Skip to content

Commit 1e078b6

Browse files
committed
I04_1-172:
- added forgotten icon to the configuration gui - added a delayed stop button layout
1 parent e1c9fa7 commit 1e078b6

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

dls_barcode/config/barcode_config_dialog.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from .camera_config_control import CameraConfigControl
33
from .store_directory_config_control import StoreDirectoryConfigControl
44

5+
from PyQt4.QtGui import QStyle
6+
57

68
class BarcodeConfigDialog(ConfigDialog):
79
""" Dialog to edit the configuration options for the program. Provides a custom control for
@@ -10,12 +12,15 @@ class BarcodeConfigDialog(ConfigDialog):
1012
def __init__(self, config, to_run_before_test_camera):
1113
ConfigDialog.__init__(self, config)
1214
self._to_run_before_test_camera = to_run_before_test_camera
13-
self._init_ui(to_run_before_test_camera)
15+
self._config_icon = self.style().standardIcon(QStyle.SP_FileDialogDetailedView)
16+
self._init_ui()
1417
self.finalize_layout()
1518

16-
def _init_ui(self, to_run_before_test_camera):
19+
def _init_ui(self):
1720
self.setGeometry(100, 100, 450, 400)
1821

22+
self.setWindowIcon(self._config_icon)
23+
1924
self._to_run_before_test_camera()
2025

2126
cfg = self._config

dls_barcode/gui/main_window.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,14 @@ def _on_scan_action_clicked(self):
124124
if not self._camera_capture_alive():
125125
self._initialise_scanner()
126126
self._restart_live_capture_from_side()
127+
self._scan_button.setDelayedStopLayout()
127128
else:
128129
self._cleanup()
130+
self._scan_button.setStartLayout()
129131

130132
def _on_options_action_clicked(self):
131133
dialog = BarcodeConfigDialog(self._config, self._cleanup)
132-
dialog.setWindowIcon(self._config_icon)
134+
self._scan_button.setStartLayout()
133135
dialog.exec_()
134136

135137
def closeEvent(self, event):
@@ -145,7 +147,6 @@ def _cleanup(self):
145147
self._camera_scanner.kill()
146148
self._camera_scanner = None
147149
self._camera_switch = None
148-
self._scan_button.setStartLayout()
149150

150151
def _initialise_scanner(self):
151152
self._camera_scanner = CameraScanner(self._result_queue, self._view_queue, self._message_queue, self._config)
@@ -257,4 +258,6 @@ def _restart_live_capture_from_top(self):
257258
def _restart_live_capture_from_side(self):
258259
self._reset_msg_timer()
259260
self._camera_switch.restart_live_capture_from_side()
260-
self._scan_button.setStopLayout()
261+
262+
263+

dls_barcode/gui/scan_button.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from __future__ import division
22

3-
3+
from PyQt4.QtCore import QTime, QTimer
44
from PyQt4.QtGui import QPushButton, QGroupBox, QVBoxLayout, QStyle
5-
from PyQt4.QtCore import Qt
65

76

87
class ScanButton(QGroupBox):
@@ -29,9 +28,16 @@ def _init_ui(self):
2928
vbox.addWidget(self._scan_button)
3029
self.setLayout(vbox)
3130

31+
# A small delay in the button layout change - process restart is slow at the moment
32+
def setDelayedStopLayout(self):
33+
self._scan_button.setDisabled(True)
34+
timer = QTimer()
35+
timer.singleShot(6000, self.setStopLayout) # 6sec delay
36+
3237
def setStopLayout(self):
3338
self._scan_button.setIcon(self._stop_capture_icon)
3439
self._scan_button.setStyleSheet("background-color: rgb(255, 0, 0)")
40+
self._scan_button.setDisabled(False)
3541

3642
def setStartLayout(self):
3743
self._scan_button.setIcon(self._start_capture_icon)

0 commit comments

Comments
 (0)