Add new types to verse editing

Clean up dialog so looks better
Add controls around the editor in terms of validation
This commit is contained in:
Tim Bentley 2009-12-02 08:35:02 +00:00
parent 7eeb81f00a
commit 156a70208b
5 changed files with 256 additions and 184 deletions

View File

@ -210,17 +210,17 @@ class SlideController(QtGui.QWidget):
if isLive: if isLive:
self.Songbar = OpenLPToolbar(self) self.Songbar = OpenLPToolbar(self)
self.Songbar.addToolbarButton( self.Songbar.addToolbarButton(
u'Bridge', u':/pages/page_bridge.png', u'Bridge:1', u':/pages/page_bridge.png',
self.trUtf8('Bridge'), self.trUtf8('Bridge'),
self.onSongBarHandler) self.onSongBarHandler)
self.Songbar.addToolbarButton( self.Songbar.addToolbarButton(
u'Chorus', u':/pages/page_chorus.png', u'Chorus:1', u':/pages/page_chorus.png',
self.trUtf8('Chorus'), self.trUtf8('Chorus'),
self.onSongBarHandler) self.onSongBarHandler)
for verse in range(1, 12): for verse in range(1, 12):
self.Songbar.addToolbarButton( self.Songbar.addToolbarButton(
unicode(verse), u':/pages/page_%s.png' % verse, unicode(u'Verse:%s'% verse), u':/pages/page_%s.png' % verse,
unicode(self.trUtf8('Verse %s'))%verse, unicode(self.trUtf8('Verse %s'))% verse,
self.onSongBarHandler) self.onSongBarHandler)
self.ControllerLayout.addWidget(self.Songbar) self.ControllerLayout.addWidget(self.Songbar)
self.Songbar.setVisible(False) self.Songbar.setVisible(False)
@ -312,14 +312,14 @@ class SlideController(QtGui.QWidget):
pass pass
def onSongBarHandler(self): def onSongBarHandler(self):
request = self.sender().text() request = unicode(self.sender().text())
if request == u'Bridge': if request == u'Bridge':
pass a=c
elif request == u'Chorus': elif request == u'Chorus':
pass a=c
else: else:
#Remember list is 1 out! #Remember list is 1 out!
slideno = int(request) - 1 slideno = self.slideList[request]
if slideno > self.PreviewListWidget.rowCount(): if slideno > self.PreviewListWidget.rowCount():
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount()) self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
else: else:
@ -355,14 +355,19 @@ class SlideController(QtGui.QWidget):
self.Songbar.actions[action].setVisible(False) self.Songbar.actions[action].setVisible(False)
if item.verse_order: if item.verse_order:
verses = item.verse_order.split(u' ') verses = item.verse_order.split(u' ')
# for verse in verses: for verse in verses:
# if not verse or int(verse) > 12: if verse is not u' ':
# break pass
# try: try:
# self.Songbar.actions[verse].setVisible(True) if verse == u'C':
# except: self.Songbar.actions[u'Chorus:1'].setVisible(True)
# #More than 20 verses hard luck elif verse == u'B':
# pass self.Songbar.actions[u'Bridge:1'].setVisible(True)
else:
vse = u'Verse:%s' % verse
self.Songbar.actions[vse].setVisible(True)
except:
pass
self.Songbar.setVisible(True) self.Songbar.setVisible(True)
elif item.is_image(): elif item.is_image():
#Not sensible to allow loops with 1 frame #Not sensible to allow loops with 1 frame
@ -451,6 +456,10 @@ class SlideController(QtGui.QWidget):
slide_height = 0 slide_height = 0
#It is a based Text Render #It is a based Text Render
if self.serviceItem.is_text(): if self.serviceItem.is_text():
#only load the slot once
try:
test = self.slideList[frame[u'verseTag']]
except:
self.slideList[frame[u'verseTag']] = framenumber self.slideList[frame[u'verseTag']] = framenumber
item.setText(frame[u'text']) item.setText(frame[u'text'])
else: else:
@ -479,6 +488,7 @@ class SlideController(QtGui.QWidget):
if self.isLive: if self.isLive:
self.serviceItem.request_audit() self.serviceItem.request_audit()
log.debug(u'displayServiceManagerItems End') log.debug(u'displayServiceManagerItems End')
print self.slideList
#Screen event methods #Screen event methods
def onSlideSelectedFirst(self): def onSlideSelectedFirst(self):

View File

@ -315,7 +315,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.VerseDeleteButton.setEnabled(True) self.VerseDeleteButton.setEnabled(True)
def onVerseAddButtonClicked(self): def onVerseAddButtonClicked(self):
self.verse_form.setVerse(u'') self.verse_form.setVerse(u'', self.VerseListWidget.count() + 1, True)
self.verse_form.exec_() self.verse_form.exec_()
afterText, verse, subVerse = self.verse_form.getVerse() afterText, verse, subVerse = self.verse_form.getVerse()
data = u'%s:%s' %(verse, subVerse) data = u'%s:%s' %(verse, subVerse)
@ -329,7 +329,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if item: if item:
tempText = item.text() tempText = item.text()
verseId = unicode((item.data(QtCore.Qt.UserRole)).toString()) verseId = unicode((item.data(QtCore.Qt.UserRole)).toString())
self.verse_form.setVerse(tempText, True, verseId) self.verse_form.setVerse(tempText, \
self.VerseListWidget.count(), True, verseId)
self.verse_form.exec_() self.verse_form.exec_()
afterText, verse, subVerse = self.verse_form.getVerse() afterText, verse, subVerse = self.verse_form.getVerse()
data = u'%s:%s' %(verse, subVerse) data = u'%s:%s' %(verse, subVerse)
@ -401,13 +402,13 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.SongTabWidget.setCurrentIndex(2) self.SongTabWidget.setCurrentIndex(2)
self.AuthorsListView.setFocus() self.AuthorsListView.setFocus()
for verse in unicode(self.VerseOrderEdit.text()): for verse in unicode(self.VerseOrderEdit.text()):
if verse.isdigit() or u' BC'.find(verse) > -1: if verse.isdigit() or u' BCITPEO'.find(verse.upper()) > -1:
pass pass
else: else:
self.SongTabWidget.setCurrentIndex(0) self.SongTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus() self.VerseOrderEdit.setFocus()
return False, \ return False, \
self.trUtf8('Invalid verse entry - values must be Numeric, B or C') self.trUtf8('Invalid verse entry - values must be Numeric, I,B,C,T,P,E,O')
return True, u'' return True, u''
def onTitleEditItemLostFocus(self): def onTitleEditItemLostFocus(self):

View File

@ -1,88 +1,91 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### # Form implementation generated from reading ui file 'editversedialog.ui'
# OpenLP - Open Source Lyrics Projection # #
# --------------------------------------------------------------------------- # # Created: Wed Dec 2 08:14:47 2009
# Copyright (c) 2008-2009 Raoul Snyman # # by: PyQt4 UI code generator 4.6.2
# Portions copyright (c) 2008-2009 Tim Bentley, Jonathan Corwin, Michael # #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # WARNING! All changes made in this file will be lost!
# Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
class Ui_EditVerseDialog(object): class Ui_EditVerseDialog(object):
def setupUi(self, EditVerseDialog): def setupUi(self, EditVerseDialog):
EditVerseDialog.setObjectName("EditVerseDialog") EditVerseDialog.setObjectName("EditVerseDialog")
EditVerseDialog.resize(492, 494) EditVerseDialog.resize(500, 521)
EditVerseDialog.setModal(True) EditVerseDialog.setModal(True)
self.widget = QtGui.QWidget(EditVerseDialog) self.layoutWidget = QtGui.QWidget(EditVerseDialog)
self.widget.setGeometry(QtCore.QRect(9, 12, 471, 471)) self.layoutWidget.setGeometry(QtCore.QRect(11, 1, 471, 491))
self.widget.setObjectName("widget") self.layoutWidget.setObjectName("layoutWidget")
self.verticalLayout = QtGui.QVBoxLayout(self.widget) self.verticalLayout_3 = QtGui.QVBoxLayout(self.layoutWidget)
self.verticalLayout.setObjectName("verticalLayout") self.verticalLayout_3.setObjectName("verticalLayout_3")
self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout") self.horizontalLayout.setObjectName("horizontalLayout")
self.VerseListComboBox = QtGui.QComboBox(self.widget) self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.VerseTypeLabel = QtGui.QLabel(self.layoutWidget)
self.VerseTypeLabel.setTextFormat(QtCore.Qt.PlainText)
self.VerseTypeLabel.setAlignment(QtCore.Qt.AlignCenter)
self.VerseTypeLabel.setObjectName("VerseTypeLabel")
self.verticalLayout.addWidget(self.VerseTypeLabel)
self.VerseListComboBox = QtGui.QComboBox(self.layoutWidget)
self.VerseListComboBox.setObjectName("VerseListComboBox") self.VerseListComboBox.setObjectName("VerseListComboBox")
self.VerseListComboBox.addItem("") self.VerseListComboBox.addItem("")
self.VerseListComboBox.setItemText(0, "")
self.VerseListComboBox.addItem("") self.VerseListComboBox.addItem("")
self.VerseListComboBox.addItem("") self.VerseListComboBox.addItem("")
self.VerseListComboBox.addItem("") self.VerseListComboBox.addItem("")
self.horizontalLayout.addWidget(self.VerseListComboBox) self.VerseListComboBox.addItem("")
self.SubVerseListComboBox = QtGui.QComboBox(self.widget) self.VerseListComboBox.addItem("")
self.VerseListComboBox.addItem("")
self.verticalLayout.addWidget(self.VerseListComboBox)
self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2 = QtGui.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.VerseNumberLabel = QtGui.QLabel(self.layoutWidget)
self.VerseNumberLabel.setAlignment(QtCore.Qt.AlignCenter)
self.VerseNumberLabel.setObjectName("VerseNumberLabel")
self.verticalLayout_2.addWidget(self.VerseNumberLabel)
self.SubVerseListComboBox = QtGui.QComboBox(self.layoutWidget)
self.SubVerseListComboBox.setObjectName("SubVerseListComboBox") self.SubVerseListComboBox.setObjectName("SubVerseListComboBox")
self.SubVerseListComboBox.addItem("") self.verticalLayout_2.addWidget(self.SubVerseListComboBox)
self.SubVerseListComboBox.setItemText(0, "") self.horizontalLayout.addLayout(self.verticalLayout_2)
self.SubVerseListComboBox.addItem("") self.verticalLayout_3.addLayout(self.horizontalLayout)
self.SubVerseListComboBox.addItem("") self.VerseTextEdit = QtGui.QTextEdit(self.layoutWidget)
self.SubVerseListComboBox.addItem("")
self.SubVerseListComboBox.addItem("")
self.SubVerseListComboBox.addItem("")
self.SubVerseListComboBox.addItem("")
self.SubVerseListComboBox.addItem("")
self.SubVerseListComboBox.addItem("")
self.SubVerseListComboBox.addItem("")
self.SubVerseListComboBox.addItem("")
self.SubVerseListComboBox.addItem("")
self.horizontalLayout.addWidget(self.SubVerseListComboBox)
self.verticalLayout.addLayout(self.horizontalLayout)
self.VerseTextEdit = QtGui.QTextEdit(self.widget)
self.VerseTextEdit.setAcceptRichText(False) self.VerseTextEdit.setAcceptRichText(False)
self.VerseTextEdit.setObjectName("VerseTextEdit") self.VerseTextEdit.setObjectName("VerseTextEdit")
self.verticalLayout.addWidget(self.VerseTextEdit) self.verticalLayout_3.addWidget(self.VerseTextEdit)
self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.addVerse = QtGui.QPushButton(self.widget) self.addBridge = QtGui.QPushButton(self.layoutWidget)
self.addVerse.setObjectName("addVerse")
self.horizontalLayout_2.addWidget(self.addVerse)
self.addChorus = QtGui.QPushButton(self.widget)
self.addChorus.setObjectName("addChorus")
self.horizontalLayout_2.addWidget(self.addChorus)
self.addBridge = QtGui.QPushButton(self.widget)
self.addBridge.setObjectName("addBridge") self.addBridge.setObjectName("addBridge")
self.horizontalLayout_2.addWidget(self.addBridge) self.horizontalLayout_2.addWidget(self.addBridge)
self.verticalLayout.addLayout(self.horizontalLayout_2) self.addVerse = QtGui.QPushButton(self.layoutWidget)
self.ButtonBox = QtGui.QDialogButtonBox(self.widget) self.addVerse.setObjectName("addVerse")
self.horizontalLayout_2.addWidget(self.addVerse)
self.addChorus = QtGui.QPushButton(self.layoutWidget)
self.addChorus.setObjectName("addChorus")
self.horizontalLayout_2.addWidget(self.addChorus)
self.verticalLayout_3.addLayout(self.horizontalLayout_2)
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.addPreChorus = QtGui.QPushButton(self.layoutWidget)
self.addPreChorus.setObjectName("addPreChorus")
self.horizontalLayout_3.addWidget(self.addPreChorus)
self.addIntro = QtGui.QPushButton(self.layoutWidget)
self.addIntro.setObjectName("addIntro")
self.horizontalLayout_3.addWidget(self.addIntro)
self.addOther = QtGui.QPushButton(self.layoutWidget)
self.addOther.setObjectName("addOther")
self.horizontalLayout_3.addWidget(self.addOther)
self.addEnding = QtGui.QPushButton(self.layoutWidget)
self.addEnding.setObjectName("addEnding")
self.horizontalLayout_3.addWidget(self.addEnding)
self.verticalLayout_3.addLayout(self.horizontalLayout_3)
self.ButtonBox = QtGui.QDialogButtonBox(self.layoutWidget)
self.ButtonBox.setOrientation(QtCore.Qt.Horizontal) self.ButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
self.ButtonBox.setObjectName("ButtonBox") self.ButtonBox.setObjectName("ButtonBox")
self.verticalLayout.addWidget(self.ButtonBox) self.verticalLayout_3.addWidget(self.ButtonBox)
self.retranslateUi(EditVerseDialog) self.retranslateUi(EditVerseDialog)
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("accepted()"), EditVerseDialog.accept) QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("accepted()"), EditVerseDialog.accept)
@ -91,20 +94,20 @@ class Ui_EditVerseDialog(object):
def retranslateUi(self, EditVerseDialog): def retranslateUi(self, EditVerseDialog):
EditVerseDialog.setWindowTitle(QtGui.QApplication.translate("EditVerseDialog", "Edit Verse", None, QtGui.QApplication.UnicodeUTF8)) EditVerseDialog.setWindowTitle(QtGui.QApplication.translate("EditVerseDialog", "Edit Verse", None, QtGui.QApplication.UnicodeUTF8))
self.VerseTypeLabel.setText(QtGui.QApplication.translate("EditVerseDialog", "Verse Type", None, QtGui.QApplication.UnicodeUTF8))
self.VerseListComboBox.setItemText(0, QtGui.QApplication.translate("EditVerseDialog", "Intro", None, QtGui.QApplication.UnicodeUTF8))
self.VerseListComboBox.setItemText(1, QtGui.QApplication.translate("EditVerseDialog", "Verse", None, QtGui.QApplication.UnicodeUTF8)) self.VerseListComboBox.setItemText(1, QtGui.QApplication.translate("EditVerseDialog", "Verse", None, QtGui.QApplication.UnicodeUTF8))
self.VerseListComboBox.setItemText(2, QtGui.QApplication.translate("EditVerseDialog", "Chorus", None, QtGui.QApplication.UnicodeUTF8)) self.VerseListComboBox.setItemText(2, QtGui.QApplication.translate("EditVerseDialog", "Pre-Chorus", None, QtGui.QApplication.UnicodeUTF8))
self.VerseListComboBox.setItemText(3, QtGui.QApplication.translate("EditVerseDialog", "Bridge", None, QtGui.QApplication.UnicodeUTF8)) self.VerseListComboBox.setItemText(3, QtGui.QApplication.translate("EditVerseDialog", "Chorus", None, QtGui.QApplication.UnicodeUTF8))
self.SubVerseListComboBox.setItemText(1, QtGui.QApplication.translate("EditVerseDialog", "1", None, QtGui.QApplication.UnicodeUTF8)) self.VerseListComboBox.setItemText(4, QtGui.QApplication.translate("EditVerseDialog", "Bridge", None, QtGui.QApplication.UnicodeUTF8))
self.SubVerseListComboBox.setItemText(2, QtGui.QApplication.translate("EditVerseDialog", "1a", None, QtGui.QApplication.UnicodeUTF8)) self.VerseListComboBox.setItemText(5, QtGui.QApplication.translate("EditVerseDialog", "Ending", None, QtGui.QApplication.UnicodeUTF8))
self.SubVerseListComboBox.setItemText(3, QtGui.QApplication.translate("EditVerseDialog", "1b", None, QtGui.QApplication.UnicodeUTF8)) self.VerseListComboBox.setItemText(6, QtGui.QApplication.translate("EditVerseDialog", "Other", None, QtGui.QApplication.UnicodeUTF8))
self.SubVerseListComboBox.setItemText(4, QtGui.QApplication.translate("EditVerseDialog", "2", None, QtGui.QApplication.UnicodeUTF8)) self.VerseNumberLabel.setText(QtGui.QApplication.translate("EditVerseDialog", "Number", None, QtGui.QApplication.UnicodeUTF8))
self.SubVerseListComboBox.setItemText(5, QtGui.QApplication.translate("EditVerseDialog", "2a", None, QtGui.QApplication.UnicodeUTF8)) self.addBridge.setText(QtGui.QApplication.translate("EditVerseDialog", "Bridge", None, QtGui.QApplication.UnicodeUTF8))
self.SubVerseListComboBox.setItemText(6, QtGui.QApplication.translate("EditVerseDialog", "2b", None, QtGui.QApplication.UnicodeUTF8))
self.SubVerseListComboBox.setItemText(7, QtGui.QApplication.translate("EditVerseDialog", "3", None, QtGui.QApplication.UnicodeUTF8))
self.SubVerseListComboBox.setItemText(8, QtGui.QApplication.translate("EditVerseDialog", "4", None, QtGui.QApplication.UnicodeUTF8))
self.SubVerseListComboBox.setItemText(9, QtGui.QApplication.translate("EditVerseDialog", "5", None, QtGui.QApplication.UnicodeUTF8))
self.SubVerseListComboBox.setItemText(10, QtGui.QApplication.translate("EditVerseDialog", "6", None, QtGui.QApplication.UnicodeUTF8))
self.SubVerseListComboBox.setItemText(11, QtGui.QApplication.translate("EditVerseDialog", "7", None, QtGui.QApplication.UnicodeUTF8))
self.addVerse.setText(QtGui.QApplication.translate("EditVerseDialog", "Verse", None, QtGui.QApplication.UnicodeUTF8)) self.addVerse.setText(QtGui.QApplication.translate("EditVerseDialog", "Verse", None, QtGui.QApplication.UnicodeUTF8))
self.addChorus.setText(QtGui.QApplication.translate("EditVerseDialog", "Chorus", None, QtGui.QApplication.UnicodeUTF8)) self.addChorus.setText(QtGui.QApplication.translate("EditVerseDialog", "Chorus", None, QtGui.QApplication.UnicodeUTF8))
self.addBridge.setText(QtGui.QApplication.translate("EditVerseDialog", "Bridge", None, QtGui.QApplication.UnicodeUTF8)) self.addPreChorus.setText(QtGui.QApplication.translate("EditVerseDialog", "Pre-Chorus", None, QtGui.QApplication.UnicodeUTF8))
self.addIntro.setText(QtGui.QApplication.translate("EditVerseDialog", "Intro", None, QtGui.QApplication.UnicodeUTF8))
self.addOther.setText(QtGui.QApplication.translate("EditVerseDialog", "Other", None, QtGui.QApplication.UnicodeUTF8))
self.addEnding.setText(QtGui.QApplication.translate("EditVerseDialog", "Ending", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -42,17 +42,39 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
QtCore.SIGNAL(u'clicked()'), self.onAddChorus) QtCore.SIGNAL(u'clicked()'), self.onAddChorus)
QtCore.QObject.connect(self.addBridge, QtCore.QObject.connect(self.addBridge,
QtCore.SIGNAL(u'clicked()'), self.onAddBridge) QtCore.SIGNAL(u'clicked()'), self.onAddBridge)
QtCore.QObject.connect(self.addIntro,
QtCore.SIGNAL(u'clicked()'), self.onAddIntro)
QtCore.QObject.connect(self.addOther,
QtCore.SIGNAL(u'clicked()'), self.onAddOther)
QtCore.QObject.connect(self.addPreChorus,
QtCore.SIGNAL(u'clicked()'), self.onAddPreChorus)
QtCore.QObject.connect(self.addEnding,
QtCore.SIGNAL(u'clicked()'), self.onAddEnding)
QtCore.QObject.connect(self.VerseListComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onVerseComboChanged)
def onAddIntro(self):
self.VerseTextEdit.insertPlainText(u'---[Intro:1]---')
def onAddEnding(self):
self.VerseTextEdit.insertPlainText(u'---[Ending:1]---')
def onAddOther(self):
self.VerseTextEdit.insertPlainText(u'---[Other:1]---')
def onAddPreChorus(self):
self.VerseTextEdit.insertPlainText(u'---[PreChorus:1]---')
def onAddBridge(self): def onAddBridge(self):
self.VerseTextEdit.insertPlainText(u'---[Bridge:1]---\n') self.VerseTextEdit.insertPlainText(u'---[Bridge:1]---')
def onAddChorus(self): def onAddChorus(self):
self.VerseTextEdit.insertPlainText(u'---[Chorus:1]---\n') self.VerseTextEdit.insertPlainText(u'---[Chorus:1]---')
def onAddVerse(self): def onAddVerse(self):
self.VerseTextEdit.insertPlainText(u'---[Verse:1]---\n') self.VerseTextEdit.insertPlainText(u'---[Verse:1]---')
def setVerse(self, text, single=False, tag=0): def setVerse(self, text, verseCount=0, single=False, tag=u'Verse:1'):
posVerse = 0 posVerse = 0
posSub = 0 posSub = 0
if single: if single:
@ -65,19 +87,31 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
posSub = 0 posSub = 0
self.VerseListComboBox.setEnabled(True) self.VerseListComboBox.setEnabled(True)
self.SubVerseListComboBox.setEnabled(True) self.SubVerseListComboBox.setEnabled(True)
self.SubVerseListComboBox.clear()
for i in range(1, verseCount + 1):
self.SubVerseListComboBox.addItem(u'%s'% i)
self.addBridge.setEnabled(False) self.addBridge.setEnabled(False)
self.addChorus.setEnabled(False) self.addChorus.setEnabled(False)
self.addVerse.setEnabled(False) self.addVerse.setEnabled(False)
self.addIntro.setEnabled(False)
self.addPreChorus.setEnabled(False)
self.addOther.setEnabled(False)
self.addEnding.setEnabled(False)
else: else:
self.VerseListComboBox.setEnabled(False) self.VerseListComboBox.setEnabled(False)
self.SubVerseListComboBox.setEnabled(False) self.SubVerseListComboBox.setEnabled(False)
self.addBridge.setEnabled(True) self.addBridge.setEnabled(True)
self.addChorus.setEnabled(True) self.addChorus.setEnabled(True)
self.addVerse.setEnabled(True) self.addVerse.setEnabled(True)
self.addIntro.setEnabled(True)
self.addPreChorus.setEnabled(True)
self.addOther.setEnabled(True)
self.addEnding.setEnabled(True)
self.VerseListComboBox.setCurrentIndex(posVerse) self.VerseListComboBox.setCurrentIndex(posVerse)
self.SubVerseListComboBox.setCurrentIndex(posSub) self.SubVerseListComboBox.setCurrentIndex(posSub)
self.VerseTextEdit.setPlainText(text) self.VerseTextEdit.setPlainText(text)
self.VerseTextEdit.setFocus(QtCore.Qt.OtherFocusReason) self.VerseTextEdit.setFocus(QtCore.Qt.OtherFocusReason)
self.onVerseComboChanged(0)
def getVerse(self): def getVerse(self):
return self.VerseTextEdit.toPlainText(), \ return self.VerseTextEdit.toPlainText(), \
@ -86,3 +120,10 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
def getVerseAll(self): def getVerseAll(self):
return self.VerseTextEdit.toPlainText() return self.VerseTextEdit.toPlainText()
def onVerseComboChanged(self, id):
if unicode(self.VerseListComboBox.currentText()) == u'Verse':
self.SubVerseListComboBox.setEnabled(True)
else:
self.SubVerseListComboBox.setEnabled(False)
self.SubVerseListComboBox.setCurrentIndex(0)

View File

@ -6,33 +6,48 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>492</width> <width>500</width>
<height>494</height> <height>521</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Edit Verse</string>
</property> </property>
<property name="modal"> <property name="modal">
<bool>true</bool> <bool>true</bool>
</property> </property>
<widget class="QWidget" name=""> <widget class="QWidget" name="layoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>9</x> <x>11</x>
<y>12</y> <y>1</y>
<width>471</width> <width>471</width>
<height>471</height> <height>491</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="VerseTypeLabel">
<property name="text">
<string>Verse Type</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item> <item>
<widget class="QComboBox" name="VerseListComboBox"> <widget class="QComboBox" name="VerseListComboBox">
<item> <item>
<property name="text"> <property name="text">
<string/> <string>Intro</string>
</property> </property>
</item> </item>
<item> <item>
@ -40,6 +55,11 @@
<string>Verse</string> <string>Verse</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Pre-Chorus</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>Chorus</string> <string>Chorus</string>
@ -50,74 +70,39 @@
<string>Bridge</string> <string>Bridge</string>
</property> </property>
</item> </item>
</widget>
</item>
<item>
<widget class="QComboBox" name="SubVerseListComboBox">
<item> <item>
<property name="text"> <property name="text">
<string/> <string>Ending</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>1</string> <string>Other</string>
</property>
</item>
<item>
<property name="text">
<string>1a</string>
</property>
</item>
<item>
<property name="text">
<string>1b</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>2a</string>
</property>
</item>
<item>
<property name="text">
<string>2b</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
<item>
<property name="text">
<string>6</string>
</property>
</item>
<item>
<property name="text">
<string>7</string>
</property> </property>
</item> </item>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="VerseNumberLabel">
<property name="text">
<string>Number</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="SubVerseListComboBox"/>
</item>
</layout>
</item>
</layout>
</item>
<item> <item>
<widget class="QTextEdit" name="VerseTextEdit"> <widget class="QTextEdit" name="VerseTextEdit">
<property name="acceptRichText"> <property name="acceptRichText">
@ -127,6 +112,13 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="addBridge">
<property name="text">
<string>Bridge</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="addVerse"> <widget class="QPushButton" name="addVerse">
<property name="text"> <property name="text">
@ -141,10 +133,35 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item> <item>
<widget class="QPushButton" name="addBridge"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="addPreChorus">
<property name="text"> <property name="text">
<string>Bridge</string> <string>Pre-Chorus</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addIntro">
<property name="text">
<string>Intro</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addOther">
<property name="text">
<string>Other</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addEnding">
<property name="text">
<string>Ending</string>
</property> </property>
</widget> </widget>
</item> </item>