Fix none for new authors

Fix focus bugs in Song child windows
This commit is contained in:
Tim Bentley 2009-07-14 19:38:33 +01:00
parent 66b6836406
commit 6fdd5d028f
4 changed files with 16 additions and 2 deletions

View File

@ -154,6 +154,8 @@ class MigrateSongs():
author = Author()
authors_temp = self.session.query(TAuthor).get(a)
author.display_name = authors_temp.authorname
author.first_name = u''
author.last_name = u''
song.authors.append(author)
try:
self.session.add(song)

View File

@ -97,6 +97,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
self.DeleteButton.setEnabled(False)
self.author = None
self._validate_form()
self.DisplayEdit.setFocus()
def onAuthorListWidgetItemClicked(self, index):
"""
@ -108,8 +109,14 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.author = self.songmanager.get_author(item_id)
self.DisplayEdit.setText(self.author.display_name)
self.FirstNameEdit.setText(self.author.first_name)
self.LastNameEdit.setText(self.author.last_name)
if self.author.first_name is None:
self.FirstNameEdit.setText(u'')
else:
self.FirstNameEdit.setText(self.author.first_name)
if self.author.last_name is None:
self.LastNameEdit.setText(u'')
else:
self.LastNameEdit.setText(self.author.last_name)
if len(self.author.songs) > 0:
self.MessageLabel.setText(translate(u'AuthorForm', u'Author in use "Delete" is disabled'))
self.DeleteButton.setEnabled(False)
@ -117,6 +124,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
self.MessageLabel.setText(translate(u'AuthorForm', u'Author in not used'))
self.DeleteButton.setEnabled(True)
self._validate_form()
self.DisplayEdit.setFocus()
def _validate_form(self):
# We need at lease a display name

View File

@ -96,6 +96,7 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
self.AddUpdateButton.setEnabled(True)
self.Book = None
self._validate_form()
self.NameEdit.setFocus()
def onBooksListViewItemClicked(self, index):
"""
@ -115,6 +116,7 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
self.MessageLabel.setText(translate(u'BookForm', u'Book in not used'))
self.DeleteButton.setEnabled(True)
self._validate_form()
self.NameEdit.setFocus()
def _validate_form(self):
# We need at lease a display name

View File

@ -95,6 +95,7 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
self.DeleteButton.setEnabled(False)
self.topic = None
self._validate_form()
self.TopicNameEdit.setFocus()
def onTopicsListWidgetItemClicked(self, index):
"""
@ -113,6 +114,7 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
self.MessageLabel.setText(translate(u'TopicForm', u'Topic in not used'))
self.DeleteButton.setEnabled(True)
self._validate_form()
self.TopicNameEdit.setFocus()
def _validate_form(self):
# We need at lease a display name