|
15 | 15 | get_camera_index_by_name,
|
16 | 16 | bg_color_highlight,
|
17 | 17 | bg_color_clear,
|
| 18 | + is_valid_int_input |
18 | 19 | )
|
19 | 20 | from lang_manager import LocaleStringManager as lang
|
20 | 21 |
|
@@ -63,7 +64,7 @@ def __init__(self, widget_id: Tab, main_config: BabbleConfig, osc_queue: Queue):
|
63 | 64 | self.capture_event = Event()
|
64 | 65 | self.capture_queue = Queue(maxsize=2)
|
65 | 66 | self.roi_queue = Queue(maxsize=2)
|
66 |
| - self.image_queue = Queue(maxsize=4) |
| 67 | + self.image_queue = Queue(maxsize=500) # This is needed to prevent the UI from freezing during widget changes. |
67 | 68 |
|
68 | 69 | self.babble_cnn = BabbleProcessor(
|
69 | 70 | self.config,
|
@@ -134,14 +135,14 @@ def __init__(self, widget_id: Tab, main_config: BabbleConfig, osc_queue: Queue):
|
134 | 135 | key=self.gui_restart_calibration,
|
135 | 136 | button_color=button_color,
|
136 | 137 | tooltip=lang._instance.get_string("camera.startCalibrationTooltip"),
|
137 |
| - disabled=True, |
| 138 | + disabled=not self.settings_config.use_calibration, |
138 | 139 | ),
|
139 | 140 | sg.Button(
|
140 | 141 | lang._instance.get_string("camera.stopCalibration"),
|
141 | 142 | key=self.gui_stop_calibration,
|
142 | 143 | button_color=button_color,
|
143 | 144 | tooltip=lang._instance.get_string("camera.startCalibrationTooltip"),
|
144 |
| - disabled=True, |
| 145 | + disabled=not self.settings_config.use_calibration, |
145 | 146 | ),
|
146 | 147 | ],
|
147 | 148 | [
|
@@ -324,11 +325,11 @@ def render(self, window, event, values):
|
324 | 325 | if any(x in str(value) for x in ports):
|
325 | 326 | self.config.capture_source = value
|
326 | 327 | else:
|
327 |
| - cam = get_camera_index_by_name( |
328 |
| - value |
329 |
| - ) # Set capture_source to the UVC index. Otherwise treat value like an ipcam if we return none |
| 328 | + cam = get_camera_index_by_name(value) # Set capture_source to the UVC index. Otherwise treat value like an ipcam if we return none |
330 | 329 | if cam != None:
|
331 |
| - self.config.capture_source = get_camera_index_by_name(value) |
| 330 | + self.config.capture_source = cam |
| 331 | + elif is_valid_int_input(value): |
| 332 | + self.config.capture_source = int(value) |
332 | 333 | else:
|
333 | 334 | self.config.capture_source = value
|
334 | 335 | except ValueError:
|
@@ -395,11 +396,11 @@ def render(self, window, event, values):
|
395 | 396 | if self.settings_config.use_calibration == True:
|
396 | 397 | window[self.gui_restart_calibration].update(disabled=False)
|
397 | 398 | window[self.gui_stop_calibration].update(disabled=False)
|
398 |
| - print({lang._instance.get_string("info.enabled")}) |
| 399 | + print(f'[{lang._instance.get_string("log.info")}] {lang._instance.get_string("info.enabled")}') |
399 | 400 | else:
|
400 | 401 | window[self.gui_restart_calibration].update(disabled=True)
|
401 | 402 | window[self.gui_stop_calibration].update(disabled=True)
|
402 |
| - print(lang._instance.get_string("algoritm.disabled")) |
| 403 | + print(f'[{lang._instance.get_string("log.info")}] {lang._instance.get_string("info.disabled")}') |
403 | 404 |
|
404 | 405 | if event == "{}+UP".format(self.gui_roi_selection):
|
405 | 406 | # Event for mouse button up in ROI mode
|
|
0 commit comments