Print Dialog complete

This commit is contained in:
Tim Bentley 2011-02-19 20:23:23 +00:00
parent b5e369ba4d
commit 282c81326c
2 changed files with 34 additions and 42 deletions

View File

@ -59,7 +59,8 @@ class Ui_PrintServiceDialog(object):
self.printButton = self.toolbar.addAction(
QtGui.QIcon(build_icon(u':/general/general_print.png')), 'Print')
self.optionsButton = QtGui.QToolButton(self.toolbar)
self.optionsButton.setText(u'Options')
self.optionsButton.setText(translate('OpenLP.PrintServiceForm',
'Options'))
self.optionsButton.setToolButtonStyle(
QtCore.Qt.ToolButtonTextBesideIcon)
self.optionsButton.setIcon(QtGui.QIcon(
@ -68,38 +69,41 @@ class Ui_PrintServiceDialog(object):
self.toolbar.addWidget(self.optionsButton)
self.closeButton = self.toolbar.addAction(
QtGui.QIcon(build_icon(u':/system/system_close.png')),
'Close')
translate('OpenLP.PrintServiceForm', 'Close'))
self.toolbar.addSeparator()
self.plainCopy = self.toolbar.addAction(
QtGui.QIcon(build_icon(u':/system/system_edit_copy.png')),
'Copy')
translate('OpenLP.PrintServiceForm', 'Copy'))
self.htmlCopy = self.toolbar.addAction(
QtGui.QIcon(build_icon(u':/system/system_edit_copy.png')),
'Copy as HTML')
translate('OpenLP.PrintServiceForm', 'Copy as HTML'))
self.toolbar.addSeparator()
self.zoomInButton = QtGui.QToolButton(self.toolbar)
self.zoomInButton.setIcon(QtGui.QIcon(
build_icon(u':/general/general_zoom_in.png')))
self.zoomInButton.setToolTip(u'Zoom In')
self.zoomInButton.setToolTip(translate('OpenLP.PrintServiceForm',
'Zoom In'))
self.zoomInButton.setObjectName(u'zoomInButton')
self.zoomInButton.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoomInButton)
self.zoomOutButton = QtGui.QToolButton(self.toolbar)
self.zoomOutButton.setIcon(QtGui.QIcon(
build_icon(u':/general/general_zoom_out.png')))
self.zoomOutButton.setToolTip(u'Zoom Out')
self.zoomOutButton.setToolTip(translate('OpenLP.PrintServiceForm',
'Zoom Out'))
self.zoomOutButton.setObjectName(u'zoomOutButton')
self.zoomOutButton.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoomOutButton)
self.zoomOriginalButton = QtGui.QToolButton(self.toolbar)
self.zoomOriginalButton.setIcon(QtGui.QIcon(
build_icon(u':/general/general_zoom_original.png')))
self.zoomOriginalButton.setToolTip(u'Zoom Original')
self.zoomOriginalButton.setToolTip(translate('OpenLP.PrintServiceForm',
'Zoom Original'))
self.zoomOriginalButton.setObjectName(u'zoomOriginalButton')
self.zoomOriginalButton.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoomOriginalButton)
self.zoomComboBox = QtGui.QComboBox(printServiceDialog)
self.zoomComboBox.setObjectName((u'zoomComboBox'))
self.zoomComboBox.setObjectName(u'zoomComboBox')
self.toolbar.addWidget(self.zoomComboBox)
self.mainLayout.addWidget(self.toolbar)
self.previewWidget = QtGui.QPrintPreviewWidget(printServiceDialog)
@ -111,7 +115,7 @@ class Ui_PrintServiceDialog(object):
self.optionsLayout = QtGui.QVBoxLayout(self.optionsWidget)
self.optionsLayout.setContentsMargins(8, 8, 8, 8)
self.titleLabel = QtGui.QLabel(self.optionsWidget)
self.titleLabel.setObjectName((u'titleLabel'))
self.titleLabel.setObjectName(u'titleLabel')
self.titleLabel.setText(u'Title:')
self.optionsLayout.addWidget(self.titleLabel)
self.titleLineEdit = QtGui.QLineEdit(self.optionsWidget)
@ -121,10 +125,11 @@ class Ui_PrintServiceDialog(object):
self.footerLabel.setObjectName(u'footerLabel')
self.footerLabel.setText(u'Custom Footer Text:')
self.optionsLayout.addWidget(self.footerLabel)
self.footerTextEdit = QtGui.QTextEdit(self.optionsWidget)
self.footerTextEdit = SpellTextEdit(self.optionsWidget)
self.footerTextEdit.setObjectName(u'footerTextEdit')
self.optionsLayout.addWidget(self.footerTextEdit)
self.optionsGroupBox = QtGui.QGroupBox(u'Other Options')
self.optionsGroupBox = QtGui.QGroupBox(
translate('OpenLP.PrintServiceForm','Other Options'))
self.groupLayout = QtGui.QVBoxLayout()
self.slideTextCheckBox = QtGui.QCheckBox()
self.groupLayout.addWidget(self.slideTextCheckBox)
@ -150,22 +155,11 @@ class Ui_PrintServiceDialog(object):
'Include service item notes'))
self.metaDataCheckBox.setText(translate('OpenLP.PrintServiceForm',
'Include play length of media items'))
self.titleLineEdit.setText(translate('OpenLP.PrintServiceForm',
'Service Order Sheet'))
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Page])
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Width])
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.OneHundred])
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.SeventyFive])
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Fifty])
self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.TwentyFive])
# self.serviceTitleLabel.setText(translate(
# 'OpenLP.PrintServiceOrderForm', 'Title:'))
# self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager',
# 'Service Order Sheet'))
# 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(
# translate('OpenLP.ServiceManager', '<b>Custom Service Notes:</b>'))

View File

@ -43,6 +43,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
self.printer = QtGui.QPrinter()
self.printDialog = QtGui.QPrintDialog(self.printer, self)
self.document = QtGui.QTextDocument()
self.zoom = 0
self.setupUi(self)
# Load the settings for the dialog.
settings = QtCore.QSettings()
@ -53,6 +54,8 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
u'print file meta data', QtCore.QVariant(False)).toBool())
self.notesCheckBox.setChecked(settings.value(
u'print notes', QtCore.QVariant(False)).toBool())
self.zoomComboBox.setCurrentIndex(settings.value(
u'display size', QtCore.QVariant(0)).toInt()[0])
settings.endGroup()
# Signals
QtCore.QObject.connect(self.printButton,
@ -69,23 +72,10 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested)
QtCore.QObject.connect(self.zoomComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), self.displaySizeChanged)
# QtCore.QObject.connect(self.serviceTitleLineEdit,
# QtCore.SIGNAL(u'textChanged(const QString)'),
# self.updatePreviewText)
# QtCore.QObject.connect(self.slideTextCheckBox,
# QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText)
# QtCore.QObject.connect(self.notesCheckBox,
# QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText)
# QtCore.QObject.connect(self.metaDataCheckBox,
# QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText)
# QtCore.QObject.connect(self.footerTextEdit,
# 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.copyHtmlButton,
# QtCore.SIGNAL(u'clicked()'), self.copyHtmlText)
QtCore.QObject.connect(self.plainCopy,
QtCore.SIGNAL(u'triggered()'), self.copyText)
QtCore.QObject.connect(self.htmlCopy,
QtCore.SIGNAL(u'triggered()'), self.copyHtmlText)
self.updatePreviewText()
def toggleOptions(self, checked):
@ -97,6 +87,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
self.titleLineEdit.setFocus()
else:
self.saveOptions()
self.updatePreviewText()
def updatePreviewText(self):
"""
@ -171,12 +162,16 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
self.previewWidget.fitToWidth()
elif display == ZoomSize.OneHundred:
self.previewWidget.fitToWidth()
self.previewWidget.zoomIn(1)
elif display == ZoomSize.SeventyFive:
self.previewWidget.fitToWidth()
self.previewWidget.zoomIn(0.75)
elif display == ZoomSize.Fifty:
self.previewWidget.fitToWidth()
self.previewWidget.zoomIn(0.5)
elif display == ZoomSize.TwentyFive:
self.previewWidget.fitToWidth()
self.previewWidget.zoomIn(0.25)
settings = QtCore.QSettings()
settings.beginGroup(u'advanced')
settings.setValue(u'display size',QtCore.QVariant(display))
@ -208,18 +203,21 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
Called when *zoomInButton* is clicked.
"""
self.previewWidget.zoomIn()
self.zoom -= 0.1
def zoomOut(self):
"""
Called when *zoomOutButton* is clicked.
"""
self.previewWidget.zoomOut()
self.zoom += 0.1
def zoomOriginal(self):
"""
Called when *zoomOutButton* is clicked.
"""
self.previewWidget.fitInView()
self.previewWidget.zoomIn(1 + self.zoom)
self.zoom = 0
def updateTextFormat(self, value):
"""