202
202
<p><i>Delete marked</i> is used to remove extra files/folders/covers that
203
203
have no entries in the database. Check the box next to the item you want
204
204
to delete. Use with caution.</p>
205
<p><i>Fix marked</i> is applicable only to covers (the two lines marked
206
'fixable'). In the case of missing cover files, checking the fixable
207
box and pushing this button will remove the cover mark from the
208
database for all the files in that category. In the case of extra
209
cover files, checking the fixable box and pushing this button will
210
add the cover mark to the database for all the files in that
206
<p><i>Fix marked</i> is applicable only to covers and missing formats
207
(the three lines marked 'fixable'). In the case of missing cover files,
208
checking the fixable box and pushing this button will tell calibre that
209
there is no cover for all of the books listed. Use this option if you
210
are not going to restore the covers from a backup. In the case of extra
211
cover files, checking the fixable box and pushing this button will tell
212
calibre that the cover files it found are correct for all the books
213
listed. Use this when you are not going to delete the file(s). In the
214
case of missing formats, checking the fixable box and pushing this
215
button will tell calibre that the formats are really gone. Use this if
216
you are not going to restore the formats from a backup.</p>
214
220
self.log = QTreeWidget(self)
215
221
self.log.itemChanged.connect(self.item_changed)
222
self.log.itemExpanded.connect(self.item_expanded_or_collapsed)
223
self.log.itemCollapsed.connect(self.item_expanded_or_collapsed)
216
224
self._layout.addWidget(self.log)
218
226
self.check_button = QPushButton(_('&Run the check again'))
333
341
for check in CHECKS:
334
342
builder(t, checker, check)
336
t.setColumnWidth(0, 200)
337
t.setColumnWidth(1, 400)
344
t.resizeColumnToContents(0)
345
t.resizeColumnToContents(1)
338
346
self.delete_button.setEnabled(False)
339
347
self.text_results = '\n'.join(plaintext)
349
def item_expanded_or_collapsed(self, item):
350
self.log.resizeColumnToContents(0)
351
self.log.resizeColumnToContents(1)
341
353
def item_changed(self, item, column):
342
354
self.fix_button.setEnabled(False)
343
355
for it in self.top_level_items.values():
375
387
unicode(it.text(1))))
376
388
self.run_the_check()
390
def fix_missing_formats(self):
391
tl = self.top_level_items['missing_formats']
392
child_count = tl.childCount()
393
for i in range(0, child_count):
395
id = item.data(0, Qt.UserRole).toInt()[0]
396
all = self.db.formats(id, index_is_id=True, verify_formats=False)
397
all = set([f.strip() for f in all.split(',')]) if all else set()
398
valid = self.db.formats(id, index_is_id=True, verify_formats=True)
399
valid = set([f.strip() for f in valid.split(',')]) if valid else set()
400
for fmt in all-valid:
401
self.db.remove_format(id, fmt, index_is_id=True, db_only=True)
378
403
def fix_missing_covers(self):
379
404
tl = self.top_level_items['missing_covers']
380
405
child_count = tl.childCount()