Trilarion / imperialism-remake

Imperialism remake
https://remake.twelvepm.de/
GNU General Public License v3.0
53 stars 19 forks source link

Application icon replaced by orange back arrow #7

Closed krs013 closed 6 years ago

krs013 commented 6 years ago

The code in client/client.py to set the window icon does not seem to have any effect. I may be misunderstanding what it is supposed to do, but I think the behavior we want requires a call to setWindowIcon on the QApplication instead of a QWidget.

See: https://stackoverflow.com/a/35865441/2102965

krs013 commented 6 years ago

Simply moving the line as suggested in the answer I linked fixes it on my Mac, but my Ubuntu VM doesn't work either way.

It turns out that (in a demo program) it works either way in Ubuntu, but there is some other problem that causes the icon to be replaced by an orange back arrow.

screen shot 2017-07-13 at 1 18 56 am

screen shot 2017-07-13 at 1 18 56 am

Has anyone else seen this, or is it just my system?

Trilarion commented 6 years ago

Thanks for reporting. Problems showing the application icon is clearly a bug.

QWidget has a setwindowicon function (http://doc.qt.io/qt-5/qwidget.html#windowIcon-prop) and it seems to result in the icon also been shown in the taskbar on Windows. It makes sense to set it for the whole application. As reported, Ubuntu still seems to have a problem.

In one of the next commits, I (or someone else) should set the icon on the application.

Trilarion commented 6 years ago

I can check with Ubuntu within the next five days, but not in the next two days (being abroad).

krs013 commented 6 years ago

Based on that, it looks like the best solution would be to set it for the application, since the widgets inherit the application icon when they don't have their own.

What really confuses me is where that orange arrow comes from. I've dropped debug traces in the code and checked the QIcon object returned by base.tools.load_ui_icon and it's the correct one, so I don't know how it turns out being that arrow. I can't even find an image that looks like that.

Trilarion commented 6 years ago

Icon is now set for the application in f3e105e156a3404d7d1d081898485294dcde397c. I could verify the problem with Ubuntu and will change the title of this issue accordingly.

Trilarion commented 6 years ago

Verified on Ubuntu 16.04 LTS with python3-pyqt5.

Trilarion commented 6 years ago

According to http://doc.qt.io/qt-5/appicon.html#setting-the-application-icon-on-common-linux-desktops and http://ubuntuhandbook.org/index.php/2014/03/how-to-change-an-application-icon-in-ubuntu-unity-tips/ the application icon is specified differently in Linux, mostly by Desktop entry specifications. One feature/effect is that application icons can change according to the theme.

This is probably not a bug then, just different behavior. The application icon under Linux needs to be added in a different way than for Windows and MacOs. I would include this as a task for creating a Linux package.