diff --git a/src/calibre/gui2/dialogs/metadata_bulk.py b/src/calibre/gui2/dialogs/metadata_bulk.py index 0b01b5b2a7..1bdaacf7ab 100644 --- a/src/calibre/gui2/dialogs/metadata_bulk.py +++ b/src/calibre/gui2/dialogs/metadata_bulk.py @@ -56,7 +56,8 @@ def get_cover_data(stream, ext): # {{{ Settings = namedtuple('Settings', 'remove_all remove add au aus do_aus rating pub do_series do_autonumber do_remove_format ' 'remove_format do_swap_ta do_remove_conv do_auto_author series do_series_restart series_start_value ' - 'do_title_case cover_action clear_series pubdate adddate do_title_sort languages clear_languages restore_original') + 'do_title_case cover_action clear_series pubdate adddate do_title_sort languages clear_languages restore_original comments') +null = object() class MyBlockingBusy(QDialog): # {{{ @@ -215,6 +216,14 @@ class MyBlockingBusy(QDialog): # {{{ im.trim(tweaks['cover_trim_fuzz_value']) cdata = im.export('jpg') cache.set_cover({book_id:cdata}) + elif args.cover_action == 'clone': + cdata = None + for book_id in self.ids: + cdata = cache.cover(book_id) + if cdata: + break + if cdata: + cache.set_cover({bid:cdata for bid in self.ids if bid != book_id}) # Formats if args.do_remove_format: @@ -262,6 +271,9 @@ class MyBlockingBusy(QDialog): # {{{ elif tweaks['series_index_auto_increment'] != 'no_change': cache.set_field('series_index', {bid:1.0 for bid in self.ids}) + if args.comments is not null: + cache.set_field('comments', {bid:args.comments for bid in self.ids}) + if args.do_remove_conv: cache.delete_conversion_options(self.ids) @@ -310,12 +322,16 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog): self.refresh_book_list.setChecked(gprefs['refresh_book_list_on_bulk_edit']) self.refresh_book_list.toggled.connect(self.save_refresh_booklist) self.ids = [self.db.id(r) for r in rows] + self.first_title = self.db.title(self.ids[0], index_is_id=True) + self.cover_clone.setToolTip(unicode(self.cover_clone.toolTip()) + ' (%s)' % self.first_title) self.box_title.setText('

' + _('Editing meta information for %d books') % len(rows)) self.write_series = False self.changed = False self.refresh_books = refresh_books + self.comments = null + self.comments_button.clicked.connect(self.set_comments) all_tags = self.db.all_tags() self.tags.update_items_cache(all_tags) @@ -373,6 +389,16 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog): self.authors.setFocus(Qt.OtherFocusReason) self.exec_() + def set_comments(self): + from calibre.gui2.dialogs.comments_dialog import CommentsDialog + d = CommentsDialog(self, '' if self.comments is null else (self.comments or ''), _('Comments')) + if d.exec_() == d.Accepted: + self.comments = d.textbox.html + b = self.comments_button + b.setStyleSheet('QPushButton { font-weight: bold }') + if unicode(b.text())[-1] != '*': + b.setText(unicode(b.text()) + ' *') + def save_refresh_booklist(self, *args): gprefs['refresh_book_list_on_bulk_edit'] = bool(self.refresh_book_list.isChecked()) @@ -960,13 +986,15 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog): cover_action = 'fromfmt' elif self.cover_trim.isChecked(): cover_action = 'trim' + elif self.cover_clone.isChecked(): + cover_action = 'clone' args = Settings(remove_all, remove, add, au, aus, do_aus, rating, pub, do_series, do_autonumber, do_remove_format, remove_format, do_swap_ta, do_remove_conv, do_auto_author, series, do_series_restart, series_start_value, do_title_case, cover_action, clear_series, pubdate, adddate, do_title_sort, languages, clear_languages, - restore_original) + restore_original, self.comments) source = self.s_r_sf_itemdata(None) do_sr = source and self.s_r_obj diff --git a/src/calibre/gui2/dialogs/metadata_bulk.ui b/src/calibre/gui2/dialogs/metadata_bulk.ui index 741f8cae54..b6e86652e8 100644 --- a/src/calibre/gui2/dialogs/metadata_bulk.ui +++ b/src/calibre/gui2/dialogs/metadata_bulk.ui @@ -62,16 +62,230 @@ &Basic metadata - - + + + + + 0 + 0 + + + + List of known series. You can add new series. + + + List of known series. You can add new series. + + + true + + + QComboBox::InsertAlphabetically + + + QComboBox::AdjustToMinimumContentsLengthWithIcon + + + 40 + + + + + + + If checked, the series will be cleared + - &Author(s): + &Clear series + + + + + + + &Apply date + + + + + + + &Published: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - authors + pubdate + + + + + + + + + MMM yyyy + + + true + + + + + + + Clear published date + + + ... + + + + :/images/trash.png:/images/trash.png + + + + + + + + + &Apply date + + + + + + + Open Tag Editor + + + Open Tag Editor + + + + :/images/chapters.png:/images/chapters.png + + + + + + + &Remove tags: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + remove_tags + + + + + + + Comma separated list of tags to remove from the books. + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 15 + + + + + + + + + + + 120 + 16777215 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + When doing a same format to same format conversion, +for e.g., EPUB to EPUB, calibre saves the original EPUB + as ORIGINAL_EPUB. This option tells calibre to restore + the EPUB from ORIGINAL_EPUB. Useful if you did a bulk + conversion of a large number of books and something went wrong. + + + Restore pre conversion &originals, if available + + + + + + + + + &Series: + + + Qt::PlainText + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + series + + + + + + + true + + + + + + + Add ta&gs: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + tags + + + + + + + Tags categorize the book. This is particularly useful while searching. <br><br>They can be any words or phrases, separated by commas. @@ -100,6 +314,131 @@ + + + + &Author(s): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + authors + + + + + + + Check this box to remove all tags from the books. + + + Remove &all + + + + + + + + + false + + + If not checked, the series number for the books will be set to 1. +If checked, selected books will be automatically numbered, in the order +you selected them. So if you selected Book A and then Book B, +Book A will have series number 1 and Book B series number 2. + + + &Automatically number books in this series + + + + + + + false + + + Series will normally be renumbered from the highest number in the database +for that series. Checking this box will tell calibre to start numbering +from the value in the box + + + &Force numbers to start with: + + + + + + + false + + + 1 + + + 99000000 + + + 1 + + + + + + + + + &Date: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + adddate + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + d MMM yyyy + + + true + + + + + + + ... + + + + :/images/trash.png:/images/trash.png + + + + + @@ -174,365 +513,6 @@ - - - - true - - - - - - - Add ta&gs: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - tags - - - - - - - Tags categorize the book. This is particularly useful while searching. <br><br>They can be any words or phrases, separated by commas. - - - - - - - Open Tag Editor - - - Open Tag Editor - - - - :/images/chapters.png:/images/chapters.png - - - - - - - &Remove tags: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - remove_tags - - - - - - - Comma separated list of tags to remove from the books. - - - - - - - Check this box to remove all tags from the books. - - - Remove &all - - - - - - - &Series: - - - Qt::PlainText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - series - - - - - - - - 0 - 0 - - - - List of known series. You can add new series. - - - List of known series. You can add new series. - - - true - - - QComboBox::InsertAlphabetically - - - QComboBox::AdjustToMinimumContentsLengthWithIcon - - - 40 - - - - - - - If checked, the series will be cleared - - - &Clear series - - - - - - - - - false - - - If not checked, the series number for the books will be set to 1. -If checked, selected books will be automatically numbered, in the order -you selected them. So if you selected Book A and then Book B, -Book A will have series number 1 and Book B series number 2. - - - &Automatically number books in this series - - - - - - - false - - - Series will normally be renumbered from the highest number in the database -for that series. Checking this box will tell calibre to start numbering -from the value in the box - - - &Force numbers to start with: - - - - - - - false - - - 1 - - - 99000000 - - - 1 - - - - - - - - - &Date: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - adddate - - - - - - - - - d MMM yyyy - - - true - - - - - - - ... - - - - :/images/trash.png:/images/trash.png - - - - - - - - - &Apply date - - - - - - - &Published: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - pubdate - - - - - - - - - MMM yyyy - - - true - - - - - - - Clear published date - - - ... - - - - :/images/trash.png:/images/trash.png - - - - - - - - - &Apply date - - - - - - - &Languages: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - languages - - - - - - - - - - Remove &all - - - - - - - Remove &format: - - - remove_format - - - - - - - - - - 120 - 16777215 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - When doing a same format to same format conversion, -for e.g., EPUB to EPUB, calibre saves the original EPUB - as ORIGINAL_EPUB. This option tells calibre to restore - the EPUB from ORIGINAL_EPUB. Useful if you did a bulk - conversion of a large number of books and something went wrong. - - - Restore pre conversion &originals, if available - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 15 - - - - @@ -622,21 +602,65 @@ Future conversion of these books will use the default settings. + + + + Set the covers of all selected books to be the same +as that of the first selected book. + + + &Clone covers + + + - - - - Qt::Vertical + + + + &Languages: - - - 20 - 40 - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + + languages + + + + + + + + + + Remove &all + + + + + + + Remove &format: + + + remove_format + + + + + + + + 0 + 0 + + + + Set the co&mments for all selected books + +