From 4c0928699df3ec647f541f3470808b3a5cc9f6c5 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 14 Feb 2011 19:52:05 +0000 Subject: [PATCH 01/15] Print Dialog fixes --- openlp.pyw | 3 ++- openlp/core/ui/mainwindow.py | 5 +++-- openlp/core/ui/printserviceorderform.py | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 100c3336f..d425a0b37 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -188,7 +188,8 @@ class OpenLP(QtGui.QApplication): u'primary': (self.desktop().primaryScreen() == screen)}) log.info(u'Screen %d found with resolution %s', screen, size) # start the main app window - self.mainWindow = MainWindow(screens, app_version) + self.appClipboard = self.clipboard() + self.mainWindow = MainWindow(screens, app_version, self.appClipboard) self.mainWindow.show() if show_splash: # now kill the splashscreen diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 4840ef5da..f498c1bc3 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -240,7 +240,7 @@ class Ui_MainWindow(object): languageItem.setChecked(True) add_actions(self.LanguageGroup, [languageItem]) self.SettingsShortcutsItem = icon_action(mainWindow, - u'SettingsShortcutsItem', + u'SettingsShortcutsItem', u':/system/system_configure_shortcuts.png') self.SettingsConfigureItem = icon_action(mainWindow, u'SettingsConfigureItem', u':/system/system_settings.png') @@ -458,7 +458,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): actionList = ActionList() - def __init__(self, screens, applicationVersion): + def __init__(self, screens, applicationVersion, clipboard): """ This constructor sets up the interface, the various managers, and the plugins. @@ -467,6 +467,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.screens = screens self.actionList = ActionList() self.applicationVersion = applicationVersion + self.clipboard = clipboard # Set up settings sections for the main application # (not for use by plugins) self.uiSettingsSection = u'user interface' diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index 70128cb89..cad654280 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -37,6 +37,7 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): Constructor """ QtGui.QDialog.__init__(self, parent) + self.parent = parent self.serviceManager = serviceManager self.printer = QtGui.QPrinter() self.printDialog = QtGui.QPrintDialog(self.printer, self) @@ -86,14 +87,14 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): for item in self.serviceManager.serviceItems: item = item[u'service_item'] # Add the title of the service item. - text += u'

%s

' % (item.icon, + 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'

' + text += u'

' + slide[u'html'] + u'

' elif item.is_image(): # Add the image names of the service item. text += u'
    ' @@ -120,6 +121,7 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): u'Custom Service Notes:'), self.customNoteEdit.toPlainText()) self.document.setHtml(text) self.previewWidget.updatePreview() + self.parent.clipboard.setText(text) def paintRequested(self, printer): """ From f980d1e0b9503e00f579d6b636ca49be83ca071f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 15 Feb 2011 18:51:37 +0000 Subject: [PATCH 02/15] Finish Print dialog updates --- openlp/core/lib/ui.py | 2 ++ openlp/core/ui/printserviceorderdialog.py | 19 ++++++++--- openlp/core/ui/printserviceorderform.py | 41 +++++++++++++++++++++-- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 400381b0c..224145a99 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -48,6 +48,8 @@ class UiStrings(object): AllFiles = translate('OpenLP.Ui', 'All Files') Authors = translate('OpenLP.Ui', 'Authors') CreateANew = unicode(translate('OpenLP.Ui', 'Create a new %s.')) + CopyToHtml = translate('OpenLP.Ui', 'Copy to Html') + CopyToText = translate('OpenLP.Ui', 'Copy to Text') Delete = translate('OpenLP.Ui', '&Delete') DeleteSelect = unicode(translate('OpenLP.Ui', 'Delete the selected %s.')) DeleteType = unicode(translate('OpenLP.Ui', 'Delete %s')) diff --git a/openlp/core/ui/printserviceorderdialog.py b/openlp/core/ui/printserviceorderdialog.py index f8db4d1c0..c464a7814 100644 --- a/openlp/core/ui/printserviceorderdialog.py +++ b/openlp/core/ui/printserviceorderdialog.py @@ -27,6 +27,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate, SpellTextEdit +from openlp.core.lib.ui import UiStrings class Ui_PrintServiceOrderDialog(object): def setupUi(self, printServiceOrderDialog): @@ -75,6 +76,9 @@ class Ui_PrintServiceOrderDialog(object): self.printMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog) self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox') self.settingsLayout.addWidget(self.printMetaDataCheckBox) + self.copyMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog) + self.copyMetaDataCheckBox.setObjectName(u'copyMetaDataCheckBox') + self.settingsLayout.addWidget(self.copyMetaDataCheckBox) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.settingsLayout.addItem(spacerItem) @@ -90,12 +94,15 @@ class Ui_PrintServiceOrderDialog(object): spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.buttonLayout.addItem(spacerItem) - self.cancelButton = QtGui.QPushButton(printServiceOrderDialog) - self.cancelButton.setObjectName(u'cancelButton') - self.buttonLayout.addWidget(self.cancelButton) + self.copyTextButton = QtGui.QPushButton(printServiceOrderDialog) + self.copyTextButton.setObjectName(u'copyTextButton') + self.buttonLayout.addWidget(self.copyTextButton) self.printButton = QtGui.QPushButton(printServiceOrderDialog) self.printButton.setObjectName(u'printButton') self.buttonLayout.addWidget(self.printButton) + self.cancelButton = QtGui.QPushButton(printServiceOrderDialog) + self.cancelButton.setObjectName(u'cancelButton') + self.buttonLayout.addWidget(self.cancelButton) self.dialogLayout.addLayout(self.buttonLayout, 1, 3, 1, 1) self.zoomButtonLayout = QtGui.QHBoxLayout() self.zoomButtonLayout.setObjectName(u'zoomButtonLayout') @@ -119,7 +126,7 @@ class Ui_PrintServiceOrderDialog(object): printServiceOrderDialog.setWindowTitle( translate('OpenLP.PrintServiceOrderForm', 'Print Service Order')) self.previewLabel.setText( - translate('OpenLP.ServiceManager', 'Preview:')) + translate('OpenLP.PrintServiceOrderForm', 'Preview:')) self.printSlideTextCheckBox.setText(translate( 'OpenLP.PrintServiceOrderForm', 'Include slide text if available')) self.printNotesCheckBox.setText(translate( @@ -127,10 +134,14 @@ class Ui_PrintServiceOrderDialog(object): self.printMetaDataCheckBox.setText( translate('OpenLP.PrintServiceOrderForm', 'Include play length of media items')) + self.copyMetaDataCheckBox.setText( + translate('OpenLP.PrintServiceOrderForm', + 'Copy output as HTML')) self.serviceTitleLabel.setText(translate( 'OpenLP.PrintServiceOrderForm', 'Title:')) self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager', 'Service Order Sheet')) + self.copyTextButton.setText(UiStrings.CopyToText) self.printButton.setText(translate('OpenLP.ServiceManager', 'Print')) self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel')) self.customNotesLabel.setText( diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index cad654280..78ff34e1c 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -29,9 +29,11 @@ import os from PyQt4 import QtCore, QtGui from openlp.core.lib import translate +from openlp.core.lib.ui import UiStrings from openlp.core.ui.printserviceorderdialog import Ui_PrintServiceOrderDialog class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): + def __init__(self, parent, serviceManager): """ Constructor @@ -52,6 +54,10 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): u'print file meta data', QtCore.QVariant(False)).toBool()) self.printNotesCheckBox.setChecked(settings.value( u'print notes', QtCore.QVariant(False)).toBool()) + self.copyMetaDataCheckBox.setChecked(settings.value( + u'html copy', QtCore.QVariant(False)).toBool()) + if self.copyMetaDataCheckBox.isChecked(): + self.copyTextButton.setText(UiStrings.CopyToHtml) settings.endGroup() # Signals QtCore.QObject.connect(self.printButton, @@ -75,6 +81,10 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): QtCore.SIGNAL(u'textChanged()'), self.updatePreviewText) QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL(u'clicked()'), self.reject) + QtCore.QObject.connect(self.copyTextButton, + QtCore.SIGNAL(u'clicked()'), self.copyText) + QtCore.QObject.connect(self.copyMetaDataCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), self.updateTextFormat) self.updatePreviewText() def updatePreviewText(self): @@ -93,8 +103,17 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): if self.printSlideTextCheckBox.isChecked(): if item.is_text(): # Add the text of the service item. + verse = None for slide in item.get_frames(): - text += u'

    ' + slide[u'html'] + u'

    ' + if not verse: + text += u'

    ' + slide[u'html'] + verse = slide[u'verseTag'] + elif verse != slide[u'verseTag']: + text += u'<\p>

    ' + slide[u'html'] + verse = slide[u'verseTag'] + else: + text += u'
    ' + slide[u'html'] + text += u'

    ' elif item.is_image(): # Add the image names of the service item. text += u'
      ' @@ -121,7 +140,6 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): u'Custom Service Notes:'), self.customNoteEdit.toPlainText()) self.document.setHtml(text) self.previewWidget.updatePreview() - self.parent.clipboard.setText(text) def paintRequested(self, printer): """ @@ -132,6 +150,13 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): """ self.document.print_(printer) + def copyText(self): + if self.copyMetaDataCheckBox.isChecked(): + self.parent.clipboard.setText(self.document.toHtml()) + else: + self.parent.clipboard.setText(self.document.toPlainText()) + self.accept() + def printServiceOrder(self): """ Called, when the *printButton* is clicked. Opens the *printDialog*. @@ -154,6 +179,16 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): """ self.previewWidget.zoomOut() + def updateTextFormat(self, value): + """ + Called when html copy check box is selected. + """ + if value == QtCore.Qt.Checked: + self.copyTextButton.setText(UiStrings.CopyToHtml) + else: + self.copyTextButton.setText(UiStrings.CopyToText) + + def accept(self): """ Save the settings and close the dialog. @@ -167,6 +202,8 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): QtCore.QVariant(self.printMetaDataCheckBox.isChecked())) settings.setValue(u'print notes', QtCore.QVariant(self.printNotesCheckBox.isChecked())) + settings.setValue(u'html copy', + QtCore.QVariant(self.copyMetaDataCheckBox.isChecked())) settings.endGroup() # Close the dialog. return QtGui.QDialog.accept(self) From 33a77b72f784a0d9d62a580beff6aaa9ff72a2f9 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 15 Feb 2011 19:26:43 +0000 Subject: [PATCH 03/15] Fixes --- openlp/core/lib/ui.py | 2 +- openlp/core/ui/printserviceorderform.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 8a1bf828f..27c510eb2 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -44,7 +44,7 @@ class UiStrings(object): Advanced = translate('OpenLP.Ui', 'Advanced') AllFiles = translate('OpenLP.Ui', 'All Files') Authors = translate('OpenLP.Ui', 'Authors') - CopyToHtml = translate('OpenLP.Ui', 'Copy to Html') + CopyToHtml = translate('OpenLP.Ui', 'Copy to HTML') CopyToText = translate('OpenLP.Ui', 'Copy to Text') CreateService = translate('OpenLP.Ui', 'Create a new service.') Delete = translate('OpenLP.Ui', '&Delete') diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index 0fca2c297..cfd0f7a52 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -187,7 +187,6 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): else: self.copyTextButton.setText(UiStrings.CopyToText) - def accept(self): """ Save the settings and close the dialog. From e4876cd84cba4dc6d0b5e36203a8dff6d4d39085 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 18 Feb 2011 17:38:39 +0000 Subject: [PATCH 04/15] print changes --- openlp/core/lib/ui.py | 2 - openlp/core/ui/printserviceorderdialog.py | 18 +- openlp/core/ui/printserviceorderform.py | 27 +- resources/forms/printserviceorderdialog.ui | 396 +++++++++++---------- 4 files changed, 234 insertions(+), 209 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 27c510eb2..a98e2fb7f 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -44,8 +44,6 @@ class UiStrings(object): Advanced = translate('OpenLP.Ui', 'Advanced') AllFiles = translate('OpenLP.Ui', 'All Files') Authors = translate('OpenLP.Ui', 'Authors') - CopyToHtml = translate('OpenLP.Ui', 'Copy to HTML') - CopyToText = translate('OpenLP.Ui', 'Copy to Text') CreateService = translate('OpenLP.Ui', 'Create a new service.') Delete = translate('OpenLP.Ui', '&Delete') Edit = translate('OpenLP.Ui', '&Edit') diff --git a/openlp/core/ui/printserviceorderdialog.py b/openlp/core/ui/printserviceorderdialog.py index c464a7814..c8b47b3e3 100644 --- a/openlp/core/ui/printserviceorderdialog.py +++ b/openlp/core/ui/printserviceorderdialog.py @@ -32,6 +32,8 @@ from openlp.core.lib.ui import UiStrings class Ui_PrintServiceOrderDialog(object): def setupUi(self, printServiceOrderDialog): printServiceOrderDialog.setObjectName(u'printServiceOrderDialog') + self.verticalLayout = QtGui.QGridLayout(printServiceOrderDialog) + self.verticalLayout.setObjectName(u'verticalLayout') self.dialogLayout = QtGui.QGridLayout(printServiceOrderDialog) self.dialogLayout.setObjectName(u'dialogLayout') self.perviewLayout = QtGui.QVBoxLayout() @@ -76,9 +78,6 @@ class Ui_PrintServiceOrderDialog(object): self.printMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog) self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox') self.settingsLayout.addWidget(self.printMetaDataCheckBox) - self.copyMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog) - self.copyMetaDataCheckBox.setObjectName(u'copyMetaDataCheckBox') - self.settingsLayout.addWidget(self.copyMetaDataCheckBox) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.settingsLayout.addItem(spacerItem) @@ -94,6 +93,9 @@ class Ui_PrintServiceOrderDialog(object): spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.buttonLayout.addItem(spacerItem) + self.copyHtmlButton = QtGui.QPushButton(printServiceOrderDialog) + self.copyHtmlButton.setObjectName(u'copyHtmlButton') + self.buttonLayout.addWidget(self.copyHtmlButton) self.copyTextButton = QtGui.QPushButton(printServiceOrderDialog) self.copyTextButton.setObjectName(u'copyTextButton') self.buttonLayout.addWidget(self.copyTextButton) @@ -103,7 +105,7 @@ class Ui_PrintServiceOrderDialog(object): self.cancelButton = QtGui.QPushButton(printServiceOrderDialog) self.cancelButton.setObjectName(u'cancelButton') self.buttonLayout.addWidget(self.cancelButton) - self.dialogLayout.addLayout(self.buttonLayout, 1, 3, 1, 1) + self.dialogLayout.addLayout(self.buttonLayout, 2, 2, 1, 1) self.zoomButtonLayout = QtGui.QHBoxLayout() self.zoomButtonLayout.setObjectName(u'zoomButtonLayout') spacerItem = QtGui.QSpacerItem(40, 20, @@ -134,14 +136,14 @@ class Ui_PrintServiceOrderDialog(object): self.printMetaDataCheckBox.setText( translate('OpenLP.PrintServiceOrderForm', 'Include play length of media items')) - self.copyMetaDataCheckBox.setText( - translate('OpenLP.PrintServiceOrderForm', - 'Copy output as HTML')) self.serviceTitleLabel.setText(translate( 'OpenLP.PrintServiceOrderForm', 'Title:')) self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager', 'Service Order Sheet')) - self.copyTextButton.setText(UiStrings.CopyToText) + self.copyTextButton.setText(translate('OpenLP.ServiceManager', + 'Copy to Clipboard as Text')) + self.copyHtmlButton.setText(translate('OpenLP.ServiceManager', + 'Copy to Clipboard as Html')) self.printButton.setText(translate('OpenLP.ServiceManager', 'Print')) self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel')) self.customNotesLabel.setText( diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index cfd0f7a52..48cd606d0 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -53,10 +53,6 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): u'print file meta data', QtCore.QVariant(False)).toBool()) self.printNotesCheckBox.setChecked(settings.value( u'print notes', QtCore.QVariant(False)).toBool()) - self.copyMetaDataCheckBox.setChecked(settings.value( - u'html copy', QtCore.QVariant(False)).toBool()) - if self.copyMetaDataCheckBox.isChecked(): - self.copyTextButton.setText(UiStrings.CopyToHtml) settings.endGroup() # Signals QtCore.QObject.connect(self.printButton, @@ -82,8 +78,8 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): QtCore.SIGNAL(u'clicked()'), self.reject) QtCore.QObject.connect(self.copyTextButton, QtCore.SIGNAL(u'clicked()'), self.copyText) - QtCore.QObject.connect(self.copyMetaDataCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), self.updateTextFormat) + QtCore.QObject.connect(self.copyHtmlButton, + QtCore.SIGNAL(u'clicked()'), self.copyHtmlText) self.updatePreviewText() def updatePreviewText(self): @@ -150,11 +146,18 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): self.document.print_(printer) def copyText(self): - if self.copyMetaDataCheckBox.isChecked(): - self.parent.clipboard.setText(self.document.toHtml()) - else: - self.parent.clipboard.setText(self.document.toPlainText()) - self.accept() + """ + Copies the display text to the clipboard as plain text + """ + self.parent.clipboard.setText(self.document.toPlainText()) + + + def copyHtmlText(self): + """ + Copies the display text to the clipboard as Html + """ + self.parent.clipboard.setText(self.document.toHtml()) + def printServiceOrder(self): """ @@ -200,8 +203,6 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): QtCore.QVariant(self.printMetaDataCheckBox.isChecked())) settings.setValue(u'print notes', QtCore.QVariant(self.printNotesCheckBox.isChecked())) - settings.setValue(u'html copy', - QtCore.QVariant(self.copyMetaDataCheckBox.isChecked())) settings.endGroup() # Close the dialog. return QtGui.QDialog.accept(self) diff --git a/resources/forms/printserviceorderdialog.ui b/resources/forms/printserviceorderdialog.ui index 131979b65..f95aff17b 100644 --- a/resources/forms/printserviceorderdialog.ui +++ b/resources/forms/printserviceorderdialog.ui @@ -7,197 +7,221 @@ 0 0 494 - 426 + 434 Dialog - - - - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - Service Title: - - - - - - - - - Include slide text if avaialbe - - - - - - - Include service item notes - - - - - - - Include play lenght of media items - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - <b>Custom Notes:</b> - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Cancel - - - - - - - Print - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - ... - - - - :/general/general_zoom_out.png:/general/general_zoom_out.png - - - - - - - - :/general/general_zoom_in.png:/general/general_zoom_in.png - - - - - - - - - - - - 0 - 0 - - - - Preview: - - - - - - - true - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - - - + + + + 4 + 4 + 491 + 432 + + + + + + + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + Service Title: + + + + + + + + + Include slide text if avaialbe + + + + + + + Include service item notes + + + + + + + Include play lenght of media items + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + <b>Custom Notes:</b> + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + ... + + + + :/general/general_zoom_out.png:/general/general_zoom_out.png + + + + + + + + :/general/general_zoom_in.png:/general/general_zoom_in.png + + + + + + + + + + + + 0 + 0 + + + + Preview: + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + spacer_3 + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + Cancel + + + + + + + Cancel + + + + + + + Print + + + + + + + From 1f7d6b635d3b245b390ada8ea24ed2567d1ec206 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 18 Feb 2011 19:13:37 +0000 Subject: [PATCH 05/15] Preview Edit now works --- openlp/plugins/songs/forms/editsongform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 77caf012e..c541f5a1e 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -678,8 +678,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): A button (QPushButton). """ log.debug(u'onPreview') - if unicode(button.objectName()) == u'previewButton' and \ - self.saveSong(True): + if unicode(button.objectName()) == u'previewButton': + self.saveSong(True) Receiver.send_message(u'songs_preview') def clearCaches(self): From 31b217571cd683d5f4b9d3a769f2929ae0f1c814 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 19 Feb 2011 08:36:24 +0000 Subject: [PATCH 06/15] Print Dialog updates --- openlp/core/ui/printserviceorderdialog.py | 237 +++++++++++---------- openlp/core/ui/printserviceorderform.py | 90 ++++---- resources/images/general_print.png | Bin 0 -> 880 bytes resources/images/general_zoom_in.png | Bin 716 -> 1191 bytes resources/images/general_zoom_original.png | Bin 0 -> 1182 bytes resources/images/general_zoom_out.png | Bin 662 -> 1173 bytes resources/images/openlp-2.qrc | 4 + resources/images/system_configure.png | Bin 0 -> 1101 bytes resources/images/system_edit_copy.png | Bin 0 -> 515 bytes 9 files changed, 178 insertions(+), 153 deletions(-) create mode 100644 resources/images/general_print.png create mode 100644 resources/images/general_zoom_original.png create mode 100644 resources/images/system_configure.png create mode 100644 resources/images/system_edit_copy.png diff --git a/openlp/core/ui/printserviceorderdialog.py b/openlp/core/ui/printserviceorderdialog.py index c8b47b3e3..ea3df1dba 100644 --- a/openlp/core/ui/printserviceorderdialog.py +++ b/openlp/core/ui/printserviceorderdialog.py @@ -30,121 +30,136 @@ from openlp.core.lib import build_icon, translate, SpellTextEdit from openlp.core.lib.ui import UiStrings class Ui_PrintServiceOrderDialog(object): - def setupUi(self, printServiceOrderDialog): - printServiceOrderDialog.setObjectName(u'printServiceOrderDialog') - self.verticalLayout = QtGui.QGridLayout(printServiceOrderDialog) - self.verticalLayout.setObjectName(u'verticalLayout') - self.dialogLayout = QtGui.QGridLayout(printServiceOrderDialog) - self.dialogLayout.setObjectName(u'dialogLayout') - self.perviewLayout = QtGui.QVBoxLayout() - self.perviewLayout.setObjectName(u'perviewLayout') - self.previewLabel = QtGui.QLabel(printServiceOrderDialog) - self.previewLabel.setSizePolicy( - QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) - self.previewLabel.setObjectName(u'previewLabel') - self.perviewLayout.addWidget(self.previewLabel) - self.previewWidget = QtGui.QPrintPreviewWidget( - self.printer, self, QtCore.Qt.Widget) - self.previewWidget.setEnabled(True) - self.previewWidget.setSizePolicy( - QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) - self.previewWidget.setObjectName(u'previewWidget') - # Give the previewWidget a fixed size, to prevent resizing when clicking - # the zoom buttons. - self.previewWidget.setFixedWidth(350) - self.perviewLayout.addWidget(self.previewWidget) - self.dialogLayout.addLayout(self.perviewLayout, 0, 0, 1, 1) - self.settingsLayout = QtGui.QVBoxLayout() - self.settingsLayout.setObjectName(u'settingsLayout') - self.serviceTitleLayout = QtGui.QGridLayout() - self.serviceTitleLayout.setObjectName(u'serviceTitleLayout') - self.serviceTitleLineEdit = QtGui.QLineEdit(printServiceOrderDialog) - self.serviceTitleLineEdit.setSizePolicy( - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) - self.serviceTitleLineEdit.setObjectName(u'serviceTitleLineEdit') - self.serviceTitleLayout.addWidget(self.serviceTitleLineEdit, 1, 1, 1, 1) - self.serviceTitleLabel = QtGui.QLabel(printServiceOrderDialog) - self.serviceTitleLabel.setSizePolicy( - QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) - self.serviceTitleLabel.setObjectName(u'serviceTitleLabel') - self.serviceTitleLayout.addWidget(self.serviceTitleLabel, 1, 0, 1, 1) - self.settingsLayout.addLayout(self.serviceTitleLayout) - self.printSlideTextCheckBox = QtGui.QCheckBox(printServiceOrderDialog) - self.printSlideTextCheckBox.setObjectName(u'printSlideTextCheckBox') - self.settingsLayout.addWidget(self.printSlideTextCheckBox) - self.printNotesCheckBox = QtGui.QCheckBox(printServiceOrderDialog) - self.printNotesCheckBox.setObjectName(u'printNotesCheckBox') - self.settingsLayout.addWidget(self.printNotesCheckBox) - self.printMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog) - self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox') - self.settingsLayout.addWidget(self.printMetaDataCheckBox) - 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') - spacerItem = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.buttonLayout.addItem(spacerItem) - self.copyHtmlButton = QtGui.QPushButton(printServiceOrderDialog) - self.copyHtmlButton.setObjectName(u'copyHtmlButton') - self.buttonLayout.addWidget(self.copyHtmlButton) - self.copyTextButton = QtGui.QPushButton(printServiceOrderDialog) - self.copyTextButton.setObjectName(u'copyTextButton') - self.buttonLayout.addWidget(self.copyTextButton) - self.printButton = QtGui.QPushButton(printServiceOrderDialog) - self.printButton.setObjectName(u'printButton') - self.buttonLayout.addWidget(self.printButton) - self.cancelButton = QtGui.QPushButton(printServiceOrderDialog) - self.cancelButton.setObjectName(u'cancelButton') - self.buttonLayout.addWidget(self.cancelButton) - self.dialogLayout.addLayout(self.buttonLayout, 2, 2, 1, 1) - self.zoomButtonLayout = QtGui.QHBoxLayout() - self.zoomButtonLayout.setObjectName(u'zoomButtonLayout') - spacerItem = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.zoomButtonLayout.addItem(spacerItem) - self.zoomOutButton = QtGui.QToolButton(printServiceOrderDialog) - 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) - self.zoomInButton.setIcon(build_icon(u':/general/general_zoom_in.png')) + def setupUi(self, printServiceDialog): + printServiceDialog.setObjectName(u'printServiceDialog') + printServiceDialog.resize(664, 594) + self.mainLayout = QtGui.QVBoxLayout(printServiceDialog) + self.mainLayout.setSpacing(0) + self.mainLayout.setMargin(0) + self.mainLayout.setObjectName(u'mainLayout') + self.toolbar = QtGui.QToolBar(printServiceDialog) + self.toolbar.setIconSize(QtCore.QSize(22, 22)) + self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) + self.toolbar.addAction( + QtGui.QIcon(build_icon(u':/general/general_print.png')), 'Print') + self.optionsButton = QtGui.QToolButton(self.toolbar) + self.optionsButton.setText(u'Options') + self.optionsButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) + self.optionsButton.setIcon(QtGui.QIcon( + build_icon(u':/system/system_configure.png'))) + self.optionsButton.setCheckable(True) + self.toolbar.addWidget(self.optionsButton) + self.toolbar.addAction( + QtGui.QIcon(build_icon(u':/system/system_close.png')), + 'Close') + self.toolbar.addSeparator() + self.toolbar.addAction( + QtGui.QIcon(build_icon(u':/system/system_edit_copy.png')), + 'Copy') + self.toolbar.addAction( + QtGui.QIcon(build_icon(u':/system/system_edit_copy.png')), + 'Copy as HTML') + self.toolbar.addSeparator() + self.zoomInButton = QtGui.QToolButton(self.toolbar) + self.zoomInButton.setIcon(QtGui.QIcon( + build_icon(u':/general/general_zoom_in.png'))) + self.zoomInButton.setToolTip(u'Zoom In') self.zoomInButton.setObjectName(u'zoomInButton') - self.zoomButtonLayout.addWidget(self.zoomInButton) - self.dialogLayout.addLayout(self.zoomButtonLayout, 1, 0, 1, 1) - self.retranslateUi(printServiceOrderDialog) - QtCore.QMetaObject.connectSlotsByName(printServiceOrderDialog) + self.zoomInButton.setIconSize(QtCore.QSize(22, 22)) + self.toolbar.addWidget(self.zoomInButton) + self.zoomOutButton = QtGui.QToolButton(self.toolbar) + self.zoomOutButton.setIcon(QtGui.QIcon( + build_icon(u':/general/general_zoom_out.png'))) + self.zoomOutButton.setToolTip(u'Zoom Out') + self.zoomOutButton.setObjectName(u'zoomOutButton') + self.zoomOutButton.setIconSize(QtCore.QSize(22, 22)) + self.toolbar.addWidget(self.zoomOutButton) + self.zoomOriginalButton = QtGui.QToolButton(self.toolbar) + self.zoomOriginalButton.setIcon(QtGui.QIcon( + build_icon(u':/general/general_zoom_original.png'))) + self.zoomOriginalButton.setToolTip(u'Zoom Original') + self.zoomOriginalButton.setObjectName(u'zoomOriginalButton') + self.zoomOriginalButton.setIconSize(QtCore.QSize(22, 22)) + self.toolbar.addWidget(self.zoomOriginalButton) + self.zoomComboBox = QtGui.QComboBox(printServiceDialog) + self.zoomComboBox.setObjectName((u'zoomComboBox')) + self.zoomComboBox.addItem(u'Fit Page') + self.zoomComboBox.addItem(u'Fit Width') + self.zoomComboBox.addItem(u'100%') + self.zoomComboBox.addItem(u'75%') + self.zoomComboBox.addItem(u'50%') + self.zoomComboBox.addItem(u'25%') + self.toolbar.addWidget(self.zoomComboBox) + self.mainLayout.addWidget(self.toolbar) + self.scrollArea = QtGui.QScrollArea(printServiceDialog) + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName(u'scrollArea') + self.scrollAreaWidgetContents = QtGui.QWidget() + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 227, 473)) + self.scrollAreaWidgetContents.setObjectName(u'scrollAreaWidgetContents') + self.scrollArea.setWidget(self.scrollAreaWidgetContents) + self.mainLayout.addWidget(self.scrollArea) + self.optionsWidget = QtGui.QWidget(printServiceDialog) + self.optionsWidget.hide() + self.optionsWidget.resize(400, 300) + self.optionsWidget.setAutoFillBackground(True) + self.optionsLayout = QtGui.QVBoxLayout(self.optionsWidget) + self.optionsLayout.setContentsMargins(8, 8, 8, 8) + self.titleLabel = QtGui.QLabel(self.optionsWidget) + self.titleLabel.setObjectName((u'titleLabel')) + self.titleLabel.setText(u'Title:') + self.optionsLayout.addWidget(self.titleLabel) + self.titleLineEdit = QtGui.QLineEdit(self.optionsWidget) + self.titleLineEdit.setObjectName(u'titleLineEdit') + self.optionsLayout.addWidget(self.titleLineEdit) + self.footerLabel = QtGui.QLabel(self.optionsWidget) + self.footerLabel.setObjectName(u'footerLabel') + self.footerLabel.setText(u'Custom Footer Text:') + self.optionsLayout.addWidget(self.footerLabel) + self.footerTextEdit = QtGui.QTextEdit(self.optionsWidget) + self.footerTextEdit.setObjectName(u'footerTextEdit') + self.optionsLayout.addWidget(self.footerTextEdit) + self.optionsGroupBox = QtGui.QGroupBox(u'Other Options') + self.groupLayout = QtGui.QVBoxLayout() + self.slideTextCheckBox = QtGui.QCheckBox() + self.groupLayout.addWidget(self.slideTextCheckBox) + self.notesCheckBox = QtGui.QCheckBox('Include service item notes') + self.groupLayout.addWidget(self.notesCheckBox) + self.metaDataCheckBox = QtGui.QCheckBox() + self.groupLayout.addWidget(self.metaDataCheckBox) + self.groupLayout.addStretch(1) + self.optionsGroupBox.setLayout(self.groupLayout) + self.optionsLayout.addWidget(self.optionsGroupBox) - def retranslateUi(self, printServiceOrderDialog): - printServiceOrderDialog.setWindowTitle( + self.retranslateUi(printServiceDialog) + QtCore.QMetaObject.connectSlotsByName(printServiceDialog) + QtCore.QObject.connect(self.optionsButton, + QtCore.SIGNAL(u'toggled(bool)'), self.toggleOptions) + + self.retranslateUi(printServiceDialog) + QtCore.QMetaObject.connectSlotsByName(printServiceDialog) + + def retranslateUi(self, printServiceDialog): + printServiceDialog.setWindowTitle( translate('OpenLP.PrintServiceOrderForm', 'Print Service Order')) - self.previewLabel.setText( - translate('OpenLP.PrintServiceOrderForm', 'Preview:')) - self.printSlideTextCheckBox.setText(translate( +# self.previewLabel.setText( +# translate('OpenLP.PrintServiceOrderForm', 'Preview:')) + self.slideTextCheckBox.setText(translate( 'OpenLP.PrintServiceOrderForm', 'Include slide text if available')) - self.printNotesCheckBox.setText(translate( + self.notesCheckBox.setText(translate( 'OpenLP.PrintServiceOrderForm', 'Include service item notes')) - self.printMetaDataCheckBox.setText( + self.metaDataCheckBox.setText( translate('OpenLP.PrintServiceOrderForm', 'Include play length of media items')) - self.serviceTitleLabel.setText(translate( - 'OpenLP.PrintServiceOrderForm', 'Title:')) - self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager', - 'Service Order Sheet')) - self.copyTextButton.setText(translate('OpenLP.ServiceManager', - 'Copy to Clipboard as Text')) - self.copyHtmlButton.setText(translate('OpenLP.ServiceManager', - 'Copy to Clipboard as Html')) - self.printButton.setText(translate('OpenLP.ServiceManager', 'Print')) - self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel')) - self.customNotesLabel.setText( - translate('OpenLP.ServiceManager', 'Custom Service Notes:')) +# self.serviceTitleLabel.setText(translate( +# 'OpenLP.PrintServiceOrderForm', 'Title:')) +# self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager', +# 'Service Order Sheet')) +# self.copyTextButton.setText(translate('OpenLP.ServiceManager', +# 'Copy to Clipboard as Text')) +# self.copyHtmlButton.setText(translate('OpenLP.ServiceManager', +# 'Copy to Clipboard as Html')) +# 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 48cd606d0..2bce1e837 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -47,40 +47,50 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): # Load the settings for the dialog. settings = QtCore.QSettings() settings.beginGroup(u'advanced') - self.printSlideTextCheckBox.setChecked(settings.value( + self.slideTextCheckBox.setChecked(settings.value( u'print slide text', QtCore.QVariant(False)).toBool()) - self.printMetaDataCheckBox.setChecked(settings.value( + self.metaDataCheckBox.setChecked(settings.value( u'print file meta data', QtCore.QVariant(False)).toBool()) - self.printNotesCheckBox.setChecked(settings.value( + self.notesCheckBox.setChecked(settings.value( u'print notes', QtCore.QVariant(False)).toBool()) settings.endGroup() # Signals - QtCore.QObject.connect(self.printButton, - QtCore.SIGNAL(u'clicked()'), self.printServiceOrder) - QtCore.QObject.connect(self.zoomOutButton, - QtCore.SIGNAL(u'clicked()'), self.zoomOut) - QtCore.QObject.connect(self.zoomInButton, - QtCore.SIGNAL(u'clicked()'), self.zoomIn) - QtCore.QObject.connect(self.previewWidget, - QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested) - QtCore.QObject.connect(self.serviceTitleLineEdit, - QtCore.SIGNAL(u'textChanged(const QString)'), - self.updatePreviewText) - QtCore.QObject.connect(self.printSlideTextCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText) - QtCore.QObject.connect(self.printNotesCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText) - QtCore.QObject.connect(self.printMetaDataCheckBox, - 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) - QtCore.QObject.connect(self.copyTextButton, - QtCore.SIGNAL(u'clicked()'), self.copyText) - QtCore.QObject.connect(self.copyHtmlButton, - QtCore.SIGNAL(u'clicked()'), self.copyHtmlText) - self.updatePreviewText() +# QtCore.QObject.connect(self.printButton, +# QtCore.SIGNAL(u'clicked()'), self.printServiceOrder) +# QtCore.QObject.connect(self.zoomOutButton, +# QtCore.SIGNAL(u'clicked()'), self.zoomOut) +# QtCore.QObject.connect(self.zoomInButton, +# QtCore.SIGNAL(u'clicked()'), self.zoomIn) +# QtCore.QObject.connect(self.previewWidget, +# QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested) +# QtCore.QObject.connect(self.serviceTitleLineEdit, +# QtCore.SIGNAL(u'textChanged(const QString)'), +# self.updatePreviewText) +# QtCore.QObject.connect(self.slideTextCheckBox, +# QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText) +# QtCore.QObject.connect(self.notesCheckBox, +# QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText) +# QtCore.QObject.connect(self.metaDataCheckBox, +# 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) +# QtCore.QObject.connect(self.copyTextButton, +# QtCore.SIGNAL(u'clicked()'), self.copyText) +# QtCore.QObject.connect(self.copyHtmlButton, +# QtCore.SIGNAL(u'clicked()'), self.copyHtmlText) +# self.updatePreviewText() + + def toggleOptions(self, checked): + self.optionsWidget.setVisible(checked) + if checked: + left = self.optionsButton.pos().x() + top = self.toolbar.height() + self.optionsWidget.move(left, top) + self.titleLineEdit.setFocus() + else: + self.saveOptions() def updatePreviewText(self): """ @@ -95,7 +105,7 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): text += u'

      %s

      ' % (item.icon, item.get_display_title()) # Add slide text of the service item. - if self.printSlideTextCheckBox.isChecked(): + if self.slideTextCheckBox.isChecked(): if item.is_text(): # Add the text of the service item. verse = None @@ -120,13 +130,13 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): # add footer text += u'

      %s

      ' % item.foot_text # Add service items' notes. - if self.printNotesCheckBox.isChecked(): + if self.notesCheckBox.isChecked(): if 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(): + if item.is_media() and self.metaDataCheckBox.isChecked(): text += u'

      %s %s

      ' % (translate( 'OpenLP.ServiceManager', u'Playing time:'), unicode(datetime.timedelta(seconds=item.media_length))) @@ -167,7 +177,6 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): return # Print the document. self.document.print_(self.printer) - self.accept() def zoomIn(self): """ @@ -190,7 +199,7 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): else: self.copyTextButton.setText(UiStrings.CopyToText) - def accept(self): + def saveOptions(self): """ Save the settings and close the dialog. """ @@ -198,17 +207,14 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): settings = QtCore.QSettings() settings.beginGroup(u'advanced') settings.setValue(u'print slide text', - QtCore.QVariant(self.printSlideTextCheckBox.isChecked())) + QtCore.QVariant(self.slideTextCheckBox.isChecked())) settings.setValue(u'print file meta data', - QtCore.QVariant(self.printMetaDataCheckBox.isChecked())) + QtCore.QVariant(self.metaDataCheckBox.isChecked())) settings.setValue(u'print notes', - QtCore.QVariant(self.printNotesCheckBox.isChecked())) + QtCore.QVariant(self.notesCheckBox.isChecked())) settings.endGroup() + + def close(self): # Close the dialog. return QtGui.QDialog.accept(self) - def reject(self): - """ - Close the dialog, do not print the service and do not save the settings. - """ - return QtGui.QDialog.reject(self) diff --git a/resources/images/general_print.png b/resources/images/general_print.png new file mode 100644 index 0000000000000000000000000000000000000000..8eb1c6741b62ad70bdaf4fd75d2a535d93d6d03d GIT binary patch literal 880 zcmV-$1CRWPP)-)OT5&Bd)01nK7JB8bqz-B}zf9U63KHEki(1pi_*xiLTH^n0(~c)j8uv@d*IIQhv03tcxPJZvice5)F3M!lMp}vot>R17K_;3-9@2r z#EQfUKYTvR4hNV!Ij@+xoYULeYcDDbo~8&+c|4w0wWU%Cp->1jGas0E<*ZYLGi*sN z?L$XL2P>yV?9-T$8haHVdio5u_V)JB-`|giC>o8Tr>6(Dwlm-3MzF0-w(5f|ZcF^a zLo_utg}%N%*b*k2?Q??Zk@#DHEjBG24m+)&uiUb8&J_lk+SbP0o*Ffs8SD=RC==kqO})9D|Z#^GVX8l-sOBasLn7Ib$%mdjx^mgkhg z_rmtF)sNB9q_tQsm$NPtMW*{7L@J$80|SF)1t&h;b!2t*jg&qm?I@oPRS67$DId}dwiC$+izl!n*DbuVd@mGLZP?+=%wwwy}kcD4|^~n6wUOLd|yuP z_nTkNJ>PS{{{;g6hF-5nMn=ADEw8BPqe!X=K@q&b7uM2D`iECv8MwtTjQp>Ihlhu& z+uI$V$CBBzQ}@D1n9j$q2wNprH&&tc4W(f%-_}-28^jkRHUfomi42 zTCc+l8CgNheaEL9M$LB>6jm7j!g~ei2=Mwx@4uZCWIVx&n$$|N!l0!nRADmEmnpi( z>2&(17Bi(`H)2MS7ctlX2}6-W#1{nN#ULOtlm`e9C0PMtE>AgYsH#{jb{BecMS~|M zCPqpLhH+^5HZGdhv%E<1iUORj%5OS7maim4k@KR0b7@XnM#oy)P4a=6ncqHvUa9Cg zW*{1kmhSZ&9YC|l!R3sS6tpV7*4g;bWN%)jSxHCJ8KY^7KJiiw-({{c;PANRSeE@U z7!1nA3IhCo-y*Ew=4pHF^Ihe-cD=_JEd_Ld&ojbR`HI`DiUQ9LB$=jC0JYBD>FA|UDXMX zev8F&dvbDevqw|l_laxILGjy^0Byg$)sGz&X$ z&1$u}w^J!I$8i+grvC2k?npM9oyWiv5Rb<>nx?O{KwuM_U~w>;&DINFq5uY-kVGO; z2!%qUcDubstJSu8z1}|pfxsp3Utuztu=gMykH-ige*p#7_HGjoqu~Gm002ovPDHLk FV1mKNG^+pr literal 716 zcmV;-0yF)IP)Ng=!FrWDrcisge!>7saN{P=~6mrfK`jpT_3T{q8vx zw5HJFgEze8!}mQNhlub$W%zSQr_&BW5bh&l1QGoJP)5XpuIn?2M55Xc;0_aHv)OB! zrey>{d}FfM-&ti(rCHnY)^@fcOzYhMfLJsdUFr+u^LYm$WM$Cmnmnrp)&;_e@}S|$ zZcAJ3G3@SrEBjis@=(|Hk%@_kzmo6(0E(hKaJW40O>Tdq(?zFQBH^2lKRz)_B;4tu z)8q;??TRZW%kuQm1UvwMD2icbw0~j|B>5X{_%N zDW!n{?>U=nBA4QGpJUbm9!(PI-F?1#z1e2mquawTs|UudE~UZafU?2fP&Vtv&eJ=? zZ!Jcm+{>(u&crSk8wYIXN3GZ4+Kuy+(sJJwD5VA5uljXF^?R+S@3u77Y%_lEm&R|_ zdt8_44s2~-q?8u=0+mW-=0kD$g3Q%DA_uI000qB)Ha*V9f?FXa=9GF~}r@0000;TV)u>-}ij=!1Jmawsr2{K2SAHZazfV327*FsC%b9(6MIp_6UaABO*Y4Df) z^X9$zz0aHHdBFb#1b?EtyIXI!mp0I}`XE7)Whm^cSSK?LhK?tPeoGs#_9(@CviVKFFW z96oaRI7kCVQKWr?g}8EO=1NSd@P`!&FDxt=t$DNgn-~K?T$aZG=H_VSYJ?<%n*1E! zdIC=>D9WBrOaK6B0C7ZRXyUkvN)ogpL1pHy`6UebBTA48hQKBQK|)CoBrWUo8V2J@ zK}MOjVtI5tMlB(UJWoLkAcDjMH33sJ36n`G7jOvy&;*vEa7=&{E=q!kW$8%;%d)<- z;@;lgF$%EkGa78C$fYPGAxJ({gkvbA-YXU~2(Xw0uDyt+mYBb()yyzGpqUV(F)0wRKOUK@7%t;eW%V-dY!GU)WH z!^5|acXoD8rd<$ui`bc&nH%<^oC7Dya_cMrSYbjmu@P>Up4%+8r{YIm)-tvJ2P3>| z{GQ5I{G7JDyu7)jq~!j<2uflpTaB$Av>IWak$9Ptl7Lkz>*G#ZU~f@Pl%hr?KP z^`W}5vQm8@5V*atupp%or(sJjA9v)YGZaM~^?JNm#eoWERb{1(=lSbXQ&R#C{v)AK z2ux2;|6sLRm(6DLG572&{;bWmSC&_+)#`o-wt=>`wiEJ{^du4qwZq{6k|f=QV4IMe wS?hE$)NDWn- z27;nU@0I{@dVh9QG|{V}Z*H~0i~|so3_yGgpshuKq)nhDw?O&D55KS+bVoMCxneg( zdDDq803Zt>u2WXa4#to&w}XI)7>H;mgft5^f`W1iL7o!;$(oXs-NIu8sT$B}CpN0H z;3*|Ew5U)T1nA_Yb00a)glHu(*@StJs-J+Os#BXXqL()WMpF^C&rX_lB0?nX#J#<} zLlh8%=PlTNB&8?;X{i(h5>7zgWP%(;!5s|;ViEvFQ&hslak+)rI5s>oGMH8@%gNQ5 z*_oaupUEwSm-D4h9>s$Zt=pn?5l< z{-`ck@oL>6cjeTQB=I!OA&SsM6%ZRqjfruxO`M5&npvTx#F@+9>`;}buQW+Z8ZGa?y5e|wqE^ZZ?h!-0!}@M0p7z-nvj8vTBsJr;}o zFgrV|r4grRS8g2lSeE4}iaNfyu!vP1sS4IqR~IXaa&v5KOvS-}Bp#20@$vDW3knLB zT`t$_;i)P7aB*>|A+Kc^rXPYmpuN5Qw9%3tQ52a#AOJK?`w4A)+M!H6p5T&Nou2ls*m+1{3V;?A$gCqhPTp zuWeUcZyoNLdZ*c#Z8nZ0rqRCxAQ6wpcgF(da@i|M(!sRDfB&i$J{)cO^`#a%Vf9Cx z^R-wk_SYmb0C+r}hq9u+gLAQcc22%gz~&EkrX-ZeJYNTp{s&ML5}u?#gq$ryid( zwmb=_$*#8NTT4BAa&P4g06_!@0Ej@}oBcE4v^~!lt4#tbp00kKtKQbvX1_-S4uE74 z3K1XxUghLxfH77X1w;U-*XtYa_xBduLTg455F(CiL zkjZ3p##rLjvuz*g2bQ4P^=Ni;ZeHyMr`Si=i>F&5P1B||O)E)~6c`4C;a5(l(_X_c z)&blCuneFEpi-??w>jsfY&NSEi^b3ReEx=Mnm_)WiRePgeneral_new.png general_zoom_out.png general_zoom_in.png + general_zoom_original.png + general_print.png general_open.png general_save.png general_email.png @@ -114,6 +116,8 @@ system_exit.png settings_plugin_list.png system_settings.png + system_configure.png + system_edit_copy.png system_configure_shortcuts.png diff --git a/resources/images/system_configure.png b/resources/images/system_configure.png new file mode 100644 index 0000000000000000000000000000000000000000..45b8fae8b8666fbf77bb3f906a6ea7b1ddb620f9 GIT binary patch literal 1101 zcmV-T1hV^yP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L02{9W02{9XUK)`c00007bV*G`2iXAx z12Qe)4)6T{00YfQL_t(|+MSbYOp|96$IsjLZ7HMDl|)KuRd9<5th6H|V}`kQqcbDR zT*5G0HZLI{F58gxqBdEC#2ZoEvH_ctm{K$`CIp)Z*aA^hKFon8SQ#1}pk&sr7wAft zweRKG!Gy#QGqyd+KY4P_Kfm|9=R6MusRw1XTJ$E9sWCG%vz+5OaWwk(gHR}V-r;bb zy*hd=0qH=Sn-A3bp7;_R$C5}SLT2Y?$<136r0+s6Z?S#bjvi6U)ORb5>o2(n{|N*G zB>r!lEX9^cYwJ<2tn7{ZG)@12mN!vCNR=*oDQio1woJ-#958GGD2jqXxBJZa_=FwH z0TjF96{Nrw%3qehH8V2@gb-jD23Y)nN~xU2+LIM%I$&v0QBm3S^zXp342lJoVPV_$ zZIx@+t)-tenypRQ!eps$Z>o5$s;bHs42CFah7?pP72pCPBU4(44 zyW!Bn!s6j%JEjZMs=e-;Nu0*UL7&V{qK@ z-l_I@JdmTv!8xu0WuB7n?ELw+_V)IR*x60A&Z2^-B@}}q@Vu~C&969n9Fto<{)lMS zXoya)BSxc<3=R(Pdz$w2qNNZeeBolAJ=^wLHWw5YoOO2hSQL0s(HGV>!^ht^=00000NkvXXu0mjfA3OQ4 literal 0 HcmV?d00001 diff --git a/resources/images/system_edit_copy.png b/resources/images/system_edit_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..d34cdcd32f09d66b88ae0133c6379e7d7be5afcc GIT binary patch literal 515 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H3?x5i&EW)6%*9TgAsieWw;%dH0CG7CJR*yM zqGce=SbMeU3{X(A#5JNMI6tkVJh3R1p}f3YFEcN@I61K(RWH9NefB#WDWIas0X`wF z|Ns97G9iG4g;`KgP)tlrRaFHdqNb*%p`ig}3kwVH+__`Vp52EIA3Ad6@X=#O)~#E& ze*O9l8#Zj*xN*~_O_wfRx_tTa_3PJf+_-V~-o2;Ko;`p5{N>A+@87@w^5x6duV23b z!FMqD0R}(8;1>w|{{8#UpFe;9{{8pwAJ9GFA|gP~FbJ0f`2{lwOQ@(D7@GU|rlvMe z{`B?duis_ima0JM!=5gVAr-e``y4khDe|~jujPKuwCn4?@J)AW?(W(o;_7L4S=385 zqQz#GIM23&->X;{)@;1FpK}(Y*?Z?kgH^LP7PB$2sic*7CH4JJm{z?lZFS~1?)9h2 z9=?}&a!J2a|L-BUpEp;Z)L-NBz4)VWuVU!cUXv%=pUf0XxU}biMMqYQ#@w7GcePvF z1GY>Rllx_Ecdm@{!?#yIDp@iX?wEe#=*lg9f7yJR4D!XESD&4D`2E$N;qxRaPQ1MS iDMVM4h`MnzV%zfAl3T#hTKbLh*2~7ZZD)ig{ literal 0 HcmV?d00001 From b5e369ba4dbdad7d98850bca2f98f46c8c0bcd48 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 19 Feb 2011 17:33:24 +0000 Subject: [PATCH 07/15] More Print Work --- ...ceorderdialog.py => printservicedialog.py} | 72 ++++++++++--------- ...erviceorderform.py => printserviceform.py} | 72 +++++++++++++------ openlp/core/ui/servicemanager.py | 4 +- 3 files changed, 90 insertions(+), 58 deletions(-) rename openlp/core/ui/{printserviceorderdialog.py => printservicedialog.py} (81%) rename openlp/core/ui/{printserviceorderform.py => printserviceform.py} (79%) diff --git a/openlp/core/ui/printserviceorderdialog.py b/openlp/core/ui/printservicedialog.py similarity index 81% rename from openlp/core/ui/printserviceorderdialog.py rename to openlp/core/ui/printservicedialog.py index ea3df1dba..8eb1c3d45 100644 --- a/openlp/core/ui/printserviceorderdialog.py +++ b/openlp/core/ui/printservicedialog.py @@ -29,7 +29,23 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate, SpellTextEdit from openlp.core.lib.ui import UiStrings -class Ui_PrintServiceOrderDialog(object): +class ZoomSize(): + """ + Type enumeration for Combo Box sizes + """ + Page = 0 + Width = 1 + OneHundred = 2 + SeventyFive = 3 + Fifty = 4 + TwentyFive = 5 + + Sizes = [ + translate('OpenLP.PrintServiceDialog', 'Fit Page'), + translate('OpenLP.PrintServiceDialog', 'Fit Width'), + u'100%', u'75%', u'50%', u'25%'] + +class Ui_PrintServiceDialog(object): def setupUi(self, printServiceDialog): printServiceDialog.setObjectName(u'printServiceDialog') printServiceDialog.resize(664, 594) @@ -40,23 +56,24 @@ class Ui_PrintServiceOrderDialog(object): self.toolbar = QtGui.QToolBar(printServiceDialog) self.toolbar.setIconSize(QtCore.QSize(22, 22)) self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) - self.toolbar.addAction( + self.printButton = self.toolbar.addAction( QtGui.QIcon(build_icon(u':/general/general_print.png')), 'Print') self.optionsButton = QtGui.QToolButton(self.toolbar) self.optionsButton.setText(u'Options') - self.optionsButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) + self.optionsButton.setToolButtonStyle( + QtCore.Qt.ToolButtonTextBesideIcon) self.optionsButton.setIcon(QtGui.QIcon( build_icon(u':/system/system_configure.png'))) self.optionsButton.setCheckable(True) self.toolbar.addWidget(self.optionsButton) - self.toolbar.addAction( + self.closeButton = self.toolbar.addAction( QtGui.QIcon(build_icon(u':/system/system_close.png')), 'Close') self.toolbar.addSeparator() - self.toolbar.addAction( + self.plainCopy = self.toolbar.addAction( QtGui.QIcon(build_icon(u':/system/system_edit_copy.png')), 'Copy') - self.toolbar.addAction( + self.htmlCopy = self.toolbar.addAction( QtGui.QIcon(build_icon(u':/system/system_edit_copy.png')), 'Copy as HTML') self.toolbar.addSeparator() @@ -83,22 +100,10 @@ class Ui_PrintServiceOrderDialog(object): self.toolbar.addWidget(self.zoomOriginalButton) self.zoomComboBox = QtGui.QComboBox(printServiceDialog) self.zoomComboBox.setObjectName((u'zoomComboBox')) - self.zoomComboBox.addItem(u'Fit Page') - self.zoomComboBox.addItem(u'Fit Width') - self.zoomComboBox.addItem(u'100%') - self.zoomComboBox.addItem(u'75%') - self.zoomComboBox.addItem(u'50%') - self.zoomComboBox.addItem(u'25%') self.toolbar.addWidget(self.zoomComboBox) self.mainLayout.addWidget(self.toolbar) - self.scrollArea = QtGui.QScrollArea(printServiceDialog) - self.scrollArea.setWidgetResizable(True) - self.scrollArea.setObjectName(u'scrollArea') - self.scrollAreaWidgetContents = QtGui.QWidget() - self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 227, 473)) - self.scrollAreaWidgetContents.setObjectName(u'scrollAreaWidgetContents') - self.scrollArea.setWidget(self.scrollAreaWidgetContents) - self.mainLayout.addWidget(self.scrollArea) + self.previewWidget = QtGui.QPrintPreviewWidget(printServiceDialog) + self.mainLayout.addWidget(self.previewWidget) self.optionsWidget = QtGui.QWidget(printServiceDialog) self.optionsWidget.hide() self.optionsWidget.resize(400, 300) @@ -123,7 +128,7 @@ class Ui_PrintServiceOrderDialog(object): self.groupLayout = QtGui.QVBoxLayout() self.slideTextCheckBox = QtGui.QCheckBox() self.groupLayout.addWidget(self.slideTextCheckBox) - self.notesCheckBox = QtGui.QCheckBox('Include service item notes') + self.notesCheckBox = QtGui.QCheckBox() self.groupLayout.addWidget(self.notesCheckBox) self.metaDataCheckBox = QtGui.QCheckBox() self.groupLayout.addWidget(self.metaDataCheckBox) @@ -136,21 +141,22 @@ class Ui_PrintServiceOrderDialog(object): QtCore.QObject.connect(self.optionsButton, QtCore.SIGNAL(u'toggled(bool)'), self.toggleOptions) - self.retranslateUi(printServiceDialog) - QtCore.QMetaObject.connectSlotsByName(printServiceDialog) - def retranslateUi(self, printServiceDialog): printServiceDialog.setWindowTitle( - translate('OpenLP.PrintServiceOrderForm', 'Print Service Order')) -# self.previewLabel.setText( -# translate('OpenLP.PrintServiceOrderForm', 'Preview:')) - self.slideTextCheckBox.setText(translate( - 'OpenLP.PrintServiceOrderForm', 'Include slide text if available')) - self.notesCheckBox.setText(translate( - 'OpenLP.PrintServiceOrderForm', 'Include service item notes')) - self.metaDataCheckBox.setText( - translate('OpenLP.PrintServiceOrderForm', + translate('OpenLP.PrintServiceForm', 'Print Service Order')) + self.slideTextCheckBox.setText(translate('OpenLP.PrintServiceForm', + 'Include slide text if available')) + self.notesCheckBox.setText(translate('OpenLP.PrintServiceForm', + 'Include service item notes')) + self.metaDataCheckBox.setText(translate('OpenLP.PrintServiceForm', 'Include play length of media items')) + self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Page]) + self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Width]) + self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.OneHundred]) + self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.SeventyFive]) + self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Fifty]) + self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.TwentyFive]) + # self.serviceTitleLabel.setText(translate( # 'OpenLP.PrintServiceOrderForm', 'Title:')) # self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager', diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceform.py similarity index 79% rename from openlp/core/ui/printserviceorderform.py rename to openlp/core/ui/printserviceform.py index 2bce1e837..479928dfa 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceform.py @@ -29,9 +29,9 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate from openlp.core.lib.ui import UiStrings -from openlp.core.ui.printserviceorderdialog import Ui_PrintServiceOrderDialog +from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize -class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): +class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): def __init__(self, parent, serviceManager): """ @@ -55,14 +55,20 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): u'print notes', QtCore.QVariant(False)).toBool()) settings.endGroup() # Signals -# QtCore.QObject.connect(self.printButton, -# QtCore.SIGNAL(u'clicked()'), self.printServiceOrder) -# QtCore.QObject.connect(self.zoomOutButton, -# QtCore.SIGNAL(u'clicked()'), self.zoomOut) -# QtCore.QObject.connect(self.zoomInButton, -# QtCore.SIGNAL(u'clicked()'), self.zoomIn) -# QtCore.QObject.connect(self.previewWidget, -# QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested) + QtCore.QObject.connect(self.printButton, + QtCore.SIGNAL(u'triggered()'), self.printServiceOrder) + QtCore.QObject.connect(self.closeButton, + QtCore.SIGNAL(u'triggered()'), self.accept) + QtCore.QObject.connect(self.zoomOutButton, + QtCore.SIGNAL(u'clicked()'), self.zoomOut) + QtCore.QObject.connect(self.zoomInButton, + QtCore.SIGNAL(u'clicked()'), self.zoomIn) + QtCore.QObject.connect(self.zoomOriginalButton, + QtCore.SIGNAL(u'clicked()'), self.zoomOriginal) + QtCore.QObject.connect(self.previewWidget, + QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested) + QtCore.QObject.connect(self.zoomComboBox, + QtCore.SIGNAL(u'currentIndexChanged(int)'), self.displaySizeChanged) # QtCore.QObject.connect(self.serviceTitleLineEdit, # QtCore.SIGNAL(u'textChanged(const QString)'), # self.updatePreviewText) @@ -72,7 +78,7 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): # QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText) # QtCore.QObject.connect(self.metaDataCheckBox, # QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText) -# QtCore.QObject.connect(self.customNoteEdit, +# QtCore.QObject.connect(self.footerTextEdit, # QtCore.SIGNAL(u'textChanged()'), self.updatePreviewText) # QtCore.QObject.connect(self.cancelButton, # QtCore.SIGNAL(u'clicked()'), self.reject) @@ -80,7 +86,7 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): # QtCore.SIGNAL(u'clicked()'), self.copyText) # QtCore.QObject.connect(self.copyHtmlButton, # QtCore.SIGNAL(u'clicked()'), self.copyHtmlText) -# self.updatePreviewText() + self.updatePreviewText() def toggleOptions(self, checked): self.optionsWidget.setVisible(checked) @@ -97,8 +103,8 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): Creates the html text and updates the html of *self.document*. """ text = u'' - if self.serviceTitleLineEdit.text(): - text += u'

      %s

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

      %s

      ' % unicode(self.titleLineEdit.text()) for item in self.serviceManager.serviceItems: item = item[u'service_item'] # Add the title of the service item. @@ -140,9 +146,9 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): text += u'

      %s %s

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

      %s

      %s' % (translate('OpenLP.ServiceManager', - u'Custom Service Notes:'), self.customNoteEdit.toPlainText()) + u'Custom Service Notes:'), self.footerTextEdit.toPlainText()) self.document.setHtml(text) self.previewWidget.updatePreview() @@ -155,20 +161,39 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): """ self.document.print_(printer) + def displaySizeChanged(self, display): + """ + The Zoom Combo box has changed so set up the size. + """ + if display == ZoomSize.Page: + self.previewWidget.fitInView() + elif display == ZoomSize.Width: + self.previewWidget.fitToWidth() + elif display == ZoomSize.OneHundred: + self.previewWidget.fitToWidth() + elif display == ZoomSize.SeventyFive: + self.previewWidget.fitToWidth() + elif display == ZoomSize.Fifty: + self.previewWidget.fitToWidth() + elif display == ZoomSize.TwentyFive: + self.previewWidget.fitToWidth() + settings = QtCore.QSettings() + settings.beginGroup(u'advanced') + settings.setValue(u'display size',QtCore.QVariant(display)) + settings.endGroup() + def copyText(self): """ Copies the display text to the clipboard as plain text """ self.parent.clipboard.setText(self.document.toPlainText()) - def copyHtmlText(self): """ Copies the display text to the clipboard as Html """ self.parent.clipboard.setText(self.document.toHtml()) - def printServiceOrder(self): """ Called, when the *printButton* is clicked. Opens the *printDialog*. @@ -190,6 +215,12 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): """ self.previewWidget.zoomOut() + def zoomOriginal(self): + """ + Called when *zoomOutButton* is clicked. + """ + self.previewWidget.fitInView() + def updateTextFormat(self, value): """ Called when html copy check box is selected. @@ -213,8 +244,3 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): settings.setValue(u'print notes', QtCore.QVariant(self.notesCheckBox.isChecked())) settings.endGroup() - - def close(self): - # Close the dialog. - return QtGui.QDialog.accept(self) - diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 623c2d641..f5faa22dd 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -37,7 +37,7 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \ ThemeLevel from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm -from openlp.core.ui.printserviceorderform import PrintServiceOrderForm +from openlp.core.ui.printserviceform import PrintServiceForm from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \ split_filename @@ -1208,5 +1208,5 @@ class ServiceManager(QtGui.QWidget): """ Print a Service Order Sheet. """ - settingDialog = PrintServiceOrderForm(self.mainwindow, self) + settingDialog = PrintServiceForm(self.mainwindow, self) settingDialog.exec_() From 282c81326ca0d740b542b827a825cfc7b912d506 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 19 Feb 2011 20:23:23 +0000 Subject: [PATCH 08/15] Print Dialog complete --- openlp/core/ui/printservicedialog.py | 42 ++++++++++++---------------- openlp/core/ui/printserviceform.py | 34 +++++++++++----------- 2 files changed, 34 insertions(+), 42 deletions(-) diff --git a/openlp/core/ui/printservicedialog.py b/openlp/core/ui/printservicedialog.py index 8eb1c3d45..aac5a3e44 100644 --- a/openlp/core/ui/printservicedialog.py +++ b/openlp/core/ui/printservicedialog.py @@ -59,7 +59,8 @@ class Ui_PrintServiceDialog(object): self.printButton = self.toolbar.addAction( QtGui.QIcon(build_icon(u':/general/general_print.png')), 'Print') self.optionsButton = QtGui.QToolButton(self.toolbar) - self.optionsButton.setText(u'Options') + self.optionsButton.setText(translate('OpenLP.PrintServiceForm', + 'Options')) self.optionsButton.setToolButtonStyle( QtCore.Qt.ToolButtonTextBesideIcon) self.optionsButton.setIcon(QtGui.QIcon( @@ -68,38 +69,41 @@ class Ui_PrintServiceDialog(object): self.toolbar.addWidget(self.optionsButton) self.closeButton = self.toolbar.addAction( QtGui.QIcon(build_icon(u':/system/system_close.png')), - 'Close') + translate('OpenLP.PrintServiceForm', 'Close')) self.toolbar.addSeparator() self.plainCopy = self.toolbar.addAction( QtGui.QIcon(build_icon(u':/system/system_edit_copy.png')), - 'Copy') + translate('OpenLP.PrintServiceForm', 'Copy')) self.htmlCopy = self.toolbar.addAction( QtGui.QIcon(build_icon(u':/system/system_edit_copy.png')), - 'Copy as HTML') + translate('OpenLP.PrintServiceForm', 'Copy as HTML')) self.toolbar.addSeparator() self.zoomInButton = QtGui.QToolButton(self.toolbar) self.zoomInButton.setIcon(QtGui.QIcon( build_icon(u':/general/general_zoom_in.png'))) - self.zoomInButton.setToolTip(u'Zoom In') + self.zoomInButton.setToolTip(translate('OpenLP.PrintServiceForm', + 'Zoom In')) self.zoomInButton.setObjectName(u'zoomInButton') self.zoomInButton.setIconSize(QtCore.QSize(22, 22)) self.toolbar.addWidget(self.zoomInButton) self.zoomOutButton = QtGui.QToolButton(self.toolbar) self.zoomOutButton.setIcon(QtGui.QIcon( build_icon(u':/general/general_zoom_out.png'))) - self.zoomOutButton.setToolTip(u'Zoom Out') + self.zoomOutButton.setToolTip(translate('OpenLP.PrintServiceForm', + 'Zoom Out')) self.zoomOutButton.setObjectName(u'zoomOutButton') self.zoomOutButton.setIconSize(QtCore.QSize(22, 22)) self.toolbar.addWidget(self.zoomOutButton) self.zoomOriginalButton = QtGui.QToolButton(self.toolbar) self.zoomOriginalButton.setIcon(QtGui.QIcon( build_icon(u':/general/general_zoom_original.png'))) - self.zoomOriginalButton.setToolTip(u'Zoom Original') + self.zoomOriginalButton.setToolTip(translate('OpenLP.PrintServiceForm', + 'Zoom Original')) self.zoomOriginalButton.setObjectName(u'zoomOriginalButton') self.zoomOriginalButton.setIconSize(QtCore.QSize(22, 22)) self.toolbar.addWidget(self.zoomOriginalButton) self.zoomComboBox = QtGui.QComboBox(printServiceDialog) - self.zoomComboBox.setObjectName((u'zoomComboBox')) + self.zoomComboBox.setObjectName(u'zoomComboBox') self.toolbar.addWidget(self.zoomComboBox) self.mainLayout.addWidget(self.toolbar) self.previewWidget = QtGui.QPrintPreviewWidget(printServiceDialog) @@ -111,7 +115,7 @@ class Ui_PrintServiceDialog(object): self.optionsLayout = QtGui.QVBoxLayout(self.optionsWidget) self.optionsLayout.setContentsMargins(8, 8, 8, 8) self.titleLabel = QtGui.QLabel(self.optionsWidget) - self.titleLabel.setObjectName((u'titleLabel')) + self.titleLabel.setObjectName(u'titleLabel') self.titleLabel.setText(u'Title:') self.optionsLayout.addWidget(self.titleLabel) self.titleLineEdit = QtGui.QLineEdit(self.optionsWidget) @@ -121,10 +125,11 @@ class Ui_PrintServiceDialog(object): self.footerLabel.setObjectName(u'footerLabel') self.footerLabel.setText(u'Custom Footer Text:') self.optionsLayout.addWidget(self.footerLabel) - self.footerTextEdit = QtGui.QTextEdit(self.optionsWidget) + self.footerTextEdit = SpellTextEdit(self.optionsWidget) self.footerTextEdit.setObjectName(u'footerTextEdit') self.optionsLayout.addWidget(self.footerTextEdit) - self.optionsGroupBox = QtGui.QGroupBox(u'Other Options') + self.optionsGroupBox = QtGui.QGroupBox( + translate('OpenLP.PrintServiceForm','Other Options')) self.groupLayout = QtGui.QVBoxLayout() self.slideTextCheckBox = QtGui.QCheckBox() self.groupLayout.addWidget(self.slideTextCheckBox) @@ -150,22 +155,11 @@ class Ui_PrintServiceDialog(object): 'Include service item notes')) self.metaDataCheckBox.setText(translate('OpenLP.PrintServiceForm', 'Include play length of media items')) + self.titleLineEdit.setText(translate('OpenLP.PrintServiceForm', + 'Service Order Sheet')) self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Page]) self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Width]) self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.OneHundred]) self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.SeventyFive]) self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Fifty]) self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.TwentyFive]) - -# self.serviceTitleLabel.setText(translate( -# 'OpenLP.PrintServiceOrderForm', 'Title:')) -# self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager', -# 'Service Order Sheet')) -# self.copyTextButton.setText(translate('OpenLP.ServiceManager', -# 'Copy to Clipboard as Text')) -# self.copyHtmlButton.setText(translate('OpenLP.ServiceManager', -# 'Copy to Clipboard as Html')) -# 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/printserviceform.py b/openlp/core/ui/printserviceform.py index 479928dfa..66d23f80a 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -43,6 +43,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): self.printer = QtGui.QPrinter() self.printDialog = QtGui.QPrintDialog(self.printer, self) self.document = QtGui.QTextDocument() + self.zoom = 0 self.setupUi(self) # Load the settings for the dialog. settings = QtCore.QSettings() @@ -53,6 +54,8 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): u'print file meta data', QtCore.QVariant(False)).toBool()) self.notesCheckBox.setChecked(settings.value( u'print notes', QtCore.QVariant(False)).toBool()) + self.zoomComboBox.setCurrentIndex(settings.value( + u'display size', QtCore.QVariant(0)).toInt()[0]) settings.endGroup() # Signals QtCore.QObject.connect(self.printButton, @@ -69,23 +72,10 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): QtCore.SIGNAL(u'paintRequested(QPrinter *)'), self.paintRequested) QtCore.QObject.connect(self.zoomComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.displaySizeChanged) -# QtCore.QObject.connect(self.serviceTitleLineEdit, -# QtCore.SIGNAL(u'textChanged(const QString)'), -# self.updatePreviewText) -# QtCore.QObject.connect(self.slideTextCheckBox, -# QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText) -# QtCore.QObject.connect(self.notesCheckBox, -# QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText) -# QtCore.QObject.connect(self.metaDataCheckBox, -# QtCore.SIGNAL(u'stateChanged(int)'), self.updatePreviewText) -# QtCore.QObject.connect(self.footerTextEdit, -# QtCore.SIGNAL(u'textChanged()'), self.updatePreviewText) -# QtCore.QObject.connect(self.cancelButton, -# QtCore.SIGNAL(u'clicked()'), self.reject) -# QtCore.QObject.connect(self.copyTextButton, -# QtCore.SIGNAL(u'clicked()'), self.copyText) -# QtCore.QObject.connect(self.copyHtmlButton, -# QtCore.SIGNAL(u'clicked()'), self.copyHtmlText) + QtCore.QObject.connect(self.plainCopy, + QtCore.SIGNAL(u'triggered()'), self.copyText) + QtCore.QObject.connect(self.htmlCopy, + QtCore.SIGNAL(u'triggered()'), self.copyHtmlText) self.updatePreviewText() def toggleOptions(self, checked): @@ -97,6 +87,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): self.titleLineEdit.setFocus() else: self.saveOptions() + self.updatePreviewText() def updatePreviewText(self): """ @@ -171,12 +162,16 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): self.previewWidget.fitToWidth() elif display == ZoomSize.OneHundred: self.previewWidget.fitToWidth() + self.previewWidget.zoomIn(1) elif display == ZoomSize.SeventyFive: self.previewWidget.fitToWidth() + self.previewWidget.zoomIn(0.75) elif display == ZoomSize.Fifty: self.previewWidget.fitToWidth() + self.previewWidget.zoomIn(0.5) elif display == ZoomSize.TwentyFive: self.previewWidget.fitToWidth() + self.previewWidget.zoomIn(0.25) settings = QtCore.QSettings() settings.beginGroup(u'advanced') settings.setValue(u'display size',QtCore.QVariant(display)) @@ -208,18 +203,21 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): Called when *zoomInButton* is clicked. """ self.previewWidget.zoomIn() + self.zoom -= 0.1 def zoomOut(self): """ Called when *zoomOutButton* is clicked. """ self.previewWidget.zoomOut() + self.zoom += 0.1 def zoomOriginal(self): """ Called when *zoomOutButton* is clicked. """ - self.previewWidget.fitInView() + self.previewWidget.zoomIn(1 + self.zoom) + self.zoom = 0 def updateTextFormat(self, value): """ From 5d947476ac9877b607238781475702c02c27045a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Sun, 20 Feb 2011 02:05:50 +0200 Subject: [PATCH 09/15] two missing qobject init's --- openlp/core/lib/imagemanager.py | 1 + openlp/plugins/songs/lib/songimport.py | 1 + 2 files changed, 2 insertions(+) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 0a76ce834..23005e992 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -69,6 +69,7 @@ class ImageManager(QtCore.QObject): log.info(u'Image Manager loaded') def __init__(self): + QtCore.QObject.__init__(self) self._cache = {} self._thread_running = False self._cache_dirty = False diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index b24b2699a..40be1675e 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -54,6 +54,7 @@ class SongImport(QtCore.QObject): """ self.manager = manager + QtCore.QObject.__init__(self) if kwargs.has_key(u'filename'): self.import_source = kwargs[u'filename'] elif kwargs.has_key(u'filenames'): From de66d53e73c06b11cbf1bf41aa6f37bb7f625609 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 20 Feb 2011 07:37:44 +0000 Subject: [PATCH 10/15] Review fixes --- README.txt | 3 ++- openlp/core/ui/printservicedialog.py | 11 +++++------ openlp/core/ui/printserviceform.py | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.txt b/README.txt index 15f58e6d0..0b26d74fc 100644 --- a/README.txt +++ b/README.txt @@ -17,4 +17,5 @@ translate OpenLP, have a look at the OpenLP wiki:: http://wiki.openlp.org/ -Thanks for downloading OpenLP 2.0! \ No newline at end of file +Thanks for downloading OpenLP 2.0! + diff --git a/openlp/core/ui/printservicedialog.py b/openlp/core/ui/printservicedialog.py index aac5a3e44..ec4e054c3 100644 --- a/openlp/core/ui/printservicedialog.py +++ b/openlp/core/ui/printservicedialog.py @@ -57,7 +57,7 @@ class Ui_PrintServiceDialog(object): self.toolbar.setIconSize(QtCore.QSize(22, 22)) self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.printButton = self.toolbar.addAction( - QtGui.QIcon(build_icon(u':/general/general_print.png')), 'Print') + build_icon(u':/general/general_print.png'), 'Print') self.optionsButton = QtGui.QToolButton(self.toolbar) self.optionsButton.setText(translate('OpenLP.PrintServiceForm', 'Options')) @@ -68,14 +68,14 @@ class Ui_PrintServiceDialog(object): self.optionsButton.setCheckable(True) self.toolbar.addWidget(self.optionsButton) self.closeButton = self.toolbar.addAction( - QtGui.QIcon(build_icon(u':/system/system_close.png')), + build_icon(u':/system/system_close.png'), translate('OpenLP.PrintServiceForm', 'Close')) self.toolbar.addSeparator() self.plainCopy = self.toolbar.addAction( - QtGui.QIcon(build_icon(u':/system/system_edit_copy.png')), + build_icon(u':/system/system_edit_copy.png'), translate('OpenLP.PrintServiceForm', 'Copy')) self.htmlCopy = self.toolbar.addAction( - QtGui.QIcon(build_icon(u':/system/system_edit_copy.png')), + build_icon(u':/system/system_edit_copy.png'), translate('OpenLP.PrintServiceForm', 'Copy as HTML')) self.toolbar.addSeparator() self.zoomInButton = QtGui.QToolButton(self.toolbar) @@ -147,8 +147,7 @@ class Ui_PrintServiceDialog(object): QtCore.SIGNAL(u'toggled(bool)'), self.toggleOptions) def retranslateUi(self, printServiceDialog): - printServiceDialog.setWindowTitle( - translate('OpenLP.PrintServiceForm', 'Print Service Order')) + printServiceDialog.setWindowTitle(UiStrings.PrintServiceOrder) self.slideTextCheckBox.setText(translate('OpenLP.PrintServiceForm', 'Include slide text if available')) self.notesCheckBox.setText(translate('OpenLP.PrintServiceForm', diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index 66d23f80a..882e39fca 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -129,12 +129,12 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): # Add service items' notes. if self.notesCheckBox.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. if item.is_media() and self.metaDataCheckBox.isChecked(): - text += u'

      %s %s

      ' % (translate( + text += u'

      %s %s

      ' % (translate( 'OpenLP.ServiceManager', u'Playing time:'), unicode(datetime.timedelta(seconds=item.media_length))) if self.footerTextEdit.toPlainText(): From 264c7fb585547a2d57c0128acddc3681ce54560f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Sun, 20 Feb 2011 18:45:58 +0200 Subject: [PATCH 11/15] Handled extensions to log. --- openlp/plugins/media/mediaplugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index ee413aa8c..274bce2b4 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -62,6 +62,8 @@ class MediaPlugin(Plugin): type = mimetype.split(u'video/') self.video_list, mimetype = self._addToList(self.video_list, type, mimetype) + log.info(u'MediaPlugin handles audio extensions: %s', self.audio_list) + log.info(u'MediaPlugin handles video extensions: %s', self.video_list) def _addToList(self, list, value, mimetype): # Is it a media type From 54f42cb52b88615379b08ae228fdbbf873f0df12 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 20 Feb 2011 18:34:57 +0100 Subject: [PATCH 12/15] added new property, replaced try --- openlp/plugins/songs/lib/songbeamerimport.py | 2 + openlp/plugins/songs/lib/xml.py | 41 +++++++------------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songbeamerimport.py index 2adfb30b2..afb9f5646 100644 --- a/openlp/plugins/songs/lib/songbeamerimport.py +++ b/openlp/plugins/songs/lib/songbeamerimport.py @@ -245,6 +245,8 @@ class SongBeamerImport(SongImport): self.song_number = u'' elif tag_val[0] == u'#Speed': pass + elif tag_val[0] == u'Tempo': + pass elif tag_val[0] == u'#TextAlign': pass elif tag_val[0] == u'#Title': diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index 231080831..a552a42a1 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -299,9 +299,9 @@ class OpenLyrics(object): # Remove chords from xml. xml = re.compile(u'').sub(u'', xml) song_xml = objectify.fromstring(xml) - try: + if hasattr(song_xml, u'properties'): properties = song_xml.properties - except AttributeError: + else: return None song = Song() self._process_copyright(properties, song) @@ -369,13 +369,11 @@ class OpenLyrics(object): The song object. """ authors = [] - try: + if hasattr(properties, u'authors'): for author in properties.authors.author: display_name = self._text(author) if display_name: authors.append(display_name) - except AttributeError: - pass if not authors: authors.append(SongStrings.AuthorUnknownUnT) for display_name in authors: @@ -399,10 +397,8 @@ class OpenLyrics(object): ``song`` The song object. """ - try: + if hasattr(properties, u'ccliNo'): song.ccli_number = self._text(properties.ccliNo) - except AttributeError: - song.ccli_number = u'' def _process_comments(self, properties, song): """ @@ -414,15 +410,13 @@ class OpenLyrics(object): ``song`` The song object. """ - try: - comments_list = [] + if hasattr(properties, u'comments'): + comments_list = [] for comment in properties.comments.comment: commenttext = self._text(comment) if commenttext: comments_list.append(commenttext) song.comments = u'\n'.join(comments_list) - except AttributeError: - song.comments = u'' def _process_copyright(self, properties, song): """ @@ -434,10 +428,8 @@ class OpenLyrics(object): ``song`` The song object. """ - try: + if hasattr(properties, u'copyright'): song.copyright = self._text(properties.copyright) - except AttributeError: - song.copyright = u'' def _process_lyrics(self, properties, lyrics, song): """ @@ -478,9 +470,9 @@ class OpenLyrics(object): song.search_lyrics = search_text.lower() song.lyrics = unicode(sxml.extract_xml(), u'utf-8') # Process verse order - try: + if hasattr(properties, u'verseOrder'): song.verse_order = self._text(properties.verseOrder) - except AttributeError: + else: # We have to process the temp_verse_order, as the verseOrder # property is not present. previous_type = u'' @@ -511,7 +503,7 @@ class OpenLyrics(object): """ song.song_book_id = 0 song.song_number = u'' - try: + if hasattr(properties, u'songbooks'): for songbook in properties.songbooks.songbook: bookname = self._get(songbook, u'name') if bookname: @@ -522,15 +514,10 @@ class OpenLyrics(object): book = Book.populate(name=bookname, publisher=u'') self.manager.save_object(book) song.song_book_id = book.id - try: - if self._get(songbook, u'entry'): - song.song_number = self._get(songbook, u'entry') - except AttributeError: - pass + if hasattr(songbook, u'entry'): + song.song_number = self._get(songbook, u'entry') # We only support one song book, so take the first one. break - except AttributeError: - pass def _process_titles(self, properties, song): """ @@ -563,7 +550,7 @@ class OpenLyrics(object): ``song`` The song object. """ - try: + if hasattr(properties, u'themes'): for topictext in properties.themes.theme: topictext = self._text(topictext) if topictext: @@ -574,8 +561,6 @@ class OpenLyrics(object): topic = Topic.populate(name=topictext) self.manager.save_object(topic) song.topics.append(topic) - except AttributeError: - pass def _dump_xml(self, xml): """ From 72dd290d6b5d1f34ce50890b62be5de4bf866f9c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 20 Feb 2011 18:52:22 +0100 Subject: [PATCH 13/15] fixed enumeration --- openlp/plugins/songs/lib/mediaitem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 0f3e97926..1df63d0b5 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -254,9 +254,9 @@ class SongMediaItem(MediaManagerItem): """ if self.searchAsYouType: search_length = 1 - if self.searchTextEdit.currentSearchType() == 1: + if self.searchTextEdit.currentSearchType() == SongSearch.Entire: search_length = 3 - elif self.searchTextEdit.currentSearchType() == 3: + elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics: search_length = 7 if len(text) > search_length: self.onSearchTextButtonClick() From 31247240d022933990f43b738477b23481a6d292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Sun, 20 Feb 2011 20:12:55 +0200 Subject: [PATCH 14/15] fix possible leaving out of extensions, hopefully neater approach --- openlp/plugins/media/lib/mediaitem.py | 5 ++-- openlp/plugins/media/mediaplugin.py | 43 ++++++++++----------------- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index fd98cdefa..9f3f98636 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -60,8 +60,9 @@ class MediaMediaItem(MediaManagerItem): def retranslateUi(self): self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media') self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem', - 'Videos (%s);;Audio (%s);;%s (*)')) % (self.parent.video_list, - self.parent.audio_list, UiStrings.AllFiles) + 'Videos (%s);;Audio (%s);;%s (*)')) % ( + u' '.join(self.parent.video_list), + u' '.join(self.parent.audio_list), UiStrings.AllFiles) self.replaceAction.setText(UiStrings.ReplaceBG) self.replaceAction.setToolTip(UiStrings.ReplaceLiveBG) self.resetAction.setText(UiStrings.ResetBG) diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 274bce2b4..1f6284d61 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -45,38 +45,27 @@ class MediaPlugin(Plugin): self.icon = build_icon(self.icon_path) # passed with drag and drop messages self.dnd_id = u'Media' - self.audio_list = u'' - self.video_list = u'' + self.audio_list = [] + self.video_list = [] mimetypes.init() for mimetype in Phonon.BackendCapabilities.availableMimeTypes(): mimetype = unicode(mimetype) - type = mimetype.split(u'audio/x-') - self.audio_list, mimetype = self._addToList(self.audio_list, - type, mimetype) - type = mimetype.split(u'audio/') - self.audio_list, mimetype = self._addToList(self.audio_list, - type, mimetype) - type = mimetype.split(u'video/x-') - self.video_list, mimetype = self._addToList(self.video_list, - type, mimetype) - type = mimetype.split(u'video/') - self.video_list, mimetype = self._addToList(self.video_list, - type, mimetype) - log.info(u'MediaPlugin handles audio extensions: %s', self.audio_list) - log.info(u'MediaPlugin handles video extensions: %s', self.video_list) + if mimetype.startswith(u'audio/'): + self._addToList(self.audio_list, mimetype) + elif mimetype.startswith(u'video/'): + self._addToList(self.video_list, mimetype) + log.info(u'MediaPlugin handles audio extensions: %s', + u' '.join(self.audio_list)) + log.info(u'MediaPlugin handles video extensions: %s', + u' '.join(self.video_list)) - def _addToList(self, list, value, mimetype): + def _addToList(self, list, mimetype): # Is it a media type - if len(value) == 2: - extensions = mimetypes.guess_all_extensions(unicode(mimetype)) - # we have an extension - if extensions: - for extension in extensions: - if list.find(extension) == -1: - list += u'*%s ' % extension - self.serviceManager.supportedSuffixes(extension[1:]) - mimetype = u'' - return list, mimetype + extensions = mimetypes.guess_all_extensions(unicode(mimetype)) + for extension in extensions: + if extension not in list: + list.append(u'*%s' % extension) + self.serviceManager.supportedSuffixes(extension[1:]) def about(self): about_text = translate('MediaPlugin', 'Media Plugin' From 09b515350ba641b51189c527b9fe48f983ed60f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Sun, 20 Feb 2011 20:49:59 +0200 Subject: [PATCH 15/15] oops --- openlp/plugins/media/mediaplugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 1f6284d61..12887a76c 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -63,8 +63,9 @@ class MediaPlugin(Plugin): # Is it a media type extensions = mimetypes.guess_all_extensions(unicode(mimetype)) for extension in extensions: - if extension not in list: - list.append(u'*%s' % extension) + ext = u'*%s' % extension + if ext not in list: + list.append(ext) self.serviceManager.supportedSuffixes(extension[1:]) def about(self):