6565from labscript_utils .connections import ConnectionTable
6666import labscript_devices
6767
68- from labscript_utils .labconfig import LabConfig
68+ from labscript_utils .labconfig import LabConfig , save_appconfig , load_appconfig
6969from labscript_utils .ls_zprocess import ZMQServer , ProcessTree
7070process_tree = ProcessTree .instance ()
7171process_tree .zlock_client .set_process_name ('runviewer' )
@@ -592,11 +592,8 @@ def on_load_channel_config(self):
592592 if isinstance (config_file , tuple ):
593593 config_file , _ = config_file
594594 if config_file :
595- runviewer_config = LabConfig (config_file )
596- try :
597- channels = ast .literal_eval (runviewer_config .get ('runviewer_state' , 'Channels' ))
598- except (LabConfig .NoOptionError , LabConfig .NoSectionError ):
599- channels = {}
595+ runviewer_config = load_appconfig (config_file ).get ('runviewer_state' , {})
596+ channels = runviewer_config .get ('channels' , {})
600597
601598 for row , (channel , checked ) in enumerate (channels ):
602599 check_items = self .channel_model .findItems (channel )
@@ -621,14 +618,13 @@ def on_save_channel_config(self):
621618 save_file , _ = save_file
622619
623620 if save_file :
624- runviewer_config = LabConfig (save_file )
625621
626622 channels = []
627623 for row in range (self .channel_model .rowCount ()):
628624 item = self .channel_model .item (row )
629625 channels .append ((item .text (), item .checkState () == Qt .Checked ))
630626
631- runviewer_config . set ( 'runviewer_state' , 'Channels' , pprint . pformat ( channels ) )
627+ save_appconfig ( save_file , { 'runviewer_state' : { 'channels' : channels }} )
632628
633629 def on_toggle_shutter (self , checked , current_shot ):
634630 for channel in self .shutter_lines :
0 commit comments