dded autocompletion to the authors, topics, songbooks and themes.

bzr-revno: 795
This commit is contained in:
Raoul Snyman 2010-04-19 09:12:14 +02:00
commit 7a6c8c54f6
2 changed files with 24 additions and 1 deletions

View File

@ -135,7 +135,7 @@ class Ui_EditSongDialog(object):
sizePolicy.setHeightForWidth( sizePolicy.setHeightForWidth(
self.AuthorsSelectionComboItem.sizePolicy().hasHeightForWidth()) self.AuthorsSelectionComboItem.sizePolicy().hasHeightForWidth())
self.AuthorsSelectionComboItem.setSizePolicy(sizePolicy) self.AuthorsSelectionComboItem.setSizePolicy(sizePolicy)
self.AuthorsSelectionComboItem.setEditable(False) self.AuthorsSelectionComboItem.setEditable(True)
self.AuthorsSelectionComboItem.setInsertPolicy( self.AuthorsSelectionComboItem.setInsertPolicy(
QtGui.QComboBox.InsertAlphabetically) QtGui.QComboBox.InsertAlphabetically)
self.AuthorsSelectionComboItem.setSizeAdjustPolicy( self.AuthorsSelectionComboItem.setSizeAdjustPolicy(
@ -212,6 +212,7 @@ class Ui_EditSongDialog(object):
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth( sizePolicy.setHeightForWidth(
self.SongTopicCombo.sizePolicy().hasHeightForWidth()) self.SongTopicCombo.sizePolicy().hasHeightForWidth())
self.SongTopicCombo.setEditable(True)
self.SongTopicCombo.setSizePolicy(sizePolicy) self.SongTopicCombo.setSizePolicy(sizePolicy)
self.SongTopicCombo.setObjectName(u'SongTopicCombo') self.SongTopicCombo.setObjectName(u'SongTopicCombo')
self.TopicAddLayout.addWidget(self.SongTopicCombo) self.TopicAddLayout.addWidget(self.SongTopicCombo)
@ -256,6 +257,7 @@ class Ui_EditSongDialog(object):
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.SongbookCombo.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.SongbookCombo.sizePolicy().hasHeightForWidth())
self.SongbookCombo.setEditable(True)
self.SongbookCombo.setSizePolicy(sizePolicy) self.SongbookCombo.setSizePolicy(sizePolicy)
self.SongbookCombo.setObjectName(u'SongbookCombo') self.SongbookCombo.setObjectName(u'SongbookCombo')
self.SongbookLayout.addWidget(self.SongbookCombo, 0, 0, 1, 1) self.SongbookLayout.addWidget(self.SongbookCombo, 0, 0, 1, 1)
@ -293,6 +295,7 @@ class Ui_EditSongDialog(object):
self.ThemeLayout.setMargin(8) self.ThemeLayout.setMargin(8)
self.ThemeLayout.setObjectName(u'ThemeLayout') self.ThemeLayout.setObjectName(u'ThemeLayout')
self.ThemeSelectionComboItem = QtGui.QComboBox(self.ThemeGroupBox) self.ThemeSelectionComboItem = QtGui.QComboBox(self.ThemeGroupBox)
self.ThemeSelectionComboItem.setEditable(True)
self.ThemeSelectionComboItem.setObjectName(u'ThemeSelectionComboItem') self.ThemeSelectionComboItem.setObjectName(u'ThemeSelectionComboItem')
self.ThemeLayout.addWidget(self.ThemeSelectionComboItem) self.ThemeLayout.addWidget(self.ThemeSelectionComboItem)
self.ThemeAddButton = QtGui.QPushButton(self.ThemeGroupBox) self.ThemeAddButton = QtGui.QPushButton(self.ThemeGroupBox)

View File

@ -122,6 +122,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def loadAuthors(self): def loadAuthors(self):
authors = self.songmanager.get_authors() 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() self.AuthorsSelectionComboItem.clear()
for author in authors: for author in authors:
row = self.AuthorsSelectionComboItem.count() row = self.AuthorsSelectionComboItem.count()
@ -131,6 +136,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def loadTopics(self): def loadTopics(self):
topics = self.songmanager.get_topics() 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() self.SongTopicCombo.clear()
for topic in topics: for topic in topics:
row = self.SongTopicCombo.count() row = self.SongTopicCombo.count()
@ -139,6 +149,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def loadBooks(self): def loadBooks(self):
books = self.songmanager.get_books() 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.clear()
self.SongbookCombo.addItem(u' ') self.SongbookCombo.addItem(u' ')
for book in books: for book in books:
@ -147,6 +162,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.SongbookCombo.setItemData(row, QtCore.QVariant(book.id)) self.SongbookCombo.setItemData(row, QtCore.QVariant(book.id))
def loadThemes(self, theme_list): 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.clear()
self.ThemeSelectionComboItem.addItem(u' ') self.ThemeSelectionComboItem.addItem(u' ')
for theme in theme_list: for theme in theme_list: