@@ -66,9 +66,11 @@ def __init__(self, config_file, version):
6666 def _init_ui (self ):
6767 """ Create the basic elements of the user interface.
6868 """
69+ self ._init_icons ()
70+
6971 self .setGeometry (100 , 100 , 1020 , 650 )
7072 self .setWindowTitle ('Diamond Puck Barcode Scanner' )
71- self .setWindowIcon (QtGui . QIcon ( 'web.png' ) )
73+ self .setWindowIcon (self . _window_icon )
7274
7375 self .init_menu_bar ()
7476
@@ -109,30 +111,37 @@ def _init_ui(self):
109111
110112 self .show ()
111113
114+ def _init_icons (self ):
115+ self ._window_icon = QtGui .QIcon ("..\\ resources\\ icons\\ qr_code_32.png" )
116+ self ._start_capture_icon = self .style ().standardIcon (QtGui .QStyle .SP_MediaPlay )
117+ self ._exit_icon = self .style ().standardIcon (QtGui .QStyle .SP_DialogCloseButton )
118+ self ._config_icon = self .style ().standardIcon (QtGui .QStyle .SP_FileDialogDetailedView )
119+ self ._about_icon = self .style ().standardIcon (QtGui .QStyle .SP_FileDialogInfoView )
120+
112121 def init_menu_bar (self ):
113122 """Create and populate the menu bar.
114123 """
115124 # Continuous scanner mode
116- live_action = QtGui .QAction (QtGui . QIcon ( 'open.png' ) , '&Camera Capture' , self )
125+ live_action = QtGui .QAction (self . _start_capture_icon , '&Camera Capture' , self )
117126 live_action .setShortcut ('Ctrl+W' )
118127 live_action .setStatusTip ('Capture continuously from camera' )
119128 live_action .triggered .connect (self ._on_scan_action_clicked )
120129
121130 # Exit Application
122- exit_action = QtGui .QAction (QtGui . QIcon ( 'exit.png' ) , '&Exit' , self )
131+ exit_action = QtGui .QAction (self . _exit_icon , '&Exit' , self )
123132 exit_action .setShortcut ('Ctrl+Q' )
124133 exit_action .setStatusTip ('Exit application' )
125134 exit_action .triggered .connect (self ._cleanup )
126135 exit_action .triggered .connect (QtGui .qApp .quit )
127136
128137 # Open options dialog
129- options_action = QtGui .QAction (QtGui . QIcon ( 'exit.png' ) , '&Options ' , self )
138+ options_action = QtGui .QAction (self . _config_icon , '&Config ' , self )
130139 options_action .setShortcut ('Ctrl+O' )
131140 options_action .setStatusTip ('Open Options Dialog' )
132141 options_action .triggered .connect (self ._on_options_action_clicked )
133142
134143 # Show version number
135- about_action = QtGui .QAction ("About" , self )
144+ about_action = QtGui .QAction (self . _about_icon , "About" , self )
136145 about_action .triggered .connect (self ._on_about_action_clicked )
137146
138147 # Create menu bar
@@ -143,7 +152,7 @@ def init_menu_bar(self):
143152 scan_menu = menu_bar .addMenu ('&Scan' )
144153 scan_menu .addAction (live_action )
145154
146- option_menu = menu_bar .addMenu ('&Option ' )
155+ option_menu = menu_bar .addMenu ('&Options ' )
147156 option_menu .addAction (options_action )
148157
149158 help_menu = menu_bar .addMenu ('?' )
@@ -169,7 +178,8 @@ def _on_options_action_clicked(self):
169178 self ._camera_switch .restart_live_capture_from_side ()
170179
171180 def _open_options_dialog (self ):
172- dialog = BarcodeConfigDialog (self ._config , self ._before_test_camera ) # pass the object here and trigger when the button is pressed
181+ dialog = BarcodeConfigDialog (self ._config , self ._before_test_camera )
182+ dialog .setWindowIcon (self ._config_icon )
173183 result_ok = dialog .exec_ ()
174184 return result_ok
175185
0 commit comments