Workaround the broken hackery that the DOC Input plugin does, that causes it to break the Input Options Preferences in calibre 2.0

This commit is contained in:
Kovid Goyal 2014-08-28 09:47:42 +05:30
parent 24ae2e1d75
commit 2c4ffa1700
2 changed files with 13 additions and 7 deletions

View File

@ -1048,6 +1048,11 @@ class InputOptions(PreferencesPlugin):
config_widget = 'calibre.gui2.preferences.conversion:InputOptions'
description = _('Set conversion options specific to each input format')
def create_widget(self, *args, **kwargs):
# The DOC Input plugin tries to override this
self.config_widget = 'calibre.gui2.preferences.conversion:InputOptions'
return PreferencesPlugin.create_widget(self, *args, **kwargs)
class CommonOptions(PreferencesPlugin):
name = 'Common Options'
icon = I('convert.png')

View File

@ -27,13 +27,14 @@ def config_widget_for_input_plugin(plugin):
'calibre.gui2.convert.'+name).PluginWidget
except ImportError:
# If this is not a builtin plugin, we have to import it differently
try:
ans = importlib.import_module(plugin.__module__+'.'+name).PluginWidget
except (ImportError, AttributeError, TypeError):
pass
else:
if issubclass(ans, Widget):
return ans
if plugin.__module__ and plugin.__module__.startswith('calibre_plugins.'):
try:
ans = importlib.import_module(plugin.__module__+'.'+name).PluginWidget
except (ImportError, AttributeError, TypeError):
pass
else:
if issubclass(ans, Widget):
return ans
def bulk_defaults_for_input_format(fmt):
plugin = plugin_for_input_format(fmt)