- disable "edit" and "delete" button when loading a song or creating a new one (*)

(*) To reproduce this, edit/create a song, select a verse and click "Cancel". When you edit/create another song, the "edit" and "delete" buttons are enabled.

Manually fix conflict in comments on merge (trb143)

bzr-revno: 1127
This commit is contained in:
andreas 2010-12-02 09:11:34 +00:00 committed by Tim Bentley
commit c8fe3ceb67

View File

@ -152,6 +152,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def newSong(self): def newSong(self):
log.debug(u'New Song') log.debug(u'New Song')
self.initialise()
self.SongTabWidget.setCurrentIndex(0) self.SongTabWidget.setCurrentIndex(0)
self.TitleEditItem.setText(u'') self.TitleEditItem.setText(u'')
self.AlternativeEdit.setText(u'') self.AlternativeEdit.setText(u'')
@ -170,8 +171,18 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
# it's a new song to preview is not possible # it's a new song to preview is not possible
self.previewButton.setVisible(False) self.previewButton.setVisible(False)
def loadSong(self, id, preview): def loadSong(self, id, preview=False):
"""
Loads a song.
``id``
The song id (int).
``preview``
Should be ``True`` if the song is also previewed (boolean).
"""
log.debug(u'Load Song') log.debug(u'Load Song')
self.initialise()
self.SongTabWidget.setCurrentIndex(0) self.SongTabWidget.setCurrentIndex(0)
self.loadAuthors() self.loadAuthors()
self.loadTopics() self.loadTopics()
@ -594,6 +605,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
""" """
Save and Preview button pressed. Save and Preview button pressed.
The Song is valid so as the plugin to add it to preview to see. The Song is valid so as the plugin to add it to preview to see.
``button``
A button (QPushButton).
""" """
log.debug(u'onPreview') log.debug(u'onPreview')
if unicode(button.objectName()) == u'previewButton' and \ if unicode(button.objectName()) == u'previewButton' and \
@ -630,8 +644,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
Get all the data from the widgets on the form, and then save it to the Get all the data from the widgets on the form, and then save it to the
database. database.
``preview`` ``preview``
Should be True if song is also previewed. Should be ``True`` if the song is also previewed (boolean).
""" """
self.song.title = unicode(self.TitleEditItem.text()) self.song.title = unicode(self.TitleEditItem.text())
self.song.alternate_title = unicode(self.AlternativeEdit.text()) self.song.alternate_title = unicode(self.AlternativeEdit.text())