From 84ef751f4393c8176f898b9a2aa519c13c95268c Mon Sep 17 00:00:00 2001 From: Rames The Generic Date: Sun, 20 Oct 2024 19:15:16 -0400 Subject: [PATCH 1/4] Fix missing locale entries --- BabbleApp/Locale/English/locale.json | 1 + BabbleApp/Locale/OwO/locale.json | 1 + BabbleApp/Locale/Pirate Speak/locale.json | 1 + BabbleApp/camera_widget.py | 4 ++-- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/BabbleApp/Locale/English/locale.json b/BabbleApp/Locale/English/locale.json index 1cc25fd..42daf24 100644 --- a/BabbleApp/Locale/English/locale.json +++ b/BabbleApp/Locale/English/locale.json @@ -55,6 +55,7 @@ "info.enterCaptureTwo": "not found, retrying...", "info.exitCaptureThread": "Exiting capture thread", "info.exitTrackingThread": "Exiting tracking thread", + "info.serialCapture": "Failed to get serial picture", "log.info": "INFO", "log.warn": "WARN", "log.error": "ERROR", diff --git a/BabbleApp/Locale/OwO/locale.json b/BabbleApp/Locale/OwO/locale.json index 76a2411..bbd3c21 100644 --- a/BabbleApp/Locale/OwO/locale.json +++ b/BabbleApp/Locale/OwO/locale.json @@ -55,6 +55,7 @@ "info.enterCaptureTwo": "not found, retrying...", "info.exitCaptureThread": "Exiting capture thread", "info.exitTrackingThread": "Exiting tracking thread", + "info.serialCapture": "Fawled to gwet seiewal pictower 3:", "log.info": "INFO", "log.warn": "WARN", "log.error": "ERROR", diff --git a/BabbleApp/Locale/Pirate Speak/locale.json b/BabbleApp/Locale/Pirate Speak/locale.json index 6fefdda..cda80f9 100644 --- a/BabbleApp/Locale/Pirate Speak/locale.json +++ b/BabbleApp/Locale/Pirate Speak/locale.json @@ -55,6 +55,7 @@ "info.enterCaptureTwo": "not found, retrying...", "info.exitCaptureThread": "Exiting capture thread", "info.exitTrackingThread": "Exiting tracking thread", + "info.serialCapture": "Failed to get serial piccure, matey!", "log.info": "INFO", "log.warn": "WARN", "log.error": "ERROR", diff --git a/BabbleApp/camera_widget.py b/BabbleApp/camera_widget.py index d96bf08..4c2be57 100644 --- a/BabbleApp/camera_widget.py +++ b/BabbleApp/camera_widget.py @@ -395,11 +395,11 @@ class CameraWidget: if self.settings_config.use_calibration == True: window[self.gui_restart_calibration].update(disabled=False) window[self.gui_stop_calibration].update(disabled=False) - print({lang._instance.get_string("info.enabled")}) + print(lang._instance.get_string("info.enabled")) else: window[self.gui_restart_calibration].update(disabled=True) window[self.gui_stop_calibration].update(disabled=True) - print(lang._instance.get_string("algoritm.disabled")) + print(lang._instance.get_string("info.disabled")) if event == "{}+UP".format(self.gui_roi_selection): # Event for mouse button up in ROI mode From 38d888bcd2bf4d61886f66ca09cb02964727ab3d Mon Sep 17 00:00:00 2001 From: Rames The Generic Date: Mon, 21 Oct 2024 17:32:59 -0400 Subject: [PATCH 2/4] Fix tab changes sometimes causing UI to hang. --- BabbleApp/camera_widget.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BabbleApp/camera_widget.py b/BabbleApp/camera_widget.py index 6fe8949..9120355 100644 --- a/BabbleApp/camera_widget.py +++ b/BabbleApp/camera_widget.py @@ -63,7 +63,7 @@ class CameraWidget: self.capture_event = Event() self.capture_queue = Queue(maxsize=2) self.roi_queue = Queue(maxsize=2) - self.image_queue = Queue(maxsize=4) + self.image_queue = Queue(maxsize=500) # This is needed to prevent the UI from freezing during widget changes. self.babble_cnn = BabbleProcessor( self.config, From 29f405f4e86f3fd9e39ecdb6dfe2ace4a42484fd Mon Sep 17 00:00:00 2001 From: Rames The Generic Date: Mon, 21 Oct 2024 18:09:47 -0400 Subject: [PATCH 3/4] Save valid int inputs as ints --- BabbleApp/camera.py | 1 - BabbleApp/camera_widget.py | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/BabbleApp/camera.py b/BabbleApp/camera.py index b312817..2095daa 100644 --- a/BabbleApp/camera.py +++ b/BabbleApp/camera.py @@ -43,7 +43,6 @@ class Camera: camera_output_outgoing: "queue.Queue(maxsize=2)", settings: BabbleSettingsConfig, ): - self.current_capture_sourc = None self.camera_status = CameraState.CONNECTING self.config = config self.settings = settings diff --git a/BabbleApp/camera_widget.py b/BabbleApp/camera_widget.py index 9120355..8c80d52 100644 --- a/BabbleApp/camera_widget.py +++ b/BabbleApp/camera_widget.py @@ -15,6 +15,7 @@ from utils.misc_utils import ( get_camera_index_by_name, bg_color_highlight, bg_color_clear, + is_valid_int_input ) from lang_manager import LocaleStringManager as lang @@ -324,11 +325,11 @@ class CameraWidget: if any(x in str(value) for x in ports): self.config.capture_source = value else: - cam = get_camera_index_by_name( - value - ) # Set capture_source to the UVC index. Otherwise treat value like an ipcam if we return none + cam = get_camera_index_by_name(value) # Set capture_source to the UVC index. Otherwise treat value like an ipcam if we return none if cam != None: - self.config.capture_source = get_camera_index_by_name(value) + self.config.capture_source = cam + elif is_valid_int_input(value): + self.config.capture_source = int(value) else: self.config.capture_source = value except ValueError: @@ -395,11 +396,11 @@ class CameraWidget: if self.settings_config.use_calibration == True: window[self.gui_restart_calibration].update(disabled=False) window[self.gui_stop_calibration].update(disabled=False) - print(lang._instance.get_string("info.enabled")) + print(f'[{lang._instance.get_string("log.info")}] {lang._instance.get_string("info.enabled")}') else: window[self.gui_restart_calibration].update(disabled=True) window[self.gui_stop_calibration].update(disabled=True) - print(lang._instance.get_string("info.disabled")) + print(f'[{lang._instance.get_string("log.info")}] {lang._instance.get_string("info.disabled")}') if event == "{}+UP".format(self.gui_roi_selection): # Event for mouse button up in ROI mode From 4c13436f94fdf0e5ea065a973b6b91a4a89f6d2c Mon Sep 17 00:00:00 2001 From: Rames The Generic Date: Mon, 21 Oct 2024 18:15:57 -0400 Subject: [PATCH 4/4] Start/Stop Calibration buttons load correct state on startup --- BabbleApp/camera_widget.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BabbleApp/camera_widget.py b/BabbleApp/camera_widget.py index 8c80d52..3edbc86 100644 --- a/BabbleApp/camera_widget.py +++ b/BabbleApp/camera_widget.py @@ -135,14 +135,14 @@ class CameraWidget: key=self.gui_restart_calibration, button_color=button_color, tooltip=lang._instance.get_string("camera.startCalibrationTooltip"), - disabled=True, + disabled=not self.settings_config.use_calibration, ), sg.Button( lang._instance.get_string("camera.stopCalibration"), key=self.gui_stop_calibration, button_color=button_color, tooltip=lang._instance.get_string("camera.startCalibrationTooltip"), - disabled=True, + disabled=not self.settings_config.use_calibration, ), ], [