From a2a8edb1f50ec0f8fff89f96a33a9f4fb94f0b75 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 18 Jun 2009 18:13:09 -0700 Subject: [PATCH 1/8] Fix #2617 (Epub output doesn't use DB Metadata/Cover, uses whatever is in source file) --- src/calibre/gui2/convert/single.py | 2 +- src/calibre/gui2/tools.py | 23 +++++++++++++++++++++-- src/calibre/gui2/viewer/documentview.py | 4 ++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/convert/single.py b/src/calibre/gui2/convert/single.py index 4f91d848d8..ea839e6e80 100644 --- a/src/calibre/gui2/convert/single.py +++ b/src/calibre/gui2/convert/single.py @@ -228,7 +228,7 @@ class Config(ResizableDialog, Ui_Dialog): return x = w.commit(save_defaults=False) recs.update(x) - self.opf_path, self.cover_path = self.mw.opf_file, self.mw.cover_file + self.opf_file, self.cover_file = self.mw.opf_file, self.mw.cover_file self._recommendations = recs if self.db is not None: recs['gui_preferred_input_format'] = self.input_format diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index 5610dd0ecf..58b755eeca 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -48,12 +48,21 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, out_format out_file = PersistentTemporaryFile('.' + d.output_format) out_file.write(d.output_format) out_file.close() + temp_files = [] desc = _('Convert book %d of %d (%s)') % (i + 1, total, repr(mi.title)) recs = cPickle.loads(d.recommendations) args = [in_file, out_file.name, recs] - temp_files = [out_file] + if d.opf_file is not None: + recs.append(('read_metadata_from_opf', d.opf_file.name, + OptionRecommendation.HIGH)) + temp_files.append(d.opf_file) + if d.cover_file is not None: + recs.append(('cover', d.cover_file.name, + OptionRecommendation.HIGH)) + temp_files.append(d.cover_file) + temp_files.append(out_file) jobs.append(('gui_convert', args, desc, d.output_format.upper(), book_id, temp_files)) changed = True @@ -104,11 +113,21 @@ def convert_bulk_ebook(parent, db, book_ids, out_format=None): out_file = PersistentTemporaryFile('.' + output_format) out_file.write(output_format) out_file.close() + temp_files = [] + + if d.opf_file is not None: + recs.append(('read_metadata_from_opf', d.opf_file.name, + OptionRecommendation.HIGH)) + temp_files.append(d.opf_file) + if d.cover_file is not None: + recs.append(('cover', d.cover_file.name, + OptionRecommendation.HIGH)) + temp_files.append(d.cover_file) desc = _('Convert book %d of %d (%s)') % (i + 1, total, repr(mi.title)) args = [in_file, out_file.name, recs] - temp_files = [out_file] + temp_files.append(out_file) jobs.append(('gui_convert', args, desc, d.output_format.upper(), book_id, temp_files)) changed = True diff --git a/src/calibre/gui2/viewer/documentview.py b/src/calibre/gui2/viewer/documentview.py index 4bca78bdc6..1fdd3a503b 100644 --- a/src/calibre/gui2/viewer/documentview.py +++ b/src/calibre/gui2/viewer/documentview.py @@ -190,6 +190,10 @@ class Document(QWebPage): def animated_scroll_done(self): self.emit(SIGNAL('animated_scroll_done()')) + @pyqtSignature("QString") + def debug(self, msg): + prints(msg) + def reference_mode(self, enable): self.javascript(('enter' if enable else 'leave')+'_reference_mode()') From a4c25606026a979da62031edb223a99c08a8db7e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 18 Jun 2009 19:52:10 -0700 Subject: [PATCH 2/8] beta 7 --- src/calibre/constants.py | 2 +- src/calibre/trac/plugins/download.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 3663f9fd13..0372bf3cc4 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -2,7 +2,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' __appname__ = 'calibre' -__version__ = '0.6.0b6' +__version__ = '0.6.0b7' __author__ = "Kovid Goyal " import re diff --git a/src/calibre/trac/plugins/download.py b/src/calibre/trac/plugins/download.py index 2372f14f86..b0dfed3113 100644 --- a/src/calibre/trac/plugins/download.py +++ b/src/calibre/trac/plugins/download.py @@ -9,8 +9,8 @@ DEPENDENCIES = [ ('setuptools', '0.6c5', 'setuptools', 'python-setuptools', 'python-setuptools-devel'), ('Python Imaging Library', '1.1.6', 'imaging', 'python-imaging', 'python-imaging'), ('libusb', '0.1.12', None, None, None), - ('Qt', '4.5.0', 'qt', 'libqt4-core libqt4-gui', 'qt4'), - ('PyQt', '4.5.0', 'PyQt4', 'python-qt4', 'PyQt4'), + ('Qt', '4.5.1', 'qt', 'libqt4-core libqt4-gui', 'qt4'), + ('PyQt', '4.5.1', 'PyQt4', 'python-qt4', 'PyQt4'), ('python-mechanize', '0.1.11', 'dev-python/mechanize', 'python-mechanize', 'python-mechanize'), ('ImageMagick', '6.3.5', 'imagemagick', 'imagemagick', 'ImageMagick'), ('xdg-utils', '1.0.2', 'xdg-utils', 'xdg-utils', 'xdg-utils'), From f4ec00a9d908e650e4d8258d7ea1c2ede578549f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Jun 2009 07:23:28 -0700 Subject: [PATCH 3/8] Fix #2663 (0.6b7 breaks bulk conversion) --- src/calibre/gui2/tools.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index 58b755eeca..34ab2d9b77 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -115,18 +115,20 @@ def convert_bulk_ebook(parent, db, book_ids, out_format=None): out_file.close() temp_files = [] + lrecs = list(recs) + if d.opf_file is not None: - recs.append(('read_metadata_from_opf', d.opf_file.name, + lrecs.append(('read_metadata_from_opf', d.opf_file.name, OptionRecommendation.HIGH)) temp_files.append(d.opf_file) if d.cover_file is not None: - recs.append(('cover', d.cover_file.name, + lrecs.append(('cover', d.cover_file.name, OptionRecommendation.HIGH)) temp_files.append(d.cover_file) desc = _('Convert book %d of %d (%s)') % (i + 1, total, repr(mi.title)) - args = [in_file, out_file.name, recs] + args = [in_file, out_file.name, lrecs] temp_files.append(out_file) jobs.append(('gui_convert', args, desc, d.output_format.upper(), book_id, temp_files)) From 32b024475eb162e192f45e390b434d1a3518ef51 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Jun 2009 07:34:45 -0700 Subject: [PATCH 4/8] beta 8 --- src/calibre/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 0372bf3cc4..b61169cef2 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -2,7 +2,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' __appname__ = 'calibre' -__version__ = '0.6.0b7' +__version__ = '0.6.0b8' __author__ = "Kovid Goyal " import re From 2abf0d2f0ee9b9a45fb5a7c2e161dad12ce17334 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Jun 2009 08:10:39 -0700 Subject: [PATCH 5/8] Fix #2666 (zipped html can't be converted to epub - failing on css values) --- src/calibre/ebooks/epub/output.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/calibre/ebooks/epub/output.py b/src/calibre/ebooks/epub/output.py index 0794747a64..4ddf1f7915 100644 --- a/src/calibre/ebooks/epub/output.py +++ b/src/calibre/ebooks/epub/output.py @@ -217,7 +217,7 @@ class EPUBOutput(OutputFormatPlugin): Perform various markup transforms to get the output to render correctly in the quirky ADE. ''' - from calibre.ebooks.oeb.base import XPNSMAP, XHTML + from calibre.ebooks.oeb.base import XPNSMAP, XHTML, OEB_STYLES from lxml.etree import XPath as _XPath from functools import partial XPath = partial(_XPath, namespaces=XPNSMAP) @@ -276,12 +276,6 @@ class EPUBOutput(OutputFormatPlugin): for tag in XPath('//h:img[@src]')(root): tag.set('src', tag.get('src', '').replace('&', '')) - stylesheet = self.oeb.manifest.hrefs['stylesheet.css'] - stylesheet.data.add('a { color: inherit; text-decoration: inherit; ' - 'cursor: default; }') - stylesheet.data.add('a[href] { color: blue; ' - 'text-decoration: underline; cursor:pointer; }') - special_chars = re.compile(u'[\u200b\u00ad]') for elem in root.iterdescendants(): if getattr(elem, 'text', False): @@ -291,5 +285,19 @@ class EPUBOutput(OutputFormatPlugin): elem.tail = special_chars.sub('', elem.tail) elem.tail = elem.tail.replace(u'\u2011', '-') + stylesheet = None + for item in self.oeb.manifest: + if item.media_type.lower() in OEB_STYLES: + stylesheet = item + break + + if stylesheet is not None: + stylesheet.data.add('a { color: inherit; text-decoration: inherit; ' + 'cursor: default; }') + stylesheet.data.add('a[href] { color: blue; ' + 'text-decoration: underline; cursor:pointer; }') + else: + self.oeb.log.warn('No stylesheet found') + From 41de18c01479b0c889410d248caa57d13a0b2ab5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Jun 2009 08:40:52 -0700 Subject: [PATCH 6/8] Always show the percent completion for finished jobs as a 100% --- src/calibre/gui2/jobs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/jobs.py b/src/calibre/gui2/jobs.py index b57e1836d2..dbe1746e50 100644 --- a/src/calibre/gui2/jobs.py +++ b/src/calibre/gui2/jobs.py @@ -73,7 +73,8 @@ class JobManager(QAbstractTableModel): if col == 1: return QVariant(job.status_text) if col == 2: - return QVariant(job.percent) + p = 100. if job.is_finished else job.percent + return QVariant(p) if col == 3: rtime = job.running_time if rtime is None: From b6e7713fe3cb8fef21d18b873e7072051fc392ea Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Jun 2009 08:45:07 -0700 Subject: [PATCH 7/8] Fix main memory and storage card detection order for BeBook on OS X --- src/calibre/devices/bebook/driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/devices/bebook/driver.py b/src/calibre/devices/bebook/driver.py index 2fb756b532..6709cf217c 100644 --- a/src/calibre/devices/bebook/driver.py +++ b/src/calibre/devices/bebook/driver.py @@ -63,7 +63,7 @@ class BEBOOK(USBMS): except: card_num = None - if card_num is not None and main_num is not None and card_num < main_num: + if card_num is not None and main_num is not None and card_num > main_num: names['main'] = card names['carda'] = main From 7e2dd6e5b9bf060df82ae33e1ef6167ce7f460f9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Jun 2009 08:46:20 -0700 Subject: [PATCH 8/8] Fix main memory and storage card detection order for BeBook on windows --- src/calibre/devices/bebook/driver.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/calibre/devices/bebook/driver.py b/src/calibre/devices/bebook/driver.py index 6709cf217c..dacce1ba31 100644 --- a/src/calibre/devices/bebook/driver.py +++ b/src/calibre/devices/bebook/driver.py @@ -35,12 +35,10 @@ class BEBOOK(USBMS): SUPPORTS_SUB_DIRS = True - FDI_LUNS = {'lun0':1, 'lun1':0, 'lun2':2} - def windows_sort_drives(self, drives): main = drives.get('main', None) card = drives.get('carda', None) - if card and main and card < main: + if card and main and card > main: drives['main'] = card drives['carda'] = main