def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) # By default, the settings contain a single groupbox with a listview in it. We want to make this a bit more # efficient (and pretty), so we will create a new hlayout for bot the default listview, as well as our custom # groups. self.w_ext = qt.QWidget() self.l_ext = qt.QVBoxLayout(self.w_ext) self.l.addWidget(self.w_ext, *self.l.getItemPosition(self.l.indexOf(self.gb))) self.l.removeWidget(self.gb) self.gb.hide() # Now we want to move over the listview into the new layout. We'll also style it a bit. self.gb.l.removeWidget(self.fields_view) self.l_ext.addWidget(self.fields_view) self.fields_view.setStyleSheet('QListView::item { margin: 2px 0; }') self.fields_view.setSelectionMode(qt.QAbstractItemView.NoSelection) # Add all groupboxes for the various settings. self.add_groupbox_thresholds() self.add_groupbox_goodreads_plugin_integration() # Finally, we add a custom widget to manage the shelf -> tags mappings. self.table = ShelfTagMappingWidget(self, plugin_prefs.get(KEY_SHELF_MAPPINGS)) self.l.addWidget(self.table, self.l.rowCount(), 0, 1, self.l.columnCount()) self.l.setRowStretch(self.l.rowCount() - 1, 1) # Open default groupboxes now. Cannot be done earlier because doing so before all items are laid out results in # some calculations returning the wrong values, messing up the layout. self.gb_thresholds.setOpen(True)
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] other_group_box = QGroupBox('Other options', self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QHBoxLayout() other_group_box.setLayout(other_group_box_layout) max_label = QLabel( 'Maximum title/author search matches to evaluate (1 = fastest):', self) max_label.setToolTip( 'Libri.hu do not always have links to large covers for every ISBN\n' 'of the same book. Increasing this value will take effect when doing\n' 'title/author searches to consider more ISBN editions.\n\n' 'This will increase the potential likelihood of getting a larger cover\n' 'though does not guarantee it.') other_group_box_layout.addWidget(max_label) self.max_downloads_spin = QtGui.QSpinBox(self) self.max_downloads_spin.setMinimum(5) self.max_downloads_spin.setMaximum(50) self.max_downloads_spin.setProperty( 'value', c.get(KEY_MAX_DOWNLOADS, DEFAULT_STORE_VALUES[KEY_MAX_DOWNLOADS])) other_group_box_layout.addWidget(self.max_downloads_spin) other_group_box_layout.insertStretch(-1)
def commit(self): DefaultConfigWidget.commit(self) new_prefs = {} new_prefs[KEY_GET_EDITIONS] = self.get_editions_checkbox.checkState() == Qt.Checked new_prefs[KEY_GET_ALL_AUTHORS] = self.all_authors_checkbox.checkState() == Qt.Checked new_prefs[KEY_GENRE_MAPPINGS] = self.edit_table.get_data() plugin_prefs[STORE_NAME] = new_prefs
def commit(self): DefaultConfigWidget.commit(self) new_prefs = {} new_prefs[KEY_MAX_DOWNLOADS] = int( unicode(self.max_downloads_spin.value())) new_prefs[KEY_APPEND_CONTENTS] = self.contents_checkbox.checkState( ) == Qt.Checked plugin_prefs[STORE_NAME] = new_prefs
def commit(self): DefaultConfigWidget.commit(self) # Store the custom settings. plugin_prefs.set(KEY_THRESHOLD_ABSOLUTE, self.threshold_abs.value()) plugin_prefs.set(KEY_THRESHOLD_PERCENTAGE, self.threshold_pct.value()) plugin_prefs.set(KEY_THRESHOLD_PERCENTAGE_OF, [int(idx.strip()) for idx in self.threshold_pct_of.text().split(',')]) plugin_prefs.set(KEY_SHELF_MAPPINGS, self.table.get_mappings())
def commit(self): DefaultConfigWidget.commit(self) new_prefs = {} new_prefs[KEY_MAX_DOWNLOADS] = int(unicode(self.max_downloads_spin.value())) new_prefs[KEY_GET_CATEGORY] = self.get_category_checkbox.checkState() == Qt.Checked new_prefs[KEY_GET_ALL_AUTHORS] = self.all_authors_checkbox.checkState() == Qt.Checked new_prefs[KEY_APPEND_TOC] = self.toc_checkbox.checkState() == Qt.Checked plugin_prefs[STORE_NAME] = new_prefs
def commit(self): DefaultConfigWidget.commit(self) new_prefs = {} new_prefs[KEY_GUESS_SERIES] = self.guess_series_checkbox.isChecked() new_prefs[KEY_APPEND_EDITION_TO_TITLE] = self.append_edition_to_title_checkbox.isChecked() new_prefs[KEY_FETCH_SUBJECTS] = self.fetch_subjects_radios_group.checkedId() plugin_prefs[STORE_NAME] = new_prefs
def resizeEvent(self, event): DefaultConfigWidget.resizeEvent(self, event) # Shrink the section containing the fields-to-download checkboxes to create more space for the rest. fv = self.fields_view m = fv.model() lastIndex = m.index(m.rowCount() - 1, fv.modelColumn()) rect = fv.rectForIndex(lastIndex) fv.setFixedHeight(rect.y() + rect.height() + 3)
def commit(self): DefaultConfigWidget.commit(self) new_prefs = {KEY_PARSE_SERIES: self.parse_series_checkbox.isChecked(), KEY_PARSE_COMMENTS: self.parse_comments_checkbox.isChecked(), KEY_PARSE_RATING: self.parse_rating_checkbox.isChecked(), KEY_ADD_DATABAZEKNIH_ID: self.add_databazeknih_id_checkbox.isChecked(), KEY_VERBOSE_LOGGING: self.verbose_loging_label_checkbox.isChecked()} plugin_prefs[STORE_NAME] = new_prefs
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] all_tags = get_current_db().all_tags() other_group_box = QGroupBox('Other options', self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QVBoxLayout() other_group_box.setLayout(other_group_box_layout) max_label = QLabel('Maximum title/author search matches to evaluate (1 = fastest):', self) max_label.setToolTip('Kyobobook do not always have links to large covers for every ISBN\n' 'of the same book. Increasing this value will take effect when doing\n' 'title/author searches to consider more ISBN editions.\n\n' 'This will increase the potential likelihood of getting a larger cover\n' 'though does not guarantee it.') other_group_box_layout.addWidget(max_label) #, 0, 0, 1, 1) self.max_downloads_spin = QSpinBox(self) self.max_downloads_spin.setMinimum(1) self.max_downloads_spin.setMaximum(20) self.max_downloads_spin.setProperty('value', c.get(KEY_MAX_DOWNLOADS, DEFAULT_STORE_VALUES[KEY_MAX_DOWNLOADS])) other_group_box_layout.addWidget(self.max_downloads_spin)#, 0, 1, 1, 1) #other_group_box_layout.setColumnStretch(2, 1) # by sseeookk, category 20140315 self.get_category_checkbox = QCheckBox('Add Kyobobook Categories to Calibre tags', self) self.get_category_checkbox.setToolTip('Add Kyobobook Categories to Calibre tags(ex, [Domestic Books > History > Korea Culture / History Journey]).') self.get_category_checkbox.setChecked(c[KEY_GET_CATEGORY]) other_group_box_layout.addWidget(self.get_category_checkbox) self.all_authors_checkbox = QCheckBox('Get all contributing authors (e.g. illustrators, series editors etc)', self) self.all_authors_checkbox.setToolTip('Kyobobook for some books will list all of the contributing authors and\n' 'the type of contribution like (Editor), (Illustrator) etc.\n\n' 'When this option is checked, all contributing authors are retrieved.\n\n' 'When unchecked (default) only the primary author(s) are returned which\n' 'are those that either have no contribution type specified, or have the\n' 'value of (Kyobobook Author).\n\n' 'If there is no primary author then only those with the same contribution\n' 'type as the first author are returned.\n' 'e.g. "A, B (Illustrator)" will return author A\n' 'e.g. "A (Kyobobook Author)" will return author A\n' 'e.g. "A (Editor), B (Editor), C (Illustrator)" will return authors A & B\n' 'e.g. "A (Editor), B (Series Editor)" will return author A\n') self.all_authors_checkbox.setChecked(c[KEY_GET_ALL_AUTHORS]) other_group_box_layout.addWidget(self.all_authors_checkbox) # Add by sseeookk, 20140315 self.toc_checkbox = QCheckBox('Append TOC from Features tab if available to comments', self) self.toc_checkbox.setToolTip('Kyobobook for textbooks on their website have a Features tab which\n' 'contains a table of contents for the book. Checking this option will\n' 'append the TOC to the bottom of the Synopsis in the comments field') self.toc_checkbox.setChecked(c.get(KEY_APPEND_TOC, DEFAULT_STORE_VALUES[KEY_APPEND_TOC])) # other_group_box_layout.addWidget(self.toc_checkbox, 2, 0, 1, 3) other_group_box_layout.addWidget(self.toc_checkbox)
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] other_group_box = QGroupBox('Other options', self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QGridLayout() other_group_box.setLayout(other_group_box_layout) # Guess Series guess_series_label = QLabel( 'Guess Series and Series Index from Title:', self) guess_series_label.setToolTip('DNB only rarely provides data about a book\'s series.\n' 'This plugin can try to extract series and series_index from the book title.\n') other_group_box_layout.addWidget(guess_series_label, 0, 0, 1, 1) self.guess_series_checkbox = QtGui.QCheckBox(self) self.guess_series_checkbox.setChecked( c.get(KEY_GUESS_SERIES, DEFAULT_STORE_VALUES[KEY_GUESS_SERIES])) other_group_box_layout.addWidget( self.guess_series_checkbox, 0, 1, 1, 1) # Append Edition to Title append_edition_to_title_label = QLabel( 'Append Edition to Title:', self) append_edition_to_title_label.setToolTip('For some books DNB has information about the edition.\n' 'This plugin can fetch this information and append it to the book\'s title,\n' 'e.g. "Mord am Tegernsee : Ein Bayern-Krimi : 2. Aufl.".\n' 'Of course this only works reliable if you search for a book with a known unique identifier such as dnb-idn or ISBN.') other_group_box_layout.addWidget( append_edition_to_title_label, 1, 0, 1, 1) self.append_edition_to_title_checkbox = QtGui.QCheckBox(self) self.append_edition_to_title_checkbox.setChecked(c.get( KEY_APPEND_EDITION_TO_TITLE, DEFAULT_STORE_VALUES[KEY_APPEND_EDITION_TO_TITLE])) other_group_box_layout.addWidget( self.append_edition_to_title_checkbox, 1, 1, 1, 1) # Fetch Subjects fetch_subjects_label = QLabel('Fetch Subjects:', self) fetch_subjects_label.setToolTip('DNB provides several types of subjects:\n' ' - Standardized subjects according to the GND\n' ' - Subjects delivered by the publisher\n' 'You can choose which ones to fetch.') other_group_box_layout.addWidget(fetch_subjects_label, 2, 0, 1, 1) self.fetch_subjects_radios_group = QtGui.QButtonGroup(other_group_box) titles = ['only GND subjects', 'GND subjects if available, otherwise non-GND subjects', 'GND and non-GND subjects', 'non-GND subjects if available, otherwise GND subjects', 'only non-GND subjects', 'none'] self.fetch_subjects_radios = [ QtGui.QRadioButton(title) for title in titles] for i, radio in enumerate(self.fetch_subjects_radios): if i == c.get(KEY_FETCH_SUBJECTS, DEFAULT_STORE_VALUES[KEY_FETCH_SUBJECTS]): radio.setChecked(True) self.fetch_subjects_radios_group.addButton(radio, i) other_group_box_layout.addWidget(radio, 2 + i, 1, 1, 1)
def commit(self): DefaultConfigWidget.commit(self) new_prefs = {} new_prefs[KEY_CONVERT_TAG] = self.get_convert_tag_checkbox.checkState() == Qt.Checked new_prefs[KEY_GENRE_MAPPINGS] = self.edit_table.get_data() new_prefs[KEY_GET_CATEGORY] = self.get_category_checkbox.checkState() == Qt.Checked new_prefs[KEY_CATEGORY_PREFIX] = unicode(self.category_prefix_edit.text()) new_prefs[KEY_SMALL_COVER] = self.small_cover_checkbox.checkState() == Qt.Checked new_prefs[KEY_GET_ALL_AUTHORS] = self.all_authors_checkbox.checkState() == Qt.Checked new_prefs[KEY_APPEND_TOC] = self.toc_checkbox.checkState() == Qt.Checked new_prefs[KEY_COMMENTS_SUFFIX] = str(self.comments_suffix_edit.text()) new_prefs[KEY_MAX_DOWNLOADS] = int(unicode(self.max_downloads_spin.value())) plugin_prefs[STORE_NAME] = new_prefs
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] other_group_box = QGroupBox('Other options', self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QGridLayout() other_group_box.setLayout(other_group_box_layout) max_downloads_label = QLabel('Maximum title/author search matches to download/evaluate (1 = fastest):', self) max_downloads_label.setToolTip('More matches means higher chance of better\n' 'metadata (but not necessarily).\n') other_group_box_layout.addWidget(max_downloads_label, 1, 0, 1, 1) self.max_downloads_spin = QtWidgets.QSpinBox(self) self.max_downloads_spin.setMinimum(1) self.max_downloads_spin.setMaximum(100) self.max_downloads_spin.setProperty('value', c.get(KEY_MAX_DOWNLOADS, DEFAULT_STORE_VALUES[KEY_MAX_DOWNLOADS])) other_group_box_layout.addWidget(self.max_downloads_spin, 1, 1, 1, 1) other_group_box_layout.setColumnStretch(2, 1)
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] other_group_box = QGroupBox('Other options', self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QGridLayout() other_group_box.setLayout(other_group_box_layout) # Maximum # of title/author searches to review. max_label = QLabel( 'Maximum title/author search matches to evaluate (1 = fastest):', self) max_label.setToolTip( 'ISFDB doesn\'t always have links to large covers for every ISBN\n' 'of the same book. Increasing this value will take effect when doing\n' 'title/author searches to consider more ISBN editions.\n\n' 'This will increase the potential likelihood of getting a larger cover,\n' 'though does not guarantee it.') other_group_box_layout.addWidget(max_label, 0, 0, 1, 1) self.max_downloads_spin = QtGui.QSpinBox(self) self.max_downloads_spin.setMinimum(1) self.max_downloads_spin.setMaximum(5) self.max_downloads_spin.setProperty( 'value', c.get(KEY_MAX_DOWNLOADS, DEFAULT_STORE_VALUES[KEY_MAX_DOWNLOADS])) other_group_box_layout.addWidget(self.max_downloads_spin, 0, 1, 1, 1) other_group_box_layout.setColumnStretch(2, 1) # Contents field, if possible. self.contents_checkbox = QCheckBox( 'Append Contents if available to comments', self) self.contents_checkbox.setToolTip( 'Choosing this option will write the Contents section to the comments\n' 'field, if such a section exists.') self.contents_checkbox.setChecked( c.get(KEY_APPEND_CONTENTS, DEFAULT_STORE_VALUES[KEY_APPEND_CONTENTS])) other_group_box_layout.addWidget(self.contents_checkbox, 2, 0, 1, 3)
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] other_group_box = QGroupBox('Other options', self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QGridLayout() other_group_box.setLayout(other_group_box_layout) max_downloads_label = QLabel( 'Maximum title/author search matches to download/evaluate (1 = fastest):', self) max_downloads_label.setToolTip( 'More matches means higher chance of better\n' 'metadata (but not necessarily).\n') other_group_box_layout.addWidget(max_downloads_label, 1, 0, 1, 1) self.max_downloads_spin = QtWidgets.QSpinBox(self) self.max_downloads_spin.setMinimum(1) self.max_downloads_spin.setMaximum(100) self.max_downloads_spin.setProperty( 'value', c.get(KEY_MAX_DOWNLOADS, DEFAULT_STORE_VALUES[KEY_MAX_DOWNLOADS])) other_group_box_layout.addWidget(self.max_downloads_spin, 1, 1, 1, 1) other_group_box_layout.setColumnStretch(2, 1)
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] all_tags = get_current_db().all_tags() self.gb.setMaximumHeight(80) genre_group_box = QGroupBox('Shelfari genre to calibre tag mappings', self) self.l.addWidget(genre_group_box, self.l.rowCount(), 0, 1, 2) genre_group_box_layout = QVBoxLayout() genre_group_box.setLayout(genre_group_box_layout) tags_layout = QHBoxLayout() genre_group_box_layout.addLayout(tags_layout) self.edit_table = GenreTagMappingsTableWidget(self, all_tags) tags_layout.addWidget(self.edit_table) button_layout = QVBoxLayout() tags_layout.addLayout(button_layout) add_mapping_button = QtGui.QToolButton(self) add_mapping_button.setToolTip('Add genre mapping') add_mapping_button.setIcon(QIcon(I('plus.png'))) add_mapping_button.clicked.connect(self.add_mapping) button_layout.addWidget(add_mapping_button) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) button_layout.addItem(spacerItem1) remove_mapping_button = QtGui.QToolButton(self) remove_mapping_button.setToolTip('Delete genre mapping') remove_mapping_button.setIcon(QIcon(I('minus.png'))) remove_mapping_button.clicked.connect(self.delete_mapping) button_layout.addWidget(remove_mapping_button) spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) button_layout.addItem(spacerItem3) rename_genre_button = QtGui.QToolButton(self) rename_genre_button.setToolTip('Rename Goodreads genre') rename_genre_button.setIcon(QIcon(I('edit-undo.png'))) rename_genre_button.clicked.connect(self.rename_genre) button_layout.addWidget(rename_genre_button) spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) button_layout.addItem(spacerItem2) reset_defaults_button = QtGui.QToolButton(self) reset_defaults_button.setToolTip('Reset to plugin default mappings') reset_defaults_button.setIcon(QIcon(I('clear_left.png'))) reset_defaults_button.clicked.connect(self.reset_to_defaults) button_layout.addWidget(reset_defaults_button) self.l.setRowStretch(self.l.rowCount()-1, 2) other_group_box = QGroupBox('Other options', self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QVBoxLayout() other_group_box.setLayout(other_group_box_layout) self.get_editions_checkbox = QCheckBox('Scan multiple editions for title/author searches (slower)', self) self.get_editions_checkbox.setToolTip('When checked will perform an additional search to scan the top ranked\n' 'Shelfari editions (if available) to exclude audiobook editions.\n' 'Without this enabled you will get a faster search, using the "best".\n' 'edition ranked by Shelfari which can in some cases be an audiobook.') self.get_editions_checkbox.setChecked(c[KEY_GET_EDITIONS]) other_group_box_layout.addWidget(self.get_editions_checkbox) self.all_authors_checkbox = QCheckBox('Get all contributing authors (e.g. illustrators, series editors etc)', self) self.all_authors_checkbox.setToolTip('Shelfari for some books will list all of the contributing authors and\n' 'the type of contribution like (Editor), (Illustrator) etc.\n\n' 'When this option is checked, all contributing authors are retrieved.\n\n' 'When unchecked (default) only the primary author(s) are returned which\n' 'are those that either have no contribution type specified, or have the\n' 'value of (Shelfari Author).\n\n' 'If there is no primary author then only those with the same contribution\n' 'type as the first author are returned.\n' 'e.g. "A, B (Illustrator)" will return author A\n' 'e.g. "A (Shelfari Author)" will return author A\n' 'e.g. "A (Editor), B (Editor), C (Illustrator)" will return authors A & B\n' 'e.g. "A (Editor), B (Series Editor)" will return author A\n') self.all_authors_checkbox.setChecked(c[KEY_GET_ALL_AUTHORS]) other_group_box_layout.addWidget(self.all_authors_checkbox) self.edit_table.populate_table(c[KEY_GENRE_MAPPINGS])
def commit(self): DefaultConfigWidget.commit(self) new_prefs = {} new_prefs[KEY_MAX_DOWNLOADS] = int(unicode(self.max_downloads_spin.value())) plugin_prefs[STORE_NAME] = new_prefs
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] all_tags = get_current_db().all_tags() self.gb.setMaximumHeight(80) genre_group_box = QGroupBox(_('Aladin tag to Calibre tag mappings'), self) self.l.addWidget(genre_group_box, self.l.rowCount(), 0, 1, 2) genre_group_box_layout = QVBoxLayout() genre_group_box.setLayout(genre_group_box_layout) # Aladin tag convert to calibre tag 20140312 self.get_convert_tag_checkbox = QCheckBox(_('Convert Aladin tag to Calibre tag'), self) self.get_convert_tag_checkbox.setToolTip(_('Convert Aladin tag(korean tag) to Calibre tag.')) self.get_convert_tag_checkbox.setChecked(c.get(KEY_CONVERT_TAG,DEFAULT_STORE_VALUES[KEY_CONVERT_TAG])) genre_group_box_layout.addWidget(self.get_convert_tag_checkbox) tags_layout = QHBoxLayout() genre_group_box_layout.addLayout(tags_layout) self.edit_table = GenreTagMappingsTableWidget(self, all_tags) tags_layout.addWidget(self.edit_table) button_layout = QVBoxLayout() tags_layout.addLayout(button_layout) add_mapping_button = QtGui.QToolButton(self) add_mapping_button.setToolTip(_('Add genre mapping')) add_mapping_button.setIcon(QIcon(I('plus.png'))) add_mapping_button.clicked.connect(self.add_mapping) button_layout.addWidget(add_mapping_button) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) button_layout.addItem(spacerItem1) remove_mapping_button = QtGui.QToolButton(self) remove_mapping_button.setToolTip(_('Delete genre mapping')) remove_mapping_button.setIcon(QIcon(I('minus.png'))) remove_mapping_button.clicked.connect(self.delete_mapping) button_layout.addWidget(remove_mapping_button) spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) button_layout.addItem(spacerItem3) rename_genre_button = QtGui.QToolButton(self) rename_genre_button.setToolTip(_('Rename Aladin genre')) rename_genre_button.setIcon(QIcon(I('edit-undo.png'))) rename_genre_button.clicked.connect(self.rename_genre) button_layout.addWidget(rename_genre_button) spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) button_layout.addItem(spacerItem2) reset_defaults_button = QtGui.QToolButton(self) reset_defaults_button.setToolTip(_('Reset to plugin default mappings')) reset_defaults_button.setIcon(QIcon(I('clear_left.png'))) reset_defaults_button.clicked.connect(self.reset_to_defaults) button_layout.addWidget(reset_defaults_button) self.l.setRowStretch(self.l.rowCount()-1, 2) other_group_box = QGroupBox(_('Other options'), self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QVBoxLayout() other_group_box.setLayout(other_group_box_layout) # DID: category | v0.1.0 20140315 self.get_category_checkbox = QCheckBox(_('Add Aladin Categories to Calibre tags'), self) self.get_category_checkbox.setToolTip(_('Add Aladin Categories to Calibre tags.\n' 'This Plugin will change delimiter ">" to delimiter "." for Category Hierarchy.\n' '(ex, "Category Prefix"History.Korea Culture.History Journey)\n ')) self.get_category_checkbox.stateChanged.connect(self.get_category_checkbox_changed) other_group_box_layout.addWidget(self.get_category_checkbox) self.category_group_box = QGroupBox(self) category_group_box_layout = QtGui.QGridLayout() self.category_group_box.setLayout(category_group_box_layout) other_group_box_layout.addWidget(self.category_group_box) # DID: 주제분류 category - 머리글 | v0.2.0 20140330 category_prefix_label = QtGui.QLabel(_('Category Prefix'),self) category_prefix_label.setToolTip(_('Set strings before categories to distinguish other tags.\n' '(예, ☞History.Korea Culture.History Journey)\n ')) category_group_box_layout.addWidget(category_prefix_label, 0, 0, 1, 1) self.category_prefix_edit = QtGui.QLineEdit(self) self.category_prefix_edit.setText(c.get(KEY_CATEGORY_PREFIX,DEFAULT_STORE_VALUES[KEY_CATEGORY_PREFIX])) category_group_box_layout.addWidget(self.category_prefix_edit, 0, 1, 1, 1) self.get_category_checkbox.setChecked(c.get(KEY_GET_CATEGORY,DEFAULT_STORE_VALUES[KEY_GET_CATEGORY])) # DID: 책표지(cover)를 큰것/작은것(big/small) 선택할 수 있도록 하자. | v0.2.0 20140330 self.small_cover_checkbox = QCheckBox(_('Download small cover.'), self) self.small_cover_checkbox.setToolTip(_('Download small cover from aladin.')) self.small_cover_checkbox.setChecked(c.get(KEY_SMALL_COVER, DEFAULT_STORE_VALUES[KEY_SMALL_COVER])) other_group_box_layout.addWidget(self.small_cover_checkbox) self.all_authors_checkbox = QCheckBox(_('Get all contributing authors (e.g. illustrators, series editors etc)'), self) self.all_authors_checkbox.setToolTip(_('Aladin for some books will list all of the contributing authors and\n' 'the type of contribution like (Editor), (Illustrator) etc.\n\n' 'When this option is checked, all contributing authors are retrieved.\n\n' 'When unchecked (default) only the primary author(s) are returned which\n' 'are those that either have no contribution type specified, or have the\n' 'value of (Aladin Author).\n\n' 'If there is no primary author then only those with the same contribution\n' 'type as the first author are returned.\n' 'e.g. "A, B (Illustrator)" will return author A\n' 'e.g. "A (Aladin Author)" will return author A\n' 'e.g. "A (Editor), B (Editor), C (Illustrator)" will return authors A & B\n' 'e.g. "A (Editor), B (Series Editor)" will return author A\n ')) self.all_authors_checkbox.setChecked(c.get(KEY_GET_ALL_AUTHORS, DEFAULT_STORE_VALUES[KEY_GET_ALL_AUTHORS])) other_group_box_layout.addWidget(self.all_authors_checkbox) # Add by sseeookk, 20140315 self.toc_checkbox = QCheckBox(_('Append TOC from Aladin TOC if available to comments'), self) self.toc_checkbox.setToolTip(_('Aladin for textbooks on their website have a Features which\n' 'contains a table of contents for the book. Checking this option will\n' 'append the TOC to the bottom of the Synopsis in the comments field')) self.toc_checkbox.setChecked(c.get(KEY_APPEND_TOC, DEFAULT_STORE_VALUES[KEY_APPEND_TOC])) other_group_box_layout.addWidget(self.toc_checkbox) # DID: 책소개(comment) 끝에 출처를 적으면 어떨까? | v0.2.0 20140330 # 코멘트 뒤에 붙을 내용 (예, aladin.co.kr{날짜}) comments_suffix_label = QLabel(_('Append comments suffix:'), self) comments_suffix_label.setToolTip(_('Append comments source after comments.\n' '(ex, <hr /><div><div style="float:right">[aladin.co.kr]</div></div>)\n ')) other_group_box_layout.addWidget(comments_suffix_label) self.comments_suffix_edit = QtGui.QLineEdit(self) self.comments_suffix_edit.setText(c.get(KEY_COMMENTS_SUFFIX, DEFAULT_STORE_VALUES[KEY_COMMENTS_SUFFIX])) other_group_box_layout.addWidget(self.comments_suffix_edit) max_label = QLabel(_('Maximum title/author search matches to evaluate (1 = fastest):'), self) max_label.setToolTip(_('Increasing this value will take effect when doing\n' 'title/author searches to consider more books.\n ')) other_group_box_layout.addWidget(max_label) self.max_downloads_spin = QtGui.QSpinBox(self) self.max_downloads_spin.setMinimum(1) self.max_downloads_spin.setMaximum(20) self.max_downloads_spin.setProperty('value', c.get(KEY_MAX_DOWNLOADS, DEFAULT_STORE_VALUES[KEY_MAX_DOWNLOADS])) other_group_box_layout.addWidget(self.max_downloads_spin) self.edit_table.populate_table(c[KEY_GENRE_MAPPINGS])
def config_widget(self): from calibre.gui2.metadata.config import ConfigWidget return ConfigWidget(self)
def commit(self): DefaultConfigWidget.commit(self) new_prefs = {} new_prefs[KEY_MAX_DOWNLOADS] = int( unicode(self.max_downloads_spin.value())) plugin_prefs[STORE_NAME] = new_prefs
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] other_group_box = QGroupBox('Other options', self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QGridLayout() other_group_box.setLayout(other_group_box_layout) # SRU Token sru_token_label = QLabel('SRU Token (recommended):', self) sru_token_label.setToolTip( 'To access the API of the DNB a personal SRU access token is required.\n' 'The token is for free.\n\n' 'To get a token, create an account at https://portal.dnb.de/myAccount/register.htm \n' 'After that write an email to [email protected] and ask them to enable \n' 'SRU token generation for your account.') other_group_box_layout.addWidget(sru_token_label, 0, 0, 1, 1) self.sru_token_line = QtGui.QLineEdit(self) self.sru_token_line.setText( c.get(KEY_SRUTOKEN, DEFAULT_STORE_VALUES[KEY_SRUTOKEN])) other_group_box_layout.addWidget(self.sru_token_line, 0, 1, 1, 1) # Guess Series guess_series_label = QLabel( 'Guess Series and Series Index from Title:', self) guess_series_label.setToolTip( 'DNB only rarely provides data about a book\'s series.\n' 'This plugin can try to extract series and series_index from the book title.\n' ) other_group_box_layout.addWidget(guess_series_label, 1, 0, 1, 1) self.guess_series_checkbox = QtGui.QCheckBox(self) self.guess_series_checkbox.setChecked( c.get(KEY_GUESS_SERIES, DEFAULT_STORE_VALUES[KEY_GUESS_SERIES])) other_group_box_layout.addWidget(self.guess_series_checkbox, 1, 1, 1, 1) # Append Edition to Title append_edition_to_title_label = QLabel('Append Edition to Title:', self) append_edition_to_title_label.setToolTip( 'For some books DNB has information about the edition.\n' 'This plugin can fetch this information and append it to the book\'s title,\n' 'e.g. "Mord am Tegernsee : Ein Bayern-Krimi : 2. Aufl.".\n' 'Of course this only works reliable if you search for a book with a known unique identifier such as dnb-idn or ISBN.' ) other_group_box_layout.addWidget(append_edition_to_title_label, 2, 0, 1, 1) self.append_edition_to_title_checkbox = QtGui.QCheckBox(self) self.append_edition_to_title_checkbox.setChecked( c.get(KEY_APPEND_EDITION_TO_TITLE, DEFAULT_STORE_VALUES[KEY_APPEND_EDITION_TO_TITLE])) other_group_box_layout.addWidget(self.append_edition_to_title_checkbox, 2, 1, 1, 1) # Fetch Subjects fetch_subjects_label = QLabel('Fetch Subjects:', self) fetch_subjects_label.setToolTip( 'DNB provides several types of subjects:\n' ' - Standardized subjects according to the GND\n' ' - Subjects delivered by the publisher\n' 'You can choose which ones to fetch.') other_group_box_layout.addWidget(fetch_subjects_label, 3, 0, 1, 1) self.fetch_subjects_radios_group = QtGui.QButtonGroup(other_group_box) titles = [ 'only GND subjects', 'GND subjects if available, otherwise non-GND subjects', 'GND and non-GND subjects', 'non-GND subjects if available, otherwise GND subjects', 'only non-GND subjects', 'none' ] self.fetch_subjects_radios = [ QtGui.QRadioButton(title) for title in titles ] for i, radio in enumerate(self.fetch_subjects_radios): if i == c.get(KEY_FETCH_SUBJECTS, DEFAULT_STORE_VALUES[KEY_FETCH_SUBJECTS]): radio.setChecked(True) self.fetch_subjects_radios_group.addButton(radio, i) other_group_box_layout.addWidget(radio, 3 + i, 1, 1, 1)
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin)
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] other_group_box = QGroupBox('Other options', self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QGridLayout() other_group_box.setLayout(other_group_box_layout) index = 0 # Parse Series - KEY_PARSE_SERIES parse_series_label = QLabel('Načtení názvu knižní série a pořadí:', self) parse_series_label.setToolTip('Při vybrání této položky se plugin bude snažit dotáhnout informaci o \n' 'knižní sérii a pořadí knihy v dané sérii.\n' 'S ohledem na strukturu stránek databazeknih.cz není moc spolehlivé !!!\n' ) other_group_box_layout.addWidget(parse_series_label, index, 0, 1, 1) self.parse_series_checkbox = QtGui.QCheckBox(self) self.parse_series_checkbox.setChecked(c.get(KEY_PARSE_SERIES, DEFAULT_STORE_VALUES[KEY_PARSE_SERIES])) other_group_box_layout.addWidget(self.parse_series_checkbox, index, 1, 1, 1) index += 1 # Parse comments - KEY_PARSE_COMMENTS parse_comments_label = QLabel('Načtení popisu knihy:', self) parse_comments_label.setToolTip('Při vybrání této položky se plugin bude snažit dotáhnout popis\n' 'knižního titulu. V calibre označován jako komentáře.\n' ) other_group_box_layout.addWidget(parse_comments_label, index, 0, 1, 1) self.parse_comments_checkbox = QtGui.QCheckBox(self) self.parse_comments_checkbox.setChecked(c.get(KEY_PARSE_COMMENTS, DEFAULT_STORE_VALUES[KEY_PARSE_COMMENTS])) other_group_box_layout.addWidget(self.parse_comments_checkbox, index, 1, 1, 1) index += 1 # Parse rating - KEY_PARSE_RATING parse_rating_label = QLabel('Načtení hodnocení knihy:', self) parse_rating_label.setToolTip('Při vybrání této položky se plugin bude snažit dotáhnout hodnocení knihy.\n' ) other_group_box_layout.addWidget(parse_rating_label, index, 0, 1, 1) self.parse_rating_checkbox = QtGui.QCheckBox(self) self.parse_rating_checkbox.setChecked(c.get(KEY_PARSE_RATING, DEFAULT_STORE_VALUES[KEY_PARSE_RATING])) other_group_box_layout.addWidget(self.parse_rating_checkbox, index, 1, 1, 1) index += 1 # Add databazeknih ID to book identificators - KEY_ADD_DATABAZEKNIH_ID add_databazeknih_id_label = QLabel('Vložit identifikátor z databáze knih:', self) add_databazeknih_id_label.setToolTip('Při vybrání této položky plugin vloží mezi knižní identifikátory\n' 'identifikátor Databazeknih.cz. Např. aristokratka-posledni-aristokratka-134832.\n' ) other_group_box_layout.addWidget(add_databazeknih_id_label, index, 0, 1, 1) self.add_databazeknih_id_checkbox = QtGui.QCheckBox(self) self.add_databazeknih_id_checkbox.setChecked( c.get(KEY_ADD_DATABAZEKNIH_ID, DEFAULT_STORE_VALUES[KEY_ADD_DATABAZEKNIH_ID])) other_group_box_layout.addWidget(self.add_databazeknih_id_checkbox, index, 1, 1, 1) index += 1 # Verbose logging KEY_VERBOSE_LOGGING verbose_loging_label = QLabel('Zapnot podrobné logování:', self) verbose_loging_label.setToolTip('Při vybrání této volby bude plugin logovat více informací.\n' 'Slouží pro případnou identifikaci problému, chyby.\n' ) other_group_box_layout.addWidget(verbose_loging_label, index, 0, 1, 1) self.verbose_loging_label_checkbox = QtGui.QCheckBox(self) self.verbose_loging_label_checkbox.setChecked( c.get(KEY_VERBOSE_LOGGING, DEFAULT_STORE_VALUES[KEY_VERBOSE_LOGGING])) other_group_box_layout.addWidget(self.verbose_loging_label_checkbox, index, 1, 1, 1) index += 1