@@ -26,21 +26,14 @@ def __init__(self, *args, **kwargs):
2626
2727 self .setWindowTitle ("Quick View (QV)" )
2828
29- # Initially, only show the info about how QuickView works
30- self .widget_tool .setEnabled (False )
31- self .widget_scatter .hide ()
29+ self ._set_initial_ui ()
3230
3331 # Set scale options (with data)
3432 for cb in [self .comboBox_xscale , self .comboBox_yscale ]:
3533 cb .clear ()
3634 cb .addItem ("linear" , "linear" )
3735 cb .addItem ("logarithmic" , "log" )
3836
39- # Hide settings/events by default
40- self .widget_event .setVisible (False )
41- self .widget_settings .setVisible (False )
42- self .widget_poly .setVisible (False )
43-
4437 # settings button
4538 self .toolButton_event .toggled .connect (self .on_tool )
4639 self .toolButton_poly .toggled .connect (self .on_tool )
@@ -120,7 +113,7 @@ def __init__(self, *args, **kwargs):
120113 )
121114
122115 # set initial empty dataset
123- self .rtdc_ds = None
116+ self ._rtdc_ds = None
124117
125118 # init events/features table
126119 self .tableWidget_feats .setColumnCount (2 )
@@ -185,6 +178,34 @@ def __setstate__(self, state):
185178 self .checkBox_trace_raw .setChecked (event ["trace raw" ])
186179 self .checkBox_trace_legend .setChecked (event ["trace legend" ])
187180
181+ def _set_initial_ui (self ):
182+ # Initially, only show the info about how QuickView works
183+ self .widget_tool .setEnabled (False )
184+ self .widget_scatter .hide ()
185+ # Hide settings/events by default
186+ self .widget_event .hide ()
187+ self .widget_settings .hide ()
188+ self .widget_poly .hide ()
189+ # show the how-to label
190+ self .label_howto .show ()
191+
192+ @property
193+ def rtdc_ds (self ):
194+ """Dataset to plot; set to None initially and if the file is closed"""
195+ if self ._rtdc_ds is not None :
196+ if isinstance (self ._rtdc_ds , dclab .rtdc_dataset .RTDC_HDF5 ):
197+ if not self ._rtdc_ds ._h5 :
198+ # the file is closed
199+ self ._rtdc_ds = None
200+ # now check again
201+ if self ._rtdc_ds is None :
202+ self ._set_initial_ui ()
203+ return self ._rtdc_ds
204+
205+ @rtdc_ds .setter
206+ def rtdc_ds (self , rtdc_ds ):
207+ self ._rtdc_ds = rtdc_ds
208+
188209 def get_event_image (self , ds , event ):
189210 state = self .__getstate__ ()
190211 imkw = self .imkw .copy ()
0 commit comments