- Fixed a problem where authors with null names in the db were not editable.

- Fixed the add author shortcut on the edit song form to split up the author's name so that the above error doesn't occur.
- Made the Clear Search button run a blank search (which is what the user expects).
This commit is contained in:
Raoul Snyman 2010-06-19 00:09:41 +02:00
commit a616a7d160
3 changed files with 10 additions and 1 deletions

View File

@ -294,7 +294,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
'exist, do you want to add them?'),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
author = Author.populate(display_name=text)
author = Author.populate(first_name=text.rsplit(u' ', 1)[0],
last_name=text.rsplit(u' ', 1)[1], display_name=text)
self.songmanager.save_author(author)
self.song.authors.append(author)
author_item = QtGui.QListWidgetItem(unicode(author.display_name))

View File

@ -172,6 +172,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
author_id = self._getCurrentItemId(self.AuthorsListWidget)
if author_id != -1:
author = self.songmanager.get_author(author_id)
# Just make sure none of the fields is None
if author.first_name is None:
author.first_name = u''
if author.last_name is None:
author.last_name = u''
if author.display_name is None:
author.display_name = u''
self.authorform.setAutoDisplayName(False)
self.authorform.FirstNameEdit.setText(author.first_name)
self.authorform.LastNameEdit.setText(author.last_name)

View File

@ -218,6 +218,7 @@ class SongMediaItem(MediaManagerItem):
Clear the search text.
"""
self.SearchTextEdit.clear()
self.onSearchTextButtonClick()
def onSearchTextEditChanged(self, text):
"""