forked from openlp/openlp
Finish Print dialog updates
This commit is contained in:
parent
4c0928699d
commit
f980d1e0b9
@ -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'))
|
||||
|
@ -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', '<b>Preview:</b>'))
|
||||
translate('OpenLP.PrintServiceOrderForm', '<b>Preview:</b>'))
|
||||
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(
|
||||
|
@ -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'<p>' + slide[u'html'] + u'</p>'
|
||||
if not verse:
|
||||
text += u'<p>' + slide[u'html']
|
||||
verse = slide[u'verseTag']
|
||||
elif verse != slide[u'verseTag']:
|
||||
text += u'<\p><p>' + slide[u'html']
|
||||
verse = slide[u'verseTag']
|
||||
else:
|
||||
text += u'<br/>' + slide[u'html']
|
||||
text += u'</p>'
|
||||
elif item.is_image():
|
||||
# Add the image names of the service item.
|
||||
text += u'<ol>'
|
||||
@ -121,7 +140,6 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
|
||||
u'Custom Service Notes:'), self.customNoteEdit.toPlainText())
|
||||
self.document.setHtml(text)
|
||||
self.previewWidget.updatePreview()
|
||||
self.parent.clipboard.setText(text)
|
||||
|
||||
def paintRequested(self, printer):
|
||||
"""
|
||||
@ -132,6 +150,13 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
|
||||
"""
|
||||
self.document.print_(printer)
|
||||
|
||||
def copyText(self):
|
||||
if self.copyMetaDataCheckBox.isChecked():
|
||||
self.parent.clipboard.setText(self.document.toHtml())
|
||||
else:
|
||||
self.parent.clipboard.setText(self.document.toPlainText())
|
||||
self.accept()
|
||||
|
||||
def printServiceOrder(self):
|
||||
"""
|
||||
Called, when the *printButton* is clicked. Opens the *printDialog*.
|
||||
@ -154,6 +179,16 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
|
||||
"""
|
||||
self.previewWidget.zoomOut()
|
||||
|
||||
def updateTextFormat(self, value):
|
||||
"""
|
||||
Called when html copy check box is selected.
|
||||
"""
|
||||
if value == QtCore.Qt.Checked:
|
||||
self.copyTextButton.setText(UiStrings.CopyToHtml)
|
||||
else:
|
||||
self.copyTextButton.setText(UiStrings.CopyToText)
|
||||
|
||||
|
||||
def accept(self):
|
||||
"""
|
||||
Save the settings and close the dialog.
|
||||
@ -167,6 +202,8 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
|
||||
QtCore.QVariant(self.printMetaDataCheckBox.isChecked()))
|
||||
settings.setValue(u'print notes',
|
||||
QtCore.QVariant(self.printNotesCheckBox.isChecked()))
|
||||
settings.setValue(u'html copy',
|
||||
QtCore.QVariant(self.copyMetaDataCheckBox.isChecked()))
|
||||
settings.endGroup()
|
||||
# Close the dialog.
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
Loading…
Reference in New Issue
Block a user