- removed error message box -> print anyway

- print playing time of media
- more settings
This commit is contained in:
Andreas Preikschat 2011-02-04 13:59:44 +01:00
commit 9afa150f02
2 changed files with 67 additions and 40 deletions

View File

@ -84,11 +84,15 @@ class AdvancedTab(SettingsTab):
self.serviceOrderGroupBox.setObjectName(u'serviceOrderGroupBox') self.serviceOrderGroupBox.setObjectName(u'serviceOrderGroupBox')
self.serviceOrderLayout = QtGui.QVBoxLayout(self.serviceOrderGroupBox) self.serviceOrderLayout = QtGui.QVBoxLayout(self.serviceOrderGroupBox)
self.serviceOrderLayout.setObjectName(u'serviceOrderLayout') self.serviceOrderLayout.setObjectName(u'serviceOrderLayout')
self.detailedServicePrintCheckBox = QtGui.QCheckBox( self.printSlideTextCheckBox = QtGui.QCheckBox(self.serviceOrderGroupBox)
self.serviceOrderGroupBox) self.printSlideTextCheckBox.setObjectName(u'printSlideTextCheckBox')
self.detailedServicePrintCheckBox.setObjectName( self.serviceOrderLayout.addWidget(self.printSlideTextCheckBox)
u'detailedServicePrintCheckBox') self.printMetaDataCheckBox = QtGui.QCheckBox(self.serviceOrderGroupBox)
self.serviceOrderLayout.addWidget(self.detailedServicePrintCheckBox) 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.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')
@ -141,9 +145,12 @@ class AdvancedTab(SettingsTab):
'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', self.serviceOrderGroupBox.setTitle(translate('OpenLP.AdvancedTab',
'Service Order Print')) 'Service Order Print'))
self.detailedServicePrintCheckBox.setText( self.printSlideTextCheckBox.setText(
translate('OpenLP.AdvancedTab', translate('OpenLP.AdvancedTab', 'Include text slides if available'))
'Print slide texts and service item notes as well')) 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(
@ -179,8 +186,12 @@ 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( self.printSlideTextCheckBox.setChecked(settings.value(
u'detailed service print', QtCore.QVariant(False)).toBool()) 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):
@ -201,8 +212,12 @@ 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', settings.setValue(u'print slide text',
QtCore.QVariant(self.detailedServicePrintCheckBox.isChecked())) 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):

View File

@ -24,9 +24,11 @@
# 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 datetime
import logging
import mutagen
import os
import zipfile import zipfile
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -1188,11 +1190,6 @@ class ServiceManager(QtGui.QWidget):
""" """
Print a Service Order Sheet. 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() printDialog = QtGui.QPrintDialog()
if not printDialog.exec_(): if not printDialog.exec_():
return return
@ -1200,29 +1197,44 @@ class ServiceManager(QtGui.QWidget):
'Service Order Sheet') 'Service Order Sheet')
for item in self.serviceItems: for item in self.serviceItems:
item = item[u'service_item'] 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, text += u'<h4><img src="%s" /> %s</h4>' % (item.icon,
item.get_display_title()) item.get_display_title())
if not QtCore.QSettings().value(u'advanced' + # Add slide text of the service item.
u'/detailed service print', QtCore.QVariant(True)).toBool(): if QtCore.QSettings().value(u'advanced' +
continue u'/print slide text', QtCore.QVariant(False)).toBool():
if item.is_text(): if item.is_text():
# Add the text of the service item. # Add the text of the service item.
for slide in item.get_frames(): for slide in item.get_frames():
text += u'<p>' + slide[u'text'] + u'</p>' text += u'<p>' + slide[u'text'] + u'</p>'
elif item.is_image(): elif item.is_image():
# Add the image names of the service item. # Add the image names of the service item.
text += u'<ol>' text += u'<ol>'
for slide in range(len(item.get_frames())): for slide in range(len(item.get_frames())):
text += u'<li><p>%s</p></li>' % item.get_frame_title(slide) text += u'<li><p>%s</p></li>' % item.get_frame_title(slide)
text += u'</ol>' text += u'</ol>'
if item.foot_text: if item.foot_text:
# add footer # add footer
text += u'<p>%s</p>' % item.foot_text text += u'<p>%s</p>' % item.foot_text
if item.notes: # Add service items' notes.
# add notes if QtCore.QSettings().value(u'advanced' +
text += u'<p><b>%s</b> %s</p>' % (translate( u'/print notes', QtCore.QVariant(False)).toBool():
'OpenLP.ServiceManager', 'Notes:'), item.notes) 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 = QtGui.QTextDocument()
serviceDocument.setHtml(text) serviceDocument.setHtml(text)
serviceDocument.print_(printDialog.printer()) serviceDocument.print_(printDialog.printer())