forked from openlp/openlp
- Removed the error dialog when there are no service items in the service (as suggested by superfly)
- Added the ability to include the "playing time" of media items - Moved settings from advanced tab to the dialog - Added a dialog with preview function. It provides the following settings: a) print text (slides) b) print notes c) print playing time (when the user actually prints the service, the settings are saved.) - Ability to enter Custom Service Notes. bzr-revno: 1277
This commit is contained in:
commit
560b3afd41
@ -80,16 +80,6 @@ class AdvancedTab(SettingsTab):
|
|||||||
self.hideMouseCheckBox.setObjectName(u'hideMouseCheckBox')
|
self.hideMouseCheckBox.setObjectName(u'hideMouseCheckBox')
|
||||||
self.hideMouseLayout.addWidget(self.hideMouseCheckBox)
|
self.hideMouseLayout.addWidget(self.hideMouseCheckBox)
|
||||||
self.leftLayout.addWidget(self.hideMouseGroupBox)
|
self.leftLayout.addWidget(self.hideMouseGroupBox)
|
||||||
self.serviceOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
|
|
||||||
self.serviceOrderGroupBox.setObjectName(u'serviceOrderGroupBox')
|
|
||||||
self.serviceOrderLayout = QtGui.QVBoxLayout(self.serviceOrderGroupBox)
|
|
||||||
self.serviceOrderLayout.setObjectName(u'serviceOrderLayout')
|
|
||||||
self.detailedServicePrintCheckBox = QtGui.QCheckBox(
|
|
||||||
self.serviceOrderGroupBox)
|
|
||||||
self.detailedServicePrintCheckBox.setObjectName(
|
|
||||||
u'detailedServicePrintCheckBox')
|
|
||||||
self.serviceOrderLayout.addWidget(self.detailedServicePrintCheckBox)
|
|
||||||
self.leftLayout.addWidget(self.serviceOrderGroupBox)
|
|
||||||
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftColumn)
|
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||||
# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
|
# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
|
||||||
# self.sharedDirLayout = QtGui.QFormLayout(self.sharedDirGroupBox)
|
# self.sharedDirLayout = QtGui.QFormLayout(self.sharedDirGroupBox)
|
||||||
@ -139,11 +129,6 @@ class AdvancedTab(SettingsTab):
|
|||||||
'Mouse Cursor'))
|
'Mouse Cursor'))
|
||||||
self.hideMouseCheckBox.setText(translate('OpenLP.AdvancedTab',
|
self.hideMouseCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||||
'Hide the mouse cursor when moved over the display window'))
|
'Hide the mouse cursor when moved over the display window'))
|
||||||
self.serviceOrderGroupBox.setTitle(translate('OpenLP.AdvancedTab',
|
|
||||||
'Service Order Print'))
|
|
||||||
self.detailedServicePrintCheckBox.setText(
|
|
||||||
translate('OpenLP.AdvancedTab',
|
|
||||||
'Print slide texts and service item notes as well'))
|
|
||||||
# self.sharedDirGroupBox.setTitle(
|
# self.sharedDirGroupBox.setTitle(
|
||||||
# translate('AdvancedTab', 'Central Data Store'))
|
# translate('AdvancedTab', 'Central Data Store'))
|
||||||
# self.sharedCheckBox.setText(
|
# self.sharedCheckBox.setText(
|
||||||
@ -179,8 +164,6 @@ class AdvancedTab(SettingsTab):
|
|||||||
QtCore.QVariant(True)).toBool())
|
QtCore.QVariant(True)).toBool())
|
||||||
self.hideMouseCheckBox.setChecked(
|
self.hideMouseCheckBox.setChecked(
|
||||||
settings.value(u'hide mouse', QtCore.QVariant(False)).toBool())
|
settings.value(u'hide mouse', QtCore.QVariant(False)).toBool())
|
||||||
self.detailedServicePrintCheckBox.setChecked(settings.value(
|
|
||||||
u'detailed service print', QtCore.QVariant(False)).toBool())
|
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
@ -201,8 +184,6 @@ class AdvancedTab(SettingsTab):
|
|||||||
QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked()))
|
QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked()))
|
||||||
settings.setValue(u'hide mouse',
|
settings.setValue(u'hide mouse',
|
||||||
QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
|
QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
|
||||||
settings.setValue(u'detailed service print',
|
|
||||||
QtCore.QVariant(self.detailedServicePrintCheckBox.isChecked()))
|
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
# def onSharedCheckBoxChanged(self, checked):
|
# def onSharedCheckBoxChanged(self, checked):
|
||||||
|
137
openlp/core/ui/printserviceorderdialog.py
Normal file
137
openlp/core/ui/printserviceorderdialog.py
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||||
|
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||||
|
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||||
|
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||||
|
# Carsten Tinggaard, Frode Woldsund #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# This program is free software; you can redistribute it and/or modify it #
|
||||||
|
# under the terms of the GNU General Public License as published by the Free #
|
||||||
|
# Software Foundation; version 2 of the License. #
|
||||||
|
# #
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||||
|
# more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License along #
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
|
from openlp.core.lib import build_icon, translate, SpellTextEdit
|
||||||
|
|
||||||
|
class Ui_PrintServiceOrderDialog(object):
|
||||||
|
def setupUi(self, printServiceOrderDialog):
|
||||||
|
printServiceOrderDialog.setObjectName(u'printServiceOrderDialog')
|
||||||
|
self.dialogLayout = QtGui.QGridLayout(printServiceOrderDialog)
|
||||||
|
self.dialogLayout.setObjectName(u'dialogLayout')
|
||||||
|
self.perviewLayout = QtGui.QVBoxLayout()
|
||||||
|
self.perviewLayout.setObjectName(u'perviewLayout')
|
||||||
|
self.previewLabel = QtGui.QLabel(printServiceOrderDialog)
|
||||||
|
self.previewLabel.setSizePolicy(
|
||||||
|
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
|
||||||
|
self.previewLabel.setObjectName(u'previewLabel')
|
||||||
|
self.perviewLayout.addWidget(self.previewLabel)
|
||||||
|
self.previewWidget = QtGui.QPrintPreviewWidget(
|
||||||
|
self.printer, self, QtCore.Qt.Widget)
|
||||||
|
self.previewWidget.setEnabled(True)
|
||||||
|
self.previewWidget.setSizePolicy(
|
||||||
|
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
|
||||||
|
self.previewWidget.setObjectName(u'previewWidget')
|
||||||
|
# Give the previewWidget a fixed size, to prevent resizing when clicking
|
||||||
|
# the zoom buttons.
|
||||||
|
self.previewWidget.setFixedWidth(350)
|
||||||
|
self.perviewLayout.addWidget(self.previewWidget)
|
||||||
|
self.dialogLayout.addLayout(self.perviewLayout, 0, 0, 1, 1)
|
||||||
|
self.settingsLayout = QtGui.QVBoxLayout()
|
||||||
|
self.settingsLayout.setObjectName(u'settingsLayout')
|
||||||
|
self.serviceTitleLayout = QtGui.QGridLayout()
|
||||||
|
self.serviceTitleLayout.setObjectName(u'serviceTitleLayout')
|
||||||
|
self.serviceTitleLineEdit = QtGui.QLineEdit(printServiceOrderDialog)
|
||||||
|
self.serviceTitleLineEdit.setSizePolicy(
|
||||||
|
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||||
|
self.serviceTitleLineEdit.setObjectName(u'serviceTitleLineEdit')
|
||||||
|
self.serviceTitleLayout.addWidget(self.serviceTitleLineEdit, 1, 1, 1, 1)
|
||||||
|
self.serviceTitleLabel = QtGui.QLabel(printServiceOrderDialog)
|
||||||
|
self.serviceTitleLabel.setSizePolicy(
|
||||||
|
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
|
||||||
|
self.serviceTitleLabel.setObjectName(u'serviceTitleLabel')
|
||||||
|
self.serviceTitleLayout.addWidget(self.serviceTitleLabel, 1, 0, 1, 1)
|
||||||
|
self.settingsLayout.addLayout(self.serviceTitleLayout)
|
||||||
|
self.printSlideTextCheckBox = QtGui.QCheckBox(printServiceOrderDialog)
|
||||||
|
self.printSlideTextCheckBox.setObjectName(u'printSlideTextCheckBox')
|
||||||
|
self.settingsLayout.addWidget(self.printSlideTextCheckBox)
|
||||||
|
self.printNotesCheckBox = QtGui.QCheckBox(printServiceOrderDialog)
|
||||||
|
self.printNotesCheckBox.setObjectName(u'printNotesCheckBox')
|
||||||
|
self.settingsLayout.addWidget(self.printNotesCheckBox)
|
||||||
|
self.printMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog)
|
||||||
|
self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox')
|
||||||
|
self.settingsLayout.addWidget(self.printMetaDataCheckBox)
|
||||||
|
spacerItem = QtGui.QSpacerItem(20, 40,
|
||||||
|
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||||
|
self.settingsLayout.addItem(spacerItem)
|
||||||
|
self.customNotesLabel = QtGui.QLabel(self)
|
||||||
|
self.customNotesLabel.setObjectName(u'customNotesLabel')
|
||||||
|
self.settingsLayout.addWidget(self.customNotesLabel)
|
||||||
|
self.customNoteEdit = SpellTextEdit(self)
|
||||||
|
self.customNoteEdit.setObjectName(u'customNoteEdit')
|
||||||
|
self.settingsLayout.addWidget(self.customNoteEdit)
|
||||||
|
self.dialogLayout.addLayout(self.settingsLayout, 0, 3, 1, 1)
|
||||||
|
self.buttonLayout = QtGui.QHBoxLayout()
|
||||||
|
self.buttonLayout.setObjectName(u'buttonLayout')
|
||||||
|
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.printButton = QtGui.QPushButton(printServiceOrderDialog)
|
||||||
|
self.printButton.setObjectName(u'printButton')
|
||||||
|
self.buttonLayout.addWidget(self.printButton)
|
||||||
|
self.dialogLayout.addLayout(self.buttonLayout, 1, 3, 1, 1)
|
||||||
|
self.zoomButtonLayout = QtGui.QHBoxLayout()
|
||||||
|
self.zoomButtonLayout.setObjectName(u'zoomButtonLayout')
|
||||||
|
spacerItem = QtGui.QSpacerItem(40, 20,
|
||||||
|
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||||
|
self.zoomButtonLayout.addItem(spacerItem)
|
||||||
|
self.zoomOutButton = QtGui.QToolButton(printServiceOrderDialog)
|
||||||
|
self.zoomOutButton.setIcon(
|
||||||
|
build_icon(u':/general/general_zoom_out.png'))
|
||||||
|
self.zoomOutButton.setObjectName(u'zoomOutButton')
|
||||||
|
self.zoomButtonLayout.addWidget(self.zoomOutButton)
|
||||||
|
self.zoomInButton = QtGui.QToolButton(printServiceOrderDialog)
|
||||||
|
self.zoomInButton.setIcon(build_icon(u':/general/general_zoom_in.png'))
|
||||||
|
self.zoomInButton.setObjectName(u'zoomInButton')
|
||||||
|
self.zoomButtonLayout.addWidget(self.zoomInButton)
|
||||||
|
self.dialogLayout.addLayout(self.zoomButtonLayout, 1, 0, 1, 1)
|
||||||
|
self.retranslateUi(printServiceOrderDialog)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(printServiceOrderDialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, printServiceOrderDialog):
|
||||||
|
printServiceOrderDialog.setWindowTitle(
|
||||||
|
translate('OpenLP.PrintServiceOrderForm', 'Print Service Order'))
|
||||||
|
self.previewLabel.setText(
|
||||||
|
translate('OpenLP.ServiceManager', '<b>Preview:</b>'))
|
||||||
|
self.printSlideTextCheckBox.setText(translate(
|
||||||
|
'OpenLP.PrintServiceOrderForm', 'Include slide text if available'))
|
||||||
|
self.printNotesCheckBox.setText(translate(
|
||||||
|
'OpenLP.PrintServiceOrderForm', 'Include service item notes'))
|
||||||
|
self.printMetaDataCheckBox.setText(
|
||||||
|
translate('OpenLP.PrintServiceOrderForm',
|
||||||
|
'Include play length of media items'))
|
||||||
|
self.serviceTitleLabel.setText(translate(
|
||||||
|
'OpenLP.PrintServiceOrderForm', 'Title:'))
|
||||||
|
self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager',
|
||||||
|
'Service Order Sheet'))
|
||||||
|
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>'))
|
184
openlp/core/ui/printserviceorderform.py
Normal file
184
openlp/core/ui/printserviceorderform.py
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||||
|
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||||
|
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||||
|
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||||
|
# Carsten Tinggaard, Frode Woldsund #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# This program is free software; you can redistribute it and/or modify it #
|
||||||
|
# under the terms of the GNU General Public License as published by the Free #
|
||||||
|
# Software Foundation; version 2 of the License. #
|
||||||
|
# #
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||||
|
# more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License along #
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
|
###############################################################################
|
||||||
|
import datetime
|
||||||
|
import mutagen
|
||||||
|
import os
|
||||||
|
|
||||||
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
|
from openlp.core.lib import translate
|
||||||
|
from openlp.core.ui.printserviceorderdialog import Ui_PrintServiceOrderDialog
|
||||||
|
|
||||||
|
class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
|
||||||
|
def __init__(self, parent, serviceManager):
|
||||||
|
"""
|
||||||
|
Constructor
|
||||||
|
"""
|
||||||
|
QtGui.QDialog.__init__(self, parent)
|
||||||
|
self.serviceManager = serviceManager
|
||||||
|
self.printer = QtGui.QPrinter()
|
||||||
|
self.printDialog = QtGui.QPrintDialog(self.printer, self)
|
||||||
|
self.document = QtGui.QTextDocument()
|
||||||
|
self.setupUi(self)
|
||||||
|
# Load the settings for the dialog.
|
||||||
|
settings = QtCore.QSettings()
|
||||||
|
settings.beginGroup(u'advanced')
|
||||||
|
self.printSlideTextCheckBox.setChecked(settings.value(
|
||||||
|
u'print slide text', QtCore.QVariant(False)).toBool())
|
||||||
|
self.printMetaDataCheckBox.setChecked(settings.value(
|
||||||
|
u'print file meta data', QtCore.QVariant(False)).toBool())
|
||||||
|
self.printNotesCheckBox.setChecked(settings.value(
|
||||||
|
u'print notes', QtCore.QVariant(False)).toBool())
|
||||||
|
settings.endGroup()
|
||||||
|
# Signals
|
||||||
|
QtCore.QObject.connect(self.printButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'), self.printServiceOrder)
|
||||||
|
QtCore.QObject.connect(self.zoomOutButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'), self.zoomOut)
|
||||||
|
QtCore.QObject.connect(self.zoomInButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'), self.zoomIn)
|
||||||
|
QtCore.QObject.connect(self.previewWidget,
|
||||||
|
QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested)
|
||||||
|
QtCore.QObject.connect(self.serviceTitleLineEdit,
|
||||||
|
QtCore.SIGNAL(u'textChanged(const QString)'),
|
||||||
|
self.updatePreviewText)
|
||||||
|
QtCore.QObject.connect(self.printSlideTextCheckBox,
|
||||||
|
QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText)
|
||||||
|
QtCore.QObject.connect(self.printNotesCheckBox,
|
||||||
|
QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText)
|
||||||
|
QtCore.QObject.connect(self.printMetaDataCheckBox,
|
||||||
|
QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText)
|
||||||
|
QtCore.QObject.connect(self.customNoteEdit,
|
||||||
|
QtCore.SIGNAL(u'textChanged()'), self.updatePreviewText)
|
||||||
|
QtCore.QObject.connect(self.cancelButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'), self.reject)
|
||||||
|
self.updatePreviewText()
|
||||||
|
|
||||||
|
def updatePreviewText(self):
|
||||||
|
"""
|
||||||
|
Creates the html text and updates the html of *self.document*.
|
||||||
|
"""
|
||||||
|
text = u''
|
||||||
|
if self.serviceTitleLineEdit.text():
|
||||||
|
text += u'<h2>%s</h2>' % unicode(self.serviceTitleLineEdit.text())
|
||||||
|
for item in self.serviceManager.serviceItems:
|
||||||
|
item = item[u'service_item']
|
||||||
|
# Add the title of the service item.
|
||||||
|
text += u'<h4><img src="%s" /> %s</h4>' % (item.icon,
|
||||||
|
item.get_display_title())
|
||||||
|
# Add slide text of the service item.
|
||||||
|
if self.printSlideTextCheckBox.isChecked():
|
||||||
|
if item.is_text():
|
||||||
|
# Add the text of the service item.
|
||||||
|
for slide in item.get_frames():
|
||||||
|
text += u'<p>' + slide[u'text'] + u'</p>'
|
||||||
|
elif item.is_image():
|
||||||
|
# Add the image names of the service item.
|
||||||
|
text += u'<ol>'
|
||||||
|
for slide in range(len(item.get_frames())):
|
||||||
|
text += u'<li><p>%s</p></li>' % \
|
||||||
|
item.get_frame_title(slide)
|
||||||
|
text += u'</ol>'
|
||||||
|
if item.foot_text:
|
||||||
|
# add footer
|
||||||
|
text += u'<p>%s</p>' % item.foot_text
|
||||||
|
# Add service items' notes.
|
||||||
|
if self.printNotesCheckBox.isChecked():
|
||||||
|
if item.notes:
|
||||||
|
text += u'<p><b>%s</b></p>%s' % (translate(
|
||||||
|
'OpenLP.ServiceManager', 'Notes:'),
|
||||||
|
item.notes.replace(u'\n', u'<br />'))
|
||||||
|
# Add play length of media files.
|
||||||
|
if item.is_media() and self.printMetaDataCheckBox.isChecked():
|
||||||
|
path = os.path.join(item.get_frames()[0][u'path'],
|
||||||
|
item.get_frames()[0][u'title'])
|
||||||
|
if not os.path.isfile(path):
|
||||||
|
continue
|
||||||
|
file = mutagen.File(path)
|
||||||
|
if file is not None:
|
||||||
|
length = int(file.info.length)
|
||||||
|
text += u'<p><b>%s</b> %s</p>' % (translate(
|
||||||
|
'OpenLP.ServiceManager', u'Playing time:'),
|
||||||
|
unicode(datetime.timedelta(seconds=length)))
|
||||||
|
if self.customNoteEdit.toPlainText():
|
||||||
|
text += u'<h4>%s</h4>%s' % (translate('OpenLP.ServiceManager',
|
||||||
|
u'Custom Service Notes:'), self.customNoteEdit.toPlainText())
|
||||||
|
self.document.setHtml(text)
|
||||||
|
self.previewWidget.updatePreview()
|
||||||
|
|
||||||
|
def paintRequested(self, printer):
|
||||||
|
"""
|
||||||
|
Paint the preview of the *self.document*.
|
||||||
|
|
||||||
|
``printer``
|
||||||
|
A *QPrinter* object.
|
||||||
|
"""
|
||||||
|
self.document.print_(printer)
|
||||||
|
|
||||||
|
def printServiceOrder(self):
|
||||||
|
"""
|
||||||
|
Called, when the *printButton* is clicked. Opens the *printDialog*.
|
||||||
|
"""
|
||||||
|
if not self.printDialog.exec_():
|
||||||
|
return
|
||||||
|
# Print the document.
|
||||||
|
self.document.print_(self.printer)
|
||||||
|
self.accept()
|
||||||
|
|
||||||
|
def zoomIn(self):
|
||||||
|
"""
|
||||||
|
Called when *zoomInButton* is clicked.
|
||||||
|
"""
|
||||||
|
self.previewWidget.zoomIn()
|
||||||
|
|
||||||
|
def zoomOut(self):
|
||||||
|
"""
|
||||||
|
Called when *zoomOutButton* is clicked.
|
||||||
|
"""
|
||||||
|
self.previewWidget.zoomOut()
|
||||||
|
|
||||||
|
def accept(self):
|
||||||
|
"""
|
||||||
|
Save the settings and close the dialog.
|
||||||
|
"""
|
||||||
|
# Save the settings for this dialog.
|
||||||
|
settings = QtCore.QSettings()
|
||||||
|
settings.beginGroup(u'advanced')
|
||||||
|
settings.setValue(u'print slide text',
|
||||||
|
QtCore.QVariant(self.printSlideTextCheckBox.isChecked()))
|
||||||
|
settings.setValue(u'print file meta data',
|
||||||
|
QtCore.QVariant(self.printMetaDataCheckBox.isChecked()))
|
||||||
|
settings.setValue(u'print notes',
|
||||||
|
QtCore.QVariant(self.printNotesCheckBox.isChecked()))
|
||||||
|
settings.endGroup()
|
||||||
|
# Close the dialog.
|
||||||
|
return QtGui.QDialog.accept(self)
|
||||||
|
|
||||||
|
def reject(self):
|
||||||
|
"""
|
||||||
|
Close the dialog, do not print the service and do not save the settings.
|
||||||
|
"""
|
||||||
|
return QtGui.QDialog.reject(self)
|
@ -23,10 +23,9 @@
|
|||||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import os
|
|
||||||
import logging
|
|
||||||
import cPickle
|
import cPickle
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -38,6 +37,7 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
|
|||||||
ThemeLevel
|
ThemeLevel
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
|
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
|
||||||
|
from openlp.core.ui.printserviceorderform import PrintServiceOrderForm
|
||||||
from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
|
from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
|
||||||
split_filename
|
split_filename
|
||||||
|
|
||||||
@ -67,8 +67,8 @@ class ServiceManagerList(QtGui.QTreeWidget):
|
|||||||
|
|
||||||
class ServiceManager(QtGui.QWidget):
|
class ServiceManager(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
Manages the services. This involves taking text strings from plugins and
|
Manages the services. This involves taking text strings from plugins and
|
||||||
adding them to the service. This service can then be zipped up with all
|
adding them to the service. This service can then be zipped up with all
|
||||||
the resources used into one OSZ file for use on any OpenLP v2 installation.
|
the resources used into one OSZ file for use on any OpenLP v2 installation.
|
||||||
Also handles the UI tasks of moving things up and down etc.
|
Also handles the UI tasks of moving things up and down etc.
|
||||||
"""
|
"""
|
||||||
@ -391,7 +391,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
return QtGui.QMessageBox.question(self.mainwindow,
|
return QtGui.QMessageBox.question(self.mainwindow,
|
||||||
translate('OpenLP.ServiceManager', 'Modified Service'),
|
translate('OpenLP.ServiceManager', 'Modified Service'),
|
||||||
translate('OpenLP.ServiceManager', 'The current service has '
|
translate('OpenLP.ServiceManager', 'The current service has '
|
||||||
'been modified. Would you like to save this service?'),
|
'been modified. Would you like to save this service?'),
|
||||||
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
|
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
|
||||||
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
|
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
|
||||||
|
|
||||||
@ -1187,41 +1187,5 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Print a Service Order Sheet.
|
Print a Service Order Sheet.
|
||||||
"""
|
"""
|
||||||
if not self.serviceItems:
|
settingDialog = PrintServiceOrderForm(self.mainwindow, self)
|
||||||
critical_error_message_box(
|
settingDialog.exec_()
|
||||||
message=translate('OpenLP.ServiceManager',
|
|
||||||
'There is no service item in this service.'))
|
|
||||||
return
|
|
||||||
printDialog = QtGui.QPrintDialog()
|
|
||||||
if not printDialog.exec_():
|
|
||||||
return
|
|
||||||
text = u'<h2>%s</h2>' % translate('OpenLP.ServiceManager',
|
|
||||||
'Service Order Sheet')
|
|
||||||
for item in self.serviceItems:
|
|
||||||
item = item[u'service_item']
|
|
||||||
# add the title
|
|
||||||
text += u'<h4><img src="%s" /> %s</h4>' % (item.icon,
|
|
||||||
item.get_display_title())
|
|
||||||
if not QtCore.QSettings().value(u'advanced' +
|
|
||||||
u'/detailed service print', QtCore.QVariant(True)).toBool():
|
|
||||||
continue
|
|
||||||
if item.is_text():
|
|
||||||
# Add the text of the service item.
|
|
||||||
for slide in item.get_frames():
|
|
||||||
text += u'<p>' + slide[u'text'] + u'</p>'
|
|
||||||
elif item.is_image():
|
|
||||||
# Add the image names of the service item.
|
|
||||||
text += u'<ol>'
|
|
||||||
for slide in range(len(item.get_frames())):
|
|
||||||
text += u'<li><p>%s</p></li>' % item.get_frame_title(slide)
|
|
||||||
text += u'</ol>'
|
|
||||||
if item.foot_text:
|
|
||||||
# add footer
|
|
||||||
text += u'<p>%s</p>' % item.foot_text
|
|
||||||
if item.notes:
|
|
||||||
# add notes
|
|
||||||
text += u'<p><b>%s</b> %s</p>' % (translate(
|
|
||||||
'OpenLP.ServiceManager', 'Notes:'), item.notes)
|
|
||||||
serviceDocument = QtGui.QTextDocument()
|
|
||||||
serviceDocument.setHtml(text)
|
|
||||||
serviceDocument.print_(printDialog.printer())
|
|
||||||
|
206
resources/forms/printserviceorderdialog.ui
Normal file
206
resources/forms/printserviceorderdialog.ui
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Dialog</class>
|
||||||
|
<widget class="QDialog" name="Dialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>494</width>
|
||||||
|
<height>426</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="dialogLayout">
|
||||||
|
<item row="0" column="3">
|
||||||
|
<layout class="QVBoxLayout" name="settingsLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="serviceTitleLayout">
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="serviceTitleLineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="serviceTitleLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Service Title:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="printSlideTextCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Include slide text if avaialbe</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="printNotesCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Include service item notes</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="printMetaDataCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Include play lenght of media items</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="customNotesLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>Custom Notes:</b></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="customNoteEdit"/>
|
||||||
|
</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>
|
||||||
|
<spacer name="spacer">
|
||||||
|
<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="QToolButton" name="zoomOutButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images/openlp-2.qrc">
|
||||||
|
<normaloff>:/general/general_zoom_out.png</normaloff>:/general/general_zoom_out.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="zoomInButton">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images/openlp-2.qrc">
|
||||||
|
<normaloff>:/general/general_zoom_in.png</normaloff>:/general/general_zoom_in.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="perviewLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="previewLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Preview:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="previewWidget" native="true">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
<zorder></zorder>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../images/openlp-2.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
BIN
resources/images/general_zoom_in.png
Normal file
BIN
resources/images/general_zoom_in.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 716 B |
BIN
resources/images/general_zoom_out.png
Normal file
BIN
resources/images/general_zoom_out.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 662 B |
@ -41,6 +41,8 @@
|
|||||||
<file>general_export.png</file>
|
<file>general_export.png</file>
|
||||||
<file>general_import.png</file>
|
<file>general_import.png</file>
|
||||||
<file>general_new.png</file>
|
<file>general_new.png</file>
|
||||||
|
<file>general_zoom_out.png</file>
|
||||||
|
<file>general_zoom_in.png</file>
|
||||||
<file>general_open.png</file>
|
<file>general_open.png</file>
|
||||||
<file>general_save.png</file>
|
<file>general_save.png</file>
|
||||||
<file>general_email.png</file>
|
<file>general_email.png</file>
|
||||||
|
Loading…
Reference in New Issue
Block a user