merge r1320

This commit is contained in:
Armin Köhler 2011-02-21 14:49:07 +01:00
commit b55ed9b471
23 changed files with 540 additions and 431 deletions

View File

@ -17,4 +17,5 @@ translate OpenLP, have a look at the OpenLP wiki::
http://wiki.openlp.org/
Thanks for downloading OpenLP 2.0!
Thanks for downloading OpenLP 2.0!

View File

@ -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

View File

@ -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

View File

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

View File

@ -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])

View File

@ -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'<h2>%s</h2>' % unicode(self.serviceTitleLineEdit.text())
if self.titleLineEdit.text():
text += u'<h2>%s</h2>' % unicode(self.titleLineEdit.text())
for item in self.serviceManager.serviceItems:
item = item[u'service_item']
# Add the title of the service item.
text += u'<h4><img src="%s" /> %s</h4>' % (item.icon,
text += u'<h3><img src="%s" /> %s</h3>' % (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'<p>' + slide[u'text'] + u'</p>'
if not verse:
text += u'<p>' + slide[u'html']
verse = slide[u'verseTag']
elif verse != slide[u'verseTag']:
text += u'<\p><p>' + slide[u'html']
verse = slide[u'verseTag']
else:
text += u'<br/>' + slide[u'html']
text += u'</p>'
elif item.is_image():
# Add the image names of the service item.
text += u'<ol>'
@ -104,19 +127,19 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
# add footer
text += u'<p>%s</p>' % item.foot_text
# Add service items' notes.
if self.printNotesCheckBox.isChecked():
if self.notesCheckBox.isChecked():
if item.notes:
text += u'<p><b>%s</b></p>%s' % (translate(
text += u'<p><strong>%s</strong></p>%s' % (translate(
'OpenLP.ServiceManager', 'Notes:'),
item.notes.replace(u'\n', u'<br />'))
# Add play length of media files.
if item.is_media() and self.printMetaDataCheckBox.isChecked():
text += u'<p><b>%s</b> %s</p>' % (translate(
if item.is_media() and self.metaDataCheckBox.isChecked():
text += u'<p><strong>%s</strong> %s</p>' % (translate(
'OpenLP.ServiceManager', u'Playing time:'),
unicode(datetime.timedelta(seconds=item.media_length)))
if self.customNoteEdit.toPlainText():
if self.footerTextEdit.toPlainText():
text += u'<h4>%s</h4>%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)

View File

@ -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', '<b>Preview:</b>'))
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', '<b>Custom Service Notes:</b>'))

View File

@ -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_()

View File

@ -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)

View File

@ -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', '<strong>Media Plugin</strong>'

View File

@ -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):

View File

@ -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()

View File

@ -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':

View File

@ -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'):

View File

@ -299,9 +299,9 @@ class OpenLyrics(object):
# Remove chords from xml.
xml = re.compile(u'<chord name=".*?"/>').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):
"""

View File

@ -7,197 +7,221 @@
<x>0</x>
<y>0</y>
<width>494</width>
<height>426</height>
<height>434</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QGridLayout" name="dialogLayout">
<item row="0" column="3">
<layout class="QVBoxLayout" name="settingsLayout">
<item>
<layout class="QGridLayout" name="serviceTitleLayout">
<item row="1" column="1">
<widget class="QLineEdit" name="serviceTitleLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="serviceTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Service Title:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="printSlideTextCheckBox">
<property name="text">
<string>Include slide text if avaialbe</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="printNotesCheckBox">
<property name="text">
<string>Include service item notes</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="printMetaDataCheckBox">
<property name="text">
<string>Include play lenght of media items</string>
</property>
</widget>
</item>
<item>
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="customNotesLabel">
<property name="text">
<string>&lt;b&gt;Custom Notes:&lt;/b&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="customNoteEdit"/>
</item>
</layout>
</item>
<item row="1" column="3">
<layout class="QHBoxLayout" name="buttonLayout">
<item>
<spacer name="spacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="printButton">
<property name="text">
<string>Print</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="zoomButtonLayout">
<item>
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="zoomOutButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_zoom_out.png</normaloff>:/general/general_zoom_out.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="zoomInButton">
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_zoom_in.png</normaloff>:/general/general_zoom_in.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="perviewLayout">
<item>
<widget class="QLabel" name="previewLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Preview:</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="previewWidget" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
<zorder></zorder>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>4</x>
<y>4</y>
<width>491</width>
<height>432</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="dialogLayout">
<item row="0" column="3">
<layout class="QVBoxLayout" name="settingsLayout">
<item>
<layout class="QGridLayout" name="serviceTitleLayout">
<item row="1" column="1">
<widget class="QLineEdit" name="serviceTitleLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="serviceTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Service Title:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="printSlideTextCheckBox">
<property name="text">
<string>Include slide text if avaialbe</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="printNotesCheckBox">
<property name="text">
<string>Include service item notes</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="printMetaDataCheckBox">
<property name="text">
<string>Include play lenght of media items</string>
</property>
</widget>
</item>
<item>
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="customNotesLabel">
<property name="text">
<string>&lt;b&gt;Custom Notes:&lt;/b&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="customNoteEdit"/>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="zoomButtonLayout">
<item>
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="zoomOutButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_zoom_out.png</normaloff>:/general/general_zoom_out.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="zoomInButton">
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_zoom_in.png</normaloff>:/general/general_zoom_in.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="perviewLayout">
<item>
<widget class="QLabel" name="previewLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Preview:</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="previewWidget" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<zorder>spacer_3</zorder>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="buttonLayout">
<item>
<spacer name="spacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton_3">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton_2">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="printButton">
<property name="text">
<string>Print</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="../images/openlp-2.qrc"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -47,6 +47,8 @@
<file>general_new.png</file>
<file>general_zoom_out.png</file>
<file>general_zoom_in.png</file>
<file>general_zoom_original.png</file>
<file>general_print.png</file>
<file>general_open.png</file>
<file>general_save.png</file>
<file>general_email.png</file>
@ -114,6 +116,8 @@
<file>system_exit.png</file>
<file>settings_plugin_list.png</file>
<file>system_settings.png</file>
<file>system_configure.png</file>
<file>system_edit_copy.png</file>
<file>system_configure_shortcuts.png</file>
</qresource>
<qresource prefix="media">

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B