mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Fixes for 89e2638cdd
This commit is contained in:
parent
a2c4d44688
commit
fe5aac9d97
@ -211,7 +211,7 @@ class Plugin(object): # {{{
|
||||
For example to load an image::
|
||||
|
||||
pixmap = QPixmap()
|
||||
pixmap.loadFromData(tuple(self.load_resources(['images/icon.png']).values())[0])
|
||||
pixmap.loadFromData(self.load_resources(['images/icon.png'])['images/icon.png'])
|
||||
icon = QIcon(pixmap)
|
||||
|
||||
:param names: List of paths to resources in the ZIP file using / as separator
|
||||
@ -247,7 +247,7 @@ class Plugin(object): # {{{
|
||||
:param gui: If True return HTML help, otherwise return plain text help.
|
||||
|
||||
'''
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError()
|
||||
|
||||
def temporary_file(self, suffix):
|
||||
'''
|
||||
|
@ -42,7 +42,7 @@ class ConversionOption(object):
|
||||
return hash(self.name)
|
||||
|
||||
def __eq__(self, other):
|
||||
return hash(self) == hash(other)
|
||||
return self.name == other.name
|
||||
|
||||
def clone(self):
|
||||
return ConversionOption(name=self.name, help=self.help,
|
||||
@ -143,7 +143,7 @@ class InputFormatPlugin(Plugin):
|
||||
|
||||
#: Set of file types for which this plugin should be run
|
||||
#: For example: ``set(['azw', 'mobi', 'prc'])``
|
||||
file_types = set([])
|
||||
file_types = set()
|
||||
|
||||
#: If True, this input plugin generates a collection of images,
|
||||
#: one per HTML file. This can be set dynamically, in the convert method
|
||||
@ -180,11 +180,11 @@ class InputFormatPlugin(Plugin):
|
||||
|
||||
#: Options to customize the behavior of this plugin. Every option must be an
|
||||
#: instance of :class:`OptionRecommendation`.
|
||||
options = set([])
|
||||
options = set()
|
||||
|
||||
#: A set of 3-tuples of the form
|
||||
#: (option_name, recommended_value, recommendation_level)
|
||||
recommendations = set([])
|
||||
recommendations = set()
|
||||
|
||||
def __init__(self, *args):
|
||||
Plugin.__init__(self, *args)
|
||||
@ -226,7 +226,7 @@ class InputFormatPlugin(Plugin):
|
||||
subsequent stages of the conversion.
|
||||
|
||||
'''
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError()
|
||||
|
||||
def __call__(self, stream, options, file_ext, log,
|
||||
accelerators, output_dir):
|
||||
@ -337,7 +337,7 @@ class OutputFormatPlugin(Plugin):
|
||||
:param log: The logger. Print debug/info messages etc. using this.
|
||||
|
||||
'''
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def is_periodical(self):
|
||||
|
@ -267,8 +267,8 @@ class OutputProfile(Plugin):
|
||||
periodical_date_in_title = True
|
||||
|
||||
#: Characters used in jackets and catalogs
|
||||
ratings_char = u'*'
|
||||
empty_ratings_char = u' '
|
||||
ratings_char = '*'
|
||||
empty_ratings_char = ' '
|
||||
|
||||
#: Unsupported unicode characters to be replaced during preprocessing
|
||||
unsupported_unicode_chars = []
|
||||
@ -302,12 +302,12 @@ class iPadOutput(OutputProfile):
|
||||
}
|
||||
]
|
||||
|
||||
ratings_char = u'\u2605' # filled star
|
||||
empty_ratings_char = u'\u2606' # hollow star
|
||||
ratings_char = '\u2605' # filled star
|
||||
empty_ratings_char = '\u2606' # hollow star
|
||||
|
||||
touchscreen = True
|
||||
# touchscreen_news_css {{{
|
||||
touchscreen_news_css = u'''
|
||||
touchscreen_news_css = '''
|
||||
/* hr used in articles */
|
||||
.article_articles_list {
|
||||
width:18%;
|
||||
@ -680,8 +680,8 @@ class KindleOutput(OutputProfile):
|
||||
supports_mobi_indexing = True
|
||||
periodical_date_in_title = False
|
||||
|
||||
empty_ratings_char = u'\u2606'
|
||||
ratings_char = u'\u2605'
|
||||
empty_ratings_char = '\u2606'
|
||||
ratings_char = '\u2605'
|
||||
|
||||
mobi_ems_per_blockquote = 2.0
|
||||
|
||||
@ -699,8 +699,8 @@ class KindleDXOutput(OutputProfile):
|
||||
# comic_screen_size = (741, 1022)
|
||||
supports_mobi_indexing = True
|
||||
periodical_date_in_title = False
|
||||
empty_ratings_char = u'\u2606'
|
||||
ratings_char = u'\u2605'
|
||||
empty_ratings_char = '\u2606'
|
||||
ratings_char = '\u2605'
|
||||
mobi_ems_per_blockquote = 2.0
|
||||
|
||||
|
||||
|
@ -361,7 +361,7 @@ def metadata_readers():
|
||||
|
||||
|
||||
def metadata_writers():
|
||||
ans = set([])
|
||||
ans = set()
|
||||
for plugins in _metadata_writers.values():
|
||||
for plugin in plugins:
|
||||
ans.add(plugin)
|
||||
@ -557,7 +557,7 @@ def plugin_for_output_format(fmt):
|
||||
|
||||
|
||||
def available_output_formats():
|
||||
formats = set([])
|
||||
formats = set()
|
||||
for plugin in output_format_plugins():
|
||||
if not is_disabled(plugin):
|
||||
formats.add(plugin.file_type)
|
||||
@ -751,16 +751,16 @@ def build_plugin(path):
|
||||
from calibre.utils.zipfile import ZipFile, ZIP_STORED
|
||||
path = unicode_type(path)
|
||||
names = frozenset(os.listdir(path))
|
||||
if u'__init__.py' not in names:
|
||||
if '__init__.py' not in names:
|
||||
prints(path, ' is not a valid plugin')
|
||||
raise SystemExit(1)
|
||||
t = PersistentTemporaryFile(u'.zip')
|
||||
with ZipFile(t, u'w', ZIP_STORED) as zf:
|
||||
with ZipFile(t, 'w', ZIP_STORED) as zf:
|
||||
zf.add_dir(path, simple_filter=lambda x:x in {'.git', '.bzr', '.svn', '.hg'})
|
||||
t.close()
|
||||
plugin = add_plugin(t.name)
|
||||
os.remove(t.name)
|
||||
prints(u'Plugin updated:', plugin.name, plugin.version)
|
||||
prints('Plugin updated:', plugin.name, plugin.version)
|
||||
|
||||
|
||||
def option_parser():
|
||||
|
@ -162,7 +162,7 @@ class XMLCache(object):
|
||||
def purge_broken_playlist_items(self, root):
|
||||
id_map = self.build_id_map(root)
|
||||
for pl in root.xpath('//*[local-name()="playlist"]'):
|
||||
seen = set([])
|
||||
seen = set()
|
||||
for item in list(pl):
|
||||
id_ = item.get('id', None)
|
||||
if id_ is None or id_ in seen or id_map.get(id_, None) is None:
|
||||
@ -573,7 +573,7 @@ class XMLCache(object):
|
||||
id_ = self.max_id(root)+1
|
||||
attrib = {
|
||||
'page':'0', 'part':'0','pageOffset':'0','scale':'0',
|
||||
'id':unicod_type(id_), 'sourceid':'1', 'path':lpath}
|
||||
'id':unicode_type(id_), 'sourceid':'1', 'path':lpath}
|
||||
ans = root.makeelement('{%s}text'%namespace, attrib=attrib, nsmap=root.nsmap)
|
||||
root.append(ans)
|
||||
return ans
|
||||
|
Loading…
x
Reference in New Issue
Block a user