mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
7bc2a5a911
@ -9,6 +9,7 @@ from functools import partial
|
||||
|
||||
from qt.core import QIcon, Qt
|
||||
|
||||
from calibre.customize.ui import preferences_plugins
|
||||
from calibre.gui2.actions import InterfaceAction
|
||||
from calibre.gui2.preferences.main import Preferences
|
||||
from calibre.gui2 import error_dialog, show_restart_warning
|
||||
@ -42,6 +43,29 @@ class PreferencesAction(InterfaceAction):
|
||||
for x in (self.gui.preferences_action, self.qaction):
|
||||
x.triggered.connect(self.do_config)
|
||||
|
||||
def initialization_complete(self):
|
||||
# Add the individual preferences to the menu.
|
||||
# First, sort them into the same order as shown in the preferences dialog
|
||||
plugins = sorted([p for p in preferences_plugins()],
|
||||
key=lambda p: p.category_order * 100 + p.name_order)
|
||||
|
||||
pm = self.preferences_menu
|
||||
# The space pushes the separator a bit away from the text
|
||||
pm.addSection(_('Preferences dialogs') + ' ')
|
||||
|
||||
config_icon = QIcon.ic('config.png')
|
||||
current_cat = 0
|
||||
for p in plugins:
|
||||
if p.category_order != current_cat:
|
||||
current_cat = p.category_order
|
||||
cm = pm.addMenu(p.gui_category)
|
||||
cm.setIcon(config_icon)
|
||||
self.create_menu_action(cm, p.name, p.gui_name, icon=QIcon.ic(p.icon),
|
||||
triggered=partial(self.do_config,
|
||||
initial_plugin=(p.category, p.name),
|
||||
close_after_initial=True),
|
||||
shortcut=None)
|
||||
|
||||
def get_plugins(self):
|
||||
from calibre.gui2.dialogs.plugin_updater import (PluginUpdaterDialog,
|
||||
FILTER_NOT_INSTALLED)
|
||||
|
Loading…
x
Reference in New Issue
Block a user