From 1083cf38be7fbd0767dcad7344c1caff345c5337 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 29 Jan 2011 20:39:16 +0100 Subject: [PATCH 1/9] started with service order sheet printing --- openlp/core/ui/mainwindow.py | 17 +++++++++++++++-- openlp/core/ui/servicemanager.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index d8bedade3..ea11c7d99 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..ce400525e 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1182,3 +1182,31 @@ 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. + """ + # TODO: Add settings, consider footer. If saved service, print service + # file name. + printer = QtGui.QPrinter() + printer.setPaperSize(QtGui.QPrinter.A4) + text = u'

%s

' % translate('OpenLP.ServiceManager', + 'Service Order Sheet') + for item in self.serviceItems: + text += u'

' + item[u'service_item'].title + u'

' + if item[u'service_item'].is_text(): + for slide in item[u'service_item'].get_frames(): + text += u'

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

' + elif item[u'service_item'].is_image(): + # Get child title + pass + else: + # What to do with the other types? + pass + if item[u'service_item'].notes: + text += u'

%s ' % translate('OpenLP.ServiceManager', + 'Notes:') + item[u'service_item'].notes + u'

' + doc = QtGui.QTextDocument() + doc.setHtml(text) + doc.print_(printer) From ce49a8fe20ca5d2212fb56c1f5732358ecc435c3 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 30 Jan 2011 20:19:24 +0100 Subject: [PATCH 2/9] print footer, display plugin icon --- openlp/core/ui/servicemanager.py | 43 ++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index ce400525e..ab1d6b5c8 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1187,26 +1187,31 @@ class ServiceManager(QtGui.QWidget): """ Print a Service Order Sheet. """ - # TODO: Add settings, consider footer. If saved service, print service - # file name. - printer = QtGui.QPrinter() - printer.setPaperSize(QtGui.QPrinter.A4) + # TODO: Add settings. + if not self.serviceItems: + return + printDialog = QtGui.QPrintDialog() + if not printDialog.exec_(): + return text = u'

%s

' % translate('OpenLP.ServiceManager', 'Service Order Sheet') for item in self.serviceItems: - text += u'

' + item[u'service_item'].title + u'

' - if item[u'service_item'].is_text(): - for slide in item[u'service_item'].get_frames(): + item = item[u'service_item'] + text += u'

%s

' % (item.icon, + item.get_display_title()) + if item.is_text(): + for slide in item.get_frames(): text += u'

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

' - elif item[u'service_item'].is_image(): - # Get child title - pass - else: - # What to do with the other types? - pass - if item[u'service_item'].notes: - text += u'

%s ' % translate('OpenLP.ServiceManager', - 'Notes:') + item[u'service_item'].notes + u'

' - doc = QtGui.QTextDocument() - doc.setHtml(text) - doc.print_(printer) + elif item.is_image(): + 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: + text += u'

%s

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

%s %s

' % (translate( + 'OpenLP.ServiceManager', 'Notes:'), item.notes) + serviceDocument = QtGui.QTextDocument() + serviceDocument.setHtml(text) + serviceDocument.print_(printDialog.printer()) From e8dce46cf95a65c144f4d183feac58f3c03f12bf Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Jan 2011 18:00:56 +0100 Subject: [PATCH 3/9] --- openlp/core/lib/mediamanageritem.py | 6 +----- openlp/core/ui/servicemanager.py | 5 +++++ openlp/plugins/media/lib/mediaitem.py | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 9565a9b37..7dd74efb0 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/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index ab1d6b5c8..085644b67 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1197,19 +1197,24 @@ class ServiceManager(QtGui.QWidget): '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 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() 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) From 7b3f61e93b0096c9139f20cd0f3f10dedb69c619 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Jan 2011 20:35:35 +0100 Subject: [PATCH 4/9] added setting --- openlp/core/ui/advancedtab.py | 18 ++++++++++++++++++ openlp/core/ui/generaltab.py | 1 + openlp/core/ui/servicemanager.py | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 58b637bc2..10660a914 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', + 'Included detailed information')) # 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/servicemanager.py b/openlp/core/ui/servicemanager.py index d99ccd2d5..6b0b84472 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1187,7 +1187,6 @@ class ServiceManager(QtGui.QWidget): """ Print a Service Order Sheet. """ - # TODO: Add settings. if not self.serviceItems: return printDialog = QtGui.QPrintDialog() @@ -1200,6 +1199,9 @@ class ServiceManager(QtGui.QWidget): # 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(): From 6ac0f162a3522ffbf0015385029f41ad5b9ce961 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Jan 2011 21:39:55 +0100 Subject: [PATCH 5/9] removed white spaces --- openlp/core/lib/toolbar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 """ From 9744d246d6399692156942d72d61b7695b260d5e Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Tue, 1 Feb 2011 00:33:50 +0000 Subject: [PATCH 6/9] Deduplication --- openlp/core/lib/__init__.py | 14 ++++ openlp/core/lib/mediamanageritem.py | 22 ++++++ openlp/core/ui/serviceitemeditdialog.py | 10 +-- openlp/core/ui/serviceitemeditform.py | 27 ++++--- openlp/core/ui/servicenotedialog.py | 48 ------------- openlp/core/ui/servicenoteform.py | 22 ++++-- openlp/core/ui/slidecontroller.py | 31 ++++---- openlp/core/ui/themestab.py | 28 ++++---- openlp/plugins/bibles/lib/mediaitem.py | 43 +++++------ .../plugins/custom/forms/editcustomdialog.py | 11 +-- openlp/plugins/custom/forms/editcustomform.py | 2 +- .../custom/forms/editcustomslidedialog.py | 11 +-- openlp/plugins/custom/lib/mediaitem.py | 11 +-- .../presentations/lib/messagelistener.py | 2 +- openlp/plugins/songs/forms/authorsdialog.py | 12 +--- openlp/plugins/songs/forms/editsongdialog.py | 11 +-- openlp/plugins/songs/forms/editsongform.py | 22 +++--- openlp/plugins/songs/forms/editversedialog.py | 14 +--- openlp/plugins/songs/forms/songbookdialog.py | 12 +--- .../songs/forms/songmaintenanceform.py | 71 ++++++++----------- openlp/plugins/songs/forms/topicsdialog.py | 12 +--- openlp/plugins/songs/lib/easislidesimport.py | 50 +++++++------ openlp/plugins/songs/lib/mediaitem.py | 11 +-- 23 files changed, 205 insertions(+), 292 deletions(-) delete mode 100644 openlp/core/ui/servicenotedialog.py diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 33280f83b..ee2b68c91 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -319,6 +319,20 @@ def check_directory_exists(dir): if not os.path.exists(dir): os.makedirs(dir) +def dialogButtonsSaveCancel(parent): + """ + Return a standard dialog button box with save and cancel buttons. + """ + button_box = QtGui.QDialogButtonBox(parent) + button_box.setStandardButtons(QtGui.QDialogButtonBox.Save | + QtGui.QDialogButtonBox.Cancel) + button_box.setObjectName(u'%sButtonBox' % parent) + QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'), + parent.accept) + QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'), + parent.reject) + return button_box + from theme import ThemeLevel, ThemeXML, BackgroundGradientType, \ BackgroundType, HorizontalType, VerticalType from displaytags import DisplayTags diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 9565a9b37..f127cd998 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -540,3 +540,25 @@ class MediaManagerItem(QtGui.QWidget): individual service items need to be processed by the plugins """ pass + + def _getIdOfItemToGenerate(self, item, remoteItem): + """ + Utility method to check items being submitted for slide generation. + + ``item`` + The item to check. + + ``remoteItem`` + The id to assign if the slide generation was remotely triggered. + """ + if item is None: + if self.remoteTriggered is None: + item = self.listView.currentItem() + if item is None: + return False + item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] + else: + item_id = remoteItem + else: + item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] + return item_id diff --git a/openlp/core/ui/serviceitemeditdialog.py b/openlp/core/ui/serviceitemeditdialog.py index 3e1079ded..025a7d40c 100644 --- a/openlp/core/ui/serviceitemeditdialog.py +++ b/openlp/core/ui/serviceitemeditdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, build_icon +from openlp.core.lib import translate, build_icon, dialogButtonsSaveCancel class Ui_ServiceItemEditDialog(object): def setupUi(self, serviceItemEditDialog): @@ -52,12 +52,8 @@ class Ui_ServiceItemEditDialog(object): self.downButton.setObjectName(u'downButton') self.buttonLayout.addWidget(self.downButton) self.dialogLayout.addLayout(self.buttonLayout, 0, 1) - self.buttonBox = QtGui.QDialogButtonBox(serviceItemEditDialog) - self.buttonBox.setStandardButtons( - QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save) - self.buttonBox.setObjectName(u'buttonBox') - self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2) - + self.dialogLayout.addWidget( + dialogButtonsSaveCancel(serviceItemEditDialog), 1, 0, 1, 2) self.retranslateUi(serviceItemEditDialog) QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog) diff --git a/openlp/core/ui/serviceitemeditform.py b/openlp/core/ui/serviceitemeditform.py index edd4ee29f..0621a44bd 100644 --- a/openlp/core/ui/serviceitemeditform.py +++ b/openlp/core/ui/serviceitemeditform.py @@ -46,10 +46,6 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog): QtCore.SIGNAL(u'clicked()'), self.onItemDown) QtCore.QObject.connect(self.deleteButton, QtCore.SIGNAL(u'clicked()'), self.onItemDelete) - QtCore.QObject.connect(self.buttonBox, - QtCore.SIGNAL(u'accepted()'), self.accept) - QtCore.QObject.connect(self.buttonBox, - QtCore.SIGNAL(u'rejected()'), self.reject) QtCore.QObject.connect(self.listWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged) @@ -100,27 +96,30 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog): """ Move the current row up in the list. """ - item = self.listWidget.currentItem() - if not item: - return - row = self.listWidget.row(item) - temp = self.itemList[row] - self.itemList.remove(self.itemList[row]) - self.itemList.insert(row - 1, temp) - self.loadData() - self.listWidget.setCurrentRow(row - 1) + self.__moveItem(u'up') def onItemDown(self): """ Move the current row down in the list """ + self.__moveItem(u'down') + + def __moveItem(self, direction=u''): + """ + Move the current item. + """ + if not direction: + return item = self.listWidget.currentItem() if not item: return row = self.listWidget.row(item) temp = self.itemList[row] self.itemList.remove(self.itemList[row]) - self.itemList.insert(row + 1, temp) + if direction == u'up': + self.itemList.insert(row - 1, temp) + else: + self.itemList.insert(row + 1, temp) self.loadData() self.listWidget.setCurrentRow(row + 1) diff --git a/openlp/core/ui/servicenotedialog.py b/openlp/core/ui/servicenotedialog.py deleted file mode 100644 index 9a45dae7c..000000000 --- a/openlp/core/ui/servicenotedialog.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- 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 # -############################################################################### - -from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate - -class Ui_ServiceNoteEdit(object): - def setupUi(self, serviceNoteEdit): - serviceNoteEdit.setObjectName(u'serviceNoteEdit') - self.dialogLayout = QtGui.QVBoxLayout(serviceNoteEdit) - self.dialogLayout.setObjectName(u'verticalLayout') - self.textEdit = QtGui.QTextEdit(serviceNoteEdit) - self.textEdit.setObjectName(u'textEdit') - self.dialogLayout.addWidget(self.textEdit) - self.buttonBox = QtGui.QDialogButtonBox(serviceNoteEdit) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | - QtGui.QDialogButtonBox.Save) - self.buttonBox.setObjectName(u'buttonBox') - self.dialogLayout.addWidget(self.buttonBox) - self.retranslateUi(serviceNoteEdit) - QtCore.QMetaObject.connectSlotsByName(serviceNoteEdit) - - def retranslateUi(self, serviceNoteEdit): - serviceNoteEdit.setWindowTitle( - translate('OpenLP.ServiceNoteForm', 'Service Item Notes')) diff --git a/openlp/core/ui/servicenoteform.py b/openlp/core/ui/servicenoteform.py index de689e842..32e7dfe40 100644 --- a/openlp/core/ui/servicenoteform.py +++ b/openlp/core/ui/servicenoteform.py @@ -26,6 +26,7 @@ from PyQt4 import QtCore, QtGui +from openlp.core.lib import dialogButtonsSaveCancel, translate from servicenotedialog import Ui_ServiceNoteEdit class ServiceNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit): @@ -37,8 +38,19 @@ class ServiceNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit): Constructor """ QtGui.QDialog.__init__(self, parent) - self.setupUi(self) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), - self.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), - self.reject) \ No newline at end of file + self.setupUi() + self.retranslateUi() + + def setupUi(self): + self.setObjectName(u'serviceNoteEdit') + self.dialogLayout = QtGui.QVBoxLayout(self) + self.dialogLayout.setObjectName(u'verticalLayout') + self.textEdit = QtGui.QTextEdit(self) + self.textEdit.setObjectName(u'textEdit') + self.dialogLayout.addWidget(self.textEdit) + self.dialogLayout.addWidget(dialogButtonsSaveCancel(self)) + QtCore.QMetaObject.connectSlotsByName(self) + + def retranslateUi(self): + self.setWindowTitle( + translate('OpenLP.ServiceNoteForm', 'Service Item Notes')) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 916bf68c3..223624c4f 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -482,14 +482,7 @@ class SlideController(QtGui.QWidget): def onSongBarHandler(self): request = unicode(self.sender().text()) slideno = self.slideList[request] - if slideno > self.previewListWidget.rowCount(): - self.previewListWidget.selectRow( - self.previewListWidget.rowCount() - 1) - else: - if slideno + 1 < self.previewListWidget.rowCount(): - self.previewListWidget.scrollToItem( - self.previewListWidget.item(slideno + 1, 0)) - self.previewListWidget.selectRow(slideno) + self.__updatePreviewSelection(slideno) self.onSlideSelected() def receiveSpinDelay(self, value): @@ -665,14 +658,7 @@ class SlideController(QtGui.QWidget): self.previewListWidget.resizeRowsToContents() self.previewListWidget.setColumnWidth(0, self.previewListWidget.viewport().size().width()) - if slideno > self.previewListWidget.rowCount(): - self.previewListWidget.selectRow( - self.previewListWidget.rowCount() - 1) - else: - if slideno + 1 < self.previewListWidget.rowCount(): - self.previewListWidget.scrollToItem( - self.previewListWidget.item(slideno + 1, 0)) - self.previewListWidget.selectRow(slideno) + self.__updatePreviewSelection(slideno) self.enableToolBar(serviceItem) # Pass to display for viewing self.display.buildHtml(self.serviceItem) @@ -683,6 +669,19 @@ class SlideController(QtGui.QWidget): Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix, [serviceItem]) + def __updatePreviewSelection(self, slideno): + """ + Utility method to update the selected slide in the list. + """ + if slideno > self.previewListWidget.rowCount(): + self.previewListWidget.selectRow( + self.previewListWidget.rowCount() - 1) + else: + if slideno + 1 < self.previewListWidget.rowCount(): + self.previewListWidget.scrollToItem( + self.previewListWidget.item(slideno + 1, 0)) + self.previewListWidget.selectRow(slideno) + def onTextRequest(self): """ Return the text for the current item in controller diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index a440a564e..441b95155 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -165,13 +165,7 @@ class ThemesTab(SettingsTab): self.global_theme = unicode(self.DefaultComboBox.currentText()) self.parent.renderManager.set_global_theme( self.global_theme, self.theme_level) - image = self.parent.ThemeManagerContents.getPreviewImage( - self.global_theme) - preview = QtGui.QPixmap(unicode(image)) - if not preview.isNull(): - preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, - QtCore.Qt.SmoothTransformation) - self.DefaultListView.setPixmap(preview) + self.__previewGlobalTheme() def updateThemeList(self, theme_list): """ @@ -198,10 +192,16 @@ class ThemesTab(SettingsTab): self.parent.renderManager.set_global_theme( self.global_theme, self.theme_level) if self.global_theme is not u'': - image = self.parent.ThemeManagerContents.getPreviewImage( - self.global_theme) - preview = QtGui.QPixmap(unicode(image)) - if not preview.isNull(): - preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, - QtCore.Qt.SmoothTransformation) - self.DefaultListView.setPixmap(preview) + self.__previewGlobalTheme() + + def __previewGlobalTheme(self): + """ + Utility method to update the global theme preview image. + """ + image = self.parent.ThemeManagerContents.getPreviewImage( + self.global_theme) + preview = QtGui.QPixmap(unicode(image)) + if not preview.isNull(): + preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, + QtCore.Qt.SmoothTransformation) + self.DefaultListView.setPixmap(preview) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 614990654..009a19b60 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -525,19 +525,7 @@ class BibleMediaItem(MediaManagerItem): if self.advancedClearComboBox.currentIndex() == 0: self.listView.clear() if self.listView.count() != 0: - # Check if the first item is a second bible item or not. - bitem = self.listView.item(0) - item_second_bible = self._decodeQtObject(bitem, 'second_bible') - if item_second_bible and second_bible or not item_second_bible and \ - not second_bible: - self.displayResults(bible, second_bible) - elif criticalErrorMessageBox( - message=translate('BiblePlugin.MediaItem', - 'You cannot combine single and second bible verses. Do you ' - 'want to delete your search results and start a new search?'), - parent=self, question=True) == QtGui.QMessageBox.Yes: - self.listView.clear() - self.displayResults(bible, second_bible) + self.__checkSecondBible() else: self.displayResults(bible, second_bible) Receiver.send_message(u'cursor_normal') @@ -577,24 +565,29 @@ class BibleMediaItem(MediaManagerItem): if self.quickClearComboBox.currentIndex() == 0: self.listView.clear() if self.listView.count() != 0 and self.search_results: - bitem = self.listView.item(0) - item_second_bible = self._decodeQtObject(bitem, 'second_bible') - if item_second_bible and second_bible or not item_second_bible and \ - not second_bible: - self.displayResults(bible, second_bible) - elif criticalErrorMessageBox( - message=translate('BiblePlugin.MediaItem', - 'You cannot combine single and second bible verses. Do you ' - 'want to delete your search results and start a new search?'), - parent=self, question=True) == QtGui.QMessageBox.Yes: - self.listView.clear() - self.displayResults(bible, second_bible) + self.__checkSecondBible() elif self.search_results: self.displayResults(bible, second_bible) self.quickSearchButton.setEnabled(True) Receiver.send_message(u'cursor_normal') Receiver.send_message(u'openlp_process_events') + def __checkSecondBible(self): + """ + Check if the first item is a second bible item or not. + """ + bitem = self.listView.item(0) + item_second_bible = self._decodeQtObject(bitem, 'second_bible') + if item_second_bible and second_bible or not item_second_bible and \ + not second_bible: + self.displayResults(bible, second_bible) + elif criticalErrorMessageBox(message=translate('BiblePlugin.MediaItem', + 'You cannot combine single and second bible verses. Do you ' + 'want to delete your search results and start a new search?'), + parent=self, question=True) == QtGui.QMessageBox.Yes: + self.listView.clear() + self.displayResults(bible, second_bible) + def displayResults(self, bible, second_bible=u''): """ Displays the search results in the media manager. All data needed for diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index d778b1dfe..1703d3363 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.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, dialogButtonsSaveCancel class Ui_CustomEditDialog(object): def setupUi(self, customEditDialog): @@ -93,16 +93,9 @@ class Ui_CustomEditDialog(object): self.creditLabel.setBuddy(self.creditEdit) self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit) self.dialogLayout.addLayout(self.bottomFormLayout) - self.buttonBox = QtGui.QDialogButtonBox(customEditDialog) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | - QtGui.QDialogButtonBox.Save) - self.buttonBox.setObjectName(u'buttonBox') + self.buttonBox = dialogButtonsSaveCancel(customEditDialog) self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(customEditDialog) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), - customEditDialog.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), - customEditDialog.closePressed) QtCore.QMetaObject.connectSlotsByName(customEditDialog) def retranslateUi(self, customEditDialog): diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index ebc917e99..e274c2395 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -136,7 +136,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): if preview: self.previewButton.setVisible(True) - def closePressed(self): + def reject(self): Receiver.send_message(u'custom_edit_clear') self.close() diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index 1f4bf5b14..2f95e4755 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, SpellTextEdit +from openlp.core.lib import translate, SpellTextEdit, dialogButtonsSaveCancel class Ui_CustomSlideEditDialog(object): def setupUi(self, customSlideEditDialog): @@ -36,20 +36,13 @@ class Ui_CustomSlideEditDialog(object): self.slideTextEdit = SpellTextEdit(self) self.slideTextEdit.setObjectName(u'slideTextEdit') self.dialogLayout.addWidget(self.slideTextEdit) - self.buttonBox = QtGui.QDialogButtonBox(customSlideEditDialog) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | - QtGui.QDialogButtonBox.Save) - self.buttonBox.setObjectName(u'buttonBox') + self.buttonBox = dialogButtonsSaveCancel(customSlideEditDialog) self.splitButton = QtGui.QPushButton(customSlideEditDialog) self.splitButton.setObjectName(u'splitButton') self.buttonBox.addButton(self.splitButton, QtGui.QDialogButtonBox.ActionRole) self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(customSlideEditDialog) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), - customSlideEditDialog.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), - customSlideEditDialog.reject) QtCore.QMetaObject.connectSlotsByName(customSlideEditDialog) def retranslateUi(self, customSlideEditDialog): diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 9b8115956..ec915b0a9 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -146,16 +146,7 @@ class CustomMediaItem(MediaManagerItem): raw_footer = [] slide = None theme = None - if item is None: - if self.remoteTriggered is None: - item = self.listView.currentItem() - if item is None: - return False - item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] - else: - item_id = self.remoteCustom - else: - item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] + item_id = self._getIdOfItemToGenerate(item, self.remoteCustom) service_item.add_capability(ItemCapabilities.AllowsEdit) service_item.add_capability(ItemCapabilities.AllowsPreview) service_item.add_capability(ItemCapabilities.AllowsLoop) diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 19abadf0d..4d926ad3d 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -116,7 +116,7 @@ class Controller(object): def last(self): """ - Based on the handler passed at startup triggers the first slide + Based on the handler passed at startup triggers the last slide """ log.debug(u'Live = %s, last' % self.is_live) if not self.is_live: diff --git a/openlp/plugins/songs/forms/authorsdialog.py b/openlp/plugins/songs/forms/authorsdialog.py index 6f1c7f2a4..860e8b5ea 100644 --- a/openlp/plugins/songs/forms/authorsdialog.py +++ b/openlp/plugins/songs/forms/authorsdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate +from openlp.core.lib import dialogButtonsSaveCancel, translate class Ui_AuthorsDialog(object): def setupUi(self, authorsDialog): @@ -55,17 +55,9 @@ class Ui_AuthorsDialog(object): self.displayLabel.setBuddy(self.displayEdit) self.authorLayout.addRow(self.displayLabel, self.displayEdit) self.dialogLayout.addLayout(self.authorLayout) - self.buttonBox = QtGui.QDialogButtonBox(authorsDialog) - self.buttonBox.setStandardButtons( - QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) - self.buttonBox.setObjectName(u'buttonBox') - self.dialogLayout.addWidget(self.buttonBox) + self.dialogLayout.addWidget(dialogButtonsSaveCancel(authorsDialog)) self.retranslateUi(authorsDialog) authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height()) - QtCore.QObject.connect(self.buttonBox, - QtCore.SIGNAL(u'accepted()'), authorsDialog.accept) - QtCore.QObject.connect(self.buttonBox, - QtCore.SIGNAL(u'rejected()'), authorsDialog.reject) QtCore.QMetaObject.connectSlotsByName(authorsDialog) def retranslateUi(self, authorsDialog): diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index 675108af7..732f8e815 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.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, dialogButtonsSaveCancel class Ui_EditSongDialog(object): def setupUi(self, editSongDialog): @@ -264,16 +264,9 @@ class Ui_EditSongDialog(object): self.themeTabLayout.addWidget(self.commentsGroupBox) self.songTabWidget.addTab(self.themeTab, u'') self.dialogLayout.addWidget(self.songTabWidget) - self.buttonBox = QtGui.QDialogButtonBox(editSongDialog) - self.buttonBox.setStandardButtons( - QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save) - self.buttonBox.setObjectName(u'buttonBox') + self.buttonBox = dialogButtonsSaveCancel(editSongDialog) self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(editSongDialog) - QtCore.QObject.connect(self.buttonBox, - QtCore.SIGNAL(u'rejected()'), editSongDialog.closePressed) - QtCore.QObject.connect(self.buttonBox, - QtCore.SIGNAL(u'accepted()'), editSongDialog.accept) QtCore.QMetaObject.connectSlotsByName(editSongDialog) def retranslateUi(self, editSongDialog): diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index b36ea55e1..5e9fc1711 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -333,11 +333,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): author = Author.populate(first_name=text.rsplit(u' ', 1)[0], last_name=text.rsplit(u' ', 1)[1], display_name=text) self.manager.save_object(author) - author_item = QtGui.QListWidgetItem( - unicode(author.display_name)) - author_item.setData(QtCore.Qt.UserRole, - QtCore.QVariant(author.id)) - self.authorsListView.addItem(author_item) + self.__addAuthorToList(author) self.loadAuthors() self.authorsComboBox.setCurrentIndex(0) else: @@ -351,11 +347,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): message=translate('SongsPlugin.EditSongForm', 'This author is already in the list.')) else: - author_item = QtGui.QListWidgetItem(unicode( - author.display_name)) - author_item.setData(QtCore.Qt.UserRole, - QtCore.QVariant(author.id)) - self.authorsListView.addItem(author_item) + self.__addAuthorToList(author) self.authorsComboBox.setCurrentIndex(0) else: QtGui.QMessageBox.warning(self, @@ -365,6 +357,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): 'or type in a new author and click the "Add Author to ' 'Song" button to add the new author.')) + def __addAuthorToList(self, author): + """ + Add an author to the author list. + """ + author_item = QtGui.QListWidgetItem(unicode(author.display_name)) + author_item.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) + self.authorsListView.addItem(author_item) + def onAuthorsListViewPressed(self): if self.authorsListView.count() > 1: self.authorRemoveButton.setEnabled(True) @@ -653,7 +653,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.books = [] self.topics = [] - def closePressed(self): + def reject(self): """ Exit Dialog and do not save """ diff --git a/openlp/plugins/songs/forms/editversedialog.py b/openlp/plugins/songs/forms/editversedialog.py index 1710d8b93..5680dd8f6 100644 --- a/openlp/plugins/songs/forms/editversedialog.py +++ b/openlp/plugins/songs/forms/editversedialog.py @@ -26,7 +26,8 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, translate, SpellTextEdit +from openlp.core.lib import build_icon, dialogButtonsSaveCancel, translate, \ + SpellTextEdit from openlp.plugins.songs.lib import VerseType class Ui_EditVerseDialog(object): @@ -59,17 +60,8 @@ class Ui_EditVerseDialog(object): self.verseTypeLayout.addWidget(self.insertButton) self.verseTypeLayout.addStretch() self.dialogLayout.addLayout(self.verseTypeLayout) - self.buttonBox = QtGui.QDialogButtonBox(editVerseDialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | - QtGui.QDialogButtonBox.Save) - self.buttonBox.setObjectName(u'buttonBox') - self.dialogLayout.addWidget(self.buttonBox) + self.dialogLayout.addWidget(dialogButtonsSaveCancel(editVerseDialog)) self.retranslateUi(editVerseDialog) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), - editVerseDialog.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), - editVerseDialog.reject) QtCore.QMetaObject.connectSlotsByName(editVerseDialog) def retranslateUi(self, editVerseDialog): diff --git a/openlp/plugins/songs/forms/songbookdialog.py b/openlp/plugins/songs/forms/songbookdialog.py index 9b9da43bf..eb1220d66 100644 --- a/openlp/plugins/songs/forms/songbookdialog.py +++ b/openlp/plugins/songs/forms/songbookdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate +from openlp.core.lib import translate, dialogButtonsSaveCancel class Ui_SongBookDialog(object): def setupUi(self, songBookDialog): @@ -49,17 +49,9 @@ class Ui_SongBookDialog(object): self.publisherLabel.setBuddy(self.publisherEdit) self.bookLayout.addRow(self.publisherLabel, self.publisherEdit) self.dialogLayout.addLayout(self.bookLayout) - self.buttonBox = QtGui.QDialogButtonBox(songBookDialog) - self.buttonBox.setStandardButtons( - QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) - self.buttonBox.setObjectName(u'buttonBox') - self.dialogLayout.addWidget(self.buttonBox) + self.dialogLayout.addWidget(dialogButtonsSaveCancel(songBookDialog)) self.retranslateUi(songBookDialog) songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height()) - QtCore.QObject.connect(self.buttonBox, - QtCore.SIGNAL(u'accepted()'), songBookDialog.accept) - QtCore.QObject.connect(self.buttonBox, - QtCore.SIGNAL(u'rejected()'), songBookDialog.reject) QtCore.QMetaObject.connectSlotsByName(songBookDialog) def retranslateUi(self, songBookDialog): diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 6613a050b..2bc609ee2 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -310,12 +310,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): 'the existing author %s?')) % (author.display_name, temp_display_name, author.display_name), parent=self, question=True) == QtGui.QMessageBox.Yes: - Receiver.send_message(u'cursor_busy') - Receiver.send_message(u'openlp_process_events') - self.mergeAuthors(author) - self.resetAuthors() - Receiver.send_message(u'songs_load_list') - Receiver.send_message(u'cursor_normal') + self.__mergeObjects(author, self.mergeAuthors, + self.resetAuthors) else: # We restore the author's old first and last name as well as # his display name. @@ -350,11 +346,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): 'with topic %s use the existing topic %s?')) % (topic.name, temp_name, topic.name), parent=self, question=True) == QtGui.QMessageBox.Yes: - Receiver.send_message(u'cursor_busy') - Receiver.send_message(u'openlp_process_events') - self.mergeTopics(topic) - self.resetTopics() - Receiver.send_message(u'cursor_normal') + self.__mergeObjects(topic, self.mergeTopics, self.resetTopics) else: # We restore the topics's old name. topic.name = temp_name @@ -392,16 +384,23 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): 'with book %s use the existing book %s?')) % (book.name, temp_name, book.name), parent=self, question=True) == QtGui.QMessageBox.Yes: - Receiver.send_message(u'cursor_busy') - Receiver.send_message(u'openlp_process_events') - self.mergeBooks(book) - self.resetBooks() - Receiver.send_message(u'cursor_normal') + self.__mergeObjects(book, self.mergeBooks, self.resetBooks) else: # We restore the book's old name and publisher. book.name = temp_name book.publisher = temp_publisher + def __mergeObjects(self, object, merge, reset): + """ + Utility method to merge two objects to leave one in the database. + """ + Receiver.send_message(u'cursor_busy') + Receiver.send_message(u'openlp_process_events') + merge(object) + reset() + Receiver.send_message(u'songs_load_list') + Receiver.send_message(u'cursor_normal') + def mergeAuthors(self, old_author): """ Merges two authors into one author. @@ -508,42 +507,32 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): def onAuthorsListRowChanged(self, row): """ - Called when the *authorsListWidget* current's row has changed. - - ``row`` - The current row. If there is no current row, the value is -1 + Called when the *authorsListWidget*s current row has changed. """ - if row == -1: - self.authorsDeleteButton.setEnabled(False) - self.authorsEditButton.setEnabled(False) - else: - self.authorsDeleteButton.setEnabled(True) - self.authorsEditButton.setEnabled(True) + self.__rowChange(row, self.authorsEditButton, self.authorsDeleteButton) def onTopicsListRowChanged(self, row): """ - Called when the *booksListWidget* current's row has changed. - - ``row`` - The current row. If there is no current row, the value is -1. + Called when the *topicsListWidget*s current row has changed. """ - if row == -1: - self.topicsDeleteButton.setEnabled(False) - self.topicsEditButton.setEnabled(False) - else: - self.topicsDeleteButton.setEnabled(True) - self.topicsEditButton.setEnabled(True) + self.__rowChange(row, self.topicsEditButton, self.topicsDeleteButton) def onBooksListRowChanged(self, row): """ - Called when the *booksListWidget* current's row has changed. + Called when the *booksListWidget*s current row has changed. + """ + self.__rowChange(row, self.booksEditButton, self.booksDeleteButton) + + def __rowChange(self, row, editButton, deleteButton): + """ + Utility method to toggle if buttons are enabled. ``row`` The current row. If there is no current row, the value is -1. """ if row == -1: - self.booksDeleteButton.setEnabled(False) - self.booksEditButton.setEnabled(False) + deleteButton.setEnabled(False) + editButton.setEnabled(False) else: - self.booksDeleteButton.setEnabled(True) - self.booksEditButton.setEnabled(True) + deleteButton.setEnabled(True) + editButton.setEnabled(True) diff --git a/openlp/plugins/songs/forms/topicsdialog.py b/openlp/plugins/songs/forms/topicsdialog.py index ca0bbed97..8b4ea60bb 100644 --- a/openlp/plugins/songs/forms/topicsdialog.py +++ b/openlp/plugins/songs/forms/topicsdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate +from openlp.core.lib import translate, dialogButtonsSaveCancel class Ui_TopicsDialog(object): def setupUi(self, topicsDialog): @@ -43,17 +43,9 @@ class Ui_TopicsDialog(object): self.nameLabel.setBuddy(self.nameEdit) self.nameLayout.addRow(self.nameLabel, self.nameEdit) self.dialogLayout.addLayout(self.nameLayout) - self.buttonBox = QtGui.QDialogButtonBox(topicsDialog) - self.buttonBox.setStandardButtons( - QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) - self.buttonBox.setObjectName(u'buttonBox') - self.dialogLayout.addWidget(self.buttonBox) + self.dialogLayout.addWidget(dialogButtonsSaveCancel(topicsDialog)) self.retranslateUi(topicsDialog) topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height()) - QtCore.QObject.connect(self.buttonBox, - QtCore.SIGNAL(u'accepted()'), topicsDialog.accept) - QtCore.QObject.connect(self.buttonBox, - QtCore.SIGNAL(u'rejected()'), topicsDialog.reject) QtCore.QMetaObject.connectSlotsByName(topicsDialog) def retranslateUi(self, topicsDialog): diff --git a/openlp/plugins/songs/lib/easislidesimport.py b/openlp/plugins/songs/lib/easislidesimport.py index 84e7a3841..fe44c763a 100644 --- a/openlp/plugins/songs/lib/easislidesimport.py +++ b/openlp/plugins/songs/lib/easislidesimport.py @@ -133,30 +133,38 @@ class EasiSlidesImport(SongImport): pass def _add_copyright(self, song): + """ + Assign the copyright information from the import to the song being + created. + + ``song`` + The current song being imported. + """ copyright = [] - try: - copyright.append(unicode(song.Copyright).strip()) - except UnicodeDecodeError: - log.exception(u'Unicode decode error while decoding Copyright') - self._success = False - except AttributeError: - pass - try: - copyright.append(unicode(song.LicenceAdmin1).strip()) - except UnicodeDecodeError: - log.exception(u'Unicode decode error while decoding LicenceAdmin1') - self._success = False - except AttributeError: - pass - try: - copyright.append(unicode(song.LicenceAdmin2).strip()) - except UnicodeDecodeError: - log.exception(u'Unicode decode error while decoding LicenceAdmin2') - self._success = False - except AttributeError: - pass + self.__add_copyright_element(copyright, song.Copyright) + self.__add_copyright_element(copyright, song.LicenceAdmin1) + self.__add_copyright_element(copyright, song.LicenceAdmin2) self.add_copyright(u' '.join(copyright)) + def __add_copyright_element(self, copyright, element): + """ + Add a piece of copyright to the total copyright information for the + song. + + ``copyright`` + The array to add the information to. + + ``element`` + The imported variable to get the data from. + """ + try: + copyright.append(unicode(element).strip()) + except UnicodeDecodeError: + log.exception(u'Unicode error decoding %s' % element) + self._success = False + except AttributeError: + pass + def _parse_and_add_lyrics(self, song): try: lyrics = unicode(song.Contents).strip() diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index dc51f97f5..a62471c2d 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -337,16 +337,7 @@ class SongMediaItem(MediaManagerItem): author_list = u'' author_audit = [] ccli = u'' - if item is None: - if self.remoteTriggered is None: - item = self.listView.currentItem() - if item is None: - return False - item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] - else: - item_id = self.remoteSong - else: - item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] + item_id = self._getIdOfItemToGenerate(item, self.remoteSong) service_item.add_capability(ItemCapabilities.AllowsEdit) service_item.add_capability(ItemCapabilities.AllowsPreview) service_item.add_capability(ItemCapabilities.AllowsLoop) From f63b046d9bc62378e32f74896dfbfa5df9d6030d Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Tue, 1 Feb 2011 01:02:44 +0000 Subject: [PATCH 7/9] Fix silly incorrectly formatted name --- openlp/core/lib/__init__.py | 2 +- openlp/core/ui/serviceitemeditdialog.py | 4 ++-- openlp/core/ui/servicenoteform.py | 4 ++-- openlp/plugins/custom/forms/editcustomdialog.py | 4 ++-- openlp/plugins/custom/forms/editcustomslidedialog.py | 4 ++-- openlp/plugins/songs/forms/authorsdialog.py | 4 ++-- openlp/plugins/songs/forms/editsongdialog.py | 4 ++-- openlp/plugins/songs/forms/editversedialog.py | 4 ++-- openlp/plugins/songs/forms/songbookdialog.py | 4 ++-- openlp/plugins/songs/forms/topicsdialog.py | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index ee2b68c91..f07d7c78d 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -319,7 +319,7 @@ def check_directory_exists(dir): if not os.path.exists(dir): os.makedirs(dir) -def dialogButtonsSaveCancel(parent): +def save_cancel_button_box(parent): """ Return a standard dialog button box with save and cancel buttons. """ diff --git a/openlp/core/ui/serviceitemeditdialog.py b/openlp/core/ui/serviceitemeditdialog.py index 025a7d40c..0993c48b2 100644 --- a/openlp/core/ui/serviceitemeditdialog.py +++ b/openlp/core/ui/serviceitemeditdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, build_icon, dialogButtonsSaveCancel +from openlp.core.lib import translate, build_icon, save_cancel_button_box class Ui_ServiceItemEditDialog(object): def setupUi(self, serviceItemEditDialog): @@ -53,7 +53,7 @@ class Ui_ServiceItemEditDialog(object): self.buttonLayout.addWidget(self.downButton) self.dialogLayout.addLayout(self.buttonLayout, 0, 1) self.dialogLayout.addWidget( - dialogButtonsSaveCancel(serviceItemEditDialog), 1, 0, 1, 2) + save_cancel_button_box(serviceItemEditDialog), 1, 0, 1, 2) self.retranslateUi(serviceItemEditDialog) QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog) diff --git a/openlp/core/ui/servicenoteform.py b/openlp/core/ui/servicenoteform.py index 32e7dfe40..215ff2b9d 100644 --- a/openlp/core/ui/servicenoteform.py +++ b/openlp/core/ui/servicenoteform.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import dialogButtonsSaveCancel, translate +from openlp.core.lib import save_cancel_button_box, translate from servicenotedialog import Ui_ServiceNoteEdit class ServiceNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit): @@ -48,7 +48,7 @@ class ServiceNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit): self.textEdit = QtGui.QTextEdit(self) self.textEdit.setObjectName(u'textEdit') self.dialogLayout.addWidget(self.textEdit) - self.dialogLayout.addWidget(dialogButtonsSaveCancel(self)) + self.dialogLayout.addWidget(save_cancel_button_box(self)) QtCore.QMetaObject.connectSlotsByName(self) def retranslateUi(self): diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index 1703d3363..3d5e3a3f7 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, translate, dialogButtonsSaveCancel +from openlp.core.lib import build_icon, translate, save_cancel_button_box class Ui_CustomEditDialog(object): def setupUi(self, customEditDialog): @@ -93,7 +93,7 @@ class Ui_CustomEditDialog(object): self.creditLabel.setBuddy(self.creditEdit) self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit) self.dialogLayout.addLayout(self.bottomFormLayout) - self.buttonBox = dialogButtonsSaveCancel(customEditDialog) + self.buttonBox = save_cancel_button_box(customEditDialog) self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(customEditDialog) QtCore.QMetaObject.connectSlotsByName(customEditDialog) diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index 2f95e4755..1325590d9 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, SpellTextEdit, dialogButtonsSaveCancel +from openlp.core.lib import translate, SpellTextEdit, save_cancel_button_box class Ui_CustomSlideEditDialog(object): def setupUi(self, customSlideEditDialog): @@ -36,7 +36,7 @@ class Ui_CustomSlideEditDialog(object): self.slideTextEdit = SpellTextEdit(self) self.slideTextEdit.setObjectName(u'slideTextEdit') self.dialogLayout.addWidget(self.slideTextEdit) - self.buttonBox = dialogButtonsSaveCancel(customSlideEditDialog) + self.buttonBox = save_cancel_button_box(customSlideEditDialog) self.splitButton = QtGui.QPushButton(customSlideEditDialog) self.splitButton.setObjectName(u'splitButton') self.buttonBox.addButton(self.splitButton, diff --git a/openlp/plugins/songs/forms/authorsdialog.py b/openlp/plugins/songs/forms/authorsdialog.py index 860e8b5ea..daae83525 100644 --- a/openlp/plugins/songs/forms/authorsdialog.py +++ b/openlp/plugins/songs/forms/authorsdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import dialogButtonsSaveCancel, translate +from openlp.core.lib import translate, save_cancel_button_box class Ui_AuthorsDialog(object): def setupUi(self, authorsDialog): @@ -55,7 +55,7 @@ class Ui_AuthorsDialog(object): self.displayLabel.setBuddy(self.displayEdit) self.authorLayout.addRow(self.displayLabel, self.displayEdit) self.dialogLayout.addLayout(self.authorLayout) - self.dialogLayout.addWidget(dialogButtonsSaveCancel(authorsDialog)) + self.dialogLayout.addWidget(save_cancel_button_box(authorsDialog)) self.retranslateUi(authorsDialog) authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height()) QtCore.QMetaObject.connectSlotsByName(authorsDialog) diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index 732f8e815..4714ab093 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, translate, dialogButtonsSaveCancel +from openlp.core.lib import build_icon, translate, save_cancel_button_box class Ui_EditSongDialog(object): def setupUi(self, editSongDialog): @@ -264,7 +264,7 @@ class Ui_EditSongDialog(object): self.themeTabLayout.addWidget(self.commentsGroupBox) self.songTabWidget.addTab(self.themeTab, u'') self.dialogLayout.addWidget(self.songTabWidget) - self.buttonBox = dialogButtonsSaveCancel(editSongDialog) + self.buttonBox = save_cancel_button_box(editSongDialog) self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(editSongDialog) QtCore.QMetaObject.connectSlotsByName(editSongDialog) diff --git a/openlp/plugins/songs/forms/editversedialog.py b/openlp/plugins/songs/forms/editversedialog.py index 5680dd8f6..d74da50d1 100644 --- a/openlp/plugins/songs/forms/editversedialog.py +++ b/openlp/plugins/songs/forms/editversedialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, dialogButtonsSaveCancel, translate, \ +from openlp.core.lib import build_icon, save_cancel_button_box, translate, \ SpellTextEdit from openlp.plugins.songs.lib import VerseType @@ -60,7 +60,7 @@ class Ui_EditVerseDialog(object): self.verseTypeLayout.addWidget(self.insertButton) self.verseTypeLayout.addStretch() self.dialogLayout.addLayout(self.verseTypeLayout) - self.dialogLayout.addWidget(dialogButtonsSaveCancel(editVerseDialog)) + self.dialogLayout.addWidget(save_cancel_button_box(editVerseDialog)) self.retranslateUi(editVerseDialog) QtCore.QMetaObject.connectSlotsByName(editVerseDialog) diff --git a/openlp/plugins/songs/forms/songbookdialog.py b/openlp/plugins/songs/forms/songbookdialog.py index eb1220d66..757a629ab 100644 --- a/openlp/plugins/songs/forms/songbookdialog.py +++ b/openlp/plugins/songs/forms/songbookdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, dialogButtonsSaveCancel +from openlp.core.lib import translate, save_cancel_button_box class Ui_SongBookDialog(object): def setupUi(self, songBookDialog): @@ -49,7 +49,7 @@ class Ui_SongBookDialog(object): self.publisherLabel.setBuddy(self.publisherEdit) self.bookLayout.addRow(self.publisherLabel, self.publisherEdit) self.dialogLayout.addLayout(self.bookLayout) - self.dialogLayout.addWidget(dialogButtonsSaveCancel(songBookDialog)) + self.dialogLayout.addWidget(save_cancel_button_box(songBookDialog)) self.retranslateUi(songBookDialog) songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height()) QtCore.QMetaObject.connectSlotsByName(songBookDialog) diff --git a/openlp/plugins/songs/forms/topicsdialog.py b/openlp/plugins/songs/forms/topicsdialog.py index 8b4ea60bb..38c45407f 100644 --- a/openlp/plugins/songs/forms/topicsdialog.py +++ b/openlp/plugins/songs/forms/topicsdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, dialogButtonsSaveCancel +from openlp.core.lib import translate, save_cancel_button_box class Ui_TopicsDialog(object): def setupUi(self, topicsDialog): @@ -43,7 +43,7 @@ class Ui_TopicsDialog(object): self.nameLabel.setBuddy(self.nameEdit) self.nameLayout.addRow(self.nameLabel, self.nameEdit) self.dialogLayout.addLayout(self.nameLayout) - self.dialogLayout.addWidget(dialogButtonsSaveCancel(topicsDialog)) + self.dialogLayout.addWidget(save_cancel_button_box(topicsDialog)) self.retranslateUi(topicsDialog) topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height()) QtCore.QMetaObject.connectSlotsByName(topicsDialog) From cfb263cd821338eff00d336c391aea2d858d0897 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 1 Feb 2011 07:27:19 +0100 Subject: [PATCH 8/9] --- openlp/core/ui/servicemanager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 6b0b84472..d43e06fe7 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -1192,12 +1192,14 @@ class ServiceManager(QtGui.QWidget): printDialog = QtGui.QPrintDialog() if not printDialog.exec_(): return - text = u'

%s

' % translate('OpenLP.ServiceManager', + text = u'

%s

' % translate('OpenLP.ServiceManager', + 'Service Order Sheet') + 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, + text += u'

%s

' % (item.icon, item.get_display_title()) if not QtCore.QSettings().value(u'advanced' + u'/detailed service print', QtCore.QVariant(True)).toBool(): From a31fda9463d270b433a900eba4a88b5fe29a58c4 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 1 Feb 2011 19:22:48 +0100 Subject: [PATCH 9/9] fixed camelCase --- openlp/core/ui/mainwindow.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index ea11c7d99..8477ccc24 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -175,10 +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') + self.printServiceOrderItem = QtGui.QAction(mainWindow) + self.printServiceOrderItem.setObjectName(u'printServiceItem') mainWindow.actionList.add_action( - self.PrintServiceOrderItem, u'Print Service Order') + 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') @@ -306,7 +306,7 @@ class Ui_MainWindow(object): (self.ExportThemeItem, self.ExportLanguageItem)) self.FileMenuActions = (self.FileNewItem, self.FileOpenItem, self.FileSaveItem, self.FileSaveAsItem, None, - self.PrintServiceOrderItem, None, self.FileImportMenu.menuAction(), + self.printServiceOrderItem, None, self.FileImportMenu.menuAction(), self.FileExportMenu.menuAction(), self.FileExitItem) add_actions(self.ViewModeMenu, (self.ModeDefaultItem, self.ModeSetupItem, self.ModeLiveItem)) @@ -385,11 +385,11 @@ class Ui_MainWindow(object): 'Save the current service under a new name.')) self.FileSaveAsItem.setShortcut( translate('OpenLP.MainWindow', 'Ctrl+Shift+S')) - self.PrintServiceOrderItem.setText( + self.printServiceOrderItem.setText( translate('OpenLP.MainWindow', 'Print Service Order')) - self.PrintServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow', + self.printServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow', 'Print the current Service Order.')) - self.PrintServiceOrderItem.setShortcut( + self.printServiceOrderItem.setShortcut( translate('OpenLP.MainWindow', 'Ctrl+P')) self.FileExitItem.setText( translate('OpenLP.MainWindow', 'E&xit')) @@ -577,7 +577,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.QObject.connect(self.FileSaveAsItem, QtCore.SIGNAL(u'triggered()'), self.ServiceManagerContents.saveFileAs) - QtCore.QObject.connect(self.PrintServiceOrderItem, + QtCore.QObject.connect(self.printServiceOrderItem, QtCore.SIGNAL(u'triggered()'), self.ServiceManagerContents.printServiceOrder) # i18n set signals for languages