diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 400381b0c..224145a99 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -48,6 +48,8 @@ class UiStrings(object): AllFiles = translate('OpenLP.Ui', 'All Files') Authors = translate('OpenLP.Ui', 'Authors') CreateANew = unicode(translate('OpenLP.Ui', 'Create a new %s.')) + CopyToHtml = translate('OpenLP.Ui', 'Copy to Html') + CopyToText = translate('OpenLP.Ui', 'Copy to Text') Delete = translate('OpenLP.Ui', '&Delete') DeleteSelect = unicode(translate('OpenLP.Ui', 'Delete the selected %s.')) DeleteType = unicode(translate('OpenLP.Ui', 'Delete %s')) diff --git a/openlp/core/ui/printserviceorderdialog.py b/openlp/core/ui/printserviceorderdialog.py index f8db4d1c0..c464a7814 100644 --- a/openlp/core/ui/printserviceorderdialog.py +++ b/openlp/core/ui/printserviceorderdialog.py @@ -27,6 +27,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate, SpellTextEdit +from openlp.core.lib.ui import UiStrings class Ui_PrintServiceOrderDialog(object): def setupUi(self, printServiceOrderDialog): @@ -75,6 +76,9 @@ class Ui_PrintServiceOrderDialog(object): self.printMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog) self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox') self.settingsLayout.addWidget(self.printMetaDataCheckBox) + self.copyMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog) + self.copyMetaDataCheckBox.setObjectName(u'copyMetaDataCheckBox') + self.settingsLayout.addWidget(self.copyMetaDataCheckBox) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.settingsLayout.addItem(spacerItem) @@ -90,12 +94,15 @@ class Ui_PrintServiceOrderDialog(object): spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.buttonLayout.addItem(spacerItem) - self.cancelButton = QtGui.QPushButton(printServiceOrderDialog) - self.cancelButton.setObjectName(u'cancelButton') - self.buttonLayout.addWidget(self.cancelButton) + self.copyTextButton = QtGui.QPushButton(printServiceOrderDialog) + self.copyTextButton.setObjectName(u'copyTextButton') + self.buttonLayout.addWidget(self.copyTextButton) self.printButton = QtGui.QPushButton(printServiceOrderDialog) self.printButton.setObjectName(u'printButton') self.buttonLayout.addWidget(self.printButton) + self.cancelButton = QtGui.QPushButton(printServiceOrderDialog) + self.cancelButton.setObjectName(u'cancelButton') + self.buttonLayout.addWidget(self.cancelButton) self.dialogLayout.addLayout(self.buttonLayout, 1, 3, 1, 1) self.zoomButtonLayout = QtGui.QHBoxLayout() self.zoomButtonLayout.setObjectName(u'zoomButtonLayout') @@ -119,7 +126,7 @@ class Ui_PrintServiceOrderDialog(object): printServiceOrderDialog.setWindowTitle( translate('OpenLP.PrintServiceOrderForm', 'Print Service Order')) self.previewLabel.setText( - translate('OpenLP.ServiceManager', 'Preview:')) + translate('OpenLP.PrintServiceOrderForm', 'Preview:')) self.printSlideTextCheckBox.setText(translate( 'OpenLP.PrintServiceOrderForm', 'Include slide text if available')) self.printNotesCheckBox.setText(translate( @@ -127,10 +134,14 @@ class Ui_PrintServiceOrderDialog(object): self.printMetaDataCheckBox.setText( translate('OpenLP.PrintServiceOrderForm', 'Include play length of media items')) + self.copyMetaDataCheckBox.setText( + translate('OpenLP.PrintServiceOrderForm', + 'Copy output as HTML')) self.serviceTitleLabel.setText(translate( 'OpenLP.PrintServiceOrderForm', 'Title:')) self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager', 'Service Order Sheet')) + self.copyTextButton.setText(UiStrings.CopyToText) self.printButton.setText(translate('OpenLP.ServiceManager', 'Print')) self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel')) self.customNotesLabel.setText( diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index cad654280..78ff34e1c 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -29,9 +29,11 @@ import os from PyQt4 import QtCore, QtGui from openlp.core.lib import translate +from openlp.core.lib.ui import UiStrings from openlp.core.ui.printserviceorderdialog import Ui_PrintServiceOrderDialog class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): + def __init__(self, parent, serviceManager): """ Constructor @@ -52,6 +54,10 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): u'print file meta data', QtCore.QVariant(False)).toBool()) self.printNotesCheckBox.setChecked(settings.value( u'print notes', QtCore.QVariant(False)).toBool()) + self.copyMetaDataCheckBox.setChecked(settings.value( + u'html copy', QtCore.QVariant(False)).toBool()) + if self.copyMetaDataCheckBox.isChecked(): + self.copyTextButton.setText(UiStrings.CopyToHtml) settings.endGroup() # Signals QtCore.QObject.connect(self.printButton, @@ -75,6 +81,10 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): QtCore.SIGNAL(u'textChanged()'), self.updatePreviewText) QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL(u'clicked()'), self.reject) + QtCore.QObject.connect(self.copyTextButton, + QtCore.SIGNAL(u'clicked()'), self.copyText) + QtCore.QObject.connect(self.copyMetaDataCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), self.updateTextFormat) self.updatePreviewText() def updatePreviewText(self): @@ -93,8 +103,17 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): if self.printSlideTextCheckBox.isChecked(): if item.is_text(): # Add the text of the service item. + verse = None for slide in item.get_frames(): - text += u'
' + slide[u'html'] + u'
' + if not verse: + text += u'' + slide[u'html'] + verse = slide[u'verseTag'] + elif verse != slide[u'verseTag']: + text += u'<\p>
' + slide[u'html']
+ verse = slide[u'verseTag']
+ else:
+ text += u'
' + slide[u'html']
+ text += u'