diff --git a/src/calibre/gui2/dialogs/metadata_single.py b/src/calibre/gui2/dialogs/metadata_single.py index 133f449550..7c5a9f95d4 100644 --- a/src/calibre/gui2/dialogs/metadata_single.py +++ b/src/calibre/gui2/dialogs/metadata_single.py @@ -691,8 +691,8 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog): title = self.title.text() self.title.setText(self.authors.text()) self.authors.setText(title) - self.author_sort.setText('') - + self.deduce_author_sort() + self.deduce_title_sort() def initialize_combos(self): self.initalize_authors() diff --git a/src/calibre/gui2/dialogs/metadata_single.ui b/src/calibre/gui2/dialogs/metadata_single.ui index 02e6eb01e2..770807b2d7 100644 --- a/src/calibre/gui2/dialogs/metadata_single.ui +++ b/src/calibre/gui2/dialogs/metadata_single.ui @@ -100,30 +100,10 @@ - - - - Swap the author and title - - - ... - - - - :/images/swap.png:/images/swap.png - - - - 16 - 16 - - - - - Title sort: + Title &sort: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -136,22 +116,7 @@ - Specify how this book should be sorted when by title. For example, The Exorcist might be sorted as Exorcist, The. - - - - - - - Automatically create the title sort entry based on the current title entry. -Using this button to create title sort will change title sort from red to green. - - - ... - - - - :/images/auto_author_sort.png:/images/auto_author_sort.png + Specify how this book should be sorted when by title. For example, The Exorcist might be sorted as Exorcist, The. @@ -168,6 +133,13 @@ Using this button to create title sort will change title sort from red to green. + + + + true + + + @@ -181,32 +153,13 @@ Using this button to create title sort will change title sort from red to green. - - - - - - Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles. + + + + Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles. If the box is colored green, then text matches the individual author's sort strings. If it is colored red, then the authors and this text do not match. - - - - - - - Automatically create the author sort entry based on the current author entry. -Using this button to create author sort will change author sort from red to green. - - - ... - - - - :/images/auto_author_sort.png:/images/auto_author_sort.png - - - - + + @@ -253,6 +206,13 @@ Using this button to create author sort will change author sort from red to gree + + + + true + + + @@ -266,31 +226,6 @@ Using this button to create author sort will change author sort from red to gree - - - - - - 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 - - - - - @@ -307,7 +242,7 @@ Using this button to create author sort will change author sort from red to gree - + 5 @@ -328,22 +263,21 @@ Using this button to create author sort will change author sort from red to gree - - - - Remove unused series (Series that have no books) - - - ... - - - - :/images/trash.png:/images/trash.png - - - + + + + false + + + Book + + + 9999.989999999999782 + + + @@ -360,66 +294,6 @@ Using this button to create author sort will change author sort from red to gree - - - - Publishe&d: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - pubdate - - - - - - - true - - - - - - - false - - - Book - - - 9999.989999999999782 - - - - - - - MMM yyyy - - - true - - - - - - - true - - - - - - - dd MMM yyyy - - - true - - - @@ -433,9 +307,194 @@ Using this button to create author sort will change author sort from red to gree + + + + dd MMM yyyy + + + true + + + + + + + Publishe&d: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + pubdate + + + + + + + MMM yyyy + + + true + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Automatically create the author sort entry based on the current author entry. +Using this button to create author sort will change author sort from red to green. + + + ... + + + + :/images/auto_author_sort.png:/images/auto_author_sort.png + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Swap the author and title + + + ... + + + + :/images/swap.png:/images/swap.png + + + + 16 + 16 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Automatically create the title sort entry based on the current title entry. +Using this button to create title sort will change title sort from red to green. + + + ... + + + + :/images/auto_author_sort.png:/images/auto_author_sort.png + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 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 unused series (Series that have no books) + + + ... + + + + :/images/trash.png:/images/trash.png + + + + + + + &Fetch metadata from server + + + @@ -455,13 +514,6 @@ Using this button to create author sort will change author sort from red to gree - - - - &Fetch metadata from server - - - @@ -779,13 +831,12 @@ Using this button to create author sort will change author sort from red to gree title - title_sort auto_title_sort + title_sort swap_button authors - swap_button - author_sort auto_author_sort + author_sort rating publisher tags @@ -796,20 +847,22 @@ Using this button to create author sort will change author sort from red to gree isbn date pubdate - comments fetch_metadata_button - add_format_button - remove_format_button + comments button_set_cover button_set_metadata formats + add_format_button + remove_format_button cover_path + cover_button + trim_cover_button reset_cover fetch_cover_button generate_cover_button + button_box scrollArea central_widget - button_box diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index d355fe600e..d8316cbf68 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -266,6 +266,7 @@ def run_in_debug_mode(logpath=None): exe = base + '-debug' + ext print 'Starting debug executable:', exe subprocess.Popen([exe, '--gui-debug', logpath], stdout=fd, stderr=fd) + time.sleep(1) # Give subprocess a change to launch, before fd is closed def run_gui(opts, args, actions, listener, app, gui_debug=None): initialize_file_icon_provider() diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 27266f2f9a..1557f5065e 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -137,13 +137,13 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): # if we are to copy the prefs and structure from some other DB, then # we need to do it before we call initialize_dynamic if apply_default_prefs and default_prefs is not None: - prefs = DBPrefs(self) + dbprefs = DBPrefs(self) for key in default_prefs: # be sure that prefs not to be copied are listed below if key in ['news_to_be_synced']: continue try: - prefs[key] = default_prefs[key] + dbprefs[key] = default_prefs[key] except: pass # ignore options that don't exist anymore fmvals = [f for f in default_prefs['field_metadata'].values() if f['is_custom']] @@ -1400,7 +1400,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): return float(tweaks['series_index_auto_increment']) return 1.0 series_indices = [x[0] for x in series_indices] - print series_indices if tweaks['series_index_auto_increment'] == 'next': return series_indices[-1] + 1 if tweaks['series_index_auto_increment'] == 'first_free': @@ -1613,13 +1612,13 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): if notify: self.notify('metadata', [id]) - def set_title_sort(self, id, title_sort, notify=True, commit=True): - if not title_sort: + def set_title_sort(self, id, title_sort_, notify=True, commit=True): + if not title_sort_: return False - if isbytestring(title_sort): - title_sort = title_sort.decode(preferred_encoding, 'replace') - self.conn.execute('UPDATE books SET sort=? WHERE id=?', (title_sort, id)) - self.data.set(id, self.FIELD_MAP['sort'], title_sort, row_is_id=True) + if isbytestring(title_sort_): + title_sort_ = title_sort_.decode(preferred_encoding, 'replace') + self.conn.execute('UPDATE books SET sort=? WHERE id=?', (title_sort_, id)) + self.data.set(id, self.FIELD_MAP['sort'], title_sort_, row_is_id=True) self.dirtied([id], commit=False) if commit: self.conn.commit() diff --git a/src/calibre/library/schema_upgrades.py b/src/calibre/library/schema_upgrades.py index 4bf7e0ac6a..597cee8cfd 100644 --- a/src/calibre/library/schema_upgrades.py +++ b/src/calibre/library/schema_upgrades.py @@ -437,5 +437,5 @@ class SchemaUpgrade(object): BEGIN UPDATE books SET sort=title_sort(NEW.title) WHERE id=NEW.id AND OLD.title <> NEW.title; - END; + END; ''')