More song tagging changes

This commit is contained in:
Tim Bentley 2009-11-23 17:28:21 +00:00
parent 50aa143446
commit 5e2beba4ea
2 changed files with 16 additions and 4 deletions

View File

@ -322,10 +322,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
item = self.VerseListWidget.currentItem()
if item:
tempText = item.text()
verseId = unicode((item.data(QtCore.Qt.UserRole)).toString()[0])
verseId = unicode((item.data(QtCore.Qt.UserRole)).toString())
self.verse_form.setVerse(tempText, True, verseId)
self.verse_form.exec_()
afterText = self.verse_form.getVerse()
afterText, verse, subVerse = self.verse_form.getVerse()
data = u'%s%s' %(verse , subVerse)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
item.setText(afterText)
#number of lines has change
if len(tempText.split(u'\n')) != len(afterText.split(u'\n')):

View File

@ -30,13 +30,21 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
"""
This is the form that is used to edit the verses of the song.
"""
def __init__(self, parent=None):
"""
Constructor
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
QtCore.QObject.connect(self.VerseListComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onVerseListComboBoxChanged)
def onVerseListComboBoxChanged(self, value):
if unicode(self.VerseListComboBox.currentText()).isdigit():
self.SubVerseListComboBox.setEnabled(True)
else:
self.SubVerseListComboBox.setCurrentIndex(0)
self.SubVerseListComboBox.setEnabled(False)
def setVerse(self, text, single=False, id=0):
posVerse = 0
@ -65,4 +73,6 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
self.VerseTextEdit.setFocus(QtCore.Qt.OtherFocusReason)
def getVerse(self):
return self.VerseTextEdit.toPlainText()
return self.VerseTextEdit.toPlainText(), \
unicode(self.VerseListComboBox.currentText()), \
unicode(self.SubVerseListComboBox.currentText())