@@ -33,8 +33,6 @@ def __init__(self, widget_id: Tab, main_config: BabbleConfig, osc_queue: Queue):
3333 self .gui_tracking_fps = f"-TRACKINGFPS{ widget_id } -"
3434 self .gui_tracking_bps = f"-TRACKINGBPS{ widget_id } -"
3535 self .gui_output_graph = f"-OUTPUTGRAPH{ widget_id } -"
36- self .gui_restart_calibration = f"-RESTARTCALIBRATION{ widget_id } -"
37- self .gui_stop_calibration = f"-STOPCALIBRATION{ widget_id } -"
3836 self .gui_mode_readout = f"-APPMODE{ widget_id } -"
3937 self .gui_roi_message = f"-ROIMESSAGE{ widget_id } -"
4038 self .gui_vertical_flip = f"-VERTICALFLIP{ widget_id } -"
@@ -128,22 +126,6 @@ def __init__(self, widget_id: Tab, main_config: BabbleConfig, osc_queue: Queue):
128126 tooltip = lang ._instance .get_string ("camera.rotationTooltip" ),
129127 ),
130128 ],
131- [
132- sg .Button (
133- lang ._instance .get_string ("camera.startCalibration" ),
134- key = self .gui_restart_calibration ,
135- button_color = button_color ,
136- tooltip = lang ._instance .get_string ("camera.startCalibrationTooltip" ),
137- disabled = not self .settings_config .use_calibration ,
138- ),
139- sg .Button (
140- lang ._instance .get_string ("camera.stopCalibration" ),
141- key = self .gui_stop_calibration ,
142- button_color = button_color ,
143- tooltip = lang ._instance .get_string ("camera.startCalibrationTooltip" ),
144- disabled = not self .settings_config .use_calibration ,
145- ),
146- ],
147129 [
148130 sg .Checkbox (
149131 f'{ lang ._instance .get_string ("camera.enableCalibration" )} :' ,
@@ -388,13 +370,14 @@ def render(self, window, event, values):
388370
389371 if event == self .use_calibration :
390372 if self .settings_config .use_calibration == True :
391- window [self .gui_restart_calibration ].update (disabled = False )
392- window [self .gui_stop_calibration ].update (disabled = False )
393373 print (f'[{ lang ._instance .get_string ("log.info" )} ] { lang ._instance .get_string ("info.enabled" )} ' )
374+ # Optionally, trigger BlendShapeCalibrator reset/init here if needed
375+ playSound (os .path .join ("Audio" , "start.wav" ))
394376 else :
395- window [self .gui_restart_calibration ].update (disabled = True )
396- window [self .gui_stop_calibration ].update (disabled = True )
397377 print (f'[{ lang ._instance .get_string ("log.info" )} ] { lang ._instance .get_string ("info.disabled" )} ' )
378+ # Stop calibration if it was running
379+ if self .babble_cnn .calibration_frame_counter is not None :
380+ self .babble_cnn .calibration_frame_counter = None
398381
399382 if event == "{}+UP" .format (self .gui_roi_selection ):
400383 # Event for mouse button up in ROI mode
@@ -438,18 +421,15 @@ def render(self, window, event, values):
438421 #print(self.camera_list)
439422 window [self .gui_camera_addr ].update (values = self .camera_list ,size = (20 ,0 ))
440423
441- if event == self . gui_restart_calibration :
424+
442425 if (
443426 values [self .use_calibration ] == True
444427 ): # Don't start recording if the calibration filter is disabled.
445- self .babble_cnn .calibration_frame_counter = 1500
428+ self .babble_cnn .calibration_frame_counter = None # Disable old frame counter logic
429+ # Optionally, trigger BlendShapeCalibrator reset/init here if needed
446430 playSound (os .path .join ("Audio" , "start.wav" ))
447431
448- if event == self .gui_stop_calibration :
449- if (
450- self .babble_cnn .calibration_frame_counter != None
451- ): # Only assign the variable if we are in calibration mode.
452- self .babble_cnn .calibration_frame_counter = 0
432+ # Calibration is now controlled by the checkbox only
453433
454434 needs_roi_set = self .config .roi_window_h <= 0 or self .config .roi_window_w <= 0
455435
0 commit comments