-
Notifications
You must be signed in to change notification settings - Fork 92
Description
This is another old issue that I had noticed long time ago, probably more than one year to this date. The window icon and Alt-Tab icon are missing and showing only "unknown application" icon instead. I think those have been missing, since Customizer has been rewritten in Python and Qt.
See the following screenshot for proof.
From my testing, loading gui.ui file in Qt 4 Designer will show both window icon and Alt-Tab icon properly. The issue is apparent only after Customizer has been installed to host system.
Then, googling for sometime leads me to this answer for the question "PyQt4: Icons are not displayed in the GUI" on Stack Overflow. The answer and its below comment hinted that icon file had unresolved path, and the solution is to assign the file in Qt resource and run pyrcc4 to convert into binary file.
Using Qt Resource (Tried method)
Based on the hinted solution above, I have personally tried and managed to fix those icons properly after few trials and errors.
-
Edit in Qt4 Designer and Edit resource in Resource Browser (bottom right corner, third tab); This will create
resources.qrcwith the following contents, whereby the path to target image is found at same path as existing:<RCC> <qresource prefix="images"> <file>../data/logo.png</file> </qresource> </RCC> -
The above file needs to be processed by
pyrcc4, which is required inMakefile; The following changes are necessary inMakefile. -
Add new line after line 12, then it will become like this:
PYUIC = pyuic4 PYRCC = pyrcc4 -
Add new line after line 42, then it will become like this:
$(PYUIC) src/gui.ui -o src/gui_ui.py $(PYRCC) src/resources.qrc -o src/resources_rc.py -
For above line, naming is important for the output file, as hinted by the following error message when I tried to run for earlier attempt for third stage of debugging:
~/test/debug3$ sudo customizer-gui Traceback (most recent call last): File "/usr/sbin/customizer-gui", line 10, in <module> import gui_ui File "/usr/share/customizer/gui_ui.py", line 317, in <module> import resources_rc ImportError: No module named resources_rc -
Finally, add new line after line 69, then it will become like this:
$(INSTALL) -m644 src/gui_ui.py $(DESTDIR)$(PREFIX)/share/customizer/ $(INSTALL) -m644 src/resources_rc.py $(DESTDIR)$(PREFIX)/share/customizer/
Above steps are explained for future reference, in case Qt Resource may be used for different purpose in this project. Also, using Qt Resource will increase the size of binary, but not the source code itself.
Using quick solution (Suggested method)
In line 434 of src/gui.py.in file, insert the following code.
MainWindow.setWindowIcon(QtGui.QIcon("@PREFIX@/share/customizer/logo.png"))
I think this is an easier and better approach to fix this issue, because this allows flexibility to replace the image file logo.png. This is useful, in case HiDPI users wish to use a higher resolution of icon image at 256 pixels that will be included in future release 4.2.0.
Since a quick solution is found, I hope to include this fix in patched release 4.1.3 instead.