diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py
index cfb0e2bc2..64e54e5fc 100644
--- a/openlp/core/lib/renderer.py
+++ b/openlp/core/lib/renderer.py
@@ -533,7 +533,10 @@ class Renderer(object):
font = self.mainFont
metrics = QtGui.QFontMetrics(font)
w = metrics.width(line)
- h = metrics.height() + int(self._theme.font_main_line_adjustment)
+ if footer:
+ h = metrics.height()
+ else:
+ h = metrics.height() + int(self._theme.font_main_line_adjustment)
if draw:
self.painter.setFont(font)
if color is None:
@@ -581,4 +584,4 @@ class Renderer(object):
"""
image.save(u'renderer.png', u'png')
if image2:
- image2.save(u'renderer2.png', u'png')
\ No newline at end of file
+ image2.save(u'renderer2.png', u'png')
diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py
index 34c3573da..848f6ec72 100644
--- a/openlp/core/ui/amendthemedialog.py
+++ b/openlp/core/ui/amendthemedialog.py
@@ -184,6 +184,7 @@ class Ui_AmendThemeDialog(object):
self.MainFontLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainWrapLineAdjustmentLabel)
self.FontMainLineAdjustmentSpinBox = QtGui.QSpinBox(self.FontMainGroupBox)
self.FontMainLineAdjustmentSpinBox.setObjectName("FontMainLineAdjustmentSpinBox")
+ self.FontMainLineAdjustmentSpinBox.setMinimum(-99)
self.MainFontLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontMainLineAdjustmentSpinBox)
self.FontMainWrapIndentationLabel = QtGui.QLabel(self.FontMainGroupBox)
self.FontMainWrapIndentationLabel.setObjectName("FontMainWrapIndentationLabel")
diff --git a/openlp/core/ui/displaytab.py b/openlp/core/ui/displaytab.py
index 38a0baa91..d3ef9205d 100644
--- a/openlp/core/ui/displaytab.py
+++ b/openlp/core/ui/displaytab.py
@@ -42,139 +42,139 @@ class DisplayTab(SettingsTab):
self.tabTitleVisible = self.trUtf8('Displays')
self.layoutWidget = QtGui.QWidget(self)
self.layoutWidget.setGeometry(QtCore.QRect(0, 40, 241, 79))
- self.layoutWidget.setObjectName("layoutWidget")
+ self.layoutWidget.setObjectName(u'layoutWidget')
self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
- self.verticalLayout.setObjectName("verticalLayout")
+ self.verticalLayout.setObjectName(u'verticalLayout')
self.CurrentGroupBox = QtGui.QGroupBox(self.layoutWidget)
- self.CurrentGroupBox.setObjectName("CurrentGroupBox")
+ self.CurrentGroupBox.setObjectName(u'CurrentGroupBox')
self.horizontalLayout = QtGui.QHBoxLayout(self.CurrentGroupBox)
- self.horizontalLayout.setObjectName("horizontalLayout")
+ self.horizontalLayout.setObjectName(u'horizontalLayout')
self.verticalLayout_6 = QtGui.QVBoxLayout()
- self.verticalLayout_6.setObjectName("verticalLayout_6")
+ self.verticalLayout_6.setObjectName(u'verticalLayout_6')
self.XLabel = QtGui.QLabel(self.CurrentGroupBox)
self.XLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.XLabel.setObjectName("XLabel")
+ self.XLabel.setObjectName(u'XLabel')
self.verticalLayout_6.addWidget(self.XLabel)
self.Xpos = QtGui.QLabel(self.CurrentGroupBox)
self.Xpos.setAlignment(QtCore.Qt.AlignCenter)
- self.Xpos.setObjectName("Xpos")
+ self.Xpos.setObjectName(u'Xpos')
self.verticalLayout_6.addWidget(self.Xpos)
self.horizontalLayout.addLayout(self.verticalLayout_6)
self.verticalLayout_7 = QtGui.QVBoxLayout()
- self.verticalLayout_7.setObjectName("verticalLayout_7")
+ self.verticalLayout_7.setObjectName(u'verticalLayout_7')
self.YLabel = QtGui.QLabel(self.CurrentGroupBox)
self.YLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.YLabel.setObjectName("YLabel")
+ self.YLabel.setObjectName(u'YLabel')
self.verticalLayout_7.addWidget(self.YLabel)
self.Ypos = QtGui.QLabel(self.CurrentGroupBox)
self.Ypos.setAlignment(QtCore.Qt.AlignCenter)
- self.Ypos.setObjectName("Ypos")
+ self.Ypos.setObjectName(u'Ypos')
self.verticalLayout_7.addWidget(self.Ypos)
self.horizontalLayout.addLayout(self.verticalLayout_7)
self.verticalLayout_9 = QtGui.QVBoxLayout()
- self.verticalLayout_9.setObjectName("verticalLayout_9")
+ self.verticalLayout_9.setObjectName(u'verticalLayout_9')
self.HeightLabel = QtGui.QLabel(self.CurrentGroupBox)
self.HeightLabel.setMaximumSize(QtCore.QSize(100, 16777215))
self.HeightLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.HeightLabel.setObjectName("HeightLabel")
+ self.HeightLabel.setObjectName(u'HeightLabel')
self.verticalLayout_9.addWidget(self.HeightLabel)
self.Height = QtGui.QLabel(self.CurrentGroupBox)
self.Height.setAlignment(QtCore.Qt.AlignCenter)
- self.Height.setObjectName("Height")
+ self.Height.setObjectName(u'Height')
self.verticalLayout_9.addWidget(self.Height)
self.horizontalLayout.addLayout(self.verticalLayout_9)
self.verticalLayout_8 = QtGui.QVBoxLayout()
- self.verticalLayout_8.setObjectName("verticalLayout_8")
+ self.verticalLayout_8.setObjectName(u'verticalLayout_8')
self.WidthLabel = QtGui.QLabel(self.CurrentGroupBox)
self.WidthLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.WidthLabel.setObjectName("WidthLabel")
+ self.WidthLabel.setObjectName(u'WidthLabel')
self.verticalLayout_8.addWidget(self.WidthLabel)
self.Width = QtGui.QLabel(self.CurrentGroupBox)
self.Width.setAlignment(QtCore.Qt.AlignCenter)
- self.Width.setObjectName("Width")
+ self.Width.setObjectName(u'Width')
self.verticalLayout_8.addWidget(self.Width)
self.horizontalLayout.addLayout(self.verticalLayout_8)
self.verticalLayout.addWidget(self.CurrentGroupBox)
self.CurrentGroupBox_2 = QtGui.QGroupBox(self)
self.CurrentGroupBox_2.setGeometry(QtCore.QRect(0, 130, 248, 87))
self.CurrentGroupBox_2.setMaximumSize(QtCore.QSize(500, 16777215))
- self.CurrentGroupBox_2.setObjectName("CurrentGroupBox_2")
+ self.CurrentGroupBox_2.setObjectName(u'CurrentGroupBox_2')
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.CurrentGroupBox_2)
- self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.horizontalLayout_2.setObjectName(u'horizontalLayout_2')
self.verticalLayout_2 = QtGui.QVBoxLayout()
- self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.verticalLayout_2.setObjectName(u'verticalLayout_2')
self.XAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.XAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.XAmendLabel.setObjectName("XAmendLabel")
+ self.XAmendLabel.setObjectName(u'XAmendLabel')
self.verticalLayout_2.addWidget(self.XAmendLabel)
self.XposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.XposEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.XposEdit.setMaxLength(4)
- self.XposEdit.setObjectName("XposEdit")
+ self.XposEdit.setObjectName(u'XposEdit')
self.verticalLayout_2.addWidget(self.XposEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_2)
self.verticalLayout_3 = QtGui.QVBoxLayout()
- self.verticalLayout_3.setObjectName("verticalLayout_3")
+ self.verticalLayout_3.setObjectName(u'verticalLayout_3')
self.YAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.YAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.YAmendLabel.setObjectName("YAmendLabel")
+ self.YAmendLabel.setObjectName(u'YAmendLabel')
self.verticalLayout_3.addWidget(self.YAmendLabel)
self.YposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.YposEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.YposEdit.setMaxLength(4)
- self.YposEdit.setObjectName("YposEdit")
+ self.YposEdit.setObjectName(u'YposEdit')
self.verticalLayout_3.addWidget(self.YposEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_3)
self.verticalLayout_4 = QtGui.QVBoxLayout()
- self.verticalLayout_4.setObjectName("verticalLayout_4")
+ self.verticalLayout_4.setObjectName(u'verticalLayout_4')
self.HeightAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.HeightAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.HeightAmendLabel.setObjectName("HeightAmendLabel")
+ self.HeightAmendLabel.setObjectName(u'HeightAmendLabel')
self.verticalLayout_4.addWidget(self.HeightAmendLabel)
self.HeightEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.HeightEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.HeightEdit.setMaxLength(4)
- self.HeightEdit.setObjectName("HeightEdit")
+ self.HeightEdit.setObjectName(u'HeightEdit')
self.verticalLayout_4.addWidget(self.HeightEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_4)
self.verticalLayout_5 = QtGui.QVBoxLayout()
self.verticalLayout_5.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
- self.verticalLayout_5.setObjectName("verticalLayout_5")
+ self.verticalLayout_5.setObjectName(u'verticalLayout_5')
self.WidthAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.WidthAmendLabel.setMaximumSize(QtCore.QSize(100, 16777215))
self.WidthAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.WidthAmendLabel.setObjectName("WidthAmendLabel")
+ self.WidthAmendLabel.setObjectName(u'WidthAmendLabel')
self.verticalLayout_5.addWidget(self.WidthAmendLabel)
self.WidthEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.WidthEdit.setMaximumSize(QtCore.QSize(60, 16777215))
- self.WidthEdit.setObjectName("WidthEdit")
+ self.WidthEdit.setObjectName(u'WidthEdit')
self.verticalLayout_5.addWidget(self.WidthEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_5)
self.OverrideCheckBox = QtGui.QCheckBox(self)
self.OverrideCheckBox.setGeometry(QtCore.QRect(0, 10, 191, 23))
- self.OverrideCheckBox.setObjectName("OverrideCheckBox")
+ self.OverrideCheckBox.setObjectName(u'OverrideCheckBox')
QtCore.QMetaObject.connectSlotsByName(self)
QtCore.QObject.connect(self.OverrideCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onOverrideCheckBoxChanged)
def retranslateUi(self):
- self.setWindowTitle(QtGui.QApplication.translate("self", "Amend Display Settings", None, QtGui.QApplication.UnicodeUTF8))
- self.CurrentGroupBox.setTitle(QtGui.QApplication.translate("self", "Default Settings", None, QtGui.QApplication.UnicodeUTF8))
- self.XLabel.setText(QtGui.QApplication.translate("self", "X", None, QtGui.QApplication.UnicodeUTF8))
- self.Xpos.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8))
- self.YLabel.setText(QtGui.QApplication.translate("self", "Y", None, QtGui.QApplication.UnicodeUTF8))
- self.Ypos.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8))
- self.HeightLabel.setText(QtGui.QApplication.translate("self", "Height", None, QtGui.QApplication.UnicodeUTF8))
- self.Height.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8))
- self.WidthLabel.setText(QtGui.QApplication.translate("self", "Width", None, QtGui.QApplication.UnicodeUTF8))
- self.Width.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8))
- self.CurrentGroupBox_2.setTitle(QtGui.QApplication.translate("self", "Amend Settings", None, QtGui.QApplication.UnicodeUTF8))
- self.XAmendLabel.setText(QtGui.QApplication.translate("self", "X", None, QtGui.QApplication.UnicodeUTF8))
- self.YAmendLabel.setText(QtGui.QApplication.translate("self", "Y", None, QtGui.QApplication.UnicodeUTF8))
- self.HeightAmendLabel.setText(QtGui.QApplication.translate("self", "Height", None, QtGui.QApplication.UnicodeUTF8))
- self.WidthAmendLabel.setText(QtGui.QApplication.translate("self", "Width", None, QtGui.QApplication.UnicodeUTF8))
- self.OverrideCheckBox.setText(QtGui.QApplication.translate("self", "Override Output Display", None, QtGui.QApplication.UnicodeUTF8))
+ self.setWindowTitle( self.trUtf8(u'Amend Display Settings'))
+ self.CurrentGroupBox.setTitle( self.trUtf8(u'Default Settings'))
+ self.XLabel.setText(self.trUtf8(u'X'))
+ self.Xpos.setText(u'0')
+ self.YLabel.setText( self.trUtf8(u'Y'))
+ self.Ypos.setText(u'0')
+ self.HeightLabel.setText( self.trUtf8(u'Height'))
+ self.Height.setText(u'0')
+ self.WidthLabel.setText( self.trUtf8(u'Width'))
+ self.Width.setText(u'0')
+ self.CurrentGroupBox_2.setTitle( self.trUtf8(u'Amend Settings'))
+ self.XAmendLabel.setText( self.trUtf8(u'X'))
+ self.YAmendLabel.setText( self.trUtf8(u'Y'))
+ self.HeightAmendLabel.setText( self.trUtf8(u'Height'))
+ self.WidthAmendLabel.setText( self.trUtf8(u'Width'))
+ self.OverrideCheckBox.setText( self.trUtf8(u'Override Output Display'))
def load(self):
settings = QtCore.QSettings()
diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py
index 4b2c4d268..b0278428a 100644
--- a/openlp/core/ui/maindisplay.py
+++ b/openlp/core/ui/maindisplay.py
@@ -116,10 +116,12 @@ class MainDisplay(DisplayWidget):
"""
log.debug(u'Initialisation started')
DisplayWidget.__init__(self, parent)
+ self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
+ self.setWindowState(QtCore.Qt.WindowFullScreen)
self.parent = parent
self.setWindowTitle(u'OpenLP Display')
# WA_TranslucentBackground is not available in QT4.4
- try:
+ try:
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
except AttributeError:
pass
@@ -346,12 +348,12 @@ class VideoDisplay(Phonon.VideoWidget):
Phonon.createPath(self.mediaObject, self.audioObject)
flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Dialog
# WindowsStaysOnBottomHint is not available in QT4.4
- try:
+ try:
flags = flags | QtCore.Qt.WindowStaysOnBottomHint
except AttributeError:
pass
self.setWindowFlags(flags)
-
+
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_hide'), self.mediaHide)
QtCore.QObject.connect(Receiver.get_receiver(),
diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py
index 4432eb9c0..92c8fed94 100644
--- a/openlp/core/ui/mainwindow.py
+++ b/openlp/core/ui/mainwindow.py
@@ -331,7 +331,7 @@ class Ui_MainWindow(object):
"""
MainWindow.mainTitle = translate('MainWindow', 'OpenLP 2.0')
MainWindow.language = translate('MainWindow', 'English')
- MainWindow.defaultThemeText = translate('MainWindow',
+ MainWindow.defaultThemeText = translate('MainWindow',
'Default Theme: ')
MainWindow.setWindowTitle(MainWindow.mainTitle)
self.FileMenu.setTitle(translate('MainWindow', '&File'))
@@ -340,7 +340,7 @@ class Ui_MainWindow(object):
self.OptionsMenu.setTitle(translate('MainWindow', '&Options'))
self.OptionsViewMenu.setTitle(translate('MainWindow', '&View'))
self.ViewModeMenu.setTitle(translate('MainWindow', 'M&ode'))
- self.OptionsLanguageMenu.setTitle(translate('MainWindow',
+ self.OptionsLanguageMenu.setTitle(translate('MainWindow',
u'&Language'))
self.ToolsMenu.setTitle(translate('MainWindow', '&Tools'))
self.HelpMenu.setTitle(translate('MainWindow', '&Help'))
@@ -525,7 +525,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onSaveService)
#i18n set signals for languages
- QtCore.QObject.connect(self.AutoLanguageItem,
+ QtCore.QObject.connect(self.AutoLanguageItem,
QtCore.SIGNAL(u'toggled(bool)'),
self.setAutoLanguage)
self.LanguageGroup.triggered.connect(LanguageManager.set_language)
diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py
index 37e0cf59a..e614205fe 100644
--- a/openlp/core/ui/slidecontroller.py
+++ b/openlp/core/ui/slidecontroller.py
@@ -114,10 +114,6 @@ class SlideController(QtGui.QWidget):
self.songEditList = [
u'Edit Song',
]
- if isLive:
- self.labelWidth = 20
- else:
- self.labelWidth = 0
self.timer_id = 0
self.songEdit = False
self.selectedRow = 0
@@ -157,12 +153,10 @@ class SlideController(QtGui.QWidget):
self.ControllerLayout.setMargin(0)
# Controller list view
self.PreviewListWidget = SlideList(self)
- self.PreviewListWidget.setColumnCount(2)
+ self.PreviewListWidget.setColumnCount(1)
self.PreviewListWidget.horizontalHeader().setVisible(False)
- self.PreviewListWidget.verticalHeader().setVisible(False)
- self.PreviewListWidget.setColumnWidth(1, self.labelWidth)
self.PreviewListWidget.setColumnWidth(
- 1, self.Controller.width() - self.labelWidth)
+ 0, self.Controller.width())
self.PreviewListWidget.isLive = self.isLive
self.PreviewListWidget.setObjectName(u'PreviewListWidget')
self.PreviewListWidget.setSelectionBehavior(1)
@@ -382,8 +376,7 @@ class SlideController(QtGui.QWidget):
"""
width = self.parent.ControlSplitter.sizes()[self.split]
height = width * self.parent.RenderManager.screen_ratio
- self.PreviewListWidget.setColumnWidth(0, self.labelWidth)
- self.PreviewListWidget.setColumnWidth(1, width - self.labelWidth)
+ self.PreviewListWidget.setColumnWidth(0, width)
#Sort out image hights (Songs , bibles excluded)
if self.serviceItem and not self.serviceItem.is_text():
for framenumber, frame in enumerate(self.serviceItem.get_frames()):
@@ -526,20 +519,19 @@ class SlideController(QtGui.QWidget):
self.serviceItem = serviceItem
self.PreviewListWidget.clear()
self.PreviewListWidget.setRowCount(0)
- self.PreviewListWidget.setColumnWidth(0, self.labelWidth)
- self.PreviewListWidget.setColumnWidth(1, width - self.labelWidth)
+ self.PreviewListWidget.setColumnWidth(0, width)
if self.isLive:
self.SongMenu.menu().clear()
row = 0
+ text = []
for framenumber, frame in enumerate(self.serviceItem.get_frames()):
self.PreviewListWidget.setRowCount(
self.PreviewListWidget.rowCount() + 1)
- rowitem = QtGui.QTableWidgetItem()
item = QtGui.QTableWidgetItem()
- slide_height = 0
+ slideHeight = 0
#It is a based Text Render
if self.serviceItem.is_text():
- if self.isLive and frame[u'verseTag'] is not None:
+ if frame[u'verseTag'] is not None:
#only load the slot once
bits = frame[u'verseTag'].split(u':')
tag = None
@@ -553,10 +545,11 @@ class SlideController(QtGui.QWidget):
tag = bits[0]
tag1 = tag
row = bits[0][0:1]
- if tag1 not in self.slideList:
- self.slideList[tag1] = framenumber
- self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag1),
- self.onSongBarHandler)
+ if self.isLive:
+ if tag1 not in self.slideList:
+ self.slideList[tag1] = framenumber
+ self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag1),
+ self.onSongBarHandler)
else:
row += 1
item.setText(frame[u'text'])
@@ -568,20 +561,18 @@ class SlideController(QtGui.QWidget):
self.parent.RenderManager.height)
label.setScaledContents(True)
label.setPixmap(QtGui.QPixmap.fromImage(pixmap))
- self.PreviewListWidget.setCellWidget(framenumber, 1, label)
- slide_height = width * self.parent.RenderManager.screen_ratio
+ self.PreviewListWidget.setCellWidget(framenumber, 0, label)
+ slideHeight = width * self.parent.RenderManager.screen_ratio
row += 1
- rowitem.setText(unicode(row))
- rowitem.setTextAlignment(QtCore.Qt.AlignVCenter)
- self.PreviewListWidget.setItem(framenumber, 0, rowitem)
- self.PreviewListWidget.setItem(framenumber, 1, item)
- if slide_height != 0:
- self.PreviewListWidget.setRowHeight(framenumber, slide_height)
+ text.append(unicode(row))
+ self.PreviewListWidget.setItem(framenumber, 0, item)
+ if slideHeight != 0:
+ self.PreviewListWidget.setRowHeight(framenumber, slideHeight)
+ self.PreviewListWidget.setVerticalHeaderLabels(text)
if self.serviceItem.is_text():
self.PreviewListWidget.resizeRowsToContents()
- self.PreviewListWidget.setColumnWidth(0, self.labelWidth)
- self.PreviewListWidget.setColumnWidth(1,
- self.PreviewListWidget.viewport().size().width() - self.labelWidth)
+ self.PreviewListWidget.setColumnWidth(0,
+ self.PreviewListWidget.viewport().size().width())
if slideno > self.PreviewListWidget.rowCount():
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
else:
@@ -604,16 +595,16 @@ class SlideController(QtGui.QWidget):
data = []
if self.serviceItem:
for framenumber, frame in enumerate(self.serviceItem.get_frames()):
- data_item = {}
+ dataItem = {}
if self.serviceItem.is_text():
- data_item[u'tag'] = unicode(frame[u'verseTag'])
- data_item[u'text'] = unicode(frame[u'text'])
+ dataItem[u'tag'] = unicode(frame[u'verseTag'])
+ dataItem[u'text'] = unicode(frame[u'text'])
else:
- data_item[u'tag'] = unicode(framenumber)
- data_item[u'text'] = u''
- data_item[u'selected'] = \
+ dataItem[u'tag'] = unicode(framenumber)
+ dataItem[u'text'] = u''
+ dataItem[u'selected'] = \
(self.PreviewListWidget.currentRow() == framenumber)
- data.append(data_item)
+ data.append(dataItem)
Receiver.send_message(u'slidecontroller_%s_text_response'
% self.typePrefix, data)
diff --git a/openlp/plugins/bibles/forms/bibleimportwizard.py b/openlp/plugins/bibles/forms/bibleimportwizard.py
index c709dae81..6340144a5 100644
--- a/openlp/plugins/bibles/forms/bibleimportwizard.py
+++ b/openlp/plugins/bibles/forms/bibleimportwizard.py
@@ -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'' + \
- translate('ImportWizardForm', 'Welcome to the Bible Import Wizard') + u'')
+ u'%s' % \
+ 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%')
+
+
diff --git a/openlp/plugins/bibles/forms/importwizardform.py b/openlp/plugins/bibles/forms/importwizardform.py
index f5dbc8ee0..011bf264a 100644
--- a/openlp/plugins/bibles/forms/importwizardform.py
+++ b/openlp/plugins/bibles/forms/importwizardform.py
@@ -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')
+
+
diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py
index 5b49852e5..46a65bc51 100644
--- a/openlp/plugins/bibles/lib/csvbible.py
+++ b/openlp/plugins/bibles/lib/csvbible.py
@@ -118,3 +118,5 @@ class CSVBible(BibleDB):
return False
else:
return success
+
+
diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py
index ea8bd3538..048b569d0 100644
--- a/openlp/plugins/bibles/lib/opensong.py
+++ b/openlp/plugins/bibles/lib/opensong.py
@@ -108,3 +108,5 @@ class OpenSongBible(BibleDB):
return False
else:
return success
+
+
diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py
index 104e2adb8..9763ff24b 100644
--- a/openlp/plugins/bibles/lib/osis.py
+++ b/openlp/plugins/bibles/lib/osis.py
@@ -184,3 +184,5 @@ class OSISBible(BibleDB):
return False
else:
return success
+
+
diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py
index b66f0e215..3c87346cd 100644
--- a/openlp/plugins/remotes/lib/httpserver.py
+++ b/openlp/plugins/remotes/lib/httpserver.py
@@ -314,7 +314,7 @@ class HttpConnection(object):
"""
if not self.socket:
return
- html = self.send_408_timeout()
+ self.send_408_timeout()
self.close()
def disconnected(self):
@@ -334,4 +334,3 @@ class HttpConnection(object):
self.socket.close()
self.socket = None
self.parent.close_connection(self)
-
diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py
index 2c632d90d..bc1679fc9 100644
--- a/openlp/plugins/remotes/remoteplugin.py
+++ b/openlp/plugins/remotes/remoteplugin.py
@@ -25,9 +25,7 @@
import logging
-from PyQt4 import QtNetwork, QtCore
-
-from openlp.core.lib import Plugin, Receiver
+from openlp.core.lib import Plugin
from openlp.plugins.remotes.lib import RemoteTab, HttpServer
log = logging.getLogger(__name__)
diff --git a/openlp/plugins/songs/forms/__init__.py b/openlp/plugins/songs/forms/__init__.py
index f850a3adb..1073b6866 100644
--- a/openlp/plugins/songs/forms/__init__.py
+++ b/openlp/plugins/songs/forms/__init__.py
@@ -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
diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py
index 6d617072d..a6f2f5b56 100644
--- a/openlp/plugins/songs/forms/editsongdialog.py
+++ b/openlp/plugins/songs/forms/editsongdialog.py
@@ -70,8 +70,12 @@ class Ui_EditSongDialog(object):
QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.LyricsLabel.setObjectName(u'LyricsLabel')
self.LyricsTabLayout.addWidget(self.LyricsLabel, 2, 0, 1, 1)
- self.VerseListWidget = QtGui.QListWidget(self.LyricsTab)
- self.VerseListWidget.setSpacing(2)
+ self.VerseListWidget = QtGui.QTableWidget(self.LyricsTab)
+ self.VerseListWidget.setColumnCount(1)
+ self.VerseListWidget.horizontalHeader().setVisible(False)
+ self.VerseListWidget.setSelectionBehavior(1)
+ self.VerseListWidget.setEditTriggers(
+ QtGui.QAbstractItemView.NoEditTriggers)
self.VerseListWidget.setAlternatingRowColors(True)
self.VerseListWidget.setObjectName(u'VerseListWidget')
self.LyricsTabLayout.addWidget(self.VerseListWidget, 2, 1, 1, 1)
diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py
index 4c3f78e2f..abc29ad27 100644
--- a/openlp/plugins/songs/forms/editsongform.py
+++ b/openlp/plugins/songs/forms/editsongform.py
@@ -41,12 +41,14 @@ 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
"""
QtGui.QDialog.__init__(self, parent)
self.parent = parent
+ #can this be automated?
+ self.width = 400
self.setupUi(self)
# Connecting signals and slots
QtCore.QObject.connect(self.AuthorAddButton,
@@ -77,7 +79,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
QtCore.QObject.connect(self.VerseDeleteButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked)
QtCore.QObject.connect(self.VerseListWidget,
- QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
+ QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'),
self.onVerseListViewPressed)
QtCore.QObject.connect(self.SongbookCombo,
QtCore.SIGNAL(u'activated(int)'), self.onSongBookComboChanged)
@@ -106,7 +108,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)
@@ -182,6 +184,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.CommentsEdit.setText(u'')
self.CCLNumberEdit.setText(u'')
self.VerseListWidget.clear()
+ self.VerseListWidget.setRowCount(0)
self.AuthorsListView.clear()
self.TopicsListView.clear()
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason)
@@ -223,6 +226,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
else:
self.CopyrightEditItem.setText(u'')
self.VerseListWidget.clear()
+ self.VerseListWidget.setRowCount(0)
if self.song.verse_order:
self.VerseOrderEdit.setText(self.song.verse_order)
else:
@@ -236,21 +240,30 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
else:
self.CCLNumberEdit.setText(u'')
#lazy xml migration for now
+ self.VerseListWidget.clear()
+ self.VerseListWidget.setRowCount(0)
+ self.VerseListWidget.setColumnWidth(0, self.width)
if self.song.lyrics.startswith(u' -1:
@@ -336,22 +362,26 @@ 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)
- item = QtGui.QListWidgetItem(afterText)
+ item = QtGui.QTableWidgetItem(afterText)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
item.setText(afterText)
- self.VerseListWidget.addItem(item)
+ self.VerseListWidget.setRowCount(
+ self.VerseListWidget.rowCount() + 1)
+ self.VerseListWidget.setItem(int(self.VerseListWidget.rowCount() - 1), 0, item)
+ self.VerseListWidget.setColumnWidth(0, self.width)
+ self.VerseListWidget.resizeRowsToContents()
+ self.tagRows()
def onVerseEditButtonClicked(self):
item = self.VerseListWidget.currentItem()
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)
@@ -361,24 +391,26 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if len(tempText.split(u'\n')) != len(afterText.split(u'\n')):
tempList = {}
tempId = {}
- for row in range(0, self.VerseListWidget.count()):
- tempList[row] = self.VerseListWidget.item(row).text()
- tempId[row] = self.VerseListWidget.item(row).\
+ for row in range(0, self.VerseListWidget.rowCount()):
+ tempList[row] = self.VerseListWidget.item(row, 0).text()
+ tempId[row] = self.VerseListWidget.item(row, 0).\
data(QtCore.Qt.UserRole)
self.VerseListWidget.clear()
for row in range (0, len(tempList)):
- item = QtGui.QListWidgetItem(tempList[row])
+ item = QtGui.QTableWidgetItem(tempList[row], 0)
item.setData(QtCore.Qt.UserRole, tempId[row])
- self.VerseListWidget.addItem(item)
+ self.VerseListWidget.setItem(row, 0, item)
+ self.VerseListWidget.resizeRowsToContents()
self.VerseListWidget.repaint()
self.VerseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False)
+ self.tagRows()
def onVerseEditAllButtonClicked(self):
verse_list = u''
- if self.VerseListWidget.count() > 0:
- for row in range(0, self.VerseListWidget.count()):
- item = self.VerseListWidget.item(row)
+ if self.VerseListWidget.rowCount() > 0:
+ for row in range(0, self.VerseListWidget.rowCount()):
+ item = self.VerseListWidget.item(row, 0)
field = unicode((item.data(QtCore.Qt.UserRole)).toString())
verse_list += u'---[%s]---\n' % field
verse_list += item.text()
@@ -390,6 +422,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
verse_list = self.verse_form.getVerseAll()
verse_list = unicode(verse_list.replace(u'\r\n', u'\n'))
self.VerseListWidget.clear()
+ self.VerseListWidget.setRowCount(0)
for row in self.findVerseSplit.split(verse_list):
for match in row.split(u'---['):
for count, parts in enumerate(match.split(u']---\n')):
@@ -401,13 +434,20 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
else:
if parts.endswith(u'\n'):
parts = parts.rstrip(u'\n')
- item = QtGui.QListWidgetItem(parts)
- item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
- self.VerseListWidget.addItem(item)
- self.VerseListWidget.repaint()
+ item = QtGui.QTableWidgetItem(parts)
+ item.setData(
+ QtCore.Qt.UserRole, QtCore.QVariant(variant))
+ self.VerseListWidget.setRowCount(
+ self.VerseListWidget.rowCount() + 1)
+ self.VerseListWidget.setItem(
+ int(self.VerseListWidget.rowCount() - 1), 0, item)
+ self.VerseListWidget.setColumnWidth(0, self.width)
+ self.VerseListWidget.resizeRowsToContents()
+ self.VerseListWidget.repaint()
+ self.tagRows()
def onVerseDeleteButtonClicked(self):
- self.VerseListWidget.takeItem(self.VerseListWidget.currentRow())
+ self.VerseListWidget.removeRow(self.VerseListWidget.currentRow())
self.VerseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False)
@@ -422,12 +462,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.SongTabWidget.setCurrentIndex(0)
self.TitleEditItem.setFocus()
return False, self.trUtf8('You need to enter a song title.')
- if self.VerseListWidget.count() == 0:
+ if self.VerseListWidget.rowCount() == 0:
self.SongTabWidget.setCurrentIndex(0)
self.VerseListWidget.setFocus()
return False, self.trUtf8('You need to enter some verses.')
if self.AuthorsListView.count() == 0:
- self.SongTabWidget.setCurrentIndex(2)
+ self.SongTabWidget.setCurrentIndex(1)
self.AuthorsListView.setFocus()
#split the verse list by space and mark lower case for testing
taglist = unicode(self.trUtf8(' bitped'))
@@ -480,6 +520,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.loadTopics()
def onPreview(self, button):
+ """
+ Save and Preview button pressed.
+ The Song is valid so as the plugin to add it to preview to see.
+ """
log.debug(u'onPreview')
if button.text() == unicode(self.trUtf8('Save && Preview')) \
and self.saveSong():
@@ -521,12 +565,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
sxml.new_document()
sxml.add_lyrics_to_song()
text = u' '
- for i in range (0, self.VerseListWidget.count()):
- item = self.VerseListWidget.item(i)
+ for i in range (0, self.VerseListWidget.rowCount()):
+ item = self.VerseListWidget.item(i, 0)
verseId = unicode((item.data(QtCore.Qt.UserRole)).toString())
bits = verseId.split(u':')
sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text()))
- text = text + unicode(self.VerseListWidget.item(i).text()) + u' '
+ text = text + unicode(self.VerseListWidget.item(i, 0).text()) + u' '
text = text.replace(u'\'', u'')
text = text.replace(u',', u'')
text = text.replace(u';', u'')
@@ -556,3 +600,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)
+
+
diff --git a/openlp/plugins/songs/forms/editversedialog.py b/openlp/plugins/songs/forms/editversedialog.py
index 201f06cc7..d7a059215 100644
--- a/openlp/plugins/songs/forms/editversedialog.py
+++ b/openlp/plugins/songs/forms/editversedialog.py
@@ -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'))
+
diff --git a/openlp/plugins/songs/forms/editverseform.py b/openlp/plugins/songs/forms/editverseform.py
index d412e3627..6dbe21cea 100644
--- a/openlp/plugins/songs/forms/editverseform.py
+++ b/openlp/plugins/songs/forms/editverseform.py
@@ -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)
+
diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py
new file mode 100644
index 000000000..ff6b416c6
--- /dev/null
+++ b/openlp/plugins/songs/forms/songimportform.py
@@ -0,0 +1,248 @@
+# -*- 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 logging
+
+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')
diff --git a/openlp/plugins/songs/forms/songimportwizard.py b/openlp/plugins/songs/forms/songimportwizard.py
new file mode 100644
index 000000000..d0c8d9d92
--- /dev/null
+++ b/openlp/plugins/songs/forms/songimportwizard.py
@@ -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(
+ '%s' % \
+ 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%'))
+
diff --git a/openlp/plugins/songs/lib/manager.py b/openlp/plugins/songs/lib/manager.py
index dc275cc98..7147f4d79 100644
--- a/openlp/plugins/songs/lib/manager.py
+++ b/openlp/plugins/songs/lib/manager.py
@@ -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.
diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py
index 040a6b26f..0a2d29b14 100644
--- a/openlp/plugins/songs/lib/mediaitem.py
+++ b/openlp/plugins/songs/lib/mediaitem.py
@@ -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'
+
+
+
+
+
+
+
+ """
+ def __init__(self, song=None):
+ if song:
+ if song.lyrics.startswith(u'' % \
+ (verse[u'type'], verse[u'label'], verse[u'text'])
+ lyrics_output = lyrics_output + \
+ u'%s' % \
+ (language[u'language'], verse_output)
+ song_output = u'' + \
+ u'%s' % lyrics_output
+ return song_output
+
diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py
index af05b4605..ef0aa0949 100644
--- a/openlp/plugins/songs/songsplugin.py
+++ b/openlp/plugins/songs/songsplugin.py
@@ -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('Song Plugin
This plugin allows '
- 'Songs to be managed and displayed.
')
+ about_text = self.trUtf8('Song Plugin
'
+ '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
+
diff --git a/resources/forms/editversedialog.ui b/resources/forms/editversedialog.ui
index e0917f44d..d2f178159 100644
--- a/resources/forms/editversedialog.ui
+++ b/resources/forms/editversedialog.ui
@@ -6,8 +6,8 @@
0
0
- 500
- 521
+ 474
+ 442
@@ -16,174 +16,118 @@
true
-
-
-
- 11
- 1
- 471
- 491
-
+
+
+ 8
-
- -
-
-
-
-
-
-
-
-
- Verse Type
-
-
- Qt::PlainText
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
-
- Intro
-
-
- -
-
- Verse
-
-
- -
-
- Pre-Chorus
-
-
- -
-
- Chorus
-
-
- -
-
- Bridge
-
-
- -
-
- Ending
-
-
- -
-
- Other
-
-
-
-
-
-
- -
-
-
-
-
-
- Number
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
-
-
-
- Bridge
-
-
-
- -
-
+
+ 8
+
+
-
+
+
+ false
+
+
+
+ -
+
+
+ 8
+
+
-
+
+
+ Verse Type:
+
+
+
+ -
+
+
-
Verse
-
-
- -
-
+
+ -
Chorus
-
-
-
-
- -
-
-
-
-
+
+ -
+
+ Bridge
+
+
+ -
Pre-Chorus
-
-
- -
-
+
+ -
Intro
-
-
- -
-
-
- Other
-
-
-
- -
-
+
+ -
Ending
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Save
-
-
-
-
-
+
+ -
+
+ Other
+
+
+
+
+ -
+
+
+ -
+
+
+ Insert
+
+
+
+ :/general/general_add.png:/general/general_add.png
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Save
+
+
+
+
-
+
+
+
- ButtonBox
+ EditButtonBox
accepted()
EditVerseDialog
accept()
@@ -199,7 +143,7 @@
- ButtonBox
+ EditButtonBox
rejected()
EditVerseDialog
reject()
diff --git a/resources/forms/songimportwizard.ui b/resources/forms/songimportwizard.ui
new file mode 100644
index 000000000..6679efb38
--- /dev/null
+++ b/resources/forms/songimportwizard.ui
@@ -0,0 +1,467 @@
+
+
+ SongImportWizard
+
+
+
+ 0
+ 0
+ 550
+ 386
+
+
+
+
+ 166
+ 386
+
+
+
+ Song Import Wizard
+
+
+ true
+
+
+ QWizard::ModernStyle
+
+
+ QWizard::NoBackButtonOnLastPage|QWizard::NoBackButtonOnStartPage
+
+
+
+
+ 8
+
+
+ 0
+
+ -
+
+
+
+ 163
+ 0
+
+
+
+
+ 163
+ 16777215
+
+
+
+
+
+
+ :/wizards/wizard_importsong.bmp
+
+
+
+ -
+
+
+ 8
+
+
-
+
+
+ <!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>
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ 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.
+
+
+ true
+
+
+ 10
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
+ Select Import Source
+
+
+ Select the import format, and where to import from.
+
+
+
+ 8
+
+
+ 20
+
+ -
+
+
+ 8
+
+
-
+
+
+ Format:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
-
+
+ OpenLyrics
+
+
+ -
+
+ OpenSong
+
+
+ -
+
+ CCLI
+
+
+ -
+
+ CSV
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ 3
+
+
+
+
+ 8
+
+
+ 0
+
+
-
+
+
+ -
+
+
+ 8
+
+
-
+
+
+ Add Files...
+
+
+
+ :/general/general_open.png:/general/general_open.png
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Remove File(s)
+
+
+
+ :/general/general_delete.png:/general/general_delete.png
+
+
+
+
+
+
+
+
+
+
+ 8
+
+
+ 0
+
+ -
+
+
+ -
+
+
+ 8
+
+
-
+
+
+ Add Files...
+
+
+
+ :/general/general_open.png:/general/general_open.png
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Remove File(s)
+
+
+
+ :/general/general_delete.png:/general/general_delete.png
+
+
+
+
+
+
+
+
+
+
+ 8
+
+
+ 0
+
+ -
+
+
+ -
+
+
+ 8
+
+
-
+
+
+ Add Files...
+
+
+
+ :/general/general_open.png:/general/general_open.png
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Remove File(s)
+
+
+
+ :/general/general_delete.png:/general/general_delete.png
+
+
+
+
+
+
+
+
+
+
+ 8
+
+
+ 8
+
+
+ 0
+
+ -
+
+
+ Filename:
+
+
+
+ -
+
+
+ 8
+
+
-
+
+
+ -
+
+
+ Browse...
+
+
+
+ :/general/general_open.png:/general/general_open.png
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Importing
+
+
+ Please wait while your songs are imported.
+
+
+
+ 8
+
+
+ 50
+
+ -
+
+
+ Ready.
+
+
+
+ -
+
+
+ 0
+
+
+ false
+
+
+ %p
+
+
+
+
+
+
+
+
+
+
+
+ FormatComboBox
+ currentIndexChanged(int)
+ FormatStackedWidget
+ setCurrentIndex(int)
+
+
+ 122
+ 92
+
+
+ 274
+ 222
+
+
+
+
+
diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc
index 98de90f09..49309b8d5 100644
--- a/resources/images/openlp-2.qrc
+++ b/resources/images/openlp-2.qrc
@@ -67,6 +67,7 @@
export_move_to_list.png
+ wizard_importsong.bmp
wizard_importbible.bmp
diff --git a/resources/images/wizard_importsong.bmp b/resources/images/wizard_importsong.bmp
new file mode 100644
index 000000000..948422dcc
Binary files /dev/null and b/resources/images/wizard_importsong.bmp differ
diff --git a/scripts/translation_utils.py b/scripts/translation_utils.py
index 0135efeb6..8162b82b3 100755
--- a/scripts/translation_utils.py
+++ b/scripts/translation_utils.py
@@ -49,9 +49,7 @@ translations = [ u"en"
, u"pt_BR"
, u"es"
, u"sv"]
-
-
-
+
def write_file(filename, stringlist):
content = u''
for line in stringlist:
@@ -76,7 +74,6 @@ def main():
help="proceed all options")
(options, args) = parser.parse_args()
- qt_args = []
if options.download:
downloadTranslations()
elif options.prepare: