This commit is contained in:
Andreas Preikschat 2011-01-03 22:10:27 +01:00
commit 1c9e735122
185 changed files with 4818 additions and 4947 deletions

View File

@ -19,3 +19,4 @@ _eric4project
*.qm *.qm
openlp/core/resources.py.old openlp/core/resources.py.old
*.qm *.qm
resources/windows/warnOpenLP.txt

View File

@ -3,6 +3,7 @@ recursive-include openlp *.sqlite
recursive-include openlp *.csv recursive-include openlp *.csv
recursive-include openlp *.html recursive-include openlp *.html
recursive-include openlp *.js recursive-include openlp *.js
recursive-include openlp *.css
recursive-include openlp *.qm recursive-include openlp *.qm
recursive-include documentation * recursive-include documentation *
recursive-include resources/forms * recursive-include resources/forms *

View File

@ -5,8 +5,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -162,6 +162,10 @@ class OpenLP(QtGui.QApplication):
#provide a listener for widgets to reqest a screen update. #provide a listener for widgets to reqest a screen update.
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_process_events'), self.processEvents) QtCore.SIGNAL(u'openlp_process_events'), self.processEvents)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'cursor_busy'), self.setBusyCursor)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'cursor_normal'), self.setNormalCursor)
self.setOrganizationName(u'OpenLP') self.setOrganizationName(u'OpenLP')
self.setOrganizationDomain(u'openlp.org') self.setOrganizationDomain(u'openlp.org')
self.setApplicationName(u'OpenLP') self.setApplicationName(u'OpenLP')
@ -201,8 +205,21 @@ class OpenLP(QtGui.QApplication):
self.exceptionForm = ExceptionForm(self.mainWindow) self.exceptionForm = ExceptionForm(self.mainWindow)
self.exceptionForm.exceptionTextEdit.setPlainText( self.exceptionForm.exceptionTextEdit.setPlainText(
''.join(format_exception(exctype, value, traceback))) ''.join(format_exception(exctype, value, traceback)))
self.setNormalCursor()
self.exceptionForm.exec_() self.exceptionForm.exec_()
def setBusyCursor(self):
"""
Sets the Busy Cursor for the Application
"""
self.setOverrideCursor(QtCore.Qt.BusyCursor)
def setNormalCursor(self):
"""
Sets the Normal Cursor forthe Application
"""
self.restoreOverrideCursor()
def main(): def main():
""" """
The main function which parses command line options and then runs The main function which parses command line options and then runs

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -25,4 +25,4 @@
############################################################################### ###############################################################################
""" """
The :mod:`openlp` module contains all the project produced OpenLP functionality The :mod:`openlp` module contains all the project produced OpenLP functionality
""" """

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -28,4 +28,4 @@ The :mod:`core` module provides all core application functions
All the core functions of the OpenLP application including the GUI, settings, All the core functions of the OpenLP application including the GUI, settings,
logging and a plugin framework are contained within the openlp.core module. logging and a plugin framework are contained within the openlp.core module.
""" """

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -84,7 +84,8 @@ html_expands.append({u'desc': u'Underline', u'start tag': u'{u}',
u'start html': u'<span style="text-decoration: underline;">', u'start html': u'<span style="text-decoration: underline;">',
u'end tag': u'{/u}', u'end html': u'</span>', u'protected': True}) u'end tag': u'{/u}', u'end html': u'</span>', u'protected': True})
def translate(context, text, comment=None): def translate(context, text, comment=None,
encoding=QtCore.QCoreApplication.CodecForTr, n=-1):
""" """
A special shortcut method to wrap around the Qt4 translation functions. A special shortcut method to wrap around the Qt4 translation functions.
This abstracts the translation procedure so that we can change it if at a This abstracts the translation procedure so that we can change it if at a
@ -101,7 +102,7 @@ def translate(context, text, comment=None):
An identifying string for when the same text is used in different roles An identifying string for when the same text is used in different roles
within the same context. within the same context.
""" """
return QtCore.QCoreApplication.translate(context, text, comment) return QtCore.QCoreApplication.translate(context, text, comment, encoding, n)
def get_text_file_string(text_file): def get_text_file_string(text_file):
""" """

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -52,4 +52,4 @@ class BaseListWithDnD(QtGui.QListWidget):
mimeData = QtCore.QMimeData() mimeData = QtCore.QMimeData()
drag.setMimeData(mimeData) drag.setMimeData(mimeData)
mimeData.setText(self.PluginName) mimeData.setText(self.PluginName)
drag.start(QtCore.Qt.CopyAction) drag.start(QtCore.Qt.CopyAction)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -295,4 +295,4 @@ class Manager(object):
if self.is_dirty: if self.is_dirty:
engine = create_engine(self.db_url) engine = create_engine(self.db_url)
if self.db_url.startswith(u'sqlite'): if self.db_url.startswith(u'sqlite'):
engine.execute("vacuum") engine.execute("vacuum")

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -37,13 +37,15 @@ class OpenLPDockWidget(QtGui.QDockWidget):
""" """
Custom DockWidget class to handle events Custom DockWidget class to handle events
""" """
def __init__(self, parent=None, name=None): def __init__(self, parent=None, name=None, icon=None):
""" """
Initialise the DockWidget Initialise the DockWidget
""" """
log.debug(u'Initialise the %s widget' % name)
QtGui.QDockWidget.__init__(self, parent) QtGui.QDockWidget.__init__(self, parent)
self.parent = parent self.parent = parent
if name: if name:
self.setObjectName(name) self.setObjectName(name)
if icon:
self.setWindowIcon(icon)
self.setFloating(False) self.setFloating(False)
log.debug(u'Init done')

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -220,6 +220,21 @@ class EventReceiver(QtCore.QObject):
Waits for openlp to do something "interesting" and sends a Waits for openlp to do something "interesting" and sends a
remotes_poll_response signal when it does remotes_poll_response signal when it does
``openlp_warning_message``
Displays a standalone Warning Message
``openlp_error_message``
Displays a standalone Error Message
``openlp_information_message``
Displays a standalone Information Message
``cursor_busy``
Makes the cursor got to a busy form
``cursor_normal``
Resets the cursor to default
""" """
def __init__(self): def __init__(self):
""" """

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -641,4 +641,4 @@ def build_alert_css(alertTab, width):
align = u'top' align = u'top'
alert = style % (width, align, alertTab.font_face, alertTab.font_size, alert = style % (width, align, alertTab.font_face, alertTab.font_size,
alertTab.font_color, alertTab.bg_color) alertTab.font_color, alertTab.bg_color)
return alert return alert

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -165,4 +165,4 @@ class ImageManager(QtCore.QObject):
image = self._cache[key] image = self._cache[key]
if image.dirty: if image.dirty:
image.image_bytes = image_to_byte(image.image) image.image_bytes = image_to_byte(image.image)
image.dirty = False image.dirty = False

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -284,34 +284,30 @@ class MediaManagerItem(QtGui.QWidget):
self.listView.addAction( self.listView.addAction(
context_menu_action( context_menu_action(
self.listView, u':/general/general_edit.png', self.listView, u':/general/general_edit.png',
unicode(translate('OpenLP.MediaManagerItem', '&Edit %s')) % self.plugin.getString(StringContent.Edit)[u'title'],
name_string[u'singular'],
self.onEditClick)) self.onEditClick))
self.listView.addAction(context_menu_separator(self.listView)) self.listView.addAction(context_menu_separator(self.listView))
if self.hasDeleteIcon: if self.hasDeleteIcon:
self.listView.addAction( self.listView.addAction(
context_menu_action( context_menu_action(
self.listView, u':/general/general_delete.png', self.listView, u':/general/general_delete.png',
unicode(translate('OpenLP.MediaManagerItem', self.plugin.getString(StringContent.Delete)[u'title'],
'&Delete %s')) %
name_string[u'singular'],
self.onDeleteClick)) self.onDeleteClick))
self.listView.addAction(context_menu_separator(self.listView)) self.listView.addAction(context_menu_separator(self.listView))
self.listView.addAction( self.listView.addAction(
context_menu_action( context_menu_action(
self.listView, u':/general/general_preview.png', self.listView, u':/general/general_preview.png',
unicode(translate('OpenLP.MediaManagerItem', '&Preview %s')) % self.plugin.getString(StringContent.Preview)[u'title'],
name_string[u'singular'],
self.onPreviewClick)) self.onPreviewClick))
self.listView.addAction( self.listView.addAction(
context_menu_action( context_menu_action(
self.listView, u':/general/general_live.png', self.listView, u':/general/general_live.png',
translate('OpenLP.MediaManagerItem', '&Show Live'), self.plugin.getString(StringContent.Live)[u'title'],
self.onLiveClick)) self.onLiveClick))
self.listView.addAction( self.listView.addAction(
context_menu_action( context_menu_action(
self.listView, u':/general/general_add.png', self.listView, u':/general/general_add.png',
translate('OpenLP.MediaManagerItem', '&Add to Service'), self.plugin.getString(StringContent.Service)[u'title'],
self.onAddClick)) self.onAddClick))
if self.addToServiceItem: if self.addToServiceItem:
self.listView.addAction( self.listView.addAction(
@ -353,11 +349,13 @@ class MediaManagerItem(QtGui.QWidget):
self.OnNewFileMasks) self.OnNewFileMasks)
log.info(u'New files(s) %s', unicode(files)) log.info(u'New files(s) %s', unicode(files))
if files: if files:
Receiver.send_message(u'cursor_busy')
self.loadList(files) self.loadList(files)
lastDir = os.path.split(unicode(files[0]))[0] lastDir = os.path.split(unicode(files[0]))[0]
SettingsManager.set_last_dir(self.settingsSection, lastDir) SettingsManager.set_last_dir(self.settingsSection, lastDir)
SettingsManager.set_list(self.settingsSection, SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList()) self.settingsSection, self.getFileList())
Receiver.send_message(u'cursor_normal')
def getFileList(self): def getFileList(self):
""" """
@ -381,7 +379,7 @@ class MediaManagerItem(QtGui.QWidget):
if os.path.exists(thumb): if os.path.exists(thumb):
filedate = os.stat(file).st_mtime filedate = os.stat(file).st_mtime
thumbdate = os.stat(thumb).st_mtime thumbdate = os.stat(thumb).st_mtime
#if file updated rebuild icon # if file updated rebuild icon
if filedate > thumbdate: if filedate > thumbdate:
self.iconFromFile(file, thumb) self.iconFromFile(file, thumb)
else: else:
@ -445,7 +443,7 @@ class MediaManagerItem(QtGui.QWidget):
translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'You must select one or more items to preview.')) 'You must select one or more items to preview.'))
else: else:
log.debug(self.plugin.name + u' Preview requested') log.debug(u'%s Preview requested', self.plugin.name)
serviceItem = self.buildServiceItem() serviceItem = self.buildServiceItem()
if serviceItem: if serviceItem:
serviceItem.from_plugin = True serviceItem.from_plugin = True
@ -462,7 +460,7 @@ class MediaManagerItem(QtGui.QWidget):
translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'You must select one or more items to send live.')) 'You must select one or more items to send live.'))
else: else:
log.debug(self.plugin.name + u' Live requested') log.debug(u'%s Live requested', self.plugin.name)
serviceItem = self.buildServiceItem() serviceItem = self.buildServiceItem()
if serviceItem: if serviceItem:
serviceItem.from_plugin = True serviceItem.from_plugin = True
@ -481,7 +479,7 @@ class MediaManagerItem(QtGui.QWidget):
# Is it posssible to process multiple list items to generate # Is it posssible to process multiple list items to generate
# multiple service items? # multiple service items?
if self.singleServiceItem or self.remoteTriggered: if self.singleServiceItem or self.remoteTriggered:
log.debug(self.plugin.name + u' Add requested') log.debug(u'%s Add requested', self.plugin.name)
serviceItem = self.buildServiceItem(None, True) serviceItem = self.buildServiceItem(None, True)
if serviceItem: if serviceItem:
serviceItem.from_plugin = False serviceItem.from_plugin = False
@ -505,7 +503,7 @@ class MediaManagerItem(QtGui.QWidget):
translate('OpenLP.MediaManagerItem', translate('OpenLP.MediaManagerItem',
'You must select one or more items')) 'You must select one or more items'))
else: else:
log.debug(self.plugin.name + u' Add requested') log.debug(u'%s Add requested', self.plugin.name)
serviceItem = self.parent.serviceManager.getServiceItem() serviceItem = self.parent.serviceManager.getServiceItem()
if not serviceItem: if not serviceItem:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -314,4 +314,4 @@ class Plugin(QtCore.QObject):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
pass pass

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -221,4 +221,4 @@ class PluginManager(object):
for plugin in self.plugins: for plugin in self.plugins:
if plugin.isActive(): if plugin.isActive():
plugin.finalise() plugin.finalise()
log.info(u'Finalisation Complete for %s ' % plugin.name) log.info(u'Finalisation Complete for %s ' % plugin.name)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -144,4 +144,4 @@ class Renderer(object):
html_text = html_text[:len(html_text)-4] html_text = html_text[:len(html_text)-4]
formatted.append(html_text) formatted.append(html_text)
log.debug(u'format_slide - End') log.debug(u'format_slide - End')
return formatted return formatted

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -261,4 +261,4 @@ class RenderManager(object):
log.debug(u'calculate default %d, %d, %f', log.debug(u'calculate default %d, %d, %f',
self.width, self.height, self.screen_ratio ) self.width, self.height, self.screen_ratio )
# 90% is start of footer # 90% is start of footer
self.footer_start = int(self.height * 0.90) self.footer_start = int(self.height * 0.90)

View File

@ -0,0 +1,191 @@
# -*- 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 #
###############################################################################
import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon
log = logging.getLogger(__name__)
class SearchEdit(QtGui.QLineEdit):
"""
This is a specialised QLineEdit with a "clear" button inside for searches.
"""
def __init__(self, parent):
"""
Constructor.
"""
QtGui.QLineEdit.__init__(self, parent)
self._currentSearchType = -1
self.clearButton = QtGui.QToolButton(self)
self.clearButton.setIcon(build_icon(u':/system/clear_shortcut.png'))
self.clearButton.setCursor(QtCore.Qt.ArrowCursor)
self.clearButton.setStyleSheet(
u'QToolButton { border: none; padding: 0px; }')
self.clearButton.resize(18, 18)
self.clearButton.hide()
QtCore.QObject.connect(
self.clearButton,
QtCore.SIGNAL(u'clicked()'),
self._onClearButtonClicked
)
QtCore.QObject.connect(
self,
QtCore.SIGNAL(u'textChanged(const QString&)'),
self._onSearchEditTextChanged
)
self._updateStyleSheet()
def _updateStyleSheet(self):
"""
Internal method to update the stylesheet depending on which widgets are
available and visible.
"""
frameWidth = self.style().pixelMetric(
QtGui.QStyle.PM_DefaultFrameWidth)
rightPadding = self.clearButton.sizeHint().width() + frameWidth
if hasattr(self, u'menuButton'):
leftPadding = self.menuButton.width()
self.setStyleSheet(
u'QLineEdit { padding-left: %spx; padding-right: %spx; } ' % \
(leftPadding, rightPadding))
else:
self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' % \
rightPadding)
msz = self.minimumSizeHint();
self.setMinimumSize(
max(msz.width(),
self.clearButton.sizeHint().width() + (frameWidth * 2) + 2),
max(msz.height(),
self.clearButton.height() + (frameWidth * 2) + 2)
)
def resizeEvent(self, event):
"""
Reimplemented method to react to resizing of the widget.
``event``
The event that happened.
"""
sz = self.clearButton.sizeHint()
frameWidth = self.style().pixelMetric(
QtGui.QStyle.PM_DefaultFrameWidth)
self.clearButton.move(self.rect().right() - frameWidth - sz.width(),
(self.rect().bottom() + 1 - sz.height()) / 2)
if hasattr(self, u'menuButton'):
sz = self.menuButton.sizeHint()
self.menuButton.move(self.rect().left() + frameWidth + 2,
(self.rect().bottom() + 1 - sz.height()) / 2)
def currentSearchType(self):
"""
Readonly property to return the current search type.
"""
return self._currentSearchType
def setSearchTypes(self, items):
"""
A list of tuples to be used in the search type menu. The first item in
the list will be preselected as the default.
``items``
The list of tuples to use. The tuples should contain an integer
identifier, an icon (QIcon instance or string) and a title for the
item in the menu. In short, they should look like this::
(<identifier>, <icon>, <title>)
For instance::
(1, <QIcon instance>, "Titles")
Or::
(2, ":/songs/authors.png", "Authors")
"""
menu = QtGui.QMenu(self)
first = None
for identifier, icon, title in items:
action = QtGui.QAction(build_icon(icon), title, menu)
action.setData(QtCore.QVariant(identifier))
menu.addAction(action)
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'),
self._onMenuActionTriggered)
if first is None:
first = action
self._currentSearchType = identifier
if not hasattr(self, u'menuButton'):
self.menuButton = QtGui.QToolButton(self)
self.menuButton.setIcon(build_icon(u':/system/clear_shortcut.png'))
self.menuButton.setCursor(QtCore.Qt.ArrowCursor)
self.menuButton.setPopupMode(QtGui.QToolButton.InstantPopup)
self.menuButton.setStyleSheet(
u'QToolButton { border: none; padding: 0px 10px 0px 0px; }')
self.menuButton.resize(QtCore.QSize(28, 18))
self.menuButton.setMenu(menu)
self.menuButton.setDefaultAction(first)
self.menuButton.show()
self._updateStyleSheet()
def _onSearchEditTextChanged(self, text):
"""
Internally implemented slot to react to when the text in the line edit
has changed so that we can show or hide the clear button.
``text``
A :class:`~PyQt4.QtCore.QString` instance which represents the text
in the line edit.
"""
self.clearButton.setVisible(not text.isEmpty())
def _onClearButtonClicked(self):
"""
Internally implemented slot to react to the clear button being pressed
to clear the line edit. Once it has cleared the line edit, it emits the
``cleared()`` signal so that an application can react to the clearing
of the line edit.
"""
self.clear()
self.emit(QtCore.SIGNAL(u'cleared()'))
def _onMenuActionTriggered(self):
"""
Internally implemented slot to react to the select of one of the search
types in the menu. Once it has set the correct action on the button,
and set the current search type (using the list of identifiers provided
by the developer), the ``searchTypeChanged(int)`` signal is emitted
with the identifier.
"""
sender = self.sender()
for action in self.menuButton.menu().actions():
action.setChecked(False)
self.menuButton.setDefaultAction(sender)
self._currentSearchType = sender.data().toInt()[0]
self.emit(QtCore.SIGNAL(u'searchTypeChanged(int)'),
self._currentSearchType)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -58,7 +58,7 @@ class ItemCapabilities(object):
NoLineBreaks = 7 NoLineBreaks = 7
OnLoadUpdate = 8 OnLoadUpdate = 8
AddIfNewItem = 9 AddIfNewItem = 9
ProvidesOwnDisplay = 10
class ServiceItem(object): class ServiceItem(object):
""" """

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -55,7 +55,7 @@ class SettingsManager(object):
self.mainwindow_left = mainwindow_docbars self.mainwindow_left = mainwindow_docbars
self.mainwindow_right = mainwindow_docbars self.mainwindow_right = mainwindow_docbars
self.slidecontroller = (self.width - ( self.slidecontroller = (self.width - (
self.mainwindow_left + self.mainwindow_right) - 100 ) / 2 self.mainwindow_left + self.mainwindow_right) - 100) / 2
self.slidecontroller_image = self.slidecontroller - 50 self.slidecontroller_image = self.slidecontroller - 50
@staticmethod @staticmethod
@ -178,4 +178,4 @@ class SettingsManager(object):
if extension == os.path.splitext(filename)[1]] if extension == os.path.splitext(filename)[1]]
else: else:
# no filtering required # no filtering required
return files return files

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -31,7 +31,7 @@ class SettingsTab(QtGui.QWidget):
SettingsTab is a helper widget for plugins to define Tabs for the settings SettingsTab is a helper widget for plugins to define Tabs for the settings
dialog. dialog.
""" """
def __init__(self, title, visible_title=None): def __init__(self, title, visible_title=None):
""" """
Constructor to create the Settings tab item. Constructor to create the Settings tab item.

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -158,4 +158,4 @@ class SpellAction(QtGui.QAction):
def __init__(self, *args): def __init__(self, *args):
QtGui.QAction.__init__(self, *args) QtGui.QAction.__init__(self, *args)
self.triggered.connect(lambda x: self.correct.emit( self.triggered.connect(lambda x: self.correct.emit(
unicode(self.text()))) unicode(self.text())))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -598,4 +598,4 @@ class ThemeXML(object):
self.font_footer_shadow_size) self.font_footer_shadow_size)
self.add_display(self.display_horizontal_align, self.add_display(self.display_horizontal_align,
self.display_vertical_align, self.display_vertical_align,
self.display_slide_transition) self.display_slide_transition)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -154,4 +154,4 @@ class OpenLPToolbar(QtGui.QToolBar):
push_button.setCheckable(True) push_button.setCheckable(True)
push_button.setFlat(True) push_button.setFlat(True)
self.addWidget(push_button) self.addWidget(push_button)
return push_button return push_button

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -24,4 +24,4 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from openlp.core.theme.theme import Theme from openlp.core.theme.theme import Theme

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -33,11 +33,11 @@ processing version 1 themes in OpenLP version 2.
from xml.etree.ElementTree import ElementTree, XML from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import QtGui from PyQt4 import QtGui
DELPHI_COLORS = {"clRed":0xFF0000, DELPHI_COLORS = {u'clRed': 0xFF0000,
"clBlue":0x0000FF, u'clBlue': 0x0000FF,
"clYellow":0xFFFF00, u'clYellow': 0xFFFF00,
"clBlack":0x000000, u'clBlack': 0x000000,
"clWhite":0xFFFFFF} u'clWhite': 0xFFFFFF}
BLANK_STYLE_XML = \ BLANK_STYLE_XML = \
'''<?xml version="1.0" encoding="iso-8859-1"?> '''<?xml version="1.0" encoding="iso-8859-1"?>

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -58,4 +58,4 @@ from thememanager import ThemeManager
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm',
'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager',
'MediaDockManager', 'ServiceItemEditForm'] 'MediaDockManager', 'ServiceItemEditForm']

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -182,8 +182,8 @@ class Ui_AboutDialog(object):
self.aboutNotebook.indexOf(self.creditsTab), self.aboutNotebook.indexOf(self.creditsTab),
translate('OpenLP.AboutForm', 'Credits')) translate('OpenLP.AboutForm', 'Credits'))
self.licenseTextEdit.setPlainText(translate('OpenLP.AboutForm', self.licenseTextEdit.setPlainText(translate('OpenLP.AboutForm',
'Copyright \xa9 2004-2010 Raoul Snyman\n' 'Copyright \xa9 2004-2011 Raoul Snyman\n'
'Portions copyright \xa9 2004-2010 ' 'Portions copyright \xa9 2004-2011 '
'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri, ' 'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri, '
'Christian Richter, Maikel Stuivenberg, Martin Thompson, Jon ' 'Christian Richter, Maikel Stuivenberg, Martin Thompson, Jon '
'Tibble, Carsten Tinggaard\n' 'Tibble, Carsten Tinggaard\n'
@ -575,5 +575,4 @@ class Ui_AboutDialog(object):
translate('OpenLP.AboutForm', 'License')) translate('OpenLP.AboutForm', 'License'))
self.contributeButton.setText(translate('OpenLP.AboutForm', self.contributeButton.setText(translate('OpenLP.AboutForm',
'Contribute')) 'Contribute'))
self.closeButton.setText(translate('OpenLP.AboutForm', 'Close')) self.closeButton.setText(translate('OpenLP.AboutForm', 'Close'))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -61,4 +61,4 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog):
import webbrowser import webbrowser
url = u'http://www.openlp.org/en/documentation/introduction/' \ url = u'http://www.openlp.org/en/documentation/introduction/' \
+ u'contributing.html' + u'contributing.html'
webbrowser.open_new(url) webbrowser.open_new(url)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -90,6 +90,10 @@ class AdvancedTab(SettingsTab):
self.expandServiceItemCheckBox.setObjectName( self.expandServiceItemCheckBox.setObjectName(
u'expandServiceItemCheckBox') u'expandServiceItemCheckBox')
self.uiLayout.addWidget(self.expandServiceItemCheckBox) self.uiLayout.addWidget(self.expandServiceItemCheckBox)
self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.enableAutoCloseCheckBox.setObjectName(
u'enableAutoCloseCheckBox')
self.uiLayout.addWidget(self.enableAutoCloseCheckBox)
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget) # self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget)
# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox') # self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
# self.sharedDirGroupBox.setGeometry(QtCore.QRect(0, 65, 500, 85)) # self.sharedDirGroupBox.setGeometry(QtCore.QRect(0, 65, 500, 85))
@ -150,6 +154,8 @@ class AdvancedTab(SettingsTab):
'Double-click to send items straight to live')) 'Double-click to send items straight to live'))
self.expandServiceItemCheckBox.setText(translate('OpenLP.AdvancedTab', self.expandServiceItemCheckBox.setText(translate('OpenLP.AdvancedTab',
'Expand new service items on creation')) 'Expand new service items on creation'))
self.enableAutoCloseCheckBox.setText(translate('OpenLP.AdvancedTab',
'Enable application exit confirmation'))
# self.sharedDirGroupBox.setTitle( # self.sharedDirGroupBox.setTitle(
# translate('AdvancedTab', 'Central Data Store')) # translate('AdvancedTab', 'Central Data Store'))
# self.sharedCheckBox.setText( # self.sharedCheckBox.setText(
@ -180,6 +186,9 @@ class AdvancedTab(SettingsTab):
self.expandServiceItemCheckBox.setChecked( self.expandServiceItemCheckBox.setChecked(
settings.value(u'expand service item', settings.value(u'expand service item',
QtCore.QVariant(False)).toBool()) QtCore.QVariant(False)).toBool())
self.enableAutoCloseCheckBox.setChecked(
settings.value(u'enable exit confirmation',
QtCore.QVariant(True)).toBool())
settings.endGroup() settings.endGroup()
def save(self): def save(self):
@ -196,12 +205,14 @@ class AdvancedTab(SettingsTab):
QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked())) QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked()))
settings.setValue(u'expand service item', settings.setValue(u'expand service item',
QtCore.QVariant(self.expandServiceItemCheckBox.isChecked())) QtCore.QVariant(self.expandServiceItemCheckBox.isChecked()))
settings.setValue(u'enable exit confirmation',
QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked()))
settings.endGroup() settings.endGroup()
def onSharedCheckBoxChanged(self, checked): # def onSharedCheckBoxChanged(self, checked):
""" # """
Enables the widgets to allow a shared data location # Enables the widgets to allow a shared data location
""" # """
self.sharedLabel.setEnabled(checked) # self.sharedLabel.setEnabled(checked)
self.sharedTextEdit.setEnabled(checked) # self.sharedTextEdit.setEnabled(checked)
self.sharedPushButton.setEnabled(checked) # self.sharedPushButton.setEnabled(checked)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -98,4 +98,4 @@ class Ui_ExceptionDialog(object):
self.sendReportButton.setText(translate('OpenLP.ExceptionDialog', self.sendReportButton.setText(translate('OpenLP.ExceptionDialog',
'Send E-Mail')) 'Send E-Mail'))
self.saveReportButton.setText(translate('OpenLP.ExceptionDialog', self.saveReportButton.setText(translate('OpenLP.ExceptionDialog',
'Save to File')) 'Save to File'))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -84,7 +84,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
u'lxml: %s\n' % etree.__version__ + \ u'lxml: %s\n' % etree.__version__ + \
u'Chardet: %s\n' % chardet_version + \ u'Chardet: %s\n' % chardet_version + \
u'PyEnchant: %s\n' % enchant_version + \ u'PyEnchant: %s\n' % enchant_version + \
u'PySQLite: %s\n' % sqlite_version u'PySQLite: %s\n' % sqlite_version
if platform.system() == u'Linux': if platform.system() == u'Linux':
if os.environ.get(u'KDE_FULL_SESSION') == u'true': if os.environ.get(u'KDE_FULL_SESSION') == u'true':
system = system + u'Desktop: KDE SC\n' system = system + u'Desktop: KDE SC\n'
@ -135,7 +135,9 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
'--- Please enter the report below this line. ---\n\n\n' '--- Please enter the report below this line. ---\n\n\n'
'--- Exception Traceback ---\n%s\n' '--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n' '--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n')) '--- Library Versions ---\n%s\n',
'Please add the information that bug reports are favoured written '
'in English.'))
content = self._createReport() content = self._createReport()
for line in content[1].split(u'\n'): for line in content[1].split(u'\n'):
if re.search(r'[/\\]openlp[/\\]', line): if re.search(r'[/\\]openlp[/\\]', line):

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -54,4 +54,4 @@ class Ui_FileRenameDialog(object):
def retranslateUi(self, FileRenameDialog): def retranslateUi(self, FileRenameDialog):
self.fileRenameLabel.setText(translate('OpenLP.FileRenameForm', self.fileRenameLabel.setText(translate('OpenLP.FileRenameForm',
'New File Name:')) 'New File Name:'))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -52,4 +52,4 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
else: else:
self.setWindowTitle(translate('OpenLP.FileRenameForm', self.setWindowTitle(translate('OpenLP.FileRenameForm',
'File Rename')) 'File Rename'))
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -141,10 +141,10 @@ class GeneralTab(SettingsTab):
self.settingsLayout.addWidget(self.autoPreviewCheckBox, 1, 0, 1, 2) self.settingsLayout.addWidget(self.autoPreviewCheckBox, 1, 0, 1, 2)
# Moved here from image tab # Moved here from image tab
self.timeoutLabel = QtGui.QLabel(self.settingsGroupBox) self.timeoutLabel = QtGui.QLabel(self.settingsGroupBox)
self.timeoutLabel.setObjectName("timeoutLabel") self.timeoutLabel.setObjectName(u'timeoutLabel')
self.settingsLayout.addWidget(self.timeoutLabel, 2, 0, 1, 1) self.settingsLayout.addWidget(self.timeoutLabel, 2, 0, 1, 1)
self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox) self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox)
self.timeoutSpinBox.setObjectName("timeoutSpinBox") self.timeoutSpinBox.setObjectName(u'timeoutSpinBox')
self.settingsLayout.addWidget(self.timeoutSpinBox, 2, 1, 1, 1) self.settingsLayout.addWidget(self.timeoutSpinBox, 2, 1, 1, 1)
self.generalLeftLayout.addWidget(self.settingsGroupBox) self.generalLeftLayout.addWidget(self.settingsGroupBox)
self.generalLeftSpacer = QtGui.QSpacerItem(20, 40, self.generalLeftSpacer = QtGui.QSpacerItem(20, 40,
@ -389,11 +389,11 @@ class GeneralTab(SettingsTab):
settings = QtCore.QSettings() settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
for screen in self.screens.screen_list: for screen in self.screens.screen_list:
screen_name = u'%s %d' % (translate('OpenLP.GeneralTab', 'Screen'), screen_name = unicode(translate('OpenLP.GeneralTab', 'Screen %d')) \
screen[u'number'] + 1) % (screen[u'number'] + 1)
if screen[u'primary']: if screen[u'primary']:
screen_name = u'%s (%s)' % (screen_name, screen_name = unicode(translate('OpenLP.GeneralTab',
translate('OpenLP.GeneralTab', 'primary')) '%s (primary)')) % screen_name
self.monitorComboBox.addItem(screen_name) self.monitorComboBox.addItem(screen_name)
self.numberEdit.setText(unicode(settings.value( self.numberEdit.setText(unicode(settings.value(
u'ccli number', QtCore.QVariant(u'')).toString())) u'ccli number', QtCore.QVariant(u'')).toString()))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -94,7 +94,6 @@ class MainDisplay(DisplayWidget):
""" """
This is the display screen. This is the display screen.
""" """
def __init__(self, parent, screens, live): def __init__(self, parent, screens, live):
DisplayWidget.__init__(self, live, parent=None) DisplayWidget.__init__(self, live, parent=None)
self.parent = parent self.parent = parent
@ -116,7 +115,7 @@ class MainDisplay(DisplayWidget):
""" """
Set up and build the output screen Set up and build the output screen
""" """
log.debug(u'Setup live = %s for %s ' % (self.isLive, log.debug(u'Setup live = %s for monitor %s ' % (self.isLive,
self.screens.monitor_number)) self.screens.monitor_number))
self.usePhonon = QtCore.QSettings().value( self.usePhonon = QtCore.QSettings().value(
u'media/use phonon', QtCore.QVariant(True)).toBool() u'media/use phonon', QtCore.QVariant(True)).toBool()
@ -209,7 +208,7 @@ class MainDisplay(DisplayWidget):
shrink = True shrink = True
else: else:
shrink = False shrink = False
js = u'show_alert("%s", "%s")' % ( js = u'show_alert("%s", "%s")' % (
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'), text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'),
u'top' if shrink else u'') u'top' if shrink else u'')
height = self.frame.evaluateJavaScript(js) height = self.frame.evaluateJavaScript(js)
@ -235,8 +234,8 @@ class MainDisplay(DisplayWidget):
def image(self, name): def image(self, name):
""" """
Add an image as the background. The image is converted to a Add an image as the background. The image is converted to a bytestream
bytestream on route. on route.
`Image` `Image`
The Image to be displayed can be QImage or QPixmap The Image to be displayed can be QImage or QPixmap
@ -421,8 +420,8 @@ class MainDisplay(DisplayWidget):
Display the Footer Display the Footer
""" """
log.debug(u'footer') log.debug(u'footer')
js = "show_footer('" + \ js = u'show_footer(\'' + \
text.replace("\\", "\\\\").replace("\'", "\\\'") + "')" text.replace(u'\\', u'\\\\').replace(u'\'', u'\\\'') + u'\')'
self.frame.evaluateJavaScript(js) self.frame.evaluateJavaScript(js)
def hideDisplay(self, mode=HideMode.Screen): def hideDisplay(self, mode=HideMode.Screen):
@ -541,4 +540,3 @@ class AudioPlayer(QtCore.QObject):
""" """
log.debug(u'AudioPlayer Reached end of media playlist') log.debug(u'AudioPlayer Reached end of media playlist')
self.mediaObject.clearQueue() self.mediaObject.clearQueue()

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -76,7 +76,7 @@ class Ui_MainWindow(object):
MainIcon = build_icon(u':/icon/openlp-logo-16x16.png') MainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
MainWindow.setWindowIcon(MainIcon) MainWindow.setWindowIcon(MainIcon)
self.setDockNestingEnabled(True) self.setDockNestingEnabled(True)
# Set up the main container, which contains all the other form widgets # Set up the main container, which contains all the other form widgets.
self.MainContent = QtGui.QWidget(MainWindow) self.MainContent = QtGui.QWidget(MainWindow)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Expanding)
@ -141,13 +141,12 @@ class Ui_MainWindow(object):
self.DefaultThemeLabel.setObjectName(u'DefaultThemeLabel') self.DefaultThemeLabel.setObjectName(u'DefaultThemeLabel')
self.StatusBar.addPermanentWidget(self.DefaultThemeLabel) self.StatusBar.addPermanentWidget(self.DefaultThemeLabel)
# Create the MediaManager # Create the MediaManager
self.MediaManagerDock = OpenLPDockWidget(MainWindow) self.MediaManagerDock = OpenLPDockWidget(
self.MediaManagerDock.setWindowIcon( MainWindow, u'MediaManagerDock',
build_icon(u':/system/system_mediamanager.png')) build_icon(u':/system/system_mediamanager.png'))
self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE) self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
self.MediaManagerDock.setMinimumWidth( self.MediaManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_left) self.settingsmanager.mainwindow_left)
self.MediaManagerDock.setObjectName(u'MediaManagerDock')
self.MediaManagerContents = QtGui.QWidget(MainWindow) self.MediaManagerContents = QtGui.QWidget(MainWindow)
self.MediaManagerContents.setObjectName(u'MediaManagerContents') self.MediaManagerContents.setObjectName(u'MediaManagerContents')
self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents) self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
@ -161,10 +160,9 @@ class Ui_MainWindow(object):
MainWindow.addDockWidget( MainWindow.addDockWidget(
QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock) QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)
# Create the service manager # Create the service manager
self.ServiceManagerDock = OpenLPDockWidget(MainWindow) self.ServiceManagerDock = OpenLPDockWidget(
self.ServiceManagerDock.setWindowIcon( MainWindow, u'ServiceManagerDock',
build_icon(u':/system/system_servicemanager.png')) build_icon(u':/system/system_servicemanager.png'))
self.ServiceManagerDock.setObjectName(u'ServiceManagerDock')
self.ServiceManagerDock.setMinimumWidth( self.ServiceManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_right) self.settingsmanager.mainwindow_right)
self.ServiceManagerContents = ServiceManager(self) self.ServiceManagerContents = ServiceManager(self)
@ -172,10 +170,9 @@ class Ui_MainWindow(object):
MainWindow.addDockWidget( MainWindow.addDockWidget(
QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock) QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock)
# Create the theme manager # Create the theme manager
self.ThemeManagerDock = OpenLPDockWidget(MainWindow) self.ThemeManagerDock = OpenLPDockWidget(
self.ThemeManagerDock.setWindowIcon( MainWindow, u'ThemeManagerDock',
build_icon(u':/system/system_thememanager.png')) build_icon(u':/system/system_thememanager.png'))
self.ThemeManagerDock.setObjectName(u'ThemeManagerDock')
self.ThemeManagerDock.setMinimumWidth( self.ThemeManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_right) self.settingsmanager.mainwindow_right)
self.ThemeManagerContents = ThemeManager(self) self.ThemeManagerContents = ThemeManager(self)
@ -272,7 +269,7 @@ class Ui_MainWindow(object):
self.SettingsPluginListItem.setObjectName(u'SettingsPluginListItem') self.SettingsPluginListItem.setObjectName(u'SettingsPluginListItem')
MainWindow.actionList.add_action(self.SettingsPluginListItem, MainWindow.actionList.add_action(self.SettingsPluginListItem,
u'Settings') u'Settings')
#i18n Language Items # i18n Language Items
self.AutoLanguageItem = QtGui.QAction(MainWindow) self.AutoLanguageItem = QtGui.QAction(MainWindow)
self.AutoLanguageItem.setObjectName(u'AutoLanguageItem') self.AutoLanguageItem.setObjectName(u'AutoLanguageItem')
self.AutoLanguageItem.setCheckable(True) self.AutoLanguageItem.setCheckable(True)
@ -331,7 +328,7 @@ class Ui_MainWindow(object):
None, self.ViewMediaManagerItem, self.ViewServiceManagerItem, None, self.ViewMediaManagerItem, self.ViewServiceManagerItem,
self.ViewThemeManagerItem, None, self.ViewPreviewPanel, self.ViewThemeManagerItem, None, self.ViewPreviewPanel,
self.ViewLivePanel)) self.ViewLivePanel))
#i18n add Language Actions # i18n add Language Actions
add_actions(self.SettingsLanguageMenu, (self.AutoLanguageItem, None)) add_actions(self.SettingsLanguageMenu, (self.AutoLanguageItem, None))
add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions()) add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions())
add_actions(self.SettingsMenu, (self.SettingsPluginListItem, add_actions(self.SettingsMenu, (self.SettingsPluginListItem,
@ -354,17 +351,8 @@ class Ui_MainWindow(object):
QtCore.SIGNAL(u'aboutToShow()'), self.updateFileMenu) QtCore.SIGNAL(u'aboutToShow()'), self.updateFileMenu)
QtCore.QObject.connect(self.FileExitItem, QtCore.QObject.connect(self.FileExitItem,
QtCore.SIGNAL(u'triggered()'), MainWindow.close) QtCore.SIGNAL(u'triggered()'), MainWindow.close)
QtCore.QObject.connect(self.ControlSplitter,
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
QtCore.QMetaObject.connectSlotsByName(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def trackSplitter(self, tab, pos):
"""
Splitter between the Preview and Live Controllers.
"""
self.liveController.widthChanged()
self.previewController.widthChanged()
def retranslateUi(self, MainWindow): def retranslateUi(self, MainWindow):
""" """
Set up the translation system Set up the translation system
@ -594,16 +582,16 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QObject.connect(self.SettingsShortcutsItem, QtCore.QObject.connect(self.SettingsShortcutsItem,
QtCore.SIGNAL(u'triggered()'), self.onSettingsShortcutsItemClicked) QtCore.SIGNAL(u'triggered()'), self.onSettingsShortcutsItemClicked)
QtCore.QObject.connect(self.FileNewItem, QtCore.SIGNAL(u'triggered()'), QtCore.QObject.connect(self.FileNewItem, QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onNewService) self.ServiceManagerContents.onNewServiceClicked)
QtCore.QObject.connect(self.FileOpenItem, QtCore.QObject.connect(self.FileOpenItem,
QtCore.SIGNAL(u'triggered()'), QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onLoadService) self.ServiceManagerContents.onLoadServiceClicked)
QtCore.QObject.connect(self.FileSaveItem, QtCore.QObject.connect(self.FileSaveItem,
QtCore.SIGNAL(u'triggered()'), QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onQuickSaveService) self.ServiceManagerContents.onSaveServiceClicked)
QtCore.QObject.connect(self.FileSaveAsItem, QtCore.QObject.connect(self.FileSaveAsItem,
QtCore.SIGNAL(u'triggered()'), QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onSaveService) self.ServiceManagerContents.onSaveServiceAsClicked)
# i18n set signals for languages # i18n set signals for languages
QtCore.QObject.connect(self.AutoLanguageItem, QtCore.QObject.connect(self.AutoLanguageItem,
QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage) QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
@ -624,6 +612,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged) QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage) QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage)
Receiver.send_message(u'cursor_busy')
# Simple message boxes
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_error_message'), self.onErrorMessage)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_warning_message'), self.onWarningMessage)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_information_message'),
self.onInformationMessage)
# warning cyclic dependency # warning cyclic dependency
# RenderManager needs to call ThemeManager and # RenderManager needs to call ThemeManager and
# ThemeManager needs to call RenderManager # ThemeManager needs to call RenderManager
@ -671,6 +668,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if savedPlugin != -1: if savedPlugin != -1:
self.MediaToolBox.setCurrentIndex(savedPlugin) self.MediaToolBox.setCurrentIndex(savedPlugin)
self.settingsForm.postSetUp() self.settingsForm.postSetUp()
Receiver.send_message(u'cursor_normal')
def setAutoLanguage(self, value): def setAutoLanguage(self, value):
self.LanguageGroup.setDisabled(value) self.LanguageGroup.setDisabled(value)
@ -703,7 +701,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if QtCore.QSettings().value( if QtCore.QSettings().value(
self.generalSettingsSection + u'/auto open', self.generalSettingsSection + u'/auto open',
QtCore.QVariant(False)).toBool(): QtCore.QVariant(False)).toBool():
self.ServiceManagerContents.onLoadService(True) self.ServiceManagerContents.loadLastFile()
view_mode = QtCore.QSettings().value(u'%s/view mode' % \ view_mode = QtCore.QSettings().value(u'%s/view mode' % \
self.generalSettingsSection, u'default') self.generalSettingsSection, u'default')
if view_mode == u'default': if view_mode == u'default':
@ -732,6 +730,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
translate('OpenLP.MainWindow', translate('OpenLP.MainWindow',
'The Main Display has been blanked out')) 'The Main Display has been blanked out'))
def onErrorMessage(self, data):
QtGui.QMessageBox.critical(self, data[u'title'], data[u'message'])
def onWarningMessage(self, data):
QtGui.QMessageBox.warning(self, data[u'title'], data[u'message'])
def onInformationMessage(self, data):
QtGui.QMessageBox.information(self, data[u'title'], data[u'message'])
def onHelpWebSiteClicked(self): def onHelpWebSiteClicked(self):
""" """
Load the OpenLP website Load the OpenLP website
@ -759,6 +766,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
self.settingsForm.exec_() self.settingsForm.exec_()
def paintEvent(self, event):
"""
We need to make sure, that the SlidePreview's size is correct.
"""
self.previewController.previewSizeChanged()
self.liveController.previewSizeChanged()
def onSettingsShortcutsItemClicked(self): def onSettingsShortcutsItemClicked(self):
""" """
Show the shortcuts dialog Show the shortcuts dialog
@ -817,7 +831,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
Hook to close the main window and display windows on exit Hook to close the main window and display windows on exit
""" """
if self.serviceNotSaved: if self.ServiceManagerContents.isModified():
ret = QtGui.QMessageBox.question(self, ret = QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'Save Changes to Service?'), translate('OpenLP.MainWindow', 'Save Changes to Service?'),
translate('OpenLP.MainWindow', 'Your service has changed. ' translate('OpenLP.MainWindow', 'Your service has changed. '
@ -828,17 +842,35 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtGui.QMessageBox.Save), QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save) QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save: if ret == QtGui.QMessageBox.Save:
self.ServiceManagerContents.onSaveService(True) if self.ServiceManagerContents.saveFile():
self.cleanUp() self.cleanUp()
event.accept() event.accept()
else:
event.ignore()
elif ret == QtGui.QMessageBox.Discard: elif ret == QtGui.QMessageBox.Discard:
self.cleanUp() self.cleanUp()
event.accept() event.accept()
else: else:
event.ignore() event.ignore()
else: else:
self.cleanUp() if QtCore.QSettings().value(u'advanced/enable exit confirmation',
event.accept() QtCore.QVariant(True)).toBool():
ret = QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow', 'Are you sure you want to close OpenLP?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes)
if ret == QtGui.QMessageBox.Yes:
self.cleanUp()
event.accept()
else:
event.ignore()
else:
self.cleanUp()
event.accept()
def cleanUp(self): def cleanUp(self):
""" """
@ -880,6 +912,23 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
title = u'%s - %s*' % (self.mainTitle, service_name) title = u'%s - %s*' % (self.mainTitle, service_name)
self.setWindowTitle(title) self.setWindowTitle(title)
def setServiceModified(self, modified, fileName):
"""
This method is called from the ServiceManager to set the title of the
main window.
``modified``
Whether or not this service has been modified.
``fileName``
The file name of the service file.
"""
if modified:
title = u'%s - %s*' % (self.mainTitle, fileName)
else:
title = u'%s - %s' % (self.mainTitle, fileName)
self.setWindowTitle(title)
def showStatusMessage(self, message): def showStatusMessage(self, message):
self.StatusBar.showMessage(message) self.StatusBar.showMessage(message)
@ -981,11 +1030,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if recentFilesToDisplay: if recentFilesToDisplay:
self.FileMenu.addSeparator() self.FileMenu.addSeparator()
for fileId, filename in enumerate(recentFilesToDisplay): for fileId, filename in enumerate(recentFilesToDisplay):
action = QtGui.QAction(u'&%d %s' % (fileId +1, log.debug('Recent file name: %s', filename)
action = QtGui.QAction(u'&%d %s' % (fileId + 1,
QtCore.QFileInfo(filename).fileName()), self) QtCore.QFileInfo(filename).fileName()), self)
action.setData(QtCore.QVariant(filename)) action.setData(QtCore.QVariant(filename))
self.connect(action, QtCore.SIGNAL(u'triggered()'), self.connect(action, QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.loadService) self.ServiceManagerContents.onRecentServiceClicked)
self.FileMenu.addAction(action) self.FileMenu.addAction(action)
self.FileMenu.addSeparator() self.FileMenu.addSeparator()
self.FileMenu.addAction(self.FileMenuActions[-1]) self.FileMenu.addAction(self.FileMenuActions[-1])
@ -998,8 +1048,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
The service filename to add The service filename to add
""" """
# The maxRecentFiles value does not have an interface and so never gets # The maxRecentFiles value does not have an interface and so never gets
# actually stored in the settings therefore the default value of 20 # actually stored in the settings therefore the default value of 20 will
# will always be used. # always be used.
maxRecentFiles = QtCore.QSettings().value(u'advanced/max recent files', maxRecentFiles = QtCore.QSettings().value(u'advanced/max recent files',
QtCore.QVariant(20)).toInt()[0] QtCore.QVariant(20)).toInt()[0]
if filename: if filename:
@ -1009,4 +1059,4 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.recentFiles.insert(0, QtCore.QString(filename)) self.recentFiles.insert(0, QtCore.QString(filename))
while self.recentFiles.count() > maxRecentFiles: while self.recentFiles.count() > maxRecentFiles:
# Don't care what API says takeLast works, removeLast doesn't! # Don't care what API says takeLast works, removeLast doesn't!
self.recentFiles.takeLast() self.recentFiles.takeLast()

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -85,4 +85,4 @@ class MediaDockManager(object):
if self.media_dock.widget(dock_index).settingsSection == \ if self.media_dock.widget(dock_index).settingsSection == \
media_item.plugin.name.lower(): media_item.plugin.name.lower():
self.media_dock.widget(dock_index).hide() self.media_dock.widget(dock_index).hide()
self.media_dock.removeItem(dock_index) self.media_dock.removeItem(dock_index)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -114,4 +114,3 @@ class Ui_PluginViewDialog(object):
translate('OpenLP.PluginForm', 'Active')) translate('OpenLP.PluginForm', 'Active'))
self.statusComboBox.setItemText(1, self.statusComboBox.setItemText(1,
translate('OpenLP.PluginForm', 'Inactive')) translate('OpenLP.PluginForm', 'Inactive'))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -92,7 +92,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
self.statusComboBox.setEnabled(False) self.statusComboBox.setEnabled(False)
def _setDetails(self): def _setDetails(self):
log.debug('PluginStatus: %s', str(self.activePlugin.status)) log.debug(u'PluginStatus: %s', str(self.activePlugin.status))
self.versionNumberLabel.setText(self.activePlugin.version) self.versionNumberLabel.setText(self.activePlugin.version)
self.aboutTextBrowser.setHtml(self.activePlugin.about()) self.aboutTextBrowser.setHtml(self.activePlugin.about())
self.programaticChange = True self.programaticChange = True

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -99,4 +99,4 @@ class ScreenList(object):
user wants to use the correct screen attributes user wants to use the correct screen attributes
""" """
log.debug(u'reset_current_display') log.debug(u'reset_current_display')
self.set_current_display(self.current_display) self.set_current_display(self.current_display)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -82,4 +82,4 @@ class Ui_ServiceItemEditDialog(object):
serviceItemEditDialog.setWindowTitle( serviceItemEditDialog.setWindowTitle(
translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item')) translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item'))
self.deleteButton.setText(translate('OpenLP.ServiceItemEditForm', self.deleteButton.setText(translate('OpenLP.ServiceItemEditForm',
'Delete')) 'Delete'))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -122,4 +122,4 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
self.itemList.remove(self.itemList[row]) self.itemList.remove(self.itemList[row])
self.itemList.insert(row + 1, temp) self.itemList.insert(row + 1, temp)
self.loadData() self.loadData()
self.listWidget.setCurrentRow(row + 1) self.listWidget.setCurrentRow(row + 1)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -37,7 +37,7 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \ Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \
ThemeLevel ThemeLevel
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation, split_filename
class ServiceManagerList(QtGui.QTreeWidget): class ServiceManagerList(QtGui.QTreeWidget):
""" """
@ -90,6 +90,7 @@ class ServiceManagerList(QtGui.QTreeWidget):
mimeData.setText(u'ServiceManager') mimeData.setText(u'ServiceManager')
drag.start(QtCore.Qt.CopyAction) drag.start(QtCore.Qt.CopyAction)
class ServiceManager(QtGui.QWidget): class ServiceManager(QtGui.QWidget):
""" """
Manages the services. This involves taking text strings from plugins and Manages the services. This involves taking text strings from plugins and
@ -101,18 +102,19 @@ class ServiceManager(QtGui.QWidget):
""" """
Sets up the service manager, toolbars, list view, et al. Sets up the service manager, toolbars, list view, et al.
""" """
QtGui.QWidget.__init__(self) QtGui.QWidget.__init__(self, parent)
self.parent = parent self.parent = parent
self.serviceItems = [] self.serviceItems = []
self.serviceName = u'' self.serviceName = u''
self.suffixes = [] self.suffixes = []
self.droppos = 0 self.dropPosition = 0
self.expandTabs = False self.expandTabs = False
#is a new service and has not been saved # is a new service and has not been saved
self.isNew = True self._modified = False
self._fileName = u''
self.serviceNoteForm = ServiceNoteForm(self.parent) self.serviceNoteForm = ServiceNoteForm(self.parent)
self.serviceItemEditForm = ServiceItemEditForm(self.parent) self.serviceItemEditForm = ServiceItemEditForm(self.parent)
#start with the layout # start with the layout
self.layout = QtGui.QVBoxLayout(self) self.layout = QtGui.QVBoxLayout(self)
self.layout.setSpacing(0) self.layout.setSpacing(0)
self.layout.setMargin(0) self.layout.setMargin(0)
@ -123,17 +125,17 @@ class ServiceManager(QtGui.QWidget):
translate('OpenLP.ServiceManager', 'New Service'), translate('OpenLP.ServiceManager', 'New Service'),
u':/general/general_new.png', u':/general/general_new.png',
translate('OpenLP.ServiceManager', 'Create a new service'), translate('OpenLP.ServiceManager', 'Create a new service'),
self.onNewService) self.onNewServiceClicked)
self.toolbar.addToolbarButton( self.toolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Open Service'), translate('OpenLP.ServiceManager', 'Open Service'),
u':/general/general_open.png', u':/general/general_open.png',
translate('OpenLP.ServiceManager', 'Load an existing service'), translate('OpenLP.ServiceManager', 'Load an existing service'),
self.onLoadService) self.onLoadServiceClicked)
self.toolbar.addToolbarButton( self.toolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Save Service'), translate('OpenLP.ServiceManager', 'Save Service'),
u':/general/general_save.png', u':/general/general_save.png',
translate('OpenLP.ServiceManager', 'Save this service'), translate('OpenLP.ServiceManager', 'Save this service'),
self.onQuickSaveService) self.onSaveServiceClicked)
self.toolbar.addSeparator() self.toolbar.addSeparator()
self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager', self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager',
'Theme:'), self) 'Theme:'), self)
@ -282,6 +284,42 @@ class ServiceManager(QtGui.QWidget):
self.menu.addMenu(self.themeMenu) self.menu.addMenu(self.themeMenu)
self.configUpdated(True) self.configUpdated(True)
def setModified(self, modified=True):
"""
Setter for property "modified". Sets whether or not the current service
has been modified.
"""
self._modified = modified
serviceFile = self.shortFileName() or u'Untitled Service'
self.parent.setServiceModified(modified, serviceFile)
def isModified(self):
"""
Getter for boolean property "modified".
"""
return self._modified
def setFileName(self, fileName):
"""
Setter for service file.
"""
self._fileName = unicode(fileName)
self.parent.setServiceModified(self.isModified, self.shortFileName())
QtCore.QSettings(). \
setValue(u'service/last file',QtCore.QVariant(fileName))
def fileName(self):
"""
Return the current file name including path.
"""
return self._fileName
def shortFileName(self):
"""
Return the current file name, excluding the path.
"""
return split_filename(self._fileName)[1]
def configUpdated(self, firstTime=False): def configUpdated(self, firstTime=False):
""" """
Triggered when Config dialog is updated. Triggered when Config dialog is updated.
@ -295,6 +333,223 @@ class ServiceManager(QtGui.QWidget):
def supportedSuffixes(self, suffix): def supportedSuffixes(self, suffix):
self.suffixes.append(suffix) self.suffixes.append(suffix)
def onNewServiceClicked(self):
"""
Create a new service.
"""
if self.isModified():
result = QtGui.QMessageBox.question(self.parent,
translate('OpenLP.ServiceManager', 'Save Changes'),
translate('OpenLP.ServiceManager', 'The current service has '
'been modified, would you like to save it?'),
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
if result == QtGui.QMessageBox.Cancel:
return False
elif result == QtGui.QMessageBox.Save:
if not self.saveFile():
return False
self.newFile()
def onLoadServiceClicked(self):
if self.isModified():
result = QtGui.QMessageBox.question(self.parent,
translate('OpenLP.ServiceManager', 'Save Changes'),
translate('OpenLP.ServiceManager', 'The current service has '
'been modified, would you like to save it?'),
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
if result == QtGui.QMessageBox.Cancel:
return False
elif result == QtGui.QMessageBox.Save:
self.saveFile()
fileName = unicode(QtGui.QFileDialog.getOpenFileName(self.parent,
translate('OpenLP.ServiceManager', 'Open File'),
SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz) (*.osz)')))
if not fileName:
return False
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
split_filename(fileName)[0])
self.loadFile(fileName)
def onSaveServiceClicked(self):
self.saveFile()
def onSaveServiceAsClicked(self):
self.saveFileAs()
def onRecentServiceClicked(self):
sender = self.sender()
self.loadFile(sender.data().toString())
def newFile(self):
"""
Create a blank new service file.
"""
self.serviceManagerList.clear()
self.serviceItems = []
self.setFileName(u'')
self.setModified(False)
QtCore.QSettings(). \
setValue(u'service/last file',QtCore.QVariant(u''))
def saveFile(self):
"""
Save the current Service file.
"""
if not self.fileName():
return self.saveFileAs()
else:
fileName = self.fileName()
log.debug(u'ServiceManager.saveFile - %s' % fileName)
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
split_filename(fileName)[0])
service = []
serviceFileName = fileName.replace(u'.osz', u'.osd')
zip = None
file = None
try:
write_list = []
zip = zipfile.ZipFile(unicode(fileName), 'w')
for item in self.serviceItems:
service.append({u'serviceitem': \
item[u'service_item'].get_service_repr()})
if item[u'service_item'].uses_file():
for frame in item[u'service_item'].get_frames():
if item[u'service_item'].is_image():
path_from = frame[u'path']
else:
path_from = unicode(os.path.join(
frame[u'path'],
frame[u'title']))
# On write a file once
if not path_from in write_list:
write_list.append(path_from)
zip.write(path_from.encode(u'utf-8'))
file = open(serviceFileName, u'wb')
cPickle.dump(service, file)
file.close()
zip.write(serviceFileName.encode(u'utf-8'))
except IOError:
log.exception(u'Failed to save service to disk')
finally:
if file:
file.close()
if zip:
zip.close()
try:
os.remove(serviceFileName)
except (IOError, OSError):
# if not present do not worry
pass
self.parent.addRecentFile(fileName)
self.setModified(False)
return True
def saveFileAs(self):
"""
Get a file name and then call :function:`ServiceManager.saveFile` to
save the file.
"""
fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.parent,
translate('OpenLP.ServiceManager', 'Save Service'),
SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz) (*.osz)')))
if not fileName:
return False
if os.path.splitext(fileName)[1] == u'':
fileName += u'.osz'
else:
ext = os.path.splitext(fileName)[1]
fileName.replace(ext, u'.osz')
self.setFileName(fileName)
return self.saveFile()
def loadFile(self, fileName):
if not fileName:
return False
else:
fileName = unicode(fileName)
zip = None
fileTo = None
try:
zip = zipfile.ZipFile(unicode(fileName))
for file in zip.namelist():
try:
ucsfile = file.decode(u'utf-8')
except UnicodeDecodeError:
QtGui.QMessageBox.critical(
self, translate('OpenLP.ServiceManager', 'Error'),
translate('OpenLP.ServiceManager',
'File is not a valid service.\n'
'The content encoding is not UTF-8.'))
log.exception(u'Filename "%s" is not valid UTF-8' %
file.decode(u'utf-8', u'replace'))
continue
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
filePath = os.path.join(self.servicePath,
os.path.split(osfile)[1])
fileTo = open(filePath, u'wb')
fileTo.write(zip.read(file))
fileTo.flush()
fileTo.close()
if filePath.endswith(u'osd'):
p_file = filePath
if 'p_file' in locals():
fileTo = open(p_file, u'r')
items = cPickle.load(fileTo)
fileTo.close()
self.newFile()
for item in items:
serviceItem = ServiceItem()
serviceItem.render_manager = self.parent.renderManager
serviceItem.set_from_service(item, self.servicePath)
self.validateItem(serviceItem)
self.addServiceItem(serviceItem)
if serviceItem.is_capable(
ItemCapabilities.OnLoadUpdate):
Receiver.send_message(u'%s_service_load' %
serviceItem.name.lower(), serviceItem)
try:
if os.path.isfile(p_file):
os.remove(p_file)
except (IOError, OSError):
log.exception(u'Failed to remove osd file')
else:
QtGui.QMessageBox.critical(
self, translate('OpenLP.ServiceManager', 'Error'),
translate('OpenLP.ServiceManager',
'File is not a valid service.'))
log.exception(u'File contains no service data')
except (IOError, NameError):
log.exception(u'Problem loading a service file')
finally:
if fileTo:
fileTo.close()
if zip:
zip.close()
self.setFileName(fileName)
self.parent.addRecentFile(fileName)
self.setModified(False)
QtCore.QSettings(). \
setValue(u'service/last file',QtCore.QVariant(fileName))
# Refresh Plugin lists
Receiver.send_message(u'plugin_list_refresh')
def loadLastFile(self):
"""
Load the last service item from the service manager when the
service was last closed. Can be blank if there was no service
present.
"""
fileName = QtCore.QSettings(). \
value(u'service/last file',QtCore.QVariant(u'')).toString()
if fileName:
self.loadFile(fileName)
def contextMenu(self, point): def contextMenu(self, point):
item = self.serviceManagerList.itemAt(point) item = self.serviceManagerList.itemAt(point)
if item is None: if item is None:
@ -427,6 +682,7 @@ class ServiceManager(QtGui.QWidget):
# Top Item was selected so set the last one # Top Item was selected so set the last one
if setLastItem: if setLastItem:
lastItem.setSelected(True) lastItem.setSelected(True)
self.isModified = True
def onMoveSelectionDown(self): def onMoveSelectionDown(self):
""" """
@ -449,6 +705,7 @@ class ServiceManager(QtGui.QWidget):
serviceIterator += 1 serviceIterator += 1
if setSelected: if setSelected:
firstItem.setSelected(True) firstItem.setSelected(True)
self.isModified = True
def onCollapseAll(self): def onCollapseAll(self):
""" """
@ -492,7 +749,7 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(0, temp) self.serviceItems.insert(0, temp)
self.repaintServiceList(0, count) self.repaintServiceList(0, count)
self.parent.serviceChanged(False, self.serviceName) self.isModified = True
def onServiceUp(self): def onServiceUp(self):
""" """
@ -505,7 +762,7 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(item - 1, temp) self.serviceItems.insert(item - 1, temp)
self.repaintServiceList(item - 1, count) self.repaintServiceList(item - 1, count)
self.parent.serviceChanged(False, self.serviceName) self.setModified(True)
def onServiceDown(self): def onServiceDown(self):
""" """
@ -518,7 +775,7 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(item + 1, temp) self.serviceItems.insert(item + 1, temp)
self.repaintServiceList(item + 1, count) self.repaintServiceList(item + 1, count)
self.parent.serviceChanged(False, self.serviceName) self.setModified(True)
def onServiceEnd(self): def onServiceEnd(self):
""" """
@ -530,30 +787,7 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(len(self.serviceItems), temp) self.serviceItems.insert(len(self.serviceItems), temp)
self.repaintServiceList(len(self.serviceItems) - 1, count) self.repaintServiceList(len(self.serviceItems) - 1, count)
self.parent.serviceChanged(False, self.serviceName) self.setModified(True)
def onNewService(self):
"""
Clear the list to create a new service
"""
if self.parent.serviceNotSaved and QtCore.QSettings().value(
self.parent.generalSettingsSection + u'/save prompt',
QtCore.QVariant(False)).toBool():
ret = QtGui.QMessageBox.question(self,
translate('OpenLP.ServiceManager', 'Save Changes to Service?'),
translate('OpenLP.ServiceManager',
'Your service is unsaved, do you want to save '
'those changes before creating a new one?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save:
self.onSaveService()
self.serviceManagerList.clear()
self.serviceItems = []
self.serviceName = u''
self.isNew = True
self.parent.serviceChanged(True, self.serviceName)
def onDeleteFromService(self): def onDeleteFromService(self):
""" """
@ -563,13 +797,19 @@ class ServiceManager(QtGui.QWidget):
if item is not -1: if item is not -1:
self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.remove(self.serviceItems[item])
self.repaintServiceList(0, 0) self.repaintServiceList(0, 0)
self.parent.serviceChanged(False, self.serviceName) self.setModified(True)
def repaintServiceList(self, serviceItem, serviceItemCount): def repaintServiceList(self, serviceItem, serviceItemCount):
""" """
Clear the existing service list and prepaint all the items Clear the existing service list and prepaint all the items. This is
Used when moving items as the move takes place in supporting array, used when moving items as the move takes place in a supporting list,
and when regenerating all the items due to theme changes and when regenerating all the items due to theme changes.
``serviceItem``
The item which changed.
``serviceItemCount``
The number of items in the service.
""" """
# Correct order of items in array # Correct order of items in array
count = 1 count = 1
@ -615,183 +855,6 @@ class ServiceManager(QtGui.QWidget):
item[u'expanded'] = temp item[u'expanded'] = temp
treewidgetitem.setExpanded(item[u'expanded']) treewidgetitem.setExpanded(item[u'expanded'])
def onSaveService(self, quick=False):
"""
Save the current service in a zip (OSZ) file
This file contains
* An osd which is a pickle of the service items
* All image, presentation and video files needed to run the service.
"""
log.debug(u'onSaveService %s' % quick)
if not quick or self.isNew:
filename = QtGui.QFileDialog.getSaveFileName(self,
translate('OpenLP.ServiceManager', 'Save Service'),
SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))
else:
filename = os.path.join(SettingsManager.get_last_dir(
self.parent.serviceSettingsSection), self.serviceName)
if filename:
filename = QtCore.QDir.toNativeSeparators(filename)
splittedFile = filename.split(u'.')
if splittedFile[-1] != u'osz':
filename = filename + u'.osz'
filename = unicode(filename)
self.isNew = False
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
os.path.split(filename)[0])
service = []
servicefile = filename + u'.osd'
zip = None
file = None
try:
write_list = []
zip = zipfile.ZipFile(unicode(filename), 'w')
for item in self.serviceItems:
service.append({u'serviceitem':item[u'service_item']
.get_service_repr()})
if item[u'service_item'].uses_file():
for frame in item[u'service_item'].get_frames():
if item[u'service_item'].is_image():
path_from = frame[u'path']
else:
path_from = unicode(os.path.join(
frame[u'path'],
frame[u'title']))
# On write a file once
if not path_from in write_list:
write_list.append(path_from)
zip.write(path_from.encode(u'utf-8'))
file = open(servicefile, u'wb')
cPickle.dump(service, file)
file.close()
zip.write(servicefile.encode(u'utf-8'))
except IOError:
log.exception(u'Failed to save service to disk')
finally:
if file:
file.close()
if zip:
zip.close()
try:
os.remove(servicefile)
except (IOError, OSError):
pass #if not present do not worry
name = filename.split(os.path.sep)
self.serviceName = name[-1]
self.parent.addRecentFile(filename)
self.parent.serviceChanged(True, self.serviceName)
def onQuickSaveService(self):
self.onSaveService(True)
def onLoadService(self, lastService=False):
if lastService:
if not self.parent.recentFiles:
return
filename = self.parent.recentFiles[0]
else:
filename = QtGui.QFileDialog.getOpenFileName(
self, translate('OpenLP.ServiceManager', 'Open Service'),
SettingsManager.get_last_dir(
self.parent.serviceSettingsSection), u'Services (*.osz)')
filename = QtCore.QDir.toNativeSeparators(filename)
self.loadService(filename)
def loadService(self, filename=None):
"""
Load an existing service from disk and rebuild the serviceitems. All
files retrieved from the zip file are placed in a temporary directory
and will only be used for this service.
"""
if self.parent.serviceNotSaved:
ret = QtGui.QMessageBox.question(self,
translate('OpenLP.ServiceManager', 'Save Changes to Service?'),
translate('OpenLP.ServiceManager',
'Your current service is unsaved, do you want to '
'save the changes before opening a new one?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Discard | QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save:
self.onSaveService()
if filename is None:
action = self.sender()
if isinstance(action, QtGui.QAction):
filename = action.data().toString()
else:
return
filename = unicode(filename)
name = filename.split(os.path.sep)
if filename:
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
os.path.split(filename)[0])
zip = None
file_to = None
try:
zip = zipfile.ZipFile(unicode(filename))
for file in zip.namelist():
try:
ucsfile = file.decode(u'utf-8')
except UnicodeDecodeError:
QtGui.QMessageBox.critical(
self, translate('OpenLP.ServiceManager', 'Error'),
translate('OpenLP.ServiceManager',
'File is not a valid service.\n'
'The content encoding is not UTF-8.'))
log.exception(u'Filename "%s" is not valid UTF-8' %
file.decode(u'utf-8', u'replace'))
continue
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
names = osfile.split(os.path.sep)
file_path = os.path.join(self.servicePath,
names[len(names) - 1])
file_to = open(file_path, u'wb')
file_to.write(zip.read(file))
file_to.flush()
file_to.close()
if file_path.endswith(u'osd'):
p_file = file_path
if 'p_file' in locals():
file_to = open(p_file, u'r')
items = cPickle.load(file_to)
file_to.close()
self.onNewService()
for item in items:
serviceitem = ServiceItem()
serviceitem.render_manager = self.parent.renderManager
serviceitem.set_from_service(item, self.servicePath)
self.validateItem(serviceitem)
self.addServiceItem(serviceitem)
if serviceitem.is_capable(
ItemCapabilities.OnLoadUpdate):
Receiver.send_message(u'%s_service_load' %
serviceitem.name.lower(), serviceitem)
try:
if os.path.isfile(p_file):
os.remove(p_file)
except (IOError, OSError):
log.exception(u'Failed to remove osd file')
else:
QtGui.QMessageBox.critical(
self, translate('OpenLP.ServiceManager', 'Error'),
translate('OpenLP.ServiceManager',
'File is not a valid service.'))
log.exception(u'File contains no service data')
except (IOError, NameError):
log.exception(u'Problem loading a service file')
finally:
if file_to:
file_to.close()
if zip:
zip.close()
self.isNew = False
self.serviceName = name[len(name) - 1]
self.parent.addRecentFile(filename)
self.parent.serviceChanged(True, self.serviceName)
# Refresh Plugin lists
Receiver.send_message(u'plugin_list_refresh')
def validateItem(self, serviceItem): def validateItem(self, serviceItem):
""" """
Validates the service item and if the suffix matches an accepted Validates the service item and if the suffix matches an accepted
@ -844,6 +907,7 @@ class ServiceManager(QtGui.QWidget):
Rebuild the service list as things have changed and a Rebuild the service list as things have changed and a
repaint is the easiest way to do this. repaint is the easiest way to do this.
""" """
Receiver.send_message(u'cursor_busy')
log.debug(u'regenerateServiceItems') log.debug(u'regenerateServiceItems')
# force reset of renderer as theme data has changed # force reset of renderer as theme data has changed
self.parent.renderManager.themedata = None self.parent.renderManager.themedata = None
@ -857,7 +921,8 @@ class ServiceManager(QtGui.QWidget):
item[u'service_item'], False, expand=item[u'expanded']) item[u'service_item'], False, expand=item[u'expanded'])
# Set to False as items may have changed rendering # Set to False as items may have changed rendering
# does not impact the saved song so True may also be valid # does not impact the saved song so True may also be valid
self.parent.serviceChanged(False, self.serviceName) self.setModified(True)
Receiver.send_message(u'cursor_normal')
def serviceItemUpdate(self, message): def serviceItemUpdate(self, message):
""" """
@ -881,7 +946,7 @@ class ServiceManager(QtGui.QWidget):
item[u'service_item'] = newItem item[u'service_item'] = newItem
self.repaintServiceList(itemcount + 1, 0) self.repaintServiceList(itemcount + 1, 0)
self.parent.liveController.replaceServiceManagerItem(newItem) self.parent.liveController.replaceServiceManagerItem(newItem)
self.parent.serviceChanged(False, self.serviceName) self.setModified(True)
def addServiceItem(self, item, rebuild=False, expand=None, replace=False): def addServiceItem(self, item, rebuild=False, expand=None, replace=False):
""" """
@ -905,7 +970,7 @@ class ServiceManager(QtGui.QWidget):
self.parent.liveController.replaceServiceManagerItem(item) self.parent.liveController.replaceServiceManagerItem(item)
else: else:
# nothing selected for dnd # nothing selected for dnd
if self.droppos == 0: if self.dropPosition == 0:
if isinstance(item, list): if isinstance(item, list):
for inditem in item: for inditem in item:
self.serviceItems.append({u'service_item': inditem, self.serviceItems.append({u'service_item': inditem,
@ -917,15 +982,15 @@ class ServiceManager(QtGui.QWidget):
u'expanded':expand}) u'expanded':expand})
self.repaintServiceList(len(self.serviceItems) + 1, 0) self.repaintServiceList(len(self.serviceItems) + 1, 0)
else: else:
self.serviceItems.insert(self.droppos, {u'service_item': item, self.serviceItems.insert(self.dropPosition, {u'service_item': item,
u'order': self.droppos, u'order': self.dropPosition,
u'expanded':expand}) u'expanded':expand})
self.repaintServiceList(self.droppos, 0) self.repaintServiceList(self.dropPosition, 0)
# if rebuilding list make sure live is fixed. # if rebuilding list make sure live is fixed.
if rebuild: if rebuild:
self.parent.liveController.replaceServiceManagerItem(item) self.parent.liveController.replaceServiceManagerItem(item)
self.droppos = 0 self.dropPosition = 0
self.parent.serviceChanged(False, self.serviceName) self.setModified(True)
def makePreview(self): def makePreview(self):
""" """
@ -1045,7 +1110,7 @@ class ServiceManager(QtGui.QWidget):
# we are not over anything so drop # we are not over anything so drop
replace = False replace = False
if item is None: if item is None:
self.droppos = len(self.serviceItems) self.dropPosition = len(self.serviceItems)
else: else:
# we are over somthing so lets investigate # we are over somthing so lets investigate
pos = self._getParentItemData(item) - 1 pos = self._getParentItemData(item) - 1
@ -1056,14 +1121,14 @@ class ServiceManager(QtGui.QWidget):
action = self.dndMenu.exec_(QtGui.QCursor.pos()) action = self.dndMenu.exec_(QtGui.QCursor.pos())
# New action required # New action required
if action == self.newAction: if action == self.newAction:
self.droppos = self._getParentItemData(item) self.dropPosition = self._getParentItemData(item)
# Append to existing action # Append to existing action
if action == self.addToAction: if action == self.addToAction:
self.droppos = self._getParentItemData(item) self.dropPosition = self._getParentItemData(item)
item.setSelected(True) item.setSelected(True)
replace = True replace = True
else: else:
self.droppos = self._getParentItemData(item) self.dropPosition = self._getParentItemData(item)
Receiver.send_message(u'%s_add_service_item' % plugin, replace) Receiver.send_message(u'%s_add_service_item' % plugin, replace)
def updateThemeList(self, theme_list): def updateThemeList(self, theme_list):

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -50,4 +50,4 @@ class Ui_ServiceNoteEdit(object):
def retranslateUi(self, serviceNoteEdit): def retranslateUi(self, serviceNoteEdit):
serviceNoteEdit.setWindowTitle( serviceNoteEdit.setWindowTitle(
translate('OpenLP.ServiceNoteForm', 'Service Item Notes')) translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -41,4 +41,4 @@ class ServiceNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit):
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
self.accept) self.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
self.reject) self.reject)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -65,4 +65,4 @@ class Ui_SettingsDialog(object):
def retranslateUi(self, settingsDialog): def retranslateUi(self, settingsDialog):
settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm', settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm',
'Configure OpenLP')) 'Configure OpenLP'))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -98,4 +98,4 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
Run any post-setup code for the tabs on the form Run any post-setup code for the tabs on the form
""" """
for tabIndex in range(0, self.settingsTabWidget.count()): for tabIndex in range(0, self.settingsTabWidget.count()):
self.settingsTabWidget.widget(tabIndex).postSetUp() self.settingsTabWidget.widget(tabIndex).postSetUp()

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -111,4 +111,3 @@ class Ui_ShortcutListDialog(object):
translate('OpenLP.ShortcutListDialog', 'Custom:')) translate('OpenLP.ShortcutListDialog', 'Custom:'))
self.shortcutPushButton.setText( self.shortcutPushButton.setText(
translate('OpenLP.ShortcutListDialog', 'None')) translate('OpenLP.ShortcutListDialog', 'None'))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -71,7 +71,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
if event.modifiers() & Qt.ShiftModifier == Qt.ShiftModifier: if event.modifiers() & Qt.ShiftModifier == Qt.ShiftModifier:
key_string = u'Shift+' + key_string key_string = u'Shift+' + key_string
key_sequence = QtGui.QKeySequence(key_string) key_sequence = QtGui.QKeySequence(key_string)
existing_key = QtGui.QKeySequence("Ctrl+Shift+F8") existing_key = QtGui.QKeySequence(u'Ctrl+Shift+F8')
if key_sequence == existing_key: if key_sequence == existing_key:
QtGui.QMessageBox.warning( QtGui.QMessageBox.warning(
self, self,
@ -107,4 +107,3 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
def onShortcutPushButtonClicked(self, toggled): def onShortcutPushButtonClicked(self, toggled):
self.captureShortcut = toggled self.captureShortcut = toggled

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -73,6 +73,7 @@ class SlideList(QtGui.QTableWidget):
else: else:
event.ignore() event.ignore()
class SlideController(QtGui.QWidget): class SlideController(QtGui.QWidget):
""" """
SlideController is the slide controller widget. This widget is what the SlideController is the slide controller widget. This widget is what the
@ -183,41 +184,23 @@ class SlideController(QtGui.QWidget):
translate('OpenLP.SlideController', translate('OpenLP.SlideController',
'Blank Screen'), self.HideMenu) 'Blank Screen'), self.HideMenu)
self.BlankScreen.setCheckable(True) self.BlankScreen.setCheckable(True)
QtCore.QObject.connect(self.BlankScreen,
QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay)
self.ThemeScreen = QtGui.QAction(QtGui.QIcon( self.ThemeScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_theme.png'), u':/slides/slide_theme.png'),
translate('OpenLP.SlideController', translate('OpenLP.SlideController',
'Blank to Theme'), self.HideMenu) 'Blank to Theme'), self.HideMenu)
self.ThemeScreen.setCheckable(True) self.ThemeScreen.setCheckable(True)
QtCore.QObject.connect(self.ThemeScreen,
QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
if self.screens.display_count > 1:
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_desktop.png'),
translate('OpenLP.SlideController',
'Show Desktop'), self.HideMenu)
self.DesktopScreen.setCheckable(True)
QtCore.QObject.connect(self.DesktopScreen,
QtCore.SIGNAL("triggered(bool)"), self.onHideDisplay)
self.HideMenu.setDefaultAction(self.BlankScreen) self.HideMenu.setDefaultAction(self.BlankScreen)
self.HideMenu.menu().addAction(self.BlankScreen) self.HideMenu.menu().addAction(self.BlankScreen)
self.HideMenu.menu().addAction(self.ThemeScreen) self.HideMenu.menu().addAction(self.ThemeScreen)
if self.screens.display_count > 1: if self.screens.display_count > 1:
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_desktop.png'),
translate('OpenLP.SlideController',
'Show Desktop'), self.HideMenu)
self.HideMenu.menu().addAction(self.DesktopScreen) self.HideMenu.menu().addAction(self.DesktopScreen)
if not self.isLive: self.DesktopScreen.setCheckable(True)
self.Toolbar.addToolbarSeparator(u'Close Separator') QtCore.QObject.connect(self.DesktopScreen,
self.Toolbar.addToolbarButton( QtCore.SIGNAL(u'triggered(bool)'), self.onHideDisplay)
u'Go Live', u':/general/general_live.png',
translate('OpenLP.SlideController', 'Move to live'),
self.onGoLive)
self.Toolbar.addToolbarSeparator(u'Close Separator')
self.Toolbar.addToolbarButton(
u'Edit Song', u':/general/general_edit.png',
translate('OpenLP.SlideController',
'Edit and reload song preview'),
self.onEditSong)
if isLive:
self.Toolbar.addToolbarSeparator(u'Loop Separator') self.Toolbar.addToolbarSeparator(u'Loop Separator')
self.Toolbar.addToolbarButton( self.Toolbar.addToolbarButton(
u'Start Loop', u':/media/media_time.png', u'Start Loop', u':/media/media_time.png',
@ -230,12 +213,23 @@ class SlideController(QtGui.QWidget):
self.DelaySpinBox = QtGui.QSpinBox() self.DelaySpinBox = QtGui.QSpinBox()
self.DelaySpinBox.setMinimum(1) self.DelaySpinBox.setMinimum(1)
self.DelaySpinBox.setMaximum(180) self.DelaySpinBox.setMaximum(180)
self.Toolbar.addToolbarWidget( self.Toolbar.addToolbarWidget(u'Image SpinBox', self.DelaySpinBox)
u'Image SpinBox', self.DelaySpinBox)
self.DelaySpinBox.setSuffix(translate('OpenLP.SlideController', self.DelaySpinBox.setSuffix(translate('OpenLP.SlideController',
's')) 's'))
self.DelaySpinBox.setToolTip(translate('OpenLP.SlideController', self.DelaySpinBox.setToolTip(translate('OpenLP.SlideController',
'Delay between slides in seconds')) 'Delay between slides in seconds'))
else:
self.Toolbar.addToolbarSeparator(u'Close Separator')
self.Toolbar.addToolbarButton(
u'Go Live', u':/general/general_live.png',
translate('OpenLP.SlideController', 'Move to live'),
self.onGoLive)
self.Toolbar.addToolbarSeparator(u'Close Separator')
self.Toolbar.addToolbarButton(
u'Edit Song', u':/general/general_edit.png',
translate('OpenLP.SlideController',
'Edit and reload song preview'),
self.onEditSong)
self.ControllerLayout.addWidget(self.Toolbar) self.ControllerLayout.addWidget(self.Toolbar)
# Build a Media ToolBar # Build a Media ToolBar
self.Mediabar = OpenLPToolbar(self) self.Mediabar = OpenLPToolbar(self)
@ -251,42 +245,39 @@ class SlideController(QtGui.QWidget):
u'Media Stop', u':/slides/media_playback_stop.png', u'Media Stop', u':/slides/media_playback_stop.png',
translate('OpenLP.SlideController', 'Start playing media'), translate('OpenLP.SlideController', 'Start playing media'),
self.onMediaStop) self.onMediaStop)
if not self.isLive: if self.isLive:
self.seekSlider = Phonon.SeekSlider() # Build the Song Toolbar
self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
self.seekSlider.setObjectName(u'seekSlider')
self.Mediabar.addToolbarWidget(
u'Seek Slider', self.seekSlider)
self.volumeSlider = Phonon.VolumeSlider()
self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
self.volumeSlider.setObjectName(u'volumeSlider')
self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
else:
self.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
self.volumeSlider.setTickInterval(1)
self.volumeSlider.setTickPosition(QtGui.QSlider.TicksAbove)
self.volumeSlider.setMinimum(0)
self.volumeSlider.setMaximum(10)
self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
self.volumeSlider.setObjectName(u'volumeSlider')
self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
self.ControllerLayout.addWidget(self.Mediabar)
# Build the Song Toolbar
if isLive:
self.SongMenu = QtGui.QToolButton(self.Toolbar) self.SongMenu = QtGui.QToolButton(self.Toolbar)
self.SongMenu.setText(translate('OpenLP.SlideController', self.SongMenu.setText(translate('OpenLP.SlideController',
'Go To')) 'Go To'))
self.SongMenu.setPopupMode(QtGui.QToolButton.InstantPopup) self.SongMenu.setPopupMode(QtGui.QToolButton.InstantPopup)
self.Toolbar.addToolbarWidget(u'Song Menu', self.SongMenu) self.Toolbar.addToolbarWidget(u'Song Menu', self.SongMenu)
self.SongMenu.setMenu(QtGui.QMenu( self.SongMenu.setMenu(QtGui.QMenu(
translate('OpenLP.SlideController', 'Go To'), translate('OpenLP.SlideController', 'Go To'), self.Toolbar))
self.Toolbar))
self.Toolbar.makeWidgetsInvisible([u'Song Menu']) self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
# Build the volumeSlider.
self.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
self.volumeSlider.setTickInterval(1)
self.volumeSlider.setTickPosition(QtGui.QSlider.TicksAbove)
self.volumeSlider.setMinimum(0)
self.volumeSlider.setMaximum(10)
else:
# Build the seekSlider.
self.seekSlider = Phonon.SeekSlider()
self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
self.seekSlider.setObjectName(u'seekSlider')
self.Mediabar.addToolbarWidget(u'Seek Slider', self.seekSlider)
self.volumeSlider = Phonon.VolumeSlider()
self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
self.volumeSlider.setObjectName(u'volumeSlider')
self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
self.ControllerLayout.addWidget(self.Mediabar)
# Screen preview area # Screen preview area
self.PreviewFrame = QtGui.QFrame(self.Splitter) self.PreviewFrame = QtGui.QFrame(self.Splitter)
self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 225)) self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio))
self.PreviewFrame.setMinimumHeight(100)
self.PreviewFrame.setSizePolicy(QtGui.QSizePolicy( self.PreviewFrame.setSizePolicy(QtGui.QSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored,
QtGui.QSizePolicy.Label)) QtGui.QSizePolicy.Label))
self.PreviewFrame.setFrameShape(QtGui.QFrame.StyledPanel) self.PreviewFrame.setFrameShape(QtGui.QFrame.StyledPanel)
self.PreviewFrame.setFrameShadow(QtGui.QFrame.Sunken) self.PreviewFrame.setFrameShadow(QtGui.QFrame.Sunken)
@ -306,7 +297,6 @@ class SlideController(QtGui.QWidget):
Phonon.createPath(self.mediaObject, self.audio) Phonon.createPath(self.mediaObject, self.audio)
if not self.isLive: if not self.isLive:
self.video.setGeometry(QtCore.QRect(0, 0, 300, 225)) self.video.setGeometry(QtCore.QRect(0, 0, 300, 225))
self.video.setVisible(False)
self.SlideLayout.insertWidget(0, self.video) self.SlideLayout.insertWidget(0, self.video)
# Actual preview screen # Actual preview screen
self.SlidePreview = QtGui.QLabel(self) self.SlidePreview = QtGui.QLabel(self)
@ -330,18 +320,24 @@ class SlideController(QtGui.QWidget):
# Signals # Signals
QtCore.QObject.connect(self.PreviewListWidget, QtCore.QObject.connect(self.PreviewListWidget,
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected) QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
if not self.isLive: if self.isLive:
QtCore.QObject.connect(self.PreviewListWidget, QtCore.QObject.connect(self.BlankScreen,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), QtCore.SIGNAL(u'triggered(bool)'), self.onBlankDisplay)
self.onGoLiveClick) QtCore.QObject.connect(self.ThemeScreen,
if isLive: QtCore.SIGNAL(u'triggered(bool)'), self.onThemeDisplay)
QtCore.QObject.connect(self.volumeSlider,
QtCore.SIGNAL(u'sliderReleased()'), self.mediaVolume)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_active'), self.updatePreview)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'), QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
self.receiveSpinDelay) self.receiveSpinDelay)
if isLive:
self.Toolbar.makeWidgetsInvisible(self.loopList) self.Toolbar.makeWidgetsInvisible(self.loopList)
self.Toolbar.actions[u'Stop Loop'].setVisible(False) self.Toolbar.actions[u'Stop Loop'].setVisible(False)
else: else:
QtCore.QObject.connect(self.PreviewListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onGoLiveClick)
self.Toolbar.makeWidgetsInvisible(self.songEditList) self.Toolbar.makeWidgetsInvisible(self.songEditList)
self.Mediabar.setVisible(False) self.Mediabar.setVisible(False)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -381,54 +377,49 @@ class SlideController(QtGui.QWidget):
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix), QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix),
self.onTextRequest) self.onTextRequest)
QtCore.QObject.connect(self.Splitter,
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem) QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged) QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged)
if self.isLive:
QtCore.QObject.connect(self.volumeSlider,
QtCore.SIGNAL(u'sliderReleased()'), self.mediaVolume)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_active'), self.updatePreview)
def screenSizeChanged(self): def screenSizeChanged(self):
""" """
Settings dialog has changed the screen size of adjust output and Settings dialog has changed the screen size of adjust output and
screen previews screen previews.
""" """
log.debug(u'screenSizeChanged live = %s' % self.isLive)
# rebuild display as screen size changed # rebuild display as screen size changed
self.display = MainDisplay(self, self.screens, self.isLive) self.display = MainDisplay(self, self.screens, self.isLive)
self.display.imageManager = self.parent.renderManager.image_manager self.display.imageManager = self.parent.renderManager.image_manager
self.display.alertTab = self.alertTab self.display.alertTab = self.alertTab
self.display.setup()
# The SlidePreview's ratio.
self.ratio = float(self.screens.current[u'size'].width()) / \ self.ratio = float(self.screens.current[u'size'].width()) / \
float(self.screens.current[u'size'].height()) float(self.screens.current[u'size'].height())
self.display.setup() self.previewSizeChanged()
self.SlidePreview.setFixedSize(
QtCore.QSize(self.settingsmanager.slidecontroller_image,
self.settingsmanager.slidecontroller_image / self.ratio))
def widthChanged(self): def previewSizeChanged(self):
""" """
Handle changes of width from the splitter between the live and preview Takes care of the SlidePreview's size. Is called when one of the the
controller. Event only issues when changes have finished splitters is moved or when the screen size is changed.
""" """
log.debug(u'widthChanged live = %s' % self.isLive) if self.ratio < float(self.PreviewFrame.width()) / float(
self.PreviewFrame.height()):
# We have to take the height as limit.
max_height = self.PreviewFrame.height() - self.grid.margin() * 2
self.SlidePreview.setFixedSize(QtCore.QSize(max_height * self.ratio,
max_height))
else:
# We have to take the width as limit.
max_width = self.PreviewFrame.width() - self.grid.margin() * 2
self.SlidePreview.setFixedSize(QtCore.QSize(max_width,
max_width / self.ratio))
width = self.parent.ControlSplitter.sizes()[self.split] width = self.parent.ControlSplitter.sizes()[self.split]
height = width * self.parent.renderManager.screen_ratio
self.PreviewListWidget.setColumnWidth(0, width) self.PreviewListWidget.setColumnWidth(0, width)
# Sort out image heights (Songs, bibles excluded) # Sort out image heights (Songs, bibles excluded)
if self.serviceItem and not self.serviceItem.is_text(): if self.serviceItem and not self.serviceItem.is_text():
for framenumber in range(len(self.serviceItem.get_frames())): for framenumber in range(len(self.serviceItem.get_frames())):
self.PreviewListWidget.setRowHeight(framenumber, height) self.PreviewListWidget.setRowHeight(
framenumber, width / self.ratio)
def trackSplitter(self, tab, pos):
"""
Splitter between the slide list and the preview panel
"""
pass
def onSongBarHandler(self): def onSongBarHandler(self):
request = unicode(self.sender().text()) request = unicode(self.sender().text())
@ -554,6 +545,8 @@ class SlideController(QtGui.QWidget):
if self.serviceItem.is_media(): if self.serviceItem.is_media():
self.onMediaClose() self.onMediaClose()
if self.isLive: if self.isLive:
if serviceItem.is_capable(ItemCapabilities.ProvidesOwnDisplay):
self._forceUnblank()
blanked = self.BlankScreen.isChecked() blanked = self.BlankScreen.isChecked()
else: else:
blanked = False blanked = False
@ -561,8 +554,6 @@ class SlideController(QtGui.QWidget):
[serviceItem, self.isLive, blanked, slideno]) [serviceItem, self.isLive, blanked, slideno])
self.slideList = {} self.slideList = {}
width = self.parent.ControlSplitter.sizes()[self.split] width = self.parent.ControlSplitter.sizes()[self.split]
# Set pointing cursor when we have something to point at
self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor)
self.serviceItem = serviceItem self.serviceItem = serviceItem
self.PreviewListWidget.clear() self.PreviewListWidget.clear()
self.PreviewListWidget.setRowCount(0) self.PreviewListWidget.setRowCount(0)
@ -691,7 +682,7 @@ class SlideController(QtGui.QWidget):
""" """
log.debug(u'mainDisplaySetBackground live = %s' % self.isLive) log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
if not self.display.primary: if not self.display.primary:
self.onHideDisplay(True) self.onBlankDisplay(True)
def onSlideBlank(self): def onSlideBlank(self):
""" """
@ -1034,3 +1025,23 @@ class SlideController(QtGui.QWidget):
self.video.hide() self.video.hide()
self.SlidePreview.clear() self.SlidePreview.clear()
self.SlidePreview.show() self.SlidePreview.show()
def _forceUnblank(self):
"""
Used by command items which provide their own displays to reset the
screen hide attributes
"""
if self.BlankScreen.isChecked:
self.BlankScreen.setChecked(False)
self.HideMenu.setDefaultAction(self.BlankScreen)
QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(False))
if self.ThemeScreen.isChecked:
self.ThemeScreen.setChecked(False)
self.HideMenu.setDefaultAction(self.ThemeScreen)
if self.screens.display_count > 1:
if self.DesktopScreen.isChecked:
self.DesktopScreen.setChecked(False)
self.HideMenu.setDefaultAction(self.DesktopScreen)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -55,4 +55,4 @@ class SplashScreen(object):
self.splash_screen.show() self.splash_screen.show()
def finish(self, widget): def finish(self, widget):
self.splash_screen.finish(widget) self.splash_screen.finish(widget)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -56,90 +56,70 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.registerFields() self.registerFields()
self.accepted = False self.accepted = False
self.updateThemeAllowed = True self.updateThemeAllowed = True
QtCore.QObject.connect(self.backgroundTypeComboBox, QtCore.QObject.connect(self.backgroundComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.onBackgroundComboBox) self.onBackgroundComboBoxCurrentIndexChanged)
QtCore.QObject.connect(self.gradientComboBox, QtCore.QObject.connect(self.gradientComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.onGradientComboBox) self.onGradientComboBoxCurrentIndexChanged)
QtCore.QObject.connect(self.colorButton, QtCore.QObject.connect(self.colorButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'clicked()'),
self.onColorButtonClicked) self.onColorButtonClicked)
QtCore.QObject.connect(self.gradientStartButton, QtCore.QObject.connect(self.gradientStartButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'clicked()'),
self.onGradientStartButtonClicked) self.onGradientStartButtonClicked)
QtCore.QObject.connect(self.gradientEndButton, QtCore.QObject.connect(self.gradientEndButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'clicked()'),
self.onGradientEndButtonClicked) self.onGradientEndButtonClicked)
QtCore.QObject.connect(self.imageBrowseButton, QtCore.QObject.connect(self.imageBrowseButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'clicked()'),
self.onImageBrowseButtonClicked) self.onImageBrowseButtonClicked)
QtCore.QObject.connect(self.mainColorPushButton, QtCore.QObject.connect(self.mainColorButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'clicked()'),
self.onMainColourPushButtonClicked) self.onMainColorButtonClicked)
QtCore.QObject.connect(self.outlineColorPushButton, QtCore.QObject.connect(self.outlineColorButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'clicked()'),
self.onOutlineColourPushButtonClicked) self.onOutlineColorButtonClicked)
QtCore.QObject.connect(self.shadowColorPushButton, QtCore.QObject.connect(self.shadowColorButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'clicked()'),
self.onShadowColourPushButtonClicked) self.onShadowColorButtonClicked)
QtCore.QObject.connect(self.outlineCheckBox, QtCore.QObject.connect(self.outlineCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onOutlineCheckCheckBoxChanged) self.onOutlineCheckCheckBoxStateChanged)
QtCore.QObject.connect(self.shadowCheckBox, QtCore.QObject.connect(self.shadowCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onShadowCheckCheckBoxChanged) self.onShadowCheckCheckBoxStateChanged)
QtCore.QObject.connect(self.footerColorPushButton, QtCore.QObject.connect(self.footerColorButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'clicked()'),
self.onFooterColourPushButtonClicked) self.onFooterColorButtonClicked)
QtCore.QObject.connect(self.mainDefaultPositionCheckBox, QtCore.QObject.connect(self.mainPositionCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onMainDefaultPositionCheckBox) self.onMainPositionCheckBoxStateChanged)
QtCore.QObject.connect(self.footerDefaultPositionCheckBox, QtCore.QObject.connect(self.footerPositionCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onFooterDefaultPositionCheckBox) self.onFooterPositionCheckBoxStateChanged)
QtCore.QObject.connect(self, QtCore.QObject.connect(self,
QtCore.SIGNAL(u'currentIdChanged(int)'), QtCore.SIGNAL(u'currentIdChanged(int)'),
self.pageChanged) self.onCurrentIdChanged)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_line_count'), QtCore.SIGNAL(u'theme_line_count'),
self.updateLinesText) self.updateLinesText)
QtCore.QObject.connect(self.mainSizeSpinBox, QtCore.QObject.connect(self.mainSizeSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), QtCore.SIGNAL(u'valueChanged(int)'),
self.calculateLines) self.calculateLines)
QtCore.QObject.connect(self.mainSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.calculateLines)
QtCore.QObject.connect(self.lineSpacingSpinBox, QtCore.QObject.connect(self.lineSpacingSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), QtCore.SIGNAL(u'valueChanged(int)'),
self.calculateLines) self.calculateLines)
QtCore.QObject.connect(self.lineSpacingSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.calculateLines)
QtCore.QObject.connect(self.outlineSizeSpinBox, QtCore.QObject.connect(self.outlineSizeSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), QtCore.SIGNAL(u'valueChanged(int)'),
self.calculateLines) self.calculateLines)
QtCore.QObject.connect(self.outlineSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.calculateLines)
QtCore.QObject.connect(self.shadowSizeSpinBox, QtCore.QObject.connect(self.shadowSizeSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), QtCore.SIGNAL(u'valueChanged(int)'),
self.calculateLines) self.calculateLines)
QtCore.QObject.connect(self.shadowSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.calculateLines)
QtCore.QObject.connect(self.mainFontComboBox, QtCore.QObject.connect(self.mainFontComboBox,
QtCore.SIGNAL(u'activated(int)'), QtCore.SIGNAL(u'activated(int)'),
self.calculateLines) self.calculateLines)
QtCore.QObject.connect(self, QtCore.SIGNAL(u'accepted()'), self.accept)
def pageChanged(self, pageId):
"""
Detects Page changes and updates as approprate.
"""
if pageId == 6:
self.updateTheme()
frame = self.thememanager.generateImage(self.theme)
self.previewBoxLabel.setPixmap(QtGui.QPixmap.fromImage(frame))
def setDefaults(self): def setDefaults(self):
""" """
@ -147,19 +127,19 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
""" """
self.restart() self.restart()
self.accepted = False self.accepted = False
self.setBackgroundTabValues() self.setBackgroundPageValues()
self.setMainAreaTabValues() self.setMainAreaPageValues()
self.setFooterAreaTabValues() self.setFooterAreaPageValues()
self.setAlignmentTabValues() self.setAlignmentPageValues()
self.setPositionTabValues() self.setPositionPageValues()
self.setPreviewTabValues() self.setPreviewPageValues()
def registerFields(self): def registerFields(self):
""" """
Map field names to screen names, Map field names to screen names,
""" """
self.backgroundPage.registerField( self.backgroundPage.registerField(
u'background_type', self.backgroundTypeComboBox) u'background_type', self.backgroundComboBox)
self.backgroundPage.registerField( self.backgroundPage.registerField(
u'color', self.colorButton) u'color', self.colorButton)
self.backgroundPage.registerField( self.backgroundPage.registerField(
@ -167,11 +147,11 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.backgroundPage.registerField( self.backgroundPage.registerField(
u'grandient_end', self.gradientEndButton) u'grandient_end', self.gradientEndButton)
self.backgroundPage.registerField( self.backgroundPage.registerField(
u'background_image', self.imageLineEdit) u'background_image', self.imageFileEdit)
self.backgroundPage.registerField( self.backgroundPage.registerField(
u'gradient', self.gradientComboBox) u'gradient', self.gradientComboBox)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
u'mainColorPushButton', self.mainColorPushButton) u'mainColorButton', self.mainColorButton)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
u'mainSizeSpinBox', self.mainSizeSpinBox) u'mainSizeSpinBox', self.mainSizeSpinBox)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
@ -179,17 +159,17 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
u'outlineCheckBox', self.outlineCheckBox) u'outlineCheckBox', self.outlineCheckBox)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
u'outlineColorPushButton', self.outlineColorPushButton) u'outlineColorButton', self.outlineColorButton)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
u'outlineSizeSpinBox', self.outlineSizeSpinBox) u'outlineSizeSpinBox', self.outlineSizeSpinBox)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
u'shadowCheckBox', self.shadowCheckBox) u'shadowCheckBox', self.shadowCheckBox)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
u'boldCheckBox', self.boldCheckBox) u'mainBoldCheckBox', self.mainBoldCheckBox)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
u'italicsCheckBox', self.italicsCheckBox) u'mainItalicsCheckBox', self.mainItalicsCheckBox)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
u'shadowColorPushButton', self.shadowColorPushButton) u'shadowColorButton', self.shadowColorButton)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
u'shadowSizeSpinBox', self.shadowSizeSpinBox) u'shadowSizeSpinBox', self.shadowSizeSpinBox)
self.mainAreaPage.registerField( self.mainAreaPage.registerField(
@ -224,7 +204,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
Calculate the number of lines on a page by rendering text Calculate the number of lines on a page by rendering text
""" """
# Do not trigger on start up # Do not trigger on start up
if self.page != 0: if self.currentPage != self.welcomePage:
self.updateTheme() self.updateTheme()
frame = self.thememanager.generateImage(self.theme, True) frame = self.thememanager.generateImage(self.theme, True)
@ -235,7 +215,37 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.mainLineCountLabel.setText(unicode(translate('OpenLP.ThemeForm', \ self.mainLineCountLabel.setText(unicode(translate('OpenLP.ThemeForm', \
'(%d lines per slide)' % int(lines)))) '(%d lines per slide)' % int(lines))))
def onOutlineCheckCheckBoxChanged(self, state): def resizeEvent(self, event=None):
"""
Rescale the theme preview thumbnail on resize events.
"""
if not event:
event = QtGui.QResizeEvent(self.size(), self.size())
QtGui.QWizard.resizeEvent(self, event)
if self.currentPage() == self.previewPage:
frameWidth = self.previewBoxLabel.lineWidth()
pixmapWidth = self.previewArea.width() - 2 * frameWidth
pixmapHeight = self.previewArea.height() - 2 * frameWidth
aspectRatio = float(pixmapWidth) / pixmapHeight
if aspectRatio < self.displayAspectRatio:
pixmapHeight = int(pixmapWidth / self.displayAspectRatio + 0.5)
else:
pixmapWidth = int(pixmapHeight * self.displayAspectRatio + 0.5)
self.previewBoxLabel.setFixedSize(pixmapWidth + 2 * frameWidth,
pixmapHeight + 2 * frameWidth)
def onCurrentIdChanged(self, pageId):
"""
Detects Page changes and updates as approprate.
"""
if self.page(pageId) == self.previewPage:
self.updateTheme()
frame = self.thememanager.generateImage(self.theme)
self.previewBoxLabel.setPixmap(QtGui.QPixmap.fromImage(frame))
self.displayAspectRatio = float(frame.width()) / frame.height()
self.resizeEvent()
def onOutlineCheckCheckBoxStateChanged(self, state):
""" """
Change state as Outline check box changed Change state as Outline check box changed
""" """
@ -243,11 +253,11 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.theme.font_main_outline = True self.theme.font_main_outline = True
else: else:
self.theme.font_main_outline = False self.theme.font_main_outline = False
self.outlineColorPushButton.setEnabled(self.theme.font_main_outline) self.outlineColorButton.setEnabled(self.theme.font_main_outline)
self.outlineSizeSpinBox.setEnabled(self.theme.font_main_outline) self.outlineSizeSpinBox.setEnabled(self.theme.font_main_outline)
self.calculateLines() self.calculateLines()
def onShadowCheckCheckBoxChanged(self, state): def onShadowCheckCheckBoxStateChanged(self, state):
""" """
Change state as Shadow check box changed Change state as Shadow check box changed
""" """
@ -255,35 +265,21 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.theme.font_main_shadow = True self.theme.font_main_shadow = True
else: else:
self.theme.font_main_shadow = False self.theme.font_main_shadow = False
self.shadowColorPushButton.setEnabled(self.theme.font_main_shadow) self.shadowColorButton.setEnabled(self.theme.font_main_shadow)
self.shadowSizeSpinBox.setEnabled(self.theme.font_main_shadow) self.shadowSizeSpinBox.setEnabled(self.theme.font_main_shadow)
self.calculateLines() self.calculateLines()
def onMainDefaultPositionCheckBox(self, value): def onMainPositionCheckBoxStateChanged(self, value):
""" """
Change state as Main Area Position check box changed Change state as Main Area Position check box changed
""" """
if value == QtCore.Qt.Checked: self.theme.font_main_override = (value == QtCore.Qt.Checked)
self.theme.font_main_override = False
else:
self.theme.font_main_override = True
self.mainXSpinBox.setEnabled(self.theme.font_main_override)
self.mainYSpinBox.setEnabled(self.theme.font_main_override)
self.mainHeightSpinBox.setEnabled(self.theme.font_main_override)
self.mainWidthSpinBox.setEnabled(self.theme.font_main_override)
def onFooterDefaultPositionCheckBox(self, value): def onFooterPositionCheckBoxStateChanged(self, value):
""" """
Change state as Footer Area Position check box changed Change state as Footer Area Position check box changed
""" """
if value == QtCore.Qt.Checked: self.theme.font_footer_override = (value == QtCore.Qt.Checked)
self.theme.font_footer_override = False
else:
self.theme.font_footer_override = True
self.footerXSpinBox.setEnabled(self.theme.font_footer_override)
self.footerYSpinBox.setEnabled(self.theme.font_footer_override)
self.footerHeightSpinBox.setEnabled(self.theme.font_footer_override)
self.footerWidthSpinBox.setEnabled(self.theme.font_footer_override)
def exec_(self, edit=False): def exec_(self, edit=False):
""" """
@ -293,8 +289,14 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.updateThemeAllowed = False self.updateThemeAllowed = False
self.setDefaults() self.setDefaults()
self.updateThemeAllowed = True self.updateThemeAllowed = True
self.themeNameLabel.setVisible(not edit)
self.themeNameEdit.setVisible(not edit)
if edit: if edit:
self.setWindowTitle(unicode(translate('OpenLP.ThemeWizard',
'Edit Theme %s')) % self.theme.theme_name)
self.next() self.next()
else:
self.setWindowTitle(translate('OpenLP.ThemeWizard', 'New Theme'))
return QtGui.QWizard.exec_(self) return QtGui.QWizard.exec_(self)
def initializePage(self, id): def initializePage(self, id):
@ -302,21 +304,21 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
Set up the pages for Initial run through dialog Set up the pages for Initial run through dialog
""" """
log.debug(u'initializePage %s' % id) log.debug(u'initializePage %s' % id)
self.page = id wizardPage = self.page(id)
if id == 1: if wizardPage == self.backgroundPage:
self.setBackgroundTabValues() self.setBackgroundPageValues()
elif id == 2: elif wizardPage == self.mainAreaPage:
self.setMainAreaTabValues() self.setMainAreaPageValues()
elif id == 3: elif wizardPage == self.footerAreaPage:
self.setFooterAreaTabValues() self.setFooterAreaPageValues()
elif id == 4: elif wizardPage == self.alignmentPage:
self.setAlignmentTabValues() self.setAlignmentPageValues()
elif id == 5: elif wizardPage == self.areaPositionPage:
self.setPositionTabValues() self.setPositionPageValues()
def setBackgroundTabValues(self): def setBackgroundPageValues(self):
""" """
Handle the display and State of the background display tab. Handle the display and state of the Background page.
""" """
if self.theme.background_type == \ if self.theme.background_type == \
BackgroundType.to_string(BackgroundType.Solid): BackgroundType.to_string(BackgroundType.Solid):
@ -331,7 +333,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.theme.background_end_color) self.theme.background_end_color)
self.setField(u'background_type', QtCore.QVariant(1)) self.setField(u'background_type', QtCore.QVariant(1))
else: else:
self.imageLineEdit.setText(self.theme.background_filename) self.imageFileEdit.setText(self.theme.background_filename)
self.setField(u'background_type', QtCore.QVariant(2)) self.setField(u'background_type', QtCore.QVariant(2))
if self.theme.background_direction == \ if self.theme.background_direction == \
BackgroundGradientType.to_string(BackgroundGradientType.Horizontal): BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
@ -348,122 +350,101 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
else: else:
self.setField(u'gradient', QtCore.QVariant(4)) self.setField(u'gradient', QtCore.QVariant(4))
def setMainAreaTabValues(self): def setMainAreaPageValues(self):
""" """
Handle the display and State of the Main Area tab. Handle the display and state of the Main Area page.
""" """
self.mainFontComboBox.setCurrentFont( self.mainFontComboBox.setCurrentFont(
QtGui.QFont(self.theme.font_main_name)) QtGui.QFont(self.theme.font_main_name))
self.mainColorPushButton.setStyleSheet(u'background-color: %s' % self.mainColorButton.setStyleSheet(u'background-color: %s' %
self.theme.font_main_color) self.theme.font_main_color)
self.setField(u'mainSizeSpinBox', \ self.setField(u'mainSizeSpinBox',
QtCore.QVariant(self.theme.font_main_size)) QtCore.QVariant(self.theme.font_main_size))
self.setField(u'lineSpacingSpinBox', \ self.setField(u'lineSpacingSpinBox',
QtCore.QVariant(self.theme.font_main_line_adjustment)) QtCore.QVariant(self.theme.font_main_line_adjustment))
self.setField(u'outlineCheckBox', \ self.setField(u'outlineCheckBox',
QtCore.QVariant(self.theme.font_main_outline)) QtCore.QVariant(self.theme.font_main_outline))
self.outlineColorPushButton.setStyleSheet(u'background-color: %s' % self.outlineColorButton.setStyleSheet(u'background-color: %s' %
self.theme.font_main_outline_color) self.theme.font_main_outline_color)
self.setField(u'outlineSizeSpinBox', \ self.setField(u'outlineSizeSpinBox',
QtCore.QVariant(self.theme.font_main_outline_size)) QtCore.QVariant(self.theme.font_main_outline_size))
self.setField(u'shadowCheckBox', \ self.setField(u'shadowCheckBox',
QtCore.QVariant(self.theme.font_main_shadow)) QtCore.QVariant(self.theme.font_main_shadow))
self.shadowColorPushButton.setStyleSheet(u'background-color: %s' % self.shadowColorButton.setStyleSheet(u'background-color: %s' %
self.theme.font_main_shadow_color) self.theme.font_main_shadow_color)
self.setField(u'shadowSizeSpinBox', \ self.setField(u'shadowSizeSpinBox',
QtCore.QVariant(self.theme.font_main_shadow_size)) QtCore.QVariant(self.theme.font_main_shadow_size))
self.setField(u'boldCheckBox', \ self.setField(u'mainBoldCheckBox',
QtCore.QVariant(self.theme.font_main_bold)) QtCore.QVariant(self.theme.font_main_bold))
self.setField(u'italicsCheckBox', \ self.setField(u'mainItalicsCheckBox',
QtCore.QVariant(self.theme.font_main_italics)) QtCore.QVariant(self.theme.font_main_italics))
# Set up field states
if self.theme.font_main_outline:
self.setField(u'outlineCheckBox', QtCore.QVariant(False))
else:
self.setField(u'outlineCheckBox', QtCore.QVariant(True))
self.outlineColorPushButton.setEnabled(self.theme.font_main_outline)
self.outlineSizeSpinBox.setEnabled(self.theme.font_main_outline)
if self.theme.font_main_shadow:
self.setField(u'shadowCheckBox', QtCore.QVariant(False))
else:
self.setField(u'shadowCheckBox', QtCore.QVariant(True))
self.shadowColorPushButton.setEnabled(self.theme.font_main_shadow)
self.shadowSizeSpinBox.setEnabled(self.theme.font_main_shadow)
def setFooterAreaTabValues(self): def setFooterAreaPageValues(self):
""" """
Handle the display and State of the Footer Area tab. Handle the display and state of the Footer Area page.
""" """
self.footerFontComboBox.setCurrentFont( self.footerFontComboBox.setCurrentFont(
QtGui.QFont(self.theme.font_main_name)) QtGui.QFont(self.theme.font_main_name))
self.footerColorPushButton.setStyleSheet(u'background-color: %s' % self.footerColorButton.setStyleSheet(u'background-color: %s' %
self.theme.font_footer_color) self.theme.font_footer_color)
self.setField(u'footerSizeSpinBox', \ self.setField(u'footerSizeSpinBox',
QtCore.QVariant(self.theme.font_footer_size)) QtCore.QVariant(self.theme.font_footer_size))
def setPositionTabValues(self): def setPositionPageValues(self):
""" """
Handle the display and State of the Position tab. Handle the display and state of the Position page.
""" """
# Main Area # Main Area
if self.theme.font_main_override: self.mainPositionCheckBox.setChecked(not self.theme.font_main_override)
self.mainDefaultPositionCheckBox.setChecked(False) self.setField(u'mainPositionX', QtCore.QVariant(self.theme.font_main_x))
else: self.setField(u'mainPositionY', QtCore.QVariant(self.theme.font_main_y))
self.mainDefaultPositionCheckBox.setChecked(True) self.setField(u'mainPositionHeight',
self.setField(u'mainPositionX', \
QtCore.QVariant(self.theme.font_main_x))
self.setField(u'mainPositionY', \
QtCore.QVariant(self.theme.font_main_y))
self.setField(u'mainPositionHeight', \
QtCore.QVariant(self.theme.font_main_height)) QtCore.QVariant(self.theme.font_main_height))
self.setField(u'mainPositionWidth', \ self.setField(u'mainPositionWidth',
QtCore.QVariant(self.theme.font_main_width)) QtCore.QVariant(self.theme.font_main_width))
# Footer # Footer
if self.theme.font_footer_override: self.footerPositionCheckBox.setChecked(
self.footerDefaultPositionCheckBox.setChecked(False) not self.theme.font_footer_override)
else: self.setField(u'footerPositionX',
self.footerDefaultPositionCheckBox.setChecked(True)
self.setField(u'footerPositionX', \
QtCore.QVariant(self.theme.font_footer_x)) QtCore.QVariant(self.theme.font_footer_x))
self.setField(u'footerPositionY', \ self.setField(u'footerPositionY',
QtCore.QVariant(self.theme.font_footer_y)) QtCore.QVariant(self.theme.font_footer_y))
self.setField(u'footerPositionHeight', \ self.setField(u'footerPositionHeight',
QtCore.QVariant(self.theme.font_footer_height)) QtCore.QVariant(self.theme.font_footer_height))
self.setField(u'footerPositionWidth', \ self.setField(u'footerPositionWidth',
QtCore.QVariant(self.theme.font_footer_width)) QtCore.QVariant(self.theme.font_footer_width))
def setAlignmentTabValues(self): def setAlignmentPageValues(self):
""" """
Define the Tab Alignments Page Handle the display and state of the Alignments page.
""" """
self.setField(u'horizontal', \ self.setField(u'horizontal',
QtCore.QVariant(self.theme.display_horizontal_align)) QtCore.QVariant(self.theme.display_horizontal_align))
self.setField(u'vertical', \ self.setField(u'vertical',
QtCore.QVariant(self.theme.display_vertical_align)) QtCore.QVariant(self.theme.display_vertical_align))
self.setField(u'slideTransition', \ self.setField(u'slideTransition',
QtCore.QVariant(self.theme.display_slide_transition)) QtCore.QVariant(self.theme.display_slide_transition))
def setPreviewTabValues(self): def setPreviewPageValues(self):
"""
Handle the display and state of the Preview page.
"""
self.setField(u'name', QtCore.QVariant(self.theme.theme_name)) self.setField(u'name', QtCore.QVariant(self.theme.theme_name))
if len(self.theme.theme_name) > 0:
self.themeNameEdit.setEnabled(False)
else:
self.themeNameEdit.setEnabled(True)
def onBackgroundComboBox(self, index): def onBackgroundComboBoxCurrentIndexChanged(self, index):
""" """
Background style Combo box has changed. Background style Combo box has changed.
""" """
self.theme.background_type = BackgroundType.to_string(index) self.theme.background_type = BackgroundType.to_string(index)
self.setBackgroundTabValues() self.setBackgroundPageValues()
def onGradientComboBox(self, index): def onGradientComboBoxCurrentIndexChanged(self, index):
""" """
Background gradient Combo box has changed. Background gradient Combo box has changed.
""" """
self.theme.background_direction = \ self.theme.background_direction = \
BackgroundGradientType.to_string(index) BackgroundGradientType.to_string(index)
self.setBackgroundTabValues() self.setBackgroundPageValues()
def onColorButtonClicked(self): def onColorButtonClicked(self):
""" """
@ -471,7 +452,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
""" """
self.theme.background_color = \ self.theme.background_color = \
self._colorButton(self.theme.background_color) self._colorButton(self.theme.background_color)
self.setBackgroundTabValues() self.setBackgroundPageValues()
def onGradientStartButtonClicked(self): def onGradientStartButtonClicked(self):
""" """
@ -479,7 +460,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
""" """
self.theme.background_start_color = \ self.theme.background_start_color = \
self._colorButton(self.theme.background_start_color) self._colorButton(self.theme.background_start_color)
self.setBackgroundTabValues() self.setBackgroundPageValues()
def onGradientEndButtonClicked(self): def onGradientEndButtonClicked(self):
""" """
@ -487,7 +468,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
""" """
self.theme.background_end_color = \ self.theme.background_end_color = \
self._colorButton(self.theme.background_end_color) self._colorButton(self.theme.background_end_color)
self.setBackgroundTabValues() self.setBackgroundPageValues()
def onImageBrowseButtonClicked(self): def onImageBrowseButtonClicked(self):
""" """
@ -501,27 +482,27 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
images_filter) images_filter)
if filename: if filename:
self.theme.background_filename = unicode(filename) self.theme.background_filename = unicode(filename)
self.setBackgroundTabValues() self.setBackgroundPageValues()
def onMainColourPushButtonClicked(self): def onMainColorButtonClicked(self):
self.theme.font_main_color = \ self.theme.font_main_color = \
self._colorButton(self.theme.font_main_color) self._colorButton(self.theme.font_main_color)
self.setMainAreaTabValues() self.setMainAreaPageValues()
def onOutlineColourPushButtonClicked(self): def onOutlineColorButtonClicked(self):
self.theme.font_main_outline_color = \ self.theme.font_main_outline_color = \
self._colorButton(self.theme.font_main_outline_color) self._colorButton(self.theme.font_main_outline_color)
self.setMainAreaTabValues() self.setMainAreaPageValues()
def onShadowColourPushButtonClicked(self): def onShadowColorButtonClicked(self):
self.theme.font_main_shadow_color = \ self.theme.font_main_shadow_color = \
self._colorButton(self.theme.font_main_shadow_color) self._colorButton(self.theme.font_main_shadow_color)
self.setMainAreaTabValues() self.setMainAreaPageValues()
def onFooterColourPushButtonClicked(self): def onFooterColorButtonClicked(self):
self.theme.font_footer_color = \ self.theme.font_footer_color = \
self._colorButton(self.theme.font_footer_color) self._colorButton(self.theme.font_footer_color)
self.setFooterAreaTabValues() self.setFooterAreaPageValues()
def updateTheme(self): def updateTheme(self):
""" """
@ -543,9 +524,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.theme.font_main_shadow_size = \ self.theme.font_main_shadow_size = \
self.field(u'shadowSizeSpinBox').toInt()[0] self.field(u'shadowSizeSpinBox').toInt()[0]
self.theme.font_main_bold = \ self.theme.font_main_bold = \
self.field(u'boldCheckBox').toBool() self.field(u'mainBoldCheckBox').toBool()
self.theme.font_main_italics = \ self.theme.font_main_italics = \
self.field(u'italicsCheckBox').toBool() self.field(u'mainItalicsCheckBox').toBool()
# footer page # footer page
self.theme.font_footer_name = \ self.theme.font_footer_name = \
unicode(self.footerFontComboBox.currentFont().family()) unicode(self.footerFontComboBox.currentFont().family())
@ -586,8 +567,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeForm', 'Theme Name Missing'), translate('OpenLP.ThemeForm', 'Theme Name Missing'),
translate('OpenLP.ThemeForm', translate('OpenLP.ThemeForm',
'There is no name for this theme. ' 'There is no name for this theme. Please enter one.'),
'Please enter one.'),
(QtGui.QMessageBox.Ok), (QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok) QtGui.QMessageBox.Ok)
return return
@ -595,8 +575,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeForm', 'Theme Name Invalid'), translate('OpenLP.ThemeForm', 'Theme Name Invalid'),
translate('OpenLP.ThemeForm', translate('OpenLP.ThemeForm',
'Invalid theme name. ' 'Invalid theme name. Please enter one.'),
'Please enter one.'),
(QtGui.QMessageBox.Ok), (QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok) QtGui.QMessageBox.Ok)
return return

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -35,7 +35,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.ui import FileRenameForm, ThemeForm from openlp.core.ui import FileRenameForm, ThemeForm
from openlp.core.theme import Theme from openlp.core.theme import Theme
from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \ from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
build_icon, Receiver, SettingsManager, translate, check_item_selected, \ build_icon, Receiver, SettingsManager, translate, check_item_selected, \
BackgroundType, BackgroundGradientType BackgroundType, BackgroundGradientType
from openlp.core.utils import AppLocation, get_filesystem_encoding from openlp.core.utils import AppLocation, get_filesystem_encoding
@ -223,14 +223,17 @@ class ThemeManager(QtGui.QWidget):
""" """
Renames an existing theme to a new name Renames an existing theme to a new name
""" """
action = unicode(translate('OpenLP.ThemeManager', 'Rename')) if self._validate_theme_action(unicode(translate('OpenLP.ThemeManager',
if self._validate_theme_action(action, False): 'You must select a theme to rename.')),
unicode(translate('OpenLP.ThemeManager', 'Rename Confirmation')),
unicode(translate('OpenLP.ThemeManager', 'Rename %s theme?')),
False):
item = self.themeListWidget.currentItem() item = self.themeListWidget.currentItem()
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString()) oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
self.fileRenameForm.fileNameEdit.setText(oldThemeName) self.fileRenameForm.fileNameEdit.setText(oldThemeName)
self.saveThemeName = oldThemeName self.saveThemeName = oldThemeName
if self.fileRenameForm.exec_(): if self.fileRenameForm.exec_():
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text()) newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
oldThemeData = self.getThemeData(oldThemeName) oldThemeData = self.getThemeData(oldThemeName)
self.deleteTheme(oldThemeName) self.deleteTheme(oldThemeName)
self.cloneThemeData(oldThemeData, newThemeName) self.cloneThemeData(oldThemeData, newThemeName)
@ -244,7 +247,7 @@ class ThemeManager(QtGui.QWidget):
self.fileRenameForm.fileNameEdit.setText(oldThemeName) self.fileRenameForm.fileNameEdit.setText(oldThemeName)
self.saveThemeName = u'' self.saveThemeName = u''
if self.fileRenameForm.exec_(True): if self.fileRenameForm.exec_(True):
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text()) newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
themeData = self.getThemeData(oldThemeName) themeData = self.getThemeData(oldThemeName)
self.cloneThemeData(themeData, newThemeName) self.cloneThemeData(themeData, newThemeName)
self.loadThemes() self.loadThemes()
@ -288,8 +291,10 @@ class ThemeManager(QtGui.QWidget):
""" """
Delete a theme Delete a theme
""" """
action = unicode(translate('OpenLP.ThemeManager', 'Delete')) if self._validate_theme_action(unicode(translate('OpenLP.ThemeManager',
if self._validate_theme_action(action): 'You must select a theme to delete.')),
unicode(translate('OpenLP.ThemeManager', 'Delete Confirmation')),
unicode(translate('OpenLP.ThemeManager', 'Delete %s theme?'))):
item = self.themeListWidget.currentItem() item = self.themeListWidget.currentItem()
theme = unicode(item.text()) theme = unicode(item.text())
row = self.themeListWidget.row(item) row = self.themeListWidget.row(item)
@ -331,7 +336,7 @@ class ThemeManager(QtGui.QWidget):
theme = unicode(item.data(QtCore.Qt.UserRole).toString()) theme = unicode(item.data(QtCore.Qt.UserRole).toString())
path = QtGui.QFileDialog.getExistingDirectory(self, path = QtGui.QFileDialog.getExistingDirectory(self,
unicode(translate('OpenLP.ThemeManager', unicode(translate('OpenLP.ThemeManager',
'Save Theme - (%s)')) % theme, 'Save Theme - (%s)')) % theme,
SettingsManager.get_last_dir(self.settingsSection, 1)) SettingsManager.get_last_dir(self.settingsSection, 1))
path = unicode(path) path = unicode(path)
if path: if path:
@ -750,7 +755,8 @@ class ThemeManager(QtGui.QWidget):
theme.extend_image_filename(path) theme.extend_image_filename(path)
return theme return theme
def _validate_theme_action(self, action, testPlugin=True): def _validate_theme_action(self, select_text, confirm_title, confirm_text,
testPlugin=True):
""" """
Check to see if theme has been selected and the destructive action Check to see if theme has been selected and the destructive action
is allowed. is allowed.
@ -758,19 +764,14 @@ class ThemeManager(QtGui.QWidget):
self.global_theme = unicode(QtCore.QSettings().value( self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme', self.settingsSection + u'/global theme',
QtCore.QVariant(u'')).toString()) QtCore.QVariant(u'')).toString())
if check_item_selected(self.themeListWidget, if check_item_selected(self.themeListWidget, select_text):
unicode(translate('OpenLP.ThemeManager',
'You must select a theme to %s.')) % action):
item = self.themeListWidget.currentItem() item = self.themeListWidget.currentItem()
theme = unicode(item.text()) theme = unicode(item.text())
# confirm deletion # confirm deletion
answer = QtGui.QMessageBox.question(self, answer = QtGui.QMessageBox.question(self, confirm_title,
unicode(translate('OpenLP.ThemeManager', '%s Confirmation')) confirm_text % theme, QtGui.QMessageBox.StandardButtons(
% action, QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
unicode(translate('OpenLP.ThemeManager', '%s %s theme?')) QtGui.QMessageBox.No)
% (action, theme),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No), QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No: if answer == QtGui.QMessageBox.No:
return False return False
# should be the same unless default # should be the same unless default
@ -779,6 +780,7 @@ class ThemeManager(QtGui.QWidget):
translate('OpenLP.ThemeManager', 'Error'), translate('OpenLP.ThemeManager', 'Error'),
translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',
'You are unable to delete the default theme.')) 'You are unable to delete the default theme.'))
return False
else: else:
if testPlugin: if testPlugin:
for plugin in self.parent.pluginManager.plugins: for plugin in self.parent.pluginManager.plugins:

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -212,4 +212,4 @@ class ThemesTab(SettingsTab):
if not preview.isNull(): if not preview.isNull():
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation) QtCore.Qt.SmoothTransformation)
self.DefaultListView.setPixmap(preview) self.DefaultListView.setPixmap(preview)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -31,592 +31,393 @@ from openlp.core.lib import translate, build_icon
class Ui_ThemeWizard(object): class Ui_ThemeWizard(object):
def setupUi(self, ThemeWizard): def setupUi(self, ThemeWizard):
ThemeWizard.setObjectName(u'OpenLP.ThemeWizard') ThemeWizard.setObjectName(u'OpenLP.ThemeWizard')
ThemeWizard.resize(550, 386)
ThemeWizard.setModal(True) ThemeWizard.setModal(True)
ThemeWizard.setWizardStyle(QtGui.QWizard.ModernStyle) ThemeWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
ThemeWizard.setOptions( ThemeWizard.setOptions(
QtGui.QWizard.IndependentPages | QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage) QtGui.QWizard.NoBackButtonOnStartPage)
# Welcome Page
self.welcomePage = QtGui.QWizardPage() self.welcomePage = QtGui.QWizardPage()
self.welcomePage.setTitle(u'')
self.welcomePage.setSubTitle(u'')
self.welcomePage.setObjectName(u'welcomePage')
self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
QtGui.QPixmap(u':/wizards/wizard_createtheme.bmp')) QtGui.QPixmap(u':/wizards/wizard_createtheme.bmp'))
self.welcomeLayout = QtGui.QHBoxLayout(self.welcomePage) self.welcomePage.setObjectName(u'WelcomePage')
self.welcomeLayout.setSpacing(8) self.welcomeLayout = QtGui.QVBoxLayout(self.welcomePage)
self.welcomeLayout.setMargin(0) self.welcomeLayout.setObjectName(u'WelcomeLayout')
self.welcomeLayout.setObjectName(u'welcomeLayout')
self.welcomePageLayout = QtGui.QVBoxLayout()
self.welcomePageLayout.setSpacing(8)
self.welcomePageLayout.setObjectName(u'welcomePageLayout')
self.titleLabel = QtGui.QLabel(self.welcomePage) self.titleLabel = QtGui.QLabel(self.welcomePage)
self.titleLabel.setObjectName(u'titleLabel') self.titleLabel.setObjectName(u'TitleLabel')
self.welcomePageLayout.addWidget(self.titleLabel) self.welcomeLayout.addWidget(self.titleLabel)
self.welcomeTopSpacer = QtGui.QSpacerItem(20, 40, self.welcomeLayout.addSpacing(40)
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
self.welcomePageLayout.addItem(self.welcomeTopSpacer)
self.informationLabel = QtGui.QLabel(self.welcomePage) self.informationLabel = QtGui.QLabel(self.welcomePage)
self.informationLabel.setWordWrap(True) self.informationLabel.setWordWrap(True)
self.informationLabel.setMargin(10) self.informationLabel.setObjectName(u'InformationLabel')
self.informationLabel.setObjectName(u'informationLabel') self.welcomeLayout.addWidget(self.informationLabel)
self.welcomePageLayout.addWidget(self.informationLabel) self.welcomeLayout.addStretch()
self.welcomeBottomSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.welcomePageLayout.addItem(self.welcomeBottomSpacer)
self.welcomeLayout.addLayout(self.welcomePageLayout)
ThemeWizard.addPage(self.welcomePage) ThemeWizard.addPage(self.welcomePage)
# Background Page
self.backgroundPage = QtGui.QWizardPage() self.backgroundPage = QtGui.QWizardPage()
self.backgroundPage.setObjectName(u'backgroundPage') self.backgroundPage.setObjectName(u'BackgroundPage')
self.backgroundLayout = QtGui.QVBoxLayout(self.backgroundPage) self.backgroundLayout = QtGui.QVBoxLayout(self.backgroundPage)
self.backgroundLayout.setSpacing(8) self.backgroundLayout.setObjectName(u'BackgroundLayout')
self.backgroundLayout.setMargin(20) self.backgroundTypeLayout = QtGui.QFormLayout()
self.backgroundLayout.setObjectName(u'backgroundLayout') self.backgroundTypeLayout.setObjectName(u'BackgroundTypeLayout')
self.backgroundTypeLayout = QtGui.QHBoxLayout() self.backgroundLabel = QtGui.QLabel(self.backgroundPage)
self.backgroundTypeLayout.setSpacing(8) self.backgroundLabel.setObjectName(u'BackgroundLabel')
self.backgroundTypeLayout.setObjectName(u'backgroundTypeLayout') self.backgroundComboBox = QtGui.QComboBox(self.backgroundPage)
self.backgroundTypeLabel = QtGui.QLabel(self.backgroundPage) self.backgroundComboBox.addItems([u'', u'', u''])
self.backgroundTypeLabel.setObjectName(u'backgroundTypeLabel') self.backgroundComboBox.setObjectName(u'BackgroundComboBox')
self.backgroundTypeLayout.addWidget(self.backgroundTypeLabel) self.backgroundTypeLayout.addRow(self.backgroundLabel,
self.backgroundTypeComboBox = QtGui.QComboBox(self.backgroundPage) self.backgroundComboBox)
self.backgroundTypeComboBox.setObjectName(u'backgroundTypeComboBox') self.backgroundTypeSpacer = QtGui.QSpacerItem(10, 0,
self.backgroundTypeComboBox.addItem(u'') QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
self.backgroundTypeComboBox.addItem(u'') self.backgroundTypeLayout.setItem(1, QtGui.QFormLayout.LabelRole,
self.backgroundTypeComboBox.addItem(u'') self.backgroundTypeSpacer)
self.backgroundTypeLayout.addWidget(self.backgroundTypeComboBox)
self.backgroundTypeSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.backgroundTypeLayout.addItem(self.backgroundTypeSpacer)
self.backgroundLayout.addLayout(self.backgroundTypeLayout) self.backgroundLayout.addLayout(self.backgroundTypeLayout)
self.backgroundStackedWidget = QtGui.QStackedWidget( self.backgroundStack = QtGui.QStackedLayout()
self.backgroundPage) self.backgroundStack.setObjectName(u'BackgroundStack')
self.backgroundStackedWidget.setObjectName(u'backgroundStackedWidget') self.colorWidget = QtGui.QWidget(self.backgroundPage)
self.colorPage = QtGui.QWidget() self.colorWidget.setObjectName(u'ColorWidget')
self.colorPage.setObjectName(u'colorPage') self.colorLayout = QtGui.QFormLayout(self.colorWidget)
self.colorLayout = QtGui.QFormLayout(self.colorPage)
self.colorLayout.setMargin(0) self.colorLayout.setMargin(0)
self.colorLayout.setSpacing(8) self.colorLayout.setObjectName(u'ColorLayout')
self.colorLayout.setObjectName(u'colorLayout') self.colorLabel = QtGui.QLabel(self.colorWidget)
self.colorLabel = QtGui.QLabel(self.colorPage) self.colorLabel.setObjectName(u'ColorLabel')
self.colorLabel.setMinimumSize(QtCore.QSize(103, 0)) self.colorButton = QtGui.QPushButton(self.colorWidget)
self.colorLabel.setAlignment(QtCore.Qt.AlignRight | self.colorButton.setObjectName(u'ColorButton')
QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.colorLayout.addRow(self.colorLabel, self.colorButton)
self.colorLabel.setObjectName(u'colorLabel') self.colorSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
self.colorLayout.setWidget(0, QtGui.QSizePolicy.Minimum)
QtGui.QFormLayout.LabelRole, self.colorLabel) self.colorLayout.setItem(1, QtGui.QFormLayout.LabelRole,
self.colorButton = QtGui.QPushButton(self.colorPage) self.colorSpacer)
self.colorButton.setText(u'') self.backgroundStack.addWidget(self.colorWidget)
self.colorButton.setObjectName(u'colorButton') self.gradientWidget = QtGui.QWidget(self.backgroundPage)
self.colorLayout.setWidget(0, self.gradientWidget.setObjectName(u'GradientWidget')
QtGui.QFormLayout.FieldRole, self.colorButton) self.gradientLayout = QtGui.QFormLayout(self.gradientWidget)
self.backgroundStackedWidget.addWidget(self.colorPage)
self.gradientPage = QtGui.QWidget()
self.gradientPage.setObjectName(u'gradientPage')
self.gradientLayout = QtGui.QFormLayout(self.gradientPage)
self.gradientLayout.setMargin(0) self.gradientLayout.setMargin(0)
self.gradientLayout.setSpacing(8) self.gradientLayout.setObjectName(u'GradientLayout')
self.gradientLayout.setObjectName(u'gradientLayout') self.gradientStartLabel = QtGui.QLabel(self.gradientWidget)
self.gradientStartLabel = QtGui.QLabel(self.gradientPage) self.gradientStartLabel.setObjectName(u'GradientStartLabel')
self.gradientStartLabel.setMinimumSize(QtCore.QSize(103, 0)) self.gradientStartButton = QtGui.QPushButton(self.gradientWidget)
self.gradientStartLabel.setAlignment(QtCore.Qt.AlignRight | self.gradientStartButton.setObjectName(u'GradientStartButton')
QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.gradientLayout.addRow(self.gradientStartLabel,
self.gradientStartLabel.setObjectName(u'gradientStartLabel') self.gradientStartButton)
self.gradientLayout.setWidget(0, self.gradientEndLabel = QtGui.QLabel(self.gradientWidget)
QtGui.QFormLayout.LabelRole, self.gradientStartLabel) self.gradientEndLabel.setObjectName(u'GradientEndLabel')
self.gradientStartButton = QtGui.QPushButton(self.gradientPage) self.gradientEndButton = QtGui.QPushButton(self.gradientWidget)
self.gradientStartButton.setText(u'') self.gradientEndButton.setObjectName(u'GradientEndButton')
self.gradientStartButton.setObjectName(u'gradientStartButton') self.gradientLayout.addRow(self.gradientEndLabel,
self.gradientLayout.setWidget(0, self.gradientEndButton)
QtGui.QFormLayout.FieldRole, self.gradientStartButton) self.gradientTypeLabel = QtGui.QLabel(self.gradientWidget)
self.gradientEndLabel = QtGui.QLabel(self.gradientPage) self.gradientTypeLabel.setObjectName(u'GradientTypeLabel')
self.gradientEndLabel.setMinimumSize(QtCore.QSize(103, 0)) self.gradientComboBox = QtGui.QComboBox(self.gradientWidget)
self.gradientEndLabel.setAlignment(QtCore.Qt.AlignRight | self.gradientComboBox.setObjectName(u'GradientComboBox')
QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.gradientComboBox.addItems([u'', u'', u'', u'', u''])
self.gradientEndLabel.setObjectName(u'gradientEndLabel') self.gradientLayout.addRow(self.gradientTypeLabel,
self.gradientLayout.setWidget(1, self.gradientComboBox)
QtGui.QFormLayout.LabelRole, self.gradientEndLabel) self.gradientSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
self.gradientEndButton = QtGui.QPushButton(self.gradientPage) QtGui.QSizePolicy.Minimum)
self.gradientEndButton.setText(u'') self.gradientLayout.setItem(3, QtGui.QFormLayout.LabelRole,
self.gradientEndButton.setObjectName(u'gradientEndButton') self.gradientSpacer)
self.gradientLayout.setWidget(1, self.backgroundStack.addWidget(self.gradientWidget)
QtGui.QFormLayout.FieldRole, self.gradientEndButton) self.imageWidget = QtGui.QWidget(self.backgroundPage)
self.gradientTypeLabel = QtGui.QLabel(self.gradientPage) self.imageWidget.setObjectName(u'ImageWidget')
self.gradientTypeLabel.setMinimumSize(QtCore.QSize(103, 0)) self.imageLayout = QtGui.QFormLayout(self.imageWidget)
self.gradientTypeLabel.setAlignment(QtCore.Qt.AlignRight |
QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.gradientTypeLabel.setObjectName(u'gradientTypeLabel')
self.gradientLayout.setWidget(2,
QtGui.QFormLayout.LabelRole, self.gradientTypeLabel)
self.gradientComboBox = QtGui.QComboBox(self.gradientPage)
self.gradientComboBox.setObjectName(u'gradientComboBox')
self.gradientComboBox.addItem(u'')
self.gradientComboBox.addItem(u'')
self.gradientComboBox.addItem(u'')
self.gradientComboBox.addItem(u'')
self.gradientComboBox.addItem(u'')
self.gradientLayout.setWidget(2,
QtGui.QFormLayout.FieldRole, self.gradientComboBox)
self.backgroundStackedWidget.addWidget(self.gradientPage)
self.imagePage = QtGui.QWidget()
self.imagePage.setObjectName(u'imagePage')
self.imageLayout = QtGui.QFormLayout(self.imagePage)
self.imageLayout.setMargin(0) self.imageLayout.setMargin(0)
self.imageLayout.setSpacing(8) self.imageLayout.setObjectName(u'ImageLayout')
self.imageLayout.setObjectName(u'imageLayout') self.imageLabel = QtGui.QLabel(self.imageWidget)
self.imageLabel = QtGui.QLabel(self.imagePage) self.imageLabel.setObjectName(u'ImageLabel')
self.imageLabel.setMinimumSize(QtCore.QSize(103, 0))
self.imageLabel.setAlignment(QtCore.Qt.AlignRight |
QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.imageLabel.setObjectName(u'imageLabel')
self.imageLayout.setWidget(0,
QtGui.QFormLayout.LabelRole, self.imageLabel)
self.imageFileLayout = QtGui.QHBoxLayout() self.imageFileLayout = QtGui.QHBoxLayout()
self.imageFileLayout.setSpacing(8) self.imageFileLayout.setObjectName(u'ImageFileLayout')
self.imageFileLayout.setObjectName(u'imageFileLayout') self.imageFileEdit = QtGui.QLineEdit(self.imageWidget)
self.imageLineEdit = QtGui.QLineEdit(self.imagePage) self.imageFileEdit.setObjectName(u'ImageFileEdit')
self.imageLineEdit.setObjectName(u'imageLineEdit') self.imageFileLayout.addWidget(self.imageFileEdit)
self.imageFileLayout.addWidget(self.imageLineEdit) self.imageBrowseButton = QtGui.QToolButton(self.imageWidget)
self.imageBrowseButton = QtGui.QToolButton(self.imagePage) self.imageBrowseButton.setObjectName(u'ImageBrowseButton')
self.imageBrowseButton.setText(u'')
self.imageBrowseButton.setIcon( self.imageBrowseButton.setIcon(
build_icon(u':/general/general_open.png')) build_icon(u':/general/general_open.png'))
self.imageBrowseButton.setObjectName(u'imageBrowseButton')
self.imageFileLayout.addWidget(self.imageBrowseButton) self.imageFileLayout.addWidget(self.imageBrowseButton)
self.imageLayout.setLayout(0, self.imageLayout.addRow(self.imageLabel, self.imageFileLayout)
QtGui.QFormLayout.FieldRole, self.imageFileLayout) self.imageSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
self.backgroundStackedWidget.addWidget(self.imagePage) QtGui.QSizePolicy.Minimum)
self.backgroundLayout.addWidget(self.backgroundStackedWidget) self.imageLayout.setItem(1, QtGui.QFormLayout.LabelRole,
self.imageSpacer)
self.backgroundStack.addWidget(self.imageWidget)
self.backgroundLayout.addLayout(self.backgroundStack)
ThemeWizard.addPage(self.backgroundPage) ThemeWizard.addPage(self.backgroundPage)
# Main Area Page
self.mainAreaPage = QtGui.QWizardPage() self.mainAreaPage = QtGui.QWizardPage()
self.mainAreaPage.setObjectName(u'mainAreaPage') self.mainAreaPage.setObjectName(u'MainAreaPage')
self.mainAreaLayout = QtGui.QFormLayout(self.mainAreaPage) self.mainAreaLayout = QtGui.QFormLayout(self.mainAreaPage)
self.mainAreaLayout.setFormAlignment(QtCore.Qt.AlignLeading | self.mainAreaLayout.setObjectName(u'MainAreaLayout')
QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.mainAreaLayout.setMargin(20)
self.mainAreaLayout.setSpacing(8)
self.mainAreaLayout.setObjectName(u'mainAreaLayout')
self.mainFontLabel = QtGui.QLabel(self.mainAreaPage) self.mainFontLabel = QtGui.QLabel(self.mainAreaPage)
self.mainFontLabel.setMinimumSize(QtCore.QSize(103, 0)) self.mainFontLabel.setObjectName(u'MainFontLabel')
self.mainFontLabel.setAlignment(QtCore.Qt.AlignRight |
QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.mainFontLabel.setObjectName(u'mainFontLabel')
self.mainAreaLayout.setWidget(0,
QtGui.QFormLayout.LabelRole, self.mainFontLabel)
self.mainFontComboBox = QtGui.QFontComboBox(self.mainAreaPage) self.mainFontComboBox = QtGui.QFontComboBox(self.mainAreaPage)
self.mainFontComboBox.setObjectName(u'mainFontComboBox') self.mainFontComboBox.setObjectName(u'MainFontComboBox')
self.mainAreaLayout.setWidget(0, self.mainAreaLayout.addRow(self.mainFontLabel, self.mainFontComboBox)
QtGui.QFormLayout.FieldRole, self.mainFontComboBox)
self.mainColorLabel = QtGui.QLabel(self.mainAreaPage) self.mainColorLabel = QtGui.QLabel(self.mainAreaPage)
self.mainColorLabel.setObjectName(u'mainColorLabel') self.mainColorLabel.setObjectName(u'MainColorLabel')
self.mainAreaLayout.setWidget(1, self.mainPropertiesLayout = QtGui.QHBoxLayout()
QtGui.QFormLayout.LabelRole, self.mainColorLabel) self.mainPropertiesLayout.setObjectName(u'MainPropertiesLayout')
self.fontPropertiesLayout = QtGui.QHBoxLayout() self.mainColorButton = QtGui.QPushButton(self.mainAreaPage)
self.fontPropertiesLayout.setSpacing(24) self.mainColorButton.setObjectName(u'MainColorButton')
self.fontPropertiesLayout.setObjectName(u'fontPropertiesLayout') self.mainPropertiesLayout.addWidget(self.mainColorButton)
self.mainColorPushButton = QtGui.QPushButton(self.mainAreaPage) self.mainPropertiesLayout.addSpacing(20)
self.mainColorPushButton.setText(u'') self.mainBoldCheckBox = QtGui.QCheckBox(self.mainAreaPage)
self.mainColorPushButton.setObjectName(u'mainColorPushButton') self.mainBoldCheckBox.setObjectName(u'MainBoldCheckBox')
self.fontPropertiesLayout.addWidget(self.mainColorPushButton) self.mainPropertiesLayout.addWidget(self.mainBoldCheckBox)
self.boldCheckBox = QtGui.QCheckBox(self.mainAreaPage) self.mainPropertiesLayout.addSpacing(20)
self.boldCheckBox.setObjectName(u'boldCheckBox') self.mainItalicsCheckBox = QtGui.QCheckBox(self.mainAreaPage)
self.fontPropertiesLayout.addWidget(self.boldCheckBox) self.mainItalicsCheckBox.setObjectName(u'MainItalicsCheckBox')
self.italicsCheckBox = QtGui.QCheckBox(self.mainAreaPage) self.mainPropertiesLayout.addWidget(self.mainItalicsCheckBox)
self.italicsCheckBox.setObjectName(u'italicsCheckBox') self.mainAreaLayout.addRow(self.mainColorLabel,
self.fontPropertiesLayout.addWidget(self.italicsCheckBox) self.mainPropertiesLayout)
self.mainAreaLayout.setLayout(1,
QtGui.QFormLayout.FieldRole, self.fontPropertiesLayout)
self.mainSizeLabel = QtGui.QLabel(self.mainAreaPage) self.mainSizeLabel = QtGui.QLabel(self.mainAreaPage)
self.mainSizeLabel.setObjectName(u'mainSizeLabel') self.mainSizeLabel.setObjectName(u'MainSizeLabel')
self.mainAreaLayout.setWidget(2,
QtGui.QFormLayout.LabelRole, self.mainSizeLabel)
self.mainSizeLayout = QtGui.QHBoxLayout() self.mainSizeLayout = QtGui.QHBoxLayout()
self.mainSizeLayout.setSpacing(8) self.mainSizeLayout.setObjectName(u'MainSizeLayout')
self.mainSizeLayout.setMargin(0)
self.mainSizeLayout.setObjectName(u'mainSizeLayout')
self.mainSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage) self.mainSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.mainSizeSpinBox.sizePolicy().hasHeightForWidth())
self.mainSizeSpinBox.setSizePolicy(sizePolicy)
self.mainSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0))
self.mainSizeSpinBox.setMaximum(999) self.mainSizeSpinBox.setMaximum(999)
self.mainSizeSpinBox.setProperty(u'value', 16) self.mainSizeSpinBox.setValue(16)
self.mainSizeSpinBox.setObjectName(u'mainSizeSpinBox') self.mainSizeSpinBox.setObjectName(u'MainSizeSpinBox')
self.mainSizeLayout.addWidget(self.mainSizeSpinBox) self.mainSizeLayout.addWidget(self.mainSizeSpinBox)
self.mainLineCountLabel = QtGui.QLabel(self.mainAreaPage) self.mainLineCountLabel = QtGui.QLabel(self.mainAreaPage)
self.mainLineCountLabel.setObjectName(u'mainLineCountLabel') self.mainLineCountLabel.setObjectName(u'MainLineCountLabel')
self.mainSizeLayout.addWidget(self.mainLineCountLabel) self.mainSizeLayout.addWidget(self.mainLineCountLabel)
self.mainAreaLayout.setLayout(2, self.mainAreaLayout.addRow(self.mainSizeLabel, self.mainSizeLayout)
QtGui.QFormLayout.FieldRole, self.mainSizeLayout)
self.lineSpacingLabel = QtGui.QLabel(self.mainAreaPage) self.lineSpacingLabel = QtGui.QLabel(self.mainAreaPage)
self.lineSpacingLabel.setObjectName(u'lineSpacingLabel') self.lineSpacingLabel.setObjectName(u'LineSpacingLabel')
self.mainAreaLayout.setWidget(3,
QtGui.QFormLayout.LabelRole, self.lineSpacingLabel)
self.lineSpacingSpinBox = QtGui.QSpinBox(self.mainAreaPage) self.lineSpacingSpinBox = QtGui.QSpinBox(self.mainAreaPage)
self.lineSpacingSpinBox.setMinimum(-50) self.lineSpacingSpinBox.setMinimum(-50)
self.lineSpacingSpinBox.setMaximum(50) self.lineSpacingSpinBox.setMaximum(50)
self.lineSpacingSpinBox.setObjectName(u'lineSpacingSpinBox') self.lineSpacingSpinBox.setObjectName(u'LineSpacingSpinBox')
self.mainAreaLayout.setWidget(3, self.mainAreaLayout.addRow(self.lineSpacingLabel,
QtGui.QFormLayout.FieldRole, self.lineSpacingSpinBox) self.lineSpacingSpinBox)
self.outlineCheckBox = QtGui.QCheckBox(self.mainAreaPage) self.outlineCheckBox = QtGui.QCheckBox(self.mainAreaPage)
self.outlineCheckBox.setObjectName(u'outlineCheckBox') self.outlineCheckBox.setObjectName(u'OutlineCheckBox')
self.mainAreaLayout.setWidget(4,
QtGui.QFormLayout.LabelRole, self.outlineCheckBox)
self.outlineLayout = QtGui.QHBoxLayout() self.outlineLayout = QtGui.QHBoxLayout()
self.outlineLayout.setObjectName(u'outlineLayout') self.outlineLayout.setObjectName(u'OutlineLayout')
self.outlineColorPushButton = QtGui.QPushButton(self.mainAreaPage) self.outlineColorButton = QtGui.QPushButton(self.mainAreaPage)
self.outlineColorPushButton.setEnabled(True) self.outlineColorButton.setEnabled(False)
self.outlineColorPushButton.setText(u'') self.outlineColorButton.setObjectName(u'OutlineColorButton')
self.outlineColorPushButton.setObjectName(u'outlineColorPushButton') self.outlineLayout.addWidget(self.outlineColorButton)
self.outlineLayout.addWidget(self.outlineColorPushButton) self.outlineLayout.addSpacing(20)
self.outlineSizeLabel = QtGui.QLabel(self.mainAreaPage) self.outlineSizeLabel = QtGui.QLabel(self.mainAreaPage)
self.outlineSizeLabel.setObjectName(u'outlineSizeLabel') self.outlineSizeLabel.setObjectName(u'OutlineSizeLabel')
self.outlineLayout.addWidget(self.outlineSizeLabel) self.outlineLayout.addWidget(self.outlineSizeLabel)
self.outlineSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage) self.outlineSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage)
self.outlineSizeSpinBox.setObjectName(u'outlineSizeSpinBox') self.outlineSizeSpinBox.setEnabled(False)
self.outlineSizeSpinBox.setObjectName(u'OutlineSizeSpinBox')
self.outlineLayout.addWidget(self.outlineSizeSpinBox) self.outlineLayout.addWidget(self.outlineSizeSpinBox)
self.mainAreaLayout.setLayout(4, self.mainAreaLayout.addRow(self.outlineCheckBox, self.outlineLayout)
QtGui.QFormLayout.FieldRole, self.outlineLayout)
self.shadowCheckBox = QtGui.QCheckBox(self.mainAreaPage) self.shadowCheckBox = QtGui.QCheckBox(self.mainAreaPage)
self.shadowCheckBox.setObjectName(u'shadowCheckBox') self.shadowCheckBox.setObjectName(u'ShadowCheckBox')
self.mainAreaLayout.setWidget(5,
QtGui.QFormLayout.LabelRole, self.shadowCheckBox)
self.shadowLayout = QtGui.QHBoxLayout() self.shadowLayout = QtGui.QHBoxLayout()
self.shadowLayout.setObjectName(u'shadowLayout') self.shadowLayout.setObjectName(u'ShadowLayout')
self.shadowColorPushButton = QtGui.QPushButton(self.mainAreaPage) self.shadowColorButton = QtGui.QPushButton(self.mainAreaPage)
self.shadowColorPushButton.setEnabled(True) self.shadowColorButton.setEnabled(False)
self.shadowColorPushButton.setText(u'') self.shadowColorButton.setObjectName(u'shadowColorButton')
self.shadowColorPushButton.setObjectName(u'shadowColorPushButton') self.shadowLayout.addWidget(self.shadowColorButton)
self.shadowLayout.addWidget(self.shadowColorPushButton) self.shadowLayout.addSpacing(20)
self.shadowSizeLabel = QtGui.QLabel(self.mainAreaPage) self.shadowSizeLabel = QtGui.QLabel(self.mainAreaPage)
self.shadowSizeLabel.setObjectName(u'shadowSizeLabel') self.shadowSizeLabel.setObjectName(u'ShadowSizeLabel')
self.shadowLayout.addWidget(self.shadowSizeLabel) self.shadowLayout.addWidget(self.shadowSizeLabel)
self.shadowSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage) self.shadowSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage)
self.shadowSizeSpinBox.setObjectName(u'shadowSizeSpinBox') self.shadowSizeSpinBox.setEnabled(False)
self.shadowSizeSpinBox.setObjectName(u'ShadowSizeSpinBox')
self.shadowLayout.addWidget(self.shadowSizeSpinBox) self.shadowLayout.addWidget(self.shadowSizeSpinBox)
self.mainAreaLayout.setLayout(5, self.mainAreaLayout.addRow(self.shadowCheckBox, self.shadowLayout)
QtGui.QFormLayout.FieldRole, self.shadowLayout)
ThemeWizard.addPage(self.mainAreaPage) ThemeWizard.addPage(self.mainAreaPage)
# Footer Area Page
self.footerAreaPage = QtGui.QWizardPage() self.footerAreaPage = QtGui.QWizardPage()
self.footerAreaPage.setObjectName(u'footerAreaPage') self.footerAreaPage.setObjectName(u'FooterAreaPage')
self.footerLayout = QtGui.QFormLayout(self.footerAreaPage) self.footerAreaLayout = QtGui.QFormLayout(self.footerAreaPage)
self.footerLayout.setFieldGrowthPolicy( self.footerAreaLayout.setObjectName(u'FooterAreaLayout')
QtGui.QFormLayout.ExpandingFieldsGrow)
self.footerLayout.setMargin(20)
self.footerLayout.setSpacing(8)
self.footerLayout.setObjectName(u'footerLayout')
self.footerFontLabel = QtGui.QLabel(self.footerAreaPage) self.footerFontLabel = QtGui.QLabel(self.footerAreaPage)
self.footerFontLabel.setMinimumSize(QtCore.QSize(103, 0)) self.footerFontLabel.setObjectName(u'FooterFontLabel')
self.footerFontLabel.setAlignment(QtCore.Qt.AlignRight |
QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.footerFontLabel.setObjectName(u'footerFontLabel')
self.footerLayout.setWidget(0,
QtGui.QFormLayout.LabelRole, self.footerFontLabel)
self.footerFontComboBox = QtGui.QFontComboBox(self.footerAreaPage) self.footerFontComboBox = QtGui.QFontComboBox(self.footerAreaPage)
self.footerFontComboBox.setObjectName(u'footerFontComboBox') self.footerFontComboBox.setObjectName(u'footerFontComboBox')
self.footerLayout.setWidget(0, self.footerAreaLayout.addRow(self.footerFontLabel,
QtGui.QFormLayout.FieldRole, self.footerFontComboBox) self.footerFontComboBox)
self.footerColorLabel = QtGui.QLabel(self.footerAreaPage) self.footerColorLabel = QtGui.QLabel(self.footerAreaPage)
self.footerColorLabel.setObjectName(u'footerColorLabel') self.footerColorLabel.setObjectName(u'FooterColorLabel')
self.footerLayout.setWidget(1, self.footerColorButton = QtGui.QPushButton(self.footerAreaPage)
QtGui.QFormLayout.LabelRole, self.footerColorLabel) self.footerColorButton.setObjectName(u'footerColorButton')
self.footerColorPushButton = QtGui.QPushButton(self.footerAreaPage) self.footerAreaLayout.addRow(self.footerColorLabel,
self.footerColorPushButton.setText(u'') self.footerColorButton)
self.footerColorPushButton.setObjectName(u'footerColorPushButton')
self.footerLayout.setWidget(1,
QtGui.QFormLayout.FieldRole, self.footerColorPushButton)
self.footerSizeLabel = QtGui.QLabel(self.footerAreaPage) self.footerSizeLabel = QtGui.QLabel(self.footerAreaPage)
self.footerSizeLabel.setObjectName(u'footerSizeLabel') self.footerSizeLabel.setObjectName(u'FooterSizeLabel')
self.footerLayout.setWidget(2,
QtGui.QFormLayout.LabelRole, self.footerSizeLabel)
self.footerSizeSpinBox = QtGui.QSpinBox(self.footerAreaPage) self.footerSizeSpinBox = QtGui.QSpinBox(self.footerAreaPage)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.footerSizeSpinBox.sizePolicy().hasHeightForWidth())
self.footerSizeSpinBox.setSizePolicy(sizePolicy)
self.footerSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0))
self.footerSizeSpinBox.setMaximum(999) self.footerSizeSpinBox.setMaximum(999)
self.footerSizeSpinBox.setProperty(u'value', 10) self.footerSizeSpinBox.setValue(10)
self.footerSizeSpinBox.setObjectName(u'footerSizeSpinBox') self.footerSizeSpinBox.setObjectName(u'FooterSizeSpinBox')
self.footerLayout.setWidget(2, self.footerAreaLayout.addRow(self.footerSizeLabel, self.footerSizeSpinBox)
QtGui.QFormLayout.FieldRole, self.footerSizeSpinBox)
ThemeWizard.addPage(self.footerAreaPage) ThemeWizard.addPage(self.footerAreaPage)
# Alignment Page
self.alignmentPage = QtGui.QWizardPage() self.alignmentPage = QtGui.QWizardPage()
self.alignmentPage.setObjectName(u'alignmentPage') self.alignmentPage.setObjectName(u'AlignmentPage')
self.alignmentLayout = QtGui.QFormLayout(self.alignmentPage) self.alignmentLayout = QtGui.QFormLayout(self.alignmentPage)
self.alignmentLayout.setMargin(20) self.alignmentLayout.setObjectName(u'AlignmentLayout')
self.alignmentLayout.setSpacing(8)
self.alignmentLayout.setObjectName(u'alignmentLayout')
self.horizontalLabel = QtGui.QLabel(self.alignmentPage) self.horizontalLabel = QtGui.QLabel(self.alignmentPage)
self.horizontalLabel.setMinimumSize(QtCore.QSize(103, 0)) self.horizontalLabel.setObjectName(u'HorizontalLabel')
self.horizontalLabel.setAlignment(QtCore.Qt.AlignRight |
QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.horizontalLabel.setObjectName(u'horizontalLabel')
self.alignmentLayout.setWidget(0,
QtGui.QFormLayout.LabelRole, self.horizontalLabel)
self.horizontalComboBox = QtGui.QComboBox(self.alignmentPage) self.horizontalComboBox = QtGui.QComboBox(self.alignmentPage)
self.horizontalComboBox.setEditable(False) self.horizontalComboBox.addItems([u'', u'', u''])
self.horizontalComboBox.setObjectName(u'horizontalComboBox') self.horizontalComboBox.setObjectName(u'HorizontalComboBox')
self.horizontalComboBox.addItem(u'') self.alignmentLayout.addRow(self.horizontalLabel,
self.horizontalComboBox.addItem(u'') self.horizontalComboBox)
self.horizontalComboBox.addItem(u'')
self.alignmentLayout.setWidget(0,
QtGui.QFormLayout.FieldRole, self.horizontalComboBox)
self.verticalLabel = QtGui.QLabel(self.alignmentPage) self.verticalLabel = QtGui.QLabel(self.alignmentPage)
self.verticalLabel.setObjectName(u'verticalLabel') self.verticalLabel.setObjectName(u'VerticalLabel')
self.alignmentLayout.setWidget(1,
QtGui.QFormLayout.LabelRole, self.verticalLabel)
self.verticalComboBox = QtGui.QComboBox(self.alignmentPage) self.verticalComboBox = QtGui.QComboBox(self.alignmentPage)
self.verticalComboBox.setObjectName(u'verticalComboBox') self.verticalComboBox.addItems([u'', u'', u''])
self.verticalComboBox.addItem(u'') self.verticalComboBox.setObjectName(u'VerticalComboBox')
self.verticalComboBox.addItem(u'') self.alignmentLayout.addRow(self.verticalLabel, self.verticalComboBox)
self.verticalComboBox.addItem(u'') self.transitionsLabel = QtGui.QLabel(self.alignmentPage)
self.alignmentLayout.setWidget(1, self.transitionsLabel.setObjectName(u'TransitionsLabel')
QtGui.QFormLayout.FieldRole, self.verticalComboBox)
self.transitionsCheckBox = QtGui.QCheckBox(self.alignmentPage) self.transitionsCheckBox = QtGui.QCheckBox(self.alignmentPage)
self.transitionsCheckBox.setObjectName(u'transitionsCheckBox') self.transitionsCheckBox.setObjectName(u'TransitionsCheckBox')
self.alignmentLayout.setWidget(2, self.alignmentLayout.addRow(self.transitionsLabel,
QtGui.QFormLayout.FieldRole, self.transitionsCheckBox) self.transitionsCheckBox)
ThemeWizard.addPage(self.alignmentPage) ThemeWizard.addPage(self.alignmentPage)
# Area Position Page
self.areaPositionPage = QtGui.QWizardPage() self.areaPositionPage = QtGui.QWizardPage()
self.areaPositionPage.setObjectName(u'areaPositionPage') self.areaPositionPage.setObjectName(u'AreaPositionPage')
self.areaPositionLayout = QtGui.QGridLayout(self.areaPositionPage) self.areaPositionLayout = QtGui.QHBoxLayout(self.areaPositionPage)
self.areaPositionLayout.setMargin(20) self.areaPositionLayout.setObjectName(u'AreaPositionLayout')
self.areaPositionLayout.setSpacing(8)
self.areaPositionLayout.setObjectName(u'areaPositionLayout')
self.mainPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage) self.mainPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage)
self.mainPositionGroupBox.setMinimumSize(QtCore.QSize(248, 0)) self.mainPositionGroupBox.setObjectName(u'MainPositionGroupBox')
self.mainPositionGroupBox.setObjectName(u'mainPositionGroupBox')
self.mainPositionLayout = QtGui.QFormLayout(self.mainPositionGroupBox) self.mainPositionLayout = QtGui.QFormLayout(self.mainPositionGroupBox)
self.mainPositionLayout.setMargin(8) self.mainPositionLayout.setObjectName(u'MainPositionLayout')
self.mainPositionLayout.setSpacing(8) self.mainPositionCheckBox = QtGui.QCheckBox(self.mainPositionGroupBox)
self.mainPositionLayout.setObjectName(u'mainPositionLayout') self.mainPositionCheckBox.setObjectName(u'MainPositionCheckBox')
self.mainDefaultPositionCheckBox = QtGui.QCheckBox( self.mainPositionLayout.addRow(self.mainPositionCheckBox)
self.mainPositionGroupBox) self.mainXLabel = QtGui.QLabel(self.mainPositionGroupBox)
self.mainDefaultPositionCheckBox.setChecked(True) self.mainXLabel.setObjectName(u'MainXLabel')
self.mainDefaultPositionCheckBox.setTristate(False)
self.mainDefaultPositionCheckBox.setObjectName(
u'mainDefaultPositionCheckBox')
self.mainPositionLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.mainDefaultPositionCheckBox)
self.nainXLabel = QtGui.QLabel(self.mainPositionGroupBox)
self.nainXLabel.setObjectName(u'nainXLabel')
self.mainPositionLayout.setWidget(1,
QtGui.QFormLayout.LabelRole, self.nainXLabel)
self.mainXSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox) self.mainXSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox)
self.mainXSpinBox.setEnabled(False)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.mainXSpinBox.sizePolicy().hasHeightForWidth())
self.mainXSpinBox.setSizePolicy(sizePolicy)
self.mainXSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.mainXSpinBox.setMaximum(9999) self.mainXSpinBox.setMaximum(9999)
self.mainXSpinBox.setProperty(u'value', 0) self.mainXSpinBox.setObjectName(u'MainXSpinBox')
self.mainXSpinBox.setObjectName(u'mainXSpinBox') self.mainPositionLayout.addRow(self.mainXLabel, self.mainXSpinBox)
self.mainPositionLayout.setWidget(1,
QtGui.QFormLayout.FieldRole, self.mainXSpinBox)
self.mainYSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox)
self.mainYSpinBox.setEnabled(False)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.mainYSpinBox.sizePolicy().hasHeightForWidth())
self.mainYSpinBox.setSizePolicy(sizePolicy)
self.mainYSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.mainYSpinBox.setMaximum(9999)
self.mainYSpinBox.setObjectName(u'mainYSpinBox')
self.mainPositionLayout.setWidget(2,
QtGui.QFormLayout.FieldRole, self.mainYSpinBox)
self.mainYLabel = QtGui.QLabel(self.mainPositionGroupBox) self.mainYLabel = QtGui.QLabel(self.mainPositionGroupBox)
self.mainYLabel.setObjectName(u'mainYLabel') self.mainYLabel.setObjectName(u'MainYLabel')
self.mainPositionLayout.setWidget(2, self.mainYSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox)
QtGui.QFormLayout.LabelRole, self.mainYLabel) self.mainYSpinBox.setMaximum(9999)
self.mainWidthSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox) self.mainYSpinBox.setObjectName(u'MainYSpinBox')
self.mainWidthSpinBox.setEnabled(False) self.mainPositionLayout.addRow(self.mainYLabel, self.mainYSpinBox)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.mainWidthSpinBox.sizePolicy().hasHeightForWidth())
self.mainWidthSpinBox.setSizePolicy(sizePolicy)
self.mainWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.mainWidthSpinBox.setMaximum(9999)
self.mainWidthSpinBox.setObjectName(u'mainWidthSpinBox')
self.mainPositionLayout.setWidget(3,
QtGui.QFormLayout.FieldRole, self.mainWidthSpinBox)
self.mainWidthLabel = QtGui.QLabel(self.mainPositionGroupBox) self.mainWidthLabel = QtGui.QLabel(self.mainPositionGroupBox)
self.mainWidthLabel.setObjectName(u'mainWidthLabel') self.mainWidthLabel.setObjectName(u'MainWidthLabel')
self.mainPositionLayout.setWidget(3, self.mainWidthSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox)
QtGui.QFormLayout.LabelRole, self.mainWidthLabel) self.mainWidthSpinBox.setMaximum(9999)
self.mainHeightSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox) self.mainWidthSpinBox.setObjectName(u'MainWidthSpinBox')
self.mainHeightSpinBox.setEnabled(False) self.mainPositionLayout.addRow(self.mainWidthLabel,
sizePolicy = QtGui.QSizePolicy( self.mainWidthSpinBox)
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.mainHeightSpinBox.sizePolicy().hasHeightForWidth())
self.mainHeightSpinBox.setSizePolicy(sizePolicy)
self.mainHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.mainHeightSpinBox.setMaximum(9999)
self.mainHeightSpinBox.setObjectName(u'mainHeightSpinBox')
self.mainPositionLayout.setWidget(4,
QtGui.QFormLayout.FieldRole, self.mainHeightSpinBox)
self.mainHeightLabel = QtGui.QLabel(self.mainPositionGroupBox) self.mainHeightLabel = QtGui.QLabel(self.mainPositionGroupBox)
self.mainHeightLabel.setObjectName(u'mainHeightLabel') self.mainHeightLabel.setObjectName(u'MainHeightLabel')
self.mainPositionLayout.setWidget(4, self.mainHeightSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox)
QtGui.QFormLayout.LabelRole, self.mainHeightLabel) self.mainHeightSpinBox.setMaximum(9999)
self.areaPositionLayout.addWidget( self.mainHeightSpinBox.setObjectName(u'MainHeightSpinBox')
self.mainPositionGroupBox, 1, 0, 1, 1) self.mainPositionLayout.addRow(self.mainHeightLabel,
self.mainHeightSpinBox)
self.areaPositionLayout.addWidget(self.mainPositionGroupBox)
self.footerPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage) self.footerPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage)
self.footerPositionGroupBox.setMinimumSize(QtCore.QSize(248, 0)) self.footerPositionGroupBox.setObjectName(u'FooterPositionGroupBox')
self.footerPositionGroupBox.setObjectName(u'footerPositionGroupBox') self.footerPositionLayout = QtGui.QFormLayout(self.footerPositionGroupBox)
self.footerPositionLayout = QtGui.QFormLayout( self.footerPositionLayout.setObjectName(u'FooterPositionLayout')
self.footerPositionGroupBox) self.footerPositionCheckBox = QtGui.QCheckBox(self.footerPositionGroupBox)
self.footerPositionLayout.setMargin(8) self.footerPositionCheckBox.setObjectName(u'FooterPositionCheckBox')
self.footerPositionLayout.setSpacing(8) self.footerPositionLayout.addRow(self.footerPositionCheckBox)
self.footerPositionLayout.setObjectName(u'footerPositionLayout')
self.footerXLabel = QtGui.QLabel(self.footerPositionGroupBox) self.footerXLabel = QtGui.QLabel(self.footerPositionGroupBox)
self.footerXLabel.setObjectName(u'footerXLabel') self.footerXLabel.setObjectName(u'FooterXLabel')
self.footerPositionLayout.setWidget(1,
QtGui.QFormLayout.LabelRole, self.footerXLabel)
self.footerXSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox) self.footerXSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox)
self.footerXSpinBox.setEnabled(False)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.footerXSpinBox.sizePolicy().hasHeightForWidth())
self.footerXSpinBox.setSizePolicy(sizePolicy)
self.footerXSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.footerXSpinBox.setMaximum(9999) self.footerXSpinBox.setMaximum(9999)
self.footerXSpinBox.setProperty(u'value', 0) self.footerXSpinBox.setObjectName(u'FooterXSpinBox')
self.footerXSpinBox.setObjectName(u'footerXSpinBox') self.footerPositionLayout.addRow(self.footerXLabel, self.footerXSpinBox)
self.footerPositionLayout.setWidget(1,
QtGui.QFormLayout.FieldRole, self.footerXSpinBox)
self.footerYLabel = QtGui.QLabel(self.footerPositionGroupBox) self.footerYLabel = QtGui.QLabel(self.footerPositionGroupBox)
self.footerYLabel.setObjectName(u'footerYLabel') self.footerYLabel.setObjectName(u'FooterYLabel')
self.footerPositionLayout.setWidget(2,
QtGui.QFormLayout.LabelRole, self.footerYLabel)
self.footerYSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox) self.footerYSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox)
self.footerYSpinBox.setEnabled(False)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.footerYSpinBox.sizePolicy().hasHeightForWidth())
self.footerYSpinBox.setSizePolicy(sizePolicy)
self.footerYSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.footerYSpinBox.setMaximum(9999) self.footerYSpinBox.setMaximum(9999)
self.footerYSpinBox.setProperty(u'value', 0) self.footerYSpinBox.setObjectName(u'FooterYSpinBox')
self.footerYSpinBox.setObjectName(u'footerYSpinBox') self.footerPositionLayout.addRow(self.footerYLabel, self.footerYSpinBox)
self.footerPositionLayout.setWidget(2,
QtGui.QFormLayout.FieldRole, self.footerYSpinBox)
self.footerWidthLabel = QtGui.QLabel(self.footerPositionGroupBox) self.footerWidthLabel = QtGui.QLabel(self.footerPositionGroupBox)
self.footerWidthLabel.setObjectName(u'footerWidthLabel') self.footerWidthLabel.setObjectName(u'FooterWidthLabel')
self.footerPositionLayout.setWidget(3,
QtGui.QFormLayout.LabelRole, self.footerWidthLabel)
self.footerWidthSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox) self.footerWidthSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox)
self.footerWidthSpinBox.setEnabled(False)
self.footerWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.footerWidthSpinBox.setMaximum(9999) self.footerWidthSpinBox.setMaximum(9999)
self.footerWidthSpinBox.setObjectName(u'footerWidthSpinBox') self.footerWidthSpinBox.setObjectName(u'FooterWidthSpinBox')
self.footerPositionLayout.setWidget(3, self.footerPositionLayout.addRow(self.footerWidthLabel,
QtGui.QFormLayout.FieldRole, self.footerWidthSpinBox) self.footerWidthSpinBox)
self.footerHeightLabel = QtGui.QLabel(self.footerPositionGroupBox) self.footerHeightLabel = QtGui.QLabel(self.footerPositionGroupBox)
self.footerHeightLabel.setObjectName(u'footerHeightLabel') self.footerHeightLabel.setObjectName(u'FooterHeightLabel')
self.footerPositionLayout.setWidget(4,
QtGui.QFormLayout.LabelRole, self.footerHeightLabel)
self.footerHeightSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox) self.footerHeightSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox)
self.footerHeightSpinBox.setEnabled(False)
self.footerHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.footerHeightSpinBox.setMaximum(9999) self.footerHeightSpinBox.setMaximum(9999)
self.footerHeightSpinBox.setObjectName(u'footerHeightSpinBox') self.footerHeightSpinBox.setObjectName(u'FooterHeightSpinBox')
self.footerPositionLayout.setWidget(4, self.footerPositionLayout.addRow(self.footerHeightLabel,
QtGui.QFormLayout.FieldRole, self.footerHeightSpinBox) self.footerHeightSpinBox)
self.footerDefaultPositionCheckBox = QtGui.QCheckBox( self.areaPositionLayout.addWidget(self.footerPositionGroupBox)
self.footerPositionGroupBox)
self.footerDefaultPositionCheckBox.setChecked(True)
self.footerDefaultPositionCheckBox.setObjectName(
u'footerDefaultPositionCheckBox')
self.footerPositionLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.footerDefaultPositionCheckBox)
self.areaPositionLayout.addWidget(
self.footerPositionGroupBox, 1, 1, 1, 1)
ThemeWizard.addPage(self.areaPositionPage) ThemeWizard.addPage(self.areaPositionPage)
# Preview Page
self.previewPage = QtGui.QWizardPage() self.previewPage = QtGui.QWizardPage()
self.previewPage.setObjectName(u'previewPage') self.previewPage.setObjectName(u'PreviewPage')
self.previewLayout = QtGui.QVBoxLayout(self.previewPage) self.previewLayout = QtGui.QVBoxLayout(self.previewPage)
self.previewLayout.setSpacing(8) self.previewLayout.setObjectName(u'PreviewLayout')
self.previewLayout.setMargin(20) self.themeNameLayout = QtGui.QFormLayout()
self.previewLayout.setObjectName(u'previewLayout') self.themeNameLayout.setObjectName(u'ThemeNameLayout')
self.themeNameLayout = QtGui.QHBoxLayout()
self.themeNameLayout.setSpacing(8)
self.themeNameLayout.setObjectName(u'themeNameLayout')
self.themeNameLabel = QtGui.QLabel(self.previewPage) self.themeNameLabel = QtGui.QLabel(self.previewPage)
self.themeNameLabel.setMinimumSize(QtCore.QSize(103, 0)) self.themeNameLabel.setObjectName(u'ThemeNameLabel')
self.themeNameLabel.setTextFormat(QtCore.Qt.PlainText)
self.themeNameLabel.setAlignment(QtCore.Qt.AlignRight |
QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.themeNameLabel.setObjectName(u'themeNameLabel')
self.themeNameLayout.addWidget(self.themeNameLabel)
self.themeNameEdit = QtGui.QLineEdit(self.previewPage) self.themeNameEdit = QtGui.QLineEdit(self.previewPage)
self.themeNameEdit.setObjectName(u'themeNameEdit') self.themeNameEdit.setObjectName(u'ThemeNameEdit')
self.themeNameLayout.addWidget(self.themeNameEdit) self.themeNameLayout.addRow(self.themeNameLabel, self.themeNameEdit)
self.previewLayout.addLayout(self.themeNameLayout) self.previewLayout.addLayout(self.themeNameLayout)
self.previewPaneLayout = QtGui.QHBoxLayout() self.previewArea = QtGui.QWidget(self.previewPage)
self.previewPaneLayout.setSpacing(0) self.previewArea.setObjectName(u'PreviewArea')
self.previewPaneLayout.setObjectName(u'previewPaneLayout') self.previewAreaLayout = QtGui.QGridLayout(self.previewArea)
self.previewLeftSpacer = QtGui.QSpacerItem(58, 20, self.previewAreaLayout.setMargin(0)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.previewAreaLayout.setColumnStretch(0, 1)
self.previewPaneLayout.addItem(self.previewLeftSpacer) self.previewAreaLayout.setRowStretch(0, 1)
self.previewBoxLabel = QtGui.QLabel(self.previewPage) self.previewAreaLayout.setObjectName(u'PreviewAreaLayout')
sizePolicy = QtGui.QSizePolicy( self.previewBoxLabel = QtGui.QLabel(self.previewArea)
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) self.previewBoxLabel.setFrameShape(QtGui.QFrame.Box)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.previewBoxLabel.sizePolicy().hasHeightForWidth())
self.previewBoxLabel.setSizePolicy(sizePolicy)
self.previewBoxLabel.setMinimumSize(QtCore.QSize(100, 150))
self.previewBoxLabel.setFrameShape(QtGui.QFrame.WinPanel)
self.previewBoxLabel.setFrameShadow(QtGui.QFrame.Sunken)
self.previewBoxLabel.setLineWidth(1)
self.previewBoxLabel.setText(u'')
self.previewBoxLabel.setScaledContents(True) self.previewBoxLabel.setScaledContents(True)
self.previewBoxLabel.setObjectName(u'previewBoxLabel') self.previewBoxLabel.setObjectName(u'PreviewBoxLabel')
self.previewPaneLayout.addWidget(self.previewBoxLabel) self.previewAreaLayout.addWidget(self.previewBoxLabel)
self.previewRightSpacer = QtGui.QSpacerItem(78, 20, self.previewLayout.addWidget(self.previewArea)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.previewPaneLayout.addItem(self.previewRightSpacer)
self.previewLayout.addLayout(self.previewPaneLayout)
ThemeWizard.addPage(self.previewPage) ThemeWizard.addPage(self.previewPage)
self.themeNameLabel.setBuddy(self.themeNameEdit)
self.retranslateUi(ThemeWizard) self.retranslateUi(ThemeWizard)
self.backgroundStackedWidget.setCurrentIndex(0) QtCore.QObject.connect(self.backgroundComboBox,
QtCore.QObject.connect( QtCore.SIGNAL(u'currentIndexChanged(int)'), self.backgroundStack,
ThemeWizard, QtCore.SLOT(u'setCurrentIndex(int)'))
QtCore.SIGNAL(u'accepted()'), QtCore.QObject.connect(self.outlineCheckBox,
ThemeWizard.accept) QtCore.SIGNAL(u'toggled(bool)'), self.outlineColorButton,
QtCore.QObject.connect( QtCore.SLOT(u'setEnabled(bool)'))
self.backgroundTypeComboBox, QtCore.QObject.connect(self.outlineCheckBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), QtCore.SIGNAL(u'toggled(bool)'), self.outlineSizeSpinBox,
self.backgroundStackedWidget.setCurrentIndex) QtCore.SLOT(u'setEnabled(bool)'))
QtCore.QObject.connect(self.shadowCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.shadowColorButton,
QtCore.SLOT(u'setEnabled(bool)'))
QtCore.QObject.connect(self.shadowCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.shadowSizeSpinBox,
QtCore.SLOT(u'setEnabled(bool)'))
QtCore.QObject.connect(self.mainPositionCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.mainXSpinBox,
QtCore.SLOT(u'setDisabled(bool)'))
QtCore.QObject.connect(self.mainPositionCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.mainYSpinBox,
QtCore.SLOT(u'setDisabled(bool)'))
QtCore.QObject.connect(self.mainPositionCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.mainWidthSpinBox,
QtCore.SLOT(u'setDisabled(bool)'))
QtCore.QObject.connect(self.mainPositionCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.mainHeightSpinBox,
QtCore.SLOT(u'setDisabled(bool)'))
QtCore.QObject.connect(self.footerPositionCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.footerXSpinBox,
QtCore.SLOT(u'setDisabled(bool)'))
QtCore.QObject.connect(self.footerPositionCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.footerYSpinBox,
QtCore.SLOT(u'setDisabled(bool)'))
QtCore.QObject.connect(self.footerPositionCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.footerWidthSpinBox,
QtCore.SLOT(u'setDisabled(bool)'))
QtCore.QObject.connect(self.footerPositionCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.footerHeightSpinBox,
QtCore.SLOT(u'setDisabled(bool)'))
QtCore.QMetaObject.connectSlotsByName(ThemeWizard) QtCore.QMetaObject.connectSlotsByName(ThemeWizard)
def retranslateUi(self, ThemeWizard): def retranslateUi(self, ThemeWizard):
@ -627,20 +428,20 @@ class Ui_ThemeWizard(object):
translate('OpenLP.ThemeWizard', 'Welcome to the Theme Wizard')) translate('OpenLP.ThemeWizard', 'Welcome to the Theme Wizard'))
self.informationLabel.setText( self.informationLabel.setText(
translate('OpenLP.ThemeWizard', 'This wizard will help you to ' translate('OpenLP.ThemeWizard', 'This wizard will help you to '
'create and edit your themes . Click the next button below to ' 'create and edit your themes. Click the next button below to '
'start the process by setting up your background.')) 'start the process by setting up your background.'))
self.backgroundPage.setTitle( self.backgroundPage.setTitle(
translate('OpenLP.ThemeWizard', 'Set Up Background')) translate('OpenLP.ThemeWizard', 'Set Up Background'))
self.backgroundPage.setSubTitle( self.backgroundPage.setSubTitle(
translate('OpenLP.ThemeWizard', 'Set up your theme\'s background ' translate('OpenLP.ThemeWizard', 'Set up your theme\'s background '
'according to the parameters below.')) 'according to the parameters below.'))
self.backgroundTypeLabel.setText( self.backgroundLabel.setText(
translate('OpenLP.ThemeWizard', 'Background type:')) translate('OpenLP.ThemeWizard', 'Background type:'))
self.backgroundTypeComboBox.setItemText(0, self.backgroundComboBox.setItemText(0,
translate('OpenLP.ThemeWizard', 'Solid Color')) translate('OpenLP.ThemeWizard', 'Solid Color'))
self.backgroundTypeComboBox.setItemText(1, self.backgroundComboBox.setItemText(1,
translate('OpenLP.ThemeWizard', 'Gradient')) translate('OpenLP.ThemeWizard', 'Gradient'))
self.backgroundTypeComboBox.setItemText(2, self.backgroundComboBox.setItemText(2,
translate('OpenLP.ThemeWizard', 'Image')) translate('OpenLP.ThemeWizard', 'Image'))
self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:')) self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
self.gradientStartLabel.setText( self.gradientStartLabel.setText(
@ -682,9 +483,9 @@ class Ui_ThemeWizard(object):
self.shadowCheckBox.setText(translate('OpenLP.ThemeWizard', '&Shadow:')) self.shadowCheckBox.setText(translate('OpenLP.ThemeWizard', '&Shadow:'))
self.shadowSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:')) self.shadowSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
self.shadowSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt')) self.shadowSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
self.boldCheckBox.setText( self.mainBoldCheckBox.setText(
translate('OpenLP.ThemeWizard', 'Bold')) translate('OpenLP.ThemeWizard', 'Bold'))
self.italicsCheckBox.setText( self.mainItalicsCheckBox.setText(
translate('OpenLP.ThemeWizard', 'Italic')) translate('OpenLP.ThemeWizard', 'Italic'))
self.footerAreaPage.setTitle( self.footerAreaPage.setTitle(
translate('OpenLP.ThemeWizard', 'Footer Area Font Details')) translate('OpenLP.ThemeWizard', 'Footer Area Font Details'))
@ -716,8 +517,8 @@ class Ui_ThemeWizard(object):
translate('OpenLP.ThemeWizard', 'Middle')) translate('OpenLP.ThemeWizard', 'Middle'))
self.verticalComboBox.setItemText(2, self.verticalComboBox.setItemText(2,
translate('OpenLP.ThemeWizard', 'Bottom')) translate('OpenLP.ThemeWizard', 'Bottom'))
self.transitionsCheckBox.setText( self.transitionsLabel.setText(
translate('OpenLP.ThemeWizard', 'Transitions')) translate('OpenLP.ThemeWizard', 'Transitions:'))
self.areaPositionPage.setTitle( self.areaPositionPage.setTitle(
translate('OpenLP.ThemeWizard', 'Output Area Locations')) translate('OpenLP.ThemeWizard', 'Output Area Locations'))
self.areaPositionPage.setSubTitle( self.areaPositionPage.setSubTitle(
@ -725,9 +526,9 @@ class Ui_ThemeWizard(object):
' main and footer areas.')) ' main and footer areas.'))
self.mainPositionGroupBox.setTitle( self.mainPositionGroupBox.setTitle(
translate('OpenLP.ThemeWizard', '&Main Area')) translate('OpenLP.ThemeWizard', '&Main Area'))
self.mainDefaultPositionCheckBox.setText( self.mainPositionCheckBox.setText(
translate('OpenLP.ThemeWizard', '&Use default location')) translate('OpenLP.ThemeWizard', '&Use default location'))
self.nainXLabel.setText(translate('OpenLP.ThemeWizard', 'X position:')) self.mainXLabel.setText(translate('OpenLP.ThemeWizard', 'X position:'))
self.mainXSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) self.mainXSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
self.mainYSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) self.mainYSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
self.mainYLabel.setText(translate('OpenLP.ThemeWizard', 'Y position:')) self.mainYLabel.setText(translate('OpenLP.ThemeWizard', 'Y position:'))
@ -737,7 +538,7 @@ class Ui_ThemeWizard(object):
self.mainHeightLabel.setText( self.mainHeightLabel.setText(
translate('OpenLP.ThemeWizard', 'Height:')) translate('OpenLP.ThemeWizard', 'Height:'))
self.footerPositionGroupBox.setTitle( self.footerPositionGroupBox.setTitle(
translate('OpenLP.ThemeWizard', 'Footer Area')) translate('OpenLP.ThemeWizard', '&Footer Area'))
self.footerXLabel.setText( self.footerXLabel.setText(
translate('OpenLP.ThemeWizard', 'X position:')) translate('OpenLP.ThemeWizard', 'X position:'))
self.footerXSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) self.footerXSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
@ -752,7 +553,7 @@ class Ui_ThemeWizard(object):
translate('OpenLP.ThemeWizard', 'Height:')) translate('OpenLP.ThemeWizard', 'Height:'))
self.footerHeightSpinBox.setSuffix( self.footerHeightSpinBox.setSuffix(
translate('OpenLP.ThemeWizard', 'px')) translate('OpenLP.ThemeWizard', 'px'))
self.footerDefaultPositionCheckBox.setText( self.footerPositionCheckBox.setText(
translate('OpenLP.ThemeWizard', 'Use default location')) translate('OpenLP.ThemeWizard', 'Use default location'))
self.previewPage.setTitle( self.previewPage.setTitle(
translate('OpenLP.ThemeWizard', 'Save and Preview')) translate('OpenLP.ThemeWizard', 'Save and Preview'))
@ -762,3 +563,18 @@ class Ui_ThemeWizard(object):
'new theme')) 'new theme'))
self.themeNameLabel.setText( self.themeNameLabel.setText(
translate('OpenLP.ThemeWizard', 'Theme name:')) translate('OpenLP.ThemeWizard', 'Theme name:'))
# Align all QFormLayouts towards each other.
width = max(self.backgroundLabel.minimumSizeHint().width(),
self.colorLabel.minimumSizeHint().width())
width = max(width, self.gradientStartLabel.minimumSizeHint().width())
width = max(width, self.gradientEndLabel.minimumSizeHint().width())
width = max(width, self.gradientTypeLabel.minimumSizeHint().width())
width = max(width, self.imageLabel.minimumSizeHint().width())
self.backgroundTypeSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
self.colorSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
self.gradientSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
self.imageSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -275,6 +275,13 @@ def get_images_filter():
visible_formats, actual_formats) visible_formats, actual_formats)
return images_filter return images_filter
def split_filename(path):
path = os.path.abspath(path)
if not os.path.isfile(path):
return path, u''
else:
return os.path.split(path)
from languagemanager import LanguageManager from languagemanager import LanguageManager
from actions import ActionList from actions import ActionList

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -181,4 +181,4 @@ class ActionList(object):
if weight is None: if weight is None:
self.categories[category].actions.append(action) self.categories[category].actions.append(action)
else: else:
self.categories[category].actions.add(action, weight) self.categories[category].actions.add(action, weight)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -65,7 +65,7 @@ class LanguageManager(object):
""" """
trans_dir = QtCore.QDir(AppLocation.get_directory( trans_dir = QtCore.QDir(AppLocation.get_directory(
AppLocation.LanguageDir)) AppLocation.LanguageDir))
file_names = trans_dir.entryList(QtCore.QStringList("*.qm"), file_names = trans_dir.entryList(QtCore.QStringList(u'*.qm'),
QtCore.QDir.Files, QtCore.QDir.Name) QtCore.QDir.Files, QtCore.QDir.Name)
for name in file_names: for name in file_names:
file_names.replaceInStrings(name, trans_dir.filePath(name)) file_names.replaceInStrings(name, trans_dir.filePath(name))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -25,4 +25,4 @@
############################################################################### ###############################################################################
""" """
The :mod:`plugins` module provides all the project produced plugins The :mod:`plugins` module provides all the project produced plugins
""" """

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -26,4 +26,4 @@
""" """
The :mod:`alerts` module provides the Alerts plugin for producing impromptu The :mod:`alerts` module provides the Alerts plugin for producing impromptu
on-screen announcements during a service. on-screen announcements during a service.
""" """

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -40,7 +40,7 @@ class AlertsPlugin(Plugin):
log.info(u'Alerts Plugin loaded') log.info(u'Alerts Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Alerts', u'1.9.3', plugin_helpers) Plugin.__init__(self, u'Alerts', u'1.9.4', plugin_helpers)
self.weight = -3 self.weight = -3
self.icon = build_icon(u':/plugins/plugin_alerts.png') self.icon = build_icon(u':/plugins/plugin_alerts.png')
self.alertsmanager = AlertsManager(self) self.alertsmanager = AlertsManager(self)
@ -114,10 +114,10 @@ class AlertsPlugin(Plugin):
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.textStrings[StringContent.Name] = {
u'singular': translate('AlertsPlugin', 'Alert'), u'singular': translate('AlertsPlugin', 'Alert', 'name singular'),
u'plural': translate('AlertsPlugin', 'Alerts') u'plural': translate('AlertsPlugin', 'Alerts', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.textStrings[StringContent.VisibleName] = {
u'title': translate('AlertsPlugin', 'Alerts') u'title': translate('AlertsPlugin', 'Alerts', 'container title')
} }

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -24,4 +24,4 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from alertform import AlertForm from alertform import AlertForm

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -140,4 +140,4 @@ class Ui_AlertDialog(object):
self.DisplayCloseButton.setText( self.DisplayCloseButton.setText(
translate('AlertsPlugin.AlertForm', 'Display && Cl&ose')) translate('AlertsPlugin.AlertForm', 'Display && Cl&ose'))
self.CloseButton.setText( self.CloseButton.setText(
translate('AlertsPlugin.AlertForm', '&Close')) translate('AlertsPlugin.AlertForm', '&Close'))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -193,4 +193,4 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
text = text.replace(u'<>', unicode(self.ParameterEdit.text())) text = text.replace(u'<>', unicode(self.ParameterEdit.text()))
self.parent.alertsmanager.displayAlert(text) self.parent.alertsmanager.displayAlert(text)
return True return True
return False return False

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -25,4 +25,4 @@
############################################################################### ###############################################################################
from alertsmanager import AlertsManager from alertsmanager import AlertsManager
from alertstab import AlertsTab from alertstab import AlertsTab

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -103,4 +103,4 @@ class AlertsManager(QtCore.QObject):
self.parent.liveController.display.alert(u'') self.parent.liveController.display.alert(u'')
self.killTimer(self.timer_id) self.killTimer(self.timer_id)
self.timer_id = 0 self.timer_id = 0
self.generateAlert() self.generateAlert()

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -294,4 +294,4 @@ class AlertsTab(SettingsTab):
font.setPointSize(self.font_size) font.setPointSize(self.font_size)
self.FontPreview.setFont(font) self.FontPreview.setFont(font)
self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' % self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' %
(self.bg_color, self.font_color)) (self.bg_color, self.font_color))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -55,4 +55,4 @@ def init_schema(url):
mapper(AlertItem, alerts_table) mapper(AlertItem, alerts_table)
metadata.create_all(checkfirst=True) metadata.create_all(checkfirst=True)
return session return session

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -26,4 +26,4 @@
""" """
The :mod:`bibles` module provides the Bible plugin to enable OpenLP to display The :mod:`bibles` module provides the Bible plugin to enable OpenLP to display
scripture. scripture.
""" """

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -37,7 +37,7 @@ class BiblePlugin(Plugin):
log.info(u'Bible Plugin loaded') log.info(u'Bible Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Bibles', u'1.9.3', plugin_helpers) Plugin.__init__(self, u'Bibles', u'1.9.4', plugin_helpers)
self.weight = -9 self.weight = -9
self.icon_path = u':/plugins/plugin_bibles.png' self.icon_path = u':/plugins/plugin_bibles.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
@ -126,51 +126,46 @@ class BiblePlugin(Plugin):
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.textStrings[StringContent.Name] = {
u'singular': translate('BiblesPlugin', 'Bible'), u'singular': translate('BiblesPlugin', 'Bible', 'name singular'),
u'plural': translate('BiblesPlugin', 'Bibles') u'plural': translate('BiblesPlugin', 'Bibles', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.textStrings[StringContent.VisibleName] = {
u'title': translate('BiblesPlugin', 'Bibles') u'title': translate('BiblesPlugin', 'Bibles', 'container title')
} }
# Middle Header Bar # Middle Header Bar
## Import Button ## ## Import Action ##
self.textStrings[StringContent.Import] = { self.textStrings[StringContent.Import] = {
u'title': translate('BiblesPlugin', 'Import'), u'title': translate('BiblesPlugin', '&Import'),
u'tooltip': translate('BiblesPlugin', u'tooltip': translate('BiblesPlugin', 'Import a Bible')
'Import a Bible')
} }
## New Button ## ## New Action ##
self.textStrings[StringContent.New] = { self.textStrings[StringContent.New] = {
u'title': translate('BiblesPlugin', 'Add'), u'title': translate('BiblesPlugin', '&Add'),
u'tooltip': translate('BiblesPlugin', u'tooltip': translate('BiblesPlugin', 'Add a new Bible')
'Add a new Bible')
} }
## Edit Button ## ## Edit Action ##
self.textStrings[StringContent.Edit] = { self.textStrings[StringContent.Edit] = {
u'title': translate('BiblesPlugin', 'Edit'), u'title': translate('BiblesPlugin', '&Edit'),
u'tooltip': translate('BiblesPlugin', u'tooltip': translate('BiblesPlugin', 'Edit the selected Bible')
'Edit the selected Bible')
} }
## Delete Button ## ## Delete Action ##
self.textStrings[StringContent.Delete] = { self.textStrings[StringContent.Delete] = {
u'title': translate('BiblesPlugin', 'Delete'), u'title': translate('BiblesPlugin', '&Delete'),
u'tooltip': translate('BiblesPlugin', u'tooltip': translate('BiblesPlugin', 'Delete the selected Bible')
'Delete the selected Bible')
} }
## Preview ## ## Preview Action ##
self.textStrings[StringContent.Preview] = { self.textStrings[StringContent.Preview] = {
u'title': translate('BiblesPlugin', 'Preview'), u'title': translate('BiblesPlugin', 'Preview'),
u'tooltip': translate('BiblesPlugin', u'tooltip': translate('BiblesPlugin', 'Preview the selected Bible')
'Preview the selected Bible')
} }
## Live Button ## ## Send Live Action ##
self.textStrings[StringContent.Live] = { self.textStrings[StringContent.Live] = {
u'title': translate('BiblesPlugin', 'Live'), u'title': translate('BiblesPlugin', 'Live'),
u'tooltip': translate('BiblesPlugin', u'tooltip': translate('BiblesPlugin',
'Send the selected Bible live') 'Send the selected Bible live')
} }
## Add to service Button ## ## Add to Service Action ##
self.textStrings[StringContent.Service] = { self.textStrings[StringContent.Service] = {
u'title': translate('BiblesPlugin', 'Service'), u'title': translate('BiblesPlugin', 'Service'),
u'tooltip': translate('BiblesPlugin', u'tooltip': translate('BiblesPlugin',

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -53,4 +53,4 @@ from the .ui files later if necessary.
from bibleimportform import BibleImportForm from bibleimportform import BibleImportForm
__all__ = ['BibleImportForm'] __all__ = ['BibleImportForm']

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -79,12 +79,12 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
QtGui.QWizard.__init__(self, parent) QtGui.QWizard.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
self.registerFields() self.registerFields()
if not BibleFormat.get_availability(BibleFormat.OpenLP1): if BibleFormat.get_availability(BibleFormat.OpenLP1):
self.openlp1Page.setVisible(False) self.openlp1DisabledLabel.hide()
self.openlp1LocationLabel.setVisible(False) else:
self.openlp1LocationEdit.setVisible(False) self.openlp1FileLabel.hide()
self.openlp1FileButton.setVisible(False) self.openlp1FileEdit.hide()
self.openlp1DisabledLabel.setVisible(True) self.openlp1BrowseButton.hide()
self.finishButton = self.button(QtGui.QWizard.FinishButton) self.finishButton = self.button(QtGui.QWizard.FinishButton)
self.cancelButton = self.button(QtGui.QWizard.CancelButton) self.cancelButton = self.button(QtGui.QWizard.CancelButton)
self.manager = manager self.manager = manager
@ -92,24 +92,26 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
self.manager.set_process_dialog(self) self.manager.set_process_dialog(self)
self.web_bible_list = {} self.web_bible_list = {}
self.loadWebBibles() self.loadWebBibles()
QtCore.QObject.connect(self.locationComboBox, self.restart()
self.selectStack.setCurrentIndex(0)
QtCore.QObject.connect(self.webSourceComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.onLocationComboBoxChanged) self.onWebSourceComboBoxCurrentIndexChanged)
QtCore.QObject.connect(self.osisFileButton, QtCore.QObject.connect(self.osisBrowseButton,
QtCore.SIGNAL(u'clicked()'), QtCore.SIGNAL(u'clicked()'),
self.onOsisFileButtonClicked) self.onOsisBrowseButtonClicked)
QtCore.QObject.connect(self.booksFileButton, QtCore.QObject.connect(self.csvBooksButton,
QtCore.SIGNAL(u'clicked()'), QtCore.SIGNAL(u'clicked()'),
self.onBooksFileButtonClicked) self.onBooksBrowseButtonClicked)
QtCore.QObject.connect(self.csvVersesFileButton, QtCore.QObject.connect(self.csvVersesButton,
QtCore.SIGNAL(u'clicked()'), QtCore.SIGNAL(u'clicked()'),
self.onCsvVersesFileButtonClicked) self.onCsvVersesBrowseButtonClicked)
QtCore.QObject.connect(self.openSongBrowseButton, QtCore.QObject.connect(self.openSongBrowseButton,
QtCore.SIGNAL(u'clicked()'), QtCore.SIGNAL(u'clicked()'),
self.onOpenSongBrowseButtonClicked) self.onOpenSongBrowseButtonClicked)
QtCore.QObject.connect(self.openlp1FileButton, QtCore.QObject.connect(self.openlp1BrowseButton,
QtCore.SIGNAL(u'clicked()'), QtCore.SIGNAL(u'clicked()'),
self.onOpenlp1FileButtonClicked) self.onOpenlp1BrowseButtonClicked)
QtCore.QObject.connect(self, QtCore.QObject.connect(self,
QtCore.SIGNAL(u'currentIdChanged(int)'), QtCore.SIGNAL(u'currentIdChanged(int)'),
self.onCurrentIdChanged) self.onCurrentIdChanged)
@ -125,8 +127,8 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
""" """
Stop the import on cancel button, close button or ESC key. Stop the import on cancel button, close button or ESC key.
""" """
log.debug('Import canceled by user.') log.debug(u'Import canceled by user.')
if self.currentId() == 3: if self.currentPage() == self.importPage:
Receiver.send_message(u'bibles_stop_import') Receiver.send_message(u'bibles_stop_import')
self.done(QtGui.QDialog.Rejected) self.done(QtGui.QDialog.Rejected)
@ -134,11 +136,9 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
""" """
Validate the current page before moving on to the next page. Validate the current page before moving on to the next page.
""" """
if self.currentId() == 0: if self.currentPage() == self.welcomePage:
# Welcome page
return True return True
elif self.currentId() == 1: elif self.currentPage() == self.selectPage:
# Select page
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS: if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
if not self.field(u'osis_location').toString(): if not self.field(u'osis_location').toString():
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
@ -147,7 +147,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file to import your ' 'You need to specify a file to import your '
'Bible from.')) 'Bible from.'))
self.OSISLocationEdit.setFocus() self.osisFileEdit.setFocus()
return False return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV: elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
if not self.field(u'csv_booksfile').toString(): if not self.field(u'csv_booksfile').toString():
@ -157,7 +157,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file with books of ' 'You need to specify a file with books of '
'the Bible to use in the import.')) 'the Bible to use in the import.'))
self.booksLocationEdit.setFocus() self.csvBooksEdit.setFocus()
return False return False
elif not self.field(u'csv_versefile').toString(): elif not self.field(u'csv_versefile').toString():
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
@ -166,7 +166,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file of Bible ' 'You need to specify a file of Bible '
'verses to import.')) 'verses to import.'))
self.csvVerseLocationEdit.setFocus() self.csvVersesEdit.setFocus()
return False return False
elif self.field(u'source_format').toInt()[0] == \ elif self.field(u'source_format').toInt()[0] == \
BibleFormat.OpenSong: BibleFormat.OpenSong:
@ -187,11 +187,10 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file to import your ' 'You need to specify a file to import your '
'Bible from.')) 'Bible from.'))
self.openlp1LocationEdit.setFocus() self.openlp1FileEdit.setFocus()
return False return False
return True return True
elif self.currentId() == 2: elif self.currentPage() == self.licenseDetailsPage:
# License details
license_version = unicode(self.field(u'license_version').toString()) license_version = unicode(self.field(u'license_version').toString())
license_copyright = \ license_copyright = \
unicode(self.field(u'license_copyright').toString()) unicode(self.field(u'license_copyright').toString())
@ -221,11 +220,10 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
self.versionNameEdit.setFocus() self.versionNameEdit.setFocus()
return False return False
return True return True
if self.currentId() == 3: if self.currentPage() == self.importPage:
# Progress page
return True return True
def onLocationComboBoxChanged(self, index): def onWebSourceComboBoxCurrentIndexChanged(self, index):
""" """
Setup the list of Bibles when you select a different source on the web Setup the list of Bibles when you select a different source on the web
download page. download page.
@ -233,35 +231,34 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
``index`` ``index``
The index of the combo box. The index of the combo box.
""" """
self.bibleComboBox.clear() self.webTranslationComboBox.clear()
bibles = self.web_bible_list[index].keys() bibles = self.web_bible_list[index].keys()
bibles.sort() bibles.sort()
for bible in bibles: self.webTranslationComboBox.addItems(bibles)
self.bibleComboBox.addItem(bible)
def onOsisFileButtonClicked(self): def onOsisBrowseButtonClicked(self):
""" """
Show the file open dialog for the OSIS file. Show the file open dialog for the OSIS file.
""" """
self.getFileName( self.getFileName(
translate('BiblesPlugin.ImportWizardForm', 'Open OSIS File'), translate('BiblesPlugin.ImportWizardForm', 'Open OSIS File'),
self.OSISLocationEdit) self.osisFileEdit)
def onBooksFileButtonClicked(self): def onBooksBrowseButtonClicked(self):
""" """
Show the file open dialog for the books CSV file. Show the file open dialog for the books CSV file.
""" """
self.getFileName( self.getFileName(
translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'), translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'),
self.booksLocationEdit, u'%s (*.csv)' self.csvBooksEdit, u'%s (*.csv)'
% translate('BiblesPlugin.ImportWizardForm', 'CSV File')) % translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
def onCsvVersesFileButtonClicked(self): def onCsvVersesBrowseButtonClicked(self):
""" """
Show the file open dialog for the verses CSV file. Show the file open dialog for the verses CSV file.
""" """
self.getFileName(translate('BiblesPlugin.ImportWizardForm', self.getFileName(translate('BiblesPlugin.ImportWizardForm',
'Open Verses CSV File'), self.csvVerseLocationEdit, u'%s (*.csv)' 'Open Verses CSV File'), self.csvVersesEdit, u'%s (*.csv)'
% translate('BiblesPlugin.ImportWizardForm', 'CSV File')) % translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
def onOpenSongBrowseButtonClicked(self): def onOpenSongBrowseButtonClicked(self):
@ -272,36 +269,35 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm', 'Open OpenSong Bible'), translate('BiblesPlugin.ImportWizardForm', 'Open OpenSong Bible'),
self.openSongFileEdit) self.openSongFileEdit)
def onOpenlp1FileButtonClicked(self): def onOpenlp1BrowseButtonClicked(self):
""" """
Show the file open dialog for the openlp.org 1.x file. Show the file open dialog for the openlp.org 1.x file.
""" """
self.getFileName( self.getFileName(
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'Open openlp.org 1.x Bible'), self.openlp1LocationEdit, 'Open openlp.org 1.x Bible'), self.openlp1FileEdit,
u'%s (*.bible)' % translate('BiblesPlugin.ImportWizardForm', u'%s (*.bible)' % translate('BiblesPlugin.ImportWizardForm',
'openlp.org 1.x bible')) 'openlp.org 1.x bible'))
def onCurrentIdChanged(self, pageId): def onCurrentIdChanged(self, pageId):
if pageId == 3: if self.page(pageId) == self.importPage:
self.preImport() self.preImport()
self.performImport() self.performImport()
self.postImport() self.postImport()
def registerFields(self): def registerFields(self):
self.selectPage.registerField(u'source_format', self.formatComboBox) self.selectPage.registerField(u'source_format', self.formatComboBox)
self.selectPage.registerField(u'osis_location', self.OSISLocationEdit) self.selectPage.registerField(u'osis_location', self.osisFileEdit)
self.selectPage.registerField(u'csv_booksfile', self.booksLocationEdit) self.selectPage.registerField(u'csv_booksfile', self.csvBooksEdit)
self.selectPage.registerField( self.selectPage.registerField(u'csv_versefile', self.csvVersesEdit)
u'csv_versefile', self.csvVerseLocationEdit)
self.selectPage.registerField(u'opensong_file', self.openSongFileEdit) self.selectPage.registerField(u'opensong_file', self.openSongFileEdit)
self.selectPage.registerField(u'web_location', self.locationComboBox) self.selectPage.registerField(u'web_location', self.webSourceComboBox)
self.selectPage.registerField(u'web_biblename', self.bibleComboBox) self.selectPage.registerField(u'web_biblename',
self.selectPage.registerField(u'proxy_server', self.addressEdit) self.webTranslationComboBox)
self.selectPage.registerField(u'proxy_username', self.usernameEdit) self.selectPage.registerField(u'proxy_server', self.webServerEdit)
self.selectPage.registerField(u'proxy_password', self.passwordEdit) self.selectPage.registerField(u'proxy_username', self.webUserEdit)
self.selectPage.registerField( self.selectPage.registerField(u'proxy_password', self.webPasswordEdit)
u'openlp1_location', self.openlp1LocationEdit) self.selectPage.registerField(u'openlp1_location', self.openlp1FileEdit)
self.licenseDetailsPage.registerField( self.licenseDetailsPage.registerField(
u'license_version', self.versionNameEdit) u'license_version', self.versionNameEdit)
self.licenseDetailsPage.registerField( self.licenseDetailsPage.registerField(
@ -322,7 +318,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
self.setField(u'opensong_file', QtCore.QVariant('')) self.setField(u'opensong_file', QtCore.QVariant(''))
self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk)) self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk))
self.setField(u'web_biblename', self.setField(u'web_biblename',
QtCore.QVariant(self.bibleComboBox.currentIndex())) QtCore.QVariant(self.webTranslationComboBox.currentIndex()))
self.setField(u'proxy_server', self.setField(u'proxy_server',
settings.value(u'proxy address', QtCore.QVariant(u''))) settings.value(u'proxy address', QtCore.QVariant(u'')))
self.setField(u'proxy_username', self.setField(u'proxy_username',
@ -336,7 +332,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
QtCore.QVariant(self.copyrightEdit.text())) QtCore.QVariant(self.copyrightEdit.text()))
self.setField(u'license_permissions', self.setField(u'license_permissions',
QtCore.QVariant(self.permissionsEdit.text())) QtCore.QVariant(self.permissionsEdit.text()))
self.onLocationComboBoxChanged(WebDownload.Crosswalk) self.onWebSourceComboBoxCurrentIndexChanged(WebDownload.Crosswalk)
settings.endGroup() settings.endGroup()
def loadWebBibles(self): def loadWebBibles(self):
@ -491,7 +487,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
# Import a bible from the web. # Import a bible from the web.
self.importProgressBar.setMaximum(1) self.importProgressBar.setMaximum(1)
download_location = self.field(u'web_location').toInt()[0] download_location = self.field(u'web_location').toInt()[0]
bible_version = unicode(self.bibleComboBox.currentText()) bible_version = unicode(self.webTranslationComboBox.currentText())
if download_location == WebDownload.Crosswalk: if download_location == WebDownload.Crosswalk:
bible = \ bible = \
self.web_bible_list[WebDownload.Crosswalk][bible_version] self.web_bible_list[WebDownload.Crosswalk][bible_version]

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -31,269 +31,216 @@ from openlp.core.lib import build_icon, translate
class Ui_BibleImportWizard(object): class Ui_BibleImportWizard(object):
def setupUi(self, bibleImportWizard): def setupUi(self, bibleImportWizard):
bibleImportWizard.setObjectName(u'bibleImportWizard') bibleImportWizard.setObjectName(u'bibleImportWizard')
bibleImportWizard.resize(550, 386)
bibleImportWizard.setModal(True) bibleImportWizard.setModal(True)
bibleImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle) bibleImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
bibleImportWizard.setOptions( bibleImportWizard.setOptions(
QtGui.QWizard.IndependentPages | QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnLastPage) QtGui.QWizard.NoBackButtonOnLastPage)
# Welcome page # Welcome Page
self.welcomePage = QtGui.QWizardPage() self.welcomePage = QtGui.QWizardPage()
self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
QtGui.QPixmap(u':/wizards/wizard_importbible.bmp')) QtGui.QPixmap(u':/wizards/wizard_importbible.bmp'))
self.welcomePage.setObjectName(u'WelcomePage') self.welcomePage.setObjectName(u'WelcomePage')
self.welcomeLayout = QtGui.QVBoxLayout(self.welcomePage) self.welcomeLayout = QtGui.QVBoxLayout(self.welcomePage)
self.welcomeLayout.setSpacing(8)
self.welcomeLayout.setMargin(0)
self.welcomeLayout.setObjectName(u'WelcomeLayout') self.welcomeLayout.setObjectName(u'WelcomeLayout')
self.titleLabel = QtGui.QLabel(self.welcomePage) self.titleLabel = QtGui.QLabel(self.welcomePage)
self.titleLabel.setObjectName(u'TitleLabel') self.titleLabel.setObjectName(u'TitleLabel')
self.welcomeLayout.addWidget(self.titleLabel) self.welcomeLayout.addWidget(self.titleLabel)
spacerItem = QtGui.QSpacerItem(20, 40, self.welcomeLayout.addSpacing(40)
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
self.welcomeLayout.addItem(spacerItem)
self.informationLabel = QtGui.QLabel(self.welcomePage) self.informationLabel = QtGui.QLabel(self.welcomePage)
self.informationLabel.setWordWrap(True) self.informationLabel.setWordWrap(True)
self.informationLabel.setMargin(10)
self.informationLabel.setObjectName(u'InformationLabel') self.informationLabel.setObjectName(u'InformationLabel')
self.welcomeLayout.addWidget(self.informationLabel) self.welcomeLayout.addWidget(self.informationLabel)
spacerItem1 = QtGui.QSpacerItem(20, 40, self.welcomeLayout.addStretch()
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.welcomeLayout.addItem(spacerItem1)
bibleImportWizard.addPage(self.welcomePage) bibleImportWizard.addPage(self.welcomePage)
# Select page # Select Page
self.selectPage = QtGui.QWizardPage() self.selectPage = QtGui.QWizardPage()
self.selectPage.setObjectName(u'SelectPage') self.selectPage.setObjectName(u'SelectPage')
self.selectPageLayout = QtGui.QVBoxLayout(self.selectPage) self.selectPageLayout = QtGui.QVBoxLayout(self.selectPage)
self.selectPageLayout.setSpacing(8) self.selectPageLayout.setObjectName(u'SelectPageLayout')
self.selectPageLayout.setMargin(20) self.formatLayout = QtGui.QFormLayout()
self.selectPageLayout.setObjectName(u'selectPageLayout') self.formatLayout.setObjectName(u'FormatLayout')
self.formatSelectLayout = QtGui.QHBoxLayout()
self.formatSelectLayout.setSpacing(8)
self.formatSelectLayout.setObjectName(u'FormatSelectLayout')
self.formatLabel = QtGui.QLabel(self.selectPage) self.formatLabel = QtGui.QLabel(self.selectPage)
self.formatLabel.setObjectName(u'FormatLabel') self.formatLabel.setObjectName(u'FormatLabel')
self.formatSelectLayout.addWidget(self.formatLabel)
self.formatComboBox = QtGui.QComboBox(self.selectPage) self.formatComboBox = QtGui.QComboBox(self.selectPage)
self.formatComboBox.addItems([u'', u'', u'', u'', u''])
self.formatComboBox.setObjectName(u'FormatComboBox') self.formatComboBox.setObjectName(u'FormatComboBox')
self.formatComboBox.addItem(u'') self.formatLayout.addRow(self.formatLabel, self.formatComboBox)
self.formatComboBox.addItem(u'') self.formatSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
self.formatComboBox.addItem(u'') QtGui.QSizePolicy.Minimum)
self.formatComboBox.addItem(u'') self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole,
self.formatComboBox.addItem(u'') self.formatSpacer)
self.formatSelectLayout.addWidget(self.formatComboBox) self.selectPageLayout.addLayout(self.formatLayout)
spacerItem2 = QtGui.QSpacerItem(40, 20, self.selectStack = QtGui.QStackedLayout()
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.selectStack.setObjectName(u'SelectStack')
self.formatSelectLayout.addItem(spacerItem2) self.osisWidget = QtGui.QWidget(self.selectPage)
self.selectPageLayout.addLayout(self.formatSelectLayout) self.osisWidget.setObjectName(u'OsisWidget')
self.formatWidget = QtGui.QStackedWidget(self.selectPage) self.osisLayout = QtGui.QFormLayout(self.osisWidget)
self.formatWidget.setObjectName(u'FormatWidget')
generalIcon = build_icon(u':/general/general_open.png')
self.osisPage = QtGui.QWidget()
self.osisPage.setObjectName(u'OsisPage')
self.osisLayout = QtGui.QFormLayout(self.osisPage)
self.osisLayout.setFieldGrowthPolicy(
QtGui.QFormLayout.ExpandingFieldsGrow)
self.osisLayout.setMargin(0) self.osisLayout.setMargin(0)
self.osisLayout.setSpacing(8)
self.osisLayout.setObjectName(u'OsisLayout') self.osisLayout.setObjectName(u'OsisLayout')
self.osisLocationLabel = QtGui.QLabel(self.osisPage) self.osisFileLabel = QtGui.QLabel(self.osisWidget)
self.osisLocationLabel.setObjectName(u'OsisLocationLabel') self.osisFileLabel.setObjectName(u'OsisFileLabel')
self.osisLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.osisFileLayout = QtGui.QHBoxLayout()
self.osisLocationLabel) self.osisFileLayout.setObjectName(u'OsisFileLayout')
self.osisLocationLayout = QtGui.QHBoxLayout() self.osisFileEdit = QtGui.QLineEdit(self.osisWidget)
self.osisLocationLayout.setSpacing(8) self.osisFileEdit.setObjectName(u'OsisFileEdit')
self.osisLocationLayout.setObjectName(u'OsisLocationLayout') self.osisFileLayout.addWidget(self.osisFileEdit)
self.OSISLocationEdit = QtGui.QLineEdit(self.osisPage) self.osisBrowseButton = QtGui.QToolButton(self.osisWidget)
self.OSISLocationEdit.setObjectName(u'OSISLocationEdit') self.osisBrowseButton.setIcon(build_icon(u':/general/general_open.png'))
self.osisLocationLayout.addWidget(self.OSISLocationEdit) self.osisBrowseButton.setObjectName(u'OsisBrowseButton')
self.osisFileButton = QtGui.QToolButton(self.osisPage) self.osisFileLayout.addWidget(self.osisBrowseButton)
self.osisFileButton.setMaximumSize(QtCore.QSize(32, 16777215)) self.osisLayout.addRow(self.osisFileLabel, self.osisFileLayout)
self.osisFileButton.setIcon(generalIcon) self.osisSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
self.osisFileButton.setObjectName(u'OsisFileButton') QtGui.QSizePolicy.Minimum)
self.osisLocationLayout.addWidget(self.osisFileButton) self.osisLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.osisSpacer)
self.osisLayout.setLayout(1, QtGui.QFormLayout.FieldRole, self.selectStack.addWidget(self.osisWidget)
self.osisLocationLayout) self.csvWidget = QtGui.QWidget(self.selectPage)
self.formatWidget.addWidget(self.osisPage) self.csvWidget.setObjectName(u'CsvWidget')
self.csvPage = QtGui.QWidget() self.csvLayout = QtGui.QFormLayout(self.csvWidget)
self.csvPage.setObjectName(u'CsvPage') self.csvLayout.setMargin(0)
self.csvSourceLayout = QtGui.QFormLayout(self.csvPage) self.csvLayout.setObjectName(u'CsvLayout')
self.csvSourceLayout.setFieldGrowthPolicy( self.csvBooksLabel = QtGui.QLabel(self.csvWidget)
QtGui.QFormLayout.ExpandingFieldsGrow) self.csvBooksLabel.setObjectName(u'CsvBooksLabel')
self.csvSourceLayout.setLabelAlignment(QtCore.Qt.AlignBottom |
QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing)
self.csvSourceLayout.setFormAlignment(QtCore.Qt.AlignLeading |
QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.csvSourceLayout.setMargin(0)
self.csvSourceLayout.setSpacing(8)
self.csvSourceLayout.setObjectName(u'CsvSourceLayout')
self.booksLocationLabel = QtGui.QLabel(self.csvPage)
self.booksLocationLabel.setObjectName(u'BooksLocationLabel')
self.csvSourceLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.booksLocationLabel)
self.csvBooksLayout = QtGui.QHBoxLayout() self.csvBooksLayout = QtGui.QHBoxLayout()
self.csvBooksLayout.setSpacing(8)
self.csvBooksLayout.setObjectName(u'CsvBooksLayout') self.csvBooksLayout.setObjectName(u'CsvBooksLayout')
self.booksLocationEdit = QtGui.QLineEdit(self.csvPage) self.csvBooksEdit = QtGui.QLineEdit(self.csvWidget)
self.booksLocationEdit.setObjectName(u'BooksLocationEdit') self.csvBooksEdit.setObjectName(u'CsvBooksEdit')
self.csvBooksLayout.addWidget(self.booksLocationEdit) self.csvBooksLayout.addWidget(self.csvBooksEdit)
self.booksFileButton = QtGui.QToolButton(self.csvPage) self.csvBooksButton = QtGui.QToolButton(self.csvWidget)
self.booksFileButton.setMaximumSize(QtCore.QSize(32, 16777215)) self.csvBooksButton.setIcon(build_icon(u':/general/general_open.png'))
self.booksFileButton.setIcon(generalIcon) self.csvBooksButton.setObjectName(u'CsvBooksButton')
self.booksFileButton.setObjectName(u'BooksFileButton') self.csvBooksLayout.addWidget(self.csvBooksButton)
self.csvBooksLayout.addWidget(self.booksFileButton) self.csvLayout.addRow(self.csvBooksLabel, self.csvBooksLayout)
self.csvSourceLayout.setLayout(0, QtGui.QFormLayout.FieldRole, self.csvVersesLabel = QtGui.QLabel(self.csvWidget)
self.csvBooksLayout) self.csvVersesLabel.setObjectName(u'CsvVersesLabel')
self.verseLocationLabel = QtGui.QLabel(self.csvPage) self.csvVersesLayout = QtGui.QHBoxLayout()
self.verseLocationLabel.setObjectName(u'VerseLocationLabel') self.csvVersesLayout.setObjectName(u'CsvVersesLayout')
self.csvSourceLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.csvVersesEdit = QtGui.QLineEdit(self.csvWidget)
self.verseLocationLabel) self.csvVersesEdit.setObjectName(u'CsvVersesEdit')
self.csvVerseLayout = QtGui.QHBoxLayout() self.csvVersesLayout.addWidget(self.csvVersesEdit)
self.csvVerseLayout.setSpacing(8) self.csvVersesButton = QtGui.QToolButton(self.csvWidget)
self.csvVerseLayout.setObjectName(u'CsvVerseLayout') self.csvVersesButton.setIcon(build_icon(u':/general/general_open.png'))
self.csvVerseLocationEdit = QtGui.QLineEdit(self.csvPage) self.csvVersesButton.setObjectName(u'CsvVersesButton')
self.csvVerseLocationEdit.setObjectName(u'CsvVerseLocationEdit') self.csvVersesLayout.addWidget(self.csvVersesButton)
self.csvVerseLayout.addWidget(self.csvVerseLocationEdit) self.csvLayout.addRow(self.csvVersesLabel, self.csvVersesLayout)
self.csvVersesFileButton = QtGui.QToolButton(self.csvPage) self.csvSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
self.csvVersesFileButton.setMaximumSize(QtCore.QSize(32, 16777215)) QtGui.QSizePolicy.Minimum)
self.csvVersesFileButton.setIcon(generalIcon) self.csvLayout.setItem(2, QtGui.QFormLayout.LabelRole, self.csvSpacer)
self.csvVersesFileButton.setObjectName(u'CsvVersesFileButton') self.selectStack.addWidget(self.csvWidget)
self.csvVerseLayout.addWidget(self.csvVersesFileButton) self.openSongWidget = QtGui.QWidget(self.selectPage)
self.csvSourceLayout.setLayout(1, QtGui.QFormLayout.FieldRole, self.openSongWidget.setObjectName(u'OpenSongWidget')
self.csvVerseLayout) self.openSongLayout = QtGui.QFormLayout(self.openSongWidget)
self.formatWidget.addWidget(self.csvPage)
self.openSongPage = QtGui.QWidget()
self.openSongPage.setObjectName(u'OpenSongPage')
self.openSongLayout = QtGui.QFormLayout(self.openSongPage)
self.openSongLayout.setMargin(0) self.openSongLayout.setMargin(0)
self.openSongLayout.setSpacing(8)
self.openSongLayout.setObjectName(u'OpenSongLayout') self.openSongLayout.setObjectName(u'OpenSongLayout')
self.openSongFileLabel = QtGui.QLabel(self.openSongPage) self.openSongFileLabel = QtGui.QLabel(self.openSongWidget)
self.openSongFileLabel.setObjectName(u'OpenSongFileLabel') self.openSongFileLabel.setObjectName(u'OpenSongFileLabel')
self.openSongLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.openSongFileLabel)
self.openSongFileLayout = QtGui.QHBoxLayout() self.openSongFileLayout = QtGui.QHBoxLayout()
self.openSongFileLayout.setSpacing(8)
self.openSongFileLayout.setObjectName(u'OpenSongFileLayout') self.openSongFileLayout.setObjectName(u'OpenSongFileLayout')
self.openSongFileEdit = QtGui.QLineEdit(self.openSongPage) self.openSongFileEdit = QtGui.QLineEdit(self.openSongWidget)
self.openSongFileEdit.setObjectName(u'OpenSongFileEdit') self.openSongFileEdit.setObjectName(u'OpenSongFileEdit')
self.openSongFileLayout.addWidget(self.openSongFileEdit) self.openSongFileLayout.addWidget(self.openSongFileEdit)
self.openSongBrowseButton = QtGui.QToolButton(self.openSongPage) self.openSongBrowseButton = QtGui.QToolButton(self.openSongWidget)
self.openSongBrowseButton.setIcon(generalIcon) self.openSongBrowseButton.setIcon(
build_icon(u':/general/general_open.png'))
self.openSongBrowseButton.setObjectName(u'OpenSongBrowseButton') self.openSongBrowseButton.setObjectName(u'OpenSongBrowseButton')
self.openSongFileLayout.addWidget(self.openSongBrowseButton) self.openSongFileLayout.addWidget(self.openSongBrowseButton)
self.openSongLayout.setLayout(0, QtGui.QFormLayout.FieldRole, self.openSongLayout.addRow(self.openSongFileLabel,
self.openSongFileLayout) self.openSongFileLayout)
self.formatWidget.addWidget(self.openSongPage) self.openSongSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
self.webDownloadPage = QtGui.QWidget() QtGui.QSizePolicy.Minimum)
self.webDownloadPage.setObjectName(u'WebDownloadPage') self.openSongLayout.setItem(1, QtGui.QFormLayout.LabelRole,
self.webDownloadLayout = QtGui.QVBoxLayout(self.webDownloadPage) self.openSongSpacer)
self.webDownloadLayout.setSpacing(8) self.selectStack.addWidget(self.openSongWidget)
self.webDownloadLayout.setMargin(0) self.webTabWidget = QtGui.QTabWidget(self.selectPage)
self.webDownloadLayout.setObjectName(u'WebDownloadLayout') self.webTabWidget.setObjectName(u'WebTabWidget')
self.webDownloadTabWidget = QtGui.QTabWidget(self.webDownloadPage) self.webBibleTab = QtGui.QWidget()
self.webDownloadTabWidget.setObjectName(u'WebDownloadTabWidget') self.webBibleTab.setObjectName(u'WebBibleTab')
self.downloadOptionsTab = QtGui.QWidget() self.webBibleLayout = QtGui.QFormLayout(self.webBibleTab)
self.downloadOptionsTab.setObjectName(u'DownloadOptionsTab') self.webBibleLayout.setObjectName(u'WebBibleLayout')
self.downloadOptionsLayout = QtGui.QFormLayout(self.downloadOptionsTab) self.webSourceLabel = QtGui.QLabel(self.webBibleTab)
self.downloadOptionsLayout.setMargin(8) self.webSourceLabel.setObjectName(u'WebSourceLabel')
self.downloadOptionsLayout.setSpacing(8) self.webBibleLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.downloadOptionsLayout.setObjectName(u'DownloadOptionsLayout') self.webSourceLabel)
self.locationLabel = QtGui.QLabel(self.downloadOptionsTab) self.webSourceComboBox = QtGui.QComboBox(self.webBibleTab)
self.locationLabel.setObjectName(u'LocationLabel') self.webSourceComboBox.setObjectName(u'WebSourceComboBox')
self.downloadOptionsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.webSourceComboBox.addItems([u'', u'', u''])
self.locationLabel) self.webBibleLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.locationComboBox = QtGui.QComboBox(self.downloadOptionsTab) self.webSourceComboBox)
self.locationComboBox.setObjectName(u'LocationComboBox') self.webTranslationLabel = QtGui.QLabel(self.webBibleTab)
self.locationComboBox.addItem(u'') self.webTranslationLabel.setObjectName(u'webTranslationLabel')
self.locationComboBox.addItem(u'') self.webBibleLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.locationComboBox.addItem(u'') self.webTranslationLabel)
self.downloadOptionsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.webTranslationComboBox = QtGui.QComboBox(self.webBibleTab)
self.locationComboBox) self.webTranslationComboBox.setSizeAdjustPolicy(
self.bibleLabel = QtGui.QLabel(self.downloadOptionsTab) QtGui.QComboBox.AdjustToContents)
self.bibleLabel.setObjectName(u'BibleLabel') self.webTranslationComboBox.setObjectName(u'WebTranslationComboBox')
self.downloadOptionsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.webBibleLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.bibleLabel) self.webTranslationComboBox)
self.bibleComboBox = QtGui.QComboBox(self.downloadOptionsTab) self.webTabWidget.addTab(self.webBibleTab, u'')
self.bibleComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.webProxyTab = QtGui.QWidget()
self.bibleComboBox.setObjectName(u'BibleComboBox') self.webProxyTab.setObjectName(u'WebProxyTab')
self.bibleComboBox.addItem(u'') self.webProxyLayout = QtGui.QFormLayout(self.webProxyTab)
self.bibleComboBox.addItem(u'') self.webProxyLayout.setObjectName(u'WebProxyLayout')
self.bibleComboBox.addItem(u'') self.webServerLabel = QtGui.QLabel(self.webProxyTab)
self.downloadOptionsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.webServerLabel.setObjectName(u'WebServerLabel')
self.bibleComboBox) self.webProxyLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.webDownloadTabWidget.addTab(self.downloadOptionsTab, u'') self.webServerLabel)
self.proxyServerTab = QtGui.QWidget() self.webServerEdit = QtGui.QLineEdit(self.webProxyTab)
self.proxyServerTab.setObjectName(u'ProxyServerTab') self.webServerEdit.setObjectName(u'WebServerEdit')
self.proxyServerLayout = QtGui.QFormLayout(self.proxyServerTab) self.webProxyLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.proxyServerLayout.setObjectName(u'ProxyServerLayout') self.webServerEdit)
self.addressLabel = QtGui.QLabel(self.proxyServerTab) self.webUserLabel = QtGui.QLabel(self.webProxyTab)
self.addressLabel.setObjectName(u'AddressLabel') self.webUserLabel.setObjectName(u'WebUserLabel')
self.proxyServerLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.webProxyLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.addressLabel) self.webUserLabel)
self.addressEdit = QtGui.QLineEdit(self.proxyServerTab) self.webUserEdit = QtGui.QLineEdit(self.webProxyTab)
self.addressEdit.setObjectName(u'AddressEdit') self.webUserEdit.setObjectName(u'WebUserEdit')
self.proxyServerLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.webProxyLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.addressEdit) self.webUserEdit)
self.usernameLabel = QtGui.QLabel(self.proxyServerTab) self.webPasswordLabel = QtGui.QLabel(self.webProxyTab)
self.usernameLabel.setObjectName(u'UsernameLabel') self.webPasswordLabel.setObjectName(u'WebPasswordLabel')
self.proxyServerLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.webProxyLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.usernameLabel) self.webPasswordLabel)
self.usernameEdit = QtGui.QLineEdit(self.proxyServerTab) self.webPasswordEdit = QtGui.QLineEdit(self.webProxyTab)
self.usernameEdit.setObjectName(u'UsernameEdit') self.webPasswordEdit.setObjectName(u'WebPasswordEdit')
self.proxyServerLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.webProxyLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
self.usernameEdit) self.webPasswordEdit)
self.passwordLabel = QtGui.QLabel(self.proxyServerTab) self.webTabWidget.addTab(self.webProxyTab, u'')
self.passwordLabel.setObjectName(u'PasswordLabel') self.selectStack.addWidget(self.webTabWidget)
self.proxyServerLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.openlp1Widget = QtGui.QWidget(self.selectPage)
self.passwordLabel) self.openlp1Widget.setObjectName(u'Openlp1Widget')
self.passwordEdit = QtGui.QLineEdit(self.proxyServerTab) self.openlp1Layout = QtGui.QFormLayout(self.openlp1Widget)
self.passwordEdit.setObjectName(u'PasswordEdit')
self.proxyServerLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
self.passwordEdit)
self.webDownloadTabWidget.addTab(self.proxyServerTab, u'')
self.webDownloadLayout.addWidget(self.webDownloadTabWidget)
self.formatWidget.addWidget(self.webDownloadPage)
self.openlp1Page = QtGui.QWidget()
self.openlp1Page.setObjectName(u'Openlp1Page')
self.openlp1Layout = QtGui.QFormLayout(self.openlp1Page)
self.openlp1Layout.setFieldGrowthPolicy(
QtGui.QFormLayout.ExpandingFieldsGrow)
self.openlp1Layout.setMargin(0) self.openlp1Layout.setMargin(0)
self.openlp1Layout.setSpacing(8)
self.openlp1Layout.setObjectName(u'Openlp1Layout') self.openlp1Layout.setObjectName(u'Openlp1Layout')
self.openlp1LocationLabel = QtGui.QLabel(self.openlp1Page) self.openlp1FileLabel = QtGui.QLabel(self.openlp1Widget)
self.openlp1LocationLabel.setObjectName(u'Openlp1LocationLabel') self.openlp1FileLabel.setObjectName(u'Openlp1FileLabel')
self.openlp1Layout.setWidget(1, QtGui.QFormLayout.LabelRole, self.openlp1FileLayout = QtGui.QHBoxLayout()
self.openlp1LocationLabel) self.openlp1FileLayout.setObjectName(u'Openlp1FileLayout')
self.openlp1LocationLayout = QtGui.QHBoxLayout() self.openlp1FileEdit = QtGui.QLineEdit(self.openlp1Widget)
self.openlp1LocationLayout.setSpacing(8) self.openlp1FileEdit.setObjectName(u'Openlp1FileEdit')
self.openlp1LocationLayout.setObjectName(u'Openlp1LocationLayout') self.openlp1FileLayout.addWidget(self.openlp1FileEdit)
self.openlp1LocationEdit = QtGui.QLineEdit(self.openlp1Page) self.openlp1BrowseButton = QtGui.QToolButton(self.openlp1Widget)
self.openlp1LocationEdit.setObjectName(u'Openlp1LocationEdit') self.openlp1BrowseButton.setIcon(
self.openlp1LocationLayout.addWidget(self.openlp1LocationEdit) build_icon(u':/general/general_open.png'))
self.openlp1FileButton = QtGui.QToolButton(self.openlp1Page) self.openlp1BrowseButton.setObjectName(u'Openlp1BrowseButton')
self.openlp1FileButton.setMaximumSize(QtCore.QSize(32, 16777215)) self.openlp1FileLayout.addWidget(self.openlp1BrowseButton)
self.openlp1FileButton.setIcon(generalIcon) self.openlp1Layout.addRow(self.openlp1FileLabel, self.openlp1FileLayout)
self.openlp1FileButton.setObjectName(u'Openlp1FileButton') self.openlp1DisabledLabel = QtGui.QLabel(self.openlp1Widget)
self.openlp1LocationLayout.addWidget(self.openlp1FileButton)
self.openlp1Layout.setLayout(1, QtGui.QFormLayout.FieldRole,
self.openlp1LocationLayout)
self.openlp1DisabledLabel = QtGui.QLabel(self.openlp1Page)
self.openlp1DisabledLabel.setObjectName(u'openlp1DisabledLabel')
self.openlp1DisabledLabel.setVisible(False)
self.openlp1DisabledLabel.setWordWrap(True) self.openlp1DisabledLabel.setWordWrap(True)
self.openlp1Layout.addWidget(self.openlp1DisabledLabel) self.openlp1DisabledLabel.setObjectName(u'Openlp1DisabledLabel')
self.formatWidget.addWidget(self.openlp1Page) self.openlp1Layout.addRow(self.openlp1DisabledLabel)
self.selectPageLayout.addWidget(self.formatWidget) self.openlp1Spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Minimum)
self.openlp1Layout.setItem(1, QtGui.QFormLayout.LabelRole,
self.openlp1Spacer)
self.selectStack.addWidget(self.openlp1Widget)
self.selectPageLayout.addLayout(self.selectStack)
bibleImportWizard.addPage(self.selectPage) bibleImportWizard.addPage(self.selectPage)
# License page # License Page
self.licenseDetailsPage = QtGui.QWizardPage() self.licenseDetailsPage = QtGui.QWizardPage()
self.licenseDetailsPage.setObjectName(u'LicenseDetailsPage') self.licenseDetailsPage.setObjectName(u'LicenseDetailsPage')
self.licenseDetailsLayout = QtGui.QFormLayout(self.licenseDetailsPage) self.licenseDetailsLayout = QtGui.QFormLayout(self.licenseDetailsPage)
self.licenseDetailsLayout.setMargin(20)
self.licenseDetailsLayout.setSpacing(8)
self.licenseDetailsLayout.setObjectName(u'LicenseDetailsLayout') self.licenseDetailsLayout.setObjectName(u'LicenseDetailsLayout')
self.versionNameLabel = QtGui.QLabel(self.licenseDetailsPage) self.versionNameLabel = QtGui.QLabel(self.licenseDetailsPage)
self.versionNameLabel.setObjectName(u'VersionNameLabel') self.versionNameLabel.setObjectName(u'VersionNameLabel')
@ -320,29 +267,24 @@ class Ui_BibleImportWizard(object):
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
self.permissionsEdit) self.permissionsEdit)
bibleImportWizard.addPage(self.licenseDetailsPage) bibleImportWizard.addPage(self.licenseDetailsPage)
# Progress page # Progress Page
self.importPage = QtGui.QWizardPage() self.importPage = QtGui.QWizardPage()
self.importPage.setObjectName(u'ImportPage') self.importPage.setObjectName(u'ImportPage')
self.importLayout = QtGui.QVBoxLayout(self.importPage) self.importLayout = QtGui.QVBoxLayout(self.importPage)
self.importLayout.setSpacing(8) self.importLayout.setMargin(48)
self.importLayout.setMargin(50)
self.importLayout.setObjectName(u'ImportLayout') self.importLayout.setObjectName(u'ImportLayout')
self.importProgressLabel = QtGui.QLabel(self.importPage) self.importProgressLabel = QtGui.QLabel(self.importPage)
self.importProgressLabel.setObjectName(u'ImportProgressLabel') self.importProgressLabel.setObjectName(u'ImportProgressLabel')
self.importLayout.addWidget(self.importProgressLabel) self.importLayout.addWidget(self.importProgressLabel)
self.importProgressBar = QtGui.QProgressBar(self.importPage) self.importProgressBar = QtGui.QProgressBar(self.importPage)
self.importProgressBar.setValue(0)
self.importProgressBar.setObjectName(u'ImportProgressBar') self.importProgressBar.setObjectName(u'ImportProgressBar')
self.importLayout.addWidget(self.importProgressBar) self.importLayout.addWidget(self.importProgressBar)
bibleImportWizard.addPage(self.importPage) bibleImportWizard.addPage(self.importPage)
self.retranslateUi(bibleImportWizard) self.retranslateUi(bibleImportWizard)
self.formatWidget.setCurrentIndex(0)
self.webDownloadTabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.formatComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.formatWidget.setCurrentIndex)
QtCore.QMetaObject.connectSlotsByName(bibleImportWizard) QtCore.QMetaObject.connectSlotsByName(bibleImportWizard)
QtCore.QObject.connect(self.formatComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), self.selectStack,
QtCore.SLOT(u'setCurrentIndex(int)'))
def retranslateUi(self, bibleImportWizard): def retranslateUi(self, bibleImportWizard):
bibleImportWizard.setWindowTitle( bibleImportWizard.setWindowTitle(
@ -373,37 +315,37 @@ class Ui_BibleImportWizard(object):
translate('BiblesPlugin.ImportWizardForm', 'Web Download')) translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
self.formatComboBox.setItemText(4, self.formatComboBox.setItemText(4,
translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x')) translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x'))
self.openlp1LocationLabel.setText( self.openlp1FileLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'File location:')) translate('BiblesPlugin.ImportWizardForm', 'File location:'))
self.osisLocationLabel.setText( self.osisFileLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'File location:')) translate('BiblesPlugin.ImportWizardForm', 'File location:'))
self.booksLocationLabel.setText( self.csvBooksLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Books location:')) translate('BiblesPlugin.ImportWizardForm', 'Books location:'))
self.verseLocationLabel.setText( self.csvVersesLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Verse location:')) translate('BiblesPlugin.ImportWizardForm', 'Verse location:'))
self.openSongFileLabel.setText( self.openSongFileLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Bible filename:')) translate('BiblesPlugin.ImportWizardForm', 'Bible filename:'))
self.locationLabel.setText( self.webSourceLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Location:')) translate('BiblesPlugin.ImportWizardForm', 'Location:'))
self.locationComboBox.setItemText(0, self.webSourceComboBox.setItemText(0,
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk')) translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
self.locationComboBox.setItemText(1, self.webSourceComboBox.setItemText(1,
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway')) translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
self.locationComboBox.setItemText(2, self.webSourceComboBox.setItemText(2,
translate('BiblesPlugin.ImportWizardForm', 'Bibleserver')) translate('BiblesPlugin.ImportWizardForm', 'Bibleserver'))
self.bibleLabel.setText( self.webTranslationLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Bible:')) translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
self.webDownloadTabWidget.setTabText( self.webTabWidget.setTabText(
self.webDownloadTabWidget.indexOf(self.downloadOptionsTab), self.webTabWidget.indexOf(self.webBibleTab),
translate('BiblesPlugin.ImportWizardForm', 'Download Options')) translate('BiblesPlugin.ImportWizardForm', 'Download Options'))
self.addressLabel.setText( self.webServerLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Server:')) translate('BiblesPlugin.ImportWizardForm', 'Server:'))
self.usernameLabel.setText( self.webUserLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Username:')) translate('BiblesPlugin.ImportWizardForm', 'Username:'))
self.passwordLabel.setText( self.webPasswordLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Password:')) translate('BiblesPlugin.ImportWizardForm', 'Password:'))
self.webDownloadTabWidget.setTabText( self.webTabWidget.setTabText(
self.webDownloadTabWidget.indexOf(self.proxyServerTab), self.webTabWidget.indexOf(self.webProxyTab),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'Proxy Server (Optional)')) 'Proxy Server (Optional)'))
self.licenseDetailsPage.setTitle( self.licenseDetailsPage.setTitle(
@ -430,3 +372,20 @@ class Ui_BibleImportWizard(object):
'importer has been disabled due to a missing Python module. If ' 'importer has been disabled due to a missing Python module. If '
'you want to use this importer, you will need to install the ' 'you want to use this importer, you will need to install the '
'"python-sqlite" module.')) '"python-sqlite" module.'))
# Align all QFormLayouts towards each other.
width = max(self.formatLabel.minimumSizeHint().width(),
self.osisFileLabel.minimumSizeHint().width())
width = max(width, self.csvBooksLabel.minimumSizeHint().width())
width = max(width, self.csvVersesLabel.minimumSizeHint().width())
width = max(width, self.openSongFileLabel.minimumSizeHint().width())
width = max(width, self.openlp1FileLabel.minimumSizeHint().width())
self.formatSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
self.osisSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
self.csvSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
self.openSongSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
self.openlp1Spacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -77,9 +77,9 @@ def parse_reference(reference):
- After a verse reference all further single values are treat as verse in - After a verse reference all further single values are treat as verse in
the last selected chapter. the last selected chapter.
``John 3:16-18`` refers to John chapter 3 verses 16 to 18 ``John 3:16-18`` refers to John chapter 3 verses 16 to 18
- After a list separator it is possible to refer to additional verses. They - After a list separator it is possible to refer to additional verses. They
are build analog to the first ones. This way it is possible to define each are build analog to the first ones. This way it is possible to define
number of verse references. It is not possible to refer to verses in each number of verse references. It is not possible to refer to verses in
additional books. additional books.
``John 3:16,18`` refers to John chapter 3 verses 16 and 18 ``John 3:16,18`` refers to John chapter 3 verses 16 and 18
``John 3:16-18,20`` refers to John chapter 3 verses 16 to 18 and 20 ``John 3:16-18,20`` refers to John chapter 3 verses 16 to 18 and 20
@ -96,7 +96,7 @@ def parse_reference(reference):
a verse separator. a verse separator.
2. ``(?P<from_verse>[0-9]+)`` 2. ``(?P<from_verse>[0-9]+)``
The verse reference ``from_verse`` is manditory The verse reference ``from_verse`` is manditory
3. ``(?P<range_to>%(sep_r)s(?:`` ... ``|%(sep_e)s)?)?`` 3. ``(?P<range_to>%(sep_r)s(?:`` ... ``|%(sep_e)s)?)?``
A ``range_to`` declaration is optional. It starts with a range separator A ``range_to`` declaration is optional. It starts with a range separator
and contains optional a chapter and verse declaration or a end and contains optional a chapter and verse declaration or a end
separator. separator.
@ -105,15 +105,15 @@ def parse_reference(reference):
5. ``(?P<to_verse>[0-9]+)`` 5. ``(?P<to_verse>[0-9]+)``
The ``to_verse`` reference is equivalent to group 2. The ``to_verse`` reference is equivalent to group 2.
The full reference is matched against get_reference_match(u'full'). This The full reference is matched against get_reference_match(u'full'). This
regular expression looks like this: regular expression looks like this:
1. ``^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*`` 1. ``^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*``
The ``book`` group starts with the first non-whitespace character. There The ``book`` group starts with the first non-whitespace character. There
are optional leading digits followed by non-digits. The group ends are optional leading digits followed by non-digits. The group ends
before the whitspace in front of the next digit. before the whitspace in front of the next digit.
2. ``(?P<ranges>(?:`` + range_string + ``(?:%(sep_l)s|(?=\s*$)))+)\s*$`` 2. ``(?P<ranges>(?:`` + range_string + ``(?:%(sep_l)s|(?=\s*$)))+)\s*$``
The second group contains all ``ranges``. This can be multiple The second group contains all ``ranges``. This can be multiple
declarations of a range_string separated by a list separator. declarations of a range_string separated by a list separator.
The reference list is a list of tuples, with each tuple structured like The reference list is a list of tuples, with each tuple structured like
@ -126,7 +126,7 @@ def parse_reference(reference):
Returns None or a reference list. Returns None or a reference list.
""" """
log.debug('parse_reference("%s")', reference) log.debug(u'parse_reference("%s")', reference)
match = get_reference_match(u'full').match(reference) match = get_reference_match(u'full').match(reference)
if match: if match:
log.debug(u'Matched reference %s' % reference) log.debug(u'Matched reference %s' % reference)
@ -194,7 +194,7 @@ def parse_reference(reference):
class SearchResults(object): class SearchResults(object):
""" """
Encapsulate a set of search results. This is Bible-type independent. Encapsulate a set of search results. This is Bible-type independent.
""" """
def __init__(self, book, chapter, verselist): def __init__(self, book, chapter, verselist):
""" """

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -251,4 +251,4 @@ class BiblesTab(SettingsTab):
# Not Found. # Not Found.
index = 0 index = 0
self.bible_theme = u'' self.bible_theme = u''
self.BibleThemeComboBox.setCurrentIndex(index) self.BibleThemeComboBox.setCurrentIndex(index)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -72,7 +72,7 @@ class CSVBible(BibleDB):
self.create_book(unicode(line[1], details['encoding']), self.create_book(unicode(line[1], details['encoding']),
line[2], int(line[0])) line[2], int(line[0]))
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
except IOError: except IOError, IndexError:
log.exception(u'Loading books from file failed') log.exception(u'Loading books from file failed')
success = False success = False
finally: finally:
@ -86,15 +86,17 @@ class CSVBible(BibleDB):
verse_file.seek(0) verse_file.seek(0)
verse_reader = csv.reader(verse_file, dialect) verse_reader = csv.reader(verse_file, dialect)
for line in verse_reader: for line in verse_reader:
if self.stop_import_flag: # cancel pressed if self.stop_import_flag:
# cancel pressed
break break
details = chardet.detect(line[3]) details = chardet.detect(line[3])
if book_ptr != line[0]: if book_ptr != line[0]:
book = self.get_book(line[0]) book = self.get_book(line[0])
book_ptr = book.name book_ptr = book.name
self.wizard.incrementProgressBar(u'%s %s %s...' % ( self.wizard.incrementProgressBar(unicode(translate(
translate('BiblesPlugin.CSVImport', 'Importing'), 'BiblesPlugin.CSVImport', 'Importing %s %s...',
book.name, line[1])) 'Importing <book name> <chapter>...')) %
(book.name, int(line[1])))
self.session.commit() self.session.commit()
self.create_verse(book.id, line[1], line[2], self.create_verse(book.id, line[1], line[2],
unicode(line[3], details['encoding'])) unicode(line[3], details['encoding']))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -33,7 +33,7 @@ from sqlalchemy import Column, ForeignKey, or_, Table, types
from sqlalchemy.orm import class_mapper, mapper, relation from sqlalchemy.orm import class_mapper, mapper, relation
from sqlalchemy.orm.exc import UnmappedClassError from sqlalchemy.orm.exc import UnmappedClassError
from openlp.core.lib import translate from openlp.core.lib import Receiver, translate
from openlp.core.lib.db import BaseModel, init_db, Manager from openlp.core.lib.db import BaseModel, init_db, Manager
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -166,7 +166,7 @@ class BibleDB(QtCore.QObject, Manager):
""" """
Stops the import of the Bible. Stops the import of the Bible.
""" """
log.debug('Stopping import') log.debug(u'Stopping import')
self.stop_import_flag = True self.stop_import_flag = True
def get_name(self): def get_name(self):
@ -354,12 +354,12 @@ class BibleDB(QtCore.QObject, Manager):
verse_list.extend(verses) verse_list.extend(verses)
else: else:
log.debug(u'OpenLP failed to find book %s', book) log.debug(u'OpenLP failed to find book %s', book)
QtGui.QMessageBox.information(self.bible_plugin.mediaItem, Receiver.send_message(u'openlp_error_message', {
translate('BiblesPlugin.BibleDB', 'Book not found'), u'title': translate('BiblesPlugin', 'No Book Found'),
translate('BiblesPlugin.BibleDB', 'The book you requested ' u'message': translate('BiblesPlugin', 'No matching book '
'could not be found in this Bible. Please check your ' 'could be found in this Bible. Check that you have '
'spelling and that this is a complete Bible not just ' 'spelled the name of the book correctly.')
'one testament.')) })
return verse_list return verse_list
def verse_search(self, text): def verse_search(self, text):
@ -430,7 +430,7 @@ class BibleDB(QtCore.QObject, Manager):
Utility debugging method to dump the contents of a bible. Utility debugging method to dump the contents of a bible.
""" """
log.debug(u'.........Dumping Bible Database') log.debug(u'.........Dumping Bible Database')
log.debug('...............................Books ') log.debug(u'...............................Books ')
books = self.session.query(Book).all() books = self.session.query(Book).all()
log.debug(books) log.debug(books)
log.debug(u'...............................Verses ') log.debug(u'...............................Verses ')

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -28,13 +28,14 @@ import logging
import os import os
import re import re
import sqlite3 import sqlite3
import socket
import urllib import urllib
import urllib2 import urllib2
from HTMLParser import HTMLParseError from HTMLParser import HTMLParseError
from BeautifulSoup import BeautifulSoup, NavigableString from BeautifulSoup import BeautifulSoup, NavigableString
from openlp.core.lib import Receiver from openlp.core.lib import Receiver, translate
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib import SearchResults from openlp.plugins.bibles.lib import SearchResults
from openlp.plugins.bibles.lib.db import BibleDB, Book from openlp.plugins.bibles.lib.db import BibleDB, Book
@ -184,6 +185,7 @@ class BGExtract(object):
def __init__(self, proxyurl=None): def __init__(self, proxyurl=None):
log.debug(u'init %s', proxyurl) log.debug(u'init %s', proxyurl)
self.proxyurl = proxyurl self.proxyurl = proxyurl
socket.setdefaulttimeout(30)
def get_bible_chapter(self, version, bookname, chapter): def get_bible_chapter(self, version, bookname, chapter):
""" """
@ -210,6 +212,13 @@ class BGExtract(object):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
except urllib2.URLError: except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.') log.exception(u'The web bible page could not be downloaded.')
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'consider reporting a bug.')
})
finally: finally:
if not page: if not page:
return None return None
@ -219,6 +228,7 @@ class BGExtract(object):
soup = BeautifulSoup(page, markupMassage=cleaner) soup = BeautifulSoup(page, markupMassage=cleaner)
except HTMLParseError: except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.') log.exception(u'BeautifulSoup could not parse the bible page.')
Receiver.send_message(u'bibles_download_error')
finally: finally:
if not soup: if not soup:
return None return None
@ -247,6 +257,7 @@ class BSExtract(object):
def __init__(self, proxyurl=None): def __init__(self, proxyurl=None):
log.debug(u'init %s', proxyurl) log.debug(u'init %s', proxyurl)
self.proxyurl = proxyurl self.proxyurl = proxyurl
socket.setdefaulttimeout(30)
def get_bible_chapter(self, version, bookname, chapter): def get_bible_chapter(self, version, bookname, chapter):
""" """
@ -264,7 +275,7 @@ class BSExtract(object):
log.debug(u'get_bible_chapter %s,%s,%s', version, bookname, chapter) log.debug(u'get_bible_chapter %s,%s,%s', version, bookname, chapter)
chapter_url = u'http://m.bibleserver.com/text/%s/%s%s' % \ chapter_url = u'http://m.bibleserver.com/text/%s/%s%s' % \
(version, bookname, chapter) (version, bookname, chapter)
log.debug(u'URL: %s', chapter_url) log.debug(u'URL: %s', chapter_url)
page = None page = None
try: try:
@ -272,6 +283,13 @@ class BSExtract(object):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
except urllib2.URLError: except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.') log.exception(u'The web bible page could not be downloaded.')
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'consider reporting a bug.')
})
finally: finally:
if not page: if not page:
return None return None
@ -280,9 +298,13 @@ class BSExtract(object):
soup = BeautifulSoup(page) soup = BeautifulSoup(page)
except HTMLParseError: except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.') log.exception(u'BeautifulSoup could not parse the bible page.')
finally: Receiver.send_message(u'openlp_error_message', {
if not soup: u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
return None u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem extracting your verse selection. If this error '
'continues to occur consider reporting a bug.')
})
return None
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
content = None content = None
try: try:
@ -308,6 +330,7 @@ class CWExtract(object):
def __init__(self, proxyurl=None): def __init__(self, proxyurl=None):
log.debug(u'init %s', proxyurl) log.debug(u'init %s', proxyurl)
self.proxyurl = proxyurl self.proxyurl = proxyurl
socket.setdefaulttimeout(30)
def get_bible_chapter(self, version, bookname, chapter): def get_bible_chapter(self, version, bookname, chapter):
""" """
@ -333,17 +356,26 @@ class CWExtract(object):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
except urllib2.URLError: except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.') log.exception(u'The web bible page could not be downloaded.')
finally: Receiver.send_message(u'openlp_error_message', {
if not page: u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
return None u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'consider reporting a bug.')
})
return None
soup = None soup = None
try: try:
soup = BeautifulSoup(page) soup = BeautifulSoup(page)
except HTMLParseError: except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.') log.exception(u'BeautifulSoup could not parse the bible page.')
finally: Receiver.send_message(u'openlp_error_message', {
if not soup: u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
return None u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem extracting your verse selection. If this error '
'continues to occur consider reporting a bug.')
})
return None
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
htmlverses = soup.findAll(u'span', u'versetext') htmlverses = soup.findAll(u'span', u'versetext')
verses = {} verses = {}
@ -447,13 +479,18 @@ class HTTPBible(BibleDB):
[(u'Genesis', 1, 1, 1), (u'Genesis', 2, 2, 3)] [(u'Genesis', 1, 1, 1), (u'Genesis', 2, 2, 3)]
""" """
for reference in reference_list: for reference in reference_list:
log.debug('Reference: %s', reference) log.debug(u'Reference: %s', reference)
book = reference[0] book = reference[0]
db_book = self.get_book(book) db_book = self.get_book(book)
if not db_book: if not db_book:
book_details = self.lookup_book(book) book_details = self.lookup_book(book)
if not book_details: if not book_details:
Receiver.send_message(u'bibles_nobook') Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblesPlugin', 'No Book Found'),
u'message': translate('BiblesPlugin', 'No matching '
'book could be found in this Bible. Check that you'
'have spelled the name of the book correctly.')
})
return [] return []
db_book = self.create_book(book_details[u'name'], db_book = self.create_book(book_details[u'name'],
book_details[u'abbreviation'], book_details[u'abbreviation'],

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -357,4 +357,3 @@ class BibleManager(object):
BibleFormat.set_availability(BibleFormat.OpenLP1, has_openlp1) BibleFormat.set_availability(BibleFormat.OpenLP1, has_openlp1)
__all__ = [u'BibleFormat'] __all__ = [u'BibleFormat']

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -259,8 +259,6 @@ class BibleMediaItem(MediaManagerItem):
QtCore.SIGNAL(u'bibles_showprogress'), self.onSearchProgressShow) QtCore.SIGNAL(u'bibles_showprogress'), self.onSearchProgressShow)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'bibles_hideprogress'), self.onSearchProgressHide) QtCore.SIGNAL(u'bibles_hideprogress'), self.onSearchProgressHide)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'bibles_nobook'), self.onNoBookFound)
def addListViewToToolBar(self): def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self) MediaManagerItem.addListViewToToolBar(self)
@ -360,13 +358,6 @@ class BibleMediaItem(MediaManagerItem):
def onSearchProgressHide(self): def onSearchProgressHide(self):
self.SearchProgress.setVisible(False) self.SearchProgress.setVisible(False)
def onNoBookFound(self):
QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.MediaItem', 'No Book Found'),
translate('BiblesPlugin.MediaItem',
'No matching book could be found in this Bible.'))
self.AdvancedSearchButton.setEnabled(True)
def onImportClick(self): def onImportClick(self):
if not hasattr(self, u'import_wizard'): if not hasattr(self, u'import_wizard'):
self.import_wizard = BibleImportForm(self, self.parent.manager, self.import_wizard = BibleImportForm(self, self.parent.manager,
@ -912,7 +903,7 @@ class BibleMediaItem(MediaManagerItem):
old_chapter != chapter: old_chapter != chapter:
verse_text = unicode(chapter) + verse_separator + unicode(verse) verse_text = unicode(chapter) + verse_separator + unicode(verse)
else: else:
verse_text = u'%s' % verse verse_text = unicode(verse)
if self.parent.settings_tab.display_style == 1: if self.parent.settings_tab.display_style == 1:
verse_text = u'{su}(' + verse_text + u'){/su}' verse_text = u'{su}(' + verse_text + u'){/su}'
elif self.parent.settings_tab.display_style == 2: elif self.parent.settings_tab.display_style == 2:

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -73,8 +73,8 @@ class OpenLP1Bible(BibleDB):
abbreviation = unicode(book[3], u'cp1252') abbreviation = unicode(book[3], u'cp1252')
self.create_book(name, abbreviation, testament_id) self.create_book(name, abbreviation, testament_id)
# Update the progess bar. # Update the progess bar.
self.wizard.incrementProgressBar(u'%s %s...' % (translate( self.wizard.incrementProgressBar(unicode(translate(
'BiblesPlugin.OpenLP1Import', 'Importing'), name)) 'BiblesPlugin.OpenLP1Import', 'Importing %s...')) % name)
# Import the verses for this book. # Import the verses for this book.
cursor.execute(u'SELECT chapter, verse, text || \'\' AS text FROM ' cursor.execute(u'SELECT chapter, verse, text || \'\' AS text FROM '
'verse WHERE book_id=%s' % book_id) 'verse WHERE book_id=%s' % book_id)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -84,11 +84,12 @@ class OpenSongBible(BibleDB):
unicode(verse.text) unicode(verse.text)
) )
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
self.wizard.incrementProgressBar(u'%s %s %s...' % ( self.wizard.incrementProgressBar(unicode(translate(
translate('BiblesPlugin.Opensong', 'Importing'), 'BiblesPlugin.Opensong', 'Importing %s %s...',
db_book.name, chapter.attrib[u'n'])) 'Importing <book name> <chapter>...')) %
(db_book.name, int(chapter.attrib[u'n'])))
self.session.commit() self.session.commit()
except IOError: except IOError, AttributeError:
log.exception(u'Loading bible from OpenSong file failed') log.exception(u'Loading bible from OpenSong file failed')
success = False success = False
finally: finally:

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -125,7 +125,7 @@ class OSISBible(BibleDB):
verse = int(match.group(3)) verse = int(match.group(3))
verse_text = match.group(4) verse_text = match.group(4)
if not db_book or db_book.name != self.books[book][0]: if not db_book or db_book.name != self.books[book][0]:
log.debug('New book: "%s"', self.books[book][0]) log.debug(u'New book: "%s"', self.books[book][0])
if book == u'Matt': if book == u'Matt':
testament += 1 testament += 1
db_book = self.create_book( db_book = self.create_book(
@ -140,9 +140,10 @@ class OSISBible(BibleDB):
if last_chapter != chapter: if last_chapter != chapter:
if last_chapter != 0: if last_chapter != 0:
self.session.commit() self.session.commit()
self.wizard.incrementProgressBar(u'%s %s %s...' % ( self.wizard.incrementProgressBar(unicode(translate(
translate('BiblesPlugin.OsisImport', 'Importing'), 'BiblesPlugin.OsisImport', 'Importing %s %s...',
self.books[match.group(1)][0], chapter)) 'Importing <book name> <chapter>...')) %
(self.books[match.group(1)][0], chapter))
last_chapter = chapter last_chapter = chapter
# All of this rigmarol below is because the mod2osis # All of this rigmarol below is because the mod2osis
# tool from the Sword library embeds XML in the OSIS # tool from the Sword library embeds XML in the OSIS

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -27,4 +27,4 @@
The :mod:`custom` module provides the Custom plugin which allows custom, The :mod:`custom` module provides the Custom plugin which allows custom,
themed, text based items to be displayed without having to misuse another item themed, text based items to be displayed without having to misuse another item
type. type.
""" """

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -47,7 +47,7 @@ class CustomPlugin(Plugin):
log.info(u'Custom Plugin loaded') log.info(u'Custom Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Custom', u'1.9.3', plugin_helpers) Plugin.__init__(self, u'Custom', u'1.9.4', plugin_helpers)
self.weight = -5 self.weight = -5
self.manager = Manager(u'custom', init_schema) self.manager = Manager(u'custom', init_schema)
self.edit_custom_form = EditCustomForm(self.manager) self.edit_custom_form = EditCustomForm(self.manager)
@ -104,57 +104,57 @@ class CustomPlugin(Plugin):
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.textStrings[StringContent.Name] = {
u'singular': translate('CustomsPlugin', 'Custom'), u'singular': translate('CustomsPlugin', 'Custom', 'name singular'),
u'plural': translate('CustomsPlugin', 'Customs') u'plural': translate('CustomsPlugin', 'Customs', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.textStrings[StringContent.VisibleName] = {
u'title': translate('CustomsPlugin', 'Custom') u'title': translate('CustomsPlugin', 'Custom', 'container title')
} }
# Middle Header Bar # Middle Header Bar
## Import Button ## ## Import Action ##
self.textStrings[StringContent.Import] = { self.textStrings[StringContent.Import] = {
u'title': translate('CustomsPlugin', 'Import'), u'title': translate('CustomsPlugin', 'Import'),
u'tooltip': translate('CustomsPlugin', u'tooltip': translate('CustomsPlugin',
'Import a Custom') 'Import a Custom')
} }
## Load Button ## ## Load Action ##
self.textStrings[StringContent.Load] = { self.textStrings[StringContent.Load] = {
u'title': translate('CustomsPlugin', 'Load'), u'title': translate('CustomsPlugin', 'Load'),
u'tooltip': translate('CustomsPlugin', u'tooltip': translate('CustomsPlugin',
'Load a new Custom') 'Load a new Custom')
} }
## New Button ## ## New Action ##
self.textStrings[StringContent.New] = { self.textStrings[StringContent.New] = {
u'title': translate('CustomsPlugin', 'Add'), u'title': translate('CustomsPlugin', 'Add'),
u'tooltip': translate('CustomsPlugin', u'tooltip': translate('CustomsPlugin',
'Add a new Custom') 'Add a new Custom')
} }
## Edit Button ## ## Edit Action ##
self.textStrings[StringContent.Edit] = { self.textStrings[StringContent.Edit] = {
u'title': translate('CustomsPlugin', 'Edit'), u'title': translate('CustomsPlugin', 'Edit'),
u'tooltip': translate('CustomsPlugin', u'tooltip': translate('CustomsPlugin',
'Edit the selected Custom') 'Edit the selected Custom')
} }
## Delete Button ## ## Delete Action ##
self.textStrings[StringContent.Delete] = { self.textStrings[StringContent.Delete] = {
u'title': translate('CustomsPlugin', 'Delete'), u'title': translate('CustomsPlugin', 'Delete'),
u'tooltip': translate('CustomsPlugin', u'tooltip': translate('CustomsPlugin',
'Delete the selected Custom') 'Delete the selected Custom')
} }
## Preview ## ## Preview Action ##
self.textStrings[StringContent.Preview] = { self.textStrings[StringContent.Preview] = {
u'title': translate('CustomsPlugin', 'Preview'), u'title': translate('CustomsPlugin', 'Preview'),
u'tooltip': translate('CustomsPlugin', u'tooltip': translate('CustomsPlugin',
'Preview the selected Custom') 'Preview the selected Custom')
} }
## Live Button ## ## Send Live Action ##
self.textStrings[StringContent.Live] = { self.textStrings[StringContent.Live] = {
u'title': translate('CustomsPlugin', 'Live'), u'title': translate('CustomsPlugin', 'Live'),
u'tooltip': translate('CustomsPlugin', u'tooltip': translate('CustomsPlugin',
'Send the selected Custom live') 'Send the selected Custom live')
} }
## Add to service Button ## ## Add to Service Action ##
self.textStrings[StringContent.Service] = { self.textStrings[StringContent.Service] = {
u'title': translate('CustomsPlugin', 'Service'), u'title': translate('CustomsPlugin', 'Service'),
u'tooltip': translate('CustomsPlugin', u'tooltip': translate('CustomsPlugin',

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -25,4 +25,4 @@
############################################################################### ###############################################################################
from editcustomform import EditCustomForm from editcustomform import EditCustomForm
from editcustomslideform import EditCustomSlideForm from editcustomslideform import EditCustomSlideForm

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -152,4 +152,4 @@ class Ui_CustomEditDialog(object):
self.themeLabel.setText( self.themeLabel.setText(
translate('CustomPlugin.EditCustomForm', 'The&me:')) translate('CustomPlugin.EditCustomForm', 'The&me:'))
self.creditLabel.setText( self.creditLabel.setText(
translate('CustomPlugin.EditCustomForm', '&Credits:')) translate('CustomPlugin.EditCustomForm', '&Credits:'))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -265,4 +265,4 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
if self.slideListView.count() == 0: if self.slideListView.count() == 0:
return False, translate('CustomPlugin.EditCustomForm', return False, translate('CustomPlugin.EditCustomForm',
'You need to add at least one slide') 'You need to add at least one slide')
return True, u'' return True, u''

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -56,4 +56,4 @@ class Ui_CustomSlideEditDialog(object):
translate('CustomPlugin.EditCustomForm', 'Split Slide')) translate('CustomPlugin.EditCustomForm', 'Split Slide'))
self.splitButton.setToolTip( self.splitButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Split a slide into two ' translate('CustomPlugin.EditCustomForm', 'Split a slide into two '
'by inserting a slide splitter.')) 'by inserting a slide splitter.'))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -72,4 +72,4 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
if self.slideTextEdit.textCursor().columnNumber() != 0: if self.slideTextEdit.textCursor().columnNumber() != 0:
self.slideTextEdit.insertPlainText(u'\n') self.slideTextEdit.insertPlainText(u'\n')
self.slideTextEdit.insertPlainText(u'[---]\n' ) self.slideTextEdit.insertPlainText(u'[---]\n' )
self.slideTextEdit.setFocus() self.slideTextEdit.setFocus()

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -26,4 +26,4 @@
from customxmlhandler import CustomXMLBuilder, CustomXMLParser from customxmlhandler import CustomXMLBuilder, CustomXMLParser
from mediaitem import CustomMediaItem from mediaitem import CustomMediaItem
from customtab import CustomTab from customtab import CustomTab

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -76,4 +76,4 @@ class CustomTab(SettingsTab):
def save(self): def save(self):
QtCore.QSettings().setValue(self.settingsSection + u'/display footer', QtCore.QSettings().setValue(self.settingsSection + u'/display footer',
QtCore.QVariant(self.displayFooter)) QtCore.QVariant(self.displayFooter))

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -153,4 +153,4 @@ class CustomXMLParser(object):
""" """
Debugging aid to dump XML so that we can see what we have. Debugging aid to dump XML so that we can see what we have.
""" """
return dump(self.custom_xml) return dump(self.custom_xml)

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -59,4 +59,4 @@ def init_schema(url):
mapper(CustomSlide, custom_slide_table) mapper(CustomSlide, custom_slide_table)
metadata.create_all(checkfirst=True) metadata.create_all(checkfirst=True)
return session return session

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -182,4 +182,4 @@ class CustomMediaItem(MediaManagerItem):
else: else:
raw_footer.append(u'') raw_footer.append(u'')
service_item.raw_footer = raw_footer service_item.raw_footer = raw_footer
return True return True

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -26,4 +26,4 @@
""" """
The :mod:`images` module provides the Images plugin. The Images plugin The :mod:`images` module provides the Images plugin. The Images plugin
provides the facility to display images from OpenLP. provides the facility to display images from OpenLP.
""" """

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -41,7 +41,7 @@ class ImagePlugin(Plugin):
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the MediaManagerItem object # Create the MediaManagerItem object.
return ImageMediaItem(self, self, self.icon) return ImageMediaItem(self, self, self.icon)
def about(self): def about(self):
@ -64,12 +64,12 @@ class ImagePlugin(Plugin):
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.textStrings[StringContent.Name] = {
u'singular': translate('ImagePlugin', 'Image'), u'singular': translate('ImagePlugin', 'Image', 'name singular'),
u'plural': translate('ImagePlugin', 'Images') u'plural': translate('ImagePlugin', 'Images', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.textStrings[StringContent.VisibleName] = {
u'title': translate('ImagePlugin', 'Images') u'title': translate('ImagePlugin', 'Images', 'container title')
} }
# Middle Header Bar # Middle Header Bar
## Load Button ## ## Load Button ##
@ -113,4 +113,4 @@ class ImagePlugin(Plugin):
u'title': translate('ImagePlugin', 'Service'), u'title': translate('ImagePlugin', 'Service'),
u'tooltip': translate('ImagePlugin', u'tooltip': translate('ImagePlugin',
'Add the selected Image to the service') 'Add the selected Image to the service')
} }

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -24,4 +24,4 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from mediaitem import ImageMediaItem from mediaitem import ImageMediaItem

View File

@ -4,8 +4,8 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
context_menu_action, ItemCapabilities, SettingsManager, translate, \ context_menu_action, ItemCapabilities, SettingsManager, translate, \
check_item_selected, Receiver check_item_selected
from openlp.core.utils import AppLocation, get_images_filter from openlp.core.utils import AppLocation, get_images_filter
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -43,6 +43,7 @@ class ImageListView(BaseListWithDnD):
self.PluginName = u'Images' self.PluginName = u'Images'
BaseListWithDnD.__init__(self, parent) BaseListWithDnD.__init__(self, parent)
class ImageMediaItem(MediaManagerItem): class ImageMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for images. This is the custom media manager item for images.
@ -51,8 +52,8 @@ class ImageMediaItem(MediaManagerItem):
def __init__(self, parent, plugin, icon): def __init__(self, parent, plugin, icon):
self.IconPath = u'images/image' self.IconPath = u'images/image'
# this next is a class, not an instance of a class - it will # This next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem # be instanced by the base MediaManagerItem.
self.ListViewWithDnD_class = ImageListView self.ListViewWithDnD_class = ImageListView
MediaManagerItem.__init__(self, parent, self, icon) MediaManagerItem.__init__(self, parent, self, icon)
@ -109,11 +110,11 @@ class ImageMediaItem(MediaManagerItem):
translate('ImagePlugin.MediaItem', 'Replace Live Background'), translate('ImagePlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick, False) self.onReplaceClick, False)
self.resetButton = self.toolbar.addToolbarButton( self.resetButton = self.toolbar.addToolbarButton(
translate('ImagePlugin.MediaItem', u'Reset Background'), translate('ImagePlugin.MediaItem', 'Reset Background'),
u':/system/system_close.png', u':/system/system_close.png',
translate('ImagePlugin.MediaItem', 'Reset Live Background'), translate('ImagePlugin.MediaItem', 'Reset Live Background'),
self.onResetClick, False) self.onResetClick, False)
# Add the song widget to the page layout # Add the song widget to the page layout.
self.pageLayout.addWidget(self.ImageWidget) self.pageLayout.addWidget(self.ImageWidget)
self.resetButton.setVisible(False) self.resetButton.setVisible(False)
@ -132,15 +133,13 @@ class ImageMediaItem(MediaManagerItem):
os.remove(os.path.join(self.servicePath, os.remove(os.path.join(self.servicePath,
unicode(text.text()))) unicode(text.text())))
except OSError: except OSError:
#if not present do not worry # if not present do not worry
pass pass
self.listView.takeItem(row) self.listView.takeItem(row)
SettingsManager.set_list(self.settingsSection, SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList()) self.settingsSection, self.getFileList())
def loadList(self, list): def loadList(self, list):
self.listView.setCursor(QtCore.Qt.BusyCursor)
Receiver.send_message(u'openlp_process_events')
for file in list: for file in list:
filename = os.path.split(unicode(file))[1] filename = os.path.split(unicode(file))[1]
thumb = os.path.join(self.servicePath, filename) thumb = os.path.join(self.servicePath, filename)
@ -155,8 +154,6 @@ class ImageMediaItem(MediaManagerItem):
item_name.setIcon(icon) item_name.setIcon(icon)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
self.listView.addItem(item_name) self.listView.addItem(item_name)
self.listView.setCursor(QtCore.Qt.ArrowCursor)
Receiver.send_message(u'openlp_process_events')
def generateSlideData(self, service_item, item=None, xmlVersion=False): def generateSlideData(self, service_item, item=None, xmlVersion=False):
items = self.listView.selectedIndexes() items = self.listView.selectedIndexes()
@ -169,6 +166,34 @@ class ImageMediaItem(MediaManagerItem):
service_item.add_capability(ItemCapabilities.AllowsAdditions) service_item.add_capability(ItemCapabilities.AllowsAdditions)
# force a nonexistent theme # force a nonexistent theme
service_item.theme = -1 service_item.theme = -1
missing_items = []
missing_items_filenames = []
for item in items:
bitem = self.listView.item(item.row())
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
if not os.path.exists(filename):
missing_items.append(item)
missing_items_filenames.append(filename)
for item in missing_items:
items.remove(item)
# We cannot continue, as all images do not exist.
if not items:
QtGui.QMessageBox.critical(self,
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
unicode(translate('ImagePlugin.MediaItem',
'The following image(s) no longer exist: %s')) %
u'\n'.join(missing_items_filenames))
return False
# We have missing as well as existing images. We ask what to do.
elif missing_items and QtGui.QMessageBox.question(self,
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
unicode(translate('ImagePlugin.MediaItem', 'The following '
'image(s) no longer exist: %s\nDo you want to add the other '
'images anyway?')) % u'\n'.join(missing_items_filenames),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
return False
# Continue with the existing images.
for item in items: for item in items:
bitem = self.listView.item(item.row()) bitem = self.listView.item(item.row())
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
@ -186,12 +211,18 @@ class ImageMediaItem(MediaManagerItem):
if check_item_selected(self.listView, if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem', translate('ImagePlugin.MediaItem',
'You must select an image to replace the background with.')): 'You must select an image to replace the background with.')):
items = self.listView.selectedIndexes() item = self.listView.selectedIndexes()[0]
for item in items: bitem = self.listView.item(item.row())
bitem = self.listView.item(item.row()) filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) if os.path.exists(filename):
(path, name) = os.path.split(filename) (path, name) = os.path.split(filename)
self.parent.liveController.display.directImage(name, filename) self.parent.liveController.display.directImage(name, filename)
else:
QtGui.QMessageBox.critical(self,
translate('ImagePlugin.MediaItem', 'Live Background Could '
'Not Be Replaced'),
unicode(translate('ImagePlugin.MediaItem',
'The image %s no longer exists.')) % filename)
self.resetButton.setVisible(True) self.resetButton.setVisible(True)
def onPreviewClick(self): def onPreviewClick(self):

Some files were not shown because too many files have changed in this diff Show More