-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buttons should show icons or text (icon theme not properly set) #53
Comments
ouch, that's really weird and awful. I tested it on LinuxMint and Ubuntu 20 with gnome-shell 3.3x and it worked fine. The preferences icon name is preferences-desktop, which is a standard name of the icon naming specification, and included in the package gnome-icon-theme. So my first question is, do you have that package installed? I guess so, but just in case.. And the second question, can you fire a search of the file preferences-desktop.png? find /usr/share/icons/ -name 'preferences-desktop.png' thank you for reporting it Josh! |
I performed a fresh install this weekend and noticed this exact same thing happening with the icons. I have gnome-icon-theme installed and the find command noted returns the exact file shown (including other sizes). I'm using Pop!_OS 20.04 (Ubuntu-based) and on another machine with this exact OS it works. The only different is the other machine originally had a RC of opensnitch (v1.0.0rc11) so perhaps something was working then and simply carried forward that the current (v1.0.1) version does not? I'm certain I just don't have something installed the same as the other machine, but I don't know what to look for. If I use the Gnome Tweaks app and change the "Icons" setting under appearance to "Gnome" it works correct, but not with my distro default icons selected. I'm happy to try anything you might think it is, thanks! |
Per @ryanolton 's comment I tried changing the icon theme with gnome tweaks and indeed my icons were initially not set to a theme, once I set them to either Adwaita or Gnome the icons appeared. I then noticed that once I've set the icon set, if I use my Dark theme toggle gnome extension https://extensions.gnome.org/extension/2326/dark-theme-toggle/ the icons are unset again. So this may have been a bug with how that extension works, rather than your application. Though it might be nice if there was some kind of fallback in cases where maybe someone is using an oddball icon theme? |
Interesting finding! I really don't know if I can add a fallback for these cases. But at least I know now how to reproduce it, and maybe find a workaround. |
As far as I can tell, I can change programmatically the icon theme, but I don't see a way to check if it has been applied correctly. One option could be to check if there's no icon theme configured, and in such case display a warning dialog to the user. what do you think? At least the user will know that it's not an error in opensnitch so s/he can fix it. |
Ok, I've reproduced the issue on Pop!_OS 20.04. The default theme is under So yes, I can fallback to the default Gnome theme Adwaita, and if it doesn't work either fallback to the old "gnome" theme. you can try it by adding this lines to the end of
|
Setting the Theme programmatically via: So:
|
Hi @LaurentFough , yes, my bad, this should be it:
|
Seeing the same (better said not seeing any icons) on Debian Sid, amd64, built from git HEAD (1d49e81). I have
|
Hi @licaon-kter , do you see a warning dialog stating that your Desktop Environment doesn't have an icon theme configured? Can you launch gnome-tweaks and post what icon theme appear configured under Appearance? |
As said above already, no warning.
Dunno I don't have Gnome or |
yes, or any other tool that tell you the default icon theme configured, xfce4-settings-editor for example. I'll install xfce and see if I can reproduce it. Thank you reporting this problem. |
/LE: Do I need to logout/login to get it applied? I don't see any changes. |
ok @licaon-kter , thank you, I'll try to reproduce it with xfce + i3wm. |
@gustavo-iniguez-goya this is still happening. The only solution that's been working is still: And I think there's been a regression in the code, unless you didn't commit the snippet above # add the end of service.oy:__init__() method:
if QtGui.QIcon.hasThemeIcon("document-new") == False:
hasFallback = "fallbackThemeName" in dir(QtGui.QIcon)
if hasFallback:
fTheme = QtGui.QIcon.fallbackThemeName()
if fTheme != "":
QtGui.QIcon.setThemeName(fTheme)
else:
self._set_alternative_theme()
else:
self._set_alternative_theme()
def _set_alternative_theme(self):
themes = os.listdir("/usr/share/icons")
try:
themes.remove("HighContrast")
themes.remove("hicolor")
themes.remove("locolor")
except Exception:
pass
for theme in themes:
QtGui.QIcon.setThemeName(theme)
if QtGui.QIcon.hasThemeIcon("document-new"):
return
if QtGui.QIcon.themeName() == "" or QtGui.QIcon.hasThemeIcon("document-new") == False:
self._show_theme_empty_dialog()
def _show_theme_empty_dialog(self):
self._msg.setIcon(QtWidgets.QMessageBox.Warning)
self._msg.setWindowTitle("OpenSnitch")
self._msg.setText("Your Desktop Environment doesn't have an icon theme configured," + \
"or it lacks of some icons (document-new, document-save)." + \
"\n\nPlease, use gnome-tweaks or other tool to set an icon theme."
)
self._msg.setStandardButtons(QtWidgets.QMessageBox.Ok)
self._msg.show()
That being said; we should be able to come up with a workable solution. What are you're thoughts on including a simple UI to allow the user to select a theme? |
ok @LaurentFough , I've just tested it with Gnome/Xfce + i3wm and the icons show up.
That snippet is commited, what's the regression you are seeing?
I think this is not a problem of opensnitch itself.
This probably would be the solution. But you have to provide icons for multiple resolutions, etc. Please, follow these instructions and see if any of them make the icons show up: https://wiki.archlinux.org/index.php/Uniform_look_for_Qt_and_GTK_applications#Tips_and_tricks |
Neither of those links, had solutions that applied to me, or resolved the issue. As for the regression - not an issue - I can see you did, I was looking for a specific function order. |
More testing. I see where the error is, just need to track down why it's happening. Even though my theme is set to: "Arc" currentTheme = QtGui.QIcon.themeName()
print(currentTheme)
... And then testing to see why no icons are being set. if QtGui.QIcon.hasThemeIcon("document-new") == False:
print(currentTheme+"has no document-new icon")
|
great @LaurentFough ! thank you for analyze it. Have you checked if you have the document-* icons? Maybe the theme Arc doesn't have these icons, as it happens with the theme Pop. I removed HighContrast and lo/hicolor from themes list to test, because a system should have a theme configured. But
https://developer.gnome.org/icon-theme-spec/ In my system:
|
@LaurentFough can you try the following code snippet? add this to stats.py , at the end of the constructor, after line 387 opensnitch/ui/opensnitch/dialogs/stats.py Line 387 in 98d7cc0
|
My theme is in: /home/$USER/.local/share/icons/Arc/actions/24/document-new.png
/home/$USER/.local/share/icons/Arc/actions/24@2x/document-new.png
/home/$USER/.local/share/icons/Arc/actions/22/document-new.png
/home/$USER/.local/share/icons/Arc/actions/22@2x/document-new.png
/home/$USER/.local/share/icons/Arc/actions/16/document-new.png
/home/$USER/.local/share/icons/Arc/actions/16@2x/document-new.png |
Trying. |
That works. |
Yes, Qt has some builtin icons, so we can use them in this case: But I'd really like to know why even having the standard icons, fromTheme() doesn't find them. Can you post the output of this:
in my system after setting the hicolor theme:
|
/home/$USER/.icons/hicolor |
That seems to be the problem. We need to know why your theme is set to
|
On cinnamon or Gnome you can change the icon theme as follow:
No idea on i3. Many suggest to install lxappearance or dconf to change it. I think you should ask on i3 or Arch forums to get more help. Anyway, I'll commit the changes to fallback to the Qt built-in icons in case the document-* icons are missing. |
Yes. I've run this snippet previously, while debugging. I do have Let me do some more digging.
|
There're several situations where the icons of the app don't show up: - icon theme not configured. - icon theme configured but lacks standard icons defined by the standard (freedesktop). - icon theme configured but Qt doesn't load it. If we fall into any of these cases, use the Qt built-in icons . More information on this issue: #53 * removed non-used imports.
hey @LaurentFough , did you have the chance to dig more on this issue? Otherwise I'll close it. |
I did. But nothing certain stood out. I'm still just editing the source and setting my theme manually; as previously described. |
I think the last commit in 1.3_0rc2 works. It's still not respecting my currently set theme, but all app buttons have icons. Thanks. |
Great! thank you very much for your feedback Laurent :) I'll close this issue for now. |
Hi there, I'm Josh, I'm really interested in the project as there aren't many other similar applications available for Debian/Gnome with an easy to use UI.
Describe the bug
Main buttons and buttons on detail screens / tabs have no icons or text to indicate what they do. The buttons do work though.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Button icons or text should show to indicate what the button does.
Screenshots
OS
Additional context
N/A
The text was updated successfully, but these errors were encountered: