Song editing fix

This commit is contained in:
Tim Bentley 2009-09-09 17:34:24 +01:00
parent 7f1460cb4f
commit 4dd19eb643

View File

@ -282,9 +282,21 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def onVerseEditButtonClicked(self): def onVerseEditButtonClicked(self):
item = self.VerseListWidget.currentItem() item = self.VerseListWidget.currentItem()
if item is not None: if item is not None:
self.verse_form.setVerse(item.text()) tempText = item.text()
self.verse_form.setVerse(tempText)
self.verse_form.exec_() self.verse_form.exec_()
item.setText(self.verse_form.getVerse()) afterText = self.verse_form.getVerse()
item.setText(afterText)
#number of lines has change
if len(tempText.split(u'\n')) != len(afterText.split(u'\n')):
tempList = []
for row in range(0, self.VerseListWidget.count()):
tempList.insert(row, self.VerseListWidget.item(row))
self.VerseListWidget.clear()
for row in range (0, len(tempList)):
item = tempList[row]
self.VerseListWidget.addItem(item)
self.VerseListWidget.repaint()
self.VerseEditButton.setEnabled(False) self.VerseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False) self.VerseDeleteButton.setEnabled(False)