Merge branch 'two_fixes' into 'master'

Two fixes

See merge request openlp/openlp!411
This commit is contained in:
Tim Bentley 2022-02-06 16:53:14 +00:00
commit 586007bb10
3 changed files with 15 additions and 3 deletions

View File

@ -132,6 +132,7 @@ class Plugin(RegistryBase, RegistryProperties):
self.status = PluginStatus.Inactive self.status = PluginStatus.Inactive
Registry().register_function('{name}_add_service_item'.format(name=self.name), self.process_add_service_event) Registry().register_function('{name}_add_service_item'.format(name=self.name), self.process_add_service_event)
Registry().register_function('{name}_config_updated'.format(name=self.name), self.config_update) Registry().register_function('{name}_config_updated'.format(name=self.name), self.config_update)
Registry().register_function('{name}_visible_name'.format(name=self.name), self.get_visible_name)
self._setup(version) self._setup(version)
def _setup(self, version): def _setup(self, version):
@ -372,3 +373,9 @@ class Plugin(RegistryBase, RegistryProperties):
The plugin's needs to handle a new song creation The plugin's needs to handle a new song creation
""" """
pass pass
def get_visible_name(self):
"""
Returns the plugins visible name
"""
return str(self.get_string(StringContent.VisibleName)['title'])

View File

@ -1620,10 +1620,14 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
def create_custom(self): def create_custom(self):
""" """
Saves the current text item as a custom slide Saves the current text item as a custom slide and opens the custom tab (if is not open)
""" """
item = self.find_service_item()[0] item = self.find_service_item()[0]
Registry().execute('custom_create_from_service', self.service_items[item]['service_item']) Registry().execute('custom_create_from_service', self.service_items[item]['service_item'])
for pos in range(1, self.main_window.media_tool_box.count()):
if self.main_window.media_tool_box.itemText(pos) == Registry().execute('custom_visible_name')[0]:
self.main_window.media_tool_box.setItemEnabled(pos, True)
self.main_window.media_tool_box.setCurrentIndex(pos)
def find_service_item(self): def find_service_item(self):
""" """

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