2323class 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
0 commit comments