View Single Post
Old 06-29-2022, 08:36 AM   #72
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,235
Karma: 1419583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
@thiago: QApplication.instance().palette_changed.connect(wh atever)
Thanks! I will test it here.

Quote:
Originally Posted by kovidgoyal View Post
Not sure what you are saying about the themes. Are you saying that if you choose a theme for dark only and then calibre switches to light, the plugin icons dont work?
These are the steps to reproduce it:

1) Erase RCC files (icons-any, icons-light, icons-dark) to reset theme options.
2) Go to Preferences>Look and feel>Change icon theme and choose any theme for the "For light and dark" option. Don't choose anything for Light and Dark only options.
3) Now, I have no icons for my plugins.
4) Go to Preferences>Look and feel>Change icon theme and choose any theme for the "For dark only" option. Don't choose a Light only theme.
5) Now, I have icons for my plugins while my Windows is set to dark. If I change it to Light, then I have no icons again.
6) Choosing a Light and a Dark theme on calibre fix all the issues.

Quote:
Originally Posted by kovidgoyal View Post
Remind me what code you use for plugin icons?
Code:
def get_icon(icon_name):
    # Check to see whether the icon exists as a Calibre resource
    # This will enable skinning if the user stores icons within a folder like:
    # ...\AppData\Roaming\calibre\resources\images\Plugin Name\
    icon_path = os.path.join(config_dir, 'resources', 'images', PLUGIN_NAME,
                             icon_name.replace('images/', ''))
    if os.path.exists(icon_path):
        pixmap = QPixmap()
        pixmap.load(icon_path)
        return QIcon(pixmap)
    # As we did not find an icon elsewhere, look within our zip resources
    if numeric_version < (5, 99, 0):
        return get_icons(icon_name)
    else:
        return get_icons(icon_name, PLUGIN_NAME)
thiago.eec is online now