Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Oceano2python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
US191
Oceano2python
Commits
82ae38ea
Commit
82ae38ea
authored
5 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
works GUI CTD, XBT and LADCP
parent
9d288c59
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+1
-1
1 addition, 1 deletion
Makefile
oceano.py
+17
-10
17 additions, 10 deletions
oceano.py
with
18 additions
and
11 deletions
Makefile
+
1
−
1
View file @
82ae38ea
...
...
@@ -38,7 +38,7 @@ ladcp:
$(
PYTHON
)
$(
MAIN
)
$(
OPTIONS_LADCP
)
$(
GUI
)
build
:
pyinstaller
-wF
$(
MAIN
)
pyinstaller
-wF
--clean
$(
MAIN
)
runc
:
dist/
$(
PROJECT
)
This diff is collapsed.
Click to expand it.
oceano.py
+
17
−
10
View file @
82ae38ea
import
argparse
import
sys
import
re
# import myPySimpleGUI as sg
import
PySimpleGUI
as
sg
import
toml
...
...
@@ -73,11 +74,11 @@ def defineGUI():
sg
.
ChangeLookAndFeel
(
'
SandyBeach
'
)
frameLayout
=
{}
# define a frame layout for each instrument (device)
# define a frame layout for each instrument (device)
with composite key as PRES_CTD, TEMP_XBT
for
d
in
devices
:
keys
=
cfg
[
'
split
'
][
d
.
lower
()].
keys
()
# List comprehensions
frameLayout
[
d
]
=
[[
sg
.
Checkbox
(
k
,
key
=
k
,
frameLayout
[
d
]
=
[[
sg
.
Checkbox
(
k
,
key
=
'
{:s}_{:s}
'
.
format
(
k
,
d
)
,
tooltip
=
'
Select the extract the physical parameter {}
'
.
format
(
k
))]
for
k
in
keys
]
# define GUI layout
...
...
@@ -96,9 +97,10 @@ def defineGUI():
# [sg.CloseButton('Run'), sg.CloseButton('Cancel')]])
# create a local instance windows used to reload the saved config from file
window
=
sg
.
Window
(
'
Oceano converter
'
).
Layout
(
layout
)
window
.
LoadFromDisk
(
configfile
)
window
=
sg
.
Window
(
'
Oceano converter
'
,
layout
)
window
.
Finalize
#window.LoadFromDisk(configfile)
return
window
...
...
@@ -132,7 +134,7 @@ def process(args, cfg, ti):
fe: FileExtractor
n, m: array size
'''
print
(
'
processing...
'
)
# check if no file selected or cancel button pressed
logging
.
debug
(
"
File(s): {}, config: {}, Keys: {}
"
.
format
(
...
...
@@ -185,6 +187,7 @@ if __name__ == "__main__":
window
=
defineGUI
()
device
=
window
.
FindElement
(
'
_COMBO_
'
).
DefaultValue
keys
=
cfg
[
'
split
'
][
device
.
lower
()].
keys
()
# can't update combo with FindElement('_HIDDEN_').Update(), we use this function
# with hardcoded FilesBrowseCombo position
updateFilesBrowseCombo
(
...
...
@@ -204,7 +207,7 @@ if __name__ == "__main__":
while
True
:
# display the main windows
event
,
values
=
window
.
Read
()
print
(
event
,
values
)
#
print(event, values)
if
event
==
'
Cancel
'
or
event
==
None
:
raise
SystemExit
(
"
Cancelling: user exit
"
)
...
...
@@ -238,12 +241,16 @@ if __name__ == "__main__":
# debug return values from GUI
logging
.
debug
(
"
Event: {}, Values: {}
"
.
format
(
event
,
values
))
# extract selected parameters (true) from dict values
new_values
=
values
.
copy
()
# extract selected parameters (true) from dict values
only for selected device
args
.
keys
=
[]
for
k
in
values
.
keys
():
if
k
[
0
]
==
'
_
'
or
values
[
k
]
==
False
:
del
new_values
[
k
]
args
.
keys
=
new_values
.
keys
()
continue
# check if values['_COMBO_'] == device
if
not
values
[
'
_COMBO_
'
]
in
k
:
continue
else
:
args
.
keys
.
append
(
re
.
sub
(
'
_\w+$
'
,
''
,
k
))
# process of files start here
fe
=
process
(
args
,
cfg
,
values
[
'
_COMBO_
'
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment