@@ -814,8 +814,10 @@ def execute(self, command, *args):
814
814
feature_list_popup , self
815
815
)
816
816
self .features_popup_controller .populate_feature_list (feature_id )
817
+
817
818
# wait until close the popup windows
818
819
self .view .wait_window (feature_list_popup .popup )
820
+
819
821
# do not run acquisition if "cancel" is selected
820
822
temp = self .features_popup_controller .start_acquisiton_flag
821
823
delattr (self , "features_popup_controller" )
@@ -852,16 +854,14 @@ def execute(self, command, *args):
852
854
853
855
# clear show_img_pipe
854
856
while self .show_img_pipe .poll ():
855
- # TODO: image_id never called.
856
857
self .show_img_pipe .recv ()
857
- # image_id = self.show_img_pipe.recv()
858
858
859
859
elif command == "exit" :
860
- """Exit the program."""
861
- # Save current GUI settings to .navigate/config/experiment.yml file.
862
- self .sloppy_stop ()
863
- # self.menu_controller.feature_id_val.set(0)
860
+ """Exit the program.
864
861
862
+ Saves the current GUI settings to .navigate/config/experiment.yml file.
863
+ """
864
+ self .sloppy_stop ()
865
865
self .update_experiment_setting ()
866
866
file_directory = os .path .join (get_navigate_path (), "config" )
867
867
save_yaml_file (
@@ -918,7 +918,7 @@ def sloppy_stop(self):
918
918
self.threads_pool.createThread('model', target)
919
919
commands and the need to stop as abruptly as
920
920
possible when the user hits stop. Here we leverage
921
- ObjectInSubprocess's refusal to let us access
921
+ ObjectInSubprocess' refusal to let us access
922
922
the model from two threads to our advantage, and just
923
923
try repeatedly until we get a command in front
924
924
of the next command in the model threads_pool resource.
@@ -940,9 +940,9 @@ def capture_image(self, command, mode, *args):
940
940
Parameters
941
941
----------
942
942
command : string
943
- string = 'acquire' or 'autofocus'
943
+ 'acquire' or 'autofocus'
944
944
mode : string
945
- string = 'continuous', 'z-stack', 'single', or 'projection'
945
+ 'continuous', 'z-stack', 'single', or 'projection'
946
946
args : function-specific passes.
947
947
"""
948
948
self .camera_view_controller .image_count = 0
@@ -1009,7 +1009,16 @@ def capture_image(self, command, mode, *args):
1009
1009
)
1010
1010
# update framerate
1011
1011
stop_time = time .time ()
1012
- frames_per_second = images_received / (stop_time - start_time )
1012
+ try :
1013
+ frames_per_second = images_received / (stop_time - start_time )
1014
+ except ZeroDivisionError :
1015
+ frames_per_second = 1 / (
1016
+ self .configuration ["experiment" ]["MicroscopeState" ]["channels" ][
1017
+ "channel_1"
1018
+ ].get ("camera_exposure_time" , 200 )
1019
+ / 1000
1020
+ )
1021
+
1013
1022
# Update the Framerate in the Camera Settings Tab
1014
1023
self .camera_setting_controller .framerate_widgets ["max_framerate" ].set (
1015
1024
frames_per_second
@@ -1210,6 +1219,7 @@ def update_event(self):
1210
1219
waveform_dict = value ,
1211
1220
sample_rate = self .configuration_controller .daq_sample_rate ,
1212
1221
)
1222
+
1213
1223
elif event == "multiposition" :
1214
1224
# Update the multi-position tab without appending to the list
1215
1225
update_table (
@@ -1242,10 +1252,12 @@ def update_event(self):
1242
1252
if value ["done" ]:
1243
1253
print ("Tony Wilson done! Updating expt..." )
1244
1254
self .ao_popup_controller .update_experiment_values ()
1255
+
1245
1256
elif event == "mirror_update" :
1246
1257
if hasattr (self , "ao_popup_controller" ):
1247
1258
self .ao_popup_controller .set_widgets_from_coef (value ["coefs" ])
1248
1259
self .ao_popup_controller .plot_mirror (value )
1260
+
1249
1261
elif event == "ao_save_report" :
1250
1262
if hasattr (self , "ao_popup_controller" ):
1251
1263
self .ao_popup_controller .save_report_to_file (value )
@@ -1255,29 +1267,20 @@ def update_event(self):
1255
1267
break
1256
1268
1257
1269
elif event == "update_stage" :
1258
- # ZM: I am so sorry for this.
1259
1270
for _ in range (10 ):
1260
1271
try :
1261
1272
self .update_stage_controller_silent (value )
1262
1273
break
1263
1274
except RuntimeError :
1264
1275
time .sleep (0.001 )
1265
1276
pass
1277
+
1266
1278
elif event == "remove_positions" :
1267
1279
self .multiposition_tab_controller .remove_positions (value )
1280
+
1268
1281
elif event == "exposure_time" :
1269
1282
self .channels_tab_controller .set_exposure_time (value [0 ], value [1 ])
1270
1283
1271
- # def exit_program(self):
1272
- # """Exit the program.
1273
-
1274
- # This function is called when the user clicks the exit button in the GUI.
1275
- # """
1276
- # if messagebox.askyesno("Exit", "Are you sure?"):
1277
- # logger.info("Exiting Program")
1278
- # self.execute("exit")
1279
- # sys.exit()
1280
-
1281
1284
def add_acquisition_mode (self , name , acquisition_obj ):
1282
1285
if name in self .plugin_acquisition_modes :
1283
1286
print (f"*** plugin acquisition mode { name } exists, can't add another one!" )
0 commit comments