← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/printServiceOrder into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol-hush/openlp/printServiceOrder into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol-hush/openlp/printServiceOrder/+merge/48611

Hello!

- removed the error box, when no service item is in the service (as suggested by superfly)
- added the possibility to include the "playing time" of media items
- more settings
  a) print text (slides)
  b) print notes
  c) print playing time

Cheers
-- 
https://code.launchpad.net/~googol-hush/openlp/printServiceOrder/+merge/48611
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/printServiceOrder into lp:openlp.
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py	2011-02-01 19:16:51 +0000
+++ openlp/core/ui/advancedtab.py	2011-02-04 13:38:26 +0000
@@ -84,11 +84,15 @@
         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.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.setObjectName(u'sharedDirGroupBox')
@@ -141,9 +145,12 @@
             '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.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(
 #            translate('AdvancedTab', 'Central Data Store'))
 #        self.sharedCheckBox.setText(
@@ -179,8 +186,12 @@
             QtCore.QVariant(True)).toBool())
         self.hideMouseCheckBox.setChecked(
             settings.value(u'hide mouse', QtCore.QVariant(False)).toBool())
-        self.detailedServicePrintCheckBox.setChecked(settings.value(
-            u'detailed service print', 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()
 
     def save(self):
@@ -201,8 +212,12 @@
             QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked()))
         settings.setValue(u'hide mouse',
             QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
-        settings.setValue(u'detailed service print',
-            QtCore.QVariant(self.detailedServicePrintCheckBox.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()
 
 #    def onSharedCheckBoxChanged(self, checked):

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2011-02-03 03:50:04 +0000
+++ openlp/core/ui/servicemanager.py	2011-02-04 13:38:26 +0000
@@ -24,9 +24,11 @@
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
 
+import cPickle
+import datetime
+import logging
+import mutagen
 import os
-import logging
-import cPickle
 import zipfile
 
 log = logging.getLogger(__name__)
@@ -1188,11 +1190,6 @@
         """
         Print a Service Order Sheet.
         """
-        if not self.serviceItems:
-            critical_error_message_box(
-                message=translate('OpenLP.ServiceManager',
-                'There is no service item in this service.'))
-            return
         printDialog = QtGui.QPrintDialog()
         if not printDialog.exec_():
             return
@@ -1200,29 +1197,45 @@
             'Service Order Sheet')
         for item in self.serviceItems:
             item = item[u'service_item']
-            # add the title
+            # Add the title of the service item.
             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)
+            # 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())


Follow ups