From 81400b56c9fbea19c46d4af61fe7944e5bbe39bb Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Mon, 18 Oct 2010 19:39:11 +0100 Subject: [PATCH 1/2] Make check_library delete work on linux and mac by checking the file type. --- src/calibre/gui2/dialogs/check_library.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/dialogs/check_library.py b/src/calibre/gui2/dialogs/check_library.py index 741a42893d..f07a25c51a 100644 --- a/src/calibre/gui2/dialogs/check_library.py +++ b/src/calibre/gui2/dialogs/check_library.py @@ -11,7 +11,7 @@ from PyQt4.Qt import QDialog, QVBoxLayout, QHBoxLayout, QTreeWidget, QLabel, \ from calibre.gui2.dialogs.confirm_delete import confirm from calibre.library.check_library import CheckLibrary, CHECKS -from calibre.library.database2 import delete_file +from calibre.library.database2 import delete_file, delete_tree class Item(QTreeWidgetItem): pass @@ -147,7 +147,11 @@ class CheckLibraryDialog(QDialog): for it in items: if it.checkState(1): try: - delete_file(os.path.join(self.db.library_path ,unicode(it.text(1)))) + p = os.path.join(self.db.library_path ,unicode(it.text(1))) + if os.path.isdir(p): + delete_tree(p) + else: + delete_file(p) except: print 'failed to delete', os.path.join(self.db.library_path ,unicode(it.text(1))) self.run_the_check() From d1e7517fcec66484a07ddaa27b9aa88049db2091 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Mon, 18 Oct 2010 19:43:35 +0100 Subject: [PATCH 2/2] Remove cancel button --- src/calibre/gui2/dialogs/check_library.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/calibre/gui2/dialogs/check_library.py b/src/calibre/gui2/dialogs/check_library.py index cf51999559..1cd11e7807 100644 --- a/src/calibre/gui2/dialogs/check_library.py +++ b/src/calibre/gui2/dialogs/check_library.py @@ -44,14 +44,10 @@ class CheckLibraryDialog(QDialog): self.delete = QPushButton('Delete &marked') self.delete.setDefault(False) self.delete.clicked.connect(self.delete_marked) - self.cancel = QPushButton('&Cancel') - self.cancel.setDefault(False) - self.cancel.clicked.connect(self.reject) self.bbox = QDialogButtonBox(self) - self.bbox.addButton(self.copy, QDialogButtonBox.ActionRole) self.bbox.addButton(self.check, QDialogButtonBox.ActionRole) self.bbox.addButton(self.delete, QDialogButtonBox.ActionRole) - self.bbox.addButton(self.cancel, QDialogButtonBox.RejectRole) + self.bbox.addButton(self.copy, QDialogButtonBox.ActionRole) self.bbox.addButton(self.ok, QDialogButtonBox.AcceptRole) h = QHBoxLayout()