~stub/ubuntu/precise/calibre/devel

« back to all changes in this revision

Viewing changes to src/calibre/gui2/dialogs/check_library.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-04-12 11:29:25 UTC
  • mfrom: (42.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110412112925-c7171kt2bb5rmft4
Tags: 0.7.50+dfsg-2
* debian/control: Build with libpodofo-dev to enable PDF metadata.
  (Closes: #619632)
* debian/control: Add libboost1.42-dev build dependency. Apparently it is
  needed in some setups. (Closes: #619807)
* debian/rules: Call dh_sip to generate a proper sip API dependency, to
  prevent crashes like #616372 for partial upgrades.
* debian/control: Bump python-qt4 dependency to >= 4.8.3-2, which reportedly
  fixes crashes on startup. (Closes: #619701, #620125)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
211
 
        category.</p>
 
205
 
 
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>
 
217
 
212
218
        '''))
213
219
 
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)
217
225
 
218
226
        self.check_button = QPushButton(_('&Run the check again'))
333
341
        for check in CHECKS:
334
342
            builder(t, checker, check)
335
343
 
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)
340
348
 
 
349
    def item_expanded_or_collapsed(self, item):
 
350
        self.log.resizeColumnToContents(0)
 
351
        self.log.resizeColumnToContents(1)
 
352
 
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()
377
389
 
 
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):
 
394
            item = tl.child(i);
 
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)
 
402
 
378
403
    def fix_missing_covers(self):
379
404
        tl = self.top_level_items['missing_covers']
380
405
        child_count = tl.childCount()