mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
...
This commit is contained in:
parent
604857e26e
commit
5e0e77ec4a
@ -126,7 +126,7 @@ def gui_polish(data):
|
|||||||
file_map = {x:x for x in files}
|
file_map = {x:x for x in files}
|
||||||
opts = ALL_OPTS.copy()
|
opts = ALL_OPTS.copy()
|
||||||
opts.update(data)
|
opts.update(data)
|
||||||
O = namedtuple('Options', ' '.join(data.iterkeys()))
|
O = namedtuple('Options', ' '.join(ALL_OPTS.iterkeys()))
|
||||||
opts = O(**opts)
|
opts = O(**opts)
|
||||||
log = Log(level=Log.DEBUG)
|
log = Log(level=Log.DEBUG)
|
||||||
report = []
|
report = []
|
||||||
|
@ -40,7 +40,9 @@ class Polish(QDialog):
|
|||||||
'metadata':_('<h3>Updating metadata</h3>'
|
'metadata':_('<h3>Updating metadata</h3>'
|
||||||
'<p>This will update all metadata and covers in the'
|
'<p>This will update all metadata and covers in the'
|
||||||
' ebook files to match the current metadata in the'
|
' ebook files to match the current metadata in the'
|
||||||
' calibre library.</p><p>Note that most ebook'
|
' calibre library.</p><p>If the ebook file does not have'
|
||||||
|
' an identifiable cover, a new cover is inserted.</p>'
|
||||||
|
' <p>Note that most ebook'
|
||||||
' formats are not capable of supporting all the'
|
' formats are not capable of supporting all the'
|
||||||
' metadata in calibre.</p>'),
|
' metadata in calibre.</p>'),
|
||||||
}
|
}
|
||||||
@ -52,11 +54,11 @@ class Polish(QDialog):
|
|||||||
l.addWidget(la, 0, 0, 1, 2)
|
l.addWidget(la, 0, 0, 1, 2)
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
self.actions = OrderedDict([
|
self.all_actions = OrderedDict([
|
||||||
('subset', _('Subset all embedded fonts')),
|
('subset', _('Subset all embedded fonts')),
|
||||||
('metadata', _('Update metadata in book files')),
|
('metadata', _('Update metadata in book files')),
|
||||||
])
|
])
|
||||||
for name, text in self.actions.iteritems():
|
for name, text in self.all_actions.iteritems():
|
||||||
count += 1
|
count += 1
|
||||||
x = QCheckBox(text, self)
|
x = QCheckBox(text, self)
|
||||||
l.addWidget(x, count, 0, 1, 1)
|
l.addWidget(x, count, 0, 1, 1)
|
||||||
@ -94,7 +96,7 @@ class Polish(QDialog):
|
|||||||
def accept(self):
|
def accept(self):
|
||||||
self.actions = ac = {}
|
self.actions = ac = {}
|
||||||
something = False
|
something = False
|
||||||
for action in self.actions:
|
for action in self.all_actions:
|
||||||
ac[action] = bool(getattr(self, 'opt_'+action).isChecked())
|
ac[action] = bool(getattr(self, 'opt_'+action).isChecked())
|
||||||
if ac[action]:
|
if ac[action]:
|
||||||
something = True
|
something = True
|
||||||
@ -156,7 +158,7 @@ class Polish(QDialog):
|
|||||||
|
|
||||||
desc = ngettext(_('Polish %s')%mi.title,
|
desc = ngettext(_('Polish %s')%mi.title,
|
||||||
_('Polish book %(nums)s of %(tot)s (%(title)s)')%dict(
|
_('Polish book %(nums)s of %(tot)s (%(title)s)')%dict(
|
||||||
num=num, tot=len(self.book_id_map),
|
nums=num, tot=len(self.book_id_map),
|
||||||
title=mi.title), len(self.book_id_map))
|
title=mi.title), len(self.book_id_map))
|
||||||
if hasattr(self, 'pd'):
|
if hasattr(self, 'pd'):
|
||||||
self.pd.set_msg(_('Queueing book %(nums)s of %(tot)s (%(title)s)')%dict(
|
self.pd.set_msg(_('Queueing book %(nums)s of %(tot)s (%(title)s)')%dict(
|
||||||
@ -213,7 +215,7 @@ class PolishAction(InterfaceAction):
|
|||||||
return
|
return
|
||||||
d = Polish(self.gui.library_view.model().db, book_id_map, parent=self.gui)
|
d = Polish(self.gui.library_view.model().db, book_id_map, parent=self.gui)
|
||||||
if d.exec_() == d.Accepted and d.jobs:
|
if d.exec_() == d.Accepted and d.jobs:
|
||||||
for desc, data, book_id, base, files in reversed(d.jobs):
|
for desc, data, book_id, base in reversed(d.jobs):
|
||||||
job = self.gui.job_manager.run_job(
|
job = self.gui.job_manager.run_job(
|
||||||
Dispatcher(self.book_polished), 'gui_polish', args=(data,),
|
Dispatcher(self.book_polished), 'gui_polish', args=(data,),
|
||||||
description=desc)
|
description=desc)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user