From 716b8a0905ce02205a35a16b5e03a46742f9660d Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Thu, 24 Jun 2010 19:40:28 +0100 Subject: [PATCH 1/3] Changes to FAQ --- src/calibre/manual/faq.rst | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/calibre/manual/faq.rst b/src/calibre/manual/faq.rst index 4c89ed48c0..351eb6a812 100644 --- a/src/calibre/manual/faq.rst +++ b/src/calibre/manual/faq.rst @@ -107,17 +107,27 @@ How does |app| manage collections on my SONY reader? When |app| connects with the device, it retrieves all collections for the books on the device. The collections of which books are members are shown on the device view. -When you send a book to the device, |app| will if necessary create new collections based on the metadata for -that book, then add the book to the collections. By default, collections are created from tags and series. You -can control what metadata is used by going to Preferences->Plugins->Device Interface plugins and customizing -the SONY device interface plugin. +When you send a book to the device, |app| will add the book to collections based on the metadata for that book. By +default, collections are created from tags and series. You can control what metadata is used by going to +Preferences->Plugins->Device Interface plugins and customizing the SONY device interface plugin. If you remove all +values, |app| will not add the book to any collection. -|app| will not delete already existing collections for a book on your device when you resend the book to the -device. To ensure that the collections are based only on current |app| metadata, first delete the books from -the device, and then resend the books. +Collection management is largely controlled by 'Preserve device collections' found at Preferences->Add/Save->Sending +to device. If checked (the default), managing collections is left to the user; |app| will not delete already +existing collections for a book on your device when you resend the book to the device, but |app| will add the book to +collections if necessary. To ensure that the collections for a book are based only on current |app| metadata, first +delete the books from the device, then resend the books. You can edit collections directly on the device view by +double-clicking or right-clicking in the collections column. -You can edit collections on the device in the device view in |app| by double clicking or right clicking on the -collections field. This is the only way to remove a book from a collection. +If 'Preserve device collections' is not checked, then |app| will manage collections. Collections will be built using +|app| metadata exclusively. Sending a book to the device will correct the collections for that book so its +collections exactly match the book's metadata. Collections are added and deleted as necessary. Editing collections on +the device pane is not permitted, because collections not in the metadata will be removed automatically. + +In summary, check 'Preserve device collections' if you want to manage collections yourself. Collections for a book +will never be removed by |app|, but can be removed by you by editing on the device view. Uncheck 'Preserve device +collections' if you want |app| to manage the collections, adding books to and removing books from collections as +needed. Can I use both |app| and the SONY software to manage my reader? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 91cd75909e1d1eae0f2c324267dba2e6afd36d58 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Thu, 24 Jun 2010 21:26:04 +0100 Subject: [PATCH 2/3] Fix renaming bug where multiple items were renamed to the same thing --- src/calibre/gui2/actions.py | 5 +++-- src/calibre/gui2/dialogs/tag_list_editor.py | 5 ++++- src/calibre/gui2/tag_view.py | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/actions.py b/src/calibre/gui2/actions.py index f3f6ee604c..43a657ae67 100644 --- a/src/calibre/gui2/actions.py +++ b/src/calibre/gui2/actions.py @@ -839,10 +839,11 @@ class EditMetadataAction(object): # {{{ d = TagListEditor(self, tag_to_match=None, data=result, compare=compare) d.exec_() if d.result() == d.Accepted: - to_rename = d.to_rename # dict of new text to old id + to_rename = d.to_rename # dict of new text to old ids to_delete = d.to_delete # list of ids for text in to_rename: - model.rename_collection(old_id=to_rename[text], new_name=unicode(text)) + for old_id in to_rename[text]: + model.rename_collection(old_id, new_name=unicode(text)) for item in to_delete: model.delete_collection_using_id(item) self.upload_collections(model.db, view=view, oncard=oncard) diff --git a/src/calibre/gui2/dialogs/tag_list_editor.py b/src/calibre/gui2/dialogs/tag_list_editor.py index 6d91ed2ee2..9eb368e5e4 100644 --- a/src/calibre/gui2/dialogs/tag_list_editor.py +++ b/src/calibre/gui2/dialogs/tag_list_editor.py @@ -73,7 +73,10 @@ class TagListEditor(QDialog, Ui_TagListEditor): return if item.text() != self.item_before_editing.text(): (id,ign) = self.item_before_editing.data(Qt.UserRole).toInt() - self.to_rename[item.text()] = id + if item.text() not in self.to_rename: + self.to_rename[item.text()] = [id] + else: + self.to_rename[item.text()].append(id) def rename_tag(self): item = self.available_tags.currentItem() diff --git a/src/calibre/gui2/tag_view.py b/src/calibre/gui2/tag_view.py index 140b1e1e52..34b9bd1426 100644 --- a/src/calibre/gui2/tag_view.py +++ b/src/calibre/gui2/tag_view.py @@ -720,7 +720,9 @@ class TagBrowserMixin(object): # {{{ delete_func = partial(db.delete_custom_item_using_id, label=cc_label) if rename_func: for text in to_rename: - rename_func(old_id=to_rename[text], new_name=unicode(text)) + for old_id in to_rename[text]: + print 'rename', old_id, text + rename_func(old_id, new_name=unicode(text)) for item in to_delete: delete_func(item) From f299bf01ad9a643e37a74a969302c96f3e9c0f1c Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Thu, 24 Jun 2010 21:37:23 +0100 Subject: [PATCH 3/3] Remove print statement --- src/calibre/gui2/tag_view.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/calibre/gui2/tag_view.py b/src/calibre/gui2/tag_view.py index 34b9bd1426..189caea6ea 100644 --- a/src/calibre/gui2/tag_view.py +++ b/src/calibre/gui2/tag_view.py @@ -721,7 +721,6 @@ class TagBrowserMixin(object): # {{{ if rename_func: for text in to_rename: for old_id in to_rename[text]: - print 'rename', old_id, text rename_func(old_id, new_name=unicode(text)) for item in to_delete: delete_func(item)