diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index f127cd998..7bbdb4f06 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -103,7 +103,6 @@ class MediaManagerItem(QtGui.QWidget): self.icon = build_icon(icon) self.toolbar = None self.remoteTriggered = None - self.serviceItemIconName = None self.singleServiceItem = True self.pageLayout = QtGui.QVBoxLayout(self) self.pageLayout.setSpacing(0) @@ -525,10 +524,7 @@ class MediaManagerItem(QtGui.QWidget): Common method for generating a service item """ serviceItem = ServiceItem(self.parent) - if self.serviceItemIconName: - serviceItem.add_icon(self.serviceItemIconName) - else: - serviceItem.add_icon(self.parent.icon_path) + serviceItem.add_icon(self.parent.icon_path) if self.generateSlideData(serviceItem, item, xmlVersion): return serviceItem else: diff --git a/openlp/core/lib/toolbar.py b/openlp/core/lib/toolbar.py index f2c7f1b0d..b1aa3d96f 100644 --- a/openlp/core/lib/toolbar.py +++ b/openlp/core/lib/toolbar.py @@ -73,13 +73,13 @@ class OpenLPToolbar(QtGui.QToolBar): ``checkable`` If *True* the button has two, *off* and *on*, states. Default is *False*, which means the buttons has only one state. - + ``shortcut`` The primary shortcut for this action - + ``alternate`` The alternate shortcut for this action - + ``context`` Specify the context in which this shortcut is valid """ diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 58b637bc2..db6efcf4c 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -80,6 +80,16 @@ 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.detailedServicePrintCheckBox = QtGui.QCheckBox( + self.serviceOrderGroupBox) + self.detailedServicePrintCheckBox.setObjectName( + u'detailedServicePrintCheckBox') + self.serviceOrderLayout.addWidget(self.detailedServicePrintCheckBox) + self.leftLayout.addWidget(self.serviceOrderGroupBox) # self.sharedDirGroupBox = QtGui.QGroupBox(self.leftColumn) # self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox') # self.sharedDirLayout = QtGui.QFormLayout(self.sharedDirGroupBox) @@ -129,6 +139,10 @@ 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.detailedServicePrintCheckBox.setText(translate('OpenLP.AdvancedTab', + 'Print slide texts and service item notes as well')) # self.sharedDirGroupBox.setTitle( # translate('AdvancedTab', 'Central Data Store')) # self.sharedCheckBox.setText( @@ -164,6 +178,8 @@ 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()) settings.endGroup() def save(self): @@ -184,6 +200,8 @@ 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.endGroup() # def onSharedCheckBoxChanged(self, checked): diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index edace883f..12353fed8 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -51,6 +51,7 @@ class ValidEdit(QtGui.QLineEdit): else: return self.text() + class GeneralTab(SettingsTab): """ GeneralTab is the general settings tab in the settings dialog. diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index d8bedade3..8477ccc24 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -175,6 +175,10 @@ class Ui_MainWindow(object): self.FileSaveAsItem = QtGui.QAction(mainWindow) self.FileSaveAsItem.setObjectName(u'FileSaveAsItem') mainWindow.actionList.add_action(self.FileSaveAsItem, u'File') + self.printServiceOrderItem = QtGui.QAction(mainWindow) + self.printServiceOrderItem.setObjectName(u'printServiceItem') + mainWindow.actionList.add_action( + self.printServiceOrderItem, u'Print Service Order') self.FileExitItem = QtGui.QAction(mainWindow) self.FileExitItem.setIcon(build_icon(u':/system/system_exit.png')) self.FileExitItem.setObjectName(u'FileExitItem') @@ -302,8 +306,8 @@ class Ui_MainWindow(object): (self.ExportThemeItem, self.ExportLanguageItem)) self.FileMenuActions = (self.FileNewItem, self.FileOpenItem, self.FileSaveItem, self.FileSaveAsItem, None, - self.FileImportMenu.menuAction(), self.FileExportMenu.menuAction(), - self.FileExitItem) + self.printServiceOrderItem, None, self.FileImportMenu.menuAction(), + self.FileExportMenu.menuAction(), self.FileExitItem) add_actions(self.ViewModeMenu, (self.ModeDefaultItem, self.ModeSetupItem, self.ModeLiveItem)) add_actions(self.ViewMenu, (self.ViewModeMenu.menuAction(), @@ -381,6 +385,12 @@ class Ui_MainWindow(object): 'Save the current service under a new name.')) self.FileSaveAsItem.setShortcut( translate('OpenLP.MainWindow', 'Ctrl+Shift+S')) + self.printServiceOrderItem.setText( + translate('OpenLP.MainWindow', 'Print Service Order')) + self.printServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow', + 'Print the current Service Order.')) + self.printServiceOrderItem.setShortcut( + translate('OpenLP.MainWindow', 'Ctrl+P')) self.FileExitItem.setText( translate('OpenLP.MainWindow', 'E&xit')) self.FileExitItem.setStatusTip( @@ -567,6 +577,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.QObject.connect(self.FileSaveAsItem, QtCore.SIGNAL(u'triggered()'), self.ServiceManagerContents.saveFileAs) + QtCore.QObject.connect(self.printServiceOrderItem, + QtCore.SIGNAL(u'triggered()'), + self.ServiceManagerContents.printServiceOrder) # i18n set signals for languages QtCore.QObject.connect(self.AutoLanguageItem, QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 22a873855..81599085b 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -856,7 +856,7 @@ class ServiceManager(QtGui.QWidget): one it allows the item to be displayed. """ if serviceItem.is_command(): - type = serviceItem._raw_frames[0][u'title'].split(u'.')[1] + type = serviceItem._raw_frames[0][u'title'].split(u'.')[-1] if type not in self.suffixes: serviceItem.is_valid = False @@ -1182,3 +1182,46 @@ class ServiceManager(QtGui.QWidget): data_item[u'selected'] = (item == curitem) data.append(data_item) Receiver.send_message(u'servicemanager_list_response', data) + + def printServiceOrder(self): + """ + Print a Service Order Sheet. + """ + if not self.serviceItems: + criticalErrorMessageBox( + message=translate('OpenLP.ServiceManager', + 'There is no service item in this service.')) + return + 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 + 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) + serviceDocument = QtGui.QTextDocument() + serviceDocument.setHtml(text) + serviceDocument.print_(printDialog.printer()) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index e7beb81a9..c68b11c85 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -57,7 +57,6 @@ class MediaMediaItem(MediaManagerItem): u':/media/media_video.png').toImage() MediaManagerItem.__init__(self, parent, self, icon) self.singleServiceItem = False - self.serviceItemIconName = u':/media/image_clapperboard.png' QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'video_background_replaced'), self.videobackgroundReplaced)