From 2d33bab4bd90533abcde8ba3da5b2c611dd76540 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 26 Jan 2010 13:23:44 -0700 Subject: [PATCH 1/5] OSX notifications: Revert to using Qt+Growl as the Growl python bindings apparently crash on some systems --- src/calibre/devices/hanvon/driver.py | 2 +- src/calibre/gui2/notify.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/calibre/devices/hanvon/driver.py b/src/calibre/devices/hanvon/driver.py index 192c3e7fdb..ea8d604dd5 100644 --- a/src/calibre/devices/hanvon/driver.py +++ b/src/calibre/devices/hanvon/driver.py @@ -23,7 +23,7 @@ class N516(USBMS): VENDOR_ID = [0x0525] PRODUCT_ID = [0xa4a5] - BCD = [0x323] + BCD = [0x323, 0x326] VENDOR_NAME = 'INGENIC' WINDOWS_MAIN_MEM = '_FILE-STOR_GADGE' diff --git a/src/calibre/gui2/notify.py b/src/calibre/gui2/notify.py index 76f32c5ce6..009f94c4c3 100644 --- a/src/calibre/gui2/notify.py +++ b/src/calibre/gui2/notify.py @@ -85,6 +85,8 @@ class QtNotifier(Notifier): def __call__(self, body, summary=None, replaces_id=None, timeout=0): timeout, body, summary = self.get_msg_parms(timeout, body, summary) if self.systray is not None: + if isosx and isinstance(body, unicode): + body = body.encode('utf-8') self.systray.showMessage(summary, body, self.systray.Information, timeout) @@ -127,10 +129,10 @@ def get_notifier(systray=None): ans = FDONotifier() if not ans.ok: ans = None - if isosx: - ans = GrowlNotifier() - if not ans.ok: - ans = None + #if isosx: + # ans = GrowlNotifier() + # if not ans.ok: + # ans = None if ans is None: ans = QtNotifier(systray) if not ans.ok: From 67b7e9dce3c3393af88055ca85205f3f1f94bafc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 26 Jan 2010 13:43:04 -0700 Subject: [PATCH 2/5] ... --- src/calibre/gui2/notify.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/notify.py b/src/calibre/gui2/notify.py index 009f94c4c3..0f498c45d1 100644 --- a/src/calibre/gui2/notify.py +++ b/src/calibre/gui2/notify.py @@ -85,10 +85,18 @@ class QtNotifier(Notifier): def __call__(self, body, summary=None, replaces_id=None, timeout=0): timeout, body, summary = self.get_msg_parms(timeout, body, summary) if self.systray is not None: - if isosx and isinstance(body, unicode): - body = body.encode('utf-8') - self.systray.showMessage(summary, body, self.systray.Information, - timeout) + hide = False + try: + if not isinstance(body, unicode): + body = body.decode('utf-8') + if isosx and not self.systray.isVisible(): + self.systray.show() + hide = True + self.systray.showMessage(summary, body, self.systray.Information, + timeout) + finally: + if hide: + self.systray.hide() class GrowlNotifier(Notifier): From 9d258325182ba259bce1ad60e46928b38a8c91fe Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 26 Jan 2010 14:31:54 -0700 Subject: [PATCH 3/5] ... --- src/calibre/gui2/notify.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/calibre/gui2/notify.py b/src/calibre/gui2/notify.py index 0f498c45d1..385fdd92b7 100644 --- a/src/calibre/gui2/notify.py +++ b/src/calibre/gui2/notify.py @@ -85,18 +85,21 @@ class QtNotifier(Notifier): def __call__(self, body, summary=None, replaces_id=None, timeout=0): timeout, body, summary = self.get_msg_parms(timeout, body, summary) if self.systray is not None: - hide = False try: - if not isinstance(body, unicode): - body = body.decode('utf-8') - if isosx and not self.systray.isVisible(): - self.systray.show() - hide = True - self.systray.showMessage(summary, body, self.systray.Information, - timeout) - finally: - if hide: - self.systray.hide() + hide = False + try: + if not isinstance(body, unicode): + body = body.decode('utf-8') + if isosx and not self.systray.isVisible(): + self.systray.show() + hide = True + self.systray.showMessage(summary, body, self.systray.Information, + timeout) + finally: + if hide: + self.systray.hide() + except: + pass class GrowlNotifier(Notifier): From 551f35426537c70e3baa1b4f698b2dd0749b042a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 26 Jan 2010 17:16:41 -0700 Subject: [PATCH 4/5] Fix #4697 (HTML eBooks not shown) --- src/calibre/devices/eb600/driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/devices/eb600/driver.py b/src/calibre/devices/eb600/driver.py index f1303fa956..5183aae96a 100644 --- a/src/calibre/devices/eb600/driver.py +++ b/src/calibre/devices/eb600/driver.py @@ -154,7 +154,7 @@ class ECLICTO(EB600): name = 'eClicto Device Interface' gui_name = 'eClicto' - FORMATS = ['epub', 'pdf', 'txt'] + FORMATS = ['epub', 'pdf', 'htm', 'html', 'txt'] VENDOR_NAME = 'ECLICTO' WINDOWS_MAIN_MEM = 'EBOOK' From 10d6c50ac592c5a6295895ea93817fc9492568b9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 27 Jan 2010 08:52:47 -0700 Subject: [PATCH 5/5] ... --- src/calibre/ebooks/pdf/reflow.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/calibre/ebooks/pdf/reflow.py b/src/calibre/ebooks/pdf/reflow.py index 3fef8c30ce..8203b49dde 100644 --- a/src/calibre/ebooks/pdf/reflow.py +++ b/src/calibre/ebooks/pdf/reflow.py @@ -170,6 +170,10 @@ class Column(object): return self.elements[idx-1] +class Box(list): + + def __init__(self, type='p'): + self.type = type class Region(object): @@ -222,6 +226,10 @@ class Region(object): for x in self.columns: self.elements.extend(x) + # Find block quotes + indented = [i for (i, x) in enumerate(self.elements) if x.indent_fraction >= 0.2] + + class Page(object):