From 0047b8d1c105f969293f2fe8e7cd64ea7da1d4df Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 4 Feb 2011 13:57:48 +0100 Subject: [PATCH 01/13] --- openlp/core/ui/advancedtab.py | 39 ++++++++++++------ openlp/core/ui/servicemanager.py | 68 +++++++++++++++++++------------- 2 files changed, 67 insertions(+), 40 deletions(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index f68131894..630cbc18c 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -84,11 +84,15 @@ class AdvancedTab(SettingsTab): 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 @@ class AdvancedTab(SettingsTab): '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 @@ class AdvancedTab(SettingsTab): 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 @@ class AdvancedTab(SettingsTab): 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): diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 4d36f4aec..3f38afe58 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -24,9 +24,11 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -import os -import logging import cPickle +import datetime +import logging +import mutagen +import os import zipfile log = logging.getLogger(__name__) @@ -1188,11 +1190,6 @@ class ServiceManager(QtGui.QWidget): """ 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,44 @@ class ServiceManager(QtGui.QWidget): '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'

%s

' % (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'

' + slide[u'text'] + u'

' - elif item.is_image(): - # Add the image names of the service item. - text += u'
    ' - for slide in range(len(item.get_frames())): - text += u'
  1. %s

  2. ' % item.get_frame_title(slide) - text += u'
' - if item.foot_text: - # add footer - text += u'

%s

' % item.foot_text - if item.notes: - # add notes - text += u'

%s %s

' % (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'

' + slide[u'text'] + u'

' + elif item.is_image(): + # Add the image names of the service item. + text += u'
    ' + for slide in range(len(item.get_frames())): + text += u'
  1. %s

  2. ' % item.get_frame_title(slide) + text += u'
' + if item.foot_text: + # add footer + text += u'

%s

' % 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'

%s %s

' % (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'

%s %s

' % (translate( + 'OpenLP.ServiceManager', u'Playing time:'), + unicode(datetime.timedelta(seconds=length))) serviceDocument = QtGui.QTextDocument() serviceDocument.setHtml(text) serviceDocument.print_(printDialog.printer()) From 7c69bad1120fef22071f5c42c86598d374fc949b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 4 Feb 2011 14:35:55 +0100 Subject: [PATCH 02/13] fixed long line --- openlp/core/ui/servicemanager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 3f38afe58..ec1025d45 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1211,7 +1211,8 @@ class ServiceManager(QtGui.QWidget): # Add the image names of the service item. text += u'
    ' for slide in range(len(item.get_frames())): - text += u'
  1. %s

  2. ' % item.get_frame_title(slide) + text += u'
  3. %s

  4. ' % \ + item.get_frame_title(slide) text += u'
' if item.foot_text: # add footer From ce2640c80e8324580ea5379fa2f9a2532443801e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 4 Feb 2011 16:46:16 +0100 Subject: [PATCH 03/13] --- openlp/core/ui/__init__.py | 1 + openlp/core/ui/servicemanager.py | 59 ++++---------------------------- 2 files changed, 8 insertions(+), 52 deletions(-) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index eb0e89775..9de96e9b5 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -70,6 +70,7 @@ from shortcutlistform import ShortcutListForm from mediadockmanager import MediaDockManager from servicemanager import ServiceManager from thememanager import ThemeManager +from printserviceorderform import PrintServiceOrderForm __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager', diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index ec1025d45..05171daf7 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -25,15 +25,13 @@ ############################################################################### import cPickle -import datetime import logging -import mutagen import os import zipfile 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, \ Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \ @@ -1190,52 +1188,9 @@ class ServiceManager(QtGui.QWidget): """ Print a Service Order Sheet. """ - printDialog = QtGui.QPrintDialog() - if not printDialog.exec_(): - return - text = u'

%s

' % 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'

%s

' % (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'

' + slide[u'text'] + u'

' - elif item.is_image(): - # Add the image names of the service item. - text += u'
    ' - for slide in range(len(item.get_frames())): - text += u'
  1. %s

  2. ' % \ - item.get_frame_title(slide) - text += u'
' - if item.foot_text: - # add footer - text += u'

%s

' % 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'

%s %s

' % (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'

%s %s

' % (translate( - 'OpenLP.ServiceManager', u'Playing time:'), - unicode(datetime.timedelta(seconds=length))) - serviceDocument = QtGui.QTextDocument() - serviceDocument.setHtml(text) - serviceDocument.print_(printDialog.printer()) + from openlp.core.ui import PrintServiceOrderForm + dialog = PrintServiceOrderForm(self) + dialog.exec_() +# printer = QtGui.QPrinter() +# serviceDocument = QtGui.QTextDocument() +# serviceDocument.setHtml(text) From 642011b379065bb31c08db2cc84bb26bbe892230 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 4 Feb 2011 19:00:59 +0100 Subject: [PATCH 04/13] --- openlp/core/ui/__init__.py | 3 +- openlp/core/ui/advancedtab.py | 34 ------ openlp/core/ui/printserviceorderform.py | 133 ++++++++++++++++++++++++ openlp/core/ui/servicemanager.py | 11 +- 4 files changed, 140 insertions(+), 41 deletions(-) create mode 100644 openlp/core/ui/printserviceorderform.py diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 9de96e9b5..d6d1aa582 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -70,8 +70,7 @@ from shortcutlistform import ShortcutListForm from mediadockmanager import MediaDockManager from servicemanager import ServiceManager from thememanager import ThemeManager -from printserviceorderform import PrintServiceOrderForm __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager', - 'ServiceItemEditForm'] + 'ServiceItemEditForm',] diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 630cbc18c..58b637bc2 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -80,20 +80,6 @@ class AdvancedTab(SettingsTab): self.hideMouseCheckBox.setObjectName(u'hideMouseCheckBox') self.hideMouseLayout.addWidget(self.hideMouseCheckBox) 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.setObjectName(u'sharedDirGroupBox') # self.sharedDirLayout = QtGui.QFormLayout(self.sharedDirGroupBox) @@ -143,14 +129,6 @@ class AdvancedTab(SettingsTab): 'Mouse Cursor')) self.hideMouseCheckBox.setText(translate('OpenLP.AdvancedTab', '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( # translate('AdvancedTab', 'Central Data Store')) # self.sharedCheckBox.setText( @@ -186,12 +164,6 @@ class AdvancedTab(SettingsTab): QtCore.QVariant(True)).toBool()) self.hideMouseCheckBox.setChecked( 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() def save(self): @@ -212,12 +184,6 @@ class AdvancedTab(SettingsTab): QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked())) settings.setValue(u'hide mouse', 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() # def onSharedCheckBoxChanged(self, checked): diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py new file mode 100644 index 000000000..127cb95a8 --- /dev/null +++ b/openlp/core/ui/printserviceorderform.py @@ -0,0 +1,133 @@ +# -*- 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): + """ + """ + if self.serviceTitleLineEdit.text(): + text = u'

%s

' % unicode(self.serviceTitleLineEdit.text()) + else: + text = u'

%s

' % 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'

%s

' % (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'

' + slide[u'text'] + u'

' + elif item.is_image(): + # Add the image names of the service item. + text += u'
    ' + for slide in range(len(item.get_frames())): + text += u'
  1. %s

  2. ' % \ + item.get_frame_title(slide) + text += u'
' + if item.foot_text: + # add footer + text += u'

%s

' % item.foot_text + # Add service items' notes. + if self.printNotesCheckBox.isChecked(): + if item.notes: + text += u'

%s %s

' % (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'

%s %s

' % (translate( + 'OpenLP.ServiceManager', u'Playing time:'), + unicode(datetime.timedelta(seconds=length))) + return text + + diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index b97171a5b..3d6c8e861 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -38,6 +38,7 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \ ThemeLevel from openlp.core.lib.ui import critical_error_message_box 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, \ split_filename @@ -1188,11 +1189,11 @@ class ServiceManager(QtGui.QWidget): """ Print a Service Order Sheet. """ - from openlp.core.ui import PrintServiceOrderForm - dialog = PrintServiceOrderForm(self) - if dialog.exec_(): - serviceDocument = QtGui.QTextDocument() - serviceDocument.setHtml(dialog.printServiceOrder()) + settingDialog = PrintServiceOrderForm(self) + if not settingDialog.exec_(): + return + serviceDocument = QtGui.QTextDocument() + serviceDocument.setHtml(settingDialog.serviceOrderText()) printDialog = QtGui.QPrintDialog() if not printDialog.exec_(): return From 9659eb2a1cfe36227b1584aa1428f495e68480b8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 4 Feb 2011 19:34:22 +0100 Subject: [PATCH 05/13] added print dialog --- openlp/core/ui/printserviceorderform.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index 616159da6..b130f9470 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -80,17 +80,17 @@ class PrintServiceOrderForm(QtGui.QDialog): self.metaDataCheckBox.setText(translate('OpenLP.PrintServiceOrderForm', 'Include play lenght of media items')) self.serviceTitleLabel.setText(translate( - 'OpenLP.PrintServiceOrderForm', 'Service Order Title')) + 'OpenLP.PrintServiceOrderForm', 'Service Order Title:')) + self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager', + 'Service Order Sheet')) def serviceOrderText(self): """ Creates the html text, to print the service items. """ + text = u'' if self.serviceTitleLineEdit.text(): - text = u'

%s

' % unicode(self.serviceTitleLineEdit.text()) - else: - text = u'

%s

' % translate('OpenLP.ServiceManager', - 'Service Order Sheet') + text += u'

%s

' % unicode(self.serviceTitleLineEdit.text()) for item in self.serviceManager.serviceItems: item = item[u'service_item'] # Add the title of the service item. From 860b1d376b59cde145664e01d3f797e02620968d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 4 Feb 2011 21:10:32 +0100 Subject: [PATCH 06/13] --- openlp/core/ui/printserviceorderform.py | 31 +++++++-- resources/forms/printServiceOrder.ui | 91 +++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 resources/forms/printServiceOrder.ui diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index b130f9470..d24bfdf91 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -42,6 +42,16 @@ class PrintServiceOrderForm(QtGui.QDialog): QtGui.QDialog.__init__(self, parent) self.setupUi() self.retranslateUi() + # Load the settings for this 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() def setupUi(self): self.dialogLayout = QtGui.QHBoxLayout(self) @@ -63,9 +73,9 @@ class PrintServiceOrderForm(QtGui.QDialog): 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.printMetaDataCheckBox = QtGui.QCheckBox(self) + self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox') + self.verticalLayout.addWidget(self.printMetaDataCheckBox) self.verticalLayout.addWidget(save_cancel_button_box(self)) self.dialogLayout.addLayout(self.verticalLayout) QtCore.QMetaObject.connectSlotsByName(self) @@ -77,7 +87,8 @@ class PrintServiceOrderForm(QtGui.QDialog): 'OpenLP.PrintServiceOrderForm', 'Include slide text if avaialbe')) self.printNotesCheckBox.setText(translate( 'OpenLP.PrintServiceOrderForm', 'Include service item notes')) - self.metaDataCheckBox.setText(translate('OpenLP.PrintServiceOrderForm', + self.printMetaDataCheckBox.setText( + translate('OpenLP.PrintServiceOrderForm', 'Include play lenght of media items')) self.serviceTitleLabel.setText(translate( 'OpenLP.PrintServiceOrderForm', 'Service Order Title:')) @@ -118,7 +129,7 @@ class PrintServiceOrderForm(QtGui.QDialog): text += u'

%s %s

' % (translate( 'OpenLP.ServiceManager', 'Notes:'), item.notes) # Add play length of media files. - if item.is_media() and self.metaDataCheckBox.isChecked(): + 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): @@ -129,4 +140,14 @@ class PrintServiceOrderForm(QtGui.QDialog): text += u'

%s %s

' % (translate( 'OpenLP.ServiceManager', u'Playing time:'), unicode(datetime.timedelta(seconds=length))) + # 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() return text diff --git a/resources/forms/printServiceOrder.ui b/resources/forms/printServiceOrder.ui new file mode 100644 index 000000000..728e42d77 --- /dev/null +++ b/resources/forms/printServiceOrder.ui @@ -0,0 +1,91 @@ + + + Dialog + + + + 0 + 0 + 321 + 205 + + + + Dialog + + + + + + + + + + Service Title: + + + + + + + + + + + + Include slide text if avaialbe + + + + + + + Include service item notes + + + + + + + Include play lenght of media items + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + Print + + + + + + + + + + + + From 1933144731741362bc516581469476174556f034 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 6 Feb 2011 08:16:42 +0100 Subject: [PATCH 07/13] --- openlp/core/ui/printserviceorderform.py | 133 ++++++++++++++++++---- resources/forms/printServiceOrder.ui | 145 ++++++++++++++++-------- 2 files changed, 207 insertions(+), 71 deletions(-) diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index 7f09ceea2..34e1845d0 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -38,14 +38,13 @@ class PrintServiceOrderForm(QtGui.QDialog): """ Constructor """ - self.serviceManager = parent QtGui.QDialog.__init__(self, parent) - self.setupUi() - self.retranslateUi() - self.html = u'' + self.serviceManager = parent self.printer = QtGui.QPrinter() self.printDialog = QtGui.QPrintDialog(self.printer, self) self.document = QtGui.QTextDocument() + self.setupUi() + self.retranslateUi() # Load the settings for this dialog. settings = QtCore.QSettings() settings.beginGroup(u'advanced') @@ -56,37 +55,109 @@ class PrintServiceOrderForm(QtGui.QDialog): self.printNotesCheckBox.setChecked(settings.value( u'print notes', QtCore.QVariant(False)).toBool()) settings.endGroup() + # Signals + QtCore.QObject.connect(self.printButton, + QtCore.SIGNAL('clicked()'), self.printServiceOrder) + QtCore.QObject.connect(self.zoomOutButton, + QtCore.SIGNAL('clicked()'), self.zoomOut) + QtCore.QObject.connect(self.zoomInButton, + QtCore.SIGNAL('clicked()'), self.zoomIn) + QtCore.QObject.connect(self.previewWidget, + QtCore.SIGNAL('paintRequested(QPrinter *)'), self.paintRequested) + QtCore.QObject.connect(self.serviceTitleLineEdit, + QtCore.SIGNAL('textChanged(const QString)'), self.updatePreviewText) + QtCore.QObject.connect(self.printSlideTextCheckBox, + QtCore.SIGNAL('stateChanged(int)'), self.updatePreviewText) + QtCore.QObject.connect(self.printNotesCheckBox, + QtCore.SIGNAL('stateChanged(int)'), self.updatePreviewText) + QtCore.QObject.connect(self.printMetaDataCheckBox, + QtCore.SIGNAL('stateChanged(int)'), self.updatePreviewText) + self.updatePreviewText() def setupUi(self): self.dialogLayout = QtGui.QHBoxLayout(self) self.dialogLayout.setObjectName(u'dialogLayout') - self.verticalLayout = QtGui.QVBoxLayout() - self.verticalLayout.setObjectName(u'verticalLayout') + self.perviewLayout = QtGui.QVBoxLayout() + self.perviewLayout.setObjectName(u'perviewLayout') + self.previewLabel = QtGui.QLabel(self) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.previewLabel.sizePolicy().hasHeightForWidth()) + self.previewLabel.setSizePolicy(sizePolicy) + self.previewLabel.setObjectName(u'previewLabel') + self.perviewLayout.addWidget(self.previewLabel) + self.previewWidget = QtGui.QPrintPreviewWidget(self.printer, self, QtCore.Qt.Widget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.previewWidget.sizePolicy().hasHeightForWidth()) + self.previewWidget.setSizePolicy(sizePolicy) + self.previewWidget.setObjectName(u'previewWidget') + self.previewWidget.fitToWidth() + self.perviewLayout.addWidget(self.previewWidget) + self.dialogLayout.addLayout(self.perviewLayout) + self.settingsLayout = QtGui.QVBoxLayout() + self.settingsLayout.setObjectName(u'settingsLayout') 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.setSizePolicy( + QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) self.serviceTitleLineEdit.setObjectName(u'serviceTitleLineEdit') self.serviceTitleLayout.addWidget(self.serviceTitleLineEdit) - self.verticalLayout.addLayout(self.serviceTitleLayout) + self.settingsLayout.addLayout(self.serviceTitleLayout) self.printSlideTextCheckBox = QtGui.QCheckBox(self) self.printSlideTextCheckBox.setObjectName(u'printSlideTextCheckBox') - self.verticalLayout.addWidget(self.printSlideTextCheckBox) + self.settingsLayout.addWidget(self.printSlideTextCheckBox) self.printNotesCheckBox = QtGui.QCheckBox(self) self.printNotesCheckBox.setObjectName(u'printNotesCheckBox') - self.verticalLayout.addWidget(self.printNotesCheckBox) + self.settingsLayout.addWidget(self.printNotesCheckBox) self.printMetaDataCheckBox = QtGui.QCheckBox(self) self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox') - self.verticalLayout.addWidget(self.printMetaDataCheckBox) - self.verticalLayout.addWidget(save_cancel_button_box(self)) - self.dialogLayout.addLayout(self.verticalLayout) + self.settingsLayout.addWidget(self.printMetaDataCheckBox) + self.buttonLayout = QtGui.QHBoxLayout() + self.zoomOutButton = QtGui.QToolButton(self) + icon = QtGui.QIcon() + #icon.addPixmap(QtGui.QPixmap(u':/exports/export_move_to_list.png'), + icon.addPixmap(QtGui.QPixmap(u'/home/andreas/zoom-out.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.zoomOutButton.setIcon(icon) + self.zoomOutButton.setObjectName(u'zoomOutButton') + self.buttonLayout.addWidget(self.zoomOutButton) + self.zoomInButton = QtGui.QToolButton(self) + icon = QtGui.QIcon() + #icon.addPixmap(QtGui.QPixmap(u':/exports/export_remove.png'), + icon.addPixmap(QtGui.QPixmap(u'/home/andreas/zoom-in.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.zoomInButton.setIcon(icon) + self.zoomInButton.setObjectName(u'toolButton') + self.buttonLayout.addWidget(self.zoomInButton) + spacerItem = QtGui.QSpacerItem(20, 40, + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.settingsLayout.addItem(spacerItem) + self.buttonLayout.setObjectName(u'buttonLayout') + spacerItem = QtGui.QSpacerItem(40, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.buttonLayout.addItem(spacerItem) + self.cancelButton = QtGui.QPushButton(self) + self.cancelButton.setObjectName(u'cancelButton') + self.buttonLayout.addWidget(self.cancelButton) + self.printButton = QtGui.QPushButton(self) + self.printButton.setObjectName(u'printButton') + self.buttonLayout.addWidget(self.printButton) + self.settingsLayout.addLayout(self.buttonLayout) + self.dialogLayout.addLayout(self.settingsLayout) QtCore.QMetaObject.connectSlotsByName(self) def retranslateUi(self): self.setWindowTitle( translate('OpenLP.PrintServiceOrderForm', 'Print Service Order')) + self.previewLabel.setText( + translate('OpenLP.ServiceManager', 'Preview:')) self.printSlideTextCheckBox.setText(translate( 'OpenLP.PrintServiceOrderForm', 'Include slide text if avaialbe')) self.printNotesCheckBox.setText(translate( @@ -95,14 +166,17 @@ class PrintServiceOrderForm(QtGui.QDialog): translate('OpenLP.PrintServiceOrderForm', 'Include play lenght of media items')) self.serviceTitleLabel.setText(translate( - 'OpenLP.PrintServiceOrderForm', 'Service Order Title:')) + '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')) - def serviceOrderText(self): + def updatePreviewText(self): """ Creates the html text, to print the service items. """ + text = u'' if self.serviceTitleLineEdit.text(): text += u'

%s

' % unicode(self.serviceTitleLineEdit.text()) for item in self.serviceManager.serviceItems: @@ -129,8 +203,9 @@ class PrintServiceOrderForm(QtGui.QDialog): # Add service items' notes. if self.printNotesCheckBox.isChecked(): if item.notes: - text += u'

%s %s

' % (translate( - 'OpenLP.ServiceManager', 'Notes:'), item.notes) + text += u'

%s


%s' % (translate( + 'OpenLP.ServiceManager', 'Notes:'), + item.notes.replace(u'\n', u'
')) # Add play length of media files. if item.is_media() and self.printMetaDataCheckBox.isChecked(): path = os.path.join(item.get_frames()[0][u'path'], @@ -143,6 +218,19 @@ class PrintServiceOrderForm(QtGui.QDialog): text += u'

%s %s

' % (translate( 'OpenLP.ServiceManager', u'Playing time:'), unicode(datetime.timedelta(seconds=length))) + self.document.setHtml(text) + self.previewWidget.updatePreview() + + def paintRequested(self, printer): + """ + Paint the preview. + """ + self.document.print_(printer) + + def printServiceOrder(self): + if not self.printDialog.exec_(): + return + self.document.print_(self.printer) # Save the settings for this dialog. settings = QtCore.QSettings() settings.beginGroup(u'advanced') @@ -153,12 +241,9 @@ class PrintServiceOrderForm(QtGui.QDialog): settings.setValue(u'print notes', QtCore.QVariant(self.printNotesCheckBox.isChecked())) settings.endGroup() - self.document.setHtml(text) - def printServiceOrder(self): - serviceDocument = QtGui.QTextDocument() - serviceDocument.setHtml(settingDialog.serviceOrderText()) - printDialog = QtGui.QPrintDialog() - if not printDialog.exec_(): - return - serviceDocument.print_(printDialog.printer()) + def zoomIn(self): + self.previewWidget.zoomIn() + + def zoomOut(self): + self.previewWidget.zoomOut() diff --git a/resources/forms/printServiceOrder.ui b/resources/forms/printServiceOrder.ui index 84ec84bbe..b76bc012a 100644 --- a/resources/forms/printServiceOrder.ui +++ b/resources/forms/printServiceOrder.ui @@ -13,10 +13,10 @@ Dialog - + - - + + @@ -33,37 +33,47 @@ + + true + - + 0 0 + - + - - - - - Service Title: - - - - + + - + 0 0 + + + + + 0 + 0 + + + + Service Title: + + + @@ -81,14 +91,14 @@ - + Include play lenght of media items - + Qt::Vertical @@ -100,36 +110,75 @@ + + + + - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Cancel - - - - - - - Print - - - - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + Print + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + ... + + + + ../../../../../zoom-out.png../../../../../zoom-out.png + + + + + + + ... + + + + ../../../../../zoom-in.png../../../../../zoom-in.png + + @@ -137,6 +186,8 @@ - + + + From ff8fb724e1f041fc7df8fb4a0d4ca0b95102410a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 6 Feb 2011 15:26:13 +0100 Subject: [PATCH 08/13] fixed line break --- openlp/core/ui/printserviceorderform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index 3f130365a..40a3dede9 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -106,7 +106,7 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): # Add service items' notes. if self.printNotesCheckBox.isChecked(): if item.notes: - text += u'

%s


%s' % (translate( + text += u'

%s

%s' % (translate( 'OpenLP.ServiceManager', 'Notes:'), item.notes.replace(u'\n', u'
')) # Add play length of media files. From 5504c541ad485d0d9b04ddf9cf8999d871b36604 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 6 Feb 2011 21:21:18 +0100 Subject: [PATCH 09/13] removed not needed import, use build_icon --- openlp/core/ui/printserviceorderdialog.py | 15 ++++----------- openlp/core/ui/printserviceorderform.py | 1 - 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/openlp/core/ui/printserviceorderdialog.py b/openlp/core/ui/printserviceorderdialog.py index 5706034a7..70780291a 100644 --- a/openlp/core/ui/printserviceorderdialog.py +++ b/openlp/core/ui/printserviceorderdialog.py @@ -26,9 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate -from openlp.core.lib.ui import save_cancel_button_box - +from openlp.core.lib import build_icon, translate class Ui_PrintServiceOrderDialog(object): def setupUi(self, printServiceOrderDialog): @@ -99,17 +97,12 @@ class Ui_PrintServiceOrderDialog(object): QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.zoomButtonLayout.addItem(spacerItem) self.zoomOutButton = QtGui.QToolButton(printServiceOrderDialog) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(u':/general/general_zoom_out.png'), - QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.zoomOutButton.setIcon(icon) + 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) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(u':/general/general_zoom_in.png'), - QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.zoomInButton.setIcon(icon) + 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) diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index 40a3dede9..d7cf87147 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -30,7 +30,6 @@ import os from PyQt4 import QtCore, QtGui from openlp.core.lib import translate -from openlp.core.lib.ui import save_cancel_button_box from openlp.core.ui.printserviceorderdialog import Ui_PrintServiceOrderDialog class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): From 1bcbb83144460e4292c96c5a3e3b8a647c09224f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 6 Feb 2011 21:26:32 +0100 Subject: [PATCH 10/13] fixed doc --- openlp/core/ui/servicemanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index ea09797ba..83d7cbc3c 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1185,7 +1185,7 @@ class ServiceManager(QtGui.QWidget): def printServiceOrder(self): """ - Open a Print a Service Order Sheet. + Print a Service Order Sheet. """ settingDialog = PrintServiceOrderForm(self.mainwindow, self) settingDialog.exec_() From 5410d8dfd114694ed0169e548b83b4e12990b7bf Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 7 Feb 2011 18:19:54 +0100 Subject: [PATCH 11/13] added a field to enter custom service notes --- openlp/core/ui/printserviceorderdialog.py | 10 +++++++++- openlp/core/ui/printserviceorderform.py | 22 ++++++++++++++-------- resources/forms/printserviceorderdialog.ui | 10 ++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/printserviceorderdialog.py b/openlp/core/ui/printserviceorderdialog.py index 70780291a..5e7b5a031 100644 --- a/openlp/core/ui/printserviceorderdialog.py +++ b/openlp/core/ui/printserviceorderdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, translate +from openlp.core.lib import build_icon, translate, SpellTextEdit class Ui_PrintServiceOrderDialog(object): def setupUi(self, printServiceOrderDialog): @@ -78,6 +78,12 @@ class Ui_PrintServiceOrderDialog(object): 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') @@ -127,3 +133,5 @@ class Ui_PrintServiceOrderDialog(object): 'Service Order Sheet')) self.printButton.setText(translate('OpenLP.ServiceManager', 'Print')) self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel')) + self.customNotesLabel.setText( + translate('OpenLP.ServiceManager', 'Custom Service Notes:')) diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index d7cf87147..546d52d55 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -55,21 +55,24 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): settings.endGroup() # Signals QtCore.QObject.connect(self.printButton, - QtCore.SIGNAL('clicked()'), self.printServiceOrder) + QtCore.SIGNAL(u'clicked()'), self.printServiceOrder) QtCore.QObject.connect(self.zoomOutButton, - QtCore.SIGNAL('clicked()'), self.zoomOut) + QtCore.SIGNAL(u'clicked()'), self.zoomOut) QtCore.QObject.connect(self.zoomInButton, - QtCore.SIGNAL('clicked()'), self.zoomIn) + QtCore.SIGNAL(u'clicked()'), self.zoomIn) QtCore.QObject.connect(self.previewWidget, - QtCore.SIGNAL('paintRequested(QPrinter *)'), self.paintRequested) + QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested) QtCore.QObject.connect(self.serviceTitleLineEdit, - QtCore.SIGNAL('textChanged(const QString)'), self.updatePreviewText) + QtCore.SIGNAL(u'textChanged(const QString)'), + self.updatePreviewText) QtCore.QObject.connect(self.printSlideTextCheckBox, - QtCore.SIGNAL('stateChanged(int)'), self.updatePreviewText) + QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText) QtCore.QObject.connect(self.printNotesCheckBox, - QtCore.SIGNAL('stateChanged(int)'), self.updatePreviewText) + QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText) QtCore.QObject.connect(self.printMetaDataCheckBox, - QtCore.SIGNAL('stateChanged(int)'), self.updatePreviewText) + 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() @@ -120,6 +123,9 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): text += u'

%s %s

' % (translate( 'OpenLP.ServiceManager', u'Playing time:'), unicode(datetime.timedelta(seconds=length))) + if self.customNoteEdit.toPlainText(): + text += u'

%s

%s' % (translate('OpenLP.ServiceManager', + u'Custom Service Notes:'), self.customNoteEdit.toPlainText()) self.document.setHtml(text) self.previewWidget.updatePreview() diff --git a/resources/forms/printserviceorderdialog.ui b/resources/forms/printserviceorderdialog.ui index 66f44384f..131979b65 100644 --- a/resources/forms/printserviceorderdialog.ui +++ b/resources/forms/printserviceorderdialog.ui @@ -79,6 +79,16 @@
+ + + + <b>Custom Notes:</b> + + + + + +
From 9dec924f9873550aaad58b8c422bb38b659e69fb Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 7 Feb 2011 18:27:38 +0100 Subject: [PATCH 12/13] added missing doc --- openlp/core/ui/printserviceorderform.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index 546d52d55..3b01f9ac7 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -132,6 +132,9 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): def paintRequested(self, printer): """ Paint the preview of the *self.document*. + + ``printer`` + A *QPrinter* object. """ self.document.print_(printer) From 91db60ad7febbfa17bf48f6d17b6bfa2e2c6a5f7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 7 Feb 2011 19:02:13 +0100 Subject: [PATCH 13/13] fixed typos --- openlp/core/ui/printserviceorderdialog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/printserviceorderdialog.py b/openlp/core/ui/printserviceorderdialog.py index 5e7b5a031..f8db4d1c0 100644 --- a/openlp/core/ui/printserviceorderdialog.py +++ b/openlp/core/ui/printserviceorderdialog.py @@ -121,12 +121,12 @@ class Ui_PrintServiceOrderDialog(object): self.previewLabel.setText( translate('OpenLP.ServiceManager', 'Preview:')) self.printSlideTextCheckBox.setText(translate( - 'OpenLP.PrintServiceOrderForm', 'Include slide text if avaialbe')) + '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 lenght of media items')) + 'Include play length of media items')) self.serviceTitleLabel.setText(translate( 'OpenLP.PrintServiceOrderForm', 'Title:')) self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager',