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') Advanced = translate('OpenLP.Ui', 'Advanced')
AllFiles = translate('OpenLP.Ui', 'All Files') AllFiles = translate('OpenLP.Ui', 'All Files')
Authors = translate('OpenLP.Ui', 'Authors') 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.') CreateService = translate('OpenLP.Ui', 'Create a new service.')
Delete = translate('OpenLP.Ui', '&Delete') Delete = translate('OpenLP.Ui', '&Delete')
Edit = translate('OpenLP.Ui', '&Edit') Edit = translate('OpenLP.Ui', '&Edit')

View File

@ -32,6 +32,8 @@ from openlp.core.lib.ui import UiStrings
class Ui_PrintServiceOrderDialog(object): class Ui_PrintServiceOrderDialog(object):
def setupUi(self, printServiceOrderDialog): def setupUi(self, printServiceOrderDialog):
printServiceOrderDialog.setObjectName(u'printServiceOrderDialog') printServiceOrderDialog.setObjectName(u'printServiceOrderDialog')
self.verticalLayout = QtGui.QGridLayout(printServiceOrderDialog)
self.verticalLayout.setObjectName(u'verticalLayout')
self.dialogLayout = QtGui.QGridLayout(printServiceOrderDialog) self.dialogLayout = QtGui.QGridLayout(printServiceOrderDialog)
self.dialogLayout.setObjectName(u'dialogLayout') self.dialogLayout.setObjectName(u'dialogLayout')
self.perviewLayout = QtGui.QVBoxLayout() self.perviewLayout = QtGui.QVBoxLayout()
@ -76,9 +78,6 @@ class Ui_PrintServiceOrderDialog(object):
self.printMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog) self.printMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog)
self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox') self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox')
self.settingsLayout.addWidget(self.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, spacerItem = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.settingsLayout.addItem(spacerItem) self.settingsLayout.addItem(spacerItem)
@ -94,6 +93,9 @@ class Ui_PrintServiceOrderDialog(object):
spacerItem = QtGui.QSpacerItem(40, 20, spacerItem = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.buttonLayout.addItem(spacerItem) 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 = QtGui.QPushButton(printServiceOrderDialog)
self.copyTextButton.setObjectName(u'copyTextButton') self.copyTextButton.setObjectName(u'copyTextButton')
self.buttonLayout.addWidget(self.copyTextButton) self.buttonLayout.addWidget(self.copyTextButton)
@ -103,7 +105,7 @@ class Ui_PrintServiceOrderDialog(object):
self.cancelButton = QtGui.QPushButton(printServiceOrderDialog) self.cancelButton = QtGui.QPushButton(printServiceOrderDialog)
self.cancelButton.setObjectName(u'cancelButton') self.cancelButton.setObjectName(u'cancelButton')
self.buttonLayout.addWidget(self.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 = QtGui.QHBoxLayout()
self.zoomButtonLayout.setObjectName(u'zoomButtonLayout') self.zoomButtonLayout.setObjectName(u'zoomButtonLayout')
spacerItem = QtGui.QSpacerItem(40, 20, spacerItem = QtGui.QSpacerItem(40, 20,
@ -134,14 +136,14 @@ class Ui_PrintServiceOrderDialog(object):
self.printMetaDataCheckBox.setText( self.printMetaDataCheckBox.setText(
translate('OpenLP.PrintServiceOrderForm', translate('OpenLP.PrintServiceOrderForm',
'Include play length of media items')) 'Include play length of media items'))
self.copyMetaDataCheckBox.setText(
translate('OpenLP.PrintServiceOrderForm',
'Copy output as HTML'))
self.serviceTitleLabel.setText(translate( self.serviceTitleLabel.setText(translate(
'OpenLP.PrintServiceOrderForm', 'Title:')) 'OpenLP.PrintServiceOrderForm', 'Title:'))
self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager', self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager',
'Service Order Sheet')) '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.printButton.setText(translate('OpenLP.ServiceManager', 'Print'))
self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel')) self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel'))
self.customNotesLabel.setText( self.customNotesLabel.setText(

View File

@ -53,10 +53,6 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
u'print file meta data', QtCore.QVariant(False)).toBool()) u'print file meta data', QtCore.QVariant(False)).toBool())
self.printNotesCheckBox.setChecked(settings.value( self.printNotesCheckBox.setChecked(settings.value(
u'print notes', QtCore.QVariant(False)).toBool()) 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() settings.endGroup()
# Signals # Signals
QtCore.QObject.connect(self.printButton, QtCore.QObject.connect(self.printButton,
@ -82,8 +78,8 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
QtCore.SIGNAL(u'clicked()'), self.reject) QtCore.SIGNAL(u'clicked()'), self.reject)
QtCore.QObject.connect(self.copyTextButton, QtCore.QObject.connect(self.copyTextButton,
QtCore.SIGNAL(u'clicked()'), self.copyText) QtCore.SIGNAL(u'clicked()'), self.copyText)
QtCore.QObject.connect(self.copyMetaDataCheckBox, QtCore.QObject.connect(self.copyHtmlButton,
QtCore.SIGNAL(u'stateChanged(int)'), self.updateTextFormat) QtCore.SIGNAL(u'clicked()'), self.copyHtmlText)
self.updatePreviewText() self.updatePreviewText()
def updatePreviewText(self): def updatePreviewText(self):
@ -150,11 +146,18 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
self.document.print_(printer) self.document.print_(printer)
def copyText(self): def copyText(self):
if self.copyMetaDataCheckBox.isChecked(): """
self.parent.clipboard.setText(self.document.toHtml()) Copies the display text to the clipboard as plain text
else: """
self.parent.clipboard.setText(self.document.toPlainText()) 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): def printServiceOrder(self):
""" """
@ -200,8 +203,6 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
QtCore.QVariant(self.printMetaDataCheckBox.isChecked())) QtCore.QVariant(self.printMetaDataCheckBox.isChecked()))
settings.setValue(u'print notes', settings.setValue(u'print notes',
QtCore.QVariant(self.printNotesCheckBox.isChecked())) QtCore.QVariant(self.printNotesCheckBox.isChecked()))
settings.setValue(u'html copy',
QtCore.QVariant(self.copyMetaDataCheckBox.isChecked()))
settings.endGroup() settings.endGroup()
# Close the dialog. # Close the dialog.
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)

View File

@ -7,13 +7,22 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>494</width> <width>494</width>
<height>426</height> <height>434</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </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> <item>
<layout class="QGridLayout" name="dialogLayout"> <layout class="QGridLayout" name="dialogLayout">
<item row="0" column="3"> <item row="0" column="3">
@ -91,37 +100,6 @@
</item> </item>
</layout> </layout>
</item> </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"> <item row="1" column="0">
<layout class="QHBoxLayout" name="zoomButtonLayout"> <layout class="QHBoxLayout" name="zoomButtonLayout">
<item> <item>
@ -190,14 +168,60 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<zorder>spacer_3</zorder>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
</layout> </layout>
</item> </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> </layout>
<zorder></zorder> </item>
</layout>
</widget>
</widget> </widget>
<resources> <resources>
<include location="../images/openlp-2.qrc"/> <include location="../images/openlp-2.qrc"/>