From 7e747f7cc902b63cd272ad8762b5c792c8ee68af Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 19 Apr 2010 07:22:56 +0200 Subject: [PATCH 1/2] Added autocompletion to the Authors combobox. --- openlp/plugins/songs/forms/editsongdialog.py | 2 +- openlp/plugins/songs/forms/editsongform.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index 87f7d3601..9c41d363c 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -135,7 +135,7 @@ class Ui_EditSongDialog(object): sizePolicy.setHeightForWidth( self.AuthorsSelectionComboItem.sizePolicy().hasHeightForWidth()) self.AuthorsSelectionComboItem.setSizePolicy(sizePolicy) - self.AuthorsSelectionComboItem.setEditable(False) + self.AuthorsSelectionComboItem.setEditable(True) self.AuthorsSelectionComboItem.setInsertPolicy( QtGui.QComboBox.InsertAlphabetically) self.AuthorsSelectionComboItem.setSizeAdjustPolicy( diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index b2b1b14c4..c2dced872 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -122,6 +122,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def loadAuthors(self): authors = self.songmanager.get_authors() + authorsCompleter = QtGui.QCompleter( + [author.display_name for author in authors], + self.AuthorsSelectionComboItem) + authorsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive); + self.AuthorsSelectionComboItem.setCompleter(authorsCompleter); self.AuthorsSelectionComboItem.clear() for author in authors: row = self.AuthorsSelectionComboItem.count() From b45dcc6b81e8adc21867c41230ac797fdc4b5a3b Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 19 Apr 2010 07:31:31 +0200 Subject: [PATCH 2/2] Added autocompletion to the topics, songbooks and themes. --- openlp/plugins/songs/forms/editsongdialog.py | 3 +++ openlp/plugins/songs/forms/editsongform.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index 9c41d363c..b992aeea4 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -212,6 +212,7 @@ class Ui_EditSongDialog(object): sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.SongTopicCombo.sizePolicy().hasHeightForWidth()) + self.SongTopicCombo.setEditable(True) self.SongTopicCombo.setSizePolicy(sizePolicy) self.SongTopicCombo.setObjectName(u'SongTopicCombo') self.TopicAddLayout.addWidget(self.SongTopicCombo) @@ -256,6 +257,7 @@ class Ui_EditSongDialog(object): sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.SongbookCombo.sizePolicy().hasHeightForWidth()) + self.SongbookCombo.setEditable(True) self.SongbookCombo.setSizePolicy(sizePolicy) self.SongbookCombo.setObjectName(u'SongbookCombo') self.SongbookLayout.addWidget(self.SongbookCombo, 0, 0, 1, 1) @@ -293,6 +295,7 @@ class Ui_EditSongDialog(object): self.ThemeLayout.setMargin(8) self.ThemeLayout.setObjectName(u'ThemeLayout') self.ThemeSelectionComboItem = QtGui.QComboBox(self.ThemeGroupBox) + self.ThemeSelectionComboItem.setEditable(True) self.ThemeSelectionComboItem.setObjectName(u'ThemeSelectionComboItem') self.ThemeLayout.addWidget(self.ThemeSelectionComboItem) self.ThemeAddButton = QtGui.QPushButton(self.ThemeGroupBox) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index c2dced872..2c03d13f6 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -136,6 +136,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def loadTopics(self): topics = self.songmanager.get_topics() + topicsCompleter = QtGui.QCompleter( + [topic.name for topic in topics], + self.SongTopicCombo) + topicsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive); + self.SongTopicCombo.setCompleter(topicsCompleter); self.SongTopicCombo.clear() for topic in topics: row = self.SongTopicCombo.count() @@ -144,6 +149,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def loadBooks(self): books = self.songmanager.get_books() + booksCompleter = QtGui.QCompleter( + [book.name for book in books], + self.SongbookCombo) + booksCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive); + self.SongbookCombo.setCompleter(booksCompleter); self.SongbookCombo.clear() self.SongbookCombo.addItem(u' ') for book in books: @@ -152,6 +162,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.SongbookCombo.setItemData(row, QtCore.QVariant(book.id)) def loadThemes(self, theme_list): + themesCompleter = QtGui.QCompleter( + [theme for theme in theme_list], + self.ThemeSelectionComboItem) + themesCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive); + self.ThemeSelectionComboItem.setCompleter(themesCompleter); self.ThemeSelectionComboItem.clear() self.ThemeSelectionComboItem.addItem(u' ') for theme in theme_list: