1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-03-25 03:43:33 +01:00

Cleanup get_image_path usage.

This commit is contained in:
2020-04-12 19:32:51 +02:00
parent 5aa0b1a0eb
commit ea19d47ad1
6 changed files with 237 additions and 291 deletions

View File

@@ -1102,277 +1102,277 @@ plugins += [ActionAdd, ActionFetchAnnotations, ActionGenerateCatalog,
# Preferences Plugins {{{
class LookAndFeel(PreferencesPlugin):
name = 'Look & Feel'
icon = I('lookfeel.png')
gui_name = _('Look & feel')
category = 'Interface'
gui_category = _('Interface')
category_order = 1
name_order = 1
config_widget = 'ebook_converter.gui2.preferences.look_feel'
description = _('Adjust the look and feel of the calibre interface'
' to suit your tastes')
# class LookAndFeel(PreferencesPlugin):
# name = 'Look & Feel'
# icon = I('lookfeel.png')
# gui_name = _('Look & feel')
# category = 'Interface'
# gui_category = _('Interface')
# category_order = 1
# name_order = 1
# config_widget = 'ebook_converter.gui2.preferences.look_feel'
# description = _('Adjust the look and feel of the calibre interface'
# ' to suit your tastes')
class Behavior(PreferencesPlugin):
name = 'Behavior'
icon = I('config.png')
gui_name = _('Behavior')
category = 'Interface'
gui_category = _('Interface')
category_order = 1
name_order = 2
config_widget = 'ebook_converter.gui2.preferences.behavior'
description = _('Change the way calibre behaves')
# class Behavior(PreferencesPlugin):
# name = 'Behavior'
# icon = I('config.png')
# gui_name = _('Behavior')
# category = 'Interface'
# gui_category = _('Interface')
# category_order = 1
# name_order = 2
# config_widget = 'ebook_converter.gui2.preferences.behavior'
# description = _('Change the way calibre behaves')
class Columns(PreferencesPlugin):
name = 'Custom Columns'
icon = I('column.png')
gui_name = _('Add your own columns')
category = 'Interface'
gui_category = _('Interface')
category_order = 1
name_order = 3
config_widget = 'ebook_converter.gui2.preferences.columns'
description = _('Add/remove your own columns to the calibre book list')
# class Columns(PreferencesPlugin):
# name = 'Custom Columns'
# icon = I('column.png')
# gui_name = _('Add your own columns')
# category = 'Interface'
# gui_category = _('Interface')
# category_order = 1
# name_order = 3
# config_widget = 'ebook_converter.gui2.preferences.columns'
# description = _('Add/remove your own columns to the calibre book list')
class Toolbar(PreferencesPlugin):
name = 'Toolbar'
icon = I('wizard.png')
gui_name = _('Toolbars & menus')
category = 'Interface'
gui_category = _('Interface')
category_order = 1
name_order = 4
config_widget = 'ebook_converter.gui2.preferences.toolbar'
description = _('Customize the toolbars and context menus, changing which'
' actions are available in each')
# class Toolbar(PreferencesPlugin):
# name = 'Toolbar'
# icon = I('wizard.png')
# gui_name = _('Toolbars & menus')
# category = 'Interface'
# gui_category = _('Interface')
# category_order = 1
# name_order = 4
# config_widget = 'ebook_converter.gui2.preferences.toolbar'
# description = _('Customize the toolbars and context menus, changing which'
# ' actions are available in each')
class Search(PreferencesPlugin):
name = 'Search'
icon = I('search.png')
gui_name = _('Searching')
category = 'Interface'
gui_category = _('Interface')
category_order = 1
name_order = 5
config_widget = 'ebook_converter.gui2.preferences.search'
description = _('Customize the way searching for books works in calibre')
# class Search(PreferencesPlugin):
# name = 'Search'
# icon = I('search.png')
# gui_name = _('Searching')
# category = 'Interface'
# gui_category = _('Interface')
# category_order = 1
# name_order = 5
# config_widget = 'ebook_converter.gui2.preferences.search'
# description = _('Customize the way searching for books works in calibre')
class InputOptions(PreferencesPlugin):
name = 'Input Options'
icon = I('arrow-down.png')
gui_name = _('Input options')
category = 'Conversion'
gui_category = _('Conversion')
category_order = 2
name_order = 1
config_widget = 'ebook_converter.gui2.preferences.conversion:InputOptions'
description = _('Set conversion options specific to each input format')
# class InputOptions(PreferencesPlugin):
# name = 'Input Options'
# icon = I('arrow-down.png')
# gui_name = _('Input options')
# category = 'Conversion'
# gui_category = _('Conversion')
# category_order = 2
# name_order = 1
# config_widget = 'ebook_converter.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 = 'ebook_converter.gui2.preferences.conversion:InputOptions'
return PreferencesPlugin.create_widget(self, *args, **kwargs)
# def create_widget(self, *args, **kwargs):
# # The DOC Input plugin tries to override this
# self.config_widget = 'ebook_converter.gui2.preferences.conversion:InputOptions'
# return PreferencesPlugin.create_widget(self, *args, **kwargs)
class CommonOptions(PreferencesPlugin):
name = 'Common Options'
icon = I('convert.png')
gui_name = _('Common options')
category = 'Conversion'
gui_category = _('Conversion')
category_order = 2
name_order = 2
config_widget = 'ebook_converter.gui2.preferences.conversion:CommonOptions'
description = _('Set conversion options common to all formats')
# class CommonOptions(PreferencesPlugin):
# name = 'Common Options'
# icon = I('convert.png')
# gui_name = _('Common options')
# category = 'Conversion'
# gui_category = _('Conversion')
# category_order = 2
# name_order = 2
# config_widget = 'ebook_converter.gui2.preferences.conversion:CommonOptions'
# description = _('Set conversion options common to all formats')
class OutputOptions(PreferencesPlugin):
name = 'Output Options'
icon = I('arrow-up.png')
gui_name = _('Output options')
category = 'Conversion'
gui_category = _('Conversion')
category_order = 2
name_order = 3
config_widget = 'ebook_converter.gui2.preferences.conversion:OutputOptions'
description = _('Set conversion options specific to each output format')
# class OutputOptions(PreferencesPlugin):
# name = 'Output Options'
# icon = I('arrow-up.png')
# gui_name = _('Output options')
# category = 'Conversion'
# gui_category = _('Conversion')
# category_order = 2
# name_order = 3
# config_widget = 'ebook_converter.gui2.preferences.conversion:OutputOptions'
# description = _('Set conversion options specific to each output format')
class Adding(PreferencesPlugin):
name = 'Adding'
icon = I('add_book.png')
gui_name = _('Adding books')
category = 'Import/Export'
gui_category = _('Import/export')
category_order = 3
name_order = 1
config_widget = 'ebook_converter.gui2.preferences.adding'
description = _('Control how calibre reads metadata from files when '
'adding books')
# class Adding(PreferencesPlugin):
# name = 'Adding'
# icon = I('add_book.png')
# gui_name = _('Adding books')
# category = 'Import/Export'
# gui_category = _('Import/export')
# category_order = 3
# name_order = 1
# config_widget = 'ebook_converter.gui2.preferences.adding'
# description = _('Control how calibre reads metadata from files when '
# 'adding books')
class Saving(PreferencesPlugin):
name = 'Saving'
icon = I('save.png')
gui_name = _('Saving books to disk')
category = 'Import/Export'
gui_category = _('Import/export')
category_order = 3
name_order = 2
config_widget = 'ebook_converter.gui2.preferences.saving'
description = _('Control how calibre exports files from its database '
'to disk when using Save to disk')
# class Saving(PreferencesPlugin):
# name = 'Saving'
# icon = I('save.png')
# gui_name = _('Saving books to disk')
# category = 'Import/Export'
# gui_category = _('Import/export')
# category_order = 3
# name_order = 2
# config_widget = 'ebook_converter.gui2.preferences.saving'
# description = _('Control how calibre exports files from its database '
# 'to disk when using Save to disk')
class Sending(PreferencesPlugin):
name = 'Sending'
icon = I('sync.png')
gui_name = _('Sending books to devices')
category = 'Import/Export'
gui_category = _('Import/export')
category_order = 3
name_order = 3
config_widget = 'ebook_converter.gui2.preferences.sending'
description = _('Control how calibre transfers files to your '
'e-book reader')
# class Sending(PreferencesPlugin):
# name = 'Sending'
# icon = I('sync.png')
# gui_name = _('Sending books to devices')
# category = 'Import/Export'
# gui_category = _('Import/export')
# category_order = 3
# name_order = 3
# config_widget = 'ebook_converter.gui2.preferences.sending'
# description = _('Control how calibre transfers files to your '
# 'e-book reader')
class Plugboard(PreferencesPlugin):
name = 'Plugboard'
icon = I('plugboard.png')
gui_name = _('Metadata plugboards')
category = 'Import/Export'
gui_category = _('Import/export')
category_order = 3
name_order = 4
config_widget = 'ebook_converter.gui2.preferences.plugboard'
description = _('Change metadata fields before saving/sending')
# class Plugboard(PreferencesPlugin):
# name = 'Plugboard'
# icon = I('plugboard.png')
# gui_name = _('Metadata plugboards')
# category = 'Import/Export'
# gui_category = _('Import/export')
# category_order = 3
# name_order = 4
# config_widget = 'ebook_converter.gui2.preferences.plugboard'
# description = _('Change metadata fields before saving/sending')
class TemplateFunctions(PreferencesPlugin):
name = 'TemplateFunctions'
icon = I('template_funcs.png')
gui_name = _('Template functions')
category = 'Advanced'
gui_category = _('Advanced')
category_order = 5
name_order = 5
config_widget = 'ebook_converter.gui2.preferences.template_functions'
description = _('Create your own template functions')
# class TemplateFunctions(PreferencesPlugin):
# name = 'TemplateFunctions'
# icon = I('template_funcs.png')
# gui_name = _('Template functions')
# category = 'Advanced'
# gui_category = _('Advanced')
# category_order = 5
# name_order = 5
# config_widget = 'ebook_converter.gui2.preferences.template_functions'
# description = _('Create your own template functions')
class Email(PreferencesPlugin):
name = 'Email'
icon = I('mail.png')
gui_name = _('Sharing books by email')
category = 'Sharing'
gui_category = _('Sharing')
category_order = 4
name_order = 1
config_widget = 'ebook_converter.gui2.preferences.emailp'
description = _('Setup sharing of books via email. Can be used '
'for automatic sending of downloaded news to your devices')
# class Email(PreferencesPlugin):
# name = 'Email'
# icon = I('mail.png')
# gui_name = _('Sharing books by email')
# category = 'Sharing'
# gui_category = _('Sharing')
# category_order = 4
# name_order = 1
# config_widget = 'ebook_converter.gui2.preferences.emailp'
# description = _('Setup sharing of books via email. Can be used '
# 'for automatic sending of downloaded news to your devices')
class Server(PreferencesPlugin):
name = 'Server'
icon = I('network-server.png')
gui_name = _('Sharing over the net')
category = 'Sharing'
gui_category = _('Sharing')
category_order = 4
name_order = 2
config_widget = 'ebook_converter.gui2.preferences.server'
description = _('Setup the calibre Content server which will '
'give you access to your calibre library from anywhere, '
'on any device, over the internet')
# class Server(PreferencesPlugin):
# name = 'Server'
# icon = I('network-server.png')
# gui_name = _('Sharing over the net')
# category = 'Sharing'
# gui_category = _('Sharing')
# category_order = 4
# name_order = 2
# config_widget = 'ebook_converter.gui2.preferences.server'
# description = _('Setup the calibre Content server which will '
# 'give you access to your calibre library from anywhere, '
# 'on any device, over the internet')
class MetadataSources(PreferencesPlugin):
name = 'Metadata download'
icon = I('download-metadata.png')
gui_name = _('Metadata download')
category = 'Sharing'
gui_category = _('Sharing')
category_order = 4
name_order = 3
config_widget = 'ebook_converter.gui2.preferences.metadata_sources'
description = _('Control how calibre downloads e-book metadata from the net')
# class MetadataSources(PreferencesPlugin):
# name = 'Metadata download'
# icon = I('download-metadata.png')
# gui_name = _('Metadata download')
# category = 'Sharing'
# gui_category = _('Sharing')
# category_order = 4
# name_order = 3
# config_widget = 'ebook_converter.gui2.preferences.metadata_sources'
# description = _('Control how calibre downloads e-book metadata from the net')
class IgnoredDevices(PreferencesPlugin):
name = 'Ignored Devices'
icon = I('reader.png')
gui_name = _('Ignored devices')
category = 'Sharing'
gui_category = _('Sharing')
category_order = 4
name_order = 4
config_widget = 'ebook_converter.gui2.preferences.ignored_devices'
description = _('Control which devices calibre will ignore when they are connected '
'to the computer.')
# class IgnoredDevices(PreferencesPlugin):
# name = 'Ignored Devices'
# icon = I('reader.png')
# gui_name = _('Ignored devices')
# category = 'Sharing'
# gui_category = _('Sharing')
# category_order = 4
# name_order = 4
# config_widget = 'ebook_converter.gui2.preferences.ignored_devices'
# description = _('Control which devices calibre will ignore when they are connected '
# 'to the computer.')
class Plugins(PreferencesPlugin):
name = 'Plugins'
icon = I('plugins.png')
gui_name = _('Plugins')
category = 'Advanced'
gui_category = _('Advanced')
category_order = 5
name_order = 1
config_widget = 'ebook_converter.gui2.preferences.plugins'
description = _('Add/remove/customize various bits of calibre '
'functionality')
# class Plugins(PreferencesPlugin):
# name = 'Plugins'
# icon = I('plugins.png')
# gui_name = _('Plugins')
# category = 'Advanced'
# gui_category = _('Advanced')
# category_order = 5
# name_order = 1
# config_widget = 'ebook_converter.gui2.preferences.plugins'
# description = _('Add/remove/customize various bits of calibre '
# 'functionality')
class Tweaks(PreferencesPlugin):
name = 'Tweaks'
icon = I('tweaks.png')
gui_name = _('Tweaks')
category = 'Advanced'
gui_category = _('Advanced')
category_order = 5
name_order = 2
config_widget = 'ebook_converter.gui2.preferences.tweaks'
description = _('Fine tune how calibre behaves in various contexts')
# class Tweaks(PreferencesPlugin):
# name = 'Tweaks'
# icon = I('tweaks.png')
# gui_name = _('Tweaks')
# category = 'Advanced'
# gui_category = _('Advanced')
# category_order = 5
# name_order = 2
# config_widget = 'ebook_converter.gui2.preferences.tweaks'
# description = _('Fine tune how calibre behaves in various contexts')
class Keyboard(PreferencesPlugin):
name = 'Keyboard'
icon = I('keyboard-prefs.png')
gui_name = _('Shortcuts')
category = 'Advanced'
gui_category = _('Advanced')
category_order = 5
name_order = 4
config_widget = 'ebook_converter.gui2.preferences.keyboard'
description = _('Customize the keyboard shortcuts used by calibre')
# class Keyboard(PreferencesPlugin):
# name = 'Keyboard'
# icon = I('keyboard-prefs.png')
# gui_name = _('Shortcuts')
# category = 'Advanced'
# gui_category = _('Advanced')
# category_order = 5
# name_order = 4
# config_widget = 'ebook_converter.gui2.preferences.keyboard'
# description = _('Customize the keyboard shortcuts used by calibre')
class Misc(PreferencesPlugin):
name = 'Misc'
icon = I('exec.png')
gui_name = _('Miscellaneous')
category = 'Advanced'
gui_category = _('Advanced')
category_order = 5
name_order = 3
config_widget = 'ebook_converter.gui2.preferences.misc'
description = _('Miscellaneous advanced configuration')
# class Misc(PreferencesPlugin):
# name = 'Misc'
# icon = I('exec.png')
# gui_name = _('Miscellaneous')
# category = 'Advanced'
# gui_category = _('Advanced')
# category_order = 5
# name_order = 3
# config_widget = 'ebook_converter.gui2.preferences.misc'
# description = _('Miscellaneous advanced configuration')
plugins += [LookAndFeel, Behavior, Columns, Toolbar, Search, InputOptions,
CommonOptions, OutputOptions, Adding, Saving, Sending, Plugboard,
Email, Server, Plugins, Tweaks, Misc, TemplateFunctions,
MetadataSources, Keyboard, IgnoredDevices]
# plugins += [LookAndFeel, Behavior, Columns, Toolbar, Search, InputOptions,
# CommonOptions, OutputOptions, Adding, Saving, Sending, Plugboard,
# Email, Server, Plugins, Tweaks, Misc, TemplateFunctions,
# MetadataSources, Keyboard, IgnoredDevices]
# }}}

View File

@@ -95,37 +95,6 @@ class DummyReporter(object):
pass
def gui_configuration_widget(name, parent, get_option_by_name,
get_option_help, db, book_id, for_output=True):
import importlib
def widget_factory(cls):
return cls(parent, get_option_by_name,
get_option_help, db, book_id)
if for_output:
try:
output_widget = importlib.import_module(
'ebook_converter.gui2.convert.'+name)
pw = output_widget.PluginWidget
pw.ICON = I('back.png')
pw.HELP = _('Options specific to the output format.')
return widget_factory(pw)
except ImportError:
pass
else:
try:
input_widget = importlib.import_module(
'ebook_converter.gui2.convert.'+name)
pw = input_widget.PluginWidget
pw.ICON = I('forward.png')
pw.HELP = _('Options specific to the input format.')
return widget_factory(pw)
except ImportError:
pass
return None
class InputFormatPlugin(Plugin):
'''
@@ -262,17 +231,6 @@ class InputFormatPlugin(Plugin):
'''
pass
def gui_configuration_widget(self, parent, get_option_by_name,
get_option_help, db, book_id=None):
'''
Called to create the widget used for configuring this plugin in the
calibre GUI. The widget must be an instance of the PluginWidget class.
See the builtin input plugins for examples.
'''
name = self.name.lower().replace(' ', '_')
return gui_configuration_widget(name, parent, get_option_by_name,
get_option_help, db, book_id, for_output=False)
class OutputFormatPlugin(Plugin):
@@ -363,14 +321,3 @@ class OutputFormatPlugin(Plugin):
'''
pass
def gui_configuration_widget(self, parent, get_option_by_name,
get_option_help, db, book_id=None):
'''
Called to create the widget used for configuring this plugin in the
calibre GUI. The widget must be an instance of the PluginWidget class.
See the builtin output plugins for examples.
'''
name = self.name.lower().replace(' ', '_')
return gui_configuration_widget(name, parent, get_option_by_name,
get_option_help, db, book_id, for_output=True)