@@ -290,32 +290,36 @@ def __init__(self, parent=None):
290290 self .subject_tabs = detachableTabWidget (self )
291291 self .setCentralWidget (self .subject_tabs )
292292 self .subject_plots = []
293+ self .active_plots = []
293294
294295 def setup_experiment (self , experiment ):
295296 '''Create task plotters in seperate tabs for each subject.'''
296- for setup in sorted (experiment ['subjects' ].keys ()):
297+ subject_dict = experiment ['subjects' ]
298+ subjects = subject_dict .keys ()
299+ for subject in sorted (subjects ):
297300 self .subject_plots .append (Task_plot (self ))
298301 self .subject_tabs .addTab (self .subject_plots [- 1 ],
299- '{} : {}' .format (setup , experiment [ 'subjects' ][ setup ] ))
302+ '{} : {}' .format (subject_dict [ subject ][ ' setup' ], subject ))
300303
301304 def set_state_machine (self , sm_info ):
302305 '''Provide the task plotters with the state machine info.'''
303306 for subject_plot in self .subject_plots :
304307 subject_plot .set_state_machine (sm_info )
305308
306- def start_experiment (self ):
307- for subject_plot in self .subject_plots :
308- subject_plot . run_start ( False )
309+ def start_experiment (self , rig ):
310+ self .subject_plots [ rig ]. run_start ( False )
311+ self . active_plots . append ( rig )
309312
310313 def close_experiment (self ):
311314 '''Remove and delete all subject plot tabs.'''
312315 while len (self .subject_plots ) > 0 :
313316 subject_plot = self .subject_plots .pop ()
314317 subject_plot .setParent (None )
315318 subject_plot .deleteLater ()
316-
319+ self .close ()
320+
317321 def update (self ):
318322 '''Update the plots of the active tab.'''
319- for subject_plot in self .subject_plots :
320- if not subject_plot .visibleRegion ().isEmpty ():
323+ for i , subject_plot in enumerate ( self .subject_plots ) :
324+ if not subject_plot .visibleRegion ().isEmpty () and i in self . active_plots :
321325 subject_plot .update ()
0 commit comments