forked from openlp/openlp
Fix bug #1642684 by removing the unnecessary blank item.
This commit is contained in:
parent
fb585d683a
commit
18c3d99f29
@ -112,13 +112,13 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
"""
|
||||
objects = self.manager.get_all_objects(cls, order_by_ref=cls.name)
|
||||
combo.clear()
|
||||
combo.addItem('')
|
||||
for obj in objects:
|
||||
row = combo.count()
|
||||
combo.addItem(obj.name)
|
||||
cache.append(obj.name)
|
||||
combo.setItemData(row, obj.id)
|
||||
set_case_insensitive_completer(cache, combo)
|
||||
combo.setEditText('')
|
||||
|
||||
def _add_author_to_list(self, author, author_type):
|
||||
"""
|
||||
@ -345,7 +345,6 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
"""
|
||||
authors = self.manager.get_all_objects(Author, order_by_ref=Author.display_name)
|
||||
self.authors_combo_box.clear()
|
||||
self.authors_combo_box.addItem('')
|
||||
self.authors = []
|
||||
for author in authors:
|
||||
row = self.authors_combo_box.count()
|
||||
@ -353,6 +352,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
self.authors_combo_box.setItemData(row, author.id)
|
||||
self.authors.append(author.display_name)
|
||||
set_case_insensitive_completer(self.authors, self.authors_combo_box)
|
||||
self.authors_combo_box.setEditText('')
|
||||
|
||||
# Types
|
||||
self.author_types_combo_box.clear()
|
||||
@ -379,10 +379,10 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
Load the themes into a combobox.
|
||||
"""
|
||||
self.theme_combo_box.clear()
|
||||
self.theme_combo_box.addItem('')
|
||||
self.themes = theme_list
|
||||
self.theme_combo_box.addItems(theme_list)
|
||||
set_case_insensitive_completer(self.themes, self.theme_combo_box)
|
||||
self.theme_combo_box.setEditText('')
|
||||
|
||||
def load_media_files(self):
|
||||
"""
|
||||
@ -422,7 +422,6 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
self.load_songbooks()
|
||||
self.load_media_files()
|
||||
self.theme_combo_box.setEditText('')
|
||||
self.theme_combo_box.setCurrentIndex(0)
|
||||
# it's a new song to preview is not possible
|
||||
self.preview_button.setVisible(False)
|
||||
|
||||
@ -571,7 +570,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
self.manager.save_object(author)
|
||||
self._add_author_to_list(author, author_type)
|
||||
self.load_authors()
|
||||
self.authors_combo_box.setCurrentIndex(0)
|
||||
self.authors_combo_box.setEditText('')
|
||||
else:
|
||||
return
|
||||
elif item > 0:
|
||||
@ -582,7 +581,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
message=translate('SongsPlugin.EditSongForm', 'This author is already in the list.'))
|
||||
else:
|
||||
self._add_author_to_list(author, author_type)
|
||||
self.authors_combo_box.setCurrentIndex(0)
|
||||
self.authors_combo_box.setEditText('')
|
||||
else:
|
||||
QtWidgets.QMessageBox.warning(
|
||||
self, UiStrings().NISs,
|
||||
@ -646,7 +645,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
topic_item.setData(QtCore.Qt.UserRole, topic.id)
|
||||
self.topics_list_view.addItem(topic_item)
|
||||
self.load_topics()
|
||||
self.topics_combo_box.setCurrentIndex(0)
|
||||
self.topics_combo_box.setEditText('')
|
||||
else:
|
||||
return
|
||||
elif item > 0:
|
||||
@ -659,7 +658,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
topic_item = QtWidgets.QListWidgetItem(str(topic.name))
|
||||
topic_item.setData(QtCore.Qt.UserRole, topic.id)
|
||||
self.topics_list_view.addItem(topic_item)
|
||||
self.topics_combo_box.setCurrentIndex(0)
|
||||
self.topics_combo_box.setEditText('')
|
||||
else:
|
||||
QtWidgets.QMessageBox.warning(
|
||||
self, UiStrings().NISs,
|
||||
@ -689,7 +688,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
self.manager.save_object(songbook)
|
||||
self.add_songbook_entry_to_list(songbook.id, songbook.name, self.songbook_entry_edit.text())
|
||||
self.load_songbooks()
|
||||
self.songbooks_combo_box.setCurrentIndex(0)
|
||||
self.songbooks_combo_box.setEditText('')
|
||||
self.songbook_entry_edit.clear()
|
||||
else:
|
||||
return
|
||||
@ -701,7 +700,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
message=translate('SongsPlugin.EditSongForm', 'This Songbook is already in the list.'))
|
||||
else:
|
||||
self.add_songbook_entry_to_list(songbook.id, songbook.name, self.songbook_entry_edit.text())
|
||||
self.songbooks_combo_box.setCurrentIndex(0)
|
||||
self.songbooks_combo_box.setEditText('')
|
||||
self.songbook_entry_edit.clear()
|
||||
else:
|
||||
QtWidgets.QMessageBox.warning(
|
||||
|
Loading…
Reference in New Issue
Block a user