forked from openlp/openlp
Head r819
This commit is contained in:
commit
1ee3ccd180
@ -33,8 +33,8 @@ class Ui_BibleImportWizard(object):
|
||||
BibleImportWizard.setModal(True)
|
||||
BibleImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
|
||||
BibleImportWizard.setOptions(
|
||||
QtGui.QWizard.IndependentPages | \
|
||||
QtGui.QWizard.NoBackButtonOnStartPage | \
|
||||
QtGui.QWizard.IndependentPages |
|
||||
QtGui.QWizard.NoBackButtonOnStartPage |
|
||||
QtGui.QWizard.NoBackButtonOnLastPage)
|
||||
self.WelcomePage = QtGui.QWizardPage()
|
||||
self.WelcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
|
||||
@ -310,8 +310,8 @@ class Ui_BibleImportWizard(object):
|
||||
def retranslateUi(self, BibleImportWizard):
|
||||
BibleImportWizard.setWindowTitle(translate('ImportWizardForm', 'Bible Import Wizard'))
|
||||
self.TitleLabel.setText(
|
||||
u'<span style=\" font-size:14pt; font-weight:600;\">' + \
|
||||
translate('ImportWizardForm', 'Welcome to the Bible Import Wizard') + u'</span>')
|
||||
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
||||
translate('ImportWizardForm', 'Welcome to the Bible Import Wizard'))
|
||||
self.InformationLabel.setText(
|
||||
translate('ImportWizardForm', 'This wizard will help you to import Bibles from a '
|
||||
'variety of formats. Click the next button below to start the '
|
||||
@ -352,3 +352,5 @@ class Ui_BibleImportWizard(object):
|
||||
translate('ImportWizardForm', 'Please wait while your Bible is imported.'))
|
||||
self.ImportProgressLabel.setText(translate('ImportWizardForm', 'Ready.'))
|
||||
self.ImportProgressBar.setFormat(u'%p%')
|
||||
|
||||
|
||||
|
@ -427,3 +427,5 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
self.finishButton.setVisible(True)
|
||||
self.cancelButton.setVisible(False)
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
|
||||
|
||||
|
@ -118,3 +118,5 @@ class CSVBible(BibleDB):
|
||||
return False
|
||||
else:
|
||||
return success
|
||||
|
||||
|
||||
|
@ -108,3 +108,5 @@ class OpenSongBible(BibleDB):
|
||||
return False
|
||||
else:
|
||||
return success
|
||||
|
||||
|
||||
|
@ -184,3 +184,5 @@ class OSISBible(BibleDB):
|
||||
return False
|
||||
else:
|
||||
return success
|
||||
|
||||
|
||||
|
@ -30,7 +30,9 @@ from editverseform import EditVerseForm
|
||||
from editsongform import EditSongForm
|
||||
from songmaintenanceform import SongMaintenanceForm
|
||||
|
||||
from openlpexportform import OpenLPExportForm
|
||||
from openlpimportform import OpenLPImportForm
|
||||
from opensongexportform import OpenSongExportForm
|
||||
from opensongimportform import OpenSongImportForm
|
||||
#from openlpexportform import OpenLPExportForm
|
||||
#from openlpimportform import OpenLPImportForm
|
||||
#from opensongexportform import OpenSongExportForm
|
||||
#from opensongimportform import OpenSongImportForm
|
||||
|
||||
from songimportform import ImportWizardForm
|
||||
|
@ -41,7 +41,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
"""
|
||||
log.info(u'%s EditSongForm loaded', __name__)
|
||||
|
||||
def __init__(self, songmanager, parent=None):
|
||||
def __init__(self, parent, songmanager):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
@ -106,7 +106,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
|
||||
# Create other objects and forms
|
||||
self.songmanager = songmanager
|
||||
self.verse_form = EditVerseForm()
|
||||
self.verse_form = EditVerseForm(self)
|
||||
self.initialise()
|
||||
self.AuthorsListView.setSortingEnabled(False)
|
||||
self.AuthorsListView.setAlternatingRowColors(True)
|
||||
@ -336,7 +336,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.VerseDeleteButton.setEnabled(True)
|
||||
|
||||
def onVerseAddButtonClicked(self):
|
||||
self.verse_form.setVerse(u'', self.VerseListWidget.count() + 1, True)
|
||||
self.verse_form.setVerse(u'', True)
|
||||
if self.verse_form.exec_():
|
||||
afterText, verse, subVerse = self.verse_form.getVerse()
|
||||
data = u'%s:%s' % (verse, subVerse)
|
||||
@ -350,8 +350,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
if item:
|
||||
tempText = item.text()
|
||||
verseId = unicode((item.data(QtCore.Qt.UserRole)).toString())
|
||||
self.verse_form.setVerse(
|
||||
tempText, self.VerseListWidget.count(), True, verseId)
|
||||
self.verse_form.setVerse(tempText, True, verseId)
|
||||
if self.verse_form.exec_():
|
||||
afterText, verse, subVerse = self.verse_form.getVerse()
|
||||
data = u'%s:%s' % (verse, subVerse)
|
||||
@ -556,3 +555,5 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.song.search_title = self.song.search_title.replace(u'}', u'')
|
||||
self.song.search_title = self.song.search_title.replace(u'?', u'')
|
||||
self.song.search_title = unicode(self.song.search_title)
|
||||
|
||||
|
||||
|
@ -29,102 +29,76 @@ from openlp.core.lib import translate
|
||||
class Ui_EditVerseDialog(object):
|
||||
def setupUi(self, EditVerseDialog):
|
||||
EditVerseDialog.setObjectName(u'EditVerseDialog')
|
||||
EditVerseDialog.resize(500, 521)
|
||||
EditVerseDialog.resize(474, 442)
|
||||
EditVerseDialog.setModal(True)
|
||||
self.layoutWidget = QtGui.QWidget(EditVerseDialog)
|
||||
self.layoutWidget.setGeometry(QtCore.QRect(11, 1, 471, 491))
|
||||
self.layoutWidget.setObjectName(u'layoutWidget')
|
||||
self.verticalLayout_3 = QtGui.QVBoxLayout(self.layoutWidget)
|
||||
self.verticalLayout_3.setObjectName(u'verticalLayout_3')
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(u'horizontalLayout')
|
||||
self.verticalLayout = QtGui.QVBoxLayout()
|
||||
self.verticalLayout.setObjectName(u'verticalLayout')
|
||||
self.VerseTypeLabel = QtGui.QLabel(self.layoutWidget)
|
||||
self.VerseTypeLabel.setTextFormat(QtCore.Qt.PlainText)
|
||||
self.VerseTypeLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.VerseTypeLabel.setObjectName(u'VerseTypeLabel')
|
||||
self.verticalLayout.addWidget(self.VerseTypeLabel)
|
||||
self.VerseListComboBox = QtGui.QComboBox(self.layoutWidget)
|
||||
self.VerseListComboBox.setObjectName(u'VerseListComboBox')
|
||||
self.VerseListComboBox.addItem(u'')
|
||||
self.VerseListComboBox.addItem(u'')
|
||||
self.VerseListComboBox.addItem(u'')
|
||||
self.VerseListComboBox.addItem(u'')
|
||||
self.VerseListComboBox.addItem(u'')
|
||||
self.VerseListComboBox.addItem(u'')
|
||||
self.VerseListComboBox.addItem(u'')
|
||||
self.verticalLayout.addWidget(self.VerseListComboBox)
|
||||
self.horizontalLayout.addLayout(self.verticalLayout)
|
||||
self.verticalLayout_2 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_2.setObjectName(u'verticalLayout_2')
|
||||
self.VerseNumberLabel = QtGui.QLabel(self.layoutWidget)
|
||||
self.VerseNumberLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.VerseNumberLabel.setObjectName(u'VerseNumberLabel')
|
||||
self.verticalLayout_2.addWidget(self.VerseNumberLabel)
|
||||
self.SubVerseListComboBox = QtGui.QComboBox(self.layoutWidget)
|
||||
self.SubVerseListComboBox.setObjectName(u'SubVerseListComboBox')
|
||||
self.verticalLayout_2.addWidget(self.SubVerseListComboBox)
|
||||
self.horizontalLayout.addLayout(self.verticalLayout_2)
|
||||
self.verticalLayout_3.addLayout(self.horizontalLayout)
|
||||
self.VerseTextEdit = QtGui.QTextEdit(self.layoutWidget)
|
||||
self.VerseTextEdit.setAcceptRichText(False)
|
||||
self.EditVerseLayout = QtGui.QVBoxLayout(EditVerseDialog)
|
||||
self.EditVerseLayout.setSpacing(8)
|
||||
self.EditVerseLayout.setMargin(8)
|
||||
self.EditVerseLayout.setObjectName(u'EditVerseLayout')
|
||||
self.VerseTextEdit = QtGui.QPlainTextEdit(EditVerseDialog)
|
||||
self.VerseTextEdit.setObjectName(u'VerseTextEdit')
|
||||
self.verticalLayout_3.addWidget(self.VerseTextEdit)
|
||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName(u'horizontalLayout_2')
|
||||
self.addBridge = QtGui.QPushButton(self.layoutWidget)
|
||||
self.addBridge.setObjectName(u'addBridge')
|
||||
self.horizontalLayout_2.addWidget(self.addBridge)
|
||||
self.addVerse = QtGui.QPushButton(self.layoutWidget)
|
||||
self.addVerse.setObjectName(u'addVerse')
|
||||
self.horizontalLayout_2.addWidget(self.addVerse)
|
||||
self.addChorus = QtGui.QPushButton(self.layoutWidget)
|
||||
self.addChorus.setObjectName(u'addChorus')
|
||||
self.horizontalLayout_2.addWidget(self.addChorus)
|
||||
self.verticalLayout_3.addLayout(self.horizontalLayout_2)
|
||||
self.horizontalLayout_3 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_3.setObjectName(u'horizontalLayout_3')
|
||||
self.addPreChorus = QtGui.QPushButton(self.layoutWidget)
|
||||
self.addPreChorus.setObjectName(u'addPreChorus')
|
||||
self.horizontalLayout_3.addWidget(self.addPreChorus)
|
||||
self.addIntro = QtGui.QPushButton(self.layoutWidget)
|
||||
self.addIntro.setObjectName(u'addIntro')
|
||||
self.horizontalLayout_3.addWidget(self.addIntro)
|
||||
self.addOther = QtGui.QPushButton(self.layoutWidget)
|
||||
self.addOther.setObjectName(u'addOther')
|
||||
self.horizontalLayout_3.addWidget(self.addOther)
|
||||
self.addEnding = QtGui.QPushButton(self.layoutWidget)
|
||||
self.addEnding.setObjectName(u'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.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
|
||||
self.ButtonBox.setObjectName(u'ButtonBox')
|
||||
self.verticalLayout_3.addWidget(self.ButtonBox)
|
||||
self.EditVerseLayout.addWidget(self.VerseTextEdit)
|
||||
self.VerseTypeLayout = QtGui.QHBoxLayout()
|
||||
self.VerseTypeLayout.setSpacing(8)
|
||||
self.VerseTypeLayout.setObjectName(u'VerseTypeLayout')
|
||||
self.VerseTypeLabel = QtGui.QLabel(EditVerseDialog)
|
||||
self.VerseTypeLabel.setObjectName(u'VerseTypeLabel')
|
||||
self.VerseTypeLayout.addWidget(self.VerseTypeLabel)
|
||||
self.VerseTypeComboBox = QtGui.QComboBox(EditVerseDialog)
|
||||
self.VerseTypeComboBox.setObjectName(u'VerseTypeComboBox')
|
||||
self.VerseTypeComboBox.addItem(u'')
|
||||
self.VerseTypeComboBox.addItem(u'')
|
||||
self.VerseTypeComboBox.addItem(u'')
|
||||
self.VerseTypeComboBox.addItem(u'')
|
||||
self.VerseTypeComboBox.addItem(u'')
|
||||
self.VerseTypeComboBox.addItem(u'')
|
||||
self.VerseTypeComboBox.addItem(u'')
|
||||
self.VerseTypeLayout.addWidget(self.VerseTypeComboBox)
|
||||
self.VerseNumberBox = QtGui.QSpinBox(EditVerseDialog)
|
||||
self.VerseNumberBox.setMinimum(1)
|
||||
self.VerseNumberBox.setObjectName(u'VerseNumberBox')
|
||||
self.VerseTypeLayout.addWidget(self.VerseNumberBox)
|
||||
self.InsertButton = QtGui.QPushButton(EditVerseDialog)
|
||||
self.AddIcon = QtGui.QIcon()
|
||||
self.AddIcon.addPixmap(QtGui.QPixmap(u':/general/general_add.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.InsertButton.setIcon(self.AddIcon)
|
||||
self.InsertButton.setObjectName(u'InsertButton')
|
||||
self.VerseTypeLayout.addWidget(self.InsertButton)
|
||||
self.VerseTypeSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.VerseTypeLayout.addItem(self.VerseTypeSpacer)
|
||||
self.EditVerseLayout.addLayout(self.VerseTypeLayout)
|
||||
self.EditButtonBox = QtGui.QDialogButtonBox(EditVerseDialog)
|
||||
self.EditButtonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.EditButtonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save)
|
||||
self.EditButtonBox.setObjectName(u'EditButtonBox')
|
||||
self.EditVerseLayout.addWidget(self.EditButtonBox)
|
||||
|
||||
self.retranslateUi(EditVerseDialog)
|
||||
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'accepted()'), EditVerseDialog.accept)
|
||||
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'rejected()'), EditVerseDialog.reject)
|
||||
QtCore.QObject.connect(
|
||||
self.EditButtonBox,
|
||||
QtCore.SIGNAL(u'accepted()'),
|
||||
EditVerseDialog.accept
|
||||
)
|
||||
QtCore.QObject.connect(
|
||||
self.EditButtonBox,
|
||||
QtCore.SIGNAL(u'rejected()'),
|
||||
EditVerseDialog.reject
|
||||
)
|
||||
QtCore.QMetaObject.connectSlotsByName(EditVerseDialog)
|
||||
|
||||
def retranslateUi(self, EditVerseDialog):
|
||||
EditVerseDialog.setWindowTitle(translate('EditVerseForm', 'Edit Verse'))
|
||||
self.VerseTypeLabel.setText(translate('EditVerseForm', 'Verse Type'))
|
||||
self.VerseListComboBox.setItemText(0, translate('EditVerseForm', 'Intro'))
|
||||
self.VerseListComboBox.setItemText(1, translate('EditVerseForm', 'Verse'))
|
||||
self.VerseListComboBox.setItemText(2, translate('EditVerseForm', 'Pre-Chorus'))
|
||||
self.VerseListComboBox.setItemText(3, translate('EditVerseForm', 'Chorus'))
|
||||
self.VerseListComboBox.setItemText(4, translate('EditVerseForm', 'Bridge'))
|
||||
self.VerseListComboBox.setItemText(5, translate('EditVerseForm', 'Ending'))
|
||||
self.VerseListComboBox.setItemText(6, translate('EditVerseForm', 'Other'))
|
||||
self.VerseNumberLabel.setText(translate('EditVerseForm', 'Number'))
|
||||
self.addBridge.setText(translate('EditVerseForm', 'Bridge'))
|
||||
self.addVerse.setText(translate('EditVerseForm', 'Verse'))
|
||||
self.addChorus.setText(translate('EditVerseForm', 'Chorus'))
|
||||
self.addPreChorus.setText(translate('EditVerseForm', 'Pre-Chorus'))
|
||||
self.addIntro.setText(translate('EditVerseForm', 'Intro'))
|
||||
self.addOther.setText(translate('EditVerseForm', 'Other'))
|
||||
self.addEnding.setText(translate('EditVerseForm', 'Ending'))
|
||||
self.VerseTypeLabel.setText(translate('EditVerseForm', 'Verse Type:'))
|
||||
self.VerseTypeComboBox.setItemText(0, translate('EditVerseForm', 'Verse'))
|
||||
self.VerseTypeComboBox.setItemText(1, translate('EditVerseForm', 'Chorus'))
|
||||
self.VerseTypeComboBox.setItemText(2, translate('EditVerseForm', 'Bridge'))
|
||||
self.VerseTypeComboBox.setItemText(3, translate('EditVerseForm', 'Pre-Chorus'))
|
||||
self.VerseTypeComboBox.setItemText(4, translate('EditVerseForm', 'Intro'))
|
||||
self.VerseTypeComboBox.setItemText(5, translate('EditVerseForm', 'Ending'))
|
||||
self.VerseTypeComboBox.setItemText(6, translate('EditVerseForm', 'Other'))
|
||||
self.InsertButton.setText(translate('EditVerseForm', 'Insert'))
|
||||
|
||||
|
||||
|
@ -23,9 +23,60 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
import re
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from editversedialog import Ui_EditVerseDialog
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class VerseType(object):
|
||||
Verse = 0
|
||||
Chorus = 1
|
||||
Bridge = 2
|
||||
PreChorus = 3
|
||||
Intro = 4
|
||||
Ending = 5
|
||||
Other = 6
|
||||
|
||||
@staticmethod
|
||||
def to_string(verse_type):
|
||||
if verse_type == VerseType.Verse:
|
||||
return u'Verse'
|
||||
elif verse_type == VerseType.Chorus:
|
||||
return u'Chorus'
|
||||
elif verse_type == VerseType.Bridge:
|
||||
return u'Bridge'
|
||||
elif verse_type == VerseType.PreChorus:
|
||||
return u'Pre-Chorus'
|
||||
elif verse_type == VerseType.Intro:
|
||||
return u'Intro'
|
||||
elif verse_type == VerseType.Ending:
|
||||
return u'Ending'
|
||||
elif verse_type == VerseType.Other:
|
||||
return u'Other'
|
||||
|
||||
@staticmethod
|
||||
def from_string(verse_type):
|
||||
verse_type = verse_type.lower()
|
||||
if verse_type == u'verse':
|
||||
return VerseType.Verse
|
||||
elif verse_type == u'chorus':
|
||||
return VerseType.Chorus
|
||||
elif verse_type == u'bridge':
|
||||
return VerseType.Bridge
|
||||
elif verse_type == u'pre-chorus':
|
||||
return VerseType.PreChorus
|
||||
elif verse_type == u'intro':
|
||||
return VerseType.Intro
|
||||
elif verse_type == u'ending':
|
||||
return VerseType.Ending
|
||||
elif verse_type == u'other':
|
||||
return VerseType.Other
|
||||
|
||||
|
||||
class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
||||
"""
|
||||
This is the form that is used to edit the verses of the song.
|
||||
@ -36,114 +87,87 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
QtCore.QObject.connect(self.addVerse,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onAddVerse)
|
||||
QtCore.QObject.connect(self.addChorus,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onAddChorus)
|
||||
QtCore.QObject.connect(self.addBridge,
|
||||
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)
|
||||
QtCore.QObject.connect(
|
||||
self.InsertButton,
|
||||
QtCore.SIGNAL(u'clicked()'),
|
||||
self.onInsertButtonClicked
|
||||
)
|
||||
QtCore.QObject.connect(
|
||||
self.VerseTextEdit,
|
||||
QtCore.SIGNAL(u'cursorPositionChanged()'),
|
||||
self.onCursorPositionChanged
|
||||
)
|
||||
# QtCore.QObject.connect(self.VerseListComboBox,
|
||||
# QtCore.SIGNAL(u'activated(int)'), self.onVerseComboChanged)
|
||||
self.verse_regex = re.compile(r'---\[([-\w]+):([\d]+)\]---')
|
||||
|
||||
def startNewLine(self):
|
||||
def insertVerse(self, title, num=1):
|
||||
if self.VerseTextEdit.textCursor().columnNumber() != 0:
|
||||
self.VerseTextEdit.insertPlainText(u'\n')
|
||||
|
||||
def onAddIntro(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[Intro:1]---\n')
|
||||
self.VerseTextEdit.insertPlainText(u'---[%s:%s]---\n' % (title, num))
|
||||
self.VerseTextEdit.setFocus()
|
||||
|
||||
def onAddEnding(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[Ending:1]---\n')
|
||||
self.VerseTextEdit.setFocus()
|
||||
def onInsertButtonClicked(self):
|
||||
if self.VerseTextEdit.textCursor().columnNumber() != 0:
|
||||
self.VerseTextEdit.insertPlainText(u'\n')
|
||||
verse_type = self.VerseTypeComboBox.currentIndex()
|
||||
if verse_type == VerseType.Verse:
|
||||
self.insertVerse('Verse', self.VerseNumberBox.value())
|
||||
elif verse_type == VerseType.Chorus:
|
||||
self.insertVerse('Chorus', self.VerseNumberBox.value())
|
||||
elif verse_type == VerseType.Bridge:
|
||||
self.insertVerse('Bridge')
|
||||
elif verse_type == VerseType.PreChorus:
|
||||
self.insertVerse('Pre-Chorus')
|
||||
elif verse_type == VerseType.Intro:
|
||||
self.insertVerse('Intro')
|
||||
elif verse_type == VerseType.Ending:
|
||||
self.insertVerse('Ending')
|
||||
elif verse_type == VerseType.Other:
|
||||
self.insertVerse('Other')
|
||||
|
||||
def onAddOther(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[Other:1]---\n')
|
||||
self.VerseTextEdit.setFocus()
|
||||
def onCursorPositionChanged(self):
|
||||
position = self.VerseTextEdit.textCursor().position()
|
||||
text = unicode(self.VerseTextEdit.toPlainText())
|
||||
if not text:
|
||||
return
|
||||
if text.rfind(u'[', 0, position) > text.rfind(u']', 0, position) and \
|
||||
text.find(u']', position) < text.find(u'[', position):
|
||||
return
|
||||
position = text.rfind(u'---[', 0, position)
|
||||
if position == -1:
|
||||
return
|
||||
text = text[position:]
|
||||
position = text.find(u']---')
|
||||
if position == -1:
|
||||
return
|
||||
text = text[:position + 4]
|
||||
match = self.verse_regex.match(text)
|
||||
if match:
|
||||
verse_type = match.group(1)
|
||||
verse_number = int(match.group(2))
|
||||
self.VerseTypeComboBox.setCurrentIndex(VerseType.from_string(verse_type))
|
||||
self.VerseNumberBox.setValue(verse_number)
|
||||
|
||||
def onAddPreChorus(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[Pre-Chorus:1]---\n')
|
||||
self.VerseTextEdit.setFocus()
|
||||
|
||||
def onAddBridge(self):
|
||||
self.startNewLine()
|
||||
self.VerseTextEdit.insertPlainText(u'---[Bridge:1]---\n')
|
||||
self.VerseTextEdit.setFocus()
|
||||
|
||||
def onAddChorus(self):
|
||||
self.startNewLine()
|
||||
count = self.VerseTextEdit.toPlainText().\
|
||||
count(u'---[Chorus')
|
||||
self.VerseTextEdit.insertPlainText(u'---[Chorus:%s]---\n'
|
||||
% unicode(count + 1))
|
||||
self.VerseTextEdit.setFocus()
|
||||
|
||||
def onAddVerse(self):
|
||||
self.startNewLine()
|
||||
count = self.VerseTextEdit.toPlainText().\
|
||||
count(u'---[Verse')
|
||||
self.VerseTextEdit.insertPlainText(u'---[Verse:%s]---\n'
|
||||
% unicode(count + 1))
|
||||
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'---[%s:1]---\n' % self.trUtf8('Verse')
|
||||
def setVerse(self, text, single=False, tag=u'Verse:1'):
|
||||
if single:
|
||||
id = tag.split(u':')
|
||||
posVerse = self.VerseListComboBox.findText(id[0], QtCore.Qt.MatchExactly)
|
||||
posSub = self.SubVerseListComboBox.findText(id[1], QtCore.Qt.MatchExactly)
|
||||
if posVerse == -1:
|
||||
posVerse = 0
|
||||
if posSub == -1:
|
||||
posSub = 0
|
||||
self.VerseListComboBox.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.addChorus.setEnabled(False)
|
||||
self.addVerse.setEnabled(False)
|
||||
self.addIntro.setEnabled(False)
|
||||
self.addPreChorus.setEnabled(False)
|
||||
self.addOther.setEnabled(False)
|
||||
self.addEnding.setEnabled(False)
|
||||
verse_type, verse_number = tag.split(u':')
|
||||
self.VerseTypeComboBox.setCurrentIndex(VerseType.from_string(verse_type))
|
||||
self.VerseNumberBox.setValue(int(verse_number))
|
||||
self.InsertButton.setVisible(False)
|
||||
else:
|
||||
self.VerseListComboBox.setEnabled(False)
|
||||
self.SubVerseListComboBox.setEnabled(False)
|
||||
self.addBridge.setEnabled(True)
|
||||
self.addChorus.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.SubVerseListComboBox.setCurrentIndex(posSub)
|
||||
if not text:
|
||||
text = u'---[Verse:1]---\n'
|
||||
self.VerseTypeComboBox.setCurrentIndex(0)
|
||||
self.VerseNumberBox.setValue(1)
|
||||
self.InsertButton.setVisible(True)
|
||||
self.VerseTextEdit.setPlainText(text)
|
||||
self.VerseTextEdit.setFocus(QtCore.Qt.OtherFocusReason)
|
||||
self.onVerseComboChanged(0)
|
||||
self.VerseTextEdit.moveCursor(QtGui.QTextCursor.Down)
|
||||
|
||||
def getVerse(self):
|
||||
return self.VerseTextEdit.toPlainText(), \
|
||||
unicode(self.VerseListComboBox.currentText()), \
|
||||
unicode(self.SubVerseListComboBox.currentText())
|
||||
return self.VerseTextEdit.toPlainText(), \
|
||||
VerseType.to_string(self.VerseTypeComboBox.currentIndex()), \
|
||||
unicode(self.VerseNumberBox.value())
|
||||
|
||||
def getVerseAll(self):
|
||||
text = self.VerseTextEdit.toPlainText()
|
||||
@ -151,10 +175,4 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
||||
text = u'---[Verse:1]---\n%s' % text
|
||||
return text
|
||||
|
||||
def onVerseComboChanged(self, id):
|
||||
if unicode(self.VerseListComboBox.currentText()) == self.trUtf8('Verse') or \
|
||||
unicode(self.VerseListComboBox.currentText()) == self.trUtf8('Chrous'):
|
||||
self.SubVerseListComboBox.setEnabled(True)
|
||||
else:
|
||||
self.SubVerseListComboBox.setEnabled(False)
|
||||
self.SubVerseListComboBox.setCurrentIndex(0)
|
||||
|
||||
|
251
openlp/plugins/songs/forms/songimportform.py
Normal file
251
openlp/plugins/songs/forms/songimportform.py
Normal file
@ -0,0 +1,251 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
||||
# Thompson, Jon Tibble, 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 #
|
||||
###############################################################################
|
||||
|
||||
import csv
|
||||
import logging
|
||||
import os
|
||||
import os.path
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from songimportwizard import Ui_SongImportWizard
|
||||
from openlp.core.lib import Receiver, SettingsManager
|
||||
#from openlp.core.utils import AppLocation, variant_to_unicode
|
||||
from openlp.plugins.songs.lib.manager import SongFormat
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||
"""
|
||||
This is the Bible Import Wizard, which allows easy importing of Bibles
|
||||
into OpenLP from other formats like OSIS, CSV and OpenSong.
|
||||
"""
|
||||
log.info(u'BibleImportForm loaded')
|
||||
|
||||
def __init__(self, parent, manager, songsplugin):
|
||||
"""
|
||||
Instantiate the wizard, and run any extra setup we need to.
|
||||
|
||||
``parent``
|
||||
The QWidget-derived parent of the wizard.
|
||||
|
||||
``config``
|
||||
The configuration object for storing and retrieving settings.
|
||||
|
||||
``manager``
|
||||
The Bible manager.
|
||||
|
||||
``bibleplugin``
|
||||
The Bible plugin.
|
||||
"""
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.registerFields()
|
||||
self.finishButton = self.button(QtGui.QWizard.FinishButton)
|
||||
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
|
||||
self.manager = manager
|
||||
self.songsplugin = songsplugin
|
||||
#self.manager.set_process_dialog(self)
|
||||
# QtCore.QObject.connect(self.OsisFileButton,
|
||||
# QtCore.SIGNAL(u'clicked()'),
|
||||
# self.onOsisFileButtonClicked)
|
||||
# QtCore.QObject.connect(self.BooksFileButton,
|
||||
# QtCore.SIGNAL(u'clicked()'),
|
||||
# self.onBooksFileButtonClicked)
|
||||
# QtCore.QObject.connect(self.CsvVersesFileButton,
|
||||
# QtCore.SIGNAL(u'clicked()'),
|
||||
# self.onCsvVersesFileButtonClicked)
|
||||
# QtCore.QObject.connect(self.OpenSongBrowseButton,
|
||||
# QtCore.SIGNAL(u'clicked()'),
|
||||
# self.onOpenSongBrowseButtonClicked)
|
||||
QtCore.QObject.connect(self.cancelButton,
|
||||
QtCore.SIGNAL(u'clicked(bool)'),
|
||||
self.onCancelButtonClicked)
|
||||
QtCore.QObject.connect(self,
|
||||
QtCore.SIGNAL(u'currentIdChanged(int)'),
|
||||
self.onCurrentIdChanged)
|
||||
|
||||
def exec_(self):
|
||||
"""
|
||||
Run the wizard.
|
||||
"""
|
||||
self.setDefaults()
|
||||
return QtGui.QWizard.exec_(self)
|
||||
|
||||
def validateCurrentPage(self):
|
||||
"""
|
||||
Validate the current page before moving on to the next page.
|
||||
"""
|
||||
if self.currentId() == 0:
|
||||
# Welcome page
|
||||
return True
|
||||
elif self.currentId() == 1:
|
||||
# Select page
|
||||
source_format = self.field(u'source_format').toInt()[0]
|
||||
if source_format == SongFormat.OpenLyrics:
|
||||
if self.OpenLyricsFileListWidget.count() == 0:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
self.trUtf8('No OpenLyrics Files Selected'),
|
||||
self.trUtf8('You need to add at least one OpenLyrics '
|
||||
'song file to import from.'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
self.OpenLyricsAddButton.setFocus()
|
||||
return False
|
||||
elif source_format == SongFormat.OpenSong:
|
||||
if self.OpenSongFileListWidget.count() == 0:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
self.trUtf8('No OpenSong Files Selected'),
|
||||
self.trUtf8('You need to add at least one OpenSong '
|
||||
'song file to import from.'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
self.OpenSongAddButton.setFocus()
|
||||
return False
|
||||
elif source_format == SongFormat.CCLI:
|
||||
if self.CCLIFileListWidget.count() == 0:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
self.trUtf8('No CCLI Files Selected'),
|
||||
self.trUtf8('You need to add at least one CCLI file '
|
||||
'to import from.'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
self.CCLIAddButton.setFocus()
|
||||
return False
|
||||
elif source_format == SongFormat.CSV:
|
||||
if self.CSVFilenameEdit.text().isEmpty():
|
||||
QtGui.QMessageBox.critical(self,
|
||||
self.trUtf8('No CSV File Selected'),
|
||||
self.trUtf8('You need to specify a CSV file to import '
|
||||
'from.'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
self.CSVFilenameEdit.setFocus()
|
||||
return False
|
||||
return True
|
||||
elif self.currentId() == 2:
|
||||
# Progress page
|
||||
return True
|
||||
|
||||
def onCancelButtonClicked(self, checked):
|
||||
"""
|
||||
Stop the import on pressing the cancel button.
|
||||
"""
|
||||
log.debug('Cancel button pressed!')
|
||||
if self.currentId() == 3:
|
||||
Receiver.send_message(u'openlp_stop_song_import')
|
||||
|
||||
def onCurrentIdChanged(self, id):
|
||||
if id == 3:
|
||||
self.preImport()
|
||||
self.performImport()
|
||||
self.postImport()
|
||||
|
||||
def registerFields(self):
|
||||
self.SourcePage.registerField(u'source_format', self.FormatComboBox)
|
||||
|
||||
def setDefaults(self):
|
||||
self.setField(u'source_format', QtCore.QVariant(0))
|
||||
self.OpenLyricsFileListWidget.clear()
|
||||
self.OpenSongFileListWidget.clear()
|
||||
self.CCLIFileListWidget.clear()
|
||||
self.CSVFilenameEdit.setText(u'')
|
||||
|
||||
def getFileName(self, title, editbox):
|
||||
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
||||
SettingsManager.get_last_dir(self.songsplugin.settingsSection, 1))
|
||||
if filename:
|
||||
editbox.setText(filename)
|
||||
self.config.set_last_dir(filename, 1)
|
||||
|
||||
def incrementProgressBar(self, status_text):
|
||||
log.debug(u'IncrementBar %s', status_text)
|
||||
self.ImportProgressLabel.setText(status_text)
|
||||
self.ImportProgressBar.setValue(self.ImportProgressBar.value() + 1)
|
||||
Receiver.send_message(u'process_events')
|
||||
|
||||
def preImport(self):
|
||||
self.finishButton.setVisible(False)
|
||||
self.ImportProgressBar.setMinimum(0)
|
||||
self.ImportProgressBar.setMaximum(1188)
|
||||
self.ImportProgressBar.setValue(0)
|
||||
self.ImportProgressLabel.setText(self.trUtf8('Starting import...'))
|
||||
Receiver.send_message(u'process_events')
|
||||
|
||||
def performImport(self):
|
||||
pass
|
||||
# source_format = self.field(u'source_format').toInt()[0]
|
||||
# importer = None
|
||||
# if bible_type == BibleFormat.OSIS:
|
||||
# # Import an OSIS bible
|
||||
# importer = self.manager.import_bible(BibleFormat.OSIS,
|
||||
# name=license_version,
|
||||
# filename=variant_to_unicode(self.field(u'osis_location'))
|
||||
# )
|
||||
# elif bible_type == BibleFormat.CSV:
|
||||
# # Import a CSV bible
|
||||
# importer = self.manager.import_bible(BibleFormat.CSV,
|
||||
# name=license_version,
|
||||
# booksfile=variant_to_unicode(self.field(u'csv_booksfile')),
|
||||
# versefile=variant_to_unicode(self.field(u'csv_versefile'))
|
||||
# )
|
||||
# elif bible_type == BibleFormat.OpenSong:
|
||||
# # Import an OpenSong bible
|
||||
# importer = self.manager.import_bible(BibleFormat.OpenSong,
|
||||
# name=license_version,
|
||||
# filename=variant_to_unicode(self.field(u'opensong_file'))
|
||||
# )
|
||||
# elif bible_type == BibleFormat.WebDownload:
|
||||
# # Import a bible from the web
|
||||
# self.ImportProgressBar.setMaximum(1)
|
||||
# download_location = self.field(u'web_location').toInt()[0]
|
||||
# bible_version = self.BibleComboBox.currentText()
|
||||
# if not isinstance(bible_version, unicode):
|
||||
# bible_version = unicode(bible_version, u'utf8')
|
||||
# if download_location == WebDownload.Crosswalk:
|
||||
# bible = self.web_bible_list[WebDownload.Crosswalk][bible_version]
|
||||
# elif download_location == WebDownload.BibleGateway:
|
||||
# bible = self.web_bible_list[WebDownload.BibleGateway][bible_version]
|
||||
# importer = self.manager.import_bible(
|
||||
# BibleFormat.WebDownload,
|
||||
# name=license_version,
|
||||
# download_source=WebDownload.get_name(download_location),
|
||||
# download_name=bible,
|
||||
# proxy_server=variant_to_unicode(self.field(u'proxy_server')),
|
||||
# proxy_username=variant_to_unicode(self.field(u'proxy_username')),
|
||||
# proxy_password=variant_to_unicode(self.field(u'proxy_password'))
|
||||
# )
|
||||
# success = importer.do_import()
|
||||
# if success:
|
||||
# self.manager.save_meta_data(license_version, license_version,
|
||||
# license_copyright, license_permission)
|
||||
# self.manager.reload_bibles()
|
||||
# self.ImportProgressLabel.setText(self.trUtf8('Finished import.'))
|
||||
# else:
|
||||
# self.ImportProgressLabel.setText(
|
||||
# self.trUtf8('Your Bible import failed.'))
|
||||
# importer.delete()
|
||||
|
||||
def postImport(self):
|
||||
self.ImportProgressBar.setValue(self.ImportProgressBar.maximum())
|
||||
self.finishButton.setVisible(True)
|
||||
self.cancelButton.setVisible(False)
|
||||
Receiver.send_message(u'process_events')
|
255
openlp/plugins/songs/forms/songimportwizard.py
Normal file
255
openlp/plugins/songs/forms/songimportwizard.py
Normal file
@ -0,0 +1,255 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
||||
# Thompson, Jon Tibble, 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
|
||||
|
||||
class Ui_SongImportWizard(object):
|
||||
def setupUi(self, SongImportWizard):
|
||||
SongImportWizard.setObjectName(u'SongImportWizard')
|
||||
SongImportWizard.resize(550, 386)
|
||||
SongImportWizard.setModal(True)
|
||||
SongImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
|
||||
SongImportWizard.setOptions(
|
||||
QtGui.QWizard.IndependentPages |
|
||||
QtGui.QWizard.NoBackButtonOnStartPage |
|
||||
QtGui.QWizard.NoBackButtonOnLastPage)
|
||||
self.WelcomePage = QtGui.QWizardPage()
|
||||
self.WelcomePage.setObjectName(u'WelcomePage')
|
||||
self.WelcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
|
||||
QtGui.QPixmap(u':/wizards/wizard_importsong.bmp'))
|
||||
self.WelcomeLayout = QtGui.QHBoxLayout(self.WelcomePage)
|
||||
self.WelcomeLayout.setSpacing(8)
|
||||
self.WelcomeLayout.setMargin(0)
|
||||
self.WelcomeLayout.setObjectName(u'WelcomeLayout')
|
||||
self.WelcomeTextLayout = QtGui.QVBoxLayout()
|
||||
self.WelcomeTextLayout.setSpacing(8)
|
||||
self.WelcomeTextLayout.setObjectName(u'WelcomeTextLayout')
|
||||
self.TitleLabel = QtGui.QLabel(self.WelcomePage)
|
||||
self.TitleLabel.setObjectName(u'TitleLabel')
|
||||
self.WelcomeTextLayout.addWidget(self.TitleLabel)
|
||||
self.WelcomeTopSpacer = QtGui.QSpacerItem(20, 40,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
self.WelcomeTextLayout.addItem(self.WelcomeTopSpacer)
|
||||
self.InformationLabel = QtGui.QLabel(self.WelcomePage)
|
||||
self.InformationLabel.setWordWrap(True)
|
||||
self.InformationLabel.setMargin(10)
|
||||
self.InformationLabel.setObjectName(u'InformationLabel')
|
||||
self.WelcomeTextLayout.addWidget(self.InformationLabel)
|
||||
self.WelcomeBottomSpacer = QtGui.QSpacerItem(20, 40,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.WelcomeTextLayout.addItem(self.WelcomeBottomSpacer)
|
||||
self.WelcomeLayout.addLayout(self.WelcomeTextLayout)
|
||||
SongImportWizard.addPage(self.WelcomePage)
|
||||
self.SourcePage = QtGui.QWizardPage()
|
||||
self.SourcePage.setObjectName(u'SourcePage')
|
||||
self.SourceLayout = QtGui.QVBoxLayout(self.SourcePage)
|
||||
self.SourceLayout.setSpacing(8)
|
||||
self.SourceLayout.setMargin(20)
|
||||
self.SourceLayout.setObjectName(u'SourceLayout')
|
||||
self.FormatLayout = QtGui.QHBoxLayout()
|
||||
self.FormatLayout.setSpacing(8)
|
||||
self.FormatLayout.setObjectName(u'FormatLayout')
|
||||
self.FormatLabel = QtGui.QLabel(self.SourcePage)
|
||||
self.FormatLabel.setObjectName(u'FormatLabel')
|
||||
self.FormatLayout.addWidget(self.FormatLabel)
|
||||
self.FormatComboBox = QtGui.QComboBox(self.SourcePage)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
|
||||
QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(
|
||||
self.FormatComboBox.sizePolicy().hasHeightForWidth())
|
||||
self.FormatComboBox.setSizePolicy(sizePolicy)
|
||||
self.FormatComboBox.setObjectName(u'FormatComboBox')
|
||||
self.FormatComboBox.addItem(u'')
|
||||
self.FormatComboBox.addItem(u'')
|
||||
self.FormatComboBox.addItem(u'')
|
||||
self.FormatComboBox.addItem(u'')
|
||||
self.FormatLayout.addWidget(self.FormatComboBox)
|
||||
self.FormatSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.FormatLayout.addItem(self.FormatSpacer)
|
||||
self.SourceLayout.addLayout(self.FormatLayout)
|
||||
self.FormatStackedWidget = QtGui.QStackedWidget(self.SourcePage)
|
||||
self.FormatStackedWidget.setObjectName(u'FormatStackedWidget')
|
||||
self.OpenLyricsPage = QtGui.QWidget()
|
||||
self.OpenLyricsPage.setObjectName(u'OpenLyricsPage')
|
||||
self.OpenLyricsLayout = QtGui.QVBoxLayout(self.OpenLyricsPage)
|
||||
self.OpenLyricsLayout.setSpacing(8)
|
||||
self.OpenLyricsLayout.setMargin(0)
|
||||
self.OpenLyricsLayout.setObjectName(u'OpenLyricsLayout')
|
||||
self.OpenLyricsFileListWidget = QtGui.QListWidget(self.OpenLyricsPage)
|
||||
self.OpenLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget')
|
||||
self.OpenLyricsLayout.addWidget(self.OpenLyricsFileListWidget)
|
||||
self.OpenLyricsButtonLayout = QtGui.QHBoxLayout()
|
||||
self.OpenLyricsButtonLayout.setSpacing(8)
|
||||
self.OpenLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout')
|
||||
self.OpenLyricsAddButton = QtGui.QPushButton(self.OpenLyricsPage)
|
||||
self.OpenIcon = QtGui.QIcon()
|
||||
self.OpenIcon.addPixmap(QtGui.QPixmap(u':/general/general_open.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.DeleteIcon = QtGui.QIcon()
|
||||
self.DeleteIcon.addPixmap(QtGui.QPixmap(u':/general/general_delete.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.OpenLyricsAddButton.setIcon(self.OpenIcon)
|
||||
self.OpenLyricsAddButton.setObjectName(u'OpenLyricsAddButton')
|
||||
self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsAddButton)
|
||||
self.OpenLyricsButtonSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.OpenLyricsButtonLayout.addItem(self.OpenLyricsButtonSpacer)
|
||||
self.OpenLyricsRemoveButton = QtGui.QPushButton(self.OpenLyricsPage)
|
||||
self.OpenLyricsRemoveButton.setIcon(self.DeleteIcon)
|
||||
self.OpenLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton')
|
||||
self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsRemoveButton)
|
||||
self.OpenLyricsLayout.addLayout(self.OpenLyricsButtonLayout)
|
||||
self.FormatStackedWidget.addWidget(self.OpenLyricsPage)
|
||||
self.OpenSongPage = QtGui.QWidget()
|
||||
self.OpenSongPage.setObjectName(u'OpenSongPage')
|
||||
self.OpenSongLayout = QtGui.QVBoxLayout(self.OpenSongPage)
|
||||
self.OpenSongLayout.setSpacing(8)
|
||||
self.OpenSongLayout.setMargin(0)
|
||||
self.OpenSongLayout.setObjectName(u'OpenSongLayout')
|
||||
self.OpenSongFileListWidget = QtGui.QListWidget(self.OpenSongPage)
|
||||
self.OpenSongFileListWidget.setObjectName(u'OpenSongFileListWidget')
|
||||
self.OpenSongLayout.addWidget(self.OpenSongFileListWidget)
|
||||
self.OpenSongButtonLayout = QtGui.QHBoxLayout()
|
||||
self.OpenSongButtonLayout.setSpacing(8)
|
||||
self.OpenSongButtonLayout.setObjectName(u'OpenSongButtonLayout')
|
||||
self.OpenSongAddButton = QtGui.QPushButton(self.OpenSongPage)
|
||||
self.OpenSongAddButton.setIcon(self.OpenIcon)
|
||||
self.OpenSongAddButton.setObjectName(u'OpenSongAddButton')
|
||||
self.OpenSongButtonLayout.addWidget(self.OpenSongAddButton)
|
||||
self.OpenSongButtonSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.OpenSongButtonLayout.addItem(self.OpenSongButtonSpacer)
|
||||
self.OpenSongRemoveButton = QtGui.QPushButton(self.OpenSongPage)
|
||||
self.OpenSongRemoveButton.setIcon(self.DeleteIcon)
|
||||
self.OpenSongRemoveButton.setObjectName(u'OpenSongRemoveButton')
|
||||
self.OpenSongButtonLayout.addWidget(self.OpenSongRemoveButton)
|
||||
self.OpenSongLayout.addLayout(self.OpenSongButtonLayout)
|
||||
self.FormatStackedWidget.addWidget(self.OpenSongPage)
|
||||
self.CCLIPage = QtGui.QWidget()
|
||||
self.CCLIPage.setObjectName(u'CCLIPage')
|
||||
self.CCLILayout = QtGui.QVBoxLayout(self.CCLIPage)
|
||||
self.CCLILayout.setSpacing(8)
|
||||
self.CCLILayout.setMargin(0)
|
||||
self.CCLILayout.setObjectName(u'CCLILayout')
|
||||
self.CCLIFileListWidget = QtGui.QListWidget(self.CCLIPage)
|
||||
self.CCLIFileListWidget.setObjectName(u'CCLIFileListWidget')
|
||||
self.CCLILayout.addWidget(self.CCLIFileListWidget)
|
||||
self.CCLIButtonLayout = QtGui.QHBoxLayout()
|
||||
self.CCLIButtonLayout.setSpacing(8)
|
||||
self.CCLIButtonLayout.setObjectName(u'CCLIButtonLayout')
|
||||
self.CCLIAddButton = QtGui.QPushButton(self.CCLIPage)
|
||||
self.CCLIAddButton.setIcon(self.OpenIcon)
|
||||
self.CCLIAddButton.setObjectName(u'CCLIAddButton')
|
||||
self.CCLIButtonLayout.addWidget(self.CCLIAddButton)
|
||||
self.CCLIButtonSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.CCLIButtonLayout.addItem(self.CCLIButtonSpacer)
|
||||
self.CCLIRemoveButton = QtGui.QPushButton(self.CCLIPage)
|
||||
self.CCLIRemoveButton.setIcon(self.DeleteIcon)
|
||||
self.CCLIRemoveButton.setObjectName(u'CCLIRemoveButton')
|
||||
self.CCLIButtonLayout.addWidget(self.CCLIRemoveButton)
|
||||
self.CCLILayout.addLayout(self.CCLIButtonLayout)
|
||||
self.FormatStackedWidget.addWidget(self.CCLIPage)
|
||||
self.CSVPage = QtGui.QWidget()
|
||||
self.CSVPage.setObjectName(u'CSVPage')
|
||||
self.CSVLayout = QtGui.QFormLayout(self.CSVPage)
|
||||
self.CSVLayout.setMargin(0)
|
||||
self.CSVLayout.setSpacing(8)
|
||||
self.CSVLayout.setObjectName(u'CSVLayout')
|
||||
self.CSVFilenameLabel = QtGui.QLabel(self.CSVPage)
|
||||
self.CSVFilenameLabel.setObjectName(u'CSVFilenameLabel')
|
||||
self.CSVLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.CSVFilenameLabel)
|
||||
self.CSVFileLayout = QtGui.QHBoxLayout()
|
||||
self.CSVFileLayout.setSpacing(8)
|
||||
self.CSVFileLayout.setObjectName(u'CSVFileLayout')
|
||||
self.CSVFilenameEdit = QtGui.QLineEdit(self.CSVPage)
|
||||
self.CSVFilenameEdit.setObjectName(u'CSVFilenameEdit')
|
||||
self.CSVFileLayout.addWidget(self.CSVFilenameEdit)
|
||||
self.CSVBrowseButton = QtGui.QToolButton(self.CSVPage)
|
||||
self.CSVBrowseButton.setIcon(self.OpenIcon)
|
||||
self.CSVBrowseButton.setObjectName(u'CSVBrowseButton')
|
||||
self.CSVFileLayout.addWidget(self.CSVBrowseButton)
|
||||
self.CSVLayout.setLayout(0, QtGui.QFormLayout.FieldRole, self.CSVFileLayout)
|
||||
self.FormatStackedWidget.addWidget(self.CSVPage)
|
||||
self.SourceLayout.addWidget(self.FormatStackedWidget)
|
||||
SongImportWizard.addPage(self.SourcePage)
|
||||
self.ImportPage = QtGui.QWizardPage()
|
||||
self.ImportPage.setObjectName(u'ImportPage')
|
||||
self.ImportLayout = QtGui.QVBoxLayout(self.ImportPage)
|
||||
self.ImportLayout.setSpacing(8)
|
||||
self.ImportLayout.setMargin(50)
|
||||
self.ImportLayout.setObjectName(u'ImportLayout')
|
||||
self.ImportProgressLabel = QtGui.QLabel(self.ImportPage)
|
||||
self.ImportProgressLabel.setObjectName(u'ImportProgressLabel')
|
||||
self.ImportLayout.addWidget(self.ImportProgressLabel)
|
||||
self.ImportProgressBar = QtGui.QProgressBar(self.ImportPage)
|
||||
self.ImportProgressBar.setProperty(u'value', 0)
|
||||
self.ImportProgressBar.setInvertedAppearance(False)
|
||||
self.ImportProgressBar.setObjectName(u'ImportProgressBar')
|
||||
self.ImportLayout.addWidget(self.ImportProgressBar)
|
||||
SongImportWizard.addPage(self.ImportPage)
|
||||
|
||||
self.retranslateUi(SongImportWizard)
|
||||
self.FormatStackedWidget.setCurrentIndex(0)
|
||||
QtCore.QObject.connect(
|
||||
self.FormatComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.FormatStackedWidget.setCurrentIndex
|
||||
)
|
||||
QtCore.QMetaObject.connectSlotsByName(SongImportWizard)
|
||||
|
||||
def retranslateUi(self, SongImportWizard):
|
||||
SongImportWizard.setWindowTitle(self.trUtf8('Song Import Wizard'))
|
||||
self.TitleLabel.setText(
|
||||
'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
|
||||
self.trUtf8('Welcome to the Song Import Wizard'))
|
||||
self.InformationLabel.setText(self.trUtf8('This wizard will help you '
|
||||
'to import songs from a variety of formats. Click the next button '
|
||||
'below to start the process by selecting a format to import from.'))
|
||||
self.SourcePage.setTitle(self.trUtf8('Select Import Source'))
|
||||
self.SourcePage.setSubTitle(self.trUtf8('Select the import format, '
|
||||
'and where to import from.'))
|
||||
self.FormatLabel.setText(self.trUtf8('Format:'))
|
||||
self.FormatComboBox.setItemText(0, self.trUtf8('OpenLyrics'))
|
||||
self.FormatComboBox.setItemText(1, self.trUtf8('OpenSong'))
|
||||
self.FormatComboBox.setItemText(2, self.trUtf8('CCLI'))
|
||||
self.FormatComboBox.setItemText(3, self.trUtf8('CSV'))
|
||||
self.OpenLyricsAddButton.setText(self.trUtf8('Add Files...'))
|
||||
self.OpenLyricsRemoveButton.setText(self.trUtf8('Remove File(s)'))
|
||||
self.OpenSongAddButton.setText(self.trUtf8('Add Files...'))
|
||||
self.OpenSongRemoveButton.setText(self.trUtf8('Remove File(s)'))
|
||||
self.CCLIAddButton.setText(self.trUtf8('Add Files...'))
|
||||
self.CCLIRemoveButton.setText(self.trUtf8('Remove File(s)'))
|
||||
self.CSVFilenameLabel.setText(self.trUtf8('Filename:'))
|
||||
self.CSVBrowseButton.setText(self.trUtf8('Browse...'))
|
||||
self.ImportPage.setTitle(self.trUtf8('Importing'))
|
||||
self.ImportPage.setSubTitle(self.trUtf8('Please wait while your songs '
|
||||
'are imported.'))
|
||||
self.ImportProgressLabel.setText(self.trUtf8('Ready.'))
|
||||
self.ImportProgressBar.setFormat(self.trUtf8('%p%'))
|
||||
|
@ -30,10 +30,56 @@ from PyQt4 import QtCore
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.plugins.songs.lib.models import init_models, metadata, Song, \
|
||||
Author, Topic, Book
|
||||
#from openlp.plugins.songs.lib import OpenLyricsSong, OpenSongSong, CCLISong, \
|
||||
# CSVSong
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class SongManager():
|
||||
class SongFormat(object):
|
||||
"""
|
||||
This is a special enumeration class that holds the various types of songs,
|
||||
plus a few helper functions to facilitate generic handling of song types
|
||||
for importing.
|
||||
"""
|
||||
Unknown = -1
|
||||
OpenLyrics = 0
|
||||
OpenSong = 1
|
||||
CCLI = 2
|
||||
CSV = 3
|
||||
|
||||
@staticmethod
|
||||
def get_class(id):
|
||||
"""
|
||||
Return the appropriate imeplementation class.
|
||||
|
||||
``id``
|
||||
The song format.
|
||||
"""
|
||||
# if id == SongFormat.OpenLyrics:
|
||||
# return OpenLyricsSong
|
||||
# elif id == SongFormat.OpenSong:
|
||||
# return OpenSongSong
|
||||
# elif id == SongFormat.CCLI:
|
||||
# return CCLISong
|
||||
# elif id == SongFormat.CSV:
|
||||
# return CSVSong
|
||||
# else:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def list():
|
||||
"""
|
||||
Return a list of the supported song formats.
|
||||
"""
|
||||
return [
|
||||
SongFormat.OpenLyrics,
|
||||
SongFormat.OpenSong,
|
||||
SongFormat.CCLI,
|
||||
SongFormat.CSV
|
||||
]
|
||||
|
||||
|
||||
class SongManager(object):
|
||||
"""
|
||||
The Song Manager provides a central location for all database code. This
|
||||
class takes care of connecting to the database and running all the queries.
|
||||
|
@ -29,7 +29,8 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, SongXMLParser, \
|
||||
BaseListWithDnD, Receiver, ItemCapabilities
|
||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm
|
||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
||||
ImportWizardForm
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -49,10 +50,11 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.IconPath = u'songs/song'
|
||||
self.ListViewWithDnD_class = SongListView
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.edit_song_form = EditSongForm(self, self.parent.manager)
|
||||
self.singleServiceItem = False
|
||||
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
|
||||
#self.edit_song_form = EditSongForm(self.parent.manager, self)
|
||||
self.song_maintenance_form = SongMaintenanceForm(
|
||||
self.parent.songmanager, self)
|
||||
self.parent.manager, self)
|
||||
# Holds information about whether the edit is remotly triggered and
|
||||
# which Song is required.
|
||||
self.remoteSong = -1
|
||||
@ -154,17 +156,17 @@ class SongMediaItem(MediaManagerItem):
|
||||
search_type = self.SearchTypeComboBox.currentIndex()
|
||||
if search_type == 0:
|
||||
log.debug(u'Titles Search')
|
||||
search_results = self.parent.songmanager.search_song_title(
|
||||
search_results = self.parent.manager.search_song_title(
|
||||
search_keywords)
|
||||
self.displayResultsSong(search_results)
|
||||
elif search_type == 1:
|
||||
log.debug(u'Lyrics Search')
|
||||
search_results = self.parent.songmanager.search_song_lyrics(
|
||||
search_results = self.parent.manager.search_song_lyrics(
|
||||
search_keywords)
|
||||
self.displayResultsSong(search_results)
|
||||
elif search_type == 2:
|
||||
log.debug(u'Authors Search')
|
||||
search_results = self.parent.songmanager.get_song_from_author(
|
||||
search_results = self.parent.manager.get_song_from_author(
|
||||
search_keywords)
|
||||
self.displayResultsAuthor(search_results)
|
||||
#Called to redisplay the song list screen edith from a search
|
||||
@ -226,6 +228,11 @@ class SongMediaItem(MediaManagerItem):
|
||||
if len(text) > search_length:
|
||||
self.onSearchTextButtonClick()
|
||||
|
||||
def onImportClick(self):
|
||||
songimportform = ImportWizardForm(self, self.parent.manager,
|
||||
self.parent)
|
||||
songimportform.exec_()
|
||||
|
||||
def onNewClick(self):
|
||||
self.edit_song_form.newSong()
|
||||
self.edit_song_form.exec_()
|
||||
@ -256,7 +263,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
type of display is required.
|
||||
"""
|
||||
fields = songid.split(u':')
|
||||
valid = self.parent.songmanager.get_song(fields[1])
|
||||
valid = self.parent.manager.get_song(fields[1])
|
||||
if valid:
|
||||
self.remoteSong = fields[1]
|
||||
self.remoteTriggered = fields[0]
|
||||
@ -286,7 +293,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
return
|
||||
for item in items:
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
self.parent.songmanager.delete_song(item_id)
|
||||
self.parent.manager.delete_song(item_id)
|
||||
self.onSearchTextButtonClick()
|
||||
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
@ -307,15 +314,14 @@ class SongMediaItem(MediaManagerItem):
|
||||
service_item.add_capability(ItemCapabilities.AllowsEdit)
|
||||
service_item.add_capability(ItemCapabilities.AllowsPreview)
|
||||
service_item.add_capability(ItemCapabilities.AllowsLoop)
|
||||
song = self.parent.songmanager.get_song(item_id)
|
||||
song = self.parent.manager.get_song(item_id)
|
||||
service_item.theme = song.theme_name
|
||||
service_item.editId = item_id
|
||||
if song.lyrics.startswith(u'<?xml version='):
|
||||
songXML = SongXMLParser(song.lyrics)
|
||||
verseList = songXML.get_verses()
|
||||
#no verse list or only 1 space (in error)
|
||||
if song.verse_order is None or \
|
||||
song.verse_order == u'' or song.verse_order == u' ':
|
||||
if not song.verse_order or not song.verse_order.strip():
|
||||
for verse in verseList:
|
||||
service_item.add_from_text(verse[1][:30], unicode(verse[1]))
|
||||
else:
|
||||
@ -363,3 +369,5 @@ class SongMediaItem(MediaManagerItem):
|
||||
song.title, author_audit, song.copyright, song.ccli_number
|
||||
]
|
||||
return True
|
||||
|
||||
|
||||
|
138
openlp/plugins/songs/lib/xml.py
Normal file
138
openlp/plugins/songs/lib/xml.py
Normal file
@ -0,0 +1,138 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
||||
# Thompson, Jon Tibble, 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 lxml import objectify
|
||||
|
||||
class LyricsXML(object):
|
||||
"""
|
||||
This class represents the XML in the ``lyrics`` field of a song.
|
||||
|
||||
The basic XML looks like this::
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<song version="1.0">
|
||||
<lyrics language="en">
|
||||
<verse type="chorus" label="1">
|
||||
<![CDATA[ ... ]]>
|
||||
</verse>
|
||||
</lyrics>
|
||||
</song>
|
||||
"""
|
||||
def __init__(self, song=None):
|
||||
if song:
|
||||
if song.lyrics.startswith(u'<?xml'):
|
||||
self.parse(song.lyrics)
|
||||
else:
|
||||
self.extract(song.lyrics)
|
||||
else:
|
||||
self.languages = []
|
||||
|
||||
def parse(self, xml):
|
||||
"""
|
||||
Parse XML from the ``lyrics`` field in the database, and set the list
|
||||
of verses from it.
|
||||
|
||||
``xml``
|
||||
The XML to parse.
|
||||
"""
|
||||
try:
|
||||
self.languages = []
|
||||
song = objectify.fromstring(xml)
|
||||
for lyrics in song.lyrics:
|
||||
language = {
|
||||
u'language': lyrics.attrib[u'language'],
|
||||
u'verses': []
|
||||
}
|
||||
for verse in lyrics.verse:
|
||||
language[u'verses'].append({
|
||||
u'type': verse.attrib[u'type'],
|
||||
u'label': verse.attrib[u'label'],
|
||||
u'text': unicode(verse.text)
|
||||
})
|
||||
self.lyrics.append(language)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
def extract(self, text):
|
||||
"""
|
||||
If the ``lyrics`` field in the database is not XML, this method is
|
||||
called and used to construct the verse structure similar to the output
|
||||
of the ``parse`` function.
|
||||
|
||||
``text``
|
||||
The text to pull verses out of.
|
||||
"""
|
||||
text = text.replace('\r\n', '\n')
|
||||
verses = text.split('\n\n')
|
||||
self.languages = [{u'language': u'en', u'verses': []}]
|
||||
counter = 0
|
||||
for verse in verses:
|
||||
counter = counter + 1
|
||||
self.languages[0][u'verses'].append({
|
||||
u'type': u'verse',
|
||||
u'label': unicode(counter),
|
||||
u'text': verse
|
||||
})
|
||||
return True
|
||||
|
||||
def add_verse(self, type, label, text):
|
||||
"""
|
||||
Add a verse to the list of verses.
|
||||
|
||||
``type``
|
||||
The type of list, one of "verse", "chorus", "bridge", "pre-chorus",
|
||||
"intro", "outtro".
|
||||
|
||||
``label``
|
||||
The number associated with this verse, like 1 or 2.
|
||||
|
||||
``text``
|
||||
The text of the verse.
|
||||
"""
|
||||
self.verses.append({
|
||||
u'type': type,
|
||||
u'label': label,
|
||||
u'text': text
|
||||
})
|
||||
|
||||
def export(self):
|
||||
"""
|
||||
Build up the XML for the verse structure.
|
||||
"""
|
||||
lyrics_output = u''
|
||||
for language in self.languages:
|
||||
verse_output = u''
|
||||
for verse in language[u'verses']:
|
||||
verse_output = verse_output + \
|
||||
u'<verse type="%s" label="%s"><![CDATA[%s]]></verse>' % \
|
||||
(verse[u'type'], verse[u'label'], verse[u'text'])
|
||||
lyrics_output = lyrics_output + \
|
||||
u'<lyrics language="%s">%s</lyrics>' % \
|
||||
(language[u'language'], verse_output)
|
||||
song_output = u'<?xml version="1.0" encoding="UTF-8"?>' + \
|
||||
u'<song version="1.0">%s</song>' % lyrics_output
|
||||
return song_output
|
||||
|
@ -30,11 +30,10 @@ from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import Plugin, build_icon, PluginStatus, Receiver
|
||||
from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab, \
|
||||
SofImport, OooImport
|
||||
from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
|
||||
OpenSongImportForm, OpenLPExportForm
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SongsPlugin(Plugin):
|
||||
"""
|
||||
This is the number 1 plugin, if importance were placed on any
|
||||
@ -51,11 +50,7 @@ class SongsPlugin(Plugin):
|
||||
"""
|
||||
Plugin.__init__(self, u'Songs', u'1.9.1', plugin_helpers)
|
||||
self.weight = -10
|
||||
self.songmanager = SongManager()
|
||||
self.openlp_import_form = OpenLPImportForm()
|
||||
self.opensong_import_form = OpenSongImportForm()
|
||||
self.openlp_export_form = OpenLPExportForm()
|
||||
self.opensong_export_form = OpenSongExportForm()
|
||||
self.manager = SongManager()
|
||||
self.icon = build_icon(u':/media/media_song.png')
|
||||
self.status = PluginStatus.Active
|
||||
|
||||
@ -68,16 +63,16 @@ class SongsPlugin(Plugin):
|
||||
# self.songmanager = SongManager()
|
||||
Plugin.initialise(self)
|
||||
self.insert_toolbox_item()
|
||||
self.ImportSongMenu.menuAction().setVisible(True)
|
||||
self.ExportSongMenu.menuAction().setVisible(True)
|
||||
self.media_item.displayResultsSong(self.songmanager.get_songs())
|
||||
#self.ImportSongMenu.menuAction().setVisible(True)
|
||||
#self.ExportSongMenu.menuAction().setVisible(True)
|
||||
self.media_item.displayResultsSong(self.manager.get_songs())
|
||||
|
||||
def finalise(self):
|
||||
log.info(u'Plugin Finalise')
|
||||
Plugin.finalise(self)
|
||||
self.remove_toolbox_item()
|
||||
self.ImportSongMenu.menuAction().setVisible(False)
|
||||
self.ExportSongMenu.menuAction().setVisible(False)
|
||||
#self.ImportSongMenu.menuAction().setVisible(False)
|
||||
#self.ExportSongMenu.menuAction().setVisible(False)
|
||||
|
||||
def get_media_manager_item(self):
|
||||
"""
|
||||
@ -95,64 +90,47 @@ class SongsPlugin(Plugin):
|
||||
The actual **Import** menu item, so that your actions can
|
||||
use it as their parent.
|
||||
"""
|
||||
self.ImportSongMenu = QtGui.QMenu(import_menu)
|
||||
self.ImportSongMenu.setObjectName(u'ImportSongMenu')
|
||||
self.ImportOpenSongItem = QtGui.QAction(import_menu)
|
||||
self.ImportOpenSongItem.setObjectName(u'ImportOpenSongItem')
|
||||
self.ImportOpenlp1Item = QtGui.QAction(import_menu)
|
||||
self.ImportOpenlp1Item.setObjectName(u'ImportOpenlp1Item')
|
||||
self.ImportOpenlp2Item = QtGui.QAction(import_menu)
|
||||
self.ImportOpenlp2Item.setObjectName(u'ImportOpenlp2Item')
|
||||
# Main song import menu item - will eventually be the only one
|
||||
self.SongImportItem = QtGui.QAction(import_menu)
|
||||
self.SongImportItem.setObjectName(u'SongImportItem')
|
||||
self.SongImportItem.setText(import_menu.trUtf8('&Song'))
|
||||
self.SongImportItem.setToolTip(
|
||||
import_menu.trUtf8('Import songs using the import wizard.'))
|
||||
import_menu.addAction(self.SongImportItem)
|
||||
# Songs of Fellowship import menu item - will be removed and the
|
||||
# functionality will be contained within the import wizard
|
||||
self.ImportSofItem = QtGui.QAction(import_menu)
|
||||
self.ImportSofItem.setObjectName(u'ImportSofItem')
|
||||
self.ImportOooItem = QtGui.QAction(import_menu)
|
||||
self.ImportOooItem.setObjectName(u'ImportOooItem')
|
||||
# Add to menus
|
||||
self.ImportSongMenu.addAction(self.ImportOpenlp1Item)
|
||||
self.ImportSongMenu.addAction(self.ImportOpenlp2Item)
|
||||
self.ImportSongMenu.addAction(self.ImportOpenSongItem)
|
||||
self.ImportSongMenu.addAction(self.ImportSofItem)
|
||||
self.ImportSongMenu.addAction(self.ImportOooItem)
|
||||
import_menu.addAction(self.ImportSongMenu.menuAction())
|
||||
# Translations...
|
||||
self.ImportSongMenu.setTitle(import_menu.trUtf8('&Song'))
|
||||
self.ImportOpenSongItem.setText(import_menu.trUtf8('OpenSong'))
|
||||
self.ImportOpenlp1Item.setText(import_menu.trUtf8('openlp.org 1.0'))
|
||||
self.ImportOpenlp1Item.setToolTip(
|
||||
import_menu.trUtf8('Import songs in openlp.org 1.0 format'))
|
||||
self.ImportOpenlp1Item.setStatusTip(
|
||||
import_menu.trUtf8('Import songs in openlp.org 1.0 format'))
|
||||
self.ImportOpenlp2Item.setText(import_menu.trUtf8('OpenLP 2.0'))
|
||||
self.ImportOpenlp2Item.setToolTip(
|
||||
import_menu.trUtf8('Import songs in OpenLP 2.0 format'))
|
||||
self.ImportOpenlp2Item.setStatusTip(
|
||||
import_menu.trUtf8('Import songs in OpenLP 2.0 format'))
|
||||
self.ImportSofItem.setText(
|
||||
import_menu.trUtf8('Songs of Fellowship'))
|
||||
import_menu.trUtf8('Songs of Fellowship (temp menu item)'))
|
||||
self.ImportSofItem.setToolTip(
|
||||
import_menu.trUtf8('Import songs from the VOLS1_2.RTF, sof3words' \
|
||||
+ '.rtf and sof4words.rtf supplied with the music books'))
|
||||
self.ImportSofItem.setStatusTip(
|
||||
import_menu.trUtf8('Import songs from the VOLS1_2.RTF, sof3words' \
|
||||
+ '.rtf and sof4words.rtf supplied with the music books'))
|
||||
import_menu.addAction(self.ImportSofItem)
|
||||
# OpenOffice.org import menu item - will be removed and the
|
||||
# functionality will be contained within the import wizard
|
||||
self.ImportOooItem = QtGui.QAction(import_menu)
|
||||
self.ImportOooItem.setObjectName(u'ImportOooItem')
|
||||
self.ImportOooItem.setText(
|
||||
import_menu.trUtf8('Generic Document/Presentation Import'))
|
||||
import_menu.trUtf8('Generic Document/Presentation Import '
|
||||
'(temp menu item)'))
|
||||
self.ImportOooItem.setToolTip(
|
||||
import_menu.trUtf8('Import songs from Word/Writer/Powerpoint/Impress'))
|
||||
import_menu.trUtf8('Import songs from '
|
||||
'Word/Writer/Powerpoint/Impress'))
|
||||
self.ImportOooItem.setStatusTip(
|
||||
import_menu.trUtf8('Import songs from Word/Writer/Powerpoint/Impress'))
|
||||
import_menu.trUtf8('Import songs from '
|
||||
'Word/Writer/Powerpoint/Impress'))
|
||||
import_menu.addAction(self.ImportOooItem)
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.ImportOpenlp1Item,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
|
||||
QtCore.QObject.connect(self.ImportOpenlp2Item,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
|
||||
QtCore.QObject.connect(self.ImportOpenSongItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
|
||||
QtCore.QObject.connect(self.SongImportItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
|
||||
QtCore.QObject.connect(self.ImportSofItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onImportSofItemClick)
|
||||
QtCore.QObject.connect(self.ImportOooItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onImportOooItemClick)
|
||||
self.ImportSongMenu.menuAction().setVisible(False)
|
||||
|
||||
def add_export_menu_item(self, export_menu):
|
||||
"""
|
||||
@ -163,36 +141,12 @@ class SongsPlugin(Plugin):
|
||||
The actual **Export** menu item, so that your actions can
|
||||
use it as their parent.
|
||||
"""
|
||||
self.ExportSongMenu = QtGui.QMenu(export_menu)
|
||||
self.ExportSongMenu.setObjectName(u'ExportSongMenu')
|
||||
self.ExportOpenSongItem = QtGui.QAction(export_menu)
|
||||
self.ExportOpenSongItem.setObjectName(u'ExportOpenSongItem')
|
||||
self.ExportOpenlp1Item = QtGui.QAction(export_menu)
|
||||
self.ExportOpenlp1Item.setObjectName(u'ExportOpenlp1Item')
|
||||
self.ExportOpenlp2Item = QtGui.QAction(export_menu)
|
||||
self.ExportOpenlp2Item.setObjectName(u'ExportOpenlp2Item')
|
||||
# Add to menus
|
||||
self.ExportSongMenu.addAction(self.ExportOpenlp1Item)
|
||||
self.ExportSongMenu.addAction(self.ExportOpenlp2Item)
|
||||
self.ExportSongMenu.addAction(self.ExportOpenSongItem)
|
||||
export_menu.addAction(self.ExportSongMenu.menuAction())
|
||||
# Translations...
|
||||
self.ExportSongMenu.setTitle(export_menu.trUtf8('&Song'))
|
||||
self.ExportOpenSongItem.setText(export_menu.trUtf8('OpenSong'))
|
||||
self.ExportOpenlp1Item.setText(export_menu.trUtf8('openlp.org 1.0'))
|
||||
self.ExportOpenlp2Item.setText(export_menu.trUtf8('OpenLP 2.0'))
|
||||
# Signals and slots
|
||||
QtCore.QObject.connect(self.ExportOpenlp1Item,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onExportOpenlp1ItemClicked)
|
||||
QtCore.QObject.connect(self.ExportOpenSongItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onExportOpenSongItemClicked)
|
||||
self.ExportSongMenu.menuAction().setVisible(False)
|
||||
# No menu items for now.
|
||||
pass
|
||||
|
||||
def onImportOpenlp1ItemClick(self):
|
||||
self.openlp_import_form.show()
|
||||
|
||||
def onImportOpenSongItemClick(self):
|
||||
self.opensong_import_form.show()
|
||||
def onSongImportItemClicked(self):
|
||||
if self.media_item:
|
||||
self.media_item.onImportClick()
|
||||
|
||||
def onImportSofItemClick(self):
|
||||
filenames = QtGui.QFileDialog.getOpenFileNames(
|
||||
@ -200,16 +154,16 @@ class SongsPlugin(Plugin):
|
||||
u'', u'Songs of Fellowship file (*.rtf *.RTF)')
|
||||
try:
|
||||
for filename in filenames:
|
||||
sofimport = SofImport(self.songmanager)
|
||||
sofimport = SofImport(self.manager)
|
||||
sofimport.import_sof(unicode(filename))
|
||||
except:
|
||||
log.exception('Could not import SoF file')
|
||||
QtGui.QMessageBox.critical(None,
|
||||
self.ImportSongMenu.trUtf8('Import Error'),
|
||||
self.ImportSongMenu.trUtf8('Error importing Songs of '
|
||||
+ 'Fellowship file.\nOpenOffice.org must be installed'
|
||||
+ ' and you must be using an unedited copy of the RTF'
|
||||
+ ' included with the Songs of Fellowship Music Editions'),
|
||||
'Fellowship file.\nOpenOffice.org must be installed'
|
||||
' and you must be using an unedited copy of the RTF'
|
||||
' included with the Songs of Fellowship Music Editions'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
|
||||
QtGui.QMessageBox.Ok)
|
||||
Receiver.send_message(u'songs_load_list')
|
||||
@ -218,22 +172,17 @@ class SongsPlugin(Plugin):
|
||||
filenames = QtGui.QFileDialog.getOpenFileNames(
|
||||
None, self.trUtf8('Open documents or presentations'),
|
||||
u'', u'All Files(*.*)')
|
||||
oooimport = OooImport(self.songmanager)
|
||||
oooimport = OooImport(self.manager)
|
||||
oooimport.import_docs(filenames)
|
||||
Receiver.send_message(u'songs_load_list')
|
||||
|
||||
def onExportOpenlp1ItemClicked(self):
|
||||
self.openlp_export_form.show()
|
||||
|
||||
def onExportOpenSongItemClicked(self):
|
||||
self.opensong_export_form.show()
|
||||
|
||||
def about(self):
|
||||
about_text = self.trUtf8('<b>Song Plugin</b> <br>This plugin allows '
|
||||
'Songs to be managed and displayed.<br>')
|
||||
about_text = self.trUtf8('<strong>Song Plugin</strong><br />'
|
||||
'This plugin allows songs to be managed and displayed.')
|
||||
return about_text
|
||||
|
||||
def can_delete_theme(self, theme):
|
||||
if len(self.songmanager.get_songs_for_theme(theme)) == 0:
|
||||
if len(self.manager.get_songs_for_theme(theme)) == 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>521</height>
|
||||
<width>474</width>
|
||||
<height>442</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -16,174 +16,118 @@
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>11</x>
|
||||
<y>1</y>
|
||||
<width>471</width>
|
||||
<height>491</height>
|
||||
</rect>
|
||||
<layout class="QVBoxLayout" name="EditVerseLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QComboBox" name="VerseListComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Intro</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Verse</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pre-Chorus</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Chorus</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Bridge</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ending</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Other</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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>
|
||||
<widget class="QTextEdit" name="VerseTextEdit">
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addBridge">
|
||||
<property name="text">
|
||||
<string>Bridge</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addVerse">
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="VerseTextEdit">
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="VerseTypeLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="VerseTypeLabel">
|
||||
<property name="text">
|
||||
<string>Verse Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="VerseTypeComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Verse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addChorus">
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Chorus</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addPreChorus">
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Bridge</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pre-Chorus</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addIntro">
|
||||
</item>
|
||||
<item>
|
||||
<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">
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ending</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="ButtonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Other</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="VerseNumberBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="InsertButton">
|
||||
<property name="text">
|
||||
<string>Insert</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/general/general_add.png</normaloff>:/general/general_add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="VerseTypeSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="EditButtonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../images/openlp-2.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>ButtonBox</sender>
|
||||
<sender>EditButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>EditVerseDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
@ -199,7 +143,7 @@
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>ButtonBox</sender>
|
||||
<sender>EditButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>EditVerseDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
|
467
resources/forms/songimportwizard.ui
Normal file
467
resources/forms/songimportwizard.ui
Normal file
@ -0,0 +1,467 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SongImportWizard</class>
|
||||
<widget class="QWizard" name="SongImportWizard">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>386</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>166</width>
|
||||
<height>386</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Song Import Wizard</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="wizardStyle">
|
||||
<enum>QWizard::ModernStyle</enum>
|
||||
</property>
|
||||
<property name="options">
|
||||
<set>QWizard::NoBackButtonOnLastPage|QWizard::NoBackButtonOnStartPage</set>
|
||||
</property>
|
||||
<widget class="QWizardPage" name="WelcomePage">
|
||||
<layout class="QHBoxLayout" name="WelcomeLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="ImportSongImage">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>163</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>163</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images/openlp-2.qrc">:/wizards/wizard_importsong.bmp</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="WelcomeTextLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="TitleLabel">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Lucida Grande'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Welcome to the Song Import Wizard</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="WelcomeTopSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="InformationLabel">
|
||||
<property name="text">
|
||||
<string>This wizard will help you to import songs from a variety of formats. Click the next button below to start the process by selecting a format to import from.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="WelcomeBottomSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWizardPage" name="SourcePage">
|
||||
<property name="title">
|
||||
<string>Select Import Source</string>
|
||||
</property>
|
||||
<property name="subTitle">
|
||||
<string>Select the import format, and where to import from.</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="SourceLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="FormatLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="FormatLabel">
|
||||
<property name="text">
|
||||
<string>Format:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="FormatComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>OpenLyrics</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>OpenSong</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CCLI</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CSV</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="FormatSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="FormatStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="OpenLyricsPage">
|
||||
<layout class="QVBoxLayout" name="OpenLyricsLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="OpenLyricsFileListWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="OpenLyricsButtonLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="OpenLyricsAddButton">
|
||||
<property name="text">
|
||||
<string>Add Files...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="OpenLyricsButtonSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="OpenLyricsRemoveButton">
|
||||
<property name="text">
|
||||
<string>Remove File(s)</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/general/general_delete.png</normaloff>:/general/general_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="OpenSongPage">
|
||||
<layout class="QVBoxLayout" name="OpenSongLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="OpenSongFileListWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="OpenSongButtonLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="OpenSongAddButton">
|
||||
<property name="text">
|
||||
<string>Add Files...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="OpenSongButtonSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="OpenSongRemoveButton">
|
||||
<property name="text">
|
||||
<string>Remove File(s)</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/general/general_delete.png</normaloff>:/general/general_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="CCLIPage">
|
||||
<layout class="QVBoxLayout" name="CCLILayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="CCLIFileListWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="CCLIButtonLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="CCLIAddButton">
|
||||
<property name="text">
|
||||
<string>Add Files...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="CCLIButtonSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="CCLIRemoveButton">
|
||||
<property name="text">
|
||||
<string>Remove File(s)</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/general/general_delete.png</normaloff>:/general/general_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="CSVPage">
|
||||
<layout class="QFormLayout" name="CSVLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="CSVFilenameLabel">
|
||||
<property name="text">
|
||||
<string>Filename:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="CSVFileLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="CSVFilenameEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="CSVBrowseButton">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWizardPage" name="ImportPage">
|
||||
<property name="title">
|
||||
<string>Importing</string>
|
||||
</property>
|
||||
<property name="subTitle">
|
||||
<string>Please wait while your songs are imported.</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="ImportLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="ImportProgressLabel">
|
||||
<property name="text">
|
||||
<string>Ready.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="ImportProgressBar">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%p</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images/openlp-2.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>FormatComboBox</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>FormatStackedWidget</receiver>
|
||||
<slot>setCurrentIndex(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>122</x>
|
||||
<y>92</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>274</x>
|
||||
<y>222</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -67,6 +67,7 @@
|
||||
<file>export_move_to_list.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="wizards" >
|
||||
<file>wizard_importsong.bmp</file>
|
||||
<file>wizard_importbible.bmp</file>
|
||||
</qresource>
|
||||
<qresource prefix="services" >
|
||||
|
BIN
resources/images/wizard_importsong.bmp
Normal file
BIN
resources/images/wizard_importsong.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 168 KiB |
Loading…
Reference in New Issue
Block a user