mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Fix #8621 (Do not allow "Customize plugin" immediately after installation)
This commit is contained in:
parent
d06947281b
commit
c8c9ca7af9
@ -220,6 +220,12 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
_('Plugin: %s does not need customization')%plugin.name).exec_()
|
_('Plugin: %s does not need customization')%plugin.name).exec_()
|
||||||
return
|
return
|
||||||
self.changed_signal.emit()
|
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():
|
if plugin.do_user_config():
|
||||||
self._plugin_model.refresh_plugin(plugin)
|
self._plugin_model.refresh_plugin(plugin)
|
||||||
elif op == 'remove':
|
elif op == 'remove':
|
||||||
|
@ -101,28 +101,40 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
|
|||||||
self.opts = opts
|
self.opts = opts
|
||||||
self.device_connected = None
|
self.device_connected = None
|
||||||
self.gui_debug = gui_debug
|
self.gui_debug = gui_debug
|
||||||
acmap = OrderedDict()
|
self.iactions = OrderedDict()
|
||||||
for action in interface_actions():
|
for action in interface_actions():
|
||||||
if opts.ignore_plugins and action.plugin_path is not None:
|
if opts.ignore_plugins and action.plugin_path is not None:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
ac = action.load_actual_plugin(self)
|
ac = self.init_iaction(action)
|
||||||
except:
|
except:
|
||||||
# Ignore errors in loading user supplied plugins
|
# Ignore errors in loading user supplied plugins
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
if ac.plugin_path is None:
|
if action.plugin_path is None:
|
||||||
raise
|
raise
|
||||||
|
continue
|
||||||
|
|
||||||
ac.plugin_path = action.plugin_path
|
ac.plugin_path = action.plugin_path
|
||||||
ac.interface_action_base_plugin = action
|
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):
|
def initialize(self, library_path, db, listener, actions, show_gui=True):
|
||||||
opts = self.opts
|
opts = self.opts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user