From 6fdd5d028f5257ed1e3bbc006624dcefeb8d5813 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 14 Jul 2009 19:38:33 +0100 Subject: [PATCH] Fix none for new authors Fix focus bugs in Song child windows --- openlp/migration/migratesongs.py | 2 ++ openlp/plugins/songs/forms/authorsform.py | 12 ++++++++++-- openlp/plugins/songs/forms/songbookform.py | 2 ++ openlp/plugins/songs/forms/topicsform.py | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/openlp/migration/migratesongs.py b/openlp/migration/migratesongs.py index 2465c8b9d..3620c6ab2 100644 --- a/openlp/migration/migratesongs.py +++ b/openlp/migration/migratesongs.py @@ -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) diff --git a/openlp/plugins/songs/forms/authorsform.py b/openlp/plugins/songs/forms/authorsform.py index 9d9db05e7..d87e5bfe0 100644 --- a/openlp/plugins/songs/forms/authorsform.py +++ b/openlp/plugins/songs/forms/authorsform.py @@ -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 diff --git a/openlp/plugins/songs/forms/songbookform.py b/openlp/plugins/songs/forms/songbookform.py index 73f36f797..cc203cdb4 100644 --- a/openlp/plugins/songs/forms/songbookform.py +++ b/openlp/plugins/songs/forms/songbookform.py @@ -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 diff --git a/openlp/plugins/songs/forms/topicsform.py b/openlp/plugins/songs/forms/topicsform.py index d18547638..825d1a66b 100644 --- a/openlp/plugins/songs/forms/topicsform.py +++ b/openlp/plugins/songs/forms/topicsform.py @@ -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