Skip to content

Commit 905f8ff

Browse files
committed
scan countdown - attempt to fix it
(cherry picked from commit f07fa71)
1 parent d588fc6 commit 905f8ff

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

dls_barcode/gui/countdown_box.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import logging
2+
13
from PyQt5 import QtCore
24
from PyQt5.QtWidgets import QLabel, QGroupBox, QVBoxLayout
35

@@ -14,6 +16,7 @@ def __init__(self):
1416
self.setTitle("Countdown")
1517
self.setMaximumHeight(100)
1618
self.setMaximumWidth(100)
19+
self._timer = None
1720
self._init_ui()
1821
self.count = None
1922

@@ -33,8 +36,12 @@ def start_countdown(self, count):
3336
self._timer.start(1000)
3437

3538
def reset_countdown(self):
36-
self._message_lbl.clear()
37-
self.count = None
39+
if self._timer is not None:
40+
self._timer.stop()
41+
self._timer = None
42+
self._message_lbl.clear()
43+
self.count = None
44+
3845

3946
def display(self):
4047
self._message_lbl.clear()

dls_barcode/main_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def initialise_scanner(self):
5757
self._camera_scanner = CameraScanner(self._result_queue, self._view_queue, self._message_queue, self._config)
5858
self._camera_switch = CameraSwitch(self._camera_scanner, self._config.top_camera_timeout)
5959
self._restart_live_capture_from_side()
60+
self._ui.resetCountdown()
6061

6162
def _camera_capture_alive(self):
6263
return self._camera_scanner is not None and self._camera_switch is not None

0 commit comments

Comments
 (0)