Skip to content
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

[OpenSuSE rolling] Missing icons in SSH private key buttons (BiT root) #1364

Closed
ont4300 opened this issue Nov 17, 2022 · 22 comments
Closed

[OpenSuSE rolling] Missing icons in SSH private key buttons (BiT root) #1364

ont4300 opened this issue Nov 17, 2022 · 22 comments
Assignees
Labels
Bug Cosmetics appearance, icons, themes Distro-Specific only for certain distributions, desktop environments or display servers Qt Qt bugs, code or features

Comments

@ont4300
Copy link

ont4300 commented Nov 17, 2022

Fresh install of 1.3.2 on Opensuse Tumbleweed.

The symbols in the push buttons beside the private key input box are missing. This applies to backintime-qt_polkit. The symbols are there when running backintime_qt.

backman missing icons

@ont4300
Copy link
Author

ont4300 commented Nov 17, 2022

I should add that this occurs when running as root... Tom.

@emtiu emtiu added Qt Qt bugs, code or features Distro-Specific only for certain distributions, desktop environments or display servers Bug labels Nov 17, 2022
@emtiu emtiu changed the title Missing symbols in push buttons [OpenSuSE rolling] Missing symbols in push buttons Nov 17, 2022
@emtiu
Copy link
Member

emtiu commented Nov 17, 2022

Thank you for your report! This is likely related to #1306, so maybe @aryoda could have a look :)

@ont4300
Copy link
Author

ont4300 commented Nov 17, 2022

I've been thinking though (always dangerous at best!).

If I run backintime-qt_polkit, I am running the backup as root. In this case, I should be using the ssh keys for the root user and not any other user. I cannot change the private key settings. That is, the keys have to be from the root directory. In this case, not showing the symbols for "searching for a key", or "adding a key" would properly be blanked out.

In addition, if I click on where the button where the directory icon would be, the program presents a a directory window that can be scrolled through. However, a selected file is not moved to the private key window, and no hidden files or directories are shown.

I think this is what is going on. Whoever wrote the code was correct in preventing us from making a mistake.

Perhaps some mention of this should be made in the documentation.

Thanks... Tom.

@aryoda
Copy link
Contributor

aryoda commented Nov 17, 2022

Which desktop environment do you use? KDE, Gnome3...?

Could you please post the output of this diagnostics code here (copy into a terminal):

# Determine the display server
echo $XDG_SESSION_TYPE 

# if you are using X11:
pkexec env DISPLAY=$DISPLAY XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR XAUTHORITY=$XAUTHORITY python3 -c "from PyQt5.QtGui import QIcon; from PyQt5.QtWidgets import QSystemTrayIcon,QApplication; app = QApplication(['']); print('isSystemTrayAvailable: ' + str(QSystemTrayIcon.isSystemTrayAvailable())); print('Theme name: ' + QIcon.themeName()); print('has theme icon <document-save>: ' + str(QIcon.hasThemeIcon('document-save'))); print('themeSearchPaths: ' + str(QIcon.themeSearchPaths())); print('fallbackSearchPaths: ' + str(QIcon.fallbackSearchPaths()))"

# if you are using Wayland:
pkexec env QT_QPA_PLATFORM=wayland-egl XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR XAUTHORITY=$XAUTHORITY python3 -c "from PyQt5.QtGui import QIcon; from PyQt5.QtWidgets import QSystemTrayIcon,QApplication; app = QApplication(['']); print('isSystemTrayAvailable: ' + str(QSystemTrayIcon.isSystemTrayAvailable())); print('Theme name: ' + QIcon.themeName()); print('has theme icon <document-save>: ' + str(QIcon.hasThemeIcon('document-save'))); print('themeSearchPaths: ' + str(QIcon.themeSearchPaths())); print('fallbackSearchPaths: ' + str(QIcon.fallbackSearchPaths()))"

I suspect missing icons like reported in some other issues (missing tray icon) and need to know the theme settings that lack some icons...

@aryoda aryoda changed the title [OpenSuSE rolling] Missing symbols in push buttons [OpenSuSE rolling] Missing icons in SSH private key buttons Nov 17, 2022
@ont4300
Copy link
Author

ont4300 commented Nov 17, 2022 via email

@aryoda
Copy link
Contributor

aryoda commented Nov 17, 2022

I have looked-up the icon file names in the source code. Could you please check if the icon files exist in your theme's icon folder by showing the output of these commands:

cd /usr/share/icons/hicolor
find | grep folder
find | grep list-add

I expect no exact hits (eg. no folder.png or list-add.png)

@ont4300
Copy link
Author

ont4300 commented Nov 17, 2022 via email

@aryoda
Copy link
Contributor

aryoda commented Nov 18, 2022

OK, THX, the reason for the missing icons is:
Not all icon themes include every single icon specified in the FreeDesktop specification.

It is related to #1306 and could be fixed together. In know now what to do to fix the missing icons but the fix will not be as easy as I initially thought (requires a Qt5 object which would create a circular import dependency - it looks like I have to do a bigger refactoring to fix this).

I will try to find a first work-around by setting the fallback icon theme to a most-likely installed one.

Regarding your other findings when you click on the first button to select a private key file:

However, a selected file is not moved to the private key window

Do you mean, the selected file is not put into the "private key" text field after clicking on "Open"?
I could neither reproduce nor see indications for this behavior (running as root) in the source code:

def btnSshPrivateKeyFileClicked(self):
old_file = self.txtSshPrivateKeyFile.text()
if old_file:
start_dir = self.txtSshPrivateKeyFile.text()
else:
start_dir = self.config.sshPrivateKeyFolder()
f = qttools.getOpenFileName(self, _('SSH private key'), start_dir)
if f:
self.txtSshPrivateKeyFile.setText(f)

Could you please check this another time and provide more detailed instructions to reproduce this.

and no hidden files or directories are shown.

That is correct and by default. To show hidden files you normally do a right click an check the "show hidden files" box:

show hidden files

@ont4300
Copy link
Author

ont4300 commented Nov 18, 2022 via email

@aryoda
Copy link
Contributor

aryoda commented Nov 18, 2022

it populated the private key box. However, I could not edit the text in the private key box. I guess that is the proper operation.

Yes, editing the private key file URI is not allowed, it is shown read-only and you only change it by selecting another one
(I just realized there seems to be no way to delete it ;-)

I tried clicking the + button but nothing happened. Don't know if that is right.

The "+" button is meant to generate a new PPK and is only possible if you have not yet selected any private key file so this is correct to (even though I don't like disabled button without any indication why it is disabled).

@aryoda
Copy link
Contributor

aryoda commented Nov 18, 2022

Could you please show me your installed icon themes (because there are two workarounds: 1. Install a supported icon theme like oxygen 2. Add one of your themes that contains our required icons to the list of supported and probed themes):

dir /usr/share/icons

Edit: My workaround would be to change the list of probed themes here in your /usr/share/backintime/qt/icon.py file:

backintime/qt/icon.py

Lines 19 to 22 in 675c8b4

for theme in ('ubuntu-mono-dark', 'gnome', 'oxygen'):
if not QIcon.fromTheme('document-save').isNull():
break
QIcon.setThemeName(theme)

by adding your installed themes (that contain the missing files - find/grep it) to the list, eg.

for theme in ('ubuntu-mono-dark', 'gnome', 'oxygen', "Adwaita", "breeze", "HighContrast"):

Edit: Could you please show me the active style (part of the "theme") and which styles are really supported on your computer:

# Show active and supported styles in Qt5
pkexec env DISPLAY=$DISPLAY XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR XAUTHORITY=$XAUTHORITY python3 -c "from PyQt5.QtGui import QIcon; from PyQt5.QtWidgets import QSystemTrayIcon,QApplication,QStyleFactory; app = QApplication(['']); print(f'QT style: {app.style().objectName()}'); print(f'QT supported styles: {QStyleFactory.keys()}')"
# On my Ubuntu 20.04 with Gnome3:
# QT style: fusion
# QT supported styles: ['Breeze', 'cleanlooks', 'gtk2', 'cde', 'motif', 'plastique', 'qt5ct-style', 'Windows', 'Fusion']

The thing is: Themes must be installed via a (distro) package to have all files available. Qt5 does check this and ignores non-available styles (part of a"theme").

You can enforce a different supported style with this command (and check if all icons are visible in BiT then):

# use a style name from QT supported styles (the name is case-insensitive)
pkexec env QT_STYLE_OVERRIDE=oxygen backintime-qt_polkit --debug

@buhtz
Copy link
Member

buhtz commented Nov 18, 2022

As requested... Tom.

Sorry, I messed up with the GitHub frontend and deleted some parts of your post. This was a mistake. My apologize.

@ont4300
Copy link
Author

ont4300 commented Nov 18, 2022 via email

@aryoda
Copy link
Contributor

aryoda commented Nov 18, 2022

dir /usr/share/icons
drwxr-xr-x 1 root root 70 Nov 15 11:34 oxygen
Although the directory exists the Oxygen icon set does not show up in the KDE Settings program.
I installed oxygen5-icon-theme using Yast, and the icon set showed up (System Settings --> Appearance --> Icons).
the icons now exist in the buttons.

THX for publishing your solution!

I did some tests and think the pure existence of the icon folders does not imply the style/theme is fully installed:

  • normally a theme/style must be installed via a (distro) package and support Qt5
  • Not every theme/style is available in any environment (eg. qt5ct works only on X11, not on Wayland).

So the only reliable diagnostics is to ask Qt5 which styles are available (see the code in the edit of my comment here: #1364 (comment)).

Would it be possible to show me the output of these commands with and without the installed oxygen5-icon-theme so that I can confirm that my intended fix will work. Sorry for your extra work but I want to be sure about the reason...).

@ont4300
Copy link
Author

ont4300 commented Nov 18, 2022

What commands? Running BIT or file listing?

@aryoda
Copy link
Contributor

aryoda commented Nov 18, 2022

What commands? Running BIT or file listing?

# Show active and supported styles in Qt5
pkexec env DISPLAY=$DISPLAY XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR XAUTHORITY=$XAUTHORITY python3 -c "from PyQt5.QtGui import QIcon; from PyQt5.QtWidgets import QSystemTrayIcon,QApplication,QStyleFactory; app = QApplication(['']); print(f'QT style: {app.style().objectName()}'); print(f'QT supported styles: {QStyleFactory.keys()}')"

@ont4300
Copy link
Author

ont4300 commented Nov 18, 2022 via email

@aryoda
Copy link
Contributor

aryoda commented Nov 18, 2022

QT style: fusion
QT supported styles: ['Breeze', 'gtk2', 'Windows', 'Fusion']

Is this with or without oxygen5-icon-theme because I don't see oxygen in the list of supported styles?

For me it is interesting to see if the supported styles did change after installing oxygen5-icon-theme (this requires de-installation of this package to run my script + re-installing it and run my script again).

@ont4300
Copy link
Author

ont4300 commented Nov 18, 2022 via email

@aryoda
Copy link
Contributor

aryoda commented Nov 18, 2022

So, if you want to use the full Oxygen, you have to install both the theme and icon set [2 separate packages].
In this case, installing the icons alone solved the problems of the missing icons on the buttons.

Perfect summary on how to fix this issue 🏆

THX a lot for your really great testing support!

I will now prepare a fix for the upcoming BiT release to

  • [DONE] improve the debug output
  • [CANCELED -> probing improved] disable the internal logic which probes different themes since it may end up in activating a non-installed theme (oxygen)

    backintime/qt/icon.py

    Lines 19 to 22 in 675c8b4

    for theme in ('ubuntu-mono-dark', 'gnome', 'oxygen'):
    if not QIcon.fromTheme('document-save').isNull():
    break
    QIcon.setThemeName(theme)
  • [DONE] extend the README.md to describe the dependencies of theme and icon packages
  • [POSTPONED] (most-probably) also fix Tray icon missing/empty/not shown correctly #1306 after having reproduced it (looks like the same underlying problem)

Edit: I have just opened a PR #1367 as "partial fix" adding the "DONE" parts of above list.
The "POSTPONED" parts I will implement separately with #1306 since I need to reproduce the tray icon issues first and then jointly fix it (incl. solving the icon loader issue from described here).

@ont4300
Copy link
Author

ont4300 commented Nov 18, 2022 via email

@aryoda aryoda self-assigned this Nov 22, 2022
@aryoda aryoda changed the title [OpenSuSE rolling] Missing icons in SSH private key buttons [OpenSuSE rolling] Missing icons in SSH private key buttons (BiT root) Nov 24, 2022
@aryoda aryoda added the Cosmetics appearance, icons, themes label Dec 21, 2022
@buhtz buhtz added this to the 1.3.5 or 1.4.0 milestone Mar 7, 2023
aryoda added a commit that referenced this issue Jul 17, 2023
…" issues (#1159, #1236, #1364)

Candidate to fix all major sys-tray icon and missing app icon issues (#1159, #1236, #1306, #1364).
Refactor qtsystrayiconplugin.py
@aryoda
Copy link
Contributor

aryoda commented Sep 4, 2023

I am closing this now as fixed and will be contained in the next release.

Please open a new issue in case of any problems.

@buhtz buhtz closed this as completed Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Cosmetics appearance, icons, themes Distro-Specific only for certain distributions, desktop environments or display servers Qt Qt bugs, code or features
Projects
None yet
Development

No branches or pull requests

4 participants