@@ -177,6 +177,7 @@ def defaults(self):
177177 datasets_filtered_keys = None
178178 input_directory = tk .StringVar ()
179179 output_directory = tk .StringVar ()
180+ last_browsed_configfile = ''
180181 subset_items = tk .StringVar ()
181182 subset_filter = tk .StringVar ()
182183 processing_thread = None
@@ -379,7 +380,7 @@ def process_thread(process_datasets, output_dir):
379380 # process
380381 path = os .path .abspath (os .path .expanduser (os .path .expandvars (path )))
381382 try :
382- process_subset (path , output_dir , True )
383+ process_subset (path , output_dir , preproc_prioritize_speed = True )
383384 except RuntimeError :
384385 txt_console .insert (tk .END , 'Error while processing dataset, stopping...' )
385386 # TODO: handle when error
@@ -394,6 +395,27 @@ def process_thread(process_datasets, output_dir):
394395 processing_thread = None
395396 processing_thread_lock .release ()
396397
398+
399+ def btn_import_config_callback ():
400+ nonlocal last_browsed_configfile
401+
402+ #
403+ initial_dir = os .path .split (last_browsed_configfile )[0 ] if last_browsed_configfile else os .path .abspath (os .path .expanduser (os .path .expandvars ('~' )))
404+ file_selected = filedialog .askopenfilename (title = 'Select JSON file to import' , initialdir = initial_dir , filetypes = [("JSON files" , "*.json" )])
405+ if file_selected is not None and file_selected != '' :
406+ last_browsed_configfile = os .path .abspath (os .path .expanduser (os .path .expandvars (file_selected )))
407+
408+ # read the configuration file
409+ txt_console .insert (tk .END , 'Importing configuration file:\n ' + last_browsed_configfile + '\n ' )
410+ if load_config (last_browsed_configfile ):
411+ txt_console .insert (tk .END , '> Import successful\n ' )
412+ else :
413+ txt_console .insert (tk .END , '> Import failed!\n ' )
414+ return
415+
416+ txt_console .see (tk .END )
417+
418+
397419 def txt_no_input_onkey (event ):
398420 # TODO: check for mac
399421 if event .state == 12 and event .keysym == 'c' :
@@ -433,7 +455,7 @@ def txt_no_input_onkey(event):
433455 y_pos += 40
434456 tk .Label (win , text = "Configuration:" , anchor = 'w' ).place (x = 5 , y = y_pos , width = window_width - 10 , height = 20 )
435457 y_pos += 20 + 5
436- tk .Button (win , text = "Import from JSON file..." , command = config_preprocessing_callback ).place (x = 10 , y = y_pos , width = window_width - 20 , height = 26 )
458+ tk .Button (win , text = "Import from JSON file..." , command = btn_import_config_callback ).place (x = 10 , y = y_pos , width = window_width - 20 , height = 26 )
437459 y_pos += 30 + 5
438460 config_btn_width = (window_width - 10 - 10 - 10 ) / 2
439461 tk .Button (win , text = "Preprocessing" , command = config_preprocessing_callback ).place (x = 10 , y = y_pos , width = config_btn_width , height = 28 )
0 commit comments