Allow switch back to the default theme for song editing. #917

This commit is contained in:
Tim 2022-02-06 08:21:58 +00:00
parent b3788e404f
commit 77199ca794
No known key found for this signature in database
GPG Key ID: E95CE08DB3F50537

View File

@ -400,7 +400,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
self.songbooks = [] self.songbooks = []
self._load_objects(Book, self.songbooks_combo_box, self.songbooks) self._load_objects(Book, self.songbooks_combo_box, self.songbooks)
def load_themes(self, theme_list): def load_themes(self, theme_list: list):
""" """
Load the themes into a combobox. Load the themes into a combobox.
""" """
@ -409,6 +409,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
return get_natural_key(theme) return get_natural_key(theme)
self.theme_combo_box.clear() self.theme_combo_box.clear()
theme_list.insert(0, f"<{UiStrings().Default}>")
self.themes = theme_list self.themes = theme_list
self.themes.sort(key=get_theme_key) self.themes.sort(key=get_theme_key)
self.theme_combo_box.addItems(theme_list) self.theme_combo_box.addItems(theme_list)
@ -1045,7 +1046,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
self.song.verse_order = ' '.join(order) self.song.verse_order = ' '.join(order)
self.song.ccli_number = self.ccli_number_edit.text() self.song.ccli_number = self.ccli_number_edit.text()
theme_name = self.theme_combo_box.currentText() theme_name = self.theme_combo_box.currentText()
if theme_name: if theme_name and theme_name != f"<{UiStrings().Default}>":
self.song.theme_name = theme_name self.song.theme_name = theme_name
else: else:
self.song.theme_name = None self.song.theme_name = None