forked from openlp/openlp
Fix bug where empty lists fail to display dialogs
This commit is contained in:
parent
e788db767a
commit
8e0901ef67
@ -108,24 +108,25 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
|||||||
"""
|
"""
|
||||||
self.currentRow = self.AuthorListWidget.currentRow()
|
self.currentRow = self.AuthorListWidget.currentRow()
|
||||||
item = self.AuthorListWidget.currentItem()
|
item = self.AuthorListWidget.currentItem()
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
if item is not None:
|
||||||
self.author = self.songmanager.get_author(item_id)
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.DisplayEdit.setText(self.author.display_name)
|
self.author = self.songmanager.get_author(item_id)
|
||||||
if self.author.first_name is None:
|
self.DisplayEdit.setText(self.author.display_name)
|
||||||
self.FirstNameEdit.setText(u'')
|
if self.author.first_name is None:
|
||||||
else:
|
self.FirstNameEdit.setText(u'')
|
||||||
self.FirstNameEdit.setText(self.author.first_name)
|
else:
|
||||||
if self.author.last_name is None:
|
self.FirstNameEdit.setText(self.author.first_name)
|
||||||
self.LastNameEdit.setText(u'')
|
if self.author.last_name is None:
|
||||||
else:
|
self.LastNameEdit.setText(u'')
|
||||||
self.LastNameEdit.setText(self.author.last_name)
|
else:
|
||||||
if len(self.author.songs) > 0:
|
self.LastNameEdit.setText(self.author.last_name)
|
||||||
self.MessageLabel.setText(translate(u'AuthorForm', u'Author in use "Delete" is disabled'))
|
if len(self.author.songs) > 0:
|
||||||
self.DeleteButton.setEnabled(False)
|
self.MessageLabel.setText(translate(u'AuthorForm', u'Author in use "Delete" is disabled'))
|
||||||
else:
|
self.DeleteButton.setEnabled(False)
|
||||||
self.MessageLabel.setText(translate(u'AuthorForm', u'Author in not used'))
|
else:
|
||||||
self.DeleteButton.setEnabled(True)
|
self.MessageLabel.setText(translate(u'AuthorForm', u'Author in not used'))
|
||||||
self._validate_form()
|
self.DeleteButton.setEnabled(True)
|
||||||
|
self._validate_form()
|
||||||
self.DisplayEdit.setFocus()
|
self.DisplayEdit.setFocus()
|
||||||
|
|
||||||
def _validate_form(self):
|
def _validate_form(self):
|
||||||
|
@ -106,17 +106,18 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
|
|||||||
"""
|
"""
|
||||||
self.currentRow = self.BookSongListWidget.currentRow()
|
self.currentRow = self.BookSongListWidget.currentRow()
|
||||||
item = self.BookSongListWidget.currentItem()
|
item = self.BookSongListWidget.currentItem()
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
if item is not None:
|
||||||
self.Book = self.songmanager.get_book(item_id)
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.NameEdit.setText(self.Book.name)
|
self.Book = self.songmanager.get_book(item_id)
|
||||||
self.PublisherEdit.setText(self.Book.publisher)
|
self.NameEdit.setText(self.Book.name)
|
||||||
if len(self.Book.songs) > 0:
|
self.PublisherEdit.setText(self.Book.publisher)
|
||||||
self.MessageLabel.setText(translate(u'BookForm', u'Book in use "Delete" is disabled'))
|
if len(self.Book.songs) > 0:
|
||||||
self.DeleteButton.setEnabled(False)
|
self.MessageLabel.setText(translate(u'BookForm', u'Book in use "Delete" is disabled'))
|
||||||
else:
|
self.DeleteButton.setEnabled(False)
|
||||||
self.MessageLabel.setText(translate(u'BookForm', u'Book in not used'))
|
else:
|
||||||
self.DeleteButton.setEnabled(True)
|
self.MessageLabel.setText(translate(u'BookForm', u'Book in not used'))
|
||||||
self._validate_form()
|
self.DeleteButton.setEnabled(True)
|
||||||
|
self._validate_form()
|
||||||
self.NameEdit.setFocus()
|
self.NameEdit.setFocus()
|
||||||
|
|
||||||
def _validate_form(self):
|
def _validate_form(self):
|
||||||
|
@ -105,16 +105,17 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
|
|||||||
"""
|
"""
|
||||||
self.currentRow = self.TopicsListWidget.currentRow()
|
self.currentRow = self.TopicsListWidget.currentRow()
|
||||||
item = self.TopicsListWidget.currentItem()
|
item = self.TopicsListWidget.currentItem()
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
if item is not None:
|
||||||
self.topic = self.songmanager.get_topic(item_id)
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.TopicNameEdit.setText(self.topic.name)
|
self.topic = self.songmanager.get_topic(item_id)
|
||||||
if len(self.topic.songs) > 0:
|
self.TopicNameEdit.setText(self.topic.name)
|
||||||
self.MessageLabel.setText(translate(u'TopicForm', u'Topic in use "Delete" is disabled'))
|
if len(self.topic.songs) > 0:
|
||||||
self.DeleteButton.setEnabled(False)
|
self.MessageLabel.setText(translate(u'TopicForm', u'Topic in use "Delete" is disabled'))
|
||||||
else:
|
self.DeleteButton.setEnabled(False)
|
||||||
self.MessageLabel.setText(translate(u'TopicForm', u'Topic in not used'))
|
else:
|
||||||
self.DeleteButton.setEnabled(True)
|
self.MessageLabel.setText(translate(u'TopicForm', u'Topic in not used'))
|
||||||
self._validate_form()
|
self.DeleteButton.setEnabled(True)
|
||||||
|
self._validate_form()
|
||||||
self.TopicNameEdit.setFocus()
|
self.TopicNameEdit.setFocus()
|
||||||
|
|
||||||
def _validate_form(self):
|
def _validate_form(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user