This commit is contained in:
Andreas Preikschat 2011-02-04 16:46:16 +01:00
parent 7c69bad112
commit ce2640c80e
2 changed files with 8 additions and 52 deletions

View File

@ -70,6 +70,7 @@ from shortcutlistform import ShortcutListForm
from mediadockmanager import MediaDockManager from mediadockmanager import MediaDockManager
from servicemanager import ServiceManager from servicemanager import ServiceManager
from thememanager import ThemeManager from thememanager import ThemeManager
from printserviceorderform import PrintServiceOrderForm
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay', __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay',
'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager', 'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager',

View File

@ -25,15 +25,13 @@
############################################################################### ###############################################################################
import cPickle import cPickle
import datetime
import logging import logging
import mutagen
import os import os
import zipfile import zipfile
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui, QtWebKit
from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \ from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \ Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \
@ -1190,52 +1188,9 @@ class ServiceManager(QtGui.QWidget):
""" """
Print a Service Order Sheet. Print a Service Order Sheet.
""" """
printDialog = QtGui.QPrintDialog() from openlp.core.ui import PrintServiceOrderForm
if not printDialog.exec_(): dialog = PrintServiceOrderForm(self)
return dialog.exec_()
text = u'<h2>%s</h2>' % translate('OpenLP.ServiceManager', # printer = QtGui.QPrinter()
'Service Order Sheet') # serviceDocument = QtGui.QTextDocument()
for item in self.serviceItems: # serviceDocument.setHtml(text)
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())