Put new_book_tags into the GUI, remove from tweaks.

This commit is contained in:
Charles Haley 2010-09-02 14:41:08 +01:00
parent 7fa99ffb57
commit e957291d37
5 changed files with 35 additions and 19 deletions

View File

@ -93,11 +93,6 @@ save_template_title_series_sorting = 'library_order'
auto_connect_to_folder = ''
# Specify a tag to be automatically applied when a book is added to the library.
# Example: add_tag_to_new_books='ToDo'
add_tag_to_new_books = ''
# Create search terms to apply a query across several built-in search terms.
# Syntax: {'new term':['existing term 1', 'term 2', ...], 'new':['old'...] ...}
# Example: create the term 'myseries' that when used as myseries:foo would

View File

@ -457,6 +457,7 @@ class ConfigDialog(ResizableDialog, Ui_Dialog):
self.priority.setCurrentIndex(p)
self.priority.setVisible(iswindows)
self.priority_label.setVisible(iswindows)
self.new_book_tags.setText(prefs['new_book_tags'])
self._plugin_model = PluginModel()
self.plugin_view.setModel(self._plugin_model)
self.plugin_view.setStyleSheet(
@ -906,6 +907,7 @@ class ConfigDialog(ResizableDialog, Ui_Dialog):
config['disable_tray_notification'] = not self.systray_notifications.isChecked()
p = {0:'normal', 1:'high', 2:'low'}[self.priority.currentIndex()]
prefs['worker_process_priority'] = p
prefs['new_book_tags'] = unicode(self.new_book_tags.text()).strip()
prefs['output_format'] = unicode(self.output_format.currentText()).upper()
config['cover_flow_queue_length'] = self.cover_browse.value()
prefs['language'] = str(self.language.itemData(self.language.currentIndex()).toString())

View File

@ -136,7 +136,7 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Default network &amp;timeout:</string>
@ -146,7 +146,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QSpinBox" name="timeout">
<property name="toolTip">
<string>Set the default timeout for network fetches (i.e. anytime we go out to the internet to get information)</string>
@ -165,10 +165,10 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QComboBox" name="language"/>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Choose &amp;language (requires restart):</string>
@ -178,7 +178,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QComboBox" name="priority">
<item>
<property name="text">
@ -197,7 +197,7 @@
</item>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="priority_label">
<property name="text">
<string>Job &amp;priority:</string>
@ -207,7 +207,7 @@
</property>
</widget>
</item>
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Preferred &amp;output format:</string>
@ -217,9 +217,26 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="output_format"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_230">
<property name="text">
<string>Tags to apply when adding a book:</string>
</property>
<property name="buddy">
<cstring>new_book_tags</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="new_book_tags">
<property name="toolTip">
<string>A comma-separated list of tags that will be applied to books added to the library</string>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -1726,12 +1726,13 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
return run_plugins_on_import(path, format)
def _add_newbook_tag(self, mi):
tag = tweaks['add_tag_to_new_books']
if tag:
if mi.tags is None:
mi.tags = [tag]
else:
mi.tags.append(tag)
tags = prefs['new_book_tags'].strip()
if tags:
for tag in [t.strip() for t in tags.split(',')]:
if mi.tags is None:
mi.tags = [tag]
else:
mi.tags.append(tag)
def create_book_entry(self, mi, cover=None, add_duplicates=True):
self._add_newbook_tag(mi)

View File

@ -717,6 +717,7 @@ def _prefs():
c.add_opt('add_formats_to_existing', default=False,
help=_('Add new formats to existing book records'))
c.add_opt('installation_uuid', default=None, help='Installation UUID')
c.add_opt('new_book_tags', default='', help=_('Tags to apply to books added to the library'))
# these are here instead of the gui preferences because calibredb and
# calibre server can execute searches