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