def init_resources(): dirpath = pkg_resources.resource_filename(__name__, 'icons') #@UndefinedVariable for filepath in glob.glob(os.path.join(dirpath, '*.rcc')): if not QResource.registerResource(filepath): warnings.warn('Could not register rcc: %s filepath') continue QIcon.setThemeName('pyhmsa')
def event(self, ev): """Catch system events.""" if ev.type() == QEvent.PaletteChange: # detect theme switches style = interface_style() # light or dark if style is not None: QIcon.setThemeName(style) else: QIcon.setThemeName("light") # fallback return super().event(ev)
def setTheme(self): # Make icons work on non-X11 platforms, set custom theme # if not sys.platform.startswith('linux') and not sys.platform.startswith('freebsd'): # # To enable the use of custom action icons, for now the above if statement has been # removed and the QT theme is being set to our artwork/icons folder for # all OSs. themepaths = QIcon.themeSearchPaths() themepaths.append('artwork/icons') QIcon.setThemeSearchPaths(themepaths) QIcon.setThemeName('qudiTheme')
def _window_set_theme(self, theme=None): if theme is None: default_theme = _qt_detect_theme() else: default_theme = theme theme = get_config('MNE_3D_OPTION_THEME', default_theme) stylesheet = _qt_get_stylesheet(theme) self._window.setStyleSheet(stylesheet) if _qt_is_dark(self._window): QIcon.setThemeName('dark') else: QIcon.setThemeName('light')
def setTheme(self, theme, path): """ Set icon theme for qudi app. @param str theme: Qudi theme name @param str path: search path for qudi icons """ # Make icons work on non-X11 platforms, set custom theme # if not sys.platform.startswith('linux') and not sys.platform.startswith('freebsd'): # # To enable the use of custom action icons, for now the above if statement has been # removed and the QT theme is being set to our artwork/icons folder for # all OSs. themepaths = QIcon.themeSearchPaths() themepaths.append(path) QIcon.setThemeSearchPaths(themepaths) QIcon.setThemeName(theme)
def setTheme(self, theme, path): """ Set icon theme for qudi app. @param str theme: Qudi theme name @param str path: search path for qudi icons """ # Make icons work on non-X11 platforms, set custom theme # if not sys.platform.startswith('linux') and not sys.platform.startswith('freebsd'): # # To enable the use of custom action icons, for now the above if statement has been # removed and the QT theme is being set to our artwork/icons folder for # all OSs. themepaths = QIcon.themeSearchPaths() themepaths.append(path) QIcon.setThemeSearchPaths(themepaths) QIcon.setThemeName(theme)
def __init__(self, args=None): if args is None: args = sys.argv super().__init__(args) self.setOrganizationName('chrisarndt.de') self.setOrganizationDomain('chrisarndt.de') self.setApplicationName(self.name) QSettings.setDefaultFormat(QSettings.IniFormat) self.config = QSettings() self.config.setIniCodec('UTF-8') QIcon.setThemeName(self.config.value('gui/icon_theme', "tango")) self.debug = True if '-v' in args[1:] else self.config.value( 'application/debug', False) logging.basicConfig( level=logging.DEBUG if self.debug else logging.INFO, format='%(levelname)s - %(message)s') self.mainwin = RefaceDXLibMainWin(self.tr(self.name)) self.load_database( self.config.value('database/last_opened', 'refacedx.db')) self.midiin_conn = None self.midiout_conn = None self.setup_midi_thread() # signal connections self.aboutToQuit.connect(self.quit) self.mainwin.action_open.triggered.connect(self.open_database) self.mainwin.action_quit.triggered.connect(self.quit) self.mainwin.action_import.triggered.connect(self.import_patches) self.mainwin.action_export.triggered.connect(self.export_patches) self.mainwin.action_send.triggered.connect(self.send_patches) self.mainwin.action_request.triggered.connect(self.request_patch) self.mainwin.action_delete.triggered.connect(self.delete_patches) # dialogs (initialized on-demand) self.add_patch_dialog = None self.style = DarkAppStyle(self) self.mainwin.show()