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.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/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/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index c41ad4b17..aedd9cf4f 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') @@ -456,7 +456,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. @@ -465,6 +465,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/printservicedialog.py b/openlp/core/ui/printservicedialog.py new file mode 100644 index 000000000..ec4e054c3 --- /dev/null +++ b/openlp/core/ui/printservicedialog.py @@ -0,0 +1,164 @@ +# -*- 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 build_icon, translate, SpellTextEdit +from openlp.core.lib.ui import UiStrings + +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) + 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.printButton = self.toolbar.addAction( + build_icon(u':/general/general_print.png'), 'Print') + self.optionsButton = QtGui.QToolButton(self.toolbar) + self.optionsButton.setText(translate('OpenLP.PrintServiceForm', + '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.closeButton = self.toolbar.addAction( + build_icon(u':/system/system_close.png'), + translate('OpenLP.PrintServiceForm', 'Close')) + self.toolbar.addSeparator() + self.plainCopy = self.toolbar.addAction( + build_icon(u':/system/system_edit_copy.png'), + translate('OpenLP.PrintServiceForm', 'Copy')) + self.htmlCopy = self.toolbar.addAction( + build_icon(u':/system/system_edit_copy.png'), + 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(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(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(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.toolbar.addWidget(self.zoomComboBox) + self.mainLayout.addWidget(self.toolbar) + self.previewWidget = QtGui.QPrintPreviewWidget(printServiceDialog) + self.mainLayout.addWidget(self.previewWidget) + 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 = SpellTextEdit(self.optionsWidget) + self.footerTextEdit.setObjectName(u'footerTextEdit') + self.optionsLayout.addWidget(self.footerTextEdit) + self.optionsGroupBox = QtGui.QGroupBox( + translate('OpenLP.PrintServiceForm','Other Options')) + self.groupLayout = QtGui.QVBoxLayout() + self.slideTextCheckBox = QtGui.QCheckBox() + self.groupLayout.addWidget(self.slideTextCheckBox) + self.notesCheckBox = QtGui.QCheckBox() + 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) + + self.retranslateUi(printServiceDialog) + QtCore.QMetaObject.connectSlotsByName(printServiceDialog) + QtCore.QObject.connect(self.optionsButton, + QtCore.SIGNAL(u'toggled(bool)'), self.toggleOptions) + + def retranslateUi(self, printServiceDialog): + printServiceDialog.setWindowTitle(UiStrings.PrintServiceOrder) + 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.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]) diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceform.py similarity index 55% rename from openlp/core/ui/printserviceorderform.py rename to openlp/core/ui/printserviceform.py index b5160e61c..882e39fca 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceform.py @@ -28,51 +28,65 @@ import datetime from PyQt4 import QtCore, QtGui from openlp.core.lib import translate -from openlp.core.ui.printserviceorderdialog import Ui_PrintServiceOrderDialog +from openlp.core.lib.ui import UiStrings +from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize + +class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): -class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): def __init__(self, parent, serviceManager): """ Constructor """ QtGui.QDialog.__init__(self, parent) + self.parent = parent self.serviceManager = serviceManager 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() 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()) + self.zoomComboBox.setCurrentIndex(settings.value( + u'display size', QtCore.QVariant(0)).toInt()[0]) settings.endGroup() # Signals QtCore.QObject.connect(self.printButton, - QtCore.SIGNAL(u'clicked()'), self.printServiceOrder) + 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.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.zoomComboBox, + QtCore.SIGNAL(u'currentIndexChanged(int)'), self.displaySizeChanged) + 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): + 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() self.updatePreviewText() def updatePreviewText(self): @@ -80,19 +94,28 @@ 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. - 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 self.slideTextCheckBox.isChecked(): if item.is_text(): # Add the text of the service item. + verse = None for slide in item.get_frames(): - text += u'

' + slide[u'text'] + 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'
    ' @@ -104,19 +127,19 @@ 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( + 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(): - text += u'

    %s %s

    ' % (translate( + 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))) - 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() @@ -129,6 +152,43 @@ 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() + 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)) + 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*. @@ -137,21 +197,38 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): return # Print the document. self.document.print_(self.printer) - self.accept() def zoomIn(self): """ 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 accept(self): + def zoomOriginal(self): + """ + Called when *zoomOutButton* is clicked. + """ + self.previewWidget.zoomIn(1 + self.zoom) + self.zoom = 0 + + 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 saveOptions(self): """ Save the settings and close the dialog. """ @@ -159,17 +236,9 @@ 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() - # 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/openlp/core/ui/printserviceorderdialog.py b/openlp/core/ui/printserviceorderdialog.py deleted file mode 100644 index c27035fda..000000000 --- a/openlp/core/ui/printserviceorderdialog.py +++ /dev/null @@ -1,137 +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 build_icon, translate, SpellTextEdit -from openlp.core.lib.ui import UiStrings - -class Ui_PrintServiceOrderDialog(object): - def setupUi(self, printServiceOrderDialog): - printServiceOrderDialog.setObjectName(u'printServiceOrderDialog') - 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.cancelButton = QtGui.QPushButton(printServiceOrderDialog) - self.cancelButton.setObjectName(u'cancelButton') - self.buttonLayout.addWidget(self.cancelButton) - self.printButton = QtGui.QPushButton(printServiceOrderDialog) - self.printButton.setObjectName(u'printButton') - self.buttonLayout.addWidget(self.printButton) - self.dialogLayout.addLayout(self.buttonLayout, 1, 3, 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')) - 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) - - def retranslateUi(self, printServiceOrderDialog): - printServiceOrderDialog.setWindowTitle(UiStrings.PrintServiceOrder) - self.previewLabel.setText( - translate('OpenLP.ServiceManager', 'Preview:')) - self.printSlideTextCheckBox.setText(translate( - 'OpenLP.PrintServiceOrderForm', 'Include slide text if available')) - self.printNotesCheckBox.setText(translate( - 'OpenLP.PrintServiceOrderForm', 'Include service item notes')) - self.printMetaDataCheckBox.setText( - translate('OpenLP.PrintServiceOrderForm', - 'Include play length of media items')) - self.serviceTitleLabel.setText(translate( - 'OpenLP.PrintServiceOrderForm', 'Title:')) - self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager', - 'Service Order Sheet')) - self.printButton.setText(translate('OpenLP.ServiceManager', 'Print')) - self.cancelButton.setText(UiStrings.Cancel) - self.customNotesLabel.setText( - translate('OpenLP.ServiceManager', 'Custom Service Notes:')) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 5568ba431..67fbeb0ea 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, \ from openlp.core.lib.theme import 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 @@ -1207,5 +1207,5 @@ class ServiceManager(QtGui.QWidget): """ Print a Service Order Sheet. """ - settingDialog = PrintServiceOrderForm(self.mainwindow, self) + settingDialog = PrintServiceForm(self.mainwindow, self) settingDialog.exec_() 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 ee413aa8c..12887a76c 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -45,36 +45,28 @@ 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) + 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: + ext = u'*%s' % extension + if ext not in list: + list.append(ext) + self.serviceManager.supportedSuffixes(extension[1:]) def about(self): about_text = translate('MediaPlugin', 'Media Plugin' diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index c38ba14f0..68147cf6c 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -677,8 +677,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): 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() 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/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'): 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): """ 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 + + + + + + + diff --git a/resources/images/general_print.png b/resources/images/general_print.png new file mode 100644 index 000000000..8eb1c6741 Binary files /dev/null and b/resources/images/general_print.png differ diff --git a/resources/images/general_zoom_in.png b/resources/images/general_zoom_in.png index 2016b2a1b..8393e281a 100644 Binary files a/resources/images/general_zoom_in.png and b/resources/images/general_zoom_in.png differ diff --git a/resources/images/general_zoom_original.png b/resources/images/general_zoom_original.png new file mode 100644 index 000000000..a268a9984 Binary files /dev/null and b/resources/images/general_zoom_original.png differ diff --git a/resources/images/general_zoom_out.png b/resources/images/general_zoom_out.png index ffa8cfdb5..f66575efd 100644 Binary files a/resources/images/general_zoom_out.png and b/resources/images/general_zoom_out.png differ diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc index 9e6ff6543..745f20ebf 100644 --- a/resources/images/openlp-2.qrc +++ b/resources/images/openlp-2.qrc @@ -47,6 +47,8 @@ general_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 000000000..45b8fae8b Binary files /dev/null and b/resources/images/system_configure.png differ diff --git a/resources/images/system_edit_copy.png b/resources/images/system_edit_copy.png new file mode 100644 index 000000000..d34cdcd32 Binary files /dev/null and b/resources/images/system_edit_copy.png differ