Skip to content

Commit 29f405f

Browse files
Save valid int inputs as ints
1 parent 38d888b commit 29f405f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

BabbleApp/camera.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def __init__(
4343
camera_output_outgoing: "queue.Queue(maxsize=2)",
4444
settings: BabbleSettingsConfig,
4545
):
46-
self.current_capture_sourc = None
4746
self.camera_status = CameraState.CONNECTING
4847
self.config = config
4948
self.settings = settings

BabbleApp/camera_widget.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
get_camera_index_by_name,
1616
bg_color_highlight,
1717
bg_color_clear,
18+
is_valid_int_input
1819
)
1920
from lang_manager import LocaleStringManager as lang
2021

@@ -324,11 +325,11 @@ def render(self, window, event, values):
324325
if any(x in str(value) for x in ports):
325326
self.config.capture_source = value
326327
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
330329
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)
332333
else:
333334
self.config.capture_source = value
334335
except ValueError:
@@ -395,11 +396,11 @@ def render(self, window, event, values):
395396
if self.settings_config.use_calibration == True:
396397
window[self.gui_restart_calibration].update(disabled=False)
397398
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")}')
399400
else:
400401
window[self.gui_restart_calibration].update(disabled=True)
401402
window[self.gui_stop_calibration].update(disabled=True)
402-
print(lang._instance.get_string("info.disabled"))
403+
print(f'[{lang._instance.get_string("log.info")}] {lang._instance.get_string("info.disabled")}')
403404

404405
if event == "{}+UP".format(self.gui_roi_selection):
405406
# Event for mouse button up in ROI mode

0 commit comments

Comments
 (0)