fixed Song Book publisher

fixed Authors like "0123hallo" which cannot be splitted
This commit is contained in:
andreas 2010-07-21 12:30:29 +02:00
parent a835338939
commit 2691636e71
1 changed files with 33 additions and 30 deletions

View File

@ -291,6 +291,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
'exist, do you want to add them?'), 'exist, do you want to add them?'),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes: QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
if text.find(' ') == -1:
author = Author.populate(first_name=u'', last_name=u'',
display_name=text)
else:
author = Author.populate(first_name=text.rsplit(u' ', 1)[0], author = Author.populate(first_name=text.rsplit(u' ', 1)[0],
last_name=text.rsplit(u' ', 1)[1], display_name=text) last_name=text.rsplit(u' ', 1)[1], display_name=text)
self.songmanager.save_object(author, False) self.songmanager.save_object(author, False)
@ -582,8 +586,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
unicode(translate('SongsPlugin.EditSongForm', unicode(translate('SongsPlugin.EditSongForm',
'You have not used %s anywhere in the verse ' 'You have not used %s anywhere in the verse '
'order. Are you sure you want to save the song ' 'order. Are you sure you want to save the song '
'like this?')) % \ 'like this?')) % verse_names[count].replace(u':', u' '),
verse_names[count].replace(u':', u' '),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No: if answer == QtGui.QMessageBox.No:
return False return False
@ -627,7 +630,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
'not exist, do you want to add it?'), 'not exist, do you want to add it?'),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes: QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
book = Book.populate(name=text) book = Book.populate(name=text, publisher=u'')
self.songmanager.save_object(book) self.songmanager.save_object(book)
self.song.book = book self.song.book = book
self.loadBooks() self.loadBooks()