@@ -174,28 +174,24 @@ def __init__(
174174 logger .info (f"Spec - Waveform Constants Path: { waveform_constants_path } " )
175175 logger .info (f"Spec - Rest API Path: { rest_api_path } " )
176176
177- # Wire up pipes
178177 #: mp.Pipe: Pipe for sending images from model to view.
179178 self .show_img_pipe = self .model .create_pipe ("show_img_pipe" )
180179
181- # save default experiment file
182180 #: string: Path to the default experiment yaml file.
183181 self .default_experiment_file = experiment_path
184182
185- # waveform setting file
186183 #: string: Path to the waveform constants yaml file.
187184 self .waveform_constants_path = waveform_constants_path
188185
189- # Configuration Reader
190186 #: ConfigurationController: Configuration Controller object.
191187 self .configuration_controller = ConfigurationController (self .configuration )
192188
193- # Initialize the View
194189 #: View: View object in MVC architecture.
195190 self .view = view (root )
196191
197- # Sub Gui Controllers
192+ #: dict: Event listeners for the controller.
198193 self .event_listeners = {}
194+
199195 #: AcquireBarController: Acquire Bar Sub-Controller.
200196 self .acquire_bar_controller = AcquireBarController (self .view .acqbar , self )
201197
@@ -235,7 +231,7 @@ def __init__(
235231 #: KeystrokeController: Keystroke Sub-Controller.
236232 self .keystroke_controller = KeystrokeController (self .view , self )
237233
238- # Exit
234+ # Exit the program when the window is closed
239235 self .view .root .protocol (
240236 "WM_DELETE_WINDOW" , self .acquire_bar_controller .exit_program
241237 )
@@ -249,22 +245,19 @@ def __init__(
249245 # self.microscope = self.configuration['configuration']
250246 # ['microscopes'].keys()[0] # Default to the first microscope
251247
252- # Initialize the menus
253248 #: MenuController: Menu Sub-Controller.
254249 self .menu_controller = MenuController (view = self .view , parent_controller = self )
255250 self .menu_controller .initialize_menus ()
256251
257252 #: dict: acquisition modes from plugins
258253 self .plugin_acquisition_modes = {}
259254
260- # add plugin menus
261255 #: PluginsController: Plugin Sub-Controller
262256 self .plugin_controller = PluginsController (
263257 view = self .view , parent_controller = self
264258 )
265259 self .plugin_controller .load_plugins ()
266260
267- # Create default data buffer
268261 #: int: Number of x_pixels from microscope configuration file.
269262 self .img_width = 0
270263
@@ -474,8 +467,10 @@ def update_experiment_setting(self):
474467 "multiposition_count"
475468 ] = len (positions )
476469
477- if self .configuration ["experiment" ]["MicroscopeState" ]["is_multiposition" ] \
478- and len (positions ) == 0 :
470+ if (
471+ self .configuration ["experiment" ]["MicroscopeState" ]["is_multiposition" ]
472+ and len (positions ) == 0
473+ ):
479474 # Update the view and override the settings.
480475 self .configuration ["experiment" ]["MicroscopeState" ][
481476 "is_multiposition"
@@ -1262,15 +1257,40 @@ def update_event(self):
12621257 print (f"*** unhandled event: { event } , { value } " )
12631258
12641259 def add_acquisition_mode (self , name , acquisition_obj ):
1260+ """Add and Acquisition Mode.
1261+
1262+ Parameters
1263+ ----------
1264+ name : string
1265+ Name of the acquisition mode.
1266+ acquisition_obj : object
1267+ Object of the acquisition mode.
1268+ """
12651269 if name in self .plugin_acquisition_modes :
12661270 print (f"*** plugin acquisition mode { name } exists, can't add another one!" )
12671271 return
12681272 self .plugin_acquisition_modes [name ] = acquisition_obj (name )
12691273 self .acquire_bar_controller .add_mode (name )
12701274
12711275 def register_event_listener (self , event_name , event_handler ):
1276+ """Register an event listener.
1277+
1278+ Parameters
1279+ ----------
1280+ event_name : string
1281+ Name of the event.
1282+ event_handler : function
1283+ Function to handle the event.
1284+ """
12721285 self .event_listeners [event_name ] = event_handler
12731286
12741287 def register_event_listeners (self , events ):
1288+ """Register multiple event listeners.
1289+
1290+ Parameters
1291+ ----------
1292+ events : dict
1293+ Dictionary of event names and handlers.
1294+ """
12751295 for event_name , event_handler in events .items ():
12761296 self .register_event_listener (event_name , event_handler )
0 commit comments