Fix bug where empty lists fail to display dialogs

This commit is contained in:
Tim Bentley 2009-07-22 07:14:34 +01:00
parent e788db767a
commit 8e0901ef67
3 changed files with 42 additions and 39 deletions

View File

@ -108,6 +108,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
"""
self.currentRow = self.AuthorListWidget.currentRow()
item = self.AuthorListWidget.currentItem()
if item is not None:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.author = self.songmanager.get_author(item_id)
self.DisplayEdit.setText(self.author.display_name)

View File

@ -106,6 +106,7 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
"""
self.currentRow = self.BookSongListWidget.currentRow()
item = self.BookSongListWidget.currentItem()
if item is not None:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.Book = self.songmanager.get_book(item_id)
self.NameEdit.setText(self.Book.name)

View File

@ -105,6 +105,7 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
"""
self.currentRow = self.TopicsListWidget.currentRow()
item = self.TopicsListWidget.currentItem()
if item is not None:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.topic = self.songmanager.get_topic(item_id)
self.TopicNameEdit.setText(self.topic.name)