forked from openlp/openlp
This commit is contained in:
commit
41312be390
@ -80,20 +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.printSlideTextCheckBox = QtGui.QCheckBox(self.serviceOrderGroupBox)
|
|
||||||
self.printSlideTextCheckBox.setObjectName(u'printSlideTextCheckBox')
|
|
||||||
self.serviceOrderLayout.addWidget(self.printSlideTextCheckBox)
|
|
||||||
self.printMetaDataCheckBox = QtGui.QCheckBox(self.serviceOrderGroupBox)
|
|
||||||
self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox')
|
|
||||||
self.serviceOrderLayout.addWidget(self.printMetaDataCheckBox)
|
|
||||||
self.printNotesCheckBox = QtGui.QCheckBox(self.serviceOrderGroupBox)
|
|
||||||
self.printNotesCheckBox.setObjectName(u'printNotesCheckBox')
|
|
||||||
self.serviceOrderLayout.addWidget(self.printNotesCheckBox)
|
|
||||||
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)
|
||||||
@ -143,14 +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.printSlideTextCheckBox.setText(
|
|
||||||
translate('OpenLP.AdvancedTab', 'Include text slides if available'))
|
|
||||||
self.printMetaDataCheckBox.setText(translate(
|
|
||||||
'OpenLP.AdvancedTab', 'Include playing time of media files'))
|
|
||||||
self.printNotesCheckBox.setText(
|
|
||||||
translate('OpenLP.AdvancedTab', 'Include service item notes'))
|
|
||||||
# self.sharedDirGroupBox.setTitle(
|
# self.sharedDirGroupBox.setTitle(
|
||||||
# translate('AdvancedTab', 'Central Data Store'))
|
# translate('AdvancedTab', 'Central Data Store'))
|
||||||
# self.sharedCheckBox.setText(
|
# self.sharedCheckBox.setText(
|
||||||
@ -186,12 +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.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()
|
settings.endGroup()
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
@ -212,12 +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'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()
|
settings.endGroup()
|
||||||
|
|
||||||
# def onSharedCheckBoxChanged(self, checked):
|
# def onSharedCheckBoxChanged(self, checked):
|
||||||
|
132
openlp/core/ui/printserviceorderform.py
Normal file
132
openlp/core/ui/printserviceorderform.py
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
# -*- 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.lib.ui import save_cancel_button_box
|
||||||
|
|
||||||
|
|
||||||
|
class PrintServiceOrderForm(QtGui.QDialog):
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
"""
|
||||||
|
Constructor
|
||||||
|
"""
|
||||||
|
self.serviceManager = parent
|
||||||
|
QtGui.QDialog.__init__(self, parent)
|
||||||
|
self.setupUi()
|
||||||
|
self.retranslateUi()
|
||||||
|
|
||||||
|
def setupUi(self):
|
||||||
|
self.dialogLayout = QtGui.QHBoxLayout(self)
|
||||||
|
self.dialogLayout.setObjectName(u'dialogLayout')
|
||||||
|
self.verticalLayout = QtGui.QVBoxLayout()
|
||||||
|
self.verticalLayout.setObjectName(u'verticalLayout')
|
||||||
|
self.serviceTitleLayout = QtGui.QHBoxLayout()
|
||||||
|
self.serviceTitleLayout.setObjectName(u'serviceTitleLayout')
|
||||||
|
self.serviceTitleLabel = QtGui.QLabel(self)
|
||||||
|
self.serviceTitleLabel.setObjectName(u'serviceTitleLabel')
|
||||||
|
self.serviceTitleLayout.addWidget(self.serviceTitleLabel)
|
||||||
|
self.serviceTitleLineEdit = QtGui.QLineEdit(self)
|
||||||
|
self.serviceTitleLineEdit.setObjectName(u'serviceTitleLineEdit')
|
||||||
|
self.serviceTitleLayout.addWidget(self.serviceTitleLineEdit)
|
||||||
|
self.verticalLayout.addLayout(self.serviceTitleLayout)
|
||||||
|
self.printSlideTextCheckBox = QtGui.QCheckBox(self)
|
||||||
|
self.printSlideTextCheckBox.setObjectName(u'printSlideTextCheckBox')
|
||||||
|
self.verticalLayout.addWidget(self.printSlideTextCheckBox)
|
||||||
|
self.printNotesCheckBox = QtGui.QCheckBox(self)
|
||||||
|
self.printNotesCheckBox.setObjectName(u'printNotesCheckBox')
|
||||||
|
self.verticalLayout.addWidget(self.printNotesCheckBox)
|
||||||
|
self.metaDataCheckBox = QtGui.QCheckBox(self)
|
||||||
|
self.metaDataCheckBox.setObjectName(u'metaDataCheckBox')
|
||||||
|
self.verticalLayout.addWidget(self.metaDataCheckBox)
|
||||||
|
self.verticalLayout.addWidget(save_cancel_button_box(self))
|
||||||
|
self.dialogLayout.addLayout(self.verticalLayout)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(self)
|
||||||
|
|
||||||
|
def retranslateUi(self):
|
||||||
|
self.setWindowTitle(
|
||||||
|
translate('OpenLP.PrintServiceOrderForm', 'Print Service Order'))
|
||||||
|
self.printSlideTextCheckBox.setText(translate(
|
||||||
|
'OpenLP.PrintServiceOrderForm', 'Include slide text if avaialbe'))
|
||||||
|
self.printNotesCheckBox.setText(translate(
|
||||||
|
'OpenLP.PrintServiceOrderForm', 'Include service item notes'))
|
||||||
|
self.metaDataCheckBox.setText(translate('OpenLP.PrintServiceOrderForm',
|
||||||
|
'Include play lenght of media items'))
|
||||||
|
self.serviceTitleLabel.setText(translate(
|
||||||
|
'OpenLP.PrintServiceOrderForm', 'Service Order Title'))
|
||||||
|
|
||||||
|
def serviceOrderText(self):
|
||||||
|
"""
|
||||||
|
Creates the html text, to print the service items.
|
||||||
|
"""
|
||||||
|
if self.serviceTitleLineEdit.text():
|
||||||
|
text = u'<h2>%s</h2>' % unicode(self.serviceTitleLineEdit.text())
|
||||||
|
else:
|
||||||
|
text = u'<h2>%s</h2>' % translate('OpenLP.ServiceManager',
|
||||||
|
'Service Order Sheet')
|
||||||
|
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> %s</p>' % (translate(
|
||||||
|
'OpenLP.ServiceManager', 'Notes:'), item.notes)
|
||||||
|
# Add play length of media files.
|
||||||
|
if item.is_media() and self.metaDataCheckBox.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)))
|
||||||
|
return text
|
@ -23,11 +23,8 @@
|
|||||||
# 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 cPickle
|
import cPickle
|
||||||
import datetime
|
|
||||||
import logging
|
import logging
|
||||||
import mutagen
|
|
||||||
import os
|
import os
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
@ -40,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
|
||||||
|
|
||||||
@ -69,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.
|
||||||
"""
|
"""
|
||||||
@ -393,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)
|
||||||
|
|
||||||
@ -1190,52 +1188,12 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Print a Service Order Sheet.
|
Print a Service Order Sheet.
|
||||||
"""
|
"""
|
||||||
|
settingDialog = PrintServiceOrderForm(self)
|
||||||
|
if not settingDialog.exec_():
|
||||||
|
return
|
||||||
|
serviceDocument = QtGui.QTextDocument()
|
||||||
|
serviceDocument.setHtml(settingDialog.serviceOrderText())
|
||||||
printDialog = QtGui.QPrintDialog()
|
printDialog = QtGui.QPrintDialog()
|
||||||
if not printDialog.exec_():
|
if not printDialog.exec_():
|
||||||
return
|
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 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 QtCore.QSettings().value(u'advanced' +
|
|
||||||
u'/print slide text', QtCore.QVariant(False)).toBool():
|
|
||||||
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 QtCore.QSettings().value(u'advanced' +
|
|
||||||
u'/print notes', QtCore.QVariant(False)).toBool():
|
|
||||||
if item.notes:
|
|
||||||
text += u'<p><b>%s</b> %s</p>' % (translate(
|
|
||||||
'OpenLP.ServiceManager', 'Notes:'), item.notes)
|
|
||||||
# Add play length of media files.
|
|
||||||
if item.is_media() and QtCore.QSettings().value(u'advanced' +
|
|
||||||
u'/print file meta data', QtCore.QVariant(False)).toBool():
|
|
||||||
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)))
|
|
||||||
serviceDocument = QtGui.QTextDocument()
|
|
||||||
serviceDocument.setHtml(text)
|
|
||||||
serviceDocument.print_(printDialog.printer())
|
serviceDocument.print_(printDialog.printer())
|
||||||
|
@ -53,4 +53,4 @@ class ServiceNoteForm(QtGui.QDialog):
|
|||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.setWindowTitle(
|
self.setWindowTitle(
|
||||||
translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
|
translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
|
||||||
|
Loading…
Reference in New Issue
Block a user