From 5527c1d04c713d8b35b73fbfd2ddd6a1a31ca8eb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 25 May 2017 13:27:53 +0530 Subject: [PATCH] Re-organize the adding books preferences dialog --- src/calibre/gui2/preferences/adding.py | 10 +- src/calibre/gui2/preferences/adding.ui | 272 ++++++++++++++++--------- 2 files changed, 184 insertions(+), 98 deletions(-) diff --git a/src/calibre/gui2/preferences/adding.py b/src/calibre/gui2/preferences/adding.py index 250b42c7d7..05a4e1f13e 100644 --- a/src/calibre/gui2/preferences/adding.py +++ b/src/calibre/gui2/preferences/adding.py @@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en' import os -from PyQt5.Qt import Qt +from PyQt5.Qt import Qt, QVBoxLayout, QFormLayout from calibre.gui2.preferences import ConfigWidgetBase, test_widget, \ CommaSeparatedList, AbortCommit @@ -45,6 +45,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): r('auto_convert_same_fmt', gprefs) self.filename_pattern = FilenamePattern(self) + self.metadata_box.l = QVBoxLayout(self.metadata_box) self.metadata_box.layout().insertWidget(0, self.filename_pattern) self.filename_pattern.changed_signal.connect(self.changed_signal.emit) self.auto_add_browse_button.clicked.connect(self.choose_aa_path) @@ -54,6 +55,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.tag_map_rules = self.add_filter_rules = None self.tag_map_rules_button.clicked.connect(self.change_tag_map_rules) self.add_filter_rules_button.clicked.connect(self.change_add_filter_rules) + self.tabWidget.setCurrentIndex(0) + self.actions_tab.layout().setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) def change_tag_map_rules(self): from calibre.gui2.tag_mapper import RulesDialog @@ -182,7 +185,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): # Update rules used int he auto adder gui.auto_adder.read_rules() + if __name__ == '__main__': - from PyQt5.Qt import QApplication - app = QApplication([]) + from calibre.gui2 import Application + app = Application([]) test_widget('Import/Export', 'Adding') diff --git a/src/calibre/gui2/preferences/adding.ui b/src/calibre/gui2/preferences/adding.ui index b92826d8c6..706281c065 100644 --- a/src/calibre/gui2/preferences/adding.ui +++ b/src/calibre/gui2/preferences/adding.ui @@ -19,92 +19,148 @@ 0 - + - The add &process + Reading &metadata - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Swap the firstname and lastname of the author. This affects only metadata read from file names. - - - &Swap author firstname and lastname - - - - - - - + + + - &Tags to apply when adding a book: + Here you can control how calibre will read metadata from the files you add to it. calibre can either read metadata from the contents of the file, or from the filename. - - opt_new_book_tags + + true - - + + - A comma-separated list of tags that will be applied to books added to the library + + + + Read &metadata from file contents rather than file name - + + + + Swap the firstname and lastname of the author. This affects only metadata read from file names. + + + &Swap author firstname and lastname when reading author from filename + + + + + + + 0 + 100 + + &Configure metadata from file name - - - - - Qt::Vertical - - - - 20 - 363 - - - - - - + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Adding &actions + + + + + + &Mark newly added books + + + + + + + Qt::Horizontal + + + + When using the "&Copy to library" action to copy books between libraries, preserve the date + + + + When using the "Copy to library" action check for &duplicates with the same title and author + + + + + + Qt::Horizontal + + + + Automatically &convert added books to the current output format - + + + + This will force an automatic conversion even if the file being added is the same format as the output format. For example, if you set your output format to EPUB and add an EPUB file, an EPUB to EPUB conversion will be run. + + + When autoconverting, convert even if the format being added is the &same as the output format + + + + + + + Qt::Horizontal + + + + + + + Automerge: If books with similar titles and authors found, merge the incoming formats automatically into +existing book records. The box to the right controls what happens when an existing record already has +the incoming format. Note that this option also affects the Copy to library action. + +Title match ignores leading indefinite articles ("the", "a", "an"), punctuation, case, etc. Author match is exact. + + + &Automerge added books if they already exist: + + + + Automerge: If books with similar titles and authors found, merge the incoming formats automatically into @@ -120,75 +176,101 @@ Author matching is exact. - - - - Here you can control how calibre will read metadata from the files you add to it. calibre can either read metadata from the contents of the file, or from the filename. - - - true + + + + Qt::Horizontal - - - - Read &metadata from file contents rather than file name + + + + Qt::Horizontal - - + + - &Mark newly added books + &Tags to apply when adding a book: + + + opt_new_book_tags - - + + + + + 0 + 0 + + - Automerge: If books with similar titles and authors found, merge the incoming formats automatically into -existing book records. The box to the right controls what happens when an existing record already has -the incoming format. Note that this option also affects the Copy to library action. - -Title match ignores leading indefinite articles ("the", "a", "an"), punctuation, case, etc. Author match is exact. - - - &Automerge added books if they already exist in the calibre library: + A comma-separated list of tags that will be applied to books added to the library - - - - When using the "Copy to library" action check for &duplicates with the same title and author + + + + Qt::Horizontal - - - - This will force an automatic conversion even if the file being added is the same format as the output format. For example, if you set your output format to EPUB and add an EPUB file, an EPUB to EPUB conversion will be run. - + + - When autoconverting, convert even if the format being added is the &same as the output format + Control &how tags are processed: + + + tag_map_rules_button - + Create rules that can filter or transform tags on added books automatically as soon as they are added. - Create &rules to filter/transform tags + &Rules to filter tags read from metadata - - + + + + Qt::Horizontal + + + + + - Rules to &filter added files + Control &which files are added during bulk imports: + + + add_filter_rules_button + + + + + + + <p>You can specify rules to add/ignore files here. These will be used when recursively adding books from directories. + + + Rules to filter added &files + + + + + + + Qt::Horizontal