Skip to content

Commit f7829dc

Browse files
committed
qtvcp -change the logic of program icon setting
should set in this order: default qtvcp icon optional handler set icon (in def initialized__) optional INI based icon You can also set the icon in the handler file in 'def before_loop__' to override all of these.
1 parent e107b39 commit f7829dc

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/emc/usr_intf/qtvcp/qtvcp.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ def __init__(self):
290290
# actually build the widgets
291291
window.instance(filename=PATH.XML)
292292

293+
# add a default program icon - this might be overridden later
294+
window.setWindowIcon(QtGui.QIcon(os.path.join(PATH.IMAGEDIR, 'linuxcncicon.png')))
295+
293296
# title
294297
if INIPATH:
295298
if (INITITLE == ""):
@@ -401,17 +404,16 @@ def __init__(self):
401404
if INIPATH:
402405
self.postgui()
403406
self.postgui_cmd()
404-
if (INIICON == ""):
405-
window.setWindowIcon(QtGui.QIcon(os.path.join(PATH.IMAGEDIR, 'linuxcncicon.png')))
406-
else:
407+
# if there is a valid INI based icon path, override the default icon.
408+
if INIICON !='' and os.path.exists(os.path.join(PATH.CONFIGPATH, INIICON)):
407409
window.setWindowIcon(QtGui.QIcon(os.path.join(PATH.CONFIGPATH, INIICON)))
408-
else:
409-
window.setWindowIcon(QtGui.QIcon(os.path.join(PATH.IMAGEDIR, 'linuxcnc-wizard.gif')))
410410

411411
# catch control c and terminate signals
412412
signal.signal(signal.SIGTERM, self.shutdown)
413413
signal.signal(signal.SIGINT, self.shutdown)
414414

415+
# check for handler file and if it has 'before_loop' function
416+
# last chance to change anything before event loop.
415417
if opts.usermod and "before_loop__" in dir(window.handler_instance):
416418
LOG.debug('''Calling the handler file's before_loop__ function''')
417419
window.handler_instance.before_loop__()

0 commit comments

Comments
 (0)