diff --git a/src/calibre/gui2/preferences/plugins.py b/src/calibre/gui2/preferences/plugins.py index b00a485566..9e3b1b9d4a 100644 --- a/src/calibre/gui2/preferences/plugins.py +++ b/src/calibre/gui2/preferences/plugins.py @@ -220,6 +220,12 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): _('Plugin: %s does not need customization')%plugin.name).exec_() return self.changed_signal.emit() + from calibre.customize import InterfaceActionBase + if isinstance(plugin, InterfaceActionBase) and not getattr(plugin, + 'actual_iaction_plugin_loaded', False): + return error_dialog(self, _('Must restart'), + _('You must restart calibre before you can' + ' configure this plugin'), show=True) if plugin.do_user_config(): self._plugin_model.refresh_plugin(plugin) elif op == 'remove': diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 5fe630691c..d6d6b7fd01 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -101,28 +101,40 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ self.opts = opts self.device_connected = None self.gui_debug = gui_debug - acmap = OrderedDict() + self.iactions = OrderedDict() for action in interface_actions(): if opts.ignore_plugins and action.plugin_path is not None: continue try: - ac = action.load_actual_plugin(self) + ac = self.init_iaction(action) except: # Ignore errors in loading user supplied plugins import traceback traceback.print_exc() - if ac.plugin_path is None: + if action.plugin_path is None: raise + continue ac.plugin_path = action.plugin_path ac.interface_action_base_plugin = action - if ac.name in acmap: - if ac.priority >= acmap[ac.name].priority: - acmap[ac.name] = ac - else: - acmap[ac.name] = ac - self.iactions = acmap + self.add_iaction(ac) + + def init_iaction(self, action): + ac = action.load_actual_plugin(self) + ac.plugin_path = action.plugin_path + ac.interface_action_base_plugin = action + action.actual_iaction_plugin_loaded = True + return ac + + def add_iaction(self, ac): + acmap = self.iactions + if ac.name in acmap: + if ac.priority >= acmap[ac.name].priority: + acmap[ac.name] = ac + else: + acmap[ac.name] = ac + def initialize(self, library_path, db, listener, actions, show_gui=True): opts = self.opts