def do_activate(self): Gtk.Application.do_activate(self) sys.excepthook = self.exception_hook # reset theme settings to defaults so we have a standard baseline settings = Gtk.Settings.get_default() if settings.get_property('gtk-theme-name') != GTK3_DEFAULT_THEME: self.logger.debug( 'resetting the gtk-theme-name property to it\'s default value') settings.set_property('gtk-theme-name', GTK3_DEFAULT_THEME) if settings.get_property('gtk-icon-theme-name') != GTK3_DEFAULT_THEME: self.logger.debug( 'resetting the gtk-icon-theme-name property to it\'s default value' ) settings.set_property('gtk-icon-theme-name', GTK3_DEFAULT_THEME) # load a custom css theme file if one is available theme_file = self.theme_file if theme_file: self.style_provider = self.load_style_css(theme_file) elif theme_file is DISABLED: self.logger.debug( 'no css theme file will be loaded (styling has been disabled)') else: self.logger.debug( 'no css theme file will be loaded (file not found)') # create and show the main window self.main_window = main.MainAppWindow(self.config, self) self.main_window.set_position(Gtk.WindowPosition.CENTER) self.main_window.show()
def do_activate(self): Gtk.Application.do_activate(self) sys.excepthook = self.exception_hook # reset theme settings to defaults so we have a standard baseline settings = Gtk.Settings.get_default() if settings.get_property('gtk-theme-name') != GTK3_DEFAULT_THEME: self.logger.debug( 'resetting the gtk-theme-name property to it\'s default value') settings.set_property('gtk-theme-name', GTK3_DEFAULT_THEME) if settings.get_property('gtk-icon-theme-name') != GTK3_DEFAULT_THEME: self.logger.debug( 'resetting the gtk-icon-theme-name property to it\'s default value' ) settings.set_property('gtk-icon-theme-name', GTK3_DEFAULT_THEME) settings.set_property('gtk-application-prefer-dark-theme', False) # load a custom css theme file if one is available theme_file = self.theme_file if theme_file: self.style_provider = self.load_style_css(theme_file) elif theme_file is DISABLED: self.logger.debug( 'no css theme file will be loaded (styling has been disabled)') else: self.logger.debug( 'no css theme file will be loaded (file not found)') # create and show the main window self.main_window = main.MainAppWindow(self.config, self) self.main_tabs = self.main_window.tabs enabled_plugins = sorted(set(self.config['plugins.enabled'])) for name in enabled_plugins: try: self.plugin_manager.load(name) self.plugin_manager.enable(name) except Exception: enabled_plugins.remove(name) self.config['plugins.enabled'].remove(name) self.logger.info("plugin '{0}' has been disabled".format(name)) gui_utilities.show_dialog_error( 'Failed To Enable Plugin', self.main_window, "Plugin '{0}' could not be enabled.".format(name)) self.config['plugins.enabled'] = enabled_plugins