def load_theme_menu(self): from calibre.gui2.viewer.config import load_themes self.themes_menu.clear() for key in load_themes(): title = key[len('theme_'):] self.themes_menu.addAction(title, partial(self.load_theme, key))
def load_theme(self, theme_id): themes = load_themes() theme = themes[theme_id] opts = config(theme).parse() self.document.apply_settings(opts) if self.document.in_fullscreen_mode: self.document.switch_to_fullscreen_mode() self.setFocus(Qt.OtherFocusReason)