print changes

This commit is contained in:
Tim Bentley 2011-02-18 17:38:39 +00:00
parent 33a77b72f7
commit e4876cd84c
4 changed files with 234 additions and 209 deletions

View File

@ -44,8 +44,6 @@ class UiStrings(object):
Advanced = translate('OpenLP.Ui', 'Advanced')
AllFiles = translate('OpenLP.Ui', 'All Files')
Authors = translate('OpenLP.Ui', 'Authors')
CopyToHtml = translate('OpenLP.Ui', 'Copy to HTML')
CopyToText = translate('OpenLP.Ui', 'Copy to Text')
CreateService = translate('OpenLP.Ui', 'Create a new service.')
Delete = translate('OpenLP.Ui', '&Delete')
Edit = translate('OpenLP.Ui', '&Edit')

View File

@ -32,6 +32,8 @@ from openlp.core.lib.ui import UiStrings
class Ui_PrintServiceOrderDialog(object):
def setupUi(self, printServiceOrderDialog):
printServiceOrderDialog.setObjectName(u'printServiceOrderDialog')
self.verticalLayout = QtGui.QGridLayout(printServiceOrderDialog)
self.verticalLayout.setObjectName(u'verticalLayout')
self.dialogLayout = QtGui.QGridLayout(printServiceOrderDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.perviewLayout = QtGui.QVBoxLayout()
@ -76,9 +78,6 @@ 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)
@ -94,6 +93,9 @@ class Ui_PrintServiceOrderDialog(object):
spacerItem = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.buttonLayout.addItem(spacerItem)
self.copyHtmlButton = QtGui.QPushButton(printServiceOrderDialog)
self.copyHtmlButton.setObjectName(u'copyHtmlButton')
self.buttonLayout.addWidget(self.copyHtmlButton)
self.copyTextButton = QtGui.QPushButton(printServiceOrderDialog)
self.copyTextButton.setObjectName(u'copyTextButton')
self.buttonLayout.addWidget(self.copyTextButton)
@ -103,7 +105,7 @@ class Ui_PrintServiceOrderDialog(object):
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.dialogLayout.addLayout(self.buttonLayout, 2, 2, 1, 1)
self.zoomButtonLayout = QtGui.QHBoxLayout()
self.zoomButtonLayout.setObjectName(u'zoomButtonLayout')
spacerItem = QtGui.QSpacerItem(40, 20,
@ -134,14 +136,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.copyTextButton.setText(translate('OpenLP.ServiceManager',
'Copy to Clipboard as Text'))
self.copyHtmlButton.setText(translate('OpenLP.ServiceManager',
'Copy to Clipboard as Html'))
self.printButton.setText(translate('OpenLP.ServiceManager', 'Print'))
self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel'))
self.customNotesLabel.setText(

View File

@ -53,10 +53,6 @@ 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,
@ -82,8 +78,8 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
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)
QtCore.QObject.connect(self.copyHtmlButton,
QtCore.SIGNAL(u'clicked()'), self.copyHtmlText)
self.updatePreviewText()
def updatePreviewText(self):
@ -150,11 +146,18 @@ 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:
"""
Copies the display text to the clipboard as plain text
"""
self.parent.clipboard.setText(self.document.toPlainText())
self.accept()
def copyHtmlText(self):
"""
Copies the display text to the clipboard as Html
"""
self.parent.clipboard.setText(self.document.toHtml())
def printServiceOrder(self):
"""
@ -200,8 +203,6 @@ 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)

View File

@ -7,13 +7,22 @@
<x>0</x>
<y>0</y>
<width>494</width>
<height>426</height>
<height>434</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>4</x>
<y>4</y>
<width>491</width>
<height>432</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="dialogLayout">
<item row="0" column="3">
@ -91,37 +100,6 @@
</item>
</layout>
</item>
<item row="1" column="3">
<layout class="QHBoxLayout" name="buttonLayout">
<item>
<spacer name="spacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="printButton">
<property name="text">
<string>Print</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="zoomButtonLayout">
<item>
@ -190,14 +168,60 @@
<height>0</height>
</size>
</property>
<zorder>spacer_3</zorder>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="buttonLayout">
<item>
<spacer name="spacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton_3">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton_2">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="printButton">
<property name="text">
<string>Print</string>
</property>
</widget>
</item>
</layout>
<zorder></zorder>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="../images/openlp-2.qrc"/>