From 88a56dc648720d3a23601c93d5a380303b02f9cc Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Wed, 15 Sep 2010 22:28:57 +0100 Subject: [PATCH 1/4] Fix possible problem with refreshing device view. If the view had never been sorted, then refresh would not call reset. This might explain the kobo refresh problem. --- src/calibre/gui2/library/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index c746a5aa56..3370fd4b75 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -1027,7 +1027,9 @@ class DeviceBooksModel(BooksModel): # {{{ def resort(self, reset=True): if self.sorted_on: self.sort(self.column_map.index(self.sorted_on[0]), - self.sorted_on[1], reset=reset) + self.sorted_on[1], reset=False) + if reset: + self.reset() def columnCount(self, parent): if parent and parent.isValid(): From f8cdfe2777fc69d0e589e6873ff857bbd0307c05 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 15 Sep 2010 16:00:23 -0600 Subject: [PATCH 2/4] ... --- src/calibre/devices/prs505/driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/devices/prs505/driver.py b/src/calibre/devices/prs505/driver.py index 094c12cf0c..f90a8ab263 100644 --- a/src/calibre/devices/prs505/driver.py +++ b/src/calibre/devices/prs505/driver.py @@ -35,7 +35,7 @@ class PRS505(USBMS): VENDOR_NAME = 'SONY' WINDOWS_MAIN_MEM = re.compile( - r'(PRS-(505|500))|' + r'(PRS-(505|500|300))|' r'(PRS-((700[#/])|((6|9|3)(0|5)0&)))' ) WINDOWS_CARD_A_MEM = re.compile( From f5ea7426db5a7e8044cee0e83ec5d18f421aee19 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 15 Sep 2010 22:23:59 -0600 Subject: [PATCH 3/4] Conversion pipeline: Don't die if rescaling of image raises an exception, just ignore and continue --- src/calibre/ebooks/oeb/transforms/rescale.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/oeb/transforms/rescale.py b/src/calibre/ebooks/oeb/transforms/rescale.py index 55aafded5c..c3b4d6d40c 100644 --- a/src/calibre/ebooks/oeb/transforms/rescale.py +++ b/src/calibre/ebooks/oeb/transforms/rescale.py @@ -72,10 +72,13 @@ class RescaleImages(object): Qt.IgnoreAspectRatio, Qt.SmoothTransformation) data = pixmap_to_data(img, format=ext) else: - im = im.resize((int(new_width), int(new_height)), PILImage.ANTIALIAS) - of = cStringIO.StringIO() - im.convert('RGB').save(of, ext) - data = of.getvalue() + try: + im = im.resize((int(new_width), int(new_height)), PILImage.ANTIALIAS) + of = cStringIO.StringIO() + im.convert('RGB').save(of, ext) + data = of.getvalue() + except: + self.log.exception('Failed to rescale image') if data is not None: item.data = data item.unload_data_from_memory() From 9f25063ad52f95fe23a1def1cb484bc7778a7c91 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Thu, 16 Sep 2010 11:19:25 +0100 Subject: [PATCH 4/4] Fix problem with device views sometimes not updating after sync_booklists. --- src/calibre/gui2/device.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index f839e1d519..36f6a7d6eb 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -1230,7 +1230,7 @@ class DeviceMixin(object): # {{{ self.location_manager.update_devices(cp, fs, self.device_manager.device.icon) # reset the views so that up-to-date info is shown. These need to be - # here because the sony driver updates collections in sync_booklists + # here because some drivers update collections in sync_booklists self.memory_view.reset() self.card_a_view.reset() self.card_b_view.reset() @@ -1470,6 +1470,7 @@ class DeviceMixin(object): # {{{ if update_metadata: if self.device_manager.is_device_connected: - self.device_manager.sync_booklists(None, booklists) + self.device_manager.sync_booklists( + Dispatcher(self.metadata_synced), booklists) # }}}