Skip to content

Commit af05514

Browse files
committed
I04_1-167: added version number
1 parent 0a41ce4 commit af05514

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

dls_barcode/config/store_directory_config_control.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def before_apply(self):
1818

1919
confirm_msg = "The Startup Store Directory was changed from " + current_dir + " to\n" + new_dir + ".\n\n"\
2020
"This change will only take effect at the next startup."
21-
reply = QtGui.QMessageBox.question(self, 'Startup Store Directory',
22-
confirm_msg, QtGui.QMessageBox.Ok, QtGui.QMessageBox.Cancel)
21+
reply = QtGui.QMessageBox.information(self, 'Startup Store Directory',
22+
confirm_msg, QtGui.QMessageBox.Ok, QtGui.QMessageBox.Cancel)
2323

2424
if reply == QtGui.QMessageBox.Cancel:
2525
self.is_confirmed = False

dls_barcode/gui/main_window.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
class DiamondBarcodeMainWindow(QtGui.QMainWindow):
2424
""" Main GUI window for the Barcode Scanner App.
2525
"""
26-
def __init__(self, config_file):
26+
def __init__(self, config_file, version):
2727
super(DiamondBarcodeMainWindow, self).__init__()
2828

2929
self._config = BarcodeConfig(config_file, FileManager())
30+
self._version = version
3031

3132
# UI elements
3233
self._record_table = None
@@ -115,7 +116,7 @@ def init_menu_bar(self):
115116
live_action = QtGui.QAction(QtGui.QIcon('open.png'), '&Camera Capture', self)
116117
live_action.setShortcut('Ctrl+W')
117118
live_action.setStatusTip('Capture continuously from camera')
118-
live_action.triggered.connect(self._on_scan_menu_clicked)
119+
live_action.triggered.connect(self._on_scan_action_clicked)
119120

120121
# Exit Application
121122
exit_action = QtGui.QAction(QtGui.QIcon('exit.png'), '&Exit', self)
@@ -128,7 +129,11 @@ def init_menu_bar(self):
128129
options_action = QtGui.QAction(QtGui.QIcon('exit.png'), '&Options', self)
129130
options_action.setShortcut('Ctrl+O')
130131
options_action.setStatusTip('Open Options Dialog')
131-
options_action.triggered.connect(self._on_options_menu_clicked)
132+
options_action.triggered.connect(self._on_options_action_clicked)
133+
134+
# Show version number
135+
about_action = QtGui.QAction("About", self)
136+
about_action.triggered.connect(self._on_about_action_clicked)
132137

133138
# Create menu bar
134139
menu_bar = self.menuBar()
@@ -141,14 +146,20 @@ def init_menu_bar(self):
141146
option_menu = menu_bar.addMenu('&Option')
142147
option_menu.addAction(options_action)
143148

144-
def _on_scan_menu_clicked(self):
149+
help_menu = menu_bar.addMenu('?')
150+
help_menu.addAction(about_action)
151+
152+
def _on_about_action_clicked(self):
153+
QtGui.QMessageBox.about(self, 'About', "Version: " + self._version)
154+
155+
def _on_scan_action_clicked(self):
145156
print("MAIN: Scan menu clicked")
146157
if not self._camera_capture_alive():
147158
self._initialise_scanner()
148159

149160
self._camera_switch.restart_live_capture_from_side()
150161

151-
def _on_options_menu_clicked(self):
162+
def _on_options_action_clicked(self):
152163
result_ok = self._open_options_dialog()
153164
if not result_ok:
154165
return

dls_barcode/main.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
from dls_util import multiprocessing_support
99

1010
from PyQt4 import QtGui
11-
from gui import DiamondBarcodeMainWindow
1211
import argparse
12+
from gui import DiamondBarcodeMainWindow
13+
from version import VERSION
1314

1415
# Detect if the program is running from source or has been bundled
1516
IS_BUNDLED = getattr(sys, 'frozen', False)
@@ -19,9 +20,9 @@
1920
DEFAULT_CONFIG_FILE = "../config.ini"
2021

2122

22-
def main(config_file):
23+
def main(config_file, version):
2324
app = QtGui.QApplication(sys.argv)
24-
ex = DiamondBarcodeMainWindow(config_file)
25+
ex = DiamondBarcodeMainWindow(config_file, version)
2526
sys.exit(app.exec_())
2627

2728

@@ -37,4 +38,4 @@ def main(config_file):
3738
args = parser.parse_args()
3839
print("CONFIG: " + args.config_file)
3940

40-
main(args.config_file)
41+
main(args.config_file, VERSION)

dls_barcode/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VERSION = "vX.x.p"

0 commit comments

Comments
 (0)