Skip to content
Snippets Groups Projects
Commit 6a18ae74 authored by jacques Grelet's avatar jacques Grelet
Browse files

add extention as lower and upper

use a list for ti next time
parent a1515006
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ import os ...@@ -11,7 +11,7 @@ import os
import distutils.util as du import distutils.util as du
# typeInstrument is a dictionary as key: files extension # typeInstrument is a dictionary as key: files extension
typeInstrument = {'CTD': 'cnv', 'XBT': 'edf', 'LADCP': 'lad', 'TSG': 'COLCOR'} typeInstrument = {'CTD': 'CNV', 'XBT': 'EDF', 'LADCP': 'LAD', 'TSG': 'COLCOR'}
ti = typeInstrument # an alias ti = typeInstrument # an alias
...@@ -51,8 +51,10 @@ def defineGUI(): ...@@ -51,8 +51,10 @@ def defineGUI():
enable_events=True), enable_events=True),
sg.FilesBrowse(key='_HIDDEN_', sg.FilesBrowse(key='_HIDDEN_',
tooltip='Choose one or more files', tooltip='Choose one or more files',
initial_folder='data/{}'.format(ti[device]), initial_folder='data/{}'.format(
file_types=(("{} files".format(ti[device]), "*.{}".format(ti[device])),))], ti[device].lower()),
)],
# file_types=(("{} files".format(ti[device]), "*.{}".format(ti[device])),))],
[sg.Combo(list(ti.keys()), enable_events=True, [sg.Combo(list(ti.keys()), enable_events=True,
key='_COMBO_', tooltip='Select the instrument')], key='_COMBO_', tooltip='Select the instrument')],
* [[sg.Checkbox(k, key=k, * [[sg.Checkbox(k, key=k,
...@@ -67,6 +69,14 @@ def defineGUI(): ...@@ -67,6 +69,14 @@ def defineGUI():
return window return window
def updateFilesBrowseCombo(extention):
e = window.Rows[1][2]
e.FileTypes = (("{} files".format(
extention), "*.{}".format(extention)), ("{} files".format(
extention.lower()), "*.{}".format(extention.lower())))
window.Finalize
def process(args, cfg, ti): def process(args, cfg, ti):
''' '''
Extract data from ASCII files and return FileExtractor instannce and array size of extracted data Extract data from ASCII files and return FileExtractor instannce and array size of extracted data
...@@ -127,7 +137,9 @@ if __name__ == "__main__": ...@@ -127,7 +137,9 @@ if __name__ == "__main__":
# test arguements from sys.argv, args is never to None with default option set # test arguements from sys.argv, args is never to None with default option set
if args.gui or len(sys.argv) == 1: if args.gui or len(sys.argv) == 1:
# setup the GUI windows Layout
window = defineGUI() window = defineGUI()
updateFilesBrowseCombo(ti[device])
# main GUI loop # main GUI loop
while True: while True:
...@@ -144,10 +156,7 @@ if __name__ == "__main__": ...@@ -144,10 +156,7 @@ if __name__ == "__main__":
if event is '_COMBO_': if event is '_COMBO_':
# you have to go into the bowels of the pygi code, to get the instance of the Combo # you have to go into the bowels of the pygi code, to get the instance of the Combo
# by the line and column number of the window to update its "fileType" property. # by the line and column number of the window to update its "fileType" property.
e = window.Rows[1][2] updateFilesBrowseCombo(ti[values['_COMBO_']])
e.FileTypes = (("{} files".format(
ti[values['_COMBO_']]), "*.{}".format(ti[values['_COMBO_']])),)
window.Finalize
# update the Multilines instance from FilesBrowse return # update the Multilines instance from FilesBrowse return
if event is '_HIDDEN_': if event is '_HIDDEN_':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment