forked from openlp/openlp
Fix up tag editing
This commit is contained in:
parent
b90169a129
commit
611ae15790
@ -411,9 +411,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.SongTabWidget.setCurrentIndex(2)
|
||||
self.AuthorsListView.setFocus()
|
||||
#split the verse list by space and mark lower case for testing
|
||||
taglist = self.trUtf8(' bcitped')
|
||||
for verse in unicode(self.VerseOrderEdit.text()).lower().split(u' '):
|
||||
if len(verse) > 1:
|
||||
if verse[0:1] == u'v' and verse[1:].isdigit():
|
||||
if verse[0:1] == u'%s' % self.trUtf8('v') and verse[1:].isdigit():
|
||||
pass
|
||||
else:
|
||||
self.SongTabWidget.setCurrentIndex(0)
|
||||
@ -421,7 +422,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
return False, \
|
||||
self.trUtf8('Invalid verse entry - vX')
|
||||
else:
|
||||
if u' bcitped'.find(verse) > -1:
|
||||
if taglist.find(verse) > -1:
|
||||
pass
|
||||
else:
|
||||
self.SongTabWidget.setCurrentIndex(0)
|
||||
|
@ -53,53 +53,57 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
||||
QtCore.QObject.connect(self.VerseListComboBox,
|
||||
QtCore.SIGNAL(u'activated(int)'), self.onVerseComboChanged)
|
||||
|
||||
def startNewLine(self):
|
||||
if self.VerseTextEdit.textCursor().columnNumber() != 0:
|
||||
self.VerseTextEdit.insertPlainText(u'\n')
|
||||
|
||||
def onAddIntro(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
|
||||
% self.trUtf8('Intro'))
|
||||
self.VerseTextEdit.moveCursor(QtGui.QTextCursor.Down)
|
||||
self.VerseTextEdit.setFocus()
|
||||
|
||||
def onAddEnding(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
|
||||
% self.trUtf8('Ending'))
|
||||
self.VerseTextEdit.moveCursor(QtGui.QTextCursor.Down)
|
||||
self.VerseTextEdit.setFocus()
|
||||
|
||||
def onAddOther(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
|
||||
% self.trUtf8('Other'))
|
||||
self.VerseTextEdit.moveCursor(QtGui.QTextCursor.Down)
|
||||
self.VerseTextEdit.setFocus()
|
||||
|
||||
def onAddPreChorus(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
|
||||
% self.trUtf8('Pre-Chorus'))
|
||||
self.VerseTextEdit.moveCursor(QtGui.QTextCursor.Down)
|
||||
self.VerseTextEdit.setFocus()
|
||||
|
||||
def onAddBridge(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
|
||||
% self.trUtf8('Bridge'))
|
||||
self.VerseTextEdit.moveCursor(QtGui.QTextCursor.Down)
|
||||
self.VerseTextEdit.setFocus()
|
||||
|
||||
def onAddChorus(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
|
||||
% self.trUtf8('Chorus'))
|
||||
self.VerseTextEdit.moveCursor(QtGui.QTextCursor.Down)
|
||||
self.VerseTextEdit.setFocus()
|
||||
|
||||
def onAddVerse(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
|
||||
% self.trUtf8('Verse'))
|
||||
self.VerseTextEdit.moveCursor(QtGui.QTextCursor.Down)
|
||||
self.VerseTextEdit.setFocus()
|
||||
|
||||
def setVerse(self, text, verseCount=0, single=False, tag=u'Verse:1'):
|
||||
posVerse = 0
|
||||
posSub = 0
|
||||
if len(text) == 0 and not single:
|
||||
text = u'---[Verse:1]---\n'
|
||||
text = u'---[%s:1]---\n' % self.trUtf8('Verse')
|
||||
if single:
|
||||
id = tag.split(u':')
|
||||
posVerse = self.VerseListComboBox.findText(id[0], QtCore.Qt.MatchExactly)
|
||||
@ -145,11 +149,11 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
||||
def getVerseAll(self):
|
||||
text = self.VerseTextEdit.toPlainText()
|
||||
if not text.startsWith(u'---['):
|
||||
text = u'---[Verse:1]---\n%s' % text
|
||||
text = u'---[%s:1]---\n%s' % (self.trUtf8('Verse'), text)
|
||||
return text
|
||||
|
||||
def onVerseComboChanged(self, id):
|
||||
if unicode(self.VerseListComboBox.currentText()) == u'Verse':
|
||||
if unicode(self.VerseListComboBox.currentText()) == self.trUtf8('Verse'):
|
||||
self.SubVerseListComboBox.setEnabled(True)
|
||||
else:
|
||||
self.SubVerseListComboBox.setEnabled(False)
|
||||
|
Loading…
Reference in New Issue
Block a user