1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-07 21:43:31 +02:00

Removed gettext related functions

This commit is contained in:
2020-05-03 19:00:20 +02:00
parent 35445cb736
commit 212cb56d42
92 changed files with 1505 additions and 1605 deletions

View File

@@ -55,10 +55,10 @@ class Plugin(object):
version = (1, 0, 0)
#: A short string describing what this plugin does
description = _('Does absolutely nothing')
description = 'Does absolutely nothing'
#: The author of this plugin
author = _('Unknown')
author = 'Unknown'
#: When more than one plugin exists for a filetype,
#: the plugins are run in order of decreasing priority.
@@ -76,7 +76,7 @@ class Plugin(object):
#: The type of this plugin. Used for categorizing plugins in the
#: GUI
type = _('Base')
type = 'Base'
def __init__(self, plugin_path):
self.plugin_path = plugin_path
@@ -264,7 +264,7 @@ class FileTypePlugin(Plugin):
#: on the final file produced by the conversion output plugin.
on_postprocess = False
type = _('File type')
type = 'File type'
def run(self, path_to_ebook):
"""
@@ -335,7 +335,7 @@ class MetadataReaderPlugin(Plugin):
version = numeric_version
author = 'Kovid Goyal'
type = _('Metadata reader')
type = 'Metadata reader'
def __init__(self, *args, **kwargs):
Plugin.__init__(self, *args, **kwargs)
@@ -367,7 +367,7 @@ class MetadataWriterPlugin(Plugin):
version = numeric_version
author = 'Kovid Goyal'
type = _('Metadata writer')
type = 'Metadata writer'
def __init__(self, *args, **kwargs):
Plugin.__init__(self, *args, **kwargs)
@@ -398,7 +398,7 @@ class CatalogPlugin(Plugin):
#: For example: 'epub' or 'xml'
file_types = set()
type = _('Catalog generator')
type = 'Catalog generator'
#: CLI parser options specific to this plugin, declared as namedtuple
#: Option:
@@ -406,8 +406,8 @@ class CatalogPlugin(Plugin):
#: from collections import namedtuple
#: Option = namedtuple('Option', 'option, default, dest, help')
#: cli_options = [Option('--catalog-title', default = 'My Catalog',
#: dest = 'catalog_title', help = (_('Title of generated catalog. '
#: '\nDefault:') +
#: dest = 'catalog_title', help = ('Title of generated catalog. '
#: '\nDefault:' +
#: " '" + '%default' + "'"))]
#: cli_options parsed in
#: ebook_converter.db.cli.cmd_catalog:option_parser()
@@ -511,7 +511,7 @@ class InterfaceActionBase(Plugin):
supported_platforms = ['windows', 'osx', 'linux']
author = 'Kovid Goyal'
type = _('User interface action')
type = 'User interface action'
can_be_disabled = False
actual_plugin = None
@@ -544,7 +544,7 @@ class PreferencesPlugin(Plugin):
supported_platforms = ['windows', 'osx', 'linux']
author = 'Kovid Goyal'
type = _('Preferences')
type = 'Preferences'
can_be_disabled = False
#: Import path to module that contains a class named ConfigWidget
@@ -596,11 +596,11 @@ class StoreBase(Plugin):
supported_platforms = ['windows', 'osx', 'linux']
author = 'John Schember'
type = _('Store')
type = 'Store'
# Information about the store. Should be in the primary language
# of the store. This should not be translatable when set by
# a subclass.
description = _('An e-book store.')
description = 'An e-book store.'
minimum_calibre_version = (0, 8, 0)
version = (1, 0, 1)
@@ -643,7 +643,7 @@ class StoreBase(Plugin):
class EditBookToolPlugin(Plugin):
type = _('Edit book tool')
type = 'Edit book tool'
minimum_calibre_version = (1, 46, 0)
@@ -653,7 +653,7 @@ class LibraryClosedPlugin(Plugin):
when the library is changed, or when a library is used in some other way.
At the moment these plugins won't be called by the CLI functions.
"""
type = _('Library closed')
type = 'Library closed'
# minimum version 2.54 because that is when support was added
minimum_calibre_version = (2, 54, 0)

View File

@@ -19,10 +19,10 @@ plugins = []
class PML2PMLZ(FileTypePlugin):
name = 'PML to PMLZ'
author = 'John Schember'
description = _('Create a PMLZ archive containing the PML file '
'and all images in the directory pmlname_img or images. '
'This plugin is run every time you add '
'a PML file to the library.')
description = ('Create a PMLZ archive containing the PML file '
'and all images in the directory pmlname_img or images. '
'This plugin is run every time you add '
'a PML file to the library.')
version = numeric_version
file_types = {'pml'}
supported_platforms = ['windows', 'osx', 'linux']
@@ -50,9 +50,10 @@ class PML2PMLZ(FileTypePlugin):
class TXT2TXTZ(FileTypePlugin):
name = 'TXT to TXTZ'
author = 'John Schember'
description = _('Create a TXTZ archive when a TXT file is imported '
'containing Markdown or Textile references to images. The referenced '
'images as well as the TXT file are added to the archive.')
description = ('Create a TXTZ archive when a TXT file is imported '
'containing Markdown or Textile references to images. The '
'referenced images as well as the TXT file are added to '
'the archive.')
version = numeric_version
file_types = {'txt', 'text'}
supported_platforms = ['windows', 'osx', 'linux']
@@ -133,7 +134,7 @@ class ComicMetadataReader(MetadataReaderPlugin):
name = 'Read comic metadata'
file_types = {'cbr', 'cbz'}
description = _('Extract cover from comic files')
description = 'Extract cover from comic files'
def customization_help(self, gui=False):
return 'Read series number from volume or issue number. Default is volume, set this to issue to use issue number instead.'
@@ -174,7 +175,7 @@ class CHMMetadataReader(MetadataReaderPlugin):
name = 'Read CHM metadata'
file_types = {'chm'}
description = _('Read metadata from %s files') % 'CHM'
description = 'Read metadata from CHM files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.chm.metadata import get_metadata
@@ -185,7 +186,7 @@ class EPUBMetadataReader(MetadataReaderPlugin):
name = 'Read EPUB metadata'
file_types = {'epub'}
description = _('Read metadata from %s files')%'EPUB'
description = 'Read metadata from EPUB files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.epub import get_metadata, get_quick_metadata
@@ -198,7 +199,7 @@ class FB2MetadataReader(MetadataReaderPlugin):
name = 'Read FB2 metadata'
file_types = {'fb2', 'fbz'}
description = _('Read metadata from %s files')%'FB2'
description = 'Read metadata from FB2 files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.fb2 import get_metadata
@@ -209,7 +210,7 @@ class HTMLMetadataReader(MetadataReaderPlugin):
name = 'Read HTML metadata'
file_types = {'html'}
description = _('Read metadata from %s files')%'HTML'
description = 'Read metadata from HTML files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.html import get_metadata
@@ -220,7 +221,7 @@ class HTMLZMetadataReader(MetadataReaderPlugin):
name = 'Read HTMLZ metadata'
file_types = {'htmlz'}
description = _('Read metadata from %s files') % 'HTMLZ'
description = 'Read metadata from HTMLZ files'
author = 'John Schember'
def get_metadata(self, stream, ftype):
@@ -232,7 +233,7 @@ class IMPMetadataReader(MetadataReaderPlugin):
name = 'Read IMP metadata'
file_types = {'imp'}
description = _('Read metadata from %s files')%'IMP'
description = 'Read metadata from IMP files'
author = 'Ashish Kulkarni'
def get_metadata(self, stream, ftype):
@@ -244,7 +245,7 @@ class LITMetadataReader(MetadataReaderPlugin):
name = 'Read LIT metadata'
file_types = {'lit'}
description = _('Read metadata from %s files')%'LIT'
description = 'Read metadata from LIT files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.lit import get_metadata
@@ -255,7 +256,7 @@ class LRFMetadataReader(MetadataReaderPlugin):
name = 'Read LRF metadata'
file_types = {'lrf'}
description = _('Read metadata from %s files')%'LRF'
description = 'Read metadata from LRF files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.lrf.meta import get_metadata
@@ -266,7 +267,7 @@ class LRXMetadataReader(MetadataReaderPlugin):
name = 'Read LRX metadata'
file_types = {'lrx'}
description = _('Read metadata from %s files')%'LRX'
description = 'Read metadata from LRX files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.lrx import get_metadata
@@ -277,7 +278,7 @@ class MOBIMetadataReader(MetadataReaderPlugin):
name = 'Read MOBI metadata'
file_types = {'mobi', 'prc', 'azw', 'azw3', 'azw4', 'pobi'}
description = _('Read metadata from %s files')%'MOBI'
description = 'Read metadata from MOBI files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.mobi import get_metadata
@@ -288,7 +289,7 @@ class ODTMetadataReader(MetadataReaderPlugin):
name = 'Read ODT metadata'
file_types = {'odt'}
description = _('Read metadata from %s files')%'ODT'
description = 'Read metadata from ODT files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.odt import get_metadata
@@ -299,7 +300,7 @@ class DocXMetadataReader(MetadataReaderPlugin):
name = 'Read DOCX metadata'
file_types = {'docx'}
description = _('Read metadata from %s files')%'DOCX'
description = 'Read metadata from DOCX files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.docx import get_metadata
@@ -310,7 +311,7 @@ class OPFMetadataReader(MetadataReaderPlugin):
name = 'Read OPF metadata'
file_types = {'opf'}
description = _('Read metadata from %s files')%'OPF'
description = 'Read metadata from OPF files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.opf import get_metadata
@@ -321,7 +322,7 @@ class PDBMetadataReader(MetadataReaderPlugin):
name = 'Read PDB metadata'
file_types = {'pdb', 'updb'}
description = _('Read metadata from %s files') % 'PDB'
description = 'Read metadata from PDB files'
author = 'John Schember'
def get_metadata(self, stream, ftype):
@@ -333,7 +334,7 @@ class PDFMetadataReader(MetadataReaderPlugin):
name = 'Read PDF metadata'
file_types = {'pdf'}
description = _('Read metadata from %s files')%'PDF'
description = 'Read metadata from PDF files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.pdf import get_metadata, get_quick_metadata
@@ -346,7 +347,7 @@ class PMLMetadataReader(MetadataReaderPlugin):
name = 'Read PML metadata'
file_types = {'pml', 'pmlz'}
description = _('Read metadata from %s files') % 'PML'
description = 'Read metadata from PML files'
author = 'John Schember'
def get_metadata(self, stream, ftype):
@@ -358,7 +359,7 @@ class RARMetadataReader(MetadataReaderPlugin):
name = 'Read RAR metadata'
file_types = {'rar'}
description = _('Read metadata from e-books in RAR archives')
description = 'Read metadata from e-books in RAR archives'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.rar import get_metadata
@@ -369,7 +370,7 @@ class RBMetadataReader(MetadataReaderPlugin):
name = 'Read RB metadata'
file_types = {'rb'}
description = _('Read metadata from %s files')%'RB'
description = 'Read metadata from RB files'
author = 'Ashish Kulkarni'
def get_metadata(self, stream, ftype):
@@ -381,7 +382,7 @@ class RTFMetadataReader(MetadataReaderPlugin):
name = 'Read RTF metadata'
file_types = {'rtf'}
description = _('Read metadata from %s files')%'RTF'
description = 'Read metadata from RTF files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.rtf import get_metadata
@@ -392,7 +393,7 @@ class SNBMetadataReader(MetadataReaderPlugin):
name = 'Read SNB metadata'
file_types = {'snb'}
description = _('Read metadata from %s files') % 'SNB'
description = 'Read metadata from SNB files'
author = 'Li Fanxi'
def get_metadata(self, stream, ftype):
@@ -404,7 +405,7 @@ class TOPAZMetadataReader(MetadataReaderPlugin):
name = 'Read Topaz metadata'
file_types = {'tpz', 'azw1'}
description = _('Read metadata from %s files')%'MOBI'
description = 'Read metadata from MOBI files'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.topaz import get_metadata
@@ -415,7 +416,7 @@ class TXTMetadataReader(MetadataReaderPlugin):
name = 'Read TXT metadata'
file_types = {'txt'}
description = _('Read metadata from %s files') % 'TXT'
description = 'Read metadata from TXT files'
author = 'John Schember'
def get_metadata(self, stream, ftype):
@@ -427,7 +428,7 @@ class TXTZMetadataReader(MetadataReaderPlugin):
name = 'Read TXTZ metadata'
file_types = {'txtz'}
description = _('Read metadata from %s files') % 'TXTZ'
description = 'Read metadata from TXTZ files'
author = 'John Schember'
def get_metadata(self, stream, ftype):
@@ -439,7 +440,7 @@ class ZipMetadataReader(MetadataReaderPlugin):
name = 'Read ZIP metadata'
file_types = {'zip', 'oebzip'}
description = _('Read metadata from e-books in ZIP archives')
description = 'Read metadata from e-books in ZIP archives'
def get_metadata(self, stream, ftype):
from ebook_converter.ebooks.metadata.zip import get_metadata
@@ -458,7 +459,7 @@ class EPUBMetadataWriter(MetadataWriterPlugin):
name = 'Set EPUB metadata'
file_types = {'epub'}
description = _('Set metadata in %s files')%'EPUB'
description = 'Set metadata in EPUB files'
def set_metadata(self, stream, mi, type):
from ebook_converter.ebooks.metadata.epub import set_metadata
@@ -469,15 +470,16 @@ class EPUBMetadataWriter(MetadataWriterPlugin):
h = 'disable-add-missing-cover'
if gui:
h = '<i>' + h + '</i>'
return _('Enter {0} below to have the EPUB metadata writer plugin not'
' add cover images to EPUB files that have no existing cover image.').format(h)
return ('Enter {0} below to have the EPUB metadata writer plugin not '
'add cover images to EPUB files that have no existing cover '
'image.'.format(h))
class FB2MetadataWriter(MetadataWriterPlugin):
name = 'Set FB2 metadata'
file_types = {'fb2', 'fbz'}
description = _('Set metadata in %s files')%'FB2'
description = 'Set metadata in FB2 files'
def set_metadata(self, stream, mi, type):
from ebook_converter.ebooks.metadata.fb2 import set_metadata
@@ -488,7 +490,7 @@ class HTMLZMetadataWriter(MetadataWriterPlugin):
name = 'Set HTMLZ metadata'
file_types = {'htmlz'}
description = _('Set metadata from %s files') % 'HTMLZ'
description = 'Set metadata from HTMLZ files'
author = 'John Schember'
def set_metadata(self, stream, mi, type):
@@ -500,7 +502,7 @@ class LRFMetadataWriter(MetadataWriterPlugin):
name = 'Set LRF metadata'
file_types = {'lrf'}
description = _('Set metadata in %s files')%'LRF'
description = 'Set metadata in LRF files'
def set_metadata(self, stream, mi, type):
from ebook_converter.ebooks.lrf.meta import set_metadata
@@ -511,7 +513,7 @@ class MOBIMetadataWriter(MetadataWriterPlugin):
name = 'Set MOBI metadata'
file_types = {'mobi', 'prc', 'azw', 'azw3', 'azw4'}
description = _('Set metadata in %s files')%'MOBI'
description = 'Set metadata in MOBI files'
author = 'Marshall T. Vandegrift'
def set_metadata(self, stream, mi, type):
@@ -523,7 +525,7 @@ class PDBMetadataWriter(MetadataWriterPlugin):
name = 'Set PDB metadata'
file_types = {'pdb'}
description = _('Set metadata from %s files') % 'PDB'
description = 'Set metadata from PDB files'
author = 'John Schember'
def set_metadata(self, stream, mi, type):
@@ -535,7 +537,7 @@ class PDFMetadataWriter(MetadataWriterPlugin):
name = 'Set PDF metadata'
file_types = {'pdf'}
description = _('Set metadata in %s files') % 'PDF'
description = 'Set metadata in PDF files'
author = 'Kovid Goyal'
def set_metadata(self, stream, mi, type):
@@ -547,7 +549,7 @@ class RTFMetadataWriter(MetadataWriterPlugin):
name = 'Set RTF metadata'
file_types = {'rtf'}
description = _('Set metadata in %s files')%'RTF'
description = 'Set metadata in RTF files'
def set_metadata(self, stream, mi, type):
from ebook_converter.ebooks.metadata.rtf import set_metadata
@@ -558,7 +560,7 @@ class TOPAZMetadataWriter(MetadataWriterPlugin):
name = 'Set TOPAZ metadata'
file_types = {'tpz', 'azw1'}
description = _('Set metadata in %s files')%'TOPAZ'
description = 'Set metadata in TOPAZ files'
author = 'Greg Riker'
def set_metadata(self, stream, mi, type):
@@ -570,7 +572,7 @@ class TXTZMetadataWriter(MetadataWriterPlugin):
name = 'Set TXTZ metadata'
file_types = {'txtz'}
description = _('Set metadata from %s files') % 'TXTZ'
description = 'Set metadata from TXTZ files'
author = 'John Schember'
def set_metadata(self, stream, mi, type):
@@ -582,7 +584,7 @@ class ODTMetadataWriter(MetadataWriterPlugin):
name = 'Set ODT metadata'
file_types = {'odt'}
description = _('Set metadata from %s files')%'ODT'
description = 'Set metadata from ODT files'
def set_metadata(self, stream, mi, type):
from ebook_converter.ebooks.metadata.odt import set_metadata
@@ -593,7 +595,7 @@ class DocXMetadataWriter(MetadataWriterPlugin):
name = 'Set DOCX metadata'
file_types = {'docx'}
description = _('Set metadata from %s files')%'DOCX'
description = 'Set metadata from DOCX files'
def set_metadata(self, stream, mi, type):
from ebook_converter.ebooks.metadata.docx import set_metadata
@@ -828,228 +830,231 @@ plugins += input_profiles + output_profiles
class ActionAdd(InterfaceActionBase):
name = 'Add Books'
actual_plugin = 'ebook_converter.gui2.actions.add:AddAction'
description = _('Add books to calibre or the connected device')
description = 'Add books to calibre or the connected device'
class ActionFetchAnnotations(InterfaceActionBase):
name = 'Fetch Annotations'
actual_plugin = 'ebook_converter.gui2.actions.annotate:FetchAnnotationsAction'
description = _('Fetch annotations from a connected Kindle (experimental)')
description = 'Fetch annotations from a connected Kindle (experimental)'
class ActionGenerateCatalog(InterfaceActionBase):
name = 'Generate Catalog'
actual_plugin = 'ebook_converter.gui2.actions.catalog:GenerateCatalogAction'
description = _('Generate a catalog of the books in your calibre library')
description = 'Generate a catalog of the books in your calibre library'
class ActionConvert(InterfaceActionBase):
name = 'Convert Books'
actual_plugin = 'ebook_converter.gui2.actions.convert:ConvertAction'
description = _('Convert books to various e-book formats')
description = 'Convert books to various e-book formats'
class ActionPolish(InterfaceActionBase):
name = 'Polish Books'
actual_plugin = 'ebook_converter.gui2.actions.polish:PolishAction'
description = _('Fine tune your e-books')
description = 'Fine tune your e-books'
class ActionEditToC(InterfaceActionBase):
name = 'Edit ToC'
actual_plugin = 'ebook_converter.gui2.actions.toc_edit:ToCEditAction'
description = _('Edit the Table of Contents in your books')
description = 'Edit the Table of Contents in your books'
class ActionDelete(InterfaceActionBase):
name = 'Remove Books'
actual_plugin = 'ebook_converter.gui2.actions.delete:DeleteAction'
description = _('Delete books from your calibre library or connected device')
description = 'Delete books from your calibre library or connected device'
class ActionEmbed(InterfaceActionBase):
name = 'Embed Metadata'
actual_plugin = 'ebook_converter.gui2.actions.embed:EmbedAction'
description = _('Embed updated metadata into the actual book files in your calibre library')
description = ('Embed updated metadata into the actual book files in '
'your calibre library')
class ActionEditMetadata(InterfaceActionBase):
name = 'Edit Metadata'
actual_plugin = 'ebook_converter.gui2.actions.edit_metadata:EditMetadataAction'
description = _('Edit the metadata of books in your calibre library')
description = 'Edit the metadata of books in your calibre library'
class ActionView(InterfaceActionBase):
name = 'View'
actual_plugin = 'ebook_converter.gui2.actions.view:ViewAction'
description = _('Read books in your calibre library')
description = 'Read books in your calibre library'
class ActionFetchNews(InterfaceActionBase):
name = 'Fetch News'
actual_plugin = 'ebook_converter.gui2.actions.fetch_news:FetchNewsAction'
description = _('Download news from the internet in e-book form')
description = 'Download news from the internet in e-book form'
class ActionQuickview(InterfaceActionBase):
name = 'Quickview'
actual_plugin = 'ebook_converter.gui2.actions.show_quickview:ShowQuickviewAction'
description = _('Show a list of related books quickly')
description = 'Show a list of related books quickly'
class ActionTagMapper(InterfaceActionBase):
name = 'Tag Mapper'
actual_plugin = 'ebook_converter.gui2.actions.tag_mapper:TagMapAction'
description = _('Filter/transform the tags for books in the library')
description = 'Filter/transform the tags for books in the library'
class ActionAuthorMapper(InterfaceActionBase):
name = 'Author Mapper'
actual_plugin = 'ebook_converter.gui2.actions.author_mapper:AuthorMapAction'
description = _('Transform the authors for books in the library')
description = 'Transform the authors for books in the library'
class ActionTemplateTester(InterfaceActionBase):
name = 'Template Tester'
actual_plugin = 'ebook_converter.gui2.actions.show_template_tester:ShowTemplateTesterAction'
description = _('Show an editor for testing templates')
description = 'Show an editor for testing templates'
class ActionSaveToDisk(InterfaceActionBase):
name = 'Save To Disk'
actual_plugin = 'ebook_converter.gui2.actions.save_to_disk:SaveToDiskAction'
description = _('Export books from your calibre library to the hard disk')
description = 'Export books from your calibre library to the hard disk'
class ActionShowBookDetails(InterfaceActionBase):
name = 'Show Book Details'
actual_plugin = 'ebook_converter.gui2.actions.show_book_details:ShowBookDetailsAction'
description = _('Show Book details in a separate popup')
description = 'Show Book details in a separate popup'
class ActionRestart(InterfaceActionBase):
name = 'Restart'
actual_plugin = 'ebook_converter.gui2.actions.restart:RestartAction'
description = _('Restart calibre')
description = 'Restart calibre'
class ActionOpenFolder(InterfaceActionBase):
name = 'Open Folder'
actual_plugin = 'ebook_converter.gui2.actions.open:OpenFolderAction'
description = _('Open the folder that contains the book files in your'
description = ('Open the folder that contains the book files in your'
' calibre library')
class ActionSendToDevice(InterfaceActionBase):
name = 'Send To Device'
actual_plugin = 'ebook_converter.gui2.actions.device:SendToDeviceAction'
description = _('Send books to the connected device')
description = 'Send books to the connected device'
class ActionConnectShare(InterfaceActionBase):
name = 'Connect Share'
actual_plugin = 'ebook_converter.gui2.actions.device:ConnectShareAction'
description = _('Send books via email or the web. Also connect to'
description = ('Send books via email or the web. Also connect to'
' folders on your computer as if they are devices')
class ActionHelp(InterfaceActionBase):
name = 'Help'
actual_plugin = 'ebook_converter.gui2.actions.help:HelpAction'
description = _('Browse the calibre User Manual')
description = 'Browse the calibre User Manual'
class ActionPreferences(InterfaceActionBase):
name = 'Preferences'
actual_plugin = 'ebook_converter.gui2.actions.preferences:PreferencesAction'
description = _('Customize calibre')
description = 'Customize calibre'
class ActionSimilarBooks(InterfaceActionBase):
name = 'Similar Books'
actual_plugin = 'ebook_converter.gui2.actions.similar_books:SimilarBooksAction'
description = _('Easily find books similar to the currently selected one')
description = 'Easily find books similar to the currently selected one'
class ActionChooseLibrary(InterfaceActionBase):
name = 'Choose Library'
actual_plugin = 'ebook_converter.gui2.actions.choose_library:ChooseLibraryAction'
description = _('Switch between different calibre libraries and perform'
' maintenance on them')
description = ('Switch between different calibre libraries and perform '
'maintenance on them')
class ActionAddToLibrary(InterfaceActionBase):
name = 'Add To Library'
actual_plugin = 'ebook_converter.gui2.actions.add_to_library:AddToLibraryAction'
description = _('Copy books from the device to your calibre library')
description = 'Copy books from the device to your calibre library'
class ActionEditCollections(InterfaceActionBase):
name = 'Edit Collections'
actual_plugin = 'ebook_converter.gui2.actions.edit_collections:EditCollectionsAction'
description = _('Edit the collections in which books are placed on your device')
description = ('Edit the collections in which books are placed on your '
'device')
class ActionMatchBooks(InterfaceActionBase):
name = 'Match Books'
actual_plugin = 'ebook_converter.gui2.actions.match_books:MatchBookAction'
description = _('Match book on the devices to books in the library')
description = 'Match book on the devices to books in the library'
class ActionCopyToLibrary(InterfaceActionBase):
name = 'Copy To Library'
actual_plugin = 'ebook_converter.gui2.actions.copy_to_library:CopyToLibraryAction'
description = _('Copy a book from one calibre library to another')
description = 'Copy a book from one calibre library to another'
class ActionTweakEpub(InterfaceActionBase):
name = 'Tweak ePub'
actual_plugin = 'ebook_converter.gui2.actions.tweak_epub:TweakEpubAction'
description = _('Edit e-books in the EPUB or AZW3 formats')
description = 'Edit e-books in the EPUB or AZW3 formats'
class ActionUnpackBook(InterfaceActionBase):
name = 'Unpack Book'
actual_plugin = 'ebook_converter.gui2.actions.unpack_book:UnpackBookAction'
description = _('Make small changes to EPUB or HTMLZ files in your calibre library')
description = ('Make small changes to EPUB or HTMLZ files in your '
'calibre library')
class ActionNextMatch(InterfaceActionBase):
name = 'Next Match'
actual_plugin = 'ebook_converter.gui2.actions.next_match:NextMatchAction'
description = _('Find the next or previous match when searching in '
'your calibre library in highlight mode')
description = ('Find the next or previous match when searching in '
'your calibre library in highlight mode')
class ActionPickRandom(InterfaceActionBase):
name = 'Pick Random Book'
actual_plugin = 'ebook_converter.gui2.actions.random:PickRandomAction'
description = _('Choose a random book from your calibre library')
description = 'Choose a random book from your calibre library'
class ActionSortBy(InterfaceActionBase):
name = 'Sort By'
actual_plugin = 'ebook_converter.gui2.actions.sort:SortByAction'
description = _('Sort the list of books')
description = 'Sort the list of books'
class ActionMarkBooks(InterfaceActionBase):
name = 'Mark Books'
actual_plugin = 'ebook_converter.gui2.actions.mark_books:MarkBooksAction'
description = _('Temporarily mark books')
description = 'Temporarily mark books'
class ActionVirtualLibrary(InterfaceActionBase):
name = 'Virtual Library'
actual_plugin = 'ebook_converter.gui2.actions.virtual_library:VirtualLibraryAction'
description = _('Change the current Virtual library')
description = 'Change the current Virtual library'
class ActionStore(InterfaceActionBase):
name = 'Store'
author = 'John Schember'
actual_plugin = 'ebook_converter.gui2.actions.store:StoreAction'
description = _('Search for books from different book sellers')
description = 'Search for books from different book sellers'
def customization_help(self, gui=False):
return 'Customize the behavior of the store search.'
@@ -1066,7 +1071,8 @@ class ActionStore(InterfaceActionBase):
class ActionPluginUpdater(InterfaceActionBase):
name = 'Plugin Updater'
author = 'Grant Drake'
description = _('Get new ebook_converter plugins or update your existing ones')
description = ('Get new ebook_converter plugins or update your existing '
'ones')
actual_plugin = 'calibre.gui2.actions.plugin_updates:PluginUpdaterAction'

View File

@@ -101,7 +101,7 @@ class InputFormatPlugin(Plugin):
The main action happens in :meth:`convert`.
'''
type = _('Conversion input')
type = 'Conversion input'
can_be_disabled = False
supported_platforms = ['windows', 'osx', 'linux']
commit_name = None # unique name under which options for this plugin are saved
@@ -137,11 +137,11 @@ class InputFormatPlugin(Plugin):
common_options = {
OptionRecommendation(name='input_encoding',
recommended_value=None, level=OptionRecommendation.LOW,
help=_('Specify the character encoding of the input document. If '
'set this option will override any encoding declared by the '
'document itself. Particularly useful for documents that '
'do not declare an encoding or that have erroneous '
'encoding declarations.')
help='Specify the character encoding of the input document. If '
'set this option will override any encoding declared by the '
'document itself. Particularly useful for documents that '
'do not declare an encoding or that have erroneous '
'encoding declarations.'
)}
#: Options to customize the behavior of this plugin. Every option must be an
@@ -239,7 +239,7 @@ class OutputFormatPlugin(Plugin):
The main action happens in :meth:`convert`.
'''
type = _('Conversion output')
type = 'Conversion output'
can_be_disabled = False
supported_platforms = ['windows', 'osx', 'linux']
commit_name = None # unique name under which options for this plugin are saved
@@ -255,9 +255,9 @@ class OutputFormatPlugin(Plugin):
common_options = {
OptionRecommendation(name='pretty_print',
recommended_value=False, level=OptionRecommendation.LOW,
help=_('If specified, the output plugin will try to create output '
'that is as human readable as possible. May not have any effect '
'for some output plugins.')
help='If specified, the output plugin will try to create output '
'that is as human readable as possible. May not have any '
'effect for some output plugins.'
)}
#: Options to customize the behavior of this plugin. Every option must be an
@@ -270,7 +270,7 @@ class OutputFormatPlugin(Plugin):
@property
def description(self):
return _('Convert e-books to the %s format')%self.file_type
return 'Convert e-books to the %s format' % self.file_type
def __init__(self, *args):
Plugin.__init__(self, *args)

View File

@@ -43,20 +43,20 @@ class InputProfile(Plugin):
author = 'Kovid Goyal'
supported_platforms = {'windows', 'osx', 'linux'}
can_be_disabled = False
type = _('Input profile')
type = 'Input profile'
name = 'Default Input Profile'
short_name = 'default' # Used in the CLI so dont use spaces etc. in it
description = _('This profile tries to provide sane defaults and is useful '
'if you know nothing about the input document.')
description = ('This profile tries to provide sane defaults and is useful '
'if you know nothing about the input document.')
class SonyReaderInput(InputProfile):
name = 'Sony Reader'
short_name = 'sony'
description = _('This profile is intended for the SONY PRS line. '
'The 500/505/600/700 etc.')
description = ('This profile is intended for the SONY PRS line. '
'The 500/505/600/700 etc.')
screen_size = (584, 754)
dpi = 168.451
@@ -68,7 +68,7 @@ class SonyReader300Input(SonyReaderInput):
name = 'Sony Reader 300'
short_name = 'sony300'
description = _('This profile is intended for the SONY PRS 300.')
description = 'This profile is intended for the SONY PRS 300.'
dpi = 200
@@ -78,7 +78,7 @@ class SonyReader900Input(SonyReaderInput):
author = 'John Schember'
name = 'Sony Reader 900'
short_name = 'sony900'
description = _('This profile is intended for the SONY PRS-900.')
description = 'This profile is intended for the SONY PRS-900.'
screen_size = (584, 978)
@@ -87,7 +87,7 @@ class MSReaderInput(InputProfile):
name = 'Microsoft Reader'
short_name = 'msreader'
description = _('This profile is intended for the Microsoft Reader.')
description = 'This profile is intended for the Microsoft Reader.'
screen_size = (480, 652)
dpi = 96
@@ -99,7 +99,7 @@ class MobipocketInput(InputProfile):
name = 'Mobipocket Books'
short_name = 'mobipocket'
description = _('This profile is intended for the Mobipocket books.')
description = 'This profile is intended for the Mobipocket books.'
# Unfortunately MOBI books are not narrowly targeted, so this information is
# quite likely to be spurious
@@ -113,7 +113,7 @@ class HanlinV3Input(InputProfile):
name = 'Hanlin V3'
short_name = 'hanlinv3'
description = _('This profile is intended for the Hanlin V3 and its clones.')
description = 'This profile is intended for the Hanlin V3 and its clones.'
# Screen size is a best guess
screen_size = (584, 754)
@@ -126,7 +126,7 @@ class HanlinV5Input(HanlinV3Input):
name = 'Hanlin V5'
short_name = 'hanlinv5'
description = _('This profile is intended for the Hanlin V5 and its clones.')
description = 'This profile is intended for the Hanlin V5 and its clones.'
# Screen size is a best guess
screen_size = (584, 754)
@@ -137,7 +137,7 @@ class CybookG3Input(InputProfile):
name = 'Cybook G3'
short_name = 'cybookg3'
description = _('This profile is intended for the Cybook G3.')
description = 'This profile is intended for the Cybook G3.'
# Screen size is a best guess
screen_size = (600, 800)
@@ -151,7 +151,7 @@ class CybookOpusInput(InputProfile):
author = 'John Schember'
name = 'Cybook Opus'
short_name = 'cybook_opus'
description = _('This profile is intended for the Cybook Opus.')
description = 'This profile is intended for the Cybook Opus.'
# Screen size is a best guess
screen_size = (600, 800)
@@ -164,7 +164,7 @@ class KindleInput(InputProfile):
name = 'Kindle'
short_name = 'kindle'
description = _('This profile is intended for the Amazon Kindle.')
description = 'This profile is intended for the Amazon Kindle.'
# Screen size is a best guess
screen_size = (525, 640)
@@ -177,7 +177,7 @@ class IlliadInput(InputProfile):
name = 'Illiad'
short_name = 'illiad'
description = _('This profile is intended for the Irex Illiad.')
description = 'This profile is intended for the Irex Illiad.'
screen_size = (760, 925)
dpi = 160.0
@@ -190,7 +190,7 @@ class IRexDR1000Input(InputProfile):
author = 'John Schember'
name = 'IRex Digital Reader 1000'
short_name = 'irexdr1000'
description = _('This profile is intended for the IRex Digital Reader 1000.')
description = 'This profile is intended for the IRex Digital Reader 1000.'
# Screen size is a best guess
screen_size = (1024, 1280)
@@ -204,7 +204,7 @@ class IRexDR800Input(InputProfile):
author = 'Eric Cronin'
name = 'IRex Digital Reader 800'
short_name = 'irexdr800'
description = _('This profile is intended for the IRex Digital Reader 800.')
description = 'This profile is intended for the IRex Digital Reader 800.'
screen_size = (768, 1024)
dpi = 160
@@ -217,7 +217,7 @@ class NookInput(InputProfile):
author = 'John Schember'
name = 'Nook'
short_name = 'nook'
description = _('This profile is intended for the B&N Nook.')
description = 'This profile is intended for the B&N Nook.'
# Screen size is a best guess
screen_size = (600, 800)
@@ -241,13 +241,13 @@ class OutputProfile(Plugin):
author = 'Kovid Goyal'
supported_platforms = {'windows', 'osx', 'linux'}
can_be_disabled = False
type = _('Output profile')
type = 'Output profile'
name = 'Default Output Profile'
short_name = 'default' # Used in the CLI so dont use spaces etc. in it
description = _('This profile tries to provide sane defaults and is useful '
'if you want to produce a document intended to be read at a '
'computer or on a range of devices.')
description = ('This profile tries to provide sane defaults and is useful '
'if you want to produce a document intended to be read at '
'a computer or on a range of devices.')
#: The image size for comics
comic_screen_size = (584, 754)
@@ -282,8 +282,8 @@ class iPadOutput(OutputProfile):
name = 'iPad'
short_name = 'ipad'
description = _('Intended for the iPad and similar devices with a '
'resolution of 768x1024')
description = ('Intended for the iPad and similar devices with a '
'resolution of 768x1024')
screen_size = (768, 1024)
comic_screen_size = (768, 1024)
dpi = 132.0
@@ -445,14 +445,15 @@ class iPad3Output(iPadOutput):
dpi = 264.0
name = 'iPad 3'
short_name = 'ipad3'
description = _('Intended for the iPad 3 and similar devices with a '
'resolution of 1536x2048')
description = ('Intended for the iPad 3 and similar devices with a '
'resolution of 1536x2048')
class TabletOutput(iPadOutput):
name = 'Tablet'
short_name = 'tablet'
description = _('Intended for generic tablet devices, does no resizing of images')
description = ('Intended for generic tablet devices, does no resizing of '
'images')
screen_size = (10000, 10000)
comic_screen_size = (10000, 10000)
@@ -461,16 +462,16 @@ class TabletOutput(iPadOutput):
class SamsungGalaxy(TabletOutput):
name = 'Samsung Galaxy'
short_name = 'galaxy'
description = _('Intended for the Samsung Galaxy and similar tablet devices with '
'a resolution of 600x1280')
description = ('Intended for the Samsung Galaxy and similar tablet '
'devices with a resolution of 600x1280')
screen_size = comic_screen_size = (600, 1280)
class NookHD(TabletOutput):
name = 'Nook HD+'
short_name = 'nook_hd_plus'
description = _('Intended for the Nook HD+ and similar tablet devices with '
'a resolution of 1280x1920')
description = ('Intended for the Nook HD+ and similar tablet devices with '
'a resolution of 1280x1920')
screen_size = comic_screen_size = (1280, 1920)
@@ -478,8 +479,8 @@ class SonyReaderOutput(OutputProfile):
name = 'Sony Reader'
short_name = 'sony'
description = _('This profile is intended for the SONY PRS line. '
'The 500/505/600/700 etc.')
description = ('This profile is intended for the SONY PRS line. '
'The 500/505/600/700 etc.')
screen_size = (590, 775)
dpi = 168.451
@@ -496,7 +497,7 @@ class KoboReaderOutput(OutputProfile):
name = 'Kobo Reader'
short_name = 'kobo'
description = _('This profile is intended for the Kobo Reader.')
description = 'This profile is intended for the Kobo Reader.'
screen_size = (536, 710)
comic_screen_size = (536, 710)
@@ -510,7 +511,7 @@ class SonyReader300Output(SonyReaderOutput):
author = 'John Schember'
name = 'Sony Reader 300'
short_name = 'sony300'
description = _('This profile is intended for the SONY PRS-300.')
description = 'This profile is intended for the SONY PRS-300.'
dpi = 200
@@ -520,7 +521,7 @@ class SonyReader900Output(SonyReaderOutput):
author = 'John Schember'
name = 'Sony Reader 900'
short_name = 'sony900'
description = _('This profile is intended for the SONY PRS-900.')
description = 'This profile is intended for the SONY PRS-900.'
screen_size = (600, 999)
comic_screen_size = screen_size
@@ -531,7 +532,7 @@ class SonyReaderT3Output(SonyReaderOutput):
author = 'Kovid Goyal'
name = 'Sony Reader T3'
short_name = 'sonyt3'
description = _('This profile is intended for the SONY PRS-T3.')
description = 'This profile is intended for the SONY PRS-T3.'
screen_size = (758, 934)
comic_screen_size = screen_size
@@ -541,7 +542,7 @@ class GenericEink(SonyReaderOutput):
name = 'Generic e-ink'
short_name = 'generic_eink'
description = _('Suitable for use with any e-ink device')
description = 'Suitable for use with any e-ink device'
epub_periodical_format = None
@@ -549,7 +550,7 @@ class GenericEinkLarge(GenericEink):
name = 'Generic e-ink large'
short_name = 'generic_eink_large'
description = _('Suitable for use with any large screen e-ink device')
description = 'Suitable for use with any large screen e-ink device'
screen_size = (600, 999)
comic_screen_size = screen_size
@@ -559,7 +560,8 @@ class GenericEinkHD(GenericEink):
name = 'Generic e-ink HD'
short_name = 'generic_eink_hd'
description = _('Suitable for use with any modern high resolution e-ink device')
description = ('Suitable for use with any modern high resolution e-ink '
'device')
screen_size = (10000, 10000)
comic_screen_size = (10000, 10000)
@@ -569,7 +571,7 @@ class JetBook5Output(OutputProfile):
name = 'JetBook 5-inch'
short_name = 'jetbook5'
description = _('This profile is intended for the 5-inch JetBook.')
description = 'This profile is intended for the 5-inch JetBook.'
screen_size = (480, 640)
dpi = 168.451
@@ -579,9 +581,9 @@ class SonyReaderLandscapeOutput(SonyReaderOutput):
name = 'Sony Reader Landscape'
short_name = 'sony-landscape'
description = _('This profile is intended for the SONY PRS line. '
'The 500/505/700 etc, in landscape mode. Mainly useful '
'for comics.')
description = ('This profile is intended for the SONY PRS line. '
'The 500/505/700 etc, in landscape mode. Mainly useful '
'for comics.')
screen_size = (784, 1012)
comic_screen_size = (784, 1012)
@@ -591,7 +593,7 @@ class MSReaderOutput(OutputProfile):
name = 'Microsoft Reader'
short_name = 'msreader'
description = _('This profile is intended for the Microsoft Reader.')
description = 'This profile is intended for the Microsoft Reader.'
screen_size = (480, 652)
dpi = 96
@@ -603,7 +605,7 @@ class MobipocketOutput(OutputProfile):
name = 'Mobipocket Books'
short_name = 'mobipocket'
description = _('This profile is intended for the Mobipocket books.')
description = 'This profile is intended for the Mobipocket books.'
# Unfortunately MOBI books are not narrowly targeted, so this information is
# quite likely to be spurious
@@ -617,7 +619,7 @@ class HanlinV3Output(OutputProfile):
name = 'Hanlin V3'
short_name = 'hanlinv3'
description = _('This profile is intended for the Hanlin V3 and its clones.')
description = 'This profile is intended for the Hanlin V3 and its clones.'
# Screen size is a best guess
screen_size = (584, 754)
@@ -630,7 +632,7 @@ class HanlinV5Output(HanlinV3Output):
name = 'Hanlin V5'
short_name = 'hanlinv5'
description = _('This profile is intended for the Hanlin V5 and its clones.')
description = 'This profile is intended for the Hanlin V5 and its clones.'
dpi = 200
@@ -639,7 +641,7 @@ class CybookG3Output(OutputProfile):
name = 'Cybook G3'
short_name = 'cybookg3'
description = _('This profile is intended for the Cybook G3.')
description = 'This profile is intended for the Cybook G3.'
# Screen size is a best guess
screen_size = (600, 800)
@@ -654,7 +656,7 @@ class CybookOpusOutput(SonyReaderOutput):
author = 'John Schember'
name = 'Cybook Opus'
short_name = 'cybook_opus'
description = _('This profile is intended for the Cybook Opus.')
description = 'This profile is intended for the Cybook Opus.'
# Screen size is a best guess
dpi = 200
@@ -668,7 +670,7 @@ class KindleOutput(OutputProfile):
name = 'Kindle'
short_name = 'kindle'
description = _('This profile is intended for the Amazon Kindle.')
description = 'This profile is intended for the Amazon Kindle.'
# Screen size is a best guess
screen_size = (525, 640)
@@ -688,7 +690,7 @@ class KindleDXOutput(OutputProfile):
name = 'Kindle DX'
short_name = 'kindle_dx'
description = _('This profile is intended for the Amazon Kindle DX.')
description = 'This profile is intended for the Amazon Kindle DX.'
# Screen size is a best guess
screen_size = (744, 1022)
@@ -706,7 +708,8 @@ class KindlePaperWhiteOutput(KindleOutput):
name = 'Kindle PaperWhite'
short_name = 'kindle_pw'
description = _('This profile is intended for the Amazon Kindle PaperWhite 1 and 2')
description = ('This profile is intended for the Amazon Kindle '
'PaperWhite 1 and 2')
# Screen size is a best guess
screen_size = (658, 940)
@@ -718,7 +721,7 @@ class KindleVoyageOutput(KindleOutput):
name = 'Kindle Voyage'
short_name = 'kindle_voyage'
description = _('This profile is intended for the Amazon Kindle Voyage')
description = 'This profile is intended for the Amazon Kindle Voyage'
# Screen size is currently just the spec size, actual renderable area will
# depend on someone with the device doing tests.
@@ -731,7 +734,8 @@ class KindlePaperWhite3Output(KindleVoyageOutput):
name = 'Kindle PaperWhite 3'
short_name = 'kindle_pw3'
description = _('This profile is intended for the Amazon Kindle PaperWhite 3 and above')
description = ('This profile is intended for the Amazon Kindle '
'PaperWhite 3 and above')
# Screen size is currently just the spec size, actual renderable area will
# depend on someone with the device doing tests.
screen_size = (1072, 1430)
@@ -743,7 +747,8 @@ class KindleOasisOutput(KindlePaperWhite3Output):
name = 'Kindle Oasis'
short_name = 'kindle_oasis'
description = _('This profile is intended for the Amazon Kindle Oasis 2017 and above')
description = ('This profile is intended for the Amazon Kindle Oasis '
'2017 and above')
# Screen size is currently just the spec size, actual renderable area will
# depend on someone with the device doing tests.
screen_size = (1264, 1680)
@@ -755,7 +760,7 @@ class KindleFireOutput(KindleDXOutput):
name = 'Kindle Fire'
short_name = 'kindle_fire'
description = _('This profile is intended for the Amazon Kindle Fire.')
description = 'This profile is intended for the Amazon Kindle Fire.'
screen_size = (570, 1016)
dpi = 169.0
@@ -766,7 +771,7 @@ class IlliadOutput(OutputProfile):
name = 'Illiad'
short_name = 'illiad'
description = _('This profile is intended for the Irex Illiad.')
description = 'This profile is intended for the Irex Illiad.'
screen_size = (760, 925)
comic_screen_size = (760, 925)
@@ -780,7 +785,7 @@ class IRexDR1000Output(OutputProfile):
author = 'John Schember'
name = 'IRex Digital Reader 1000'
short_name = 'irexdr1000'
description = _('This profile is intended for the IRex Digital Reader 1000.')
description = 'This profile is intended for the IRex Digital Reader 1000.'
# Screen size is a best guess
screen_size = (1024, 1280)
@@ -795,7 +800,7 @@ class IRexDR800Output(OutputProfile):
author = 'Eric Cronin'
name = 'IRex Digital Reader 800'
short_name = 'irexdr800'
description = _('This profile is intended for the IRex Digital Reader 800.')
description = 'This profile is intended for the IRex Digital Reader 800.'
# Screen size is a best guess
screen_size = (768, 1024)
@@ -810,7 +815,7 @@ class NookOutput(OutputProfile):
author = 'John Schember'
name = 'Nook'
short_name = 'nook'
description = _('This profile is intended for the B&N Nook.')
description = 'This profile is intended for the B&N Nook.'
# Screen size is a best guess
screen_size = (600, 730)
@@ -823,7 +828,7 @@ class NookOutput(OutputProfile):
class NookColorOutput(NookOutput):
name = 'Nook Color'
short_name = 'nook_color'
description = _('This profile is intended for the B&N Nook Color.')
description = 'This profile is intended for the B&N Nook Color.'
screen_size = (600, 900)
comic_screen_size = (594, 900)
@@ -835,7 +840,8 @@ class PocketBook900Output(OutputProfile):
author = 'Chris Lockfort'
name = 'PocketBook Pro 900'
short_name = 'pocketbook_900'
description = _('This profile is intended for the PocketBook Pro 900 series of devices.')
description = ('This profile is intended for the PocketBook Pro 900 '
'series of devices.')
screen_size = (810, 1180)
dpi = 150.0
@@ -847,7 +853,8 @@ class PocketBookPro912Output(OutputProfile):
author = 'Daniele Pizzolli'
name = 'PocketBook Pro 912'
short_name = 'pocketbook_pro_912'
description = _('This profile is intended for the PocketBook Pro 912 series of devices.')
description = ('This profile is intended for the PocketBook Pro 912 '
'series of devices.')
# According to http://download.pocketbook-int.com/user-guides/E_Ink/912/User_Guide_PocketBook_912(EN).pdf
screen_size = (825, 1200)

View File

@@ -12,7 +12,6 @@ from ebook_converter.customize import profiles
from ebook_converter.customize import builtins
from ebook_converter.ebooks import metadata
from ebook_converter.utils import config as cfg
from ebook_converter import constants
builtin_names = frozenset(p.name for p in builtins.plugins)
@@ -25,13 +24,13 @@ class NameConflict(ValueError):
def _config():
c = cfg.Config('customize')
c.add_opt('plugins', default={}, help=_('Installed plugins'))
c.add_opt('plugins', default={}, help='Installed plugins')
c.add_opt('filetype_mapping', default={},
help=_('Mapping for filetype plugins'))
help='Mapping for filetype plugins')
c.add_opt('plugin_customization', default={},
help=_('Local plugin customization'))
c.add_opt('disabled_plugins', default=set(), help=_('Disabled plugins'))
c.add_opt('enabled_plugins', default=set(), help=_('Enabled plugins'))
help='Local plugin customization')
c.add_opt('disabled_plugins', default=set(), help='Disabled plugins')
c.add_opt('enabled_plugins', default=set(), help='Enabled plugins')
return cfg.ConfigProxy(c)
@@ -459,8 +458,8 @@ def initialize_plugin(plugin, path_to_zip_file):
except Exception:
print('Failed to initialize plugin:', plugin.name, plugin.version)
tb = traceback.format_exc()
raise customize.InvalidPlugin((_('Initialization of plugin %s failed '
'with traceback:') % tb) + '\n'+tb)
raise customize.InvalidPlugin(('Initialization of plugin %s failed '
'with traceback:' % tb) + '\n'+tb)
def has_external_plugins():
@@ -501,25 +500,29 @@ def initialized_plugins():
# CLI
def option_parser():
parser = cfg.OptionParser(usage=_('''\
parser = cfg.OptionParser(usage='''\
%prog options
Customize calibre by loading external plugins.
'''))
''')
parser.add_option('-a', '--add-plugin', default=None,
help=_('Add a plugin by specifying the path to the ZIP file containing it.'))
help='Add a plugin by specifying the path to the ZIP '
'file containing it.')
parser.add_option('-b', '--build-plugin', default=None,
help=_('For plugin developers: Path to the directory where you are'
' developing the plugin. This command will automatically zip '
'up the plugin and update it in calibre.'))
help='For plugin developers: Path to the directory '
'where you are developing the plugin. This command will '
'automatically zip up the plugin and update it in '
'calibre.')
parser.add_option('-r', '--remove-plugin', default=None,
help=_('Remove a custom plugin by name. Has no effect on builtin plugins'))
help='Remove a custom plugin by name. Has no effect on '
'builtin plugins')
parser.add_option('--customize-plugin', default=None,
help=_('Customize plugin. Specify name of plugin and customization string separated by a comma.'))
parser.add_option('-l', '--list-plugins', default=False, action='store_true',
help=_('List all installed plugins'))
help='Customize plugin. Specify name of plugin and '
'customization string separated by a comma.')
parser.add_option('-l', '--list-plugins', default=False,
action='store_true', help='List all installed plugins')
parser.add_option('--enable-plugin', default=None,
help=_('Enable the named plugin'))
help='Enable the named plugin')
parser.add_option('--disable-plugin', default=None,
help=_('Disable the named plugin'))
help='Disable the named plugin')
return parser

View File

@@ -1,111 +0,0 @@
"""
PEP 302 based plugin loading mechanism, works around the bug in zipimport in
python 2.x that prevents importing from zip files in locations whose paths
have non ASCII characters
"""
import os, zipfile, posixpath, importlib, threading, re, imp, sys
from collections import OrderedDict
from functools import partial
from ebook_converter import as_unicode
from ebook_converter.customize import (Plugin, numeric_version, platform,
InvalidPlugin, PluginNotFound)
from ebook_converter.polyglot.builtins import reload
__license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
def get_resources(zfp, name_or_list_of_names):
'''
Load resources from the plugin zip file
:param name_or_list_of_names: List of paths to resources in the zip file using / as
separator, or a single path
:return: A dictionary of the form ``{name : file_contents}``. Any names
that were not found in the zip file will not be present in the
dictionary. If a single path is passed in the return value will
be just the bytes of the resource or None if it wasn't found.
'''
names = name_or_list_of_names
if isinstance(names, (str, bytes)):
names = [names]
ans = {}
with zipfile.ZipFile(zfp) as zf:
for name in names:
try:
ans[name] = zf.read(name)
except:
import traceback
traceback.print_exc()
if len(names) == 1:
ans = ans.pop(names[0], None)
return ans
def get_icons(zfp, name_or_list_of_names):
'''
Load icons from the plugin zip file
:param name_or_list_of_names: List of paths to resources in the zip file using / as
separator, or a single path
:return: A dictionary of the form ``{name : QIcon}``. Any names
that were not found in the zip file will be null QIcons.
If a single path is passed in the return value will
be A QIcon.
'''
from PyQt5.Qt import QIcon, QPixmap
names = name_or_list_of_names
ans = get_resources(zfp, names)
if isinstance(names, (str, bytes)):
names = [names]
if ans is None:
ans = {}
if isinstance(ans, (str, bytes)):
ans = dict([(names[0], ans)])
ians = {}
for name in names:
p = QPixmap()
raw = ans.get(name, None)
if raw:
p.loadFromData(raw)
ians[name] = QIcon(p)
if len(names) == 1:
ians = ians.pop(names[0])
return ians
_translations_cache = {}
def load_translations(namespace, zfp):
null = object()
trans = _translations_cache.get(zfp, null)
if trans is None:
return
if trans is null:
from ebook_converter.utils.localization import get_lang
lang = get_lang()
if not lang or lang == 'en': # performance optimization
_translations_cache[zfp] = None
return
with zipfile.ZipFile(zfp) as zf:
try:
mo = zf.read('translations/%s.mo' % lang)
except KeyError:
mo = None # No translations for this language present
if mo is None:
_translations_cache[zfp] = None
return
from gettext import GNUTranslations
from io import BytesIO
trans = _translations_cache[zfp] = GNUTranslations(BytesIO(mo))
namespace['_'] = getattr(trans, 'gettext')
namespace['ngettext'] = getattr(trans, 'ngettext')