@@ -1278,23 +1278,11 @@ def load_channel_list(self, event=None, file_name=None, manually=False, show_pro
12781278 self .loaded_display_file = file_name , worker .hexdigest ()
12791279
12801280 else :
1281- extension = None
1281+ extension = ".dict"
12821282 info = file_name
12831283 channels = info .get ("selected_channels" , [])
12841284 self .loaded_display_file = Path (info .get ("display_file_name" , "" )), b""
12851285
1286- self .functions .update (info .get ("functions" , {}))
1287- global_vars = [
1288- line .strip ()
1289- for line in self .global_variables .splitlines ()
1290- if line .strip ()
1291- ]
1292- for line in info .get ('global_variables' , '' ).splitlines ():
1293- line = line .strip ()
1294- if line and line not in global_vars :
1295- global_vars .append (line )
1296- self .global_variables = "\n " .join (global_vars )
1297-
12981286 if channels :
12991287 iterator = QtWidgets .QTreeWidgetItemIterator (self .channels_tree )
13001288
@@ -1325,7 +1313,16 @@ def load_channel_list(self, event=None, file_name=None, manually=False, show_pro
13251313
13261314 self .clear_windows ()
13271315
1328- if extension in (".dspf" , ".dsp" ):
1316+ if extension in (".dspf" , ".dsp" , ".dict" ):
1317+ new_global_vars = "\n " .join (line .strip () for line in info .get ('global_variables' , '' ).splitlines () if line .strip ())
1318+ global_vars = "\n " .join (line .strip () for line in self .global_variables .splitlines () if line .strip ())
1319+
1320+ if new_global_vars not in global_vars :
1321+ global_vars += new_global_vars
1322+ updated_global_vars = True
1323+ else :
1324+ updated_global_vars = False
1325+
13291326 new_functions = {}
13301327
13311328 if "functions" in info :
@@ -1358,8 +1355,8 @@ def load_channel_list(self, event=None, file_name=None, manually=False, show_pro
13581355 "definition" : definition ,
13591356 }
13601357
1361- if new_functions or info . get ( "global_variables" , "" ) != self . global_variables :
1362- self .update_functions ({}, new_functions , f" { self . global_variables } \n { info . get ( 'global_variables' , '' ) } " )
1358+ if new_functions or updated_global_vars :
1359+ self .update_functions ({}, new_functions , global_vars )
13631360
13641361 windows = info .get ("windows" , [])
13651362 errors = {}
0 commit comments