diff --git a/oceano.py b/oceano.py index 4a843a5ec4fab85ab7715dd6e02520c533d78f84..95a53c1b8b575d8e1a6ccb551ba787b096e18ca3 100644 --- a/oceano.py +++ b/oceano.py @@ -18,6 +18,8 @@ ti = typeInstrument # an alias filesBrowsePosition_row = 2 filesBrowsePosition_column = 1 +# initialize filename use to save GUI configuration +configfile = 'oceano.cfg' def processArgs(): parser = argparse.ArgumentParser( @@ -54,6 +56,12 @@ def processArgs(): def defineGUI(): + # check if GUI config file exist + if args.instrument != None: + instrument_default_value = args.instrument + else: + instrument_default_value = 'CTD' + # get all devices devices = list(ti.keys()) @@ -75,7 +83,8 @@ def defineGUI(): enable_events=True), sg.FilesBrowse(key='_HIDDEN_', initial_folder=None, # row 1, col 2 tooltip='Choose one or more files')], - [sg.Combo(list(ti.keys()), enable_events=True, size=(8, 1), # row 2 + [sg.Combo(list(ti.keys()), enable_events = True, size=(8, 1), # row 2 + default_value = instrument_default_value, key='_COMBO_', tooltip='Select the instrument')], [sg.Frame(d, frameLayout[d], key='_FRAME_{:s}'.format(d) , visible=True) # row 3 for d in devices], @@ -86,7 +95,7 @@ def defineGUI(): window = sg.Window('Oceano converter').Layout(layout) window.LoadFromDisk(configfile) window.Finalize - return window + return window def updateFilesBrowseCombo(extentions, x, y): @@ -146,9 +155,6 @@ if __name__ == "__main__": parser = processArgs() args = parser.parse_args() - # initialize filename use to save GUI configuration - configfile = 'oceano.cfg' - # set looging mode if debug if args.debug: logging.basicConfig(