diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index 1cf699efa3..c4c951f980 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -88,13 +88,6 @@ categories_collapsed_rating_template = r'{first.avg_rating:4.2f:ifempty(0)} - {l categories_collapsed_popularity_template = r'{first.count:d} - {last.count:d}' -#: Set boolean custom columns to be tristate -# Set whether boolean custom columns are two- or three-valued. -# Two-values for true booleans -# three-values for yes/no/unknown -# Set to 'yes' for three-values, 'no' for two-values -bool_custom_columns_are_tristate = 'yes' - #: Specify columns to sort the booklist by on startup # Provide a set of columns to be sorted on when calibre starts # The argument is None if saved sort history is to be used diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index ddef5e1265..22aaabf592 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -81,6 +81,7 @@ gprefs.defaults['toolbar_text'] = 'auto' gprefs.defaults['font'] = None gprefs.defaults['tags_browser_partition_method'] = 'first letter' gprefs.defaults['tags_browser_collapse_at'] = 100 +gprefs.defaults['edit_metadata_single_layout'] = 'default' # }}} diff --git a/src/calibre/gui2/metadata/single.py b/src/calibre/gui2/metadata/single.py index cba877b249..2ef183fca5 100644 --- a/src/calibre/gui2/metadata/single.py +++ b/src/calibre/gui2/metadata/single.py @@ -658,7 +658,7 @@ editors = {'default': MetadataSingleDialog, 'alt1': MetadataSingleDialogAlt1} def edit_metadata(db, row_list, current_row, parent=None, view_slot=None, set_current_callback=None): - cls = db.prefs.get('edit_metadata_single_layout', '') + cls = gprefs.get('edit_metadata_single_layout', '') if cls not in editors: cls = 'default' d = editors[cls](db, parent) diff --git a/src/calibre/gui2/preferences/behavior.py b/src/calibre/gui2/preferences/behavior.py index 342b5197c9..d64af343f2 100644 --- a/src/calibre/gui2/preferences/behavior.py +++ b/src/calibre/gui2/preferences/behavior.py @@ -11,7 +11,7 @@ from PyQt4.Qt import Qt, QVariant, QListWidgetItem from calibre.gui2.preferences import ConfigWidgetBase, test_widget, Setting from calibre.gui2.preferences.behavior_ui import Ui_Form -from calibre.gui2 import config, info_dialog, dynamic +from calibre.gui2 import config, info_dialog, dynamic, gprefs from calibre.utils.config import prefs from calibre.customize.ui import available_output_formats, all_input_formats from calibre.utils.search_query_parser import saved_searches @@ -19,6 +19,7 @@ from calibre.ebooks import BOOK_EXTENSIONS from calibre.ebooks.oeb.iterator import is_supported from calibre.constants import iswindows from calibre.utils.icu import sort_key +from calibre.utils.config import test_eight_code class OutputFormatSetting(Setting): @@ -62,6 +63,14 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): signal = getattr(self.opt_internally_viewed_formats, 'item'+signal) signal.connect(self.internally_viewed_formats_changed) + r('bools_are_tristate', db.prefs, restart_required=True) + if test_eight_code: + r = self.register + choices = [(_('Default'), 'default'), (_('Compact Metadata'), 'alt1')] + r('edit_metadata_single_layout', gprefs, choices=choices) + else: + self.opt_edit_metadata_single_layout.setVisible(False) + self.edit_metadata_single_label.setVisible(False) def initialize(self): ConfigWidgetBase.initialize(self) diff --git a/src/calibre/gui2/preferences/behavior.ui b/src/calibre/gui2/preferences/behavior.ui index 0f35d28cd5..544de1457a 100644 --- a/src/calibre/gui2/preferences/behavior.ui +++ b/src/calibre/gui2/preferences/behavior.ui @@ -14,44 +14,92 @@ Form - + + + + Qt::Horizontal + + + + 10 + 00 + + + + + &Overwrite author and title by default when fetching metadata - + Download &social metadata (tags/ratings/etc.) by default - + Show notification when &new version is available - + + + + Yes/No columns have three values (Requires restart) + + + If checked, Yes/No custom columns values can be Yes, No, or Unknown. +If not checked, the values can be Yes or No. + + + + Automatically send downloaded &news to ebook reader - + &Delete news from library when it is automatically sent to reader - - - + + + + + + Preferred &output format: + + + opt_output_format + + + + + + + QComboBox::AdjustToMinimumContentsLengthWithIcon + + + 10 + + + + + + + + Default network &timeout: @@ -61,7 +109,7 @@ - + Set the default timeout for network fetches (i.e. anytime we go out to the internet to get information) @@ -80,7 +128,21 @@ - + + + + + + + + Job &priority: + + + opt_worker_process_priority + + + + QComboBox::AdjustToMinimumContentsLengthWithIcon @@ -105,37 +167,11 @@ - - - - Job &priority: - - - opt_worker_process_priority - - - - - - - Preferred &output format: - - - opt_output_format - - - - - - - QComboBox::AdjustToMinimumContentsLengthWithIcon - - - 10 - - - - + + + + + Restriction to apply when the current library is opened: @@ -145,7 +181,7 @@ - + @@ -166,14 +202,28 @@ - - - - Reset all disabled &confirmation dialogs - - + + + + + + Edit metadata (single) layout: + + + opt_edit_metadata_single_layout + + + + + + + Choose a different layout for the Edit Metadata dialog. The compact metadata layout favors editing custom metadata over changing covers and formats. + + + + - + Preferred &input format order: @@ -235,7 +285,7 @@ - + Use internal &viewer for: @@ -254,6 +304,13 @@ + + + + Reset all disabled &confirmation dialogs + + + diff --git a/src/calibre/gui2/preferences/columns.py b/src/calibre/gui2/preferences/columns.py index 4079e2d3f4..03a50e6f3a 100644 --- a/src/calibre/gui2/preferences/columns.py +++ b/src/calibre/gui2/preferences/columns.py @@ -13,7 +13,6 @@ from calibre.gui2.preferences import ConfigWidgetBase, test_widget from calibre.gui2.preferences.columns_ui import Ui_Form from calibre.gui2.preferences.create_custom_column import CreateCustomColumn from calibre.gui2 import error_dialog, question_dialog, ALL_COLUMNS -from calibre.utils.config import test_eight_code class ConfigWidget(ConfigWidgetBase, Ui_Form): @@ -34,14 +33,6 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): signal = getattr(self.opt_columns, 'item'+signal) signal.connect(self.columns_changed) - if test_eight_code: - r = self.register - choices = [(_('Default'), 'default'), (_('Compact Metadata'), 'alt1')] - r('edit_metadata_single_layout', db.prefs, choices=choices) - r('bools_are_tristate', db.prefs, restart_required=True) - else: - self.items_in_v_eight.setVisible(False) - def initialize(self): ConfigWidgetBase.initialize(self) self.init_columns() @@ -178,10 +169,6 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): must_restart = True return must_restart - def refresh_gui(self, gui): - gui.library_view.reset() - - if __name__ == '__main__': from PyQt4.Qt import QApplication diff --git a/src/calibre/gui2/preferences/columns.ui b/src/calibre/gui2/preferences/columns.ui index 48944b1c04..a9d82530ec 100644 --- a/src/calibre/gui2/preferences/columns.ui +++ b/src/calibre/gui2/preferences/columns.ui @@ -197,67 +197,6 @@ - - - - - - Related Options - - - - - - Edit metadata layout: - - - opt_edit_metadata_single_layout - - - - - - - Choose a different layout for the Edit Metadata dialog. Alternate layouts make it easier to edit custom columns. - - - - - - - Boolean columns are tristate: - - - opt_bools_are_tristate - - - - - - - If checked, boolean columns values can be Yes, No, and Unknown. -If not checked, the values can be Yes and No. - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index ccc5b60427..50ecc4f1e5 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -40,7 +40,6 @@ from calibre.ebooks import BOOK_EXTENSIONS, check_ebook_format from calibre.utils.magick.draw import save_cover_data_to from calibre.utils.recycle_bin import delete_file, delete_tree from calibre.utils.formatter_functions import load_user_template_functions -from calibre.utils.config import test_eight_code copyfile = os.link if hasattr(os, 'link') else shutil.copyfile @@ -213,11 +212,11 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): defs = self.prefs.defaults defs['gui_restriction'] = defs['cs_restriction'] = '' defs['categories_using_hierarchy'] = [] - defs['edit_metadata_single_layout'] = 'default' + # Migrate the bool tristate tweak defs['bools_are_tristate'] = \ tweaks.get('bool_custom_columns_are_tristate', 'yes') == 'yes' - if self.prefs.get('bools_are_tristate') is None or not test_eight_code: + if self.prefs.get('bools_are_tristate') is None: self.prefs.set('bools_are_tristate', defs['bools_are_tristate']) # Migrate saved search and user categories to db preference scheme