forked from openlp/openlp
Fix none for new authors
Fix focus bugs in Song child windows
This commit is contained in:
parent
66b6836406
commit
6fdd5d028f
@ -154,6 +154,8 @@ class MigrateSongs():
|
|||||||
author = Author()
|
author = Author()
|
||||||
authors_temp = self.session.query(TAuthor).get(a)
|
authors_temp = self.session.query(TAuthor).get(a)
|
||||||
author.display_name = authors_temp.authorname
|
author.display_name = authors_temp.authorname
|
||||||
|
author.first_name = u''
|
||||||
|
author.last_name = u''
|
||||||
song.authors.append(author)
|
song.authors.append(author)
|
||||||
try:
|
try:
|
||||||
self.session.add(song)
|
self.session.add(song)
|
||||||
|
@ -97,6 +97,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
|||||||
self.DeleteButton.setEnabled(False)
|
self.DeleteButton.setEnabled(False)
|
||||||
self.author = None
|
self.author = None
|
||||||
self._validate_form()
|
self._validate_form()
|
||||||
|
self.DisplayEdit.setFocus()
|
||||||
|
|
||||||
def onAuthorListWidgetItemClicked(self, index):
|
def onAuthorListWidgetItemClicked(self, index):
|
||||||
"""
|
"""
|
||||||
@ -108,8 +109,14 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
|||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.author = self.songmanager.get_author(item_id)
|
self.author = self.songmanager.get_author(item_id)
|
||||||
self.DisplayEdit.setText(self.author.display_name)
|
self.DisplayEdit.setText(self.author.display_name)
|
||||||
self.FirstNameEdit.setText(self.author.first_name)
|
if self.author.first_name is None:
|
||||||
self.LastNameEdit.setText(self.author.last_name)
|
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:
|
if len(self.author.songs) > 0:
|
||||||
self.MessageLabel.setText(translate(u'AuthorForm', u'Author in use "Delete" is disabled'))
|
self.MessageLabel.setText(translate(u'AuthorForm', u'Author in use "Delete" is disabled'))
|
||||||
self.DeleteButton.setEnabled(False)
|
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.MessageLabel.setText(translate(u'AuthorForm', u'Author in not used'))
|
||||||
self.DeleteButton.setEnabled(True)
|
self.DeleteButton.setEnabled(True)
|
||||||
self._validate_form()
|
self._validate_form()
|
||||||
|
self.DisplayEdit.setFocus()
|
||||||
|
|
||||||
def _validate_form(self):
|
def _validate_form(self):
|
||||||
# We need at lease a display name
|
# We need at lease a display name
|
||||||
|
@ -96,6 +96,7 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
|
|||||||
self.AddUpdateButton.setEnabled(True)
|
self.AddUpdateButton.setEnabled(True)
|
||||||
self.Book = None
|
self.Book = None
|
||||||
self._validate_form()
|
self._validate_form()
|
||||||
|
self.NameEdit.setFocus()
|
||||||
|
|
||||||
def onBooksListViewItemClicked(self, index):
|
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.MessageLabel.setText(translate(u'BookForm', u'Book in not used'))
|
||||||
self.DeleteButton.setEnabled(True)
|
self.DeleteButton.setEnabled(True)
|
||||||
self._validate_form()
|
self._validate_form()
|
||||||
|
self.NameEdit.setFocus()
|
||||||
|
|
||||||
def _validate_form(self):
|
def _validate_form(self):
|
||||||
# We need at lease a display name
|
# We need at lease a display name
|
||||||
|
@ -95,6 +95,7 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
|
|||||||
self.DeleteButton.setEnabled(False)
|
self.DeleteButton.setEnabled(False)
|
||||||
self.topic = None
|
self.topic = None
|
||||||
self._validate_form()
|
self._validate_form()
|
||||||
|
self.TopicNameEdit.setFocus()
|
||||||
|
|
||||||
def onTopicsListWidgetItemClicked(self, index):
|
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.MessageLabel.setText(translate(u'TopicForm', u'Topic in not used'))
|
||||||
self.DeleteButton.setEnabled(True)
|
self.DeleteButton.setEnabled(True)
|
||||||
self._validate_form()
|
self._validate_form()
|
||||||
|
self.TopicNameEdit.setFocus()
|
||||||
|
|
||||||
def _validate_form(self):
|
def _validate_form(self):
|
||||||
# We need at lease a display name
|
# We need at lease a display name
|
||||||
|
Loading…
Reference in New Issue
Block a user