This commit is contained in:
Andreas Preikschat 2010-08-02 12:36:54 +02:00
commit bf94cb903f
172 changed files with 47387 additions and 51872 deletions

View File

@ -18,3 +18,4 @@ _eric4project
.pylint.d .pylint.d
*.qm *.qm
openlp/core/resources.py.old openlp/core/resources.py.old
*.qm

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -7,8 +7,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -31,12 +32,12 @@ from optparse import OptionParser
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
log = logging.getLogger()
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from openlp.core.resources import qInitResources from openlp.core.resources import qInitResources
from openlp.core.ui import MainWindow, SplashScreen, ScreenList from openlp.core.ui import MainWindow, SplashScreen, ScreenList
from openlp.core.utils import AppLocation, LanguageManager from openlp.core.utils import AppLocation, LanguageManager, VersionThread
log = logging.getLogger()
application_stylesheet = u""" application_stylesheet = u"""
QMainWindow::separator QMainWindow::separator
@ -121,7 +122,7 @@ class OpenLP(QtGui.QApplication):
show_splash = QtCore.QSettings().value( show_splash = QtCore.QSettings().value(
u'general/show splash', QtCore.QVariant(True)).toBool() u'general/show splash', QtCore.QVariant(True)).toBool()
if show_splash: if show_splash:
self.splash = SplashScreen(self.applicationVersion()) self.splash = SplashScreen()
self.splash.show() self.splash.show()
# make sure Qt really display the splash screen # make sure Qt really display the splash screen
self.processEvents() self.processEvents()
@ -140,7 +141,7 @@ class OpenLP(QtGui.QApplication):
# now kill the splashscreen # now kill the splashscreen
self.splash.finish(self.mainWindow) self.splash.finish(self.mainWindow)
self.mainWindow.repaint() self.mainWindow.repaint()
self.mainWindow.versionThread() VersionThread(self.mainWindow, app_version).start()
return self.exec_() return self.exec_()
def main(): def main():

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -200,7 +201,7 @@ def check_item_selected(list_widget, message):
""" """
if not list_widget.selectedIndexes(): if not list_widget.selectedIndexes():
QtGui.QMessageBox.information(list_widget.parent(), QtGui.QMessageBox.information(list_widget.parent(),
translate('MediaManagerItem', 'No Items Selected'), message) translate('OpenLP.MediaManagerItem', 'No Items Selected'), message)
return False return False
return True return True

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -135,16 +136,20 @@ class Manager(object):
settings.endGroup() settings.endGroup()
self.session = init_schema(self.db_url) self.session = init_schema(self.db_url)
def save_object(self, object_instance): def save_object(self, object_instance, commit=True):
""" """
Save an object to the database Save an object to the database
``object_instance`` ``object_instance``
The object to save The object to save
``commit``
Commit the session with this object
""" """
try: try:
self.session.add(object_instance) self.session.add(object_instance)
self.session.commit() if commit:
self.session.commit()
return True return True
except InvalidRequestError: except InvalidRequestError:
self.session.rollback() self.session.rollback()
@ -178,36 +183,24 @@ class Manager(object):
""" """
return self.session.query(object_class).filter(filter_clause).first() return self.session.query(object_class).filter(filter_clause).first()
def get_all_objects(self, object_class, order_by_ref=None): def get_all_objects(self, object_class, filter_clause=None,
order_by_ref=None):
""" """
Returns all the objects from the database Returns all the objects from the database
``object_class`` ``object_class``
The type of objects to return The type of objects to return
``filter_clause``
The filter governing selection of objects to return. Defaults to
None.
``order_by_ref`` ``order_by_ref``
Any parameters to order the returned objects by. Defaults to None. Any parameters to order the returned objects by. Defaults to None.
""" """
query = self.session.query(object_class) query = self.session.query(object_class)
if order_by_ref is not None: if filter_clause:
return query.order_by(order_by_ref).all() query = query.filter(filter_clause)
return query.all()
def get_all_objects_filtered(self, object_class, filter_clause,
order_by_ref=None):
"""
Returns a selection of objects from the database
``object_class``
The type of objects to return
``filter_clause``
The filter governing selection of objects to return
``order_by_ref``
Any parameters to order the returned objects by. Defaults to None.
"""
query = self.session.query(object_class).filter(filter_clause)
if order_by_ref is not None: if order_by_ref is not None:
return query.order_by(order_by_ref).all() return query.order_by(order_by_ref).all()
return query.all() return query.all()
@ -235,7 +228,7 @@ class Manager(object):
else: else:
return True return True
def delete_all_objects(self, object_class): def delete_all_objects(self, object_class, filter_clause=None):
""" """
Delete all object records Delete all object records
@ -243,11 +236,13 @@ class Manager(object):
The type of object to delete The type of object to delete
""" """
try: try:
self.session.query(object_class).delete(synchronize_session=False) query = self.session.query(object_class)
if filter_clause:
query = query.filter(filter_clause)
query.delete(synchronize_session=False)
self.session.commit() self.session.commit()
return True return True
except InvalidRequestError: except InvalidRequestError:
self.session.rollback() self.session.rollback()
log.exception(u'Failed to delete all %s records', log.exception(u'Failed to delete %s records', object_class.__name__)
object_class.__name__)
return False return False

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -208,61 +209,62 @@ class MediaManagerItem(QtGui.QWidget):
## Import Button ## ## Import Button ##
if self.hasImportIcon: if self.hasImportIcon:
self.addToolbarButton( self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Import %s')) % unicode(translate('OpenLP.MediaManagerItem', 'Import %s')) %
self.PluginNameShort, self.PluginNameShort,
unicode(translate('MediaManagerItem', 'Import a %s')) % unicode(translate('OpenLP.MediaManagerItem', 'Import a %s')) %
self.pluginNameVisible, self.pluginNameVisible,
u':/general/general_import.png', self.onImportClick) u':/general/general_import.png', self.onImportClick)
## File Button ## ## File Button ##
if self.hasFileIcon: if self.hasFileIcon:
self.addToolbarButton( self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Load %s')) % unicode(translate('OpenLP.MediaManagerItem', 'Load %s')) %
self.PluginNameShort, self.PluginNameShort,
unicode(translate('MediaManagerItem', 'Load a new %s')) % unicode(translate('OpenLP.MediaManagerItem', 'Load a new %s')) %
self.pluginNameVisible, self.pluginNameVisible,
u':/general/general_open.png', self.onFileClick) u':/general/general_open.png', self.onFileClick)
## New Button ## ## New Button ##
if self.hasNewIcon: if self.hasNewIcon:
self.addToolbarButton( self.addToolbarButton(
unicode(translate('MediaManagerItem', 'New %s')) % unicode(translate('OpenLP.MediaManagerItem', 'New %s')) %
self.PluginNameShort, self.PluginNameShort,
unicode(translate('MediaManagerItem', 'Add a new %s')) % unicode(translate('OpenLP.MediaManagerItem', 'Add a new %s')) %
self.pluginNameVisible, self.pluginNameVisible,
u':/general/general_new.png', self.onNewClick) u':/general/general_new.png', self.onNewClick)
## Edit Button ## ## Edit Button ##
if self.hasEditIcon: if self.hasEditIcon:
self.addToolbarButton( self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Edit %s')) % unicode(translate('OpenLP.MediaManagerItem', 'Edit %s')) %
self.PluginNameShort, self.PluginNameShort,
unicode(translate( unicode(translate(
'MediaManagerItem', 'Edit the selected %s')) % 'OpenLP.MediaManagerItem', 'Edit the selected %s')) %
self.pluginNameVisible, self.pluginNameVisible,
u':/general/general_edit.png', self.onEditClick) u':/general/general_edit.png', self.onEditClick)
## Delete Button ## ## Delete Button ##
if self.hasDeleteIcon: if self.hasDeleteIcon:
self.addToolbarButton( self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Delete %s')) % unicode(translate('OpenLP.MediaManagerItem', 'Delete %s')) %
self.PluginNameShort, self.PluginNameShort,
translate('MediaManagerItem', 'Delete the selected item'), translate('OpenLP.MediaManagerItem',
'Delete the selected item'),
u':/general/general_delete.png', self.onDeleteClick) u':/general/general_delete.png', self.onDeleteClick)
## Separator Line ## ## Separator Line ##
self.addToolbarSeparator() self.addToolbarSeparator()
## Preview ## ## Preview ##
self.addToolbarButton( self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Preview %s')) % unicode(translate('OpenLP.MediaManagerItem', 'Preview %s')) %
self.PluginNameShort, self.PluginNameShort,
translate('MediaManagerItem', 'Preview the selected item'), translate('OpenLP.MediaManagerItem', 'Preview the selected item'),
u':/general/general_preview.png', self.onPreviewClick) u':/general/general_preview.png', self.onPreviewClick)
## Live Button ## ## Live Button ##
self.addToolbarButton( self.addToolbarButton(
u'Go Live', u'Go Live',
translate('MediaManagerItem', 'Send the selected item live'), translate('OpenLP.MediaManagerItem', 'Send the selected item live'),
u':/general/general_live.png', self.onLiveClick) u':/general/general_live.png', self.onLiveClick)
## Add to service Button ## ## Add to service Button ##
self.addToolbarButton( self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Add %s to Service')) % unicode(translate('OpenLP.MediaManagerItem', 'Add %s to Service')) %
self.PluginNameShort, self.PluginNameShort,
translate('MediaManagerItem', translate('OpenLP.MediaManagerItem',
'Add the selected item(s) to the service'), 'Add the selected item(s) to the service'),
u':/general/general_add.png', self.onAddClick) u':/general/general_add.png', self.onAddClick)
@ -288,7 +290,7 @@ 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('MediaManagerItem', '&Edit %s')) % unicode(translate('OpenLP.MediaManagerItem', '&Edit %s')) %
self.pluginNameVisible, self.pluginNameVisible,
self.onEditClick)) self.onEditClick))
self.listView.addAction(context_menu_separator(self.listView)) self.listView.addAction(context_menu_separator(self.listView))
@ -296,31 +298,32 @@ class MediaManagerItem(QtGui.QWidget):
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('MediaManagerItem', '&Delete %s')) % unicode(translate('OpenLP.MediaManagerItem',
'&Delete %s')) %
self.pluginNameVisible, self.pluginNameVisible,
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('MediaManagerItem', '&Preview %s')) % unicode(translate('OpenLP.MediaManagerItem', '&Preview %s')) %
self.pluginNameVisible, self.pluginNameVisible,
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('MediaManagerItem', '&Show Live'), translate('OpenLP.MediaManagerItem', '&Show Live'),
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('MediaManagerItem', '&Add to Service'), translate('OpenLP.MediaManagerItem', '&Add to Service'),
self.onAddClick)) self.onAddClick))
if self.addToServiceItem: if self.addToServiceItem:
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('MediaManagerItem', translate('OpenLP.MediaManagerItem',
'&Add to selected Service Item'), '&Add to selected Service Item'),
self.onAddEditClick)) self.onAddEditClick))
if QtCore.QSettings().value(u'advanced/double click live', if QtCore.QSettings().value(u'advanced/double click live',
@ -440,8 +443,8 @@ class MediaManagerItem(QtGui.QWidget):
""" """
if not self.listView.selectedIndexes() and not self.remoteTriggered: if not self.listView.selectedIndexes() and not self.remoteTriggered:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('MediaManagerItem', 'No Items Selected'), translate('OpenLP.MediaManagerItem', 'No Items Selected'),
translate('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.PluginNameShort + u' Preview requested') log.debug(self.PluginNameShort + u' Preview requested')
@ -457,8 +460,8 @@ class MediaManagerItem(QtGui.QWidget):
""" """
if not self.listView.selectedIndexes(): if not self.listView.selectedIndexes():
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('MediaManagerItem', 'No Items Selected'), translate('OpenLP.MediaManagerItem', 'No Items Selected'),
translate('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.PluginNameShort + u' Live requested') log.debug(self.PluginNameShort + u' Live requested')
@ -473,8 +476,8 @@ class MediaManagerItem(QtGui.QWidget):
""" """
if not self.listView.selectedIndexes() and not self.remoteTriggered: if not self.listView.selectedIndexes() and not self.remoteTriggered:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('MediaManagerItem', 'No Items Selected'), translate('OpenLP.MediaManagerItem', 'No Items Selected'),
translate('MediaManagerItem', translate('OpenLP.MediaManagerItem',
'You must select one or more items.')) 'You must select one or more items.'))
else: else:
#Is it posssible to process multiple list items to generate multiple #Is it posssible to process multiple list items to generate multiple
@ -500,16 +503,17 @@ class MediaManagerItem(QtGui.QWidget):
""" """
if not self.listView.selectedIndexes() and not self.remoteTriggered: if not self.listView.selectedIndexes() and not self.remoteTriggered:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('MediaManagerItem', 'No items selected'), translate('OpenLP.MediaManagerItem', 'No items selected'),
translate('MediaManagerItem', translate('OpenLP.MediaManagerItem',
'You must select one or more items')) 'You must select one or more items'))
else: else:
log.debug(self.PluginNameShort + u' Add requested') log.debug(self.PluginNameShort + u' Add requested')
service_item = self.parent.serviceManager.getServiceItem() service_item = self.parent.serviceManager.getServiceItem()
if not service_item: if not service_item:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('MediaManagerItem', 'No Service Item Selected'), translate('OpenLP.MediaManagerItem',
translate('MediaManagerItem', 'No Service Item Selected'),
translate('OpenLP.MediaManagerItem',
'You must select an existing service item to add to.')) 'You must select an existing service item to add to.'))
elif self.title.lower() == service_item.name.lower(): elif self.title.lower() == service_item.name.lower():
self.generateSlideData(service_item) self.generateSlideData(service_item)
@ -518,8 +522,9 @@ class MediaManagerItem(QtGui.QWidget):
else: else:
#Turn off the remote edit update message indicator #Turn off the remote edit update message indicator
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('MediaManagerItem', 'Invalid Service Item'), translate('OpenLP.MediaManagerItem',
unicode(translate('MediaManagerItem', 'Invalid Service Item'),
unicode(translate('OpenLP.MediaManagerItem',
'You must select a %s service item.')) % self.title) 'You must select a %s service item.')) % self.title)
def buildServiceItem(self, item=None): def buildServiceItem(self, item=None):

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -132,6 +133,7 @@ class Plugin(QtCore.QObject):
self.mediadock = plugin_helpers[u'toolbox'] self.mediadock = plugin_helpers[u'toolbox']
self.displayManager = plugin_helpers[u'displaymanager'] self.displayManager = plugin_helpers[u'displaymanager']
self.pluginManager = plugin_helpers[u'pluginmanager'] self.pluginManager = plugin_helpers[u'pluginmanager']
self.formparent = plugin_helpers[u'formparent']
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_add_service_item' % self.name), QtCore.SIGNAL(u'%s_add_service_item' % self.name),
self.processAddServiceEvent) self.processAddServiceEvent)

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -76,7 +77,6 @@ class PluginManager(object):
startdepth = len(os.path.abspath(plugin_dir).split(os.sep)) startdepth = len(os.path.abspath(plugin_dir).split(os.sep))
log.debug(u'finding plugins in %s at depth %d', log.debug(u'finding plugins in %s at depth %d',
unicode(plugin_dir), startdepth) unicode(plugin_dir), startdepth)
for root, dirs, files in os.walk(plugin_dir): for root, dirs, files in os.walk(plugin_dir):
for name in files: for name in files:
if name.endswith(u'.py') and not name.startswith(u'__'): if name.endswith(u'.py') and not name.startswith(u'__'):
@ -218,4 +218,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

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -57,34 +58,6 @@ class SettingsManager(object):
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
def get_preview_visibility(self):
"""
Return the preview panel's visibility.
"""
return QtCore.QSettings().value(u'user interface/preview panel',
QtCore.QVariant(True)).toBool()
def set_preview_visibility(self, visible):
"""
Set the preview panel's visibility.
"""
QtCore.QSettings().setValue(u'user interface/preview panel',
QtCore.QVariant(visible))
def get_live_visibility(self):
"""
Return the live panel's visibility.
"""
return QtCore.QSettings().value(u'user interface/live panel',
QtCore.QVariant(True)).toBool()
def set_live_visibility(self, visible):
"""
Set the live panel's visibility.
"""
QtCore.QSettings().setValue(u'user interface/live panel',
QtCore.QVariant(visible))
@staticmethod @staticmethod
def get_last_dir(section, num=None): def get_last_dir(section, num=None):
""" """
@ -206,4 +179,3 @@ class SettingsManager(object):
else: else:
# no filtering required # no filtering required
return files return files

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -105,8 +106,9 @@ class Ui_AboutDialog(object):
QtCore.QMetaObject.connectSlotsByName(aboutDialog) QtCore.QMetaObject.connectSlotsByName(aboutDialog)
def retranslateUi(self, aboutDialog): def retranslateUi(self, aboutDialog):
aboutDialog.setWindowTitle(translate('AboutForm', 'About OpenLP')) aboutDialog.setWindowTitle(translate('OpenLP.AboutForm',
self.aboutTextEdit.setPlainText(translate('AboutForm', 'About OpenLP'))
self.aboutTextEdit.setPlainText(translate('OpenLP.AboutForm',
'OpenLP <version><revision> - Open Source Lyrics ' 'OpenLP <version><revision> - Open Source Lyrics '
'Projection\n' 'Projection\n'
'\n' '\n'
@ -124,8 +126,8 @@ class Ui_AboutDialog(object):
)) ))
self.aboutNotebook.setTabText( self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.aboutTab), self.aboutNotebook.indexOf(self.aboutTab),
translate('AboutForm', 'About')) translate('OpenLP.AboutForm', 'About'))
self.creditsTextEdit.setPlainText(translate('AboutForm', self.creditsTextEdit.setPlainText(translate('OpenLP.AboutForm',
'Project Lead\n' 'Project Lead\n'
' Raoul "superfly" Snyman\n' ' Raoul "superfly" Snyman\n'
'\n' '\n'
@ -140,9 +142,12 @@ class Ui_AboutDialog(object):
'\n' '\n'
'Contributors\n' 'Contributors\n'
' Meinert "m2j" Jordan\n' ' Meinert "m2j" Jordan\n'
' Andreas "googol" Preikschat\n'
' Christian "crichter" Richter\n' ' Christian "crichter" Richter\n'
' Philip "Phill" Ridout\n'
' Maikel Stuivenberg\n' ' Maikel Stuivenberg\n'
' Carsten "catini" Tingaard\n' ' Carsten "catini" Tingaard\n'
' Frode "frodus" Woldsund\n'
'\n' '\n'
'Testers\n' 'Testers\n'
' Philip "Phill" Ridout\n' ' Philip "Phill" Ridout\n'
@ -153,12 +158,19 @@ class Ui_AboutDialog(object):
' Tim "TRB143" Bentley (Fedora)\n' ' Tim "TRB143" Bentley (Fedora)\n'
' Michael "cocooncrash" Gorven (Ubuntu)\n' ' Michael "cocooncrash" Gorven (Ubuntu)\n'
' Matthias "matthub" Hub (Mac OS X)\n' ' Matthias "matthub" Hub (Mac OS X)\n'
' Raoul "superfly" Snyman (Windows)\n' ' Raoul "superfly" Snyman (Windows, Ubuntu)\n'
'\n'
'Built With\n'
' Python: http://www.python.org/\n'
' Qt4: http://qt.nokia.com/\n'
' PyQt4: http://www.riverbankcomputing.co.uk/software/pyqt/'
'intro\n'
' Oxygen Icons: http://oxygen-icons.org/\n'
)) ))
self.aboutNotebook.setTabText( self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.creditsTab), self.aboutNotebook.indexOf(self.creditsTab),
translate('AboutForm', 'Credits')) translate('OpenLP.AboutForm', 'Credits'))
self.licenseTextEdit.setPlainText(translate('AboutForm', self.licenseTextEdit.setPlainText(translate('OpenLP.AboutForm',
'Copyright \xa9 2004-2010 Raoul Snyman\n' 'Copyright \xa9 2004-2010 Raoul Snyman\n'
'Portions copyright \xa9 2004-2010 ' 'Portions copyright \xa9 2004-2010 '
'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri, ' 'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri, '
@ -549,6 +561,7 @@ class Ui_AboutDialog(object):
'instead of this License.')) 'instead of this License.'))
self.aboutNotebook.setTabText( self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.licenseTab), self.aboutNotebook.indexOf(self.licenseTab),
translate('AboutForm', 'License')) translate('OpenLP.AboutForm', 'License'))
self.contributeButton.setText(translate('AboutForm', 'Contribute')) self.contributeButton.setText(translate('OpenLP.AboutForm',
self.closeButton.setText(translate('AboutForm', 'Close')) 'Contribute'))
self.closeButton.setText(translate('OpenLP.AboutForm', 'Close'))

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -44,7 +45,7 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog):
about_text = about_text.replace(u'<version>', about_text = about_text.replace(u'<version>',
self.applicationVersion[u'version']) self.applicationVersion[u'version'])
if self.applicationVersion[u'build']: if self.applicationVersion[u'build']:
build_text = unicode(translate('AboutForm', ' build %s')) % \ build_text = unicode(translate('OpenLP.AboutForm', ' build %s')) % \
self.applicationVersion[u'build'] self.applicationVersion[u'build']
else: else:
build_text = u'' build_text = u''

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -45,7 +46,7 @@ class AdvancedTab(SettingsTab):
Configure the UI elements for the tab. Configure the UI elements for the tab.
""" """
self.setObjectName(u'AdvancedTab') self.setObjectName(u'AdvancedTab')
self.tabTitleVisible = translate('AdvancedTab', 'Advanced') self.tabTitleVisible = translate('OpenLP.AdvancedTab', 'Advanced')
self.advancedTabLayout = QtGui.QHBoxLayout(self) self.advancedTabLayout = QtGui.QHBoxLayout(self)
self.advancedTabLayout.setSpacing(8) self.advancedTabLayout.setSpacing(8)
self.advancedTabLayout.setMargin(8) self.advancedTabLayout.setMargin(8)
@ -131,12 +132,13 @@ class AdvancedTab(SettingsTab):
""" """
Setup the interface translation strings. Setup the interface translation strings.
""" """
self.uiGroupBox.setTitle(translate('AdvancedTab', 'UI Settings')) self.uiGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
self.recentLabel.setText( self.recentLabel.setText(
translate('AdvancedTab', 'Number of recent files to display:')) translate('OpenLP.AdvancedTab',
self.mediaPluginCheckBox.setText(translate('AdvancedTab', 'Number of recent files to display:'))
'Save currently selected media manager plugin')) self.mediaPluginCheckBox.setText(translate('OpenLP.AdvancedTab',
self.doubleClickLiveCheckBox.setText(translate('AdvancedTab', 'Remember active media manager tab on startup'))
self.doubleClickLiveCheckBox.setText(translate('OpenLP.AdvancedTab',
'Double-click to send items straight to live (requires restart)')) 'Double-click to send items straight to live (requires restart)'))
# self.sharedDirGroupBox.setTitle( # self.sharedDirGroupBox.setTitle(
# translate('AdvancedTab', 'Central Data Store')) # translate('AdvancedTab', 'Central Data Store'))

File diff suppressed because it is too large Load Diff

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -51,102 +52,102 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.setupUi(self) self.setupUi(self)
# define signals # define signals
# Buttons # Buttons
QtCore.QObject.connect(self.Color1PushButton, QtCore.QObject.connect(self.color1PushButton,
QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked) QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked)
QtCore.QObject.connect(self.Color2PushButton, QtCore.QObject.connect(self.color2PushButton,
QtCore.SIGNAL(u'pressed()'), self.onColor2PushButtonClicked) QtCore.SIGNAL(u'pressed()'), self.onColor2PushButtonClicked)
QtCore.QObject.connect(self.FontMainColorPushButton, QtCore.QObject.connect(self.fontMainColorPushButton,
QtCore.SIGNAL(u'pressed()'), self.onFontMainColorPushButtonClicked) QtCore.SIGNAL(u'pressed()'), self.onFontMainColorPushButtonClicked)
QtCore.QObject.connect(self.FontFooterColorPushButton, QtCore.QObject.connect(self.fontFooterColorPushButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'pressed()'),
self.onFontFooterColorPushButtonClicked) self.onFontFooterColorPushButtonClicked)
QtCore.QObject.connect(self.OutlineColorPushButton, QtCore.QObject.connect(self.outlineColorPushButton,
QtCore.SIGNAL(u'pressed()'), self.onOutlineColorPushButtonClicked) QtCore.SIGNAL(u'pressed()'), self.onOutlineColorPushButtonClicked)
QtCore.QObject.connect(self.ShadowColorPushButton, QtCore.QObject.connect(self.shadowColorPushButton,
QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked) QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked)
QtCore.QObject.connect(self.ImageToolButton, QtCore.QObject.connect(self.imageToolButton,
QtCore.SIGNAL(u'clicked()'), self.onImageToolButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onImageToolButtonClicked)
# Combo boxes # Combo boxes
QtCore.QObject.connect(self.BackgroundComboBox, QtCore.QObject.connect(self.backgroundComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected)
QtCore.QObject.connect(self.BackgroundTypeComboBox, QtCore.QObject.connect(self.backgroundTypeComboBox,
QtCore.SIGNAL(u'activated(int)'), QtCore.SIGNAL(u'activated(int)'),
self.onBackgroundTypeComboBoxSelected) self.onBackgroundTypeComboBoxSelected)
QtCore.QObject.connect(self.GradientComboBox, QtCore.QObject.connect(self.gradientComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onGradientComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onGradientComboBoxSelected)
QtCore.QObject.connect(self.FontMainComboBox, QtCore.QObject.connect(self.fontMainComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onFontMainComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onFontMainComboBoxSelected)
QtCore.QObject.connect(self.FontMainWeightComboBox, QtCore.QObject.connect(self.fontMainWeightComboBox,
QtCore.SIGNAL(u'activated(int)'), QtCore.SIGNAL(u'activated(int)'),
self.onFontMainWeightComboBoxSelected) self.onFontMainWeightComboBoxSelected)
QtCore.QObject.connect(self.FontFooterComboBox, QtCore.QObject.connect(self.fontFooterComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onFontFooterComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onFontFooterComboBoxSelected)
QtCore.QObject.connect(self.FontFooterWeightComboBox, QtCore.QObject.connect(self.fontFooterWeightComboBox,
QtCore.SIGNAL(u'activated(int)'), QtCore.SIGNAL(u'activated(int)'),
self.onFontFooterWeightComboBoxSelected) self.onFontFooterWeightComboBoxSelected)
QtCore.QObject.connect(self.HorizontalComboBox, QtCore.QObject.connect(self.horizontalComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected)
QtCore.QObject.connect(self.VerticalComboBox, QtCore.QObject.connect(self.verticalComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected)
# Spin boxes # Spin boxes
QtCore.QObject.connect(self.FontMainSizeSpinBox, QtCore.QObject.connect(self.fontMainSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainSizeSpinBoxChanged) self.onFontMainSizeSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterSizeSpinBox, QtCore.QObject.connect(self.fontFooterSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterSizeSpinBoxChanged) self.onFontFooterSizeSpinBoxChanged)
QtCore.QObject.connect(self.FontMainXSpinBox, QtCore.QObject.connect(self.fontMainXSpinBox,
QtCore.SIGNAL(u'editingFinished()'), self.onFontMainXSpinBoxChanged) QtCore.SIGNAL(u'editingFinished()'), self.onFontMainXSpinBoxChanged)
QtCore.QObject.connect(self.FontMainYSpinBox, QtCore.QObject.connect(self.fontMainYSpinBox,
QtCore.SIGNAL(u'editingFinished()'), self.onFontMainYSpinBoxChanged) QtCore.SIGNAL(u'editingFinished()'), self.onFontMainYSpinBoxChanged)
QtCore.QObject.connect(self.FontMainWidthSpinBox, QtCore.QObject.connect(self.fontMainWidthSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainWidthSpinBoxChanged) self.onFontMainWidthSpinBoxChanged)
QtCore.QObject.connect(self.FontMainHeightSpinBox, QtCore.QObject.connect(self.fontMainHeightSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainHeightSpinBoxChanged) self.onFontMainHeightSpinBoxChanged)
QtCore.QObject.connect(self.FontMainLineAdjustmentSpinBox, QtCore.QObject.connect(self.fontMainLineAdjustmentSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainLineAdjustmentSpinBoxChanged) self.onFontMainLineAdjustmentSpinBoxChanged)
QtCore.QObject.connect(self.FontMainLineSpacingSpinBox, QtCore.QObject.connect(self.fontMainLineSpacingSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainLineSpacingSpinBoxChanged) self.onFontMainLineSpacingSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterXSpinBox, QtCore.QObject.connect(self.fontFooterXSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterXSpinBoxChanged) self.onFontFooterXSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterYSpinBox, QtCore.QObject.connect(self.fontFooterYSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterYSpinBoxChanged) self.onFontFooterYSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterWidthSpinBox, QtCore.QObject.connect(self.fontFooterWidthSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterWidthSpinBoxChanged) self.onFontFooterWidthSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterHeightSpinBox, QtCore.QObject.connect(self.fontFooterHeightSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterHeightSpinBoxChanged) self.onFontFooterHeightSpinBoxChanged)
QtCore.QObject.connect(self.ShadowSpinBox, QtCore.QObject.connect(self.shadowSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onShadowSpinBoxChanged) self.onShadowSpinBoxChanged)
QtCore.QObject.connect(self.OutlineSpinBox, QtCore.QObject.connect(self.outlineSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onOutlineSpinBoxChanged) self.onOutlineSpinBoxChanged)
# CheckBoxes # CheckBoxes
QtCore.QObject.connect(self.FontMainDefaultCheckBox, QtCore.QObject.connect(self.fontMainDefaultCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onFontMainDefaultCheckBoxChanged) self.onFontMainDefaultCheckBoxChanged)
QtCore.QObject.connect(self.FontFooterDefaultCheckBox, QtCore.QObject.connect(self.fontFooterDefaultCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onFontFooterDefaultCheckBoxChanged) self.onFontFooterDefaultCheckBoxChanged)
QtCore.QObject.connect(self.OutlineCheckBox, QtCore.QObject.connect(self.outlineCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged) QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged)
QtCore.QObject.connect(self.ShadowCheckBox, QtCore.QObject.connect(self.shadowCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged) QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged)
QtCore.QObject.connect(self.SlideTransitionCheckBox, QtCore.QObject.connect(self.slideTransitionCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onSlideTransitionCheckBoxChanged) self.onSlideTransitionCheckBoxChanged)
def accept(self): def accept(self):
new_theme = ThemeXML() new_theme = ThemeXML()
theme_name = unicode(self.ThemeNameEdit.text()) theme_name = unicode(self.themeNameEdit.text())
new_theme.new_document(theme_name) new_theme.new_document(theme_name)
save_from = None save_from = None
save_to = None save_to = None
@ -219,11 +220,12 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onImageToolButtonClicked(self): def onImageToolButtonClicked(self):
images_filter = get_images_filter() images_filter = get_images_filter()
images_filter = '%s;;%s (*.*) (*)' % (images_filter, images_filter = '%s;;%s (*.*) (*)' % (images_filter,
translate('AmendThemeForm', 'All Files')) translate('OpenLP.AmendThemeForm', 'All Files'))
filename = QtGui.QFileDialog.getOpenFileName(self, filename = QtGui.QFileDialog.getOpenFileName(self,
translate('AmendThemeForm', 'Select Image'), u'', images_filter) translate('OpenLP.AmendThemeForm', 'Select Image'), u'',
images_filter)
if filename: if filename:
self.ImageLineEdit.setText(filename) self.imageLineEdit.setText(filename)
self.theme.background_filename = filename self.theme.background_filename = filename
self.previewTheme() self.previewTheme()
@ -231,7 +233,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
#Main Font Tab #Main Font Tab
# #
def onFontMainComboBoxSelected(self): def onFontMainComboBoxSelected(self):
self.theme.font_main_name = self.FontMainComboBox.currentFont().family() self.theme.font_main_name = self.fontMainComboBox.currentFont().family()
self.previewTheme() self.previewTheme()
def onFontMainWeightComboBoxSelected(self, value): def onFontMainWeightComboBoxSelected(self, value):
@ -254,13 +256,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.font_main_color), self) QtGui.QColor(self.theme.font_main_color), self)
if new_color.isValid(): if new_color.isValid():
self.theme.font_main_color = new_color.name() self.theme.font_main_color = new_color.name()
self.FontMainColorPushButton.setStyleSheet( self.fontMainColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.font_main_color)) u'background-color: %s' % unicode(self.theme.font_main_color))
self.previewTheme() self.previewTheme()
def onFontMainSizeSpinBoxChanged(self): def onFontMainSizeSpinBoxChanged(self):
if self.theme.font_main_proportion != self.FontMainSizeSpinBox.value(): if self.theme.font_main_proportion != self.fontMainSizeSpinBox.value():
self.theme.font_main_proportion = self.FontMainSizeSpinBox.value() self.theme.font_main_proportion = self.fontMainSizeSpinBox.value()
self.previewTheme() self.previewTheme()
def onFontMainDefaultCheckBoxChanged(self, value): def onFontMainDefaultCheckBoxChanged(self, value):
@ -275,49 +277,49 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.font_main_y = u'10' self.theme.font_main_y = u'10'
self.theme.font_main_width = u'1024' self.theme.font_main_width = u'1024'
self.theme.font_main_height = u'730' self.theme.font_main_height = u'730'
self.FontMainXSpinBox.setValue(self.theme.font_main_x) self.fontMainXSpinBox.setValue(self.theme.font_main_x)
self.FontMainYSpinBox.setValue(self.theme.font_main_y) self.fontMainYSpinBox.setValue(self.theme.font_main_y)
self.FontMainWidthSpinBox.setValue(self.theme.font_main_width) self.fontMainWidthSpinBox.setValue(self.theme.font_main_width)
self.FontMainHeightSpinBox.setValue(self.theme.font_main_height) self.fontMainHeightSpinBox.setValue(self.theme.font_main_height)
self.FontMainLineAdjustmentSpinBox.setValue( self.fontMainLineAdjustmentSpinBox.setValue(
self.theme.font_main_line_adjustment) self.theme.font_main_line_adjustment)
self.FontMainLineSpacingSpinBox.setValue( self.fontMainLineSpacingSpinBox.setValue(
self.theme.font_main_indentation) self.theme.font_main_indentation)
self.stateChanging(self.theme) self.stateChanging(self.theme)
self.previewTheme() self.previewTheme()
def onFontMainXSpinBoxChanged(self): def onFontMainXSpinBoxChanged(self):
if self.theme.font_main_x != self.FontMainXSpinBox.value(): if self.theme.font_main_x != self.fontMainXSpinBox.value():
self.theme.font_main_x = self.FontMainXSpinBox.value() self.theme.font_main_x = self.fontMainXSpinBox.value()
self.previewTheme() self.previewTheme()
def onFontMainYSpinBoxChanged(self): def onFontMainYSpinBoxChanged(self):
if self.theme.font_main_y != self.FontMainYSpinBox.value(): if self.theme.font_main_y != self.fontMainYSpinBox.value():
self.theme.font_main_y = self.FontMainYSpinBox.value() self.theme.font_main_y = self.fontMainYSpinBox.value()
self.previewTheme() self.previewTheme()
def onFontMainWidthSpinBoxChanged(self): def onFontMainWidthSpinBoxChanged(self):
if self.theme.font_main_width != self.FontMainWidthSpinBox.value(): if self.theme.font_main_width != self.fontMainWidthSpinBox.value():
self.theme.font_main_width = self.FontMainWidthSpinBox.value() self.theme.font_main_width = self.fontMainWidthSpinBox.value()
self.previewTheme() self.previewTheme()
def onFontMainLineAdjustmentSpinBoxChanged(self): def onFontMainLineAdjustmentSpinBoxChanged(self):
if self.theme.font_main_line_adjustment != \ if self.theme.font_main_line_adjustment != \
self.FontMainLineAdjustmentSpinBox.value(): self.fontMainLineAdjustmentSpinBox.value():
self.theme.font_main_line_adjustment = \ self.theme.font_main_line_adjustment = \
self.FontMainLineAdjustmentSpinBox.value() self.fontMainLineAdjustmentSpinBox.value()
self.previewTheme() self.previewTheme()
def onFontMainLineSpacingSpinBoxChanged(self): def onFontMainLineSpacingSpinBoxChanged(self):
if self.theme.font_main_indentation != \ if self.theme.font_main_indentation != \
self.FontMainLineSpacingSpinBox.value(): self.fontMainLineSpacingSpinBox.value():
self.theme.font_main_indentation = \ self.theme.font_main_indentation = \
self.FontMainLineSpacingSpinBox.value() self.fontMainLineSpacingSpinBox.value()
self.previewTheme() self.previewTheme()
def onFontMainHeightSpinBoxChanged(self): def onFontMainHeightSpinBoxChanged(self):
if self.theme.font_main_height != self.FontMainHeightSpinBox.value(): if self.theme.font_main_height != self.fontMainHeightSpinBox.value():
self.theme.font_main_height = self.FontMainHeightSpinBox.value() self.theme.font_main_height = self.fontMainHeightSpinBox.value()
self.previewTheme() self.previewTheme()
# #
@ -325,7 +327,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
# #
def onFontFooterComboBoxSelected(self): def onFontFooterComboBoxSelected(self):
self.theme.font_footer_name = \ self.theme.font_footer_name = \
self.FontFooterComboBox.currentFont().family() self.fontFooterComboBox.currentFont().family()
self.previewTheme() self.previewTheme()
def onFontFooterWeightComboBoxSelected(self, value): def onFontFooterWeightComboBoxSelected(self, value):
@ -348,15 +350,15 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.font_footer_color), self) QtGui.QColor(self.theme.font_footer_color), self)
if new_color.isValid(): if new_color.isValid():
self.theme.font_footer_color = new_color.name() self.theme.font_footer_color = new_color.name()
self.FontFooterColorPushButton.setStyleSheet( self.fontFooterColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.font_footer_color)) u'background-color: %s' % unicode(self.theme.font_footer_color))
self.previewTheme() self.previewTheme()
def onFontFooterSizeSpinBoxChanged(self): def onFontFooterSizeSpinBoxChanged(self):
if self.theme.font_footer_proportion != \ if self.theme.font_footer_proportion != \
self.FontFooterSizeSpinBox.value(): self.fontFooterSizeSpinBox.value():
self.theme.font_footer_proportion = \ self.theme.font_footer_proportion = \
self.FontFooterSizeSpinBox.value() self.fontFooterSizeSpinBox.value()
self.previewTheme() self.previewTheme()
def onFontFooterDefaultCheckBoxChanged(self, value): def onFontFooterDefaultCheckBoxChanged(self, value):
@ -371,41 +373,41 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.font_footer_y = u'730' self.theme.font_footer_y = u'730'
self.theme.font_footer_width = u'1024' self.theme.font_footer_width = u'1024'
self.theme.font_footer_height = u'38' self.theme.font_footer_height = u'38'
self.FontFooterXSpinBox.setValue(self.theme.font_footer_x) self.fontFooterXSpinBox.setValue(self.theme.font_footer_x)
self.FontFooterYSpinBox.setValue(self.theme.font_footer_y) self.fontFooterYSpinBox.setValue(self.theme.font_footer_y)
self.FontFooterWidthSpinBox.setValue(self.theme.font_footer_width) self.fontFooterWidthSpinBox.setValue(self.theme.font_footer_width)
self.FontFooterHeightSpinBox.setValue( self.fontFooterHeightSpinBox.setValue(
self.theme.font_footer_height) self.theme.font_footer_height)
self.stateChanging(self.theme) self.stateChanging(self.theme)
self.previewTheme() self.previewTheme()
def onFontFooterXSpinBoxChanged(self): def onFontFooterXSpinBoxChanged(self):
if self.theme.font_footer_x != self.FontFooterXSpinBox.value(): if self.theme.font_footer_x != self.fontFooterXSpinBox.value():
self.theme.font_footer_x = self.FontFooterXSpinBox.value() self.theme.font_footer_x = self.fontFooterXSpinBox.value()
self.previewTheme() self.previewTheme()
def onFontFooterYSpinBoxChanged(self): def onFontFooterYSpinBoxChanged(self):
if self.theme.font_footer_y != self.FontFooterYSpinBox.value(): if self.theme.font_footer_y != self.fontFooterYSpinBox.value():
self.theme.font_footer_y = self.FontFooterYSpinBox.value() self.theme.font_footer_y = self.fontFooterYSpinBox.value()
self.previewTheme() self.previewTheme()
def onFontFooterWidthSpinBoxChanged(self): def onFontFooterWidthSpinBoxChanged(self):
if self.theme.font_footer_width != self.FontFooterWidthSpinBox.value(): if self.theme.font_footer_width != self.fontFooterWidthSpinBox.value():
self.theme.font_footer_width = self.FontFooterWidthSpinBox.value() self.theme.font_footer_width = self.fontFooterWidthSpinBox.value()
self.previewTheme() self.previewTheme()
def onFontFooterHeightSpinBoxChanged(self): def onFontFooterHeightSpinBoxChanged(self):
if self.theme.font_footer_height != \ if self.theme.font_footer_height != \
self.FontFooterHeightSpinBox.value(): self.fontFooterHeightSpinBox.value():
self.theme.font_footer_height = \ self.theme.font_footer_height = \
self.FontFooterHeightSpinBox.value() self.fontFooterHeightSpinBox.value()
self.previewTheme() self.previewTheme()
# #
#Background Tab #Background Tab
# #
def onGradientComboBoxSelected(self, currentIndex): def onGradientComboBoxSelected(self, currentIndex):
self.setBackground(self.BackgroundTypeComboBox.currentIndex(), self.setBackground(self.backgroundTypeComboBox.currentIndex(),
currentIndex) currentIndex)
def onBackgroundComboBoxSelected(self, currentIndex): def onBackgroundComboBoxSelected(self, currentIndex):
@ -417,14 +419,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.previewTheme() self.previewTheme()
def onBackgroundTypeComboBoxSelected(self, currentIndex): def onBackgroundTypeComboBoxSelected(self, currentIndex):
self.setBackground(currentIndex, self.GradientComboBox.currentIndex()) self.setBackground(currentIndex, self.gradientComboBox.currentIndex())
def setBackground(self, background, gradient): def setBackground(self, background, gradient):
if background == 0: # Solid if background == 0: # Solid
self.theme.background_type = u'solid' self.theme.background_type = u'solid'
if self.theme.background_color is None: if self.theme.background_color is None:
self.theme.background_color = u'#000000' self.theme.background_color = u'#000000'
self.ImageLineEdit.setText(u'') self.imageLineEdit.setText(u'')
elif background == 1: # Gradient elif background == 1: # Gradient
self.theme.background_type = u'gradient' self.theme.background_type = u'gradient'
if gradient == 0: # Horizontal if gradient == 0: # Horizontal
@ -437,7 +439,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.background_startColor = u'#000000' self.theme.background_startColor = u'#000000'
if self.theme.background_endColor is None: if self.theme.background_endColor is None:
self.theme.background_endColor = u'#ff0000' self.theme.background_endColor = u'#ff0000'
self.ImageLineEdit.setText(u'') self.imageLineEdit.setText(u'')
else: else:
self.theme.background_type = u'image' self.theme.background_type = u'image'
self.stateChanging(self.theme) self.stateChanging(self.theme)
@ -449,14 +451,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.background_color), self) QtGui.QColor(self.theme.background_color), self)
if new_color.isValid(): if new_color.isValid():
self.theme.background_color = new_color.name() self.theme.background_color = new_color.name()
self.Color1PushButton.setStyleSheet(u'background-color: %s' % self.color1PushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.background_color)) unicode(self.theme.background_color))
else: else:
new_color = QtGui.QColorDialog.getColor( new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_startColor), self) QtGui.QColor(self.theme.background_startColor), self)
if new_color.isValid(): if new_color.isValid():
self.theme.background_startColor = new_color.name() self.theme.background_startColor = new_color.name()
self.Color1PushButton.setStyleSheet(u'background-color: %s' % self.color1PushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.background_startColor)) unicode(self.theme.background_startColor))
self.previewTheme() self.previewTheme()
@ -465,7 +467,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.background_endColor), self) QtGui.QColor(self.theme.background_endColor), self)
if new_color.isValid(): if new_color.isValid():
self.theme.background_endColor = new_color.name() self.theme.background_endColor = new_color.name()
self.Color2PushButton.setStyleSheet(u'background-color: %s' % self.color2PushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.background_endColor)) unicode(self.theme.background_endColor))
self.previewTheme() self.previewTheme()
@ -481,13 +483,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.previewTheme() self.previewTheme()
def onOutlineSpinBoxChanged(self): def onOutlineSpinBoxChanged(self):
if self.theme.display_outline_size != self.OutlineSpinBox.value(): if self.theme.display_outline_size != self.outlineSpinBox.value():
self.theme.display_outline_size = self.OutlineSpinBox.value() self.theme.display_outline_size = self.outlineSpinBox.value()
self.previewTheme() self.previewTheme()
def onShadowSpinBoxChanged(self): def onShadowSpinBoxChanged(self):
if self.theme.display_shadow_size != self.ShadowSpinBox.value(): if self.theme.display_shadow_size != self.shadowSpinBox.value():
self.theme.display_shadow_size = self.ShadowSpinBox.value() self.theme.display_shadow_size = self.shadowSpinBox.value()
self.previewTheme() self.previewTheme()
def onOutlineColorPushButtonClicked(self): def onOutlineColorPushButtonClicked(self):
@ -495,7 +497,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.display_outline_color), self) QtGui.QColor(self.theme.display_outline_color), self)
if new_color.isValid(): if new_color.isValid():
self.theme.display_outline_color = new_color.name() self.theme.display_outline_color = new_color.name()
self.OutlineColorPushButton.setStyleSheet(u'background-color: %s' % self.outlineColorPushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.display_outline_color)) unicode(self.theme.display_outline_color))
self.previewTheme() self.previewTheme()
@ -520,7 +522,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.display_shadow_color), self) QtGui.QColor(self.theme.display_shadow_color), self)
if new_color.isValid(): if new_color.isValid():
self.theme.display_shadow_color = new_color.name() self.theme.display_shadow_color = new_color.name()
self.ShadowColorPushButton.setStyleSheet(u'background-color: %s' % self.shadowColorPushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.display_shadow_color)) unicode(self.theme.display_shadow_color))
self.previewTheme() self.previewTheme()
@ -539,194 +541,194 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
# #
def paintUi(self, theme): def paintUi(self, theme):
self.stateChanging(theme) self.stateChanging(theme)
self.ThemeNameEdit.setText(self.theme.theme_name) self.themeNameEdit.setText(self.theme.theme_name)
# Background Tab # Background Tab
if self.theme.background_mode == u'opaque': if self.theme.background_mode == u'opaque':
self.BackgroundComboBox.setCurrentIndex(0) self.backgroundComboBox.setCurrentIndex(0)
else: else:
self.BackgroundComboBox.setCurrentIndex(1) self.backgroundComboBox.setCurrentIndex(1)
self.ImageLineEdit.setText(u'') self.imageLineEdit.setText(u'')
if theme.background_type == u'solid': if theme.background_type == u'solid':
self.BackgroundTypeComboBox.setCurrentIndex(0) self.backgroundTypeComboBox.setCurrentIndex(0)
elif theme.background_type == u'gradient': elif theme.background_type == u'gradient':
self.BackgroundTypeComboBox.setCurrentIndex(1) self.backgroundTypeComboBox.setCurrentIndex(1)
else: else:
self.BackgroundTypeComboBox.setCurrentIndex(2) self.backgroundTypeComboBox.setCurrentIndex(2)
self.ImageLineEdit.setText(self.theme.background_filename) self.imageLineEdit.setText(self.theme.background_filename)
if self.theme.background_direction == u'horizontal': if self.theme.background_direction == u'horizontal':
self.GradientComboBox.setCurrentIndex(0) self.gradientComboBox.setCurrentIndex(0)
elif self.theme.background_direction == u'vertical': elif self.theme.background_direction == u'vertical':
self.GradientComboBox.setCurrentIndex(1) self.gradientComboBox.setCurrentIndex(1)
else: else:
self.GradientComboBox.setCurrentIndex(2) self.gradientComboBox.setCurrentIndex(2)
# Font Main Tab # Font Main Tab
self.FontMainComboBox.setCurrentFont( self.fontMainComboBox.setCurrentFont(
QtGui.QFont(self.theme.font_main_name)) QtGui.QFont(self.theme.font_main_name))
self.FontMainSizeSpinBox.setValue(self.theme.font_main_proportion) self.fontMainSizeSpinBox.setValue(self.theme.font_main_proportion)
if not self.theme.font_main_italics and \ if not self.theme.font_main_italics and \
self.theme.font_main_weight == u'Normal': self.theme.font_main_weight == u'Normal':
self.FontMainWeightComboBox.setCurrentIndex(0) self.fontMainWeightComboBox.setCurrentIndex(0)
elif not self.theme.font_main_italics and \ elif not self.theme.font_main_italics and \
self.theme.font_main_weight == u'Bold': self.theme.font_main_weight == u'Bold':
self.FontMainWeightComboBox.setCurrentIndex(1) self.fontMainWeightComboBox.setCurrentIndex(1)
elif self.theme.font_main_italics and \ elif self.theme.font_main_italics and \
self.theme.font_main_weight == u'Normal': self.theme.font_main_weight == u'Normal':
self.FontMainWeightComboBox.setCurrentIndex(2) self.fontMainWeightComboBox.setCurrentIndex(2)
else: else:
self.FontMainWeightComboBox.setCurrentIndex(3) self.fontMainWeightComboBox.setCurrentIndex(3)
self.FontMainLineSpacingSpinBox.setValue( self.fontMainLineSpacingSpinBox.setValue(
self.theme.font_main_indentation) self.theme.font_main_indentation)
self.FontMainXSpinBox.setValue(self.theme.font_main_x) self.fontMainXSpinBox.setValue(self.theme.font_main_x)
self.FontMainYSpinBox.setValue(self.theme.font_main_y) self.fontMainYSpinBox.setValue(self.theme.font_main_y)
self.FontMainWidthSpinBox.setValue(self.theme.font_main_width) self.fontMainWidthSpinBox.setValue(self.theme.font_main_width)
self.FontMainHeightSpinBox.setValue(self.theme.font_main_height) self.fontMainHeightSpinBox.setValue(self.theme.font_main_height)
# Font Footer Tab # Font Footer Tab
self.FontFooterComboBox.setCurrentFont( self.fontFooterComboBox.setCurrentFont(
QtGui.QFont(self.theme.font_footer_name)) QtGui.QFont(self.theme.font_footer_name))
self.FontFooterSizeSpinBox.setValue( self.fontFooterSizeSpinBox.setValue(
self.theme.font_footer_proportion) self.theme.font_footer_proportion)
if not self.theme.font_footer_italics and \ if not self.theme.font_footer_italics and \
self.theme.font_footer_weight == u'Normal': self.theme.font_footer_weight == u'Normal':
self.FontFooterWeightComboBox.setCurrentIndex(0) self.fontFooterWeightComboBox.setCurrentIndex(0)
elif not self.theme.font_footer_italics and \ elif not self.theme.font_footer_italics and \
self.theme.font_footer_weight == u'Bold': self.theme.font_footer_weight == u'Bold':
self.FontFooterWeightComboBox.setCurrentIndex(1) self.fontFooterWeightComboBox.setCurrentIndex(1)
elif self.theme.font_footer_italics and \ elif self.theme.font_footer_italics and \
self.theme.font_footer_weight == u'Normal': self.theme.font_footer_weight == u'Normal':
self.FontFooterWeightComboBox.setCurrentIndex(2) self.fontFooterWeightComboBox.setCurrentIndex(2)
else: else:
self.FontFooterWeightComboBox.setCurrentIndex(3) self.fontFooterWeightComboBox.setCurrentIndex(3)
self.FontFooterXSpinBox.setValue(self.theme.font_footer_x) self.fontFooterXSpinBox.setValue(self.theme.font_footer_x)
self.FontFooterYSpinBox.setValue(self.theme.font_footer_y) self.fontFooterYSpinBox.setValue(self.theme.font_footer_y)
self.FontFooterWidthSpinBox.setValue(self.theme.font_footer_width) self.fontFooterWidthSpinBox.setValue(self.theme.font_footer_width)
self.FontFooterHeightSpinBox.setValue(self.theme.font_footer_height) self.fontFooterHeightSpinBox.setValue(self.theme.font_footer_height)
self.FontMainColorPushButton.setStyleSheet( self.fontMainColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.font_main_color)) u'background-color: %s' % unicode(theme.font_main_color))
self.FontFooterColorPushButton.setStyleSheet( self.fontFooterColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.font_footer_color)) u'background-color: %s' % unicode(theme.font_footer_color))
if not self.theme.font_main_override: if not self.theme.font_main_override:
self.FontMainDefaultCheckBox.setChecked(True) self.fontMainDefaultCheckBox.setChecked(True)
else: else:
self.FontMainDefaultCheckBox.setChecked(False) self.fontMainDefaultCheckBox.setChecked(False)
if not self.theme.font_footer_override: if not self.theme.font_footer_override:
self.FontFooterDefaultCheckBox.setChecked(True) self.fontFooterDefaultCheckBox.setChecked(True)
else: else:
self.FontFooterDefaultCheckBox.setChecked(False) self.fontFooterDefaultCheckBox.setChecked(False)
self.OutlineColorPushButton.setStyleSheet( self.outlineColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.display_outline_color)) u'background-color: %s' % unicode(theme.display_outline_color))
self.ShadowColorPushButton.setStyleSheet( self.shadowColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.display_shadow_color)) u'background-color: %s' % unicode(theme.display_shadow_color))
if self.theme.display_outline: if self.theme.display_outline:
self.OutlineCheckBox.setChecked(True) self.outlineCheckBox.setChecked(True)
self.OutlineColorPushButton.setEnabled(True) self.outlineColorPushButton.setEnabled(True)
else: else:
self.OutlineCheckBox.setChecked(False) self.outlineCheckBox.setChecked(False)
self.OutlineColorPushButton.setEnabled(False) self.outlineColorPushButton.setEnabled(False)
self.OutlineSpinBox.setValue(int(self.theme.display_outline_size)) self.outlineSpinBox.setValue(int(self.theme.display_outline_size))
if self.theme.display_shadow: if self.theme.display_shadow:
self.ShadowCheckBox.setChecked(True) self.shadowCheckBox.setChecked(True)
self.ShadowColorPushButton.setEnabled(True) self.shadowColorPushButton.setEnabled(True)
else: else:
self.ShadowCheckBox.setChecked(False) self.shadowCheckBox.setChecked(False)
self.ShadowColorPushButton.setEnabled(False) self.shadowColorPushButton.setEnabled(False)
self.ShadowSpinBox.setValue(int(self.theme.display_shadow_size)) self.shadowSpinBox.setValue(int(self.theme.display_shadow_size))
if self.theme.display_slideTransition: if self.theme.display_slideTransition:
self.SlideTransitionCheckBox.setCheckState(QtCore.Qt.Checked) self.slideTransitionCheckBox.setCheckState(QtCore.Qt.Checked)
else: else:
self.SlideTransitionCheckBox.setCheckState(QtCore.Qt.Unchecked) self.slideTransitionCheckBox.setCheckState(QtCore.Qt.Unchecked)
self.HorizontalComboBox.setCurrentIndex( self.horizontalComboBox.setCurrentIndex(
self.theme.display_horizontalAlign) self.theme.display_horizontalAlign)
self.VerticalComboBox.setCurrentIndex(self.theme.display_verticalAlign) self.verticalComboBox.setCurrentIndex(self.theme.display_verticalAlign)
def stateChanging(self, theme): def stateChanging(self, theme):
if theme.background_mode == u'transparent': if theme.background_mode == u'transparent':
self.Color1Label.setVisible(False) self.color1Label.setVisible(False)
self.Color1PushButton.setVisible(False) self.color1PushButton.setVisible(False)
self.Color2Label.setVisible(False) self.color2Label.setVisible(False)
self.Color2PushButton.setVisible(False) self.color2PushButton.setVisible(False)
self.ImageLabel.setVisible(False) self.imageLabel.setVisible(False)
self.ImageLineEdit.setVisible(False) self.imageLineEdit.setVisible(False)
self.ImageFilenameWidget.setVisible(False) self.imageFilenameWidget.setVisible(False)
self.GradientLabel.setVisible(False) self.gradientLabel.setVisible(False)
self.GradientComboBox.setVisible(False) self.gradientComboBox.setVisible(False)
self.BackgroundTypeComboBox.setVisible(False) self.backgroundTypeComboBox.setVisible(False)
self.BackgroundTypeLabel.setVisible(False) self.backgroundTypeLabel.setVisible(False)
else: else:
self.BackgroundTypeComboBox.setVisible(True) self.backgroundTypeComboBox.setVisible(True)
self.BackgroundTypeLabel.setVisible(True) self.backgroundTypeLabel.setVisible(True)
if theme.background_type == u'solid': if theme.background_type == u'solid':
self.Color1PushButton.setStyleSheet( self.color1PushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.background_color)) u'background-color: %s' % unicode(theme.background_color))
self.Color1Label.setText( self.color1Label.setText(
translate('AmendThemeForm', 'Color:')) translate('OpenLP.AmendThemeForm', 'Color:'))
self.Color1Label.setVisible(True) self.color1Label.setVisible(True)
self.Color1PushButton.setVisible(True) self.color1PushButton.setVisible(True)
self.Color2Label.setVisible(False) self.color2Label.setVisible(False)
self.Color2PushButton.setVisible(False) self.color2PushButton.setVisible(False)
self.ImageLabel.setVisible(False) self.imageLabel.setVisible(False)
self.ImageLineEdit.setVisible(False) self.imageLineEdit.setVisible(False)
self.ImageFilenameWidget.setVisible(False) self.imageFilenameWidget.setVisible(False)
self.GradientLabel.setVisible(False) self.gradientLabel.setVisible(False)
self.GradientComboBox.setVisible(False) self.gradientComboBox.setVisible(False)
elif theme.background_type == u'gradient': elif theme.background_type == u'gradient':
self.Color1PushButton.setStyleSheet(u'background-color: %s' \ self.color1PushButton.setStyleSheet(u'background-color: %s' \
% unicode(theme.background_startColor)) % unicode(theme.background_startColor))
self.Color2PushButton.setStyleSheet(u'background-color: %s' \ self.color2PushButton.setStyleSheet(u'background-color: %s' \
% unicode(theme.background_endColor)) % unicode(theme.background_endColor))
self.Color1Label.setText( self.color1Label.setText(
translate('AmendThemeForm', 'First color:')) translate('OpenLP.AmendThemeForm', 'First color:'))
self.Color2Label.setText( self.color2Label.setText(
translate('AmendThemeForm', 'Second color:')) translate('OpenLP.AmendThemeForm', 'Second color:'))
self.Color1Label.setVisible(True) self.color1Label.setVisible(True)
self.Color1PushButton.setVisible(True) self.color1PushButton.setVisible(True)
self.Color2Label.setVisible(True) self.color2Label.setVisible(True)
self.Color2PushButton.setVisible(True) self.color2PushButton.setVisible(True)
self.ImageLabel.setVisible(False) self.imageLabel.setVisible(False)
self.ImageLineEdit.setVisible(False) self.imageLineEdit.setVisible(False)
self.ImageFilenameWidget.setVisible(False) self.imageFilenameWidget.setVisible(False)
self.GradientLabel.setVisible(True) self.gradientLabel.setVisible(True)
self.GradientComboBox.setVisible(True) self.gradientComboBox.setVisible(True)
else: # must be image else: # must be image
self.Color1Label.setVisible(False) self.color1Label.setVisible(False)
self.Color1PushButton.setVisible(False) self.color1PushButton.setVisible(False)
self.Color2Label.setVisible(False) self.color2Label.setVisible(False)
self.Color2PushButton.setVisible(False) self.color2PushButton.setVisible(False)
self.ImageLabel.setVisible(True) self.imageLabel.setVisible(True)
self.ImageLineEdit.setVisible(True) self.imageLineEdit.setVisible(True)
self.ImageFilenameWidget.setVisible(True) self.imageFilenameWidget.setVisible(True)
self.GradientLabel.setVisible(False) self.gradientLabel.setVisible(False)
self.GradientComboBox.setVisible(False) self.gradientComboBox.setVisible(False)
if not theme.font_main_override: if not theme.font_main_override:
self.FontMainXSpinBox.setEnabled(False) self.fontMainXSpinBox.setEnabled(False)
self.FontMainYSpinBox.setEnabled(False) self.fontMainYSpinBox.setEnabled(False)
self.FontMainWidthSpinBox.setEnabled(False) self.fontMainWidthSpinBox.setEnabled(False)
self.FontMainHeightSpinBox.setEnabled(False) self.fontMainHeightSpinBox.setEnabled(False)
else: else:
self.FontMainXSpinBox.setEnabled(True) self.fontMainXSpinBox.setEnabled(True)
self.FontMainYSpinBox.setEnabled(True) self.fontMainYSpinBox.setEnabled(True)
self.FontMainWidthSpinBox.setEnabled(True) self.fontMainWidthSpinBox.setEnabled(True)
self.FontMainHeightSpinBox.setEnabled(True) self.fontMainHeightSpinBox.setEnabled(True)
if not theme.font_footer_override: if not theme.font_footer_override:
self.FontFooterXSpinBox.setEnabled(False) self.fontFooterXSpinBox.setEnabled(False)
self.FontFooterYSpinBox.setEnabled(False) self.fontFooterYSpinBox.setEnabled(False)
self.FontFooterWidthSpinBox.setEnabled(False) self.fontFooterWidthSpinBox.setEnabled(False)
self.FontFooterHeightSpinBox.setEnabled(False) self.fontFooterHeightSpinBox.setEnabled(False)
else: else:
self.FontFooterXSpinBox.setEnabled(True) self.fontFooterXSpinBox.setEnabled(True)
self.FontFooterYSpinBox.setEnabled(True) self.fontFooterYSpinBox.setEnabled(True)
self.FontFooterWidthSpinBox.setEnabled(True) self.fontFooterWidthSpinBox.setEnabled(True)
self.FontFooterHeightSpinBox.setEnabled(True) self.fontFooterHeightSpinBox.setEnabled(True)
if self.theme.display_outline: if self.theme.display_outline:
self.OutlineColorPushButton.setEnabled(True) self.outlineColorPushButton.setEnabled(True)
else: else:
self.OutlineColorPushButton.setEnabled(False) self.outlineColorPushButton.setEnabled(False)
if self.theme.display_shadow: if self.theme.display_shadow:
self.ShadowColorPushButton.setEnabled(True) self.shadowColorPushButton.setEnabled(True)
else: else:
self.ShadowColorPushButton.setEnabled(False) self.shadowColorPushButton.setEnabled(False)
def previewTheme(self): def previewTheme(self):
if self.allowPreview: if self.allowPreview:
@ -740,15 +742,15 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
# pixels top/bottom # pixels top/bottom
line_height += 2 * int(self.theme.display_outline_size) line_height += 2 * int(self.theme.display_outline_size)
page_length = \ page_length = \
((self.FontMainHeightSpinBox.value()) / line_height ) ((self.fontMainHeightSpinBox.value()) / line_height )
log.debug(u'Page Length area height %s, metrics %s, lines %s' % log.debug(u'Page Length area height %s, metrics %s, lines %s' %
(self.FontMainHeightSpinBox.value(), metrics.height(), (self.fontMainHeightSpinBox.value(), metrics.height(),
page_length)) page_length))
page_length_text = unicode( page_length_text = unicode(
translate('AmendThemeForm', 'Slide height is %s rows.')) translate('OpenLP.AmendThemeForm', 'Slide height is %s rows.'))
self.FontMainLinesPageLabel.setText(page_length_text % page_length) self.fontMainLinesPageLabel.setText(page_length_text % page_length)
frame = self.thememanager.generateImage(self.theme) frame = self.thememanager.generateImage(self.theme)
self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame)) self.themePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
def _getThemeMetrics(self): def _getThemeMetrics(self):
main_weight = 50 main_weight = 50
@ -763,6 +765,5 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
# Validate that the screen width is big enough to display the text # Validate that the screen width is big enough to display the text
if self.theme.font_main_width < metrics.maxWidth() * 2 + 64: if self.theme.font_main_width < metrics.maxWidth() * 2 + 64:
self.theme.font_main_width = metrics.maxWidth() * 2 + 64 self.theme.font_main_width = metrics.maxWidth() * 2 + 64
self.FontMainWidthSpinBox.setValue(self.theme.font_main_width) self.fontMainWidthSpinBox.setValue(self.theme.font_main_width)
return metrics return metrics

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -37,6 +38,8 @@ class GeneralTab(SettingsTab):
""" """
self.screens = screens self.screens = screens
self.monitorNumber = 0 self.monitorNumber = 0
# Set to True to allow PostSetup to work on application start up
self.overrideChanged = True
SettingsTab.__init__(self, u'General') SettingsTab.__init__(self, u'General')
def preLoad(self): def preLoad(self):
@ -59,97 +62,102 @@ class GeneralTab(SettingsTab):
Create the user interface for the general settings tab Create the user interface for the general settings tab
""" """
self.setObjectName(u'GeneralTab') self.setObjectName(u'GeneralTab')
self.tabTitleVisible = translate('GeneralTab', 'General') self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General')
self.GeneralLayout = QtGui.QHBoxLayout(self) self.generalLayout = QtGui.QHBoxLayout(self)
self.GeneralLayout.setSpacing(8) self.generalLayout.setSpacing(8)
self.GeneralLayout.setMargin(8) self.generalLayout.setMargin(8)
self.GeneralLayout.setObjectName(u'GeneralLayout') self.generalLayout.setObjectName(u'generalLayout')
self.GeneralLeftLayout = QtGui.QVBoxLayout() self.generalLeftLayout = QtGui.QVBoxLayout()
self.GeneralLeftLayout.setObjectName(u'GeneralLeftLayout') self.generalLeftLayout.setObjectName(u'generalLeftLayout')
self.GeneralLeftLayout.setSpacing(8) self.generalLeftLayout.setSpacing(8)
self.GeneralLeftLayout.setMargin(0) self.generalLeftLayout.setMargin(0)
self.GeneralLayout.addLayout(self.GeneralLeftLayout) self.generalLayout.addLayout(self.generalLeftLayout)
self.MonitorGroupBox = QtGui.QGroupBox(self) self.monitorGroupBox = QtGui.QGroupBox(self)
self.MonitorGroupBox.setObjectName(u'MonitorGroupBox') self.monitorGroupBox.setObjectName(u'monitorGroupBox')
self.MonitorLayout = QtGui.QVBoxLayout(self.MonitorGroupBox) self.monitorLayout = QtGui.QVBoxLayout(self.monitorGroupBox)
self.MonitorLayout.setSpacing(8) self.monitorLayout.setSpacing(8)
self.MonitorLayout.setMargin(8) self.monitorLayout.setMargin(8)
self.MonitorLayout.setObjectName(u'MonitorLayout') self.monitorLayout.setObjectName(u'monitorLayout')
self.MonitorLabel = QtGui.QLabel(self.MonitorGroupBox) self.monitorLabel = QtGui.QLabel(self.monitorGroupBox)
self.MonitorLabel.setObjectName(u'MonitorLabel') self.monitorLabel.setObjectName(u'monitorLabel')
self.MonitorLayout.addWidget(self.MonitorLabel) self.monitorLayout.addWidget(self.monitorLabel)
self.MonitorComboBox = QtGui.QComboBox(self.MonitorGroupBox) self.monitorComboBox = QtGui.QComboBox(self.monitorGroupBox)
self.MonitorComboBox.setObjectName(u'MonitorComboBox') self.monitorComboBox.setObjectName(u'monitorComboBox')
self.MonitorLayout.addWidget(self.MonitorComboBox) self.monitorLayout.addWidget(self.monitorComboBox)
self.MonitorLayout.addWidget(self.MonitorComboBox) self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox)
self.DisplayOnMonitorCheck = QtGui.QCheckBox(self.MonitorGroupBox) self.displayOnMonitorCheck.setObjectName(u'monitorComboBox')
self.DisplayOnMonitorCheck.setObjectName(u'MonitorComboBox') self.monitorLayout.addWidget(self.displayOnMonitorCheck)
self.MonitorLayout.addWidget(self.DisplayOnMonitorCheck) self.generalLeftLayout.addWidget(self.monitorGroupBox)
self.GeneralLeftLayout.addWidget(self.MonitorGroupBox) self.startupGroupBox = QtGui.QGroupBox(self)
self.StartupGroupBox = QtGui.QGroupBox(self) self.startupGroupBox.setObjectName(u'startupGroupBox')
self.StartupGroupBox.setObjectName(u'StartupGroupBox') self.startupLayout = QtGui.QVBoxLayout(self.startupGroupBox)
self.StartupLayout = QtGui.QVBoxLayout(self.StartupGroupBox) self.startupLayout.setSpacing(8)
self.StartupLayout.setSpacing(8) self.startupLayout.setMargin(8)
self.StartupLayout.setMargin(8) self.startupLayout.setObjectName(u'startupLayout')
self.StartupLayout.setObjectName(u'StartupLayout') self.warningCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.WarningCheckBox = QtGui.QCheckBox(self.StartupGroupBox) self.warningCheckBox.setObjectName(u'warningCheckBox')
self.WarningCheckBox.setObjectName(u'WarningCheckBox') self.startupLayout.addWidget(self.warningCheckBox)
self.StartupLayout.addWidget(self.WarningCheckBox) self.autoOpenCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.AutoOpenCheckBox = QtGui.QCheckBox(self.StartupGroupBox) self.autoOpenCheckBox.setObjectName(u'autoOpenCheckBox')
self.AutoOpenCheckBox.setObjectName(u'AutoOpenCheckBox') self.startupLayout.addWidget(self.autoOpenCheckBox)
self.StartupLayout.addWidget(self.AutoOpenCheckBox) self.showSplashCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.ShowSplashCheckBox = QtGui.QCheckBox(self.StartupGroupBox) self.showSplashCheckBox.setObjectName(u'showSplashCheckBox')
self.ShowSplashCheckBox.setObjectName(u'ShowSplashCheckBox') self.startupLayout.addWidget(self.showSplashCheckBox)
self.StartupLayout.addWidget(self.ShowSplashCheckBox) self.generalLeftLayout.addWidget(self.startupGroupBox)
self.GeneralLeftLayout.addWidget(self.StartupGroupBox) self.settingsGroupBox = QtGui.QGroupBox(self)
self.SettingsGroupBox = QtGui.QGroupBox(self) self.settingsGroupBox.setObjectName(u'settingsGroupBox')
self.SettingsGroupBox.setObjectName(u'SettingsGroupBox') self.settingsLayout = QtGui.QGridLayout(self.settingsGroupBox)
self.SettingsLayout = QtGui.QVBoxLayout(self.SettingsGroupBox) self.settingsLayout.setSpacing(8)
self.SettingsLayout.setSpacing(8) self.settingsLayout.setMargin(8)
self.SettingsLayout.setMargin(8) self.settingsLayout.setObjectName(u'settingsLayout')
self.SettingsLayout.setObjectName(u'SettingsLayout') self.saveCheckServiceCheckBox = QtGui.QCheckBox(self.settingsGroupBox)
self.SaveCheckServiceCheckBox = QtGui.QCheckBox(self.SettingsGroupBox) self.saveCheckServiceCheckBox.setObjectName(u'saveCheckServiceCheckBox')
self.SaveCheckServiceCheckBox.setObjectName(u'SaveCheckServiceCheckBox') self.settingsLayout.addWidget(self.saveCheckServiceCheckBox, 0, 0, 1, 2)
self.SettingsLayout.addWidget(self.SaveCheckServiceCheckBox) self.autoPreviewCheckBox = QtGui.QCheckBox(self.settingsGroupBox)
self.GeneralLeftLayout.addWidget(self.SettingsGroupBox) self.autoPreviewCheckBox.setObjectName(u'autoPreviewCheckBox')
self.AutoPreviewCheckBox = QtGui.QCheckBox(self.SettingsGroupBox) self.settingsLayout.addWidget(self.autoPreviewCheckBox, 1, 0, 1, 2)
self.AutoPreviewCheckBox.setObjectName(u'AutoPreviewCheckBox') # Moved here from image tab
self.SettingsLayout.addWidget(self.AutoPreviewCheckBox) self.timeoutLabel = QtGui.QLabel(self.settingsGroupBox)
self.GeneralLeftLayout.addWidget(self.SettingsGroupBox) self.timeoutLabel.setObjectName("timeoutLabel")
self.GeneralLeftSpacer = QtGui.QSpacerItem(20, 40, self.settingsLayout.addWidget(self.timeoutLabel, 2, 0, 1, 1)
self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox)
self.timeoutSpinBox.setObjectName("timeoutSpinBox")
self.settingsLayout.addWidget(self.timeoutSpinBox, 2, 1, 1, 1)
self.generalLeftLayout.addWidget(self.settingsGroupBox)
self.generalLeftSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.GeneralLeftLayout.addItem(self.GeneralLeftSpacer) self.generalLeftLayout.addItem(self.generalLeftSpacer)
self.GeneralRightLayout = QtGui.QVBoxLayout() self.generalRightLayout = QtGui.QVBoxLayout()
self.GeneralRightLayout.setSpacing(8) self.generalRightLayout.setSpacing(8)
self.GeneralRightLayout.setMargin(0) self.generalRightLayout.setMargin(0)
self.GeneralRightLayout.setObjectName(u'GeneralRightLayout') self.generalRightLayout.setObjectName(u'generalRightLayout')
self.GeneralLayout.addLayout(self.GeneralRightLayout) self.generalLayout.addLayout(self.generalRightLayout)
self.CCLIGroupBox = QtGui.QGroupBox(self) self.ccliGroupBox = QtGui.QGroupBox(self)
self.CCLIGroupBox.setObjectName(u'CCLIGroupBox') self.ccliGroupBox.setObjectName(u'ccliGroupBox')
self.CCLILayout = QtGui.QGridLayout(self.CCLIGroupBox) self.ccliLayout = QtGui.QGridLayout(self.ccliGroupBox)
self.CCLILayout.setMargin(8) self.ccliLayout.setMargin(8)
self.CCLILayout.setSpacing(8) self.ccliLayout.setSpacing(8)
self.CCLILayout.setObjectName(u'CCLILayout') self.ccliLayout.setObjectName(u'ccliLayout')
self.NumberLabel = QtGui.QLabel(self.CCLIGroupBox) self.numberLabel = QtGui.QLabel(self.ccliGroupBox)
self.NumberLabel.setObjectName(u'NumberLabel') self.numberLabel.setObjectName(u'numberLabel')
self.CCLILayout.addWidget(self.NumberLabel, 0, 0, 1, 1) self.ccliLayout.addWidget(self.numberLabel, 0, 0, 1, 1)
self.NumberEdit = QtGui.QLineEdit(self.CCLIGroupBox) self.numberEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.NumberEdit.setObjectName(u'NumberEdit') self.numberEdit.setObjectName(u'numberEdit')
self.CCLILayout.addWidget(self.NumberEdit, 0, 1, 1, 1) self.ccliLayout.addWidget(self.numberEdit, 0, 1, 1, 1)
self.UsernameLabel = QtGui.QLabel(self.CCLIGroupBox) self.usernameLabel = QtGui.QLabel(self.ccliGroupBox)
self.UsernameLabel.setObjectName(u'UsernameLabel') self.usernameLabel.setObjectName(u'usernameLabel')
self.CCLILayout.addWidget(self.UsernameLabel, 1, 0, 1, 1) self.ccliLayout.addWidget(self.usernameLabel, 1, 0, 1, 1)
self.UsernameEdit = QtGui.QLineEdit(self.CCLIGroupBox) self.usernameEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.UsernameEdit.setObjectName(u'UsernameEdit') self.usernameEdit.setObjectName(u'usernameEdit')
self.CCLILayout.addWidget(self.UsernameEdit, 1, 1, 1, 1) self.ccliLayout.addWidget(self.usernameEdit, 1, 1, 1, 1)
self.PasswordLabel = QtGui.QLabel(self.CCLIGroupBox) self.passwordLabel = QtGui.QLabel(self.ccliGroupBox)
self.PasswordLabel.setObjectName(u'PasswordLabel') self.passwordLabel.setObjectName(u'passwordLabel')
self.CCLILayout.addWidget(self.PasswordLabel, 2, 0, 1, 1) self.ccliLayout.addWidget(self.passwordLabel, 2, 0, 1, 1)
self.PasswordEdit = QtGui.QLineEdit(self.CCLIGroupBox) self.passwordEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.PasswordEdit.setEchoMode(QtGui.QLineEdit.Password) self.passwordEdit.setEchoMode(QtGui.QLineEdit.Password)
self.PasswordEdit.setObjectName(u'PasswordEdit') self.passwordEdit.setObjectName(u'passwordEdit')
self.CCLILayout.addWidget(self.PasswordEdit, 2, 1, 1, 1) self.ccliLayout.addWidget(self.passwordEdit, 2, 1, 1, 1)
self.GeneralRightLayout.addWidget(self.CCLIGroupBox) self.generalRightLayout.addWidget(self.ccliGroupBox)
# Moved here from display tab # Moved here from display tab
self.displayGroupBox = QtGui.QGroupBox(self) self.displayGroupBox = QtGui.QGroupBox(self)
self.displayGroupBox.setObjectName(u'displayGroupBox') self.displayGroupBox.setObjectName(u'displayGroupBox')
@ -218,7 +226,7 @@ class GeneralTab(SettingsTab):
self.overrideCheckBox = QtGui.QCheckBox(self.displayGroupBox) self.overrideCheckBox = QtGui.QCheckBox(self.displayGroupBox)
self.overrideCheckBox.setObjectName(u'overrideCheckBox') self.overrideCheckBox.setObjectName(u'overrideCheckBox')
self.displayLayout.addWidget(self.overrideCheckBox) self.displayLayout.addWidget(self.overrideCheckBox)
self.GeneralRightLayout.addWidget(self.displayGroupBox) self.generalRightLayout.addWidget(self.displayGroupBox)
# Custom position # Custom position
self.customLayout = QtGui.QHBoxLayout() self.customLayout = QtGui.QHBoxLayout()
self.customLayout.setSpacing(8) self.customLayout.setSpacing(8)
@ -275,9 +283,9 @@ class GeneralTab(SettingsTab):
self.customLayout.addLayout(self.customWidthLayout) self.customLayout.addLayout(self.customWidthLayout)
self.displayLayout.addLayout(self.customLayout) self.displayLayout.addLayout(self.customLayout)
# Bottom spacer # Bottom spacer
self.GeneralRightSpacer = QtGui.QSpacerItem(20, 40, self.generalRightSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.GeneralRightLayout.addItem(self.GeneralRightSpacer) self.generalRightLayout.addItem(self.generalRightSpacer)
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.overrideCheckBox, QtCore.QObject.connect(self.overrideCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled) QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled)
@ -286,31 +294,38 @@ class GeneralTab(SettingsTab):
""" """
Translate the general settings tab to the currently selected language Translate the general settings tab to the currently selected language
""" """
self.MonitorGroupBox.setTitle(translate('GeneralTab', 'Monitors')) self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab',
self.MonitorLabel.setText( 'Monitors'))
translate('OpenLP.GeneralTab', 'Select monitor for output display:')) self.monitorLabel.setText(translate('OpenLP.GeneralTab',
self.DisplayOnMonitorCheck.setText( 'Select monitor for output display:'))
self.displayOnMonitorCheck.setText(
translate('OpenLP.GeneralTab', 'Display if a single screen')) translate('OpenLP.GeneralTab', 'Display if a single screen'))
self.StartupGroupBox.setTitle( self.startupGroupBox.setTitle(
translate('OpenLP.GeneralTab', 'Application Startup')) translate('OpenLP.GeneralTab', 'Application Startup'))
self.WarningCheckBox.setText( self.warningCheckBox.setText(
translate('OpenLP.GeneralTab', 'Show blank screen warning')) translate('OpenLP.GeneralTab', 'Show blank screen warning'))
self.AutoOpenCheckBox.setText( self.autoOpenCheckBox.setText(translate('OpenLP.GeneralTab',
translate('OpenLP.GeneralTab', 'Automatically open the last service')) 'Automatically open the last service'))
self.ShowSplashCheckBox.setText( self.showSplashCheckBox.setText(
translate('OpenLP.GeneralTab', 'Show the splash screen')) translate('OpenLP.GeneralTab', 'Show the splash screen'))
self.SettingsGroupBox.setTitle(translate('OpenLP.GeneralTab', self.settingsGroupBox.setTitle(
'Application Settings')) translate('OpenLP.GeneralTab', 'Application Settings'))
self.SaveCheckServiceCheckBox.setText(translate('OpenLP.GeneralTab', self.saveCheckServiceCheckBox.setText(translate('OpenLP.GeneralTab',
'Prompt to save Service before starting New')) 'Prompt to save before starting a new service'))
self.AutoPreviewCheckBox.setText(translate('OpenLP.GeneralTab', self.autoPreviewCheckBox.setText(translate('OpenLP.GeneralTab',
'Preview Next Song from Service Manager')) 'Automatically preview next item in service'))
self.CCLIGroupBox.setTitle(translate('GeneralTab', 'CCLI Details')) self.timeoutLabel.setText(translate('OpenLP.GeneralTab',
self.NumberLabel.setText(translate('GeneralTab', 'CCLI Number:')) 'Slide loop delay:'))
self.UsernameLabel.setText(translate('OpenLP.GeneralTab', self.timeoutSpinBox.setSuffix(
'SongSelect Username:')) translate('OpenLP.GeneralTab', ' sec'))
self.PasswordLabel.setText( self.ccliGroupBox.setTitle(
translate('OpenLP.GeneralTab', 'SongSelect Password:')) translate('OpenLP.GeneralTab', 'CCLI Details'))
self.numberLabel.setText(
translate('OpenLP.GeneralTab', 'CCLI number:'))
self.usernameLabel.setText(
translate('OpenLP.GeneralTab', 'SongSelect username:'))
self.passwordLabel.setText(
translate('OpenLP.GeneralTab', 'SongSelect password:'))
# Moved from display tab # Moved from display tab
self.displayGroupBox.setTitle( self.displayGroupBox.setTitle(
translate('OpenLP.GeneralTab', 'Display Position')) translate('OpenLP.GeneralTab', 'Display Position'))
@ -318,16 +333,19 @@ class GeneralTab(SettingsTab):
self.currentXValueLabel.setText(u'0') self.currentXValueLabel.setText(u'0')
self.currentYLabel.setText(translate('OpenLP.GeneralTab', 'Y')) self.currentYLabel.setText(translate('OpenLP.GeneralTab', 'Y'))
self.currentYValueLabel.setText(u'0') self.currentYValueLabel.setText(u'0')
self.currentHeightLabel.setText(translate('OpenLP.GeneralTab', 'Height')) self.currentHeightLabel.setText(
translate('OpenLP.GeneralTab', 'Height'))
self.currentHeightValueLabel.setText(u'0') self.currentHeightValueLabel.setText(u'0')
self.currentWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width')) self.currentWidthLabel.setText(
translate('OpenLP.GeneralTab', 'Width'))
self.currentWidthValueLabel.setText(u'0') self.currentWidthValueLabel.setText(u'0')
self.overrideCheckBox.setText(translate('OpenLP.GeneralTab', self.overrideCheckBox.setText(translate('OpenLP.GeneralTab',
'Override display position')) 'Override display position'))
self.customXLabel.setText(translate('DisplayTab', 'X')) self.customXLabel.setText(translate('OpenLP.GeneralTab', 'X'))
self.customYLabel.setText(translate('DisplayTab', 'Y')) self.customYLabel.setText(translate('OpenLP.GeneralTab', 'Y'))
self.customHeightLabel.setText(translate('DisplayTab', 'Height')) self.customHeightLabel.setText(
self.customWidthLabel.setText(translate('DisplayTab', 'Width')) translate('OpenLP.GeneralTab', 'Height'))
self.customWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width'))
def load(self): def load(self):
""" """
@ -336,30 +354,32 @@ 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('GeneralTab', 'Screen'), screen_name = u'%s %d' % (translate('OpenLP.GeneralTab', 'Screen'),
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 = u'%s (%s)' % (screen_name,
translate('GeneralTab', 'primary')) translate('OpenLP.GeneralTab', 'primary'))
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()))
self.UsernameEdit.setText(unicode(settings.value( self.usernameEdit.setText(unicode(settings.value(
u'songselect username', QtCore.QVariant(u'')).toString())) u'songselect username', QtCore.QVariant(u'')).toString()))
self.PasswordEdit.setText(unicode(settings.value( self.passwordEdit.setText(unicode(settings.value(
u'songselect password', QtCore.QVariant(u'')).toString())) u'songselect password', QtCore.QVariant(u'')).toString()))
self.SaveCheckServiceCheckBox.setChecked(settings.value(u'save prompt', self.saveCheckServiceCheckBox.setChecked(settings.value(u'save prompt',
QtCore.QVariant(False)).toBool()) QtCore.QVariant(False)).toBool())
self.MonitorComboBox.setCurrentIndex(self.monitorNumber) self.monitorComboBox.setCurrentIndex(self.monitorNumber)
self.DisplayOnMonitorCheck.setChecked(self.screens.display) self.displayOnMonitorCheck.setChecked(self.screens.display)
self.WarningCheckBox.setChecked(settings.value(u'blank warning', self.warningCheckBox.setChecked(settings.value(u'blank warning',
QtCore.QVariant(False)).toBool()) QtCore.QVariant(False)).toBool())
self.AutoOpenCheckBox.setChecked(settings.value(u'auto open', self.autoOpenCheckBox.setChecked(settings.value(u'auto open',
QtCore.QVariant(False)).toBool()) QtCore.QVariant(False)).toBool())
self.ShowSplashCheckBox.setChecked(settings.value(u'show splash', self.showSplashCheckBox.setChecked(settings.value(u'show splash',
QtCore.QVariant(True)).toBool()) QtCore.QVariant(True)).toBool())
self.AutoPreviewCheckBox.setChecked(settings.value(u'auto preview', self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview',
QtCore.QVariant(False)).toBool()) QtCore.QVariant(False)).toBool())
self.timeoutSpinBox.setValue(settings.value(u'loop delay',
QtCore.QVariant(5)).toInt()[0])
self.currentXValueLabel.setText( self.currentXValueLabel.setText(
unicode(self.screens.current[u'size'].x())) unicode(self.screens.current[u'size'].x()))
self.currentYValueLabel.setText( self.currentYValueLabel.setText(
@ -375,10 +395,12 @@ class GeneralTab(SettingsTab):
QtCore.QVariant(self.screens.current[u'size'].x())).toString()) QtCore.QVariant(self.screens.current[u'size'].x())).toString())
self.customYValueEdit.setText(settings.value(u'y position', self.customYValueEdit.setText(settings.value(u'y position',
QtCore.QVariant(self.screens.current[u'size'].y())).toString()) QtCore.QVariant(self.screens.current[u'size'].y())).toString())
self.customHeightValueEdit.setText(settings.value(u'height', self.customHeightValueEdit.setText(
QtCore.QVariant(self.screens.current[u'size'].height())).toString()) settings.value(u'height', QtCore.QVariant(
self.customWidthValueEdit.setText(settings.value(u'width', self.screens.current[u'size'].height())).toString())
QtCore.QVariant(self.screens.current[u'size'].width())).toString()) self.customWidthValueEdit.setText(
settings.value(u'width', QtCore.QVariant(
self.screens.current[u'size'].width())).toString())
else: else:
self.customXValueEdit.setText( self.customXValueEdit.setText(
unicode(self.screens.current[u'size'].x())) unicode(self.screens.current[u'size'].x()))
@ -393,34 +415,37 @@ class GeneralTab(SettingsTab):
self.customYValueEdit.setEnabled(self.overrideCheckBox.isChecked()) self.customYValueEdit.setEnabled(self.overrideCheckBox.isChecked())
self.customHeightValueEdit.setEnabled(self.overrideCheckBox.isChecked()) self.customHeightValueEdit.setEnabled(self.overrideCheckBox.isChecked())
self.customWidthValueEdit.setEnabled(self.overrideCheckBox.isChecked()) self.customWidthValueEdit.setEnabled(self.overrideCheckBox.isChecked())
self.override_changed = False
def save(self): def save(self):
""" """
Save the settings from the form Save the settings from the form
""" """
self.monitorNumber = self.MonitorComboBox.currentIndex() self.monitorNumber = self.monitorComboBox.currentIndex()
settings = QtCore.QSettings() settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
settings.setValue(u'monitor', QtCore.QVariant(self.monitorNumber)) settings.setValue(u'monitor', QtCore.QVariant(self.monitorNumber))
settings.setValue(u'display on monitor', settings.setValue(u'display on monitor',
QtCore.QVariant(self.DisplayOnMonitorCheck.isChecked())) QtCore.QVariant(self.displayOnMonitorCheck.isChecked()))
settings.setValue(u'blank warning', settings.setValue(u'blank warning',
QtCore.QVariant(self.WarningCheckBox.isChecked())) QtCore.QVariant(self.warningCheckBox.isChecked()))
settings.setValue(u'auto open', settings.setValue(u'auto open',
QtCore.QVariant(self.AutoOpenCheckBox.isChecked())) QtCore.QVariant(self.autoOpenCheckBox.isChecked()))
settings.setValue(u'show splash', settings.setValue(u'show splash',
QtCore.QVariant(self.ShowSplashCheckBox.isChecked())) QtCore.QVariant(self.showSplashCheckBox.isChecked()))
settings.setValue(u'save prompt', settings.setValue(u'save prompt',
QtCore.QVariant(self.SaveCheckServiceCheckBox.isChecked())) QtCore.QVariant(self.saveCheckServiceCheckBox.isChecked()))
settings.setValue(u'auto preview', settings.setValue(u'auto preview',
QtCore.QVariant(self.AutoPreviewCheckBox.isChecked())) QtCore.QVariant(self.autoPreviewCheckBox.isChecked()))
settings.setValue(u'loop delay',
QtCore.QVariant(self.timeoutSpinBox.value()))
Receiver.send_message(u'slidecontroller_live_spin_delay',
self.timeoutSpinBox.value())
settings.setValue(u'ccli number', settings.setValue(u'ccli number',
QtCore.QVariant(self.NumberEdit.displayText())) QtCore.QVariant(self.numberEdit.displayText()))
settings.setValue(u'songselect username', settings.setValue(u'songselect username',
QtCore.QVariant(self.UsernameEdit.displayText())) QtCore.QVariant(self.usernameEdit.displayText()))
settings.setValue(u'songselect password', settings.setValue(u'songselect password',
QtCore.QVariant(self.PasswordEdit.displayText())) QtCore.QVariant(self.passwordEdit.displayText()))
settings.setValue(u'x position', settings.setValue(u'x position',
QtCore.QVariant(self.customXValueEdit.text())) QtCore.QVariant(self.customXValueEdit.text()))
settings.setValue(u'y position', settings.setValue(u'y position',
@ -432,29 +457,42 @@ class GeneralTab(SettingsTab):
settings.setValue(u'override position', settings.setValue(u'override position',
QtCore.QVariant(self.overrideCheckBox.isChecked())) QtCore.QVariant(self.overrideCheckBox.isChecked()))
settings.endGroup() settings.endGroup()
self.screens.display = self.DisplayOnMonitorCheck.isChecked() self.screens.display = self.displayOnMonitorCheck.isChecked()
#Monitor Number has changed. # Monitor Number has changed.
if self.screens.monitor_number != self.monitorNumber: if self.screens.monitor_number != self.monitorNumber:
self.screens.monitor_number = self.monitorNumber self.screens.monitor_number = self.monitorNumber
self.screens.set_current_display(self.monitorNumber) self.screens.set_current_display(self.monitorNumber)
Receiver.send_message(u'config_screen_changed') Receiver.send_message(u'config_screen_changed')
Receiver.send_message(u'config_updated') Receiver.send_message(u'config_updated')
# On save update the screens as well
self.postSetUp()
def postSetUp(self): def postSetUp(self):
self.screens.override[u'size'] = QtCore.QRect( """
int(self.customXValueEdit.text()), Apply settings after settings tab has loaded
int(self.customYValueEdit.text()), """
int(self.customWidthValueEdit.text()), Receiver.send_message(u'slidecontroller_live_spin_delay',
int(self.customHeightValueEdit.text())) self.timeoutSpinBox.value())
if self.overrideCheckBox.isChecked(): # Reset screens after initial definition
self.screens.set_override_display() if self.overrideChanged:
Receiver.send_message(u'config_screen_changed') self.screens.override[u'size'] = QtCore.QRect(
else: int(self.customXValueEdit.text()),
self.screens.reset_current_display() int(self.customYValueEdit.text()),
int(self.customWidthValueEdit.text()),
int(self.customHeightValueEdit.text()))
if self.overrideCheckBox.isChecked():
self.screens.set_override_display()
Receiver.send_message(u'config_screen_changed')
else:
self.screens.reset_current_display()
Receiver.send_message(u'config_screen_changed')
def onOverrideCheckBoxToggled(self, checked): def onOverrideCheckBoxToggled(self, checked):
"""
Toggle screen state depending on check box state
"""
self.customXValueEdit.setEnabled(checked) self.customXValueEdit.setEnabled(checked)
self.customYValueEdit.setEnabled(checked) self.customYValueEdit.setEnabled(checked)
self.customHeightValueEdit.setEnabled(checked) self.customHeightValueEdit.setEnabled(checked)
self.customWidthValueEdit.setEnabled(checked) self.customWidthValueEdit.setEnabled(checked)
self.override_changed = True self.overrideChanged = True

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -91,12 +92,12 @@ class DisplayManager(QtGui.QWidget):
self.videoDisplay.mediaHide(message) self.videoDisplay.mediaHide(message)
self.mainDisplay.hideDisplay(message) self.mainDisplay.hideDisplay(message)
def showDisplay(self, message): def showDisplay(self):
""" """
Hide the output displays Hide the output displays
""" """
self.videoDisplay.mediaShow(message) self.videoDisplay.mediaShow()
self.mainDisplay.showDisplay(message) self.mainDisplay.showDisplay()
def addAlert(self, alertMessage, location): def addAlert(self, alertMessage, location):
""" """
@ -251,6 +252,7 @@ class MainDisplay(DisplayWidget):
self.size().height()) self.size().height())
self.webView.setGeometry(0, 0, self.size().width(), self.webView.setGeometry(0, 0, self.size().width(),
self.size().height()) self.size().height())
self.alertText.setTextWidth(self.size().width())
#Build a custom splash screen #Build a custom splash screen
self.initialFrame = QtGui.QImage( self.initialFrame = QtGui.QImage(
self.screen[u'size'].width(), self.screen[u'size'].width(),
@ -321,7 +323,6 @@ class MainDisplay(DisplayWidget):
def setupAlert(self): def setupAlert(self):
self.alertText = QtGui.QGraphicsTextItem() self.alertText = QtGui.QGraphicsTextItem()
self.alertText.setTextWidth(self.size().width())
self.alertText.setZValue(8) self.alertText.setZValue(8)
self.scene.addItem(self.alertText) self.scene.addItem(self.alertText)
@ -359,7 +360,7 @@ class MainDisplay(DisplayWidget):
if mode != HideMode.Screen and self.isHidden(): if mode != HideMode.Screen and self.isHidden():
self.setVisible(True) self.setVisible(True)
def showDisplay(self, message=u''): def showDisplay(self):
""" """
Show the stored layers so the screen reappears as it was Show the stored layers so the screen reappears as it was
originally. originally.
@ -455,7 +456,7 @@ class MainDisplay(DisplayWidget):
self.displayText.setPixmap(frame) self.displayText.setPixmap(frame)
else: else:
self.displayText.setPixmap(QtGui.QPixmap.fromImage(frame)) self.displayText.setPixmap(QtGui.QPixmap.fromImage(frame))
if not self.isVisible() and self.screens.display: if not self.isVisible() and self.screens.current['primary']:
self.setVisible(True) self.setVisible(True)
class VideoDisplay(Phonon.VideoWidget): class VideoDisplay(Phonon.VideoWidget):
@ -622,7 +623,7 @@ class VideoDisplay(Phonon.VideoWidget):
self.hidden = True self.hidden = True
self.setVisible(False) self.setVisible(False)
def mediaShow(self, message=''): def mediaShow(self):
""" """
Show the video display if it was already hidden Show the video display if it was already hidden
""" """

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -24,8 +25,6 @@
############################################################################### ###############################################################################
import logging import logging
import time
import re
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
@ -33,69 +32,29 @@ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
ThemeManager, SlideController, PluginForm, MediaDockManager, DisplayManager ThemeManager, SlideController, PluginForm, MediaDockManager, DisplayManager
from openlp.core.lib import RenderManager, build_icon, OpenLPDockWidget, \ from openlp.core.lib import RenderManager, build_icon, OpenLPDockWidget, \
SettingsManager, PluginManager, Receiver, translate SettingsManager, PluginManager, Receiver, translate
from openlp.core.utils import check_latest_version, AppLocation, add_actions, \ from openlp.core.utils import AppLocation, add_actions, LanguageManager
LanguageManager
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
MEDIA_MANAGER_STYLE = """ MEDIA_MANAGER_STYLE = """
QToolBox {
padding-bottom: 2px;
}
QToolBox::tab { QToolBox::tab {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 palette(button), stop: 1.0 palette(dark)); stop: 0 palette(button), stop: 0.5 palette(button),
border-width: 1px; stop: 1.0 palette(mid));
border-style: outset; border: 1px groove palette(mid);
border-color: palette(dark);
border-radius: 5px; border-radius: 5px;
} }
QToolBox::tab:selected { QToolBox::tab:selected {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 palette(light), stop: 1.0 palette(button)); stop: 0 palette(light), stop: 0.5 palette(midlight),
border-color: palette(button); stop: 1.0 palette(dark));
border: 1px groove palette(dark);
font-weight: bold;
} }
""" """
class VersionThread(QtCore.QThread):
"""
A special Qt thread class to fetch the version of OpenLP from the website.
This is threaded so that it doesn't affect the loading time of OpenLP.
"""
def __init__(self, parent, app_version):
QtCore.QThread.__init__(self, parent)
self.parent = parent
self.app_version = app_version
self.version_splitter = re.compile(
r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))?')
def run(self):
"""
Run the thread.
"""
time.sleep(1)
Receiver.send_message(u'maindisplay_blank_check')
version = check_latest_version(self.app_version)
remote_version = {}
local_version = {}
match = self.version_splitter.match(version)
if match:
remote_version[u'major'] = int(match.group(1))
remote_version[u'minor'] = int(match.group(2))
remote_version[u'release'] = int(match.group(3))
if len(match.groups()) > 3 and match.group(4):
remote_version[u'revision'] = int(match.group(4))
match = self.version_splitter.match(self.app_version[u'full'])
if match:
local_version[u'major'] = int(match.group(1))
local_version[u'minor'] = int(match.group(2))
local_version[u'release'] = int(match.group(3))
if len(match.groups()) > 3 and match.group(4):
local_version[u'revision'] = int(match.group(4))
if remote_version[u'major'] > local_version[u'major'] or \
remote_version[u'minor'] > local_version[u'minor'] or \
remote_version[u'release'] > local_version[u'release']:
Receiver.send_message(u'openlp_version_check', u'%s' % version)
elif remote_version.get(u'revision') and \
local_version.get(u'revision') and \
remote_version[u'revision'] > local_version[u'revision']:
Receiver.send_message(u'openlp_version_check', u'%s' % version)
class Ui_MainWindow(object): class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
@ -215,17 +174,17 @@ class Ui_MainWindow(object):
# Create the menu items # Create the menu items
self.FileNewItem = QtGui.QAction(MainWindow) self.FileNewItem = QtGui.QAction(MainWindow)
self.FileNewItem.setIcon( self.FileNewItem.setIcon(
self.ServiceManagerContents.Toolbar.getIconFromTitle( self.ServiceManagerContents.toolbar.getIconFromTitle(
u'New Service')) u'New Service'))
self.FileNewItem.setObjectName(u'FileNewItem') self.FileNewItem.setObjectName(u'FileNewItem')
self.FileOpenItem = QtGui.QAction(MainWindow) self.FileOpenItem = QtGui.QAction(MainWindow)
self.FileOpenItem.setIcon( self.FileOpenItem.setIcon(
self.ServiceManagerContents.Toolbar.getIconFromTitle( self.ServiceManagerContents.toolbar.getIconFromTitle(
u'Open Service')) u'Open Service'))
self.FileOpenItem.setObjectName(u'FileOpenItem') self.FileOpenItem.setObjectName(u'FileOpenItem')
self.FileSaveItem = QtGui.QAction(MainWindow) self.FileSaveItem = QtGui.QAction(MainWindow)
self.FileSaveItem.setIcon( self.FileSaveItem.setIcon(
self.ServiceManagerContents.Toolbar.getIconFromTitle( self.ServiceManagerContents.toolbar.getIconFromTitle(
u'Save Service')) u'Save Service'))
self.FileSaveItem.setObjectName(u'FileSaveItem') self.FileSaveItem.setObjectName(u'FileSaveItem')
self.FileSaveAsItem = QtGui.QAction(MainWindow) self.FileSaveAsItem = QtGui.QAction(MainWindow)
@ -303,18 +262,18 @@ class Ui_MainWindow(object):
self.ToolsAddToolItem.setObjectName(u'ToolsAddToolItem') self.ToolsAddToolItem.setObjectName(u'ToolsAddToolItem')
self.ViewPreviewPanel = QtGui.QAction(MainWindow) self.ViewPreviewPanel = QtGui.QAction(MainWindow)
self.ViewPreviewPanel.setCheckable(True) self.ViewPreviewPanel.setCheckable(True)
self.ViewPreviewPanel.setChecked( previewVisible = QtCore.QSettings().value(
self.settingsmanager.get_preview_visibility()) u'user interface/preview panel', QtCore.QVariant(True)).toBool()
self.ViewPreviewPanel.setChecked(previewVisible)
self.ViewPreviewPanel.setObjectName(u'ViewPreviewPanel') self.ViewPreviewPanel.setObjectName(u'ViewPreviewPanel')
self.PreviewController.Panel.setVisible( self.PreviewController.Panel.setVisible(previewVisible)
self.settingsmanager.get_preview_visibility())
self.ViewLivePanel = QtGui.QAction(MainWindow) self.ViewLivePanel = QtGui.QAction(MainWindow)
self.ViewLivePanel.setCheckable(True) self.ViewLivePanel.setCheckable(True)
self.ViewLivePanel.setChecked( liveVisible = QtCore.QSettings().value(u'user interface/live panel',
self.settingsmanager.get_live_visibility()) QtCore.QVariant(True)).toBool()
self.ViewLivePanel.setChecked(liveVisible)
self.ViewLivePanel.setObjectName(u'ViewLivePanel') self.ViewLivePanel.setObjectName(u'ViewLivePanel')
self.LiveController.Panel.setVisible( self.LiveController.Panel.setVisible(liveVisible)
self.settingsmanager.get_live_visibility())
self.ModeDefaultItem = QtGui.QAction(MainWindow) self.ModeDefaultItem = QtGui.QAction(MainWindow)
self.ModeDefaultItem.setCheckable(True) self.ModeDefaultItem.setCheckable(True)
self.ModeDefaultItem.setObjectName(u'ModeDefaultItem') self.ModeDefaultItem.setObjectName(u'ModeDefaultItem')
@ -381,127 +340,150 @@ class Ui_MainWindow(object):
""" """
Set up the translation system Set up the translation system
""" """
MainWindow.mainTitle = translate('MainWindow', 'OpenLP 2.0') MainWindow.mainTitle = translate('OpenLP.MainWindow', 'OpenLP 2.0')
MainWindow.language = translate('MainWindow', 'English') MainWindow.language = translate('OpenLP.MainWindow', 'English')
MainWindow.setWindowTitle(MainWindow.mainTitle) MainWindow.setWindowTitle(MainWindow.mainTitle)
self.FileMenu.setTitle(translate('MainWindow', '&File')) self.FileMenu.setTitle(translate('OpenLP.MainWindow', '&File'))
self.FileImportMenu.setTitle(translate('MainWindow', '&Import')) self.FileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import'))
self.FileExportMenu.setTitle(translate('MainWindow', '&Export')) self.FileExportMenu.setTitle(translate('OpenLP.MainWindow', '&Export'))
self.ViewMenu.setTitle(translate('MainWindow', '&View')) self.ViewMenu.setTitle(translate('OpenLP.MainWindow', '&View'))
self.ViewModeMenu.setTitle(translate('MainWindow', 'M&ode')) self.ViewModeMenu.setTitle(translate('OpenLP.MainWindow', 'M&ode'))
self.ToolsMenu.setTitle(translate('MainWindow', '&Tools')) self.ToolsMenu.setTitle(translate('OpenLP.MainWindow', '&Tools'))
self.SettingsMenu.setTitle(translate('MainWindow', '&Settings')) self.SettingsMenu.setTitle(translate('OpenLP.MainWindow', '&Settings'))
self.SettingsLanguageMenu.setTitle(translate('MainWindow', self.SettingsLanguageMenu.setTitle(translate('OpenLP.MainWindow',
'&Language')) '&Language'))
self.HelpMenu.setTitle(translate('MainWindow', '&Help')) self.HelpMenu.setTitle(translate('OpenLP.MainWindow', '&Help'))
self.MediaManagerDock.setWindowTitle( self.MediaManagerDock.setWindowTitle(
translate('MainWindow', 'Media Manager')) translate('OpenLP.MainWindow', 'Media Manager'))
self.ServiceManagerDock.setWindowTitle( self.ServiceManagerDock.setWindowTitle(
translate('MainWindow', 'Service Manager')) translate('OpenLP.MainWindow', 'Service Manager'))
self.ThemeManagerDock.setWindowTitle( self.ThemeManagerDock.setWindowTitle(
translate('MainWindow', 'Theme Manager')) translate('OpenLP.MainWindow', 'Theme Manager'))
self.FileNewItem.setText(translate('MainWindow', '&New')) self.FileNewItem.setText(translate('OpenLP.MainWindow', '&New'))
self.FileNewItem.setToolTip(translate('MainWindow', 'New Service')) self.FileNewItem.setToolTip(
translate('OpenLP.MainWindow', 'New Service'))
self.FileNewItem.setStatusTip( self.FileNewItem.setStatusTip(
translate('MainWindow', 'Create a new service.')) translate('OpenLP.MainWindow', 'Create a new service.'))
self.FileNewItem.setShortcut(translate('MainWindow', 'Ctrl+N')) self.FileNewItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+N'))
self.FileOpenItem.setText(translate('MainWindow', '&Open')) self.FileOpenItem.setText(translate('OpenLP.MainWindow', '&Open'))
self.FileOpenItem.setToolTip(translate('MainWindow', 'Open Service')) self.FileOpenItem.setToolTip(
translate('OpenLP.MainWindow', 'Open Service'))
self.FileOpenItem.setStatusTip( self.FileOpenItem.setStatusTip(
translate('MainWindow', 'Open an existing service.')) translate('OpenLP.MainWindow', 'Open an existing service.'))
self.FileOpenItem.setShortcut(translate('MainWindow', 'Ctrl+O')) self.FileOpenItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+O'))
self.FileSaveItem.setText(translate('MainWindow', '&Save')) self.FileSaveItem.setText(translate('OpenLP.MainWindow', '&Save'))
self.FileSaveItem.setToolTip(translate('MainWindow', 'Save Service')) self.FileSaveItem.setToolTip(
translate('OpenLP.MainWindow', 'Save Service'))
self.FileSaveItem.setStatusTip( self.FileSaveItem.setStatusTip(
translate('MainWindow', 'Save the current service to disk.')) translate('OpenLP.MainWindow', 'Save the current service to disk.'))
self.FileSaveItem.setShortcut(translate('MainWindow', 'Ctrl+S')) self.FileSaveItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+S'))
self.FileSaveAsItem.setText(translate('MainWindow', 'Save &As...')) self.FileSaveAsItem.setText(
translate('OpenLP.MainWindow', 'Save &As...'))
self.FileSaveAsItem.setToolTip( self.FileSaveAsItem.setToolTip(
translate('MainWindow', 'Save Service As')) translate('OpenLP.MainWindow', 'Save Service As'))
self.FileSaveAsItem.setStatusTip(translate('MainWindow', self.FileSaveAsItem.setStatusTip(translate('OpenLP.MainWindow',
'Save the current service under a new name.')) 'Save the current service under a new name.'))
self.FileSaveAsItem.setShortcut(translate('MainWindow', 'Ctrl+Shift+S')) self.FileSaveAsItem.setShortcut(
self.FileExitItem.setText(translate('MainWindow', 'E&xit')) translate('OpenLP.MainWindow', 'Ctrl+Shift+S'))
self.FileExitItem.setStatusTip(translate('MainWindow', 'Quit OpenLP')) self.FileExitItem.setText(
self.FileExitItem.setShortcut(translate('MainWindow', 'Alt+F4')) translate('OpenLP.MainWindow', 'E&xit'))
self.ImportThemeItem.setText(translate('MainWindow', '&Theme')) self.FileExitItem.setStatusTip(
self.ImportLanguageItem.setText(translate('MainWindow', '&Language')) translate('OpenLP.MainWindow', 'Quit OpenLP'))
self.ExportThemeItem.setText(translate('MainWindow', '&Theme')) self.FileExitItem.setShortcut(
self.ExportLanguageItem.setText(translate('MainWindow', '&Language')) translate('OpenLP.MainWindow', 'Alt+F4'))
self.SettingsConfigureItem.setText(translate('MainWindow', self.ImportThemeItem.setText(
'&Configure OpenLP...')) translate('OpenLP.MainWindow', '&Theme'))
self.ImportLanguageItem.setText(
translate('OpenLP.MainWindow', '&Language'))
self.ExportThemeItem.setText(
translate('OpenLP.MainWindow', '&Theme'))
self.ExportLanguageItem.setText(
translate('OpenLP.MainWindow', '&Language'))
self.SettingsConfigureItem.setText(
translate('OpenLP.MainWindow', '&Configure OpenLP...'))
self.ViewMediaManagerItem.setText( self.ViewMediaManagerItem.setText(
translate('MainWindow', '&Media Manager')) translate('OpenLP.MainWindow', '&Media Manager'))
self.ViewMediaManagerItem.setToolTip( self.ViewMediaManagerItem.setToolTip(
translate('MainWindow', 'Toggle Media Manager')) translate('OpenLP.MainWindow', 'Toggle Media Manager'))
self.ViewMediaManagerItem.setStatusTip(translate('MainWindow', self.ViewMediaManagerItem.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the media manager.')) 'Toggle the visibility of the media manager.'))
self.ViewMediaManagerItem.setShortcut(translate('MainWindow', 'F8')) self.ViewMediaManagerItem.setShortcut(
translate('OpenLP.MainWindow', 'F8'))
self.ViewThemeManagerItem.setText( self.ViewThemeManagerItem.setText(
translate('MainWindow', '&Theme Manager')) translate('OpenLP.MainWindow', '&Theme Manager'))
self.ViewThemeManagerItem.setToolTip( self.ViewThemeManagerItem.setToolTip(
translate('MainWindow', 'Toggle Theme Manager')) translate('OpenLP.MainWindow', 'Toggle Theme Manager'))
self.ViewThemeManagerItem.setStatusTip(translate('MainWindow', self.ViewThemeManagerItem.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the theme manager.')) 'Toggle the visibility of the theme manager.'))
self.ViewThemeManagerItem.setShortcut(translate('MainWindow', 'F10')) self.ViewThemeManagerItem.setShortcut(
translate('OpenLP.MainWindow', 'F10'))
self.ViewServiceManagerItem.setText( self.ViewServiceManagerItem.setText(
translate('MainWindow', '&Service Manager')) translate('OpenLP.MainWindow', '&Service Manager'))
self.ViewServiceManagerItem.setToolTip( self.ViewServiceManagerItem.setToolTip(
translate('MainWindow', 'Toggle Service Manager')) translate('OpenLP.MainWindow', 'Toggle Service Manager'))
self.ViewServiceManagerItem.setStatusTip(translate('MainWindow', self.ViewServiceManagerItem.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the service manager.')) 'Toggle the visibility of the service manager.'))
self.ViewServiceManagerItem.setShortcut(translate('MainWindow', 'F9')) self.ViewServiceManagerItem.setShortcut(
translate('OpenLP.MainWindow', 'F9'))
self.ViewPreviewPanel.setText( self.ViewPreviewPanel.setText(
translate('MainWindow', '&Preview Panel')) translate('OpenLP.MainWindow', '&Preview Panel'))
self.ViewPreviewPanel.setToolTip( self.ViewPreviewPanel.setToolTip(
translate('MainWindow', 'Toggle Preview Panel')) translate('OpenLP.MainWindow', 'Toggle Preview Panel'))
self.ViewPreviewPanel.setStatusTip(translate('MainWindow', self.ViewPreviewPanel.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the preview panel.')) 'Toggle the visibility of the preview panel.'))
self.ViewPreviewPanel.setShortcut(translate('MainWindow', 'F11')) self.ViewPreviewPanel.setShortcut(
translate('OpenLP.MainWindow', 'F11'))
self.ViewLivePanel.setText( self.ViewLivePanel.setText(
translate('MainWindow', '&Live Panel')) translate('OpenLP.MainWindow', '&Live Panel'))
self.ViewLivePanel.setToolTip( self.ViewLivePanel.setToolTip(
translate('MainWindow', 'Toggle Live Panel')) translate('OpenLP.MainWindow', 'Toggle Live Panel'))
self.ViewLivePanel.setStatusTip(translate('MainWindow', self.ViewLivePanel.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the live panel.')) 'Toggle the visibility of the live panel.'))
self.ViewLivePanel.setShortcut(translate('MainWindow', 'F12')) self.ViewLivePanel.setShortcut(
self.SettingsPluginListItem.setText(translate('MainWindow', translate('OpenLP.MainWindow', 'F12'))
self.SettingsPluginListItem.setText(translate('OpenLP.MainWindow',
'&Plugin List')) '&Plugin List'))
self.SettingsPluginListItem.setStatusTip( self.SettingsPluginListItem.setStatusTip(
translate('MainWindow', 'List the Plugins')) translate('OpenLP.MainWindow', 'List the Plugins'))
self.SettingsPluginListItem.setShortcut( self.SettingsPluginListItem.setShortcut(
translate('MainWindow', 'Alt+F7')) translate('OpenLP.MainWindow', 'Alt+F7'))
self.HelpDocumentationItem.setText( self.HelpDocumentationItem.setText(
translate('MainWindow', '&User Guide')) translate('OpenLP.MainWindow', '&User Guide'))
self.HelpAboutItem.setText(translate('MainWindow', '&About')) self.HelpAboutItem.setText(translate('OpenLP.MainWindow', '&About'))
self.HelpAboutItem.setStatusTip( self.HelpAboutItem.setStatusTip(
translate('MainWindow', 'More information about OpenLP')) translate('OpenLP.MainWindow', 'More information about OpenLP'))
self.HelpAboutItem.setShortcut(translate('MainWindow', 'Ctrl+F1')) self.HelpAboutItem.setShortcut(translate('OpenLP.MainWindow',
'Ctrl+F1'))
self.HelpOnlineHelpItem.setText( self.HelpOnlineHelpItem.setText(
translate('MainWindow', '&Online Help')) translate('OpenLP.MainWindow', '&Online Help'))
self.HelpWebSiteItem.setText(translate('MainWindow', '&Web Site')) self.HelpWebSiteItem.setText(
self.AutoLanguageItem.setText(translate('MainWindow', '&Auto Detect')) translate('OpenLP.MainWindow', '&Web Site'))
self.AutoLanguageItem.setText(
translate('OpenLP.MainWindow', '&Auto Detect'))
self.AutoLanguageItem.setStatusTip( self.AutoLanguageItem.setStatusTip(
translate('MainWindow', 'Use the system language, if available.')) translate('OpenLP.MainWindow',
'Use the system language, if available.'))
for item in self.LanguageGroup.actions(): for item in self.LanguageGroup.actions():
item.setText(item.objectName()) item.setText(item.objectName())
item.setStatusTip(unicode(translate('MainWindow', item.setStatusTip(unicode(translate('OpenLP.MainWindow',
'Set the interface language to %s')) % item.objectName()) 'Set the interface language to %s')) % item.objectName())
self.ToolsAddToolItem.setText(translate('MainWindow', 'Add &Tool...')) self.ToolsAddToolItem.setText(
translate('OpenLP.MainWindow', 'Add &Tool...'))
self.ToolsAddToolItem.setStatusTip( self.ToolsAddToolItem.setStatusTip(
translate('MainWindow', translate('OpenLP.MainWindow',
'Add an application to the list of tools.')) 'Add an application to the list of tools.'))
self.ModeDefaultItem.setText(translate('MainWindow', '&Default')) self.ModeDefaultItem.setText(
translate('OpenLP.MainWindow', '&Default'))
self.ModeDefaultItem.setStatusTip( self.ModeDefaultItem.setStatusTip(
translate('MainWindow', translate('OpenLP.MainWindow',
'Set the view mode back to the default.')) 'Set the view mode back to the default.'))
self.ModeSetupItem.setText(translate('MainWindow', '&Setup')) self.ModeSetupItem.setText(translate('OpenLP.MainWindow', '&Setup'))
self.ModeSetupItem.setStatusTip( self.ModeSetupItem.setStatusTip(
translate('MainWindow', translate('OpenLP.MainWindow',
'Set the view mode to Setup.')) 'Set the view mode to Setup.'))
self.ModeLiveItem.setText(translate('MainWindow', '&Live')) self.ModeLiveItem.setText(translate('OpenLP.MainWindow', '&Live'))
self.ModeLiveItem.setStatusTip( self.ModeLiveItem.setStatusTip(
translate('MainWindow', translate('OpenLP.MainWindow',
'Set the view mode to Live.')) 'Set the view mode to Live.'))
@ -550,20 +532,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'triggered()'), QtCore.SIGNAL(u'triggered()'),
self.ThemeManagerContents.onExportTheme) self.ThemeManagerContents.onExportTheme)
QtCore.QObject.connect(self.ViewMediaManagerItem, QtCore.QObject.connect(self.ViewMediaManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), QtCore.SIGNAL(u'triggered(bool)'), self.toggleMediaManager)
self.toggleMediaManager)
QtCore.QObject.connect(self.ViewServiceManagerItem, QtCore.QObject.connect(self.ViewServiceManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), QtCore.SIGNAL(u'triggered(bool)'), self.toggleServiceManager)
self.toggleServiceManager)
QtCore.QObject.connect(self.ViewThemeManagerItem, QtCore.QObject.connect(self.ViewThemeManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), QtCore.SIGNAL(u'triggered(bool)'), self.toggleThemeManager)
self.toggleThemeManager)
QtCore.QObject.connect(self.ViewPreviewPanel, QtCore.QObject.connect(self.ViewPreviewPanel,
QtCore.SIGNAL(u'toggled(bool)'), QtCore.SIGNAL(u'toggled(bool)'), self.setPreviewPanelVisibility)
self.setPreviewPanelVisibility)
QtCore.QObject.connect(self.ViewLivePanel, QtCore.QObject.connect(self.ViewLivePanel,
QtCore.SIGNAL(u'toggled(bool)'), QtCore.SIGNAL(u'toggled(bool)'), self.setLivePanelVisibility)
self.setLivePanelVisibility)
QtCore.QObject.connect(self.MediaManagerDock, QtCore.QObject.connect(self.MediaManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'), QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.ViewMediaManagerItem.setChecked) self.ViewMediaManagerItem.setChecked)
@ -581,8 +558,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'triggered()'), self.onPluginItemClicked) QtCore.SIGNAL(u'triggered()'), self.onPluginItemClicked)
QtCore.QObject.connect(self.SettingsConfigureItem, QtCore.QObject.connect(self.SettingsConfigureItem,
QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked) QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked)
QtCore.QObject.connect(self.FileNewItem, QtCore.QObject.connect(self.FileNewItem, QtCore.SIGNAL(u'triggered()'),
QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onNewService) self.ServiceManagerContents.onNewService)
QtCore.QObject.connect(self.FileOpenItem, QtCore.QObject.connect(self.FileOpenItem,
QtCore.SIGNAL(u'triggered()'), QtCore.SIGNAL(u'triggered()'),
@ -595,22 +571,18 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.ServiceManagerContents.onSaveService) self.ServiceManagerContents.onSaveService)
#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)'), QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
self.setAutoLanguage)
self.LanguageGroup.triggered.connect(LanguageManager.set_language) self.LanguageGroup.triggered.connect(LanguageManager.set_language)
QtCore.QObject.connect(self.ModeDefaultItem, QtCore.QObject.connect(self.ModeDefaultItem,
QtCore.SIGNAL(u'triggered()'), QtCore.SIGNAL(u'triggered()'), self.setViewMode)
self.onModeDefaultItemClicked)
QtCore.QObject.connect(self.ModeSetupItem, QtCore.QObject.connect(self.ModeSetupItem,
QtCore.SIGNAL(u'triggered()'), QtCore.SIGNAL(u'triggered()'), self.onModeSetupItemClicked)
self.onModeSetupItemClicked)
QtCore.QObject.connect(self.ModeLiveItem, QtCore.QObject.connect(self.ModeLiveItem,
QtCore.SIGNAL(u'triggered()'), QtCore.SIGNAL(u'triggered()'), self.onModeLiveItemClicked)
self.onModeLiveItemClicked)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_update_global'), self.defaultThemeChanged) QtCore.SIGNAL(u'theme_update_global'), self.defaultThemeChanged)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_version_check'), self.versionCheck) QtCore.SIGNAL(u'openlp_version_check'), self.versionNotice)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_blank_check'), self.blankCheck) QtCore.SIGNAL(u'maindisplay_blank_check'), self.blankCheck)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -635,6 +607,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.plugin_helpers[u'toolbox'] = self.mediaDockManager self.plugin_helpers[u'toolbox'] = self.mediaDockManager
self.plugin_helpers[u'displaymanager'] = self.displayManager self.plugin_helpers[u'displaymanager'] = self.displayManager
self.plugin_helpers[u'pluginmanager'] = self.plugin_manager self.plugin_helpers[u'pluginmanager'] = self.plugin_manager
self.plugin_helpers[u'formparent'] = self
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers) self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
# hook methods have to happen after find_plugins. Find plugins needs # hook methods have to happen after find_plugins. Find plugins needs
# the controllers hence the hooks have moved from setupUI() to here # the controllers hence the hooks have moved from setupUI() to here
@ -671,28 +644,25 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
LanguageManager.AutoLanguage = value LanguageManager.AutoLanguage = value
LanguageManager.set_language(self.LanguageGroup.checkedAction()) LanguageManager.set_language(self.LanguageGroup.checkedAction())
def versionCheck(self, version): def versionNotice(self, version):
""" """
Checks the version of the Application called from openlp.pyw Notifies the user that a newer version of OpenLP is available.
Triggered by delay thread. Triggered by delay thread.
""" """
app_version = self.applicationVersion[u'full'] version_text = unicode(translate('OpenLP.MainWindow',
version_text = unicode(translate('MainWindow', 'Version %s of OpenLP ' 'Version %s of OpenLP is now available for download (you are '
'is now available for download (you are currently running version ' 'currently running version %s). \n\nYou can download the latest '
' %s). \n\nYou can download the latest version from ' 'version from '
'http://openlp.org')) '<a href="http://openlp.org/">http://openlp.org/</a>.'))
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self,
translate('MainWindow', 'OpenLP Version Updated'), translate('OpenLP.MainWindow', 'OpenLP Version Updated'),
version_text % (version, app_version), version_text % (version, self.applicationVersion[u'full']))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
def show(self): def show(self):
""" """
Show the main form, as well as the display form Show the main form, as well as the display form
""" """
QtGui.QWidget.show(self) QtGui.QWidget.show(self)
#screen_number = self.getMonitorNumber()
self.displayManager.setup() self.displayManager.setup()
if self.displayManager.mainDisplay.isVisible(): if self.displayManager.mainDisplay.isVisible():
self.displayManager.mainDisplay.setFocus() self.displayManager.mainDisplay.setFocus()
@ -714,18 +684,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if settings.value(u'blank warning', if settings.value(u'blank warning',
QtCore.QVariant(False)).toBool(): QtCore.QVariant(False)).toBool():
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self,
translate('MainWindow', 'OpenLP Main Display Blanked'), translate('OpenLP.MainWindow',
translate('MainWindow', 'OpenLP Main Display Blanked'),
translate('OpenLP.MainWindow',
'The Main Display has been blanked out')) 'The Main Display has been blanked out'))
settings.endGroup() settings.endGroup()
def versionThread(self):
"""
Start an initial setup thread to delay notifications
"""
vT = VersionThread(self, self.applicationVersion)
vT.start()
def onHelpWebSiteClicked(self): def onHelpWebSiteClicked(self):
""" """
Load the OpenLP website Load the OpenLP website
@ -753,35 +717,28 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
self.settingsForm.exec_() self.settingsForm.exec_()
def onModeDefaultItemClicked(self):
"""
Put OpenLP into "Default" view mode.
"""
self.MediaManagerDock.setVisible(True)
self.ServiceManagerDock.setVisible(True)
self.ThemeManagerDock.setVisible(True)
self.setPreviewPanelVisibility(True)
self.setLivePanelVisibility(True)
def onModeSetupItemClicked(self): def onModeSetupItemClicked(self):
""" """
Put OpenLP into "Setup" view mode. Put OpenLP into "Setup" view mode.
""" """
self.MediaManagerDock.setVisible(True) self.setViewMode(True, True, False, True, False)
self.ServiceManagerDock.setVisible(True)
self.ThemeManagerDock.setVisible(False)
self.setPreviewPanelVisibility(True)
self.setLivePanelVisibility(False)
def onModeLiveItemClicked(self): def onModeLiveItemClicked(self):
""" """
Put OpenLP into "Live" view mode. Put OpenLP into "Live" view mode.
""" """
self.MediaManagerDock.setVisible(False) self.setViewMode(False, True, False, False, True)
self.ServiceManagerDock.setVisible(True)
self.ThemeManagerDock.setVisible(False) def setViewMode(self, media=True, service=True, theme=True, preview=True,
self.setPreviewPanelVisibility(False) live=True):
self.setLivePanelVisibility(True) """
Set OpenLP to a different view mode.
"""
self.MediaManagerDock.setVisible(media)
self.ServiceManagerDock.setVisible(service)
self.ThemeManagerDock.setVisible(theme)
self.setPreviewPanelVisibility(preview)
self.setLivePanelVisibility(live)
def screenChanged(self): def screenChanged(self):
""" """
@ -799,8 +756,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
if self.serviceNotSaved: if self.serviceNotSaved:
ret = QtGui.QMessageBox.question(self, ret = QtGui.QMessageBox.question(self,
translate('MainWindow', 'Save Changes to Service?'), translate('OpenLP.MainWindow', 'Save Changes to Service?'),
translate('MainWindow', 'Your service has changed. ' translate('OpenLP.MainWindow', 'Your service has changed. '
'Do you want to save those changes?'), 'Do you want to save those changes?'),
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Cancel |
@ -865,7 +822,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def defaultThemeChanged(self, theme): def defaultThemeChanged(self, theme):
self.DefaultThemeLabel.setText( self.DefaultThemeLabel.setText(
unicode(translate('MainWindow', 'Default Theme: %s')) % theme) unicode(translate('OpenLP.MainWindow', 'Default Theme: %s')) %
theme)
def toggleMediaManager(self, visible): def toggleMediaManager(self, visible):
if self.MediaManagerDock.isVisible() != visible: if self.MediaManagerDock.isVisible() != visible:
@ -890,7 +848,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
False - Hidden False - Hidden
""" """
self.PreviewController.Panel.setVisible(visible) self.PreviewController.Panel.setVisible(visible)
self.settingsmanager.set_preview_visibility(visible) QtCore.QSettings().setValue(u'user interface/preview panel',
QtCore.QVariant(visible))
self.ViewPreviewPanel.setChecked(visible) self.ViewPreviewPanel.setChecked(visible)
def setLivePanelVisibility(self, visible): def setLivePanelVisibility(self, visible):
@ -904,7 +863,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
False - Hidden False - Hidden
""" """
self.LiveController.Panel.setVisible(visible) self.LiveController.Panel.setVisible(visible)
self.settingsmanager.set_live_visibility(visible) QtCore.QSettings().setValue(u'user interface/live panel',
QtCore.QVariant(visible))
self.ViewLivePanel.setChecked(visible) self.ViewLivePanel.setChecked(visible)
def loadSettings(self): def loadSettings(self):

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -27,87 +28,91 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
class Ui_PluginViewDialog(object): class Ui_PluginViewDialog(object):
def setupUi(self, PluginViewDialog): def setupUi(self, pluginViewDialog):
PluginViewDialog.setObjectName(u'PluginViewDialog') pluginViewDialog.setObjectName(u'pluginViewDialog')
PluginViewDialog.setWindowModality(QtCore.Qt.ApplicationModal) pluginViewDialog.setWindowModality(QtCore.Qt.ApplicationModal)
PluginViewDialog.resize(554, 344) pluginViewDialog.resize(554, 344)
self.PluginLayout = QtGui.QVBoxLayout(PluginViewDialog) self.pluginLayout = QtGui.QVBoxLayout(pluginViewDialog)
self.PluginLayout.setSpacing(8) self.pluginLayout.setSpacing(8)
self.PluginLayout.setMargin(8) self.pluginLayout.setMargin(8)
self.PluginLayout.setObjectName(u'PluginLayout') self.pluginLayout.setObjectName(u'pluginLayout')
self.ListLayout = QtGui.QHBoxLayout() self.listLayout = QtGui.QHBoxLayout()
self.ListLayout.setSpacing(8) self.listLayout.setSpacing(8)
self.ListLayout.setObjectName(u'ListLayout') self.listLayout.setObjectName(u'listLayout')
self.PluginListWidget = QtGui.QListWidget(PluginViewDialog) self.pluginListWidget = QtGui.QListWidget(pluginViewDialog)
sizePolicy = QtGui.QSizePolicy( sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth( sizePolicy.setHeightForWidth(
self.PluginListWidget.sizePolicy().hasHeightForWidth()) self.pluginListWidget.sizePolicy().hasHeightForWidth())
self.PluginListWidget.setSizePolicy(sizePolicy) self.pluginListWidget.setSizePolicy(sizePolicy)
self.PluginListWidget.setMaximumSize(QtCore.QSize(192, 16777215)) self.pluginListWidget.setMaximumSize(QtCore.QSize(192, 16777215))
self.PluginListWidget.setObjectName(u'PluginListWidget') self.pluginListWidget.setObjectName(u'pluginListWidget')
self.ListLayout.addWidget(self.PluginListWidget) self.listLayout.addWidget(self.pluginListWidget)
self.PluginInfoGroupBox = QtGui.QGroupBox(PluginViewDialog) self.pluginInfoGroupBox = QtGui.QGroupBox(pluginViewDialog)
self.PluginInfoGroupBox.setAlignment( self.pluginInfoGroupBox.setAlignment(
QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.PluginInfoGroupBox.setFlat(False) self.pluginInfoGroupBox.setFlat(False)
self.PluginInfoGroupBox.setObjectName(u'PluginInfoGroupBox') self.pluginInfoGroupBox.setObjectName(u'pluginInfoGroupBox')
self.PluginInfoLayout = QtGui.QFormLayout(self.PluginInfoGroupBox) self.pluginInfoLayout = QtGui.QFormLayout(self.pluginInfoGroupBox)
self.PluginInfoLayout.setMargin(8) self.pluginInfoLayout.setMargin(8)
self.PluginInfoLayout.setSpacing(8) self.pluginInfoLayout.setSpacing(8)
self.PluginInfoLayout.setObjectName(u'PluginInfoLayout') self.pluginInfoLayout.setObjectName(u'pluginInfoLayout')
self.VersionLabel = QtGui.QLabel(self.PluginInfoGroupBox) self.versionLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.VersionLabel.setObjectName(u'VersionLabel') self.versionLabel.setObjectName(u'versionLabel')
self.PluginInfoLayout.setWidget( self.pluginInfoLayout.setWidget(
1, QtGui.QFormLayout.LabelRole, self.VersionLabel) 1, QtGui.QFormLayout.LabelRole, self.versionLabel)
self.VersionNumberLabel = QtGui.QLabel(self.PluginInfoGroupBox) self.versionNumberLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.VersionNumberLabel.setObjectName(u'VersionNumberLabel') self.versionNumberLabel.setObjectName(u'versionNumberLabel')
self.PluginInfoLayout.setWidget( self.pluginInfoLayout.setWidget(
1, QtGui.QFormLayout.FieldRole, self.VersionNumberLabel) 1, QtGui.QFormLayout.FieldRole, self.versionNumberLabel)
self.AboutLabel = QtGui.QLabel(self.PluginInfoGroupBox) self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.AboutLabel.setObjectName(u'AboutLabel') self.aboutLabel.setObjectName(u'aboutLabel')
self.PluginInfoLayout.setWidget( self.pluginInfoLayout.setWidget(
2, QtGui.QFormLayout.LabelRole, self.AboutLabel) 2, QtGui.QFormLayout.LabelRole, self.aboutLabel)
self.StatusLabel = QtGui.QLabel(self.PluginInfoGroupBox) self.statusLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.StatusLabel.setObjectName(u'StatusLabel') self.statusLabel.setObjectName(u'statusLabel')
self.PluginInfoLayout.setWidget( self.pluginInfoLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.StatusLabel) 0, QtGui.QFormLayout.LabelRole, self.statusLabel)
self.StatusComboBox = QtGui.QComboBox(self.PluginInfoGroupBox) self.statusComboBox = QtGui.QComboBox(self.pluginInfoGroupBox)
self.StatusComboBox.setObjectName(u'StatusComboBox') self.statusComboBox.setObjectName(u'statusComboBox')
self.StatusComboBox.addItem(QtCore.QString()) self.statusComboBox.addItem(QtCore.QString())
self.StatusComboBox.addItem(QtCore.QString()) self.statusComboBox.addItem(QtCore.QString())
self.PluginInfoLayout.setWidget( self.pluginInfoLayout.setWidget(
0, QtGui.QFormLayout.FieldRole, self.StatusComboBox) 0, QtGui.QFormLayout.FieldRole, self.statusComboBox)
self.AboutTextBrowser = QtGui.QTextBrowser(self.PluginInfoGroupBox) self.aboutTextBrowser = QtGui.QTextBrowser(self.pluginInfoGroupBox)
self.AboutTextBrowser.setTextInteractionFlags( self.aboutTextBrowser.setTextInteractionFlags(
QtCore.Qt.LinksAccessibleByMouse) QtCore.Qt.LinksAccessibleByMouse)
self.AboutTextBrowser.setObjectName(u'AboutTextBrowser') self.aboutTextBrowser.setObjectName(u'aboutTextBrowser')
self.PluginInfoLayout.setWidget( self.pluginInfoLayout.setWidget(
2, QtGui.QFormLayout.FieldRole, self.AboutTextBrowser) 2, QtGui.QFormLayout.FieldRole, self.aboutTextBrowser)
self.ListLayout.addWidget(self.PluginInfoGroupBox) self.listLayout.addWidget(self.pluginInfoGroupBox)
self.PluginLayout.addLayout(self.ListLayout) self.pluginLayout.addLayout(self.listLayout)
self.PluginListButtonBox = QtGui.QDialogButtonBox(PluginViewDialog) self.pluginListButtonBox = QtGui.QDialogButtonBox(pluginViewDialog)
self.PluginListButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.pluginListButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.PluginListButtonBox.setObjectName(u'PluginListButtonBox') self.pluginListButtonBox.setObjectName(u'pluginListButtonBox')
self.PluginLayout.addWidget(self.PluginListButtonBox) self.pluginLayout.addWidget(self.pluginListButtonBox)
self.retranslateUi(PluginViewDialog) self.retranslateUi(pluginViewDialog)
QtCore.QObject.connect(self.PluginListButtonBox, QtCore.QObject.connect(self.pluginListButtonBox,
QtCore.SIGNAL(u'accepted()'), PluginViewDialog.close) QtCore.SIGNAL(u'accepted()'), pluginViewDialog.close)
QtCore.QMetaObject.connectSlotsByName(PluginViewDialog) QtCore.QMetaObject.connectSlotsByName(pluginViewDialog)
def retranslateUi(self, PluginViewDialog): def retranslateUi(self, pluginViewDialog):
PluginViewDialog.setWindowTitle( pluginViewDialog.setWindowTitle(
translate('PluginForm', 'Plugin List')) translate('OpenLP.PluginForm', 'Plugin List'))
self.PluginInfoGroupBox.setTitle( self.pluginInfoGroupBox.setTitle(
translate('PluginForm', 'Plugin Details')) translate('OpenLP.PluginForm', 'Plugin Details'))
self.VersionLabel.setText( self.versionLabel.setText(
translate('PluginForm', 'Version:')) translate('OpenLP.PluginForm', 'Version:'))
self.VersionNumberLabel.setText(translate('PluginForm', 'TextLabel')) self.versionNumberLabel.setText(
self.AboutLabel.setText(translate('PluginForm', 'About:')) translate('OpenLP.PluginForm', 'TextLabel'))
self.StatusLabel.setText(translate('PluginForm', 'Status:')) self.aboutLabel.setText(
self.StatusComboBox.setItemText(0, translate('PluginForm', 'Active')) translate('OpenLP.PluginForm', 'About:'))
self.StatusComboBox.setItemText(1, self.statusLabel.setText(
translate('PluginForm', 'Inactive')) translate('OpenLP.PluginForm', 'Status:'))
self.statusComboBox.setItemText(0,
translate('OpenLP.PluginForm', 'Active'))
self.statusComboBox.setItemText(1,
translate('OpenLP.PluginForm', 'Inactive'))

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -44,11 +45,11 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
self._clearDetails() self._clearDetails()
# Right, now let's put some signals and slots together! # Right, now let's put some signals and slots together!
QtCore.QObject.connect( QtCore.QObject.connect(
self.PluginListWidget, self.pluginListWidget,
QtCore.SIGNAL(u'itemSelectionChanged()'), QtCore.SIGNAL(u'itemSelectionChanged()'),
self.onPluginListWidgetSelectionChanged) self.onPluginListWidgetSelectionChanged)
QtCore.QObject.connect( QtCore.QObject.connect(
self.StatusComboBox, self.statusComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.onStatusComboBoxChanged) self.onStatusComboBoxChanged)
@ -56,51 +57,53 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
""" """
Load the plugin details into the screen Load the plugin details into the screen
""" """
self.PluginListWidget.clear() self.pluginListWidget.clear()
for plugin in self.parent.plugin_manager.plugins: for plugin in self.parent.plugin_manager.plugins:
item = QtGui.QListWidgetItem(self.PluginListWidget) item = QtGui.QListWidgetItem(self.pluginListWidget)
# We do this just to make 100% sure the status is an integer as # We do this just to make 100% sure the status is an integer as
# sometimes when it's loaded from the config, it isn't cast to int. # sometimes when it's loaded from the config, it isn't cast to int.
plugin.status = int(plugin.status) plugin.status = int(plugin.status)
# Set the little status text in brackets next to the plugin name. # Set the little status text in brackets next to the plugin name.
status_text = unicode(translate('PluginForm', '%s (Inactive)')) status_text = unicode(
translate('OpenLP.PluginForm', '%s (Inactive)'))
if plugin.status == PluginStatus.Active: if plugin.status == PluginStatus.Active:
status_text = unicode(translate('PluginForm', '%s (Active)')) status_text = unicode(
translate('OpenLP.PluginForm', '%s (Active)'))
elif plugin.status == PluginStatus.Inactive: elif plugin.status == PluginStatus.Inactive:
status_text = unicode( status_text = unicode(
translate('PluginForm', '%s (Inactive)')) translate('OpenLP.PluginForm', '%s (Inactive)'))
elif plugin.status == PluginStatus.Disabled: elif plugin.status == PluginStatus.Disabled:
status_text = unicode( status_text = unicode(
translate('PluginForm', '%s (Disabled)')) translate('OpenLP.PluginForm', '%s (Disabled)'))
item.setText(status_text % plugin.name) item.setText(status_text % plugin.name)
# If the plugin has an icon, set it! # If the plugin has an icon, set it!
if plugin.icon: if plugin.icon:
item.setIcon(plugin.icon) item.setIcon(plugin.icon)
self.PluginListWidget.addItem(item) self.pluginListWidget.addItem(item)
def _clearDetails(self): def _clearDetails(self):
self.StatusComboBox.setCurrentIndex(-1) self.statusComboBox.setCurrentIndex(-1)
self.VersionNumberLabel.setText(u'') self.versionNumberLabel.setText(u'')
self.AboutTextBrowser.setHtml(u'') self.aboutTextBrowser.setHtml(u'')
self.StatusComboBox.setEnabled(False) self.statusComboBox.setEnabled(False)
def _setDetails(self): def _setDetails(self):
log.debug('PluginStatus: %s', str(self.activePlugin.status)) log.debug('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
status = 1 status = 1
if self.activePlugin.status == PluginStatus.Active: if self.activePlugin.status == PluginStatus.Active:
status = 0 status = 0
self.StatusComboBox.setCurrentIndex(status) self.statusComboBox.setCurrentIndex(status)
self.StatusComboBox.setEnabled(True) self.statusComboBox.setEnabled(True)
self.programaticChange = False self.programaticChange = False
def onPluginListWidgetSelectionChanged(self): def onPluginListWidgetSelectionChanged(self):
if self.PluginListWidget.currentItem() is None: if self.pluginListWidget.currentItem() is None:
self._clearDetails() self._clearDetails()
return return
plugin_name = self.PluginListWidget.currentItem().text().split(u' ')[0] plugin_name = self.pluginListWidget.currentItem().text().split(u' ')[0]
self.activePlugin = None self.activePlugin = None
for plugin in self.parent.plugin_manager.plugins: for plugin in self.parent.plugin_manager.plugins:
if plugin.name == plugin_name: if plugin.name == plugin_name:
@ -120,12 +123,16 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
else: else:
self.activePlugin.toggleStatus(PluginStatus.Inactive) self.activePlugin.toggleStatus(PluginStatus.Inactive)
self.activePlugin.finalise() self.activePlugin.finalise()
status_text = 'Inactive' status_text = unicode(
translate('OpenLP.PluginForm', '%s (Inactive)'))
if self.activePlugin.status == PluginStatus.Active: if self.activePlugin.status == PluginStatus.Active:
status_text = 'Active' status_text = unicode(
translate('OpenLP.PluginForm', '%s (Active)'))
elif self.activePlugin.status == PluginStatus.Inactive: elif self.activePlugin.status == PluginStatus.Inactive:
status_text = 'Inactive' status_text = unicode(
translate('OpenLP.PluginForm', '%s (Inactive)'))
elif self.activePlugin.status == PluginStatus.Disabled: elif self.activePlugin.status == PluginStatus.Disabled:
status_text = 'Disabled' status_text = unicode(
self.PluginListWidget.currentItem().setText( translate('OpenLP.PluginForm', '%s (Disabled)'))
u'%s (%s)' % (self.activePlugin.name, status_text)) self.pluginListWidget.currentItem().setText(
status_text % self.activePlugin.name)

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -27,10 +28,10 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
class Ui_ServiceItemEditDialog(object): class Ui_ServiceItemEditDialog(object):
def setupUi(self, ServiceItemEditDialog): def setupUi(self, serviceItemEditDialog):
ServiceItemEditDialog.setObjectName(u'ServiceItemEditDialog') serviceItemEditDialog.setObjectName(u'serviceItemEditDialog')
ServiceItemEditDialog.resize(386, 272) serviceItemEditDialog.resize(386, 272)
self.layoutWidget = QtGui.QWidget(ServiceItemEditDialog) self.layoutWidget = QtGui.QWidget(serviceItemEditDialog)
self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 351, 241)) self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 351, 241))
self.layoutWidget.setObjectName(u'layoutWidget') self.layoutWidget.setObjectName(u'layoutWidget')
self.outerLayout = QtGui.QVBoxLayout(self.layoutWidget) self.outerLayout = QtGui.QVBoxLayout(self.layoutWidget)
@ -46,8 +47,8 @@ class Ui_ServiceItemEditDialog(object):
self.upButton = QtGui.QPushButton(self.layoutWidget) self.upButton = QtGui.QPushButton(self.layoutWidget)
self.upButton.setObjectName(u'upButton') self.upButton.setObjectName(u'upButton')
self.buttonLayout.addWidget(self.upButton) self.buttonLayout.addWidget(self.upButton)
spacerItem = QtGui.QSpacerItem(20, 40, spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Expanding)
self.buttonLayout.addItem(spacerItem) self.buttonLayout.addItem(spacerItem)
self.deleteButton = QtGui.QPushButton(self.layoutWidget) self.deleteButton = QtGui.QPushButton(self.layoutWidget)
self.deleteButton.setObjectName(u'deleteButton') self.deleteButton.setObjectName(u'deleteButton')
@ -58,19 +59,18 @@ class Ui_ServiceItemEditDialog(object):
self.topLayout.addLayout(self.buttonLayout) self.topLayout.addLayout(self.buttonLayout)
self.outerLayout.addLayout(self.topLayout) self.outerLayout.addLayout(self.topLayout)
self.buttonBox = QtGui.QDialogButtonBox(self.layoutWidget) self.buttonBox = QtGui.QDialogButtonBox(self.layoutWidget)
self.buttonBox.setStandardButtons( self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.outerLayout.addWidget(self.buttonBox) self.outerLayout.addWidget(self.buttonBox)
self.retranslateUi(ServiceItemEditDialog) self.retranslateUi(serviceItemEditDialog)
QtCore.QMetaObject.connectSlotsByName(ServiceItemEditDialog) QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog)
def retranslateUi(self, ServiceItemEditDialog):
ServiceItemEditDialog.setWindowTitle(
translate('ServiceItemEditForm', 'Service Item Maintenance'))
self.upButton.setText(translate('ServiceItemEditForm', 'Up'))
self.deleteButton.setText(translate('ServiceItemEditForm', 'Delete'))
self.downButton.setText(translate('ServiceItemEditForm', 'Down'))
def retranslateUi(self, serviceItemEditDialog):
serviceItemEditDialog.setWindowTitle(
translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item'))
self.upButton.setText(translate('OpenLP.ServiceItemEditForm', 'Up'))
self.deleteButton.setText(translate('OpenLP.ServiceItemEditForm',
'Delete'))
self.downButton.setText(translate('OpenLP.ServiceItemEditForm', 'Down'))

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -108,98 +109,105 @@ class ServiceManager(QtGui.QWidget):
self.droppos = 0 self.droppos = 0
#is a new service and has not been saved #is a new service and has not been saved
self.isNew = True self.isNew = True
self.serviceNoteForm = ServiceNoteForm() self.serviceNoteForm = ServiceNoteForm(self.parent)
self.serviceItemEditForm = ServiceItemEditForm() 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)
# Create the top toolbar # Create the top toolbar
self.Toolbar = OpenLPToolbar(self) self.toolbar = OpenLPToolbar(self)
self.Toolbar.addToolbarButton( self.toolbar.addToolbarButton(
translate('ServiceManager', 'New Service'), translate('OpenLP.ServiceManager', 'New Service'),
u':/general/general_new.png', u':/general/general_new.png',
translate('ServiceManager', 'Create a new service'), translate('OpenLP.ServiceManager', 'Create a new service'),
self.onNewService) self.onNewService)
self.Toolbar.addToolbarButton( self.toolbar.addToolbarButton(
translate('ServiceManager', 'Open Service'), translate('OpenLP.ServiceManager', 'Open Service'),
u':/general/general_open.png', u':/general/general_open.png',
translate('ServiceManager', 'Load an existing service'), translate('OpenLP.ServiceManager', 'Load an existing service'),
self.onLoadService) self.onLoadService)
self.Toolbar.addToolbarButton( self.toolbar.addToolbarButton(
translate('ServiceManager', 'Save Service'), translate('OpenLP.ServiceManager', 'Save Service'),
u':/general/general_save.png', u':/general/general_save.png',
translate('ServiceManager', 'Save this service'), translate('OpenLP.ServiceManager', 'Save this service'),
self.onQuickSaveService) self.onQuickSaveService)
self.Toolbar.addSeparator() self.toolbar.addSeparator()
self.ThemeLabel = QtGui.QLabel(translate('ServiceManager', 'Theme:'), self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager',
self) 'Theme:'), self)
self.ThemeLabel.setMargin(3) self.themeLabel.setMargin(3)
self.Toolbar.addToolbarWidget(u'ThemeLabel', self.ThemeLabel) self.toolbar.addToolbarWidget(u'ThemeLabel', self.themeLabel)
self.ThemeComboBox = QtGui.QComboBox(self.Toolbar) self.themeComboBox = QtGui.QComboBox(self.toolbar)
self.ThemeComboBox.setToolTip(translate('ServiceManager', self.themeComboBox.setToolTip(translate('OpenLP.ServiceManager',
'Select a theme for the service')) 'Select a theme for the service'))
self.ThemeComboBox.setSizeAdjustPolicy( self.themeComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToContents) QtGui.QComboBox.AdjustToContents)
self.Toolbar.addToolbarWidget(u'ThemeWidget', self.ThemeComboBox) self.toolbar.addToolbarWidget(u'ThemeWidget', self.themeComboBox)
self.Layout.addWidget(self.Toolbar) self.layout.addWidget(self.toolbar)
# Create the service manager list # Create the service manager list
self.ServiceManagerList = ServiceManagerList(self) self.serviceManagerList = ServiceManagerList(self)
self.ServiceManagerList.setEditTriggers( self.serviceManagerList.setEditTriggers(
QtGui.QAbstractItemView.CurrentChanged | QtGui.QAbstractItemView.CurrentChanged |
QtGui.QAbstractItemView.DoubleClicked | QtGui.QAbstractItemView.DoubleClicked |
QtGui.QAbstractItemView.EditKeyPressed) QtGui.QAbstractItemView.EditKeyPressed)
self.ServiceManagerList.setDragDropMode( self.serviceManagerList.setDragDropMode(
QtGui.QAbstractItemView.DragDrop) QtGui.QAbstractItemView.DragDrop)
self.ServiceManagerList.setAlternatingRowColors(True) self.serviceManagerList.setAlternatingRowColors(True)
self.ServiceManagerList.setHeaderHidden(True) self.serviceManagerList.setHeaderHidden(True)
self.ServiceManagerList.setExpandsOnDoubleClick(False) self.serviceManagerList.setExpandsOnDoubleClick(False)
self.ServiceManagerList.setContextMenuPolicy( self.serviceManagerList.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu) QtCore.Qt.CustomContextMenu)
QtCore.QObject.connect(self.ServiceManagerList, QtCore.QObject.connect(self.serviceManagerList,
QtCore.SIGNAL('customContextMenuRequested(QPoint)'), QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
self.contextMenu) self.contextMenu)
self.ServiceManagerList.setObjectName(u'ServiceManagerList') self.serviceManagerList.setObjectName(u'serviceManagerList')
# enable drop # enable drop
self.ServiceManagerList.__class__.dragEnterEvent = self.dragEnterEvent self.serviceManagerList.__class__.dragEnterEvent = self.dragEnterEvent
self.ServiceManagerList.__class__.dragMoveEvent = self.dragEnterEvent self.serviceManagerList.__class__.dragMoveEvent = self.dragEnterEvent
self.ServiceManagerList.__class__.dropEvent = self.dropEvent self.serviceManagerList.__class__.dropEvent = self.dropEvent
self.Layout.addWidget(self.ServiceManagerList) self.layout.addWidget(self.serviceManagerList)
# Add the bottom toolbar # Add the bottom toolbar
self.OrderToolbar = OpenLPToolbar(self) self.orderToolbar = OpenLPToolbar(self)
self.OrderToolbar.addToolbarButton( self.orderToolbar.addToolbarButton(
translate('ServiceManager', 'Move to &top'), translate('OpenLP.ServiceManager', 'Move to &top'),
u':/services/service_top.png', u':/services/service_top.png',
translate('ServiceManager', 'Move to top'), self.onServiceTop) translate('OpenLP.ServiceManager',
self.OrderToolbar.addToolbarButton( 'Move item to the top of the service.'),
translate('ServiceManager', 'Move &up'), self.onServiceTop)
self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move &up'),
u':/services/service_up.png', u':/services/service_up.png',
translate('ServiceManager', 'Move up order'), self.onServiceUp) translate('OpenLP.ServiceManager',
self.OrderToolbar.addToolbarButton( 'Move item up one position in the service.'),
translate('ServiceManager', 'Move &down'), self.onServiceUp)
self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move &down'),
u':/services/service_down.png', u':/services/service_down.png',
translate('ServiceManager', 'Move down order'), translate('OpenLP.ServiceManager',
'Move item down one position in the service.'),
self.onServiceDown) self.onServiceDown)
self.OrderToolbar.addToolbarButton( self.orderToolbar.addToolbarButton(
translate('ServiceManager', 'Move to &bottom'), translate('OpenLP.ServiceManager', 'Move to &bottom'),
u':/services/service_bottom.png', u':/services/service_bottom.png',
translate('ServiceManager', 'Move to end'), translate('OpenLP.ServiceManager',
'Move item to the end of the service.'),
self.onServiceEnd) self.onServiceEnd)
self.OrderToolbar.addSeparator() self.orderToolbar.addSeparator()
self.OrderToolbar.addToolbarButton( self.orderToolbar.addToolbarButton(
translate('ServiceManager', '&Delete From Service'), translate('OpenLP.ServiceManager', '&Delete From Service'),
u':/general/general_delete.png', u':/general/general_delete.png',
translate('ServiceManager', 'Delete From Service'), translate('OpenLP.ServiceManager',
'Delete the selected item from the service.'),
self.onDeleteFromService) self.onDeleteFromService)
self.Layout.addWidget(self.OrderToolbar) self.layout.addWidget(self.orderToolbar)
# Connect up our signals and slots # Connect up our signals and slots
QtCore.QObject.connect(self.ThemeComboBox, QtCore.QObject.connect(self.themeComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onThemeComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onThemeComboBoxSelected)
QtCore.QObject.connect(self.ServiceManagerList, QtCore.QObject.connect(self.serviceManagerList,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.makeLive) QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.makeLive)
QtCore.QObject.connect(self.ServiceManagerList, QtCore.QObject.connect(self.serviceManagerList,
QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'), self.collapsed) QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'), self.collapsed)
QtCore.QObject.connect(self.ServiceManagerList, QtCore.QObject.connect(self.serviceManagerList,
QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded) QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList) QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
@ -223,44 +231,44 @@ class ServiceManager(QtGui.QWidget):
#build the drag and drop context menu #build the drag and drop context menu
self.dndMenu = QtGui.QMenu() self.dndMenu = QtGui.QMenu()
self.newAction = self.dndMenu.addAction( self.newAction = self.dndMenu.addAction(
translate('ServiceManager', '&Add New Item')) translate('OpenLP.ServiceManager', '&Add New Item'))
self.newAction.setIcon(build_icon(u':/general/general_edit.png')) self.newAction.setIcon(build_icon(u':/general/general_edit.png'))
self.addToAction = self.dndMenu.addAction( self.addToAction = self.dndMenu.addAction(
translate('ServiceManager', '&Add to Selected Item')) translate('OpenLP.ServiceManager', '&Add to Selected Item'))
self.addToAction.setIcon(build_icon(u':/general/general_edit.png')) self.addToAction.setIcon(build_icon(u':/general/general_edit.png'))
#build the context menu #build the context menu
self.menu = QtGui.QMenu() self.menu = QtGui.QMenu()
self.editAction = self.menu.addAction( self.editAction = self.menu.addAction(
translate('ServiceManager', '&Edit Item')) translate('OpenLP.ServiceManager', '&Edit Item'))
self.editAction.setIcon(build_icon(u':/general/general_edit.png')) self.editAction.setIcon(build_icon(u':/general/general_edit.png'))
self.maintainAction = self.menu.addAction( self.maintainAction = self.menu.addAction(
translate('ServiceManager', '&Maintain Item')) translate('OpenLP.ServiceManager', '&Reorder Item'))
self.maintainAction.setIcon(build_icon(u':/general/general_edit.png')) self.maintainAction.setIcon(build_icon(u':/general/general_edit.png'))
self.notesAction = self.menu.addAction( self.notesAction = self.menu.addAction(
translate('ServiceManager', '&Notes')) translate('OpenLP.ServiceManager', '&Notes'))
self.notesAction.setIcon(build_icon(u':/services/service_notes.png')) self.notesAction.setIcon(build_icon(u':/services/service_notes.png'))
self.deleteAction = self.menu.addAction( self.deleteAction = self.menu.addAction(
translate('ServiceManager', '&Delete From Service')) translate('OpenLP.ServiceManager', '&Delete From Service'))
self.deleteAction.setIcon(build_icon(u':/general/general_delete.png')) self.deleteAction.setIcon(build_icon(u':/general/general_delete.png'))
self.sep1 = self.menu.addAction(u'') self.sep1 = self.menu.addAction(u'')
self.sep1.setSeparator(True) self.sep1.setSeparator(True)
self.previewAction = self.menu.addAction( self.previewAction = self.menu.addAction(
translate('ServiceManager', '&Preview Verse')) translate('OpenLP.ServiceManager', '&Preview Verse'))
self.previewAction.setIcon(build_icon(u':/general/general_preview.png')) self.previewAction.setIcon(build_icon(u':/general/general_preview.png'))
self.liveAction = self.menu.addAction( self.liveAction = self.menu.addAction(
translate('ServiceManager', '&Live Verse')) translate('OpenLP.ServiceManager', '&Live Verse'))
self.liveAction.setIcon(build_icon(u':/general/general_live.png')) self.liveAction.setIcon(build_icon(u':/general/general_live.png'))
self.sep2 = self.menu.addAction(u'') self.sep2 = self.menu.addAction(u'')
self.sep2.setSeparator(True) self.sep2.setSeparator(True)
self.themeMenu = QtGui.QMenu( self.themeMenu = QtGui.QMenu(
translate('ServiceManager', '&Change Item Theme')) translate('OpenLP.ServiceManager', '&Change Item Theme'))
self.menu.addMenu(self.themeMenu) self.menu.addMenu(self.themeMenu)
def supportedSuffixes(self, suffix): def supportedSuffixes(self, suffix):
self.suffixes.append(suffix) self.suffixes.append(suffix)
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:
return return
if item.parent() is None: if item.parent() is None:
@ -281,7 +289,7 @@ class ServiceManager(QtGui.QWidget):
self.themeMenu.menuAction().setVisible(False) self.themeMenu.menuAction().setVisible(False)
if serviceItem[u'service_item'].is_text(): if serviceItem[u'service_item'].is_text():
self.themeMenu.menuAction().setVisible(True) self.themeMenu.menuAction().setVisible(True)
action = self.menu.exec_(self.ServiceManagerList.mapToGlobal(point)) action = self.menu.exec_(self.serviceManagerList.mapToGlobal(point))
if action == self.editAction: if action == self.editAction:
self.remoteEdit() self.remoteEdit()
if action == self.maintainAction: if action == self.maintainAction:
@ -318,14 +326,14 @@ class ServiceManager(QtGui.QWidget):
Called by the SlideController to select the Called by the SlideController to select the
next service item next service item
""" """
if len(self.ServiceManagerList.selectedItems()) == 0: if len(self.serviceManagerList.selectedItems()) == 0:
return return
selected = self.ServiceManagerList.selectedItems()[0] selected = self.serviceManagerList.selectedItems()[0]
lookFor = 0 lookFor = 0
serviceIterator = QtGui.QTreeWidgetItemIterator(self.ServiceManagerList) serviceIterator = QtGui.QTreeWidgetItemIterator(self.serviceManagerList)
while serviceIterator.value(): while serviceIterator.value():
if lookFor == 1 and serviceIterator.value().parent() is None: if lookFor == 1 and serviceIterator.value().parent() is None:
self.ServiceManagerList.setCurrentItem(serviceIterator.value()) self.serviceManagerList.setCurrentItem(serviceIterator.value())
self.makeLive() self.makeLive()
return return
if serviceIterator.value() == selected: if serviceIterator.value() == selected:
@ -337,15 +345,15 @@ class ServiceManager(QtGui.QWidget):
Called by the SlideController to select the Called by the SlideController to select the
previous service item previous service item
""" """
if len(self.ServiceManagerList.selectedItems()) == 0: if len(self.serviceManagerList.selectedItems()) == 0:
return return
selected = self.ServiceManagerList.selectedItems()[0] selected = self.serviceManagerList.selectedItems()[0]
prevItem = None prevItem = None
serviceIterator = QtGui.QTreeWidgetItemIterator(self.ServiceManagerList) serviceIterator = QtGui.QTreeWidgetItemIterator(self.serviceManagerList)
while serviceIterator.value(): while serviceIterator.value():
if serviceIterator.value() == selected: if serviceIterator.value() == selected:
if prevItem: if prevItem:
self.ServiceManagerList.setCurrentItem(prevItem) self.serviceManagerList.setCurrentItem(prevItem)
self.makeLive() self.makeLive()
return return
if serviceIterator.value().parent() is None: if serviceIterator.value().parent() is None:
@ -362,9 +370,9 @@ class ServiceManager(QtGui.QWidget):
""" """
Makes a specific item in the service live Makes a specific item in the service live
""" """
if index >= 0 and index < self.ServiceManagerList.topLevelItemCount: if index >= 0 and index < self.serviceManagerList.topLevelItemCount:
item = self.ServiceManagerList.topLevelItem(index) item = self.serviceManagerList.topLevelItem(index)
self.ServiceManagerList.setCurrentItem(item) self.serviceManagerList.setCurrentItem(item)
self.makeLive() self.makeLive()
def onMoveSelectionUp(self): def onMoveSelectionUp(self):
@ -372,7 +380,7 @@ class ServiceManager(QtGui.QWidget):
Moves the selection up the window Moves the selection up the window
Called by the up arrow Called by the up arrow
""" """
serviceIterator = QtGui.QTreeWidgetItemIterator(self.ServiceManagerList) serviceIterator = QtGui.QTreeWidgetItemIterator(self.serviceManagerList)
tempItem = None tempItem = None
setLastItem = False setLastItem = False
while serviceIterator: while serviceIterator:
@ -397,7 +405,7 @@ class ServiceManager(QtGui.QWidget):
Moves the selection down the window Moves the selection down the window
Called by the down arrow Called by the down arrow
""" """
serviceIterator = QtGui.QTreeWidgetItemIterator(self.ServiceManagerList) serviceIterator = QtGui.QTreeWidgetItemIterator(self.serviceManagerList)
firstItem = serviceIterator firstItem = serviceIterator
setSelected = False setSelected = False
while serviceIterator: while serviceIterator:
@ -485,17 +493,16 @@ class ServiceManager(QtGui.QWidget):
self.parent.generalSettingsSection + u'/save prompt', self.parent.generalSettingsSection + u'/save prompt',
QtCore.QVariant(False)).toBool(): QtCore.QVariant(False)).toBool():
ret = QtGui.QMessageBox.question(self, ret = QtGui.QMessageBox.question(self,
translate('ServiceManager', 'Save Changes to Service?'), translate('OpenLP.ServiceManager', 'Save Changes to Service?'),
translate('ServiceManager', translate('OpenLP.ServiceManager',
'Your service is unsaved, do you want to save ' 'Your service is unsaved, do you want to save '
'those changes before creating a new one?'), 'those changes before creating a new one?'),
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save) QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save: if ret == QtGui.QMessageBox.Save:
self.onSaveService() self.onSaveService()
self.ServiceManagerList.clear() self.serviceManagerList.clear()
self.serviceItems = [] self.serviceItems = []
self.serviceName = u'' self.serviceName = u''
self.isNew = True self.isNew = True
@ -523,10 +530,10 @@ class ServiceManager(QtGui.QWidget):
item[u'order'] = count item[u'order'] = count
count += 1 count += 1
#Repaint the screen #Repaint the screen
self.ServiceManagerList.clear() self.serviceManagerList.clear()
for itemcount, item in enumerate(self.serviceItems): for itemcount, item in enumerate(self.serviceItems):
serviceitem = item[u'service_item'] serviceitem = item[u'service_item']
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList) treewidgetitem = QtGui.QTreeWidgetItem(self.serviceManagerList)
if serviceitem.is_valid: if serviceitem.is_valid:
if serviceitem.notes: if serviceitem.notes:
icon = QtGui.QImage(serviceitem.icon) icon = QtGui.QImage(serviceitem.icon)
@ -557,7 +564,7 @@ class ServiceManager(QtGui.QWidget):
if serviceItem == itemcount and serviceItemCount == count: if serviceItem == itemcount and serviceItemCount == count:
#preserve expanding status as setCurrentItem sets it to True #preserve expanding status as setCurrentItem sets it to True
temp = item[u'expanded'] temp = item[u'expanded']
self.ServiceManagerList.setCurrentItem(treewidgetitem1) self.serviceManagerList.setCurrentItem(treewidgetitem1)
item[u'expanded'] = temp item[u'expanded'] = temp
treewidgetitem.setExpanded(item[u'expanded']) treewidgetitem.setExpanded(item[u'expanded'])
@ -571,9 +578,9 @@ class ServiceManager(QtGui.QWidget):
log.debug(u'onSaveService') log.debug(u'onSaveService')
if not quick or self.isNew: if not quick or self.isNew:
filename = QtGui.QFileDialog.getSaveFileName(self, filename = QtGui.QFileDialog.getSaveFileName(self,
translate('ServiceManager', 'Save Service'), translate('OpenLP.ServiceManager', 'Save Service'),
SettingsManager.get_last_dir(self.parent.serviceSettingsSection), SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
translate('ServiceManager', 'OpenLP Service Files (*.osz)')) translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))
else: else:
filename = os.path.join(SettingsManager.get_last_dir( filename = os.path.join(SettingsManager.get_last_dir(
self.parent.serviceSettingsSection), self.serviceName) self.parent.serviceSettingsSection), self.serviceName)
@ -629,7 +636,7 @@ class ServiceManager(QtGui.QWidget):
filename = self.parent.recentFiles[0] filename = self.parent.recentFiles[0]
else: else:
filename = QtGui.QFileDialog.getOpenFileName( filename = QtGui.QFileDialog.getOpenFileName(
self, translate('ServiceManager', 'Open Service'), self, translate('OpenLP.ServiceManager', 'Open Service'),
SettingsManager.get_last_dir( SettingsManager.get_last_dir(
self.parent.serviceSettingsSection), u'Services (*.osz)') self.parent.serviceSettingsSection), u'Services (*.osz)')
filename = QtCore.QDir.toNativeSeparators(filename) filename = QtCore.QDir.toNativeSeparators(filename)
@ -643,13 +650,12 @@ class ServiceManager(QtGui.QWidget):
""" """
if self.parent.serviceNotSaved: if self.parent.serviceNotSaved:
ret = QtGui.QMessageBox.question(self, ret = QtGui.QMessageBox.question(self,
translate('ServiceManager', 'Save Changes to Service?'), translate('OpenLP.ServiceManager', 'Save Changes to Service?'),
translate('ServiceManager', translate('OpenLP.ServiceManager',
'Your current service is unsaved, do you want to ' 'Your current service is unsaved, do you want to '
'save the changes before opening a new one?'), 'save the changes before opening a new one?'),
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Discard | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save) QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save: if ret == QtGui.QMessageBox.Save:
self.onSaveService() self.onSaveService()
@ -673,8 +679,8 @@ class ServiceManager(QtGui.QWidget):
ucsfile = file.decode(u'utf-8') ucsfile = file.decode(u'utf-8')
except UnicodeDecodeError: except UnicodeDecodeError:
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('ServiceManager', 'Error'), self, translate('OpenLP.ServiceManager', 'Error'),
translate('ServiceManager', translate('OpenLP.ServiceManager',
'File is not a valid service.\n' 'File is not a valid service.\n'
'The content encoding is not UTF-8.')) 'The content encoding is not UTF-8.'))
log.exception(u'Filename "%s" is not valid UTF-8' % log.exception(u'Filename "%s" is not valid UTF-8' %
@ -708,8 +714,8 @@ class ServiceManager(QtGui.QWidget):
log.exception(u'Failed to remove osd file') log.exception(u'Failed to remove osd file')
else: else:
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('ServiceManager', 'Error'), self, translate('OpenLP.ServiceManager', 'Error'),
translate('ServiceManager', translate('OpenLP.ServiceManager',
'File is not a valid service.')) 'File is not a valid service.'))
log.exception(u'File contains no service data') log.exception(u'File contains no service data')
except (IOError, NameError): except (IOError, NameError):
@ -750,7 +756,7 @@ class ServiceManager(QtGui.QWidget):
""" """
Set the theme for the current service Set the theme for the current service
""" """
self.service_theme = unicode(self.ThemeComboBox.currentText()) self.service_theme = unicode(self.themeComboBox.currentText())
self.parent.RenderManager.set_service_theme(self.service_theme) self.parent.RenderManager.set_service_theme(self.service_theme)
QtCore.QSettings().setValue( QtCore.QSettings().setValue(
self.parent.serviceSettingsSection + u'/service theme', self.parent.serviceSettingsSection + u'/service theme',
@ -763,11 +769,11 @@ class ServiceManager(QtGui.QWidget):
sure the theme combo box is in the correct state. sure the theme combo box is in the correct state.
""" """
if self.parent.RenderManager.theme_level == ThemeLevel.Global: if self.parent.RenderManager.theme_level == ThemeLevel.Global:
self.Toolbar.actions[u'ThemeLabel'].setVisible(False) self.toolbar.actions[u'ThemeLabel'].setVisible(False)
self.Toolbar.actions[u'ThemeWidget'].setVisible(False) self.toolbar.actions[u'ThemeWidget'].setVisible(False)
else: else:
self.Toolbar.actions[u'ThemeLabel'].setVisible(True) self.toolbar.actions[u'ThemeLabel'].setVisible(True)
self.Toolbar.actions[u'ThemeWidget'].setVisible(True) self.toolbar.actions[u'ThemeWidget'].setVisible(True)
def regenerateServiceItems(self): def regenerateServiceItems(self):
""" """
@ -778,7 +784,7 @@ class ServiceManager(QtGui.QWidget):
self.parent.RenderManager.themedata = None self.parent.RenderManager.themedata = None
if self.serviceItems: if self.serviceItems:
tempServiceItems = self.serviceItems tempServiceItems = self.serviceItems
self.ServiceManagerList.clear() self.serviceManagerList.clear()
self.serviceItems = [] self.serviceItems = []
self.isNew = True self.isNew = True
for item in tempServiceItems: for item in tempServiceItems:
@ -794,7 +800,6 @@ class ServiceManager(QtGui.QWidget):
``item`` ``item``
Service Item to be added Service Item to be added
""" """
sitem = self.findServiceItem()[0] sitem = self.findServiceItem()[0]
item.render() item.render()
@ -837,12 +842,9 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems[item][u'service_item'], count) self.serviceItems[item][u'service_item'], count)
else: else:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ServiceManager', 'Missing Display Handler'), translate('OpenLP.ServiceManager', 'Missing Display Handler'),
translate('ServiceManager', 'Your item cannot be displayed ' translate('OpenLP.ServiceManager', 'Your item cannot be '
'as there is no handler to display it'), 'displayed as there is no handler to display it'))
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
def getServiceItem(self): def getServiceItem(self):
""" """
@ -873,12 +875,9 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems[item][u'service_item'], 0) self.serviceItems[item][u'service_item'], 0)
else: else:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ServiceManager', 'Missing Display Handler'), translate('OpenLP.ServiceManager', 'Missing Display Handler'),
translate('ServiceManager', 'Your item cannot be displayed ' translate('OpenLP.ServiceManager', 'Your item cannot be '
'as there is no handler to display it'), 'displayed as there is no handler to display it'))
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
def remoteEdit(self): def remoteEdit(self):
""" """
@ -895,7 +894,7 @@ class ServiceManager(QtGui.QWidget):
""" """
Finds a ServiceItem in the list Finds a ServiceItem in the list
""" """
items = self.ServiceManagerList.selectedItems() items = self.serviceManagerList.selectedItems()
pos = 0 pos = 0
count = 0 count = 0
for item in items: for item in items:
@ -915,7 +914,6 @@ class ServiceManager(QtGui.QWidget):
``event`` ``event``
Handle of the event pint passed Handle of the event pint passed
""" """
event.accept() event.accept()
@ -931,7 +929,7 @@ class ServiceManager(QtGui.QWidget):
link = event.mimeData() link = event.mimeData()
if link.hasText(): if link.hasText():
plugin = event.mimeData().text() plugin = event.mimeData().text()
item = self.ServiceManagerList.itemAt(event.pos()) item = self.serviceManagerList.itemAt(event.pos())
#ServiceManager started the drag and drop #ServiceManager started the drag and drop
if plugin == u'ServiceManager': if plugin == u'ServiceManager':
startpos, startCount = self.findServiceItem() startpos, startCount = self.findServiceItem()
@ -975,23 +973,21 @@ class ServiceManager(QtGui.QWidget):
``theme_list`` ``theme_list``
A list of current themes to be displayed A list of current themes to be displayed
""" """
self.ThemeComboBox.clear() self.themeComboBox.clear()
self.themeMenu.clear() self.themeMenu.clear()
self.ThemeComboBox.addItem(u'') self.themeComboBox.addItem(u'')
for theme in theme_list: for theme in theme_list:
self.ThemeComboBox.addItem(theme) self.themeComboBox.addItem(theme)
action = context_menu_action( action = context_menu_action(self.serviceManagerList, None, theme,
self.ServiceManagerList, self.onThemeChangeAction)
None,
theme , self.onThemeChangeAction)
self.themeMenu.addAction(action) self.themeMenu.addAction(action)
id = self.ThemeComboBox.findText(self.service_theme, index = self.themeComboBox.findText(self.service_theme,
QtCore.Qt.MatchExactly) QtCore.Qt.MatchExactly)
# Not Found # Not Found
if id == -1: if index == -1:
id = 0 index = 0
self.service_theme = u'' self.service_theme = u''
self.ThemeComboBox.setCurrentIndex(id) self.themeComboBox.setCurrentIndex(index)
self.parent.RenderManager.set_service_theme(self.service_theme) self.parent.RenderManager.set_service_theme(self.service_theme)
self.regenerateServiceItems() self.regenerateServiceItems()
@ -1024,4 +1020,3 @@ class ServiceManager(QtGui.QWidget):
data_item[u'selected'] = (item == curitem) data_item[u'selected'] = (item == curitem)
data.append(data_item) data.append(data_item)
Receiver.send_message(u'servicemanager_list_response', data) Receiver.send_message(u'servicemanager_list_response', data)

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -27,10 +28,10 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
class Ui_ServiceNoteEdit(object): class Ui_ServiceNoteEdit(object):
def setupUi(self, ServiceNoteEdit): def setupUi(self, serviceNoteEdit):
ServiceNoteEdit.setObjectName(u'ServiceNoteEdit') serviceNoteEdit.setObjectName(u'serviceNoteEdit')
ServiceNoteEdit.resize(400, 243) serviceNoteEdit.resize(400, 243)
self.widget = QtGui.QWidget(ServiceNoteEdit) self.widget = QtGui.QWidget(serviceNoteEdit)
self.widget.setGeometry(QtCore.QRect(20, 10, 361, 223)) self.widget.setGeometry(QtCore.QRect(20, 10, 361, 223))
self.widget.setObjectName(u'widget') self.widget.setObjectName(u'widget')
self.verticalLayout = QtGui.QVBoxLayout(self.widget) self.verticalLayout = QtGui.QVBoxLayout(self.widget)
@ -44,9 +45,9 @@ class Ui_ServiceNoteEdit(object):
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.verticalLayout.addWidget(self.buttonBox) self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(ServiceNoteEdit) self.retranslateUi(serviceNoteEdit)
QtCore.QMetaObject.connectSlotsByName(ServiceNoteEdit) QtCore.QMetaObject.connectSlotsByName(serviceNoteEdit)
def retranslateUi(self, ServiceNoteEdit): def retranslateUi(self, serviceNoteEdit):
ServiceNoteEdit.setWindowTitle( serviceNoteEdit.setWindowTitle(
translate('ServiceNoteForm', 'Service Item Notes')) translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -28,19 +29,19 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, build_icon from openlp.core.lib import translate, build_icon
class Ui_SettingsDialog(object): class Ui_SettingsDialog(object):
def setupUi(self, SettingsDialog): def setupUi(self, settingsDialog):
SettingsDialog.setObjectName(u'SettingsDialog') settingsDialog.setObjectName(u'settingsDialog')
SettingsDialog.resize(724, 502) settingsDialog.resize(724, 502)
SettingsDialog.setWindowIcon( settingsDialog.setWindowIcon(
build_icon(u':/system/system_settings.png')) build_icon(u':/system/system_settings.png'))
self.settingsLayout = QtGui.QVBoxLayout(SettingsDialog) self.settingsLayout = QtGui.QVBoxLayout(settingsDialog)
self.settingsLayout.setSpacing(8) self.settingsLayout.setSpacing(8)
self.settingsLayout.setMargin(8) self.settingsLayout.setMargin(8)
self.settingsLayout.setObjectName(u'settingsLayout') self.settingsLayout.setObjectName(u'settingsLayout')
self.settingsTabWidget = QtGui.QTabWidget(SettingsDialog) self.settingsTabWidget = QtGui.QTabWidget(settingsDialog)
self.settingsTabWidget.setObjectName(u'settingsTabWidget') self.settingsTabWidget.setObjectName(u'settingsTabWidget')
self.settingsLayout.addWidget(self.settingsTabWidget) self.settingsLayout.addWidget(self.settingsTabWidget)
self.buttonBox = QtGui.QDialogButtonBox(SettingsDialog) self.buttonBox = QtGui.QDialogButtonBox(settingsDialog)
sizePolicy = QtGui.QSizePolicy( sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
@ -54,14 +55,14 @@ class Ui_SettingsDialog(object):
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.settingsLayout.addWidget(self.buttonBox) self.settingsLayout.addWidget(self.buttonBox)
self.retranslateUi(SettingsDialog) self.retranslateUi(settingsDialog)
self.settingsTabWidget.setCurrentIndex(0) self.settingsTabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.buttonBox, QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), SettingsDialog.accept) QtCore.SIGNAL(u'accepted()'), settingsDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), SettingsDialog.reject) QtCore.SIGNAL(u'rejected()'), settingsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(SettingsDialog) QtCore.QMetaObject.connectSlotsByName(settingsDialog)
def retranslateUi(self, SettingsDialog): def retranslateUi(self, settingsDialog):
SettingsDialog.setWindowTitle(translate('SettingsForm', settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm',
'Configure OpenLP')) 'Configure OpenLP'))

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -128,11 +129,11 @@ class SlideController(QtGui.QWidget):
# Type label for the top of the slide controller # Type label for the top of the slide controller
self.TypeLabel = QtGui.QLabel(self.Panel) self.TypeLabel = QtGui.QLabel(self.Panel)
if self.isLive: if self.isLive:
self.TypeLabel.setText(translate('SlideController', 'Live')) self.TypeLabel.setText(translate('OpenLP.SlideController', 'Live'))
self.split = 1 self.split = 1
self.typePrefix = u'live' self.typePrefix = u'live'
else: else:
self.TypeLabel.setText(translate('SlideController', 'Preview')) self.TypeLabel.setText(translate('OpenLP.SlideController', 'Preview'))
self.split = 0 self.split = 0
self.typePrefix = u'preview' self.typePrefix = u'preview'
self.TypeLabel.setStyleSheet(u'font-weight: bold; font-size: 12pt;') self.TypeLabel.setStyleSheet(u'font-weight: bold; font-size: 12pt;')
@ -179,29 +180,29 @@ class SlideController(QtGui.QWidget):
if self.isLive: if self.isLive:
self.Toolbar.addToolbarButton( self.Toolbar.addToolbarButton(
u'First Slide', u':/slides/slide_first.png', u'First Slide', u':/slides/slide_first.png',
translate('SlideController', 'Move to first'), translate('OpenLP.SlideController', 'Move to first'),
self.onSlideSelectedFirst) self.onSlideSelectedFirst)
self.Toolbar.addToolbarButton( self.Toolbar.addToolbarButton(
u'Previous Slide', u':/slides/slide_previous.png', u'Previous Slide', u':/slides/slide_previous.png',
translate('SlideController', 'Move to previous'), translate('OpenLP.SlideController', 'Move to previous'),
self.onSlideSelectedPrevious) self.onSlideSelectedPrevious)
self.Toolbar.addToolbarButton( self.Toolbar.addToolbarButton(
u'Next Slide', u':/slides/slide_next.png', u'Next Slide', u':/slides/slide_next.png',
translate('SlideController', 'Move to next'), translate('OpenLP.SlideController', 'Move to next'),
self.onSlideSelectedNext) self.onSlideSelectedNext)
if self.isLive: if self.isLive:
self.Toolbar.addToolbarButton( self.Toolbar.addToolbarButton(
u'Last Slide', u':/slides/slide_last.png', u'Last Slide', u':/slides/slide_last.png',
translate('SlideController', 'Move to last'), translate('OpenLP.SlideController', 'Move to last'),
self.onSlideSelectedLast) self.onSlideSelectedLast)
if self.isLive: if self.isLive:
self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarSeparator(u'Close Separator')
self.HideMenu = QtGui.QToolButton(self.Toolbar) self.HideMenu = QtGui.QToolButton(self.Toolbar)
self.HideMenu.setText(translate('SlideController', 'Hide')) self.HideMenu.setText(translate('OpenLP.SlideController', 'Hide'))
self.HideMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup) self.HideMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.Toolbar.addToolbarWidget(u'Hide Menu', self.HideMenu) self.Toolbar.addToolbarWidget(u'Hide Menu', self.HideMenu)
self.HideMenu.setMenu(QtGui.QMenu( self.HideMenu.setMenu(QtGui.QMenu(
translate('SlideController', 'Hide'), self.Toolbar)) translate('OpenLP.SlideController', 'Hide'), self.Toolbar))
self.BlankScreen = QtGui.QAction(QtGui.QIcon( self.BlankScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_blank.png'), u'Blank Screen', self.HideMenu) u':/slides/slide_blank.png'), u'Blank Screen', self.HideMenu)
self.BlankScreen.setCheckable(True) self.BlankScreen.setCheckable(True)
@ -225,44 +226,44 @@ class SlideController(QtGui.QWidget):
self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarSeparator(u'Close Separator')
self.Toolbar.addToolbarButton( self.Toolbar.addToolbarButton(
u'Go Live', u':/general/general_live.png', u'Go Live', u':/general/general_live.png',
translate('SlideController', 'Move to live'), self.onGoLive) translate('OpenLP.SlideController', 'Move to live'), self.onGoLive)
self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarSeparator(u'Close Separator')
self.Toolbar.addToolbarButton( self.Toolbar.addToolbarButton(
u'Edit Song', u':/general/general_edit.png', u'Edit Song', u':/general/general_edit.png',
translate('SlideController', 'Edit and re-preview Song'), translate('OpenLP.SlideController', 'Edit and re-preview Song'),
self.onEditSong) self.onEditSong)
if isLive: 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',
translate('SlideController', 'Start continuous loop'), translate('OpenLP.SlideController', 'Start continuous loop'),
self.onStartLoop) self.onStartLoop)
self.Toolbar.addToolbarButton( self.Toolbar.addToolbarButton(
u'Stop Loop', u':/media/media_stop.png', u'Stop Loop', u':/media/media_stop.png',
translate('SlideController', 'Stop continuous loop'), translate('OpenLP.SlideController', 'Stop continuous loop'),
self.onStopLoop) self.onStopLoop)
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('SlideController', 's')) self.DelaySpinBox.setSuffix(translate('OpenLP.SlideController', 's'))
self.DelaySpinBox.setToolTip(translate('SlideController', self.DelaySpinBox.setToolTip(translate('OpenLP.SlideController',
'Delay between slides in seconds')) 'Delay between slides in seconds'))
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)
self.Mediabar.addToolbarButton( self.Mediabar.addToolbarButton(
u'Media Start', u':/slides/media_playback_start.png', u'Media Start', u':/slides/media_playback_start.png',
translate('SlideController', 'Start playing media'), translate('OpenLP.SlideController', 'Start playing media'),
self.onMediaPlay) self.onMediaPlay)
self.Mediabar.addToolbarButton( self.Mediabar.addToolbarButton(
u'Media Pause', u':/slides/media_playback_pause.png', u'Media Pause', u':/slides/media_playback_pause.png',
translate('SlideController', 'Start playing media'), translate('OpenLP.SlideController', 'Start playing media'),
self.onMediaPause) self.onMediaPause)
self.Mediabar.addToolbarButton( self.Mediabar.addToolbarButton(
u'Media Stop', u':/slides/media_playback_stop.png', u'Media Stop', u':/slides/media_playback_stop.png',
translate('SlideController', 'Start playing media'), translate('OpenLP.SlideController', 'Start playing media'),
self.onMediaStop) self.onMediaStop)
if not self.isLive: if not self.isLive:
self.seekSlider = Phonon.SeekSlider() self.seekSlider = Phonon.SeekSlider()
@ -278,11 +279,11 @@ class SlideController(QtGui.QWidget):
# Build the Song Toolbar # Build the Song Toolbar
if isLive: if isLive:
self.SongMenu = QtGui.QToolButton(self.Toolbar) self.SongMenu = QtGui.QToolButton(self.Toolbar)
self.SongMenu.setText(translate('SlideController', 'Go to Verse')) self.SongMenu.setText(translate('OpenLP.SlideController', 'Go to Verse'))
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('SlideController', 'Go to Verse'), self.Toolbar)) translate('OpenLP.SlideController', 'Go to Verse'), self.Toolbar))
self.Toolbar.makeWidgetsInvisible([u'Song Menu']) self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
# Screen preview area # Screen preview area
self.PreviewFrame = QtGui.QFrame(self.Splitter) self.PreviewFrame = QtGui.QFrame(self.Splitter)
@ -532,12 +533,12 @@ class SlideController(QtGui.QWidget):
self.onMediaStop() self.onMediaStop()
if serviceItem.is_media(): if serviceItem.is_media():
self.onMediaStart(serviceItem) self.onMediaStart(serviceItem)
# if self.isLive: if self.isLive:
# blanked = self.blankButton.isChecked() blanked = self.BlankScreen.isChecked()
# else: else:
# blanked = False blanked = False
Receiver.send_message(u'%s_start' % serviceItem.name.lower(), Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
[serviceItem, self.isLive, True, 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 somthing to point at #Set pointing cursor when we have somthing to point at

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -25,15 +26,10 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate
class SplashScreen(object): class SplashScreen(object):
def __init__(self, version): def __init__(self):
self.splash_screen = QtGui.QSplashScreen() self.splash_screen = QtGui.QSplashScreen()
self.setupUi() self.setupUi()
self.message = translate(
'Splashscreen', 'Starting')\
+ '..... ' + version
def setupUi(self): def setupUi(self):
self.splash_screen.setObjectName(u'splash_screen') self.splash_screen.setObjectName(u'splash_screen')
@ -48,25 +44,15 @@ class SplashScreen(object):
self.splash_screen.sizePolicy().hasHeightForWidth()) self.splash_screen.sizePolicy().hasHeightForWidth())
self.splash_screen.setSizePolicy(sizePolicy) self.splash_screen.setSizePolicy(sizePolicy)
self.splash_screen.setContextMenuPolicy(QtCore.Qt.PreventContextMenu) self.splash_screen.setContextMenuPolicy(QtCore.Qt.PreventContextMenu)
icon = build_icon(u':/icon/openlp-logo-16x16.png')
self.splash_screen.setWindowIcon(icon)
splash_image = QtGui.QPixmap(u':/graphics/openlp-splash-screen.png') splash_image = QtGui.QPixmap(u':/graphics/openlp-splash-screen.png')
self.splash_screen.setPixmap(splash_image) self.splash_screen.setPixmap(splash_image)
self.splash_screen.setMask(splash_image.mask()) self.splash_screen.setMask(splash_image.mask())
self.splash_screen.setWindowFlags( self.splash_screen.setWindowFlags(
QtCore.Qt.SplashScreen | QtCore.Qt.WindowStaysOnTopHint) QtCore.Qt.SplashScreen | QtCore.Qt.WindowStaysOnTopHint)
self.retranslateUi()
QtCore.QMetaObject.connectSlotsByName(self.splash_screen) QtCore.QMetaObject.connectSlotsByName(self.splash_screen)
def retranslateUi(self):
self.splash_screen.setWindowTitle(
translate('Splashscreen', 'Splash Screen'))
def show(self): def show(self):
self.splash_screen.show() self.splash_screen.show()
self.splash_screen.showMessage(self.message,
QtCore.Qt.AlignLeft | QtCore.Qt.AlignBottom, QtCore.Qt.black)
self.splash_screen.repaint()
def finish(self, widget): def finish(self, widget):
self.splash_screen.finish(widget) self.splash_screen.finish(widget)

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -48,64 +49,71 @@ class ThemeManager(QtGui.QWidget):
QtGui.QWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.parent = parent self.parent = parent
self.settingsSection = u'themes' self.settingsSection = u'themes'
self.serviceComboBox = self.parent.ServiceManagerContents.ThemeComboBox self.serviceComboBox = self.parent.ServiceManagerContents.themeComboBox
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)
self.amendThemeForm = AmendThemeForm(self) self.amendThemeForm = AmendThemeForm(self)
self.Toolbar = OpenLPToolbar(self) self.toolbar = OpenLPToolbar(self)
self.Toolbar.addToolbarButton( self.toolbar.addToolbarButton(
translate('ThemeManager', 'New Theme'), u':/themes/theme_new.png', translate('OpenLP.ThemeManager', 'New Theme'),
translate('ThemeManager', 'Create a new theme.'), self.onAddTheme) u':/themes/theme_new.png',
self.Toolbar.addToolbarButton( translate('OpenLP.ThemeManager', 'Create a new theme.'),
translate('ThemeManager', 'Edit Theme'), self.onAddTheme)
self.toolbar.addToolbarButton(
translate('OpenLP.ThemeManager', 'Edit Theme'),
u':/themes/theme_edit.png', u':/themes/theme_edit.png',
translate('ThemeManager', 'Edit a theme.'), self.onEditTheme) translate('OpenLP.ThemeManager', 'Edit a theme.'),
self.Toolbar.addToolbarButton( self.onEditTheme)
translate('ThemeManager', 'Delete Theme'), self.toolbar.addToolbarButton(
translate('OpenLP.ThemeManager', 'Delete Theme'),
u':/general/general_delete.png', u':/general/general_delete.png',
translate('ThemeManager', 'Delete a theme.'), self.onDeleteTheme) translate('OpenLP.ThemeManager', 'Delete a theme.'),
self.Toolbar.addSeparator() self.onDeleteTheme)
self.Toolbar.addToolbarButton( self.toolbar.addSeparator()
translate('ThemeManager', 'Import Theme'), self.toolbar.addToolbarButton(
translate('OpenLP.ThemeManager', 'Import Theme'),
u':/general/general_import.png', u':/general/general_import.png',
translate('ThemeManager', 'Import a theme.'), self.onImportTheme) translate('OpenLP.ThemeManager', 'Import a theme.'),
self.Toolbar.addToolbarButton( self.onImportTheme)
translate('ThemeManager', 'Export Theme'), self.toolbar.addToolbarButton(
translate('OpenLP.ThemeManager', 'Export Theme'),
u':/general/general_export.png', u':/general/general_export.png',
translate('ThemeManager', 'Export a theme.'), self.onExportTheme) translate('OpenLP.ThemeManager', 'Export a theme.'),
self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar) self.onExportTheme)
self.Layout.addWidget(self.Toolbar) self.themeWidget = QtGui.QWidgetAction(self.toolbar)
self.ThemeListWidget = QtGui.QListWidget(self) self.layout.addWidget(self.toolbar)
self.ThemeListWidget.setAlternatingRowColors(True) self.themeListWidget = QtGui.QListWidget(self)
self.ThemeListWidget.setIconSize(QtCore.QSize(88, 50)) self.themeListWidget.setAlternatingRowColors(True)
self.Layout.addWidget(self.ThemeListWidget) self.themeListWidget.setIconSize(QtCore.QSize(88, 50))
self.ThemeListWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.layout.addWidget(self.themeListWidget)
self.ThemeListWidget.addAction( self.themeListWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
context_menu_action(self.ThemeListWidget, self.themeListWidget.addAction(
context_menu_action(self.themeListWidget,
u':/themes/theme_edit.png', u':/themes/theme_edit.png',
translate('ThemeManager', '&Edit Theme'), self.onEditTheme)) translate('OpenLP.ThemeManager', '&Edit Theme'),
self.ThemeListWidget.addAction( self.onEditTheme))
context_menu_separator(self.ThemeListWidget)) self.themeListWidget.addAction(
self.ThemeListWidget.addAction( context_menu_separator(self.themeListWidget))
context_menu_action(self.ThemeListWidget, self.themeListWidget.addAction(
context_menu_action(self.themeListWidget,
u':/general/general_delete.png', u':/general/general_delete.png',
translate('ThemeManager', '&Delete Theme'), translate('OpenLP.ThemeManager', '&Delete Theme'),
self.onDeleteTheme)) self.onDeleteTheme))
self.ThemeListWidget.addAction( self.themeListWidget.addAction(
context_menu_action(self.ThemeListWidget, context_menu_action(self.themeListWidget,
u':/general/general_export.png', u':/general/general_export.png',
translate('ThemeManager', 'Set As &Global Default'), translate('OpenLP.ThemeManager', 'Set As &Global Default'),
self.changeGlobalFromScreen)) self.changeGlobalFromScreen))
self.ThemeListWidget.addAction( self.themeListWidget.addAction(
context_menu_action(self.ThemeListWidget, context_menu_action(self.themeListWidget,
u':/general/general_export.png', u':/general/general_export.png',
translate('ThemeManager', 'E&xport Theme'), translate('OpenLP.ThemeManager', 'E&xport Theme'),
self.onExportTheme)) self.onExportTheme))
self.ThemeListWidget.addAction( self.themeListWidget.addAction(
context_menu_separator(self.ThemeListWidget)) context_menu_separator(self.themeListWidget))
#Signals #Signals
QtCore.QObject.connect(self.ThemeListWidget, QtCore.QObject.connect(self.themeListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.changeGlobalFromScreen) self.changeGlobalFromScreen)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -130,18 +138,18 @@ class ThemeManager(QtGui.QWidget):
tab tab
""" """
log.debug(u'changeGlobalFromTab %s', themeName) log.debug(u'changeGlobalFromTab %s', themeName)
for count in range (0, self.ThemeListWidget.count()): for count in range (0, self.themeListWidget.count()):
#reset the old name #reset the old name
item = self.ThemeListWidget.item(count) item = self.themeListWidget.item(count)
oldName = item.text() oldName = item.text()
newName = unicode(item.data(QtCore.Qt.UserRole).toString()) newName = unicode(item.data(QtCore.Qt.UserRole).toString())
if oldName != newName: if oldName != newName:
self.ThemeListWidget.item(count).setText(newName) self.themeListWidget.item(count).setText(newName)
#Set the new name #Set the new name
if themeName == newName: if themeName == newName:
name = unicode(translate('ThemeManager', '%s (default)')) % \ name = unicode(translate('OpenLP.ThemeManager',
newName '%s (default)')) % newName
self.ThemeListWidget.item(count).setText(name) self.themeListWidget.item(count).setText(name)
def changeGlobalFromScreen(self, index = -1): def changeGlobalFromScreen(self, index = -1):
""" """
@ -149,25 +157,26 @@ class ThemeManager(QtGui.QWidget):
Theme Manager list Theme Manager list
""" """
log.debug(u'changeGlobalFromScreen %s', index) log.debug(u'changeGlobalFromScreen %s', index)
selected_row = self.ThemeListWidget.currentRow() selected_row = self.themeListWidget.currentRow()
for count in range (0, self.ThemeListWidget.count()): for count in range (0, self.themeListWidget.count()):
item = self.ThemeListWidget.item(count) item = self.themeListWidget.item(count)
oldName = item.text() oldName = item.text()
#reset the old name #reset the old name
if oldName != unicode(item.data(QtCore.Qt.UserRole).toString()): if oldName != unicode(item.data(QtCore.Qt.UserRole).toString()):
self.ThemeListWidget.item(count).setText( self.themeListWidget.item(count).setText(
unicode(item.data(QtCore.Qt.UserRole).toString())) unicode(item.data(QtCore.Qt.UserRole).toString()))
#Set the new name #Set the new name
if count == selected_row: if count == selected_row:
self.global_theme = unicode( self.global_theme = unicode(
self.ThemeListWidget.item(count).text()) self.themeListWidget.item(count).text())
name = unicode(translate('ThemeManager', '%s (default)')) % \ name = unicode(translate('OpenLP.ThemeManager',
self.global_theme '%s (default)')) % self.global_theme
self.ThemeListWidget.item(count).setText(name) self.themeListWidget.item(count).setText(name)
QtCore.QSettings().setValue( QtCore.QSettings().setValue(
self.settingsSection + u'/global theme', self.settingsSection + u'/global theme',
QtCore.QVariant(self.global_theme)) QtCore.QVariant(self.global_theme))
Receiver.send_message(u'theme_update_global', self.global_theme) Receiver.send_message(u'theme_update_global',
self.global_theme)
self.pushThemes() self.pushThemes()
def onAddTheme(self): def onAddTheme(self):
@ -185,9 +194,10 @@ class ThemeManager(QtGui.QWidget):
Loads the settings for the theme that is to be edited and launches the Loads the settings for the theme that is to be edited and launches the
theme editing form so the user can make their changes. theme editing form so the user can make their changes.
""" """
if check_item_selected(self.ThemeListWidget, translate('ThemeManager', if check_item_selected(self.themeListWidget,
translate('OpenLP.ThemeManager',
'You must select a theme to edit.')): 'You must select a theme to edit.')):
item = self.ThemeListWidget.currentItem() item = self.themeListWidget.currentItem()
themeName = unicode(item.text()) themeName = unicode(item.text())
if themeName != unicode(item.data(QtCore.Qt.UserRole).toString()): if themeName != unicode(item.data(QtCore.Qt.UserRole).toString()):
self.editingDefault = True self.editingDefault = True
@ -207,14 +217,15 @@ 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, translate('ThemeManager', if check_item_selected(self.themeListWidget,
translate('OpenLP.ThemeManager',
'You must select a theme to delete.')): 'You must select a theme to delete.')):
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,
translate('ThemeManager', 'Delete Confirmation'), translate('OpenLP.ThemeManager', 'Delete Confirmation'),
translate('ThemeManager', 'Delete theme?'), translate('OpenLP.ThemeManager', 'Delete theme?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No), QtGui.QMessageBox.No) QtGui.QMessageBox.No), QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No: if answer == QtGui.QMessageBox.No:
@ -222,27 +233,26 @@ class ThemeManager(QtGui.QWidget):
# should be the same unless default # should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()): if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'), translate('OpenLP.ThemeManager', 'Error'),
translate('ThemeManager', translate('OpenLP.ThemeManager',
'You are unable to delete the default theme.'), 'You are unable to delete the default theme.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
else: else:
for plugin in self.parent.plugin_manager.plugins: for plugin in self.parent.plugin_manager.plugins:
if plugin.usesTheme(theme): if plugin.usesTheme(theme):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'), translate('OpenLP.ThemeManager', 'Error'),
unicode(translate('ThemeManager', unicode(translate('OpenLP.ThemeManager',
'Theme %s is use in %s plugin.')) % \ 'Theme %s is use in %s plugin.')) % \
(theme, plugin.name)) (theme, plugin.name))
return return
if unicode(self.serviceComboBox.currentText()) == theme: if unicode(self.serviceComboBox.currentText()) == theme:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'), translate('OpenLP.ThemeManager', 'Error'),
unicode(translate('ThemeManager', unicode(translate('OpenLP.ThemeManager',
'Theme %s is use by the service manager.')) % theme) 'Theme %s is use by the service manager.')) % theme)
return return
row = self.ThemeListWidget.row(item) row = self.themeListWidget.row(item)
self.ThemeListWidget.takeItem(row) self.themeListWidget.takeItem(row)
self.deleteTheme(theme) self.deleteTheme(theme)
def deleteTheme(self, theme): def deleteTheme(self, theme):
@ -253,15 +263,14 @@ class ThemeManager(QtGui.QWidget):
The theme to delete. The theme to delete.
""" """
self.themelist.remove(theme) self.themelist.remove(theme)
th = theme + u'.png' thumb = theme + u'.png'
try: try:
os.remove(os.path.join(self.path, th)) os.remove(os.path.join(self.path, thumb))
os.remove(os.path.join(self.thumbPath, th)) os.remove(os.path.join(self.thumbPath, thumb))
encoding = get_filesystem_encoding() encoding = get_filesystem_encoding()
shutil.rmtree(os.path.join(self.path, theme).encode(encoding)) shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
except OSError: except OSError:
#if not present do not worry log.exception(u'Error deleting theme %s', theme)
pass
# As we do not reload the themes push out the change # As we do not reload the themes push out the change
# Reaload the list as the internal lists and events need # Reaload the list as the internal lists and events need
# to be triggered # to be triggered
@ -271,15 +280,17 @@ class ThemeManager(QtGui.QWidget):
""" """
Save the theme in a zip file Save the theme in a zip file
""" """
item = self.ThemeListWidget.currentItem() item = self.themeListWidget.currentItem()
if item is None: if item is None:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'), translate('OpenLP.ThemeManager', 'Error'),
translate('ThemeManager', 'You have not selected a theme.')) translate('OpenLP.ThemeManager',
'You have not selected a theme.'))
return return
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('ThemeManager', 'Save Theme - (%s)')) % theme, unicode(translate('OpenLP.ThemeManager',
'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:
@ -295,14 +306,14 @@ class ThemeManager(QtGui.QWidget):
os.path.join(source, name).encode(u'utf-8'), os.path.join(source, name).encode(u'utf-8'),
os.path.join(theme, name).encode(u'utf-8')) os.path.join(theme, name).encode(u'utf-8'))
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('ThemeManager', 'Theme Exported'), translate('OpenLP.ThemeManager', 'Theme Exported'),
translate('ThemeManager', translate('OpenLP.ThemeManager',
'Your theme has been successfully exported.')) 'Your theme has been successfully exported.'))
except (IOError, OSError): except (IOError, OSError):
log.exception(u'Export Theme Failed') log.exception(u'Export Theme Failed')
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Theme Export Failed'), translate('OpenLP.ThemeManager', 'Theme Export Failed'),
translate('ThemeManager', translate('OpenLP.ThemeManager',
'Your theme could not be exported due to an error.')) 'Your theme could not be exported due to an error.'))
finally: finally:
if zip: if zip:
@ -315,9 +326,9 @@ class ThemeManager(QtGui.QWidget):
will load both OpenLP version 1 and version 2 themes. will load both OpenLP version 1 and version 2 themes.
""" """
files = QtGui.QFileDialog.getOpenFileNames(self, files = QtGui.QFileDialog.getOpenFileNames(self,
translate('ThemeManager', 'Select Theme Import File'), translate('OpenLP.ThemeManager', 'Select Theme Import File'),
SettingsManager.get_last_dir(self.settingsSection), SettingsManager.get_last_dir(self.settingsSection),
translate('ThemeManager', 'Theme (*.*)')) translate('OpenLP.ThemeManager', 'Theme (*.*)'))
log.info(u'New Themes %s', unicode(files)) log.info(u'New Themes %s', unicode(files))
if files: if files:
for file in files: for file in files:
@ -334,7 +345,7 @@ class ThemeManager(QtGui.QWidget):
""" """
log.debug(u'Load themes from dir') log.debug(u'Load themes from dir')
self.themelist = [] self.themelist = []
self.ThemeListWidget.clear() self.themeListWidget.clear()
#root, dirs, files = os.walk(self.path) #root, dirs, files = os.walk(self.path)
dirList = os.listdir(self.path) dirList = os.listdir(self.path)
for name in dirList: for name in dirList:
@ -344,7 +355,7 @@ class ThemeManager(QtGui.QWidget):
if os.path.exists(theme): if os.path.exists(theme):
textName = os.path.splitext(name)[0] textName = os.path.splitext(name)[0]
if textName == self.global_theme: if textName == self.global_theme:
name = unicode(translate('ThemeManager', name = unicode(translate('OpenLP.ThemeManager',
'%s (default)')) % textName '%s (default)')) % textName
else: else:
name = textName name = textName
@ -359,7 +370,7 @@ class ThemeManager(QtGui.QWidget):
item_name.setIcon(icon) item_name.setIcon(icon)
item_name.setData(QtCore.Qt.UserRole, item_name.setData(QtCore.Qt.UserRole,
QtCore.QVariant(textName)) QtCore.QVariant(textName))
self.ThemeListWidget.addItem(item_name) self.themeListWidget.addItem(item_name)
self.themelist.append(textName) self.themelist.append(textName)
self.pushThemes() self.pushThemes()
@ -420,8 +431,9 @@ class ThemeManager(QtGui.QWidget):
ucsfile = file.decode(u'utf-8') ucsfile = file.decode(u'utf-8')
except UnicodeDecodeError: except UnicodeDecodeError:
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('ThemeManager', 'Error'), self, translate('OpenLP.ThemeManager', 'Error'),
translate('ThemeManager', 'File is not a valid theme.\n' translate('OpenLP.ThemeManager',
'File is not a valid theme.\n'
'The content encoding is not UTF-8.')) 'The content encoding is not UTF-8.'))
log.exception(u'Filename "%s" is not valid UTF-8' % log.exception(u'Filename "%s" is not valid UTF-8' %
file.decode(u'utf-8', u'replace')) file.decode(u'utf-8', u'replace'))
@ -465,15 +477,16 @@ class ThemeManager(QtGui.QWidget):
self.generateAndSaveImage(dir, themename, filexml) self.generateAndSaveImage(dir, themename, filexml)
else: else:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'), translate('OpenLP.ThemeManager', 'Error'),
translate('ThemeManager', 'File is not a valid theme.')) translate('OpenLP.ThemeManager',
log.exception(u'Theme file dosen\'t contain XML data %s' % 'File is not a valid theme.'))
log.exception(u'Theme file does not contain XML data %s' %
filename) filename)
except (IOError, NameError): except (IOError, NameError):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'), translate('OpenLP.ThemeManager', 'Error'),
translate('ThemeManager', 'File is not a valid theme.')) translate('OpenLP.ThemeManager', 'File is not a valid theme.'))
log.exception(u'Importing theme from zip file failed %s' % filename) log.exception(u'Importing theme from zip failed %s' % filename)
finally: finally:
if zip: if zip:
zip.close() zip.close()
@ -537,7 +550,8 @@ class ThemeManager(QtGui.QWidget):
vAlignCorrection = 1 vAlignCorrection = 1
elif theme.VerticalAlign == 1: elif theme.VerticalAlign == 1:
vAlignCorrection = 2 vAlignCorrection = 2
newtheme.add_display(unicode(shadow), unicode(theme.ShadowColor.name()), newtheme.add_display(unicode(shadow),
unicode(theme.ShadowColor.name()),
unicode(outline), unicode(theme.OutlineColor.name()), unicode(outline), unicode(theme.OutlineColor.name()),
unicode(theme.HorizontalAlign), unicode(vAlignCorrection), unicode(theme.HorizontalAlign), unicode(vAlignCorrection),
unicode(theme.WrapStyle), unicode(0)) unicode(theme.WrapStyle), unicode(0))
@ -560,8 +574,9 @@ class ThemeManager(QtGui.QWidget):
if self.saveThemeName != name: if self.saveThemeName != name:
if os.path.exists(theme_file): if os.path.exists(theme_file):
result = QtGui.QMessageBox.question(self, result = QtGui.QMessageBox.question(self,
translate('ThemeManager', 'Theme Exists'), translate('OpenLP.ThemeManager', 'Theme Exists'),
translate('ThemeManager', 'A theme with this name already ' translate('OpenLP.ThemeManager',
'A theme with this name already '
'exists. Would you like to overwrite it?'), 'exists. Would you like to overwrite it?'),
(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), (QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.No) QtGui.QMessageBox.No)
@ -605,19 +620,21 @@ class ThemeManager(QtGui.QWidget):
if newThemeIndex != -1: if newThemeIndex != -1:
self.serviceComboBox.setCurrentIndex(newThemeIndex) self.serviceComboBox.setCurrentIndex(newThemeIndex)
if self.editingDefault: if self.editingDefault:
newThemeItem = self.ThemeListWidget.findItems(name, if self.saveThemeName != name:
QtCore.Qt.MatchExactly)[0] newThemeItem = self.themeListWidget.findItems(name,
newThemeIndex = self.ThemeListWidget.indexFromItem( QtCore.Qt.MatchExactly)[0]
newThemeItem).row() newThemeIndex = self.themeListWidget.indexFromItem(
self.global_theme = unicode( newThemeItem).row()
self.ThemeListWidget.item(newThemeIndex).text()) self.global_theme = unicode(
newName = unicode(translate('ThemeManager', '%s (default)')) % \ self.themeListWidget.item(newThemeIndex).text())
self.global_theme newName = unicode(translate('OpenLP.ThemeManager',
self.ThemeListWidget.item(newThemeIndex).setText(newName) '%s (default)')) % self.global_theme
QtCore.QSettings().setValue( self.themeListWidget.item(newThemeIndex).setText(newName)
self.settingsSection + u'/global theme', QtCore.QSettings().setValue(
QtCore.QVariant(self.global_theme)) self.settingsSection + u'/global theme',
Receiver.send_message(u'theme_update_global', self.global_theme) QtCore.QVariant(self.global_theme))
Receiver.send_message(u'theme_update_global',
self.global_theme)
self.editingDefault = False self.editingDefault = False
self.pushThemes() self.pushThemes()
else: else:
@ -664,14 +681,15 @@ class ThemeManager(QtGui.QWidget):
""" """
log.debug(u'base theme created') log.debug(u'base theme created')
newtheme = ThemeXML() newtheme = ThemeXML()
newtheme.new_document(unicode(translate('ThemeManager', 'New Theme'))) newtheme.new_document(
newtheme.add_background_solid(unicode(u'#000000')) unicode(translate('OpenLP.ThemeManager', 'New Theme')))
newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), newtheme.add_background_solid(u'#000000')
unicode(30), u'False') newtheme.add_font(unicode(QtGui.QFont().family()), u'#FFFFFF',
newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), u'30', u'False')
unicode(12), u'False', u'footer') newtheme.add_font(unicode(QtGui.QFont().family()), u'#FFFFFF',
newtheme.add_display(u'False', unicode(u'#FFFFFF'), u'False', u'12', u'False', u'footer')
unicode(u'#FFFFFF'), unicode(0), unicode(0), unicode(0), u'False') newtheme.add_display(u'False', u'#FFFFFF', u'False',
unicode(u'#FFFFFF'), u'0', u'0', u'0', u'False')
return newtheme.extract_xml() return newtheme.extract_xml()
def createThemeFromXml(self, theme_xml, path): def createThemeFromXml(self, theme_xml, path):

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -37,7 +38,7 @@ class ThemesTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'ThemesTab') self.setObjectName(u'ThemesTab')
self.tabTitleVisible = translate('ThemesTab', 'Themes') self.tabTitleVisible = translate('OpenLP.ThemesTab', 'Themes')
self.ThemesTabLayout = QtGui.QHBoxLayout(self) self.ThemesTabLayout = QtGui.QHBoxLayout(self)
self.ThemesTabLayout.setSpacing(8) self.ThemesTabLayout.setSpacing(8)
self.ThemesTabLayout.setMargin(8) self.ThemesTabLayout.setMargin(8)
@ -106,26 +107,28 @@ class ThemesTab(SettingsTab):
QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList) QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
def retranslateUi(self): def retranslateUi(self):
self.GlobalGroupBox.setTitle(translate('ThemesTab', 'Global Theme')) self.GlobalGroupBox.setTitle(
self.LevelGroupBox.setTitle(translate('ThemesTab', 'Theme Level')) translate('OpenLP.ThemesTab', 'Global Theme'))
self.LevelGroupBox.setTitle(
translate('OpenLP.ThemesTab', 'Theme Level'))
self.SongLevelRadioButton.setText( self.SongLevelRadioButton.setText(
translate('ThemesTab', 'S&ong Level')) translate('OpenLP.ThemesTab', 'S&ong Level'))
self.SongLevelLabel.setText( self.SongLevelLabel.setText(
translate('ThemesTab', 'Use the theme from each song ' translate('OpenLP.ThemesTab', 'Use the theme from each song '
'in the database. If a song doesn\'t have a theme associated with ' 'in the database. If a song doesn\'t have a theme associated with '
'it, then use the service\'s theme. If the service doesn\'t have ' 'it, then use the service\'s theme. If the service doesn\'t have '
'a theme, then use the global theme.')) 'a theme, then use the global theme.'))
self.ServiceLevelRadioButton.setText( self.ServiceLevelRadioButton.setText(
translate('ThemesTab', '&Service Level')) translate('OpenLP.ThemesTab', '&Service Level'))
self.ServiceLevelLabel.setText( self.ServiceLevelLabel.setText(
translate('ThemesTab', 'Use the theme from the service, ' translate('OpenLP.ThemesTab', 'Use the theme from the service, '
'overriding any of the individual songs\' themes. If the ' 'overriding any of the individual songs\' themes. If the '
'service doesn\'t have a theme, then use the global theme.')) 'service doesn\'t have a theme, then use the global theme.'))
self.GlobalLevelRadioButton.setText( self.GlobalLevelRadioButton.setText(
translate('ThemesTab', '&Global Level')) translate('OpenLP.ThemesTab', '&Global Level'))
self.GlobalLevelLabel.setText( self.GlobalLevelLabel.setText(
translate('ThemesTab', 'Use the global theme, overriding any ' translate('OpenLP.ThemesTab', 'Use the global theme, overriding '
'themes associated with either the service or the songs.')) 'any themes associated with either the service or the songs.'))
def load(self): def load(self):
settings = QtCore.QSettings() settings = QtCore.QSettings()

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -26,20 +27,66 @@
The :mod:`utils` module provides the utility libraries for OpenLP The :mod:`utils` module provides the utility libraries for OpenLP
""" """
import os
import sys
import logging import logging
import os
import re
import sys
import time
import urllib2 import urllib2
from datetime import datetime from datetime import datetime
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
import openlp import openlp
from openlp.core.lib import translate from openlp.core.lib import Receiver, translate
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
images_filter = None images_filter = None
class VersionThread(QtCore.QThread):
"""
A special Qt thread class to fetch the version of OpenLP from the website.
This is threaded so that it doesn't affect the loading time of OpenLP.
"""
def __init__(self, parent, app_version):
QtCore.QThread.__init__(self, parent)
self.app_version = app_version
self.version_splitter = re.compile(
r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))?')
def run(self):
"""
Run the thread.
"""
time.sleep(1)
Receiver.send_message(u'maindisplay_blank_check')
version = check_latest_version(self.app_version)
remote_version = {}
local_version = {}
match = self.version_splitter.match(version)
if match:
remote_version[u'major'] = int(match.group(1))
remote_version[u'minor'] = int(match.group(2))
remote_version[u'release'] = int(match.group(3))
if len(match.groups()) > 3 and match.group(4):
remote_version[u'revision'] = int(match.group(4))
match = self.version_splitter.match(self.app_version[u'full'])
if match:
local_version[u'major'] = int(match.group(1))
local_version[u'minor'] = int(match.group(2))
local_version[u'release'] = int(match.group(3))
if len(match.groups()) > 3 and match.group(4):
local_version[u'revision'] = int(match.group(4))
if remote_version[u'major'] > local_version[u'major'] or \
remote_version[u'minor'] > local_version[u'minor'] or \
remote_version[u'release'] > local_version[u'release']:
Receiver.send_message(u'openlp_version_check', u'%s' % version)
elif remote_version.get(u'revision') and \
local_version.get(u'revision') and \
remote_version[u'revision'] > local_version[u'revision']:
Receiver.send_message(u'openlp_version_check', u'%s' % version)
class AppLocation(object): class AppLocation(object):
""" """
The :class:`AppLocation` class is a static class which retrieves a The :class:`AppLocation` class is a static class which retrieves a

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -53,10 +54,10 @@ class LanguageManager(object):
""" """
if LanguageManager.AutoLanguage: if LanguageManager.AutoLanguage:
language = QtCore.QLocale.system().name() language = QtCore.QLocale.system().name()
lang_Path = AppLocation.get_directory(AppLocation.AppDir) lang_path = AppLocation.get_directory(AppLocation.AppDir)
lang_Path = os.path.join(lang_Path, u'resources', u'i18n') lang_path = os.path.join(lang_path, u'resources', u'i18n')
app_translator = QtCore.QTranslator() app_translator = QtCore.QTranslator()
if app_translator.load("openlp_" + language, lang_Path): if app_translator.load("openlp_" + language, lang_path):
return app_translator return app_translator
@staticmethod @staticmethod
@ -82,7 +83,7 @@ class LanguageManager(object):
""" """
translator = QtCore.QTranslator() translator = QtCore.QTranslator()
translator.load(qm_file) translator.load(qm_file)
return translator.translate('MainWindow', 'English') return translator.translate('OpenLP.MainWindow', 'English')
@staticmethod @staticmethod
def get_language(): def get_language():
@ -117,9 +118,9 @@ class LanguageManager(object):
u'general/language', QtCore.QVariant(language)) u'general/language', QtCore.QVariant(language))
log.info(u'Language file: \'%s\' written to conf file' % language) log.info(u'Language file: \'%s\' written to conf file' % language)
QtGui.QMessageBox.information(None, QtGui.QMessageBox.information(None,
translate('LanguageManager', 'Language'), translate('OpenLP.LanguageManager', 'Language'),
translate('LanguageManager', translate('OpenLP.LanguageManager',
'After restart new Language settings will be used.')) 'Please restart OpenLP to use your new language setting.'))
@staticmethod @staticmethod
def init_qm_list(): def init_qm_list():
@ -143,4 +144,3 @@ class LanguageManager(object):
if LanguageManager.__qmList__ is None: if LanguageManager.__qmList__ is None:
LanguageManager.init_qm_list() LanguageManager.init_qm_list()
return LanguageManager.__qmList__ return LanguageManager.__qmList__

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -27,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.plugins.alerts.lib import AlertsManager, AlertsTab from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
from openlp.plugins.alerts.lib.db import init_schema from openlp.plugins.alerts.lib.db import init_schema
@ -44,8 +45,7 @@ class AlertsPlugin(Plugin):
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)
self.manager = Manager(u'alerts', init_schema) self.manager = Manager(u'alerts', init_schema)
self.alertForm = AlertForm(self.manager, self) self.alertForm = AlertForm(self)
self.status = PluginStatus.Active
def getSettingsTab(self): def getSettingsTab(self):
""" """
@ -65,13 +65,11 @@ class AlertsPlugin(Plugin):
""" """
log.info(u'add tools menu') log.info(u'add tools menu')
self.toolsAlertItem = QtGui.QAction(tools_menu) self.toolsAlertItem = QtGui.QAction(tools_menu)
AlertIcon = build_icon(u':/plugins/plugin_alerts.png') self.toolsAlertItem.setIcon(build_icon(u':/plugins/plugin_alerts.png'))
self.toolsAlertItem.setIcon(AlertIcon)
self.toolsAlertItem.setObjectName(u'toolsAlertItem') self.toolsAlertItem.setObjectName(u'toolsAlertItem')
self.toolsAlertItem.setText( self.toolsAlertItem.setText(translate('AlertsPlugin', '&Alert'))
translate('AlertsPlugin', '&Alert'))
self.toolsAlertItem.setStatusTip( self.toolsAlertItem.setStatusTip(
translate('AlertsPlugin', 'Show an alert message')) translate('AlertsPlugin', 'Show an alert message.'))
self.toolsAlertItem.setShortcut(u'F7') self.toolsAlertItem.setShortcut(u'F7')
self.serviceManager.parent.ToolsMenu.addAction(self.toolsAlertItem) self.serviceManager.parent.ToolsMenu.addAction(self.toolsAlertItem)
QtCore.QObject.connect(self.toolsAlertItem, QtCore.QObject.connect(self.toolsAlertItem,
@ -90,8 +88,7 @@ class AlertsPlugin(Plugin):
def toggleAlertsState(self): def toggleAlertsState(self):
self.alertsActive = not self.alertsActive self.alertsActive = not self.alertsActive
QtCore.QSettings().setValue( QtCore.QSettings().setValue(self.settingsSection + u'/active',
self.settingsSection + u'/active',
QtCore.QVariant(self.alertsActive)) QtCore.QVariant(self.alertsActive))
def onAlertsTrigger(self): def onAlertsTrigger(self):
@ -99,8 +96,7 @@ class AlertsPlugin(Plugin):
self.alertForm.exec_() self.alertForm.exec_()
def about(self): def about(self):
about_text = translate('AlertsPlugin', about_text = translate('AlertsPlugin', '<strong>Alerts Plugin</strong>'
'<b>Alerts Plugin</b><br>This plugin ' '<br />The alert plugin controls the displaying of nursery alerts '
'controls the displaying of alerts on the presentations screen') 'on the display screen')
return about_text return about_text

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -34,14 +35,14 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
""" """
Provide UI for the alert system Provide UI for the alert system
""" """
def __init__(self, manager, parent): def __init__(self, plugin):
""" """
Initialise the alert form Initialise the alert form
""" """
self.manager = manager self.manager = plugin.manager
self.parent = parent self.parent = plugin
self.item_id = None self.item_id = None
QtGui.QDialog.__init__(self, None) QtGui.QDialog.__init__(self, plugin.formparent)
self.setupUi(self) self.setupUi(self)
QtCore.QObject.connect(self.DisplayButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.DisplayButton, QtCore.SIGNAL(u'clicked()'),
self.onDisplayClicked) self.onDisplayClicked)
@ -62,7 +63,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
def loadList(self): def loadList(self):
self.AlertListWidget.clear() self.AlertListWidget.clear()
alerts = self.manager.get_all_objects(AlertItem, AlertItem.text) alerts = self.manager.get_all_objects(AlertItem,
order_by_ref=AlertItem.text)
for alert in alerts: for alert in alerts:
item_name = QtGui.QListWidgetItem(alert.text) item_name = QtGui.QListWidgetItem(alert.text)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(alert.id)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(alert.id))

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -79,7 +80,7 @@ class AlertsManager(QtCore.QObject):
if self.timer_id != 0: if self.timer_id != 0:
Receiver.send_message(u'maindisplay_status_text', Receiver.send_message(u'maindisplay_status_text',
translate('AlertsPlugin.AlertsManager', translate('AlertsPlugin.AlertsManager',
'Alert message created and delayed')) 'Alert message created and displayed.'))
return return
Receiver.send_message(u'maindisplay_status_text', u'') Receiver.send_message(u'maindisplay_status_text', u'')
self.generateAlert() self.generateAlert()
@ -117,4 +118,3 @@ class AlertsManager(QtCore.QObject):
self.killTimer(self.timer_id) self.killTimer(self.timer_id)
self.timer_id = 0 self.timer_id = 0
self.generateAlert() self.generateAlert()

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -190,13 +191,13 @@ class AlertsTab(SettingsTab):
self.FontGroupBox.setTitle( self.FontGroupBox.setTitle(
translate('AlertsPlugin.AlertsTab', 'Font')) translate('AlertsPlugin.AlertsTab', 'Font'))
self.FontLabel.setText( self.FontLabel.setText(
translate('AlertsPlugin.AlertsTab', 'Font Name:')) translate('AlertsPlugin.AlertsTab', 'Font name:'))
self.FontColorLabel.setText( self.FontColorLabel.setText(
translate('AlertsPlugin.AlertsTab', 'Font Color:')) translate('AlertsPlugin.AlertsTab', 'Font color:'))
self.BackgroundColorLabel.setText( self.BackgroundColorLabel.setText(
translate('AlertsPlugin.AlertsTab', 'Background Color:')) translate('AlertsPlugin.AlertsTab', 'Background color:'))
self.FontSizeLabel.setText( self.FontSizeLabel.setText(
translate('AlertsPlugin.AlertsTab', 'Font Size:')) translate('AlertsPlugin.AlertsTab', 'Font size:'))
self.FontSizeSpinBox.setSuffix( self.FontSizeSpinBox.setSuffix(
translate('AlertsPlugin.AlertsTab', 'pt')) translate('AlertsPlugin.AlertsTab', 'pt'))
self.TimeoutLabel.setText( self.TimeoutLabel.setText(
@ -208,7 +209,7 @@ class AlertsTab(SettingsTab):
self.PreviewGroupBox.setTitle( self.PreviewGroupBox.setTitle(
translate('AlertsPlugin.AlertsTab', 'Preview')) translate('AlertsPlugin.AlertsTab', 'Preview'))
self.FontPreview.setText( self.FontPreview.setText(
translate('AlertsPlugin.AlertsTab', 'openlp.org')) translate('AlertsPlugin.AlertsTab', 'OpenLP 2.0'))
self.LocationComboBox.setItemText(0, self.LocationComboBox.setItemText(0,
translate('AlertsPlugin.AlertsTab', 'Top')) translate('AlertsPlugin.AlertsTab', 'Top'))
self.LocationComboBox.setItemText(1, self.LocationComboBox.setItemText(1,

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -27,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate from openlp.core.lib import Plugin, build_icon, translate
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -40,8 +41,6 @@ class BiblePlugin(Plugin):
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)
#Register the bible Manager
self.status = PluginStatus.Active
self.manager = None self.manager = None
def initialise(self): def initialise(self):
@ -49,50 +48,49 @@ class BiblePlugin(Plugin):
if self.manager is None: if self.manager is None:
self.manager = BibleManager(self) self.manager = BibleManager(self)
Plugin.initialise(self) Plugin.initialise(self)
self.ImportBibleItem.setVisible(True) self.importBibleItem.setVisible(True)
self.ExportBibleItem.setVisible(True) self.exportBibleItem.setVisible(True)
def finalise(self): def finalise(self):
log.info(u'Plugin Finalise') log.info(u'Plugin Finalise')
Plugin.finalise(self) Plugin.finalise(self)
self.ImportBibleItem.setVisible(False) self.importBibleItem.setVisible(False)
self.ExportBibleItem.setVisible(False) self.exportBibleItem.setVisible(False)
def getSettingsTab(self): def getSettingsTab(self):
return BiblesTab(self.name) return BiblesTab(self.name)
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the BibleManagerItem object # Create the BibleManagerItem object.
return BibleMediaItem(self, self.icon, self.name) return BibleMediaItem(self, self.icon, self.name)
def addImportMenuItem(self, import_menu): def addImportMenuItem(self, import_menu):
self.ImportBibleItem = QtGui.QAction(import_menu) self.importBibleItem = QtGui.QAction(import_menu)
self.ImportBibleItem.setObjectName(u'ImportBibleItem') self.importBibleItem.setObjectName(u'importBibleItem')
import_menu.addAction(self.ImportBibleItem) import_menu.addAction(self.importBibleItem)
self.ImportBibleItem.setText( self.importBibleItem.setText(
translate('BiblePlugin', '&Bible')) translate('BiblesPlugin', '&Bible'))
# Signals and slots # signals and slots
QtCore.QObject.connect(self.ImportBibleItem, QtCore.QObject.connect(self.importBibleItem,
QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick) QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick)
self.ImportBibleItem.setVisible(False) self.importBibleItem.setVisible(False)
def addExportMenuItem(self, export_menu): def addExportMenuItem(self, export_menu):
self.ExportBibleItem = QtGui.QAction(export_menu) self.exportBibleItem = QtGui.QAction(export_menu)
self.ExportBibleItem.setObjectName(u'ExportBibleItem') self.exportBibleItem.setObjectName(u'exportBibleItem')
export_menu.addAction(self.ExportBibleItem) export_menu.addAction(self.exportBibleItem)
self.ExportBibleItem.setText(translate( self.exportBibleItem.setText(translate(
'BiblePlugin', '&Bible')) 'BiblesPlugin', '&Bible'))
self.ExportBibleItem.setVisible(False) self.exportBibleItem.setVisible(False)
def onBibleImportClick(self): def onBibleImportClick(self):
if self.mediaItem: if self.mediaItem:
self.mediaItem.onImportClick() self.mediaItem.onImportClick()
def about(self): def about(self):
about_text = translate('BiblePlugin', about_text = translate('BiblesPlugin', '<strong>Bible Plugin</strong>'
'<strong>Bible Plugin</strong><br />This ' '<br />The Bible plugin provides the ability to display bible '
'plugin allows bible verses from different sources to be ' 'verses from different sources during the service.')
'displayed on the screen during the service.')
return about_text return about_text
def usesTheme(self, theme): def usesTheme(self, theme):

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -334,13 +335,13 @@ class Ui_BibleImportWizard(object):
self.FormatComboBox.setItemText(3, self.FormatComboBox.setItemText(3,
translate('BiblesPlugin.ImportWizardForm', 'Web Download')) translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
self.OsisLocationLabel.setText( self.OsisLocationLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'File Location:')) translate('BiblesPlugin.ImportWizardForm', 'File location:'))
self.BooksLocationLabel.setText( self.BooksLocationLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Books Location:')) translate('BiblesPlugin.ImportWizardForm', 'Books location:'))
self.VerseLocationLabel.setText( self.VerseLocationLabel.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.LocationLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Location:')) translate('BiblesPlugin.ImportWizardForm', 'Location:'))
self.LocationComboBox.setItemText(0, self.LocationComboBox.setItemText(0,
@ -368,7 +369,7 @@ class Ui_BibleImportWizard(object):
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'Set up the Bible\'s license details.')) 'Set up the Bible\'s license details.'))
self.VersionNameLabel.setText( self.VersionNameLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Version Name:')) translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
self.CopyrightLabel.setText( self.CopyrightLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Copyright:')) translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
self.PermissionLabel.setText( self.PermissionLabel.setText(

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -49,8 +50,8 @@ class WebDownload(object):
} }
@classmethod @classmethod
def get_name(cls, id): def get_name(cls, name):
return cls.Names[id] return cls.Names[name]
class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
@ -128,8 +129,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid Bible Location'), 'Invalid Bible Location'),
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.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OSISLocationEdit.setFocus() self.OSISLocationEdit.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:
@ -139,8 +139,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid Books File'), 'Invalid Books File'),
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.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.BooksLocationEdit.setFocus() self.BooksLocationEdit.setFocus()
return False return False
elif self.field(u'csv_versefile').toString() == u'': elif self.field(u'csv_versefile').toString() == u'':
@ -149,8 +148,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid Verse File'), 'Invalid Verse File'),
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.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CsvVerseLocationEdit.setFocus() self.CsvVerseLocationEdit.setFocus()
return False return False
elif self.field(u'source_format').toInt()[0] == \ elif self.field(u'source_format').toInt()[0] == \
@ -161,8 +159,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid OpenSong Bible'), 'Invalid OpenSong Bible'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify an OpenSong Bible ' 'You need to specify an OpenSong Bible '
'file to import.'), 'file to import.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenSongFileEdit.setFocus() self.OpenSongFileEdit.setFocus()
return False return False
return True return True
@ -177,8 +174,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Empty Version Name'), 'Empty Version Name'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a version name for your ' 'You need to specify a version name for your '
'Bible.'), 'Bible.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.VersionNameEdit.setFocus() self.VersionNameEdit.setFocus()
return False return False
elif license_copyright == u'': elif license_copyright == u'':
@ -188,8 +184,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to set a copyright for your Bible! ' 'You need to set a copyright for your Bible! '
'Bibles in the Public Domain need to be marked as ' 'Bibles in the Public Domain need to be marked as '
'such.'), 'such.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CopyrightEdit.setFocus() self.CopyrightEdit.setFocus()
return False return False
elif self.manager.exists(license_version): elif self.manager.exists(license_version):
@ -198,8 +193,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Bible Exists'), 'Bible Exists'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'This Bible already exists! Please import ' 'This Bible already exists! Please import '
'a different Bible or first delete the existing one.'), 'a different Bible or first delete the existing one.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.VersionNameEdit.setFocus() self.VersionNameEdit.setFocus()
return False return False
return True return True
@ -259,8 +253,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
if self.currentId() == 3: if self.currentId() == 3:
Receiver.send_message(u'bibles_stop_import') Receiver.send_message(u'bibles_stop_import')
def onCurrentIdChanged(self, id): def onCurrentIdChanged(self, pageId):
if id == 3: if pageId == 3:
self.preImport() self.preImport()
self.performImport() self.performImport()
self.postImport() self.postImport()
@ -326,6 +320,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
#Load and store Crosswalk Bibles #Load and store Crosswalk Bibles
filepath = AppLocation.get_directory(AppLocation.PluginsDir) filepath = AppLocation.get_directory(AppLocation.PluginsDir)
filepath = os.path.join(filepath, u'bibles', u'resources') filepath = os.path.join(filepath, u'bibles', u'resources')
books_file = None
try: try:
self.web_bible_list[WebDownload.Crosswalk] = {} self.web_bible_list[WebDownload.Crosswalk] = {}
books_file = open( books_file = open(
@ -347,6 +342,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
if books_file: if books_file:
books_file.close() books_file.close()
#Load and store BibleGateway Bibles #Load and store BibleGateway Bibles
books_file = None
try: try:
self.web_bible_list[WebDownload.BibleGateway] = {} self.web_bible_list[WebDownload.BibleGateway] = {}
books_file = open(os.path.join(filepath, u'biblegateway.csv'), 'r') books_file = open(os.path.join(filepath, u'biblegateway.csv'), 'r')

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -22,8 +23,163 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
"""
The :mod:`lib` module contains all the library functionality for the bibles
plugin.
"""
import logging
import re
log = logging.getLogger(__name__)
BIBLE_REFERENCE = re.compile(
r'^([\w ]+?) *([0-9]+)' # Initial book and chapter
r'(?: *[:|v|V] *([0-9]+))?' # Verse for first chapter
r'(?: *- *([0-9]+|end$))?' # Range for verses or chapters
r'(?:(?:,([0-9]+))?' # Second chapter
r' *[,|:|v|V] *([0-9]+|end$)' # More range for verses or chapters
r'(?: *- *([0-9]+|end$))?)?$', # End of second verse range
re.UNICODE)
def check_end(match_group):
"""
Check if a regular expression match group contains the text u'end' or
should be converted to an int.
``match_group``
The match group to check.
"""
if match_group == u'end':
return -1
else:
return int(match_group)
def parse_reference(reference):
"""
This is the über-awesome function that takes a person's typed in string
and converts it to a reference list, a list of references to be queried
from the Bible database files.
BIBLE_REFERENCE regular expression produces the following match groups:
0 This is a special group consisting of the whole string that matched.
1 [\w ]+ The book the reference is from.
2 [0-9]+ The first (or only) chapter in the reference.
3 None|[0-9]+ None or the only verse or the first verse in a
verse range or the start verse in a chapter range.
4 None|[0-9]+|end None or the end verse of the first verse range or
the end chapter of a chapter range.
5 None|[0-9]+ None or the second chapter in multiple
(non-ranged) chapters.
6 None|[0-9]+|end None, the start of the second verse range or the
end of a chapter range.
7 None|[0-9]+|end None or the end of the second verse range.
The reference list is a list of tuples, with each tuple structured like
this::
(book, chapter, start_verse, end_verse)
``reference``
The bible reference to parse.
Returns None or a reference list.
"""
reference = reference.strip()
log.debug('parse_reference("%s")', reference)
unified_ref_list = []
match = BIBLE_REFERENCE.match(reference)
if match:
log.debug(u'Matched reference %s' % reference)
book = match.group(1)
chapter = int(match.group(2))
if match.group(7):
# Two verse ranges
vr1_start = int(match.group(3))
vr1_end = int(match.group(4))
unified_ref_list.append((book, chapter, vr1_start, vr1_end))
vr2_start = int(match.group(6))
vr2_end = check_end(match.group(7))
if match.group(5):
# One verse range per chapter
chapter2 = int(match.group(5))
unified_ref_list.append((book, chapter2, vr2_start, vr2_end))
else:
unified_ref_list.append((book, chapter, vr2_start, vr2_end))
elif match.group(6):
# Chapter range with verses
if match.group(3):
vr1_start = int(match.group(3))
else:
vr1_start = 1
if match.group(2) == match.group(4):
vr1_end = int(match.group(6))
unified_ref_list.append((book, chapter, vr1_start, vr1_end))
else:
vr1_end = -1
unified_ref_list.append((book, chapter, vr1_start, vr1_end))
vr2_end = check_end(match.group(6))
if int(match.group(4)) > chapter:
for i in range(chapter + 1, int(match.group(4)) + 1):
if i == int(match.group(4)):
unified_ref_list.append((book, i, 1, vr2_end))
else:
unified_ref_list.append((book, i, 1, -1))
elif match.group(4):
# Chapter range or chapter and verse range
if match.group(3):
vr1_start = int(match.group(3))
vr1_end = check_end(match.group(4))
if vr1_end == -1 or vr1_end > vr1_start:
unified_ref_list.append((book, chapter, vr1_start, vr1_end))
else:
log.debug(u'Ambiguous reference: %s' % reference)
return None
elif match.group(4) != u'end':
for i in range(chapter, int(match.group(4)) + 1):
unified_ref_list.append((book, i, 1, -1))
else:
log.debug(u'Unsupported reference: %s' % reference)
return None
elif match.group(3):
# Single chapter and verse
verse = int(match.group(3))
unified_ref_list.append((book, chapter, verse, verse))
else:
# Single chapter
unified_ref_list.append((book, chapter, -1, -1))
else:
log.debug(u'Invalid reference: %s' % reference)
return None
return unified_ref_list
class SearchResults(object):
"""
Encapsulate a set of search results. This is Bible-type independant.
"""
def __init__(self, book, chapter, verselist):
"""
Create the search result object.
``book``
The book of the Bible.
``chapter``
The chapter of the book.
``verselist``
The list of verses for this reading
"""
self.book = book
self.chapter = chapter
self.verselist = verselist
def has_verselist(self):
"""
Returns whether or not the verse list contains verses.
"""
return len(self.verselist) > 0
from common import BibleCommon
from manager import BibleManager from manager import BibleManager
from biblestab import BiblesTab from biblestab import BiblesTab
from mediaitem import BibleMediaItem from mediaitem import BibleMediaItem

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -45,7 +46,7 @@ class BiblesTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'BiblesTab') self.setObjectName(u'BiblesTab')
self.tabTitleVisible = translate('BiblesPlugin,BiblesTab', 'Bibles') self.tabTitleVisible = translate('BiblesPlugin.BiblesTab', 'Bibles')
self.BibleLayout = QtGui.QHBoxLayout(self) self.BibleLayout = QtGui.QHBoxLayout(self)
self.BibleLayout.setSpacing(8) self.BibleLayout.setSpacing(8)
self.BibleLayout.setMargin(8) self.BibleLayout.setMargin(8)
@ -150,34 +151,34 @@ class BiblesTab(SettingsTab):
def retranslateUi(self): def retranslateUi(self):
self.VerseDisplayGroupBox.setTitle( self.VerseDisplayGroupBox.setTitle(
translate('BiblesPlugin,BiblesTab', 'Verse Display')) translate('BiblesPlugin.BiblesTab', 'Verse Display'))
self.NewChaptersCheckBox.setText( self.NewChaptersCheckBox.setText(
translate('BiblesPlugin,BiblesTab', translate('BiblesPlugin.BiblesTab',
'Only show new chapter numbers')) 'Only show new chapter numbers'))
self.LayoutStyleLabel.setText( self.LayoutStyleLabel.setText(
translate('BiblesPlugin,BiblesTab', 'Layout Style:')) translate('BiblesPlugin.BiblesTab', 'Layout style:'))
self.DisplayStyleLabel.setText( self.DisplayStyleLabel.setText(
translate('BiblesPlugin,BiblesTab', 'Display Style:')) translate('BiblesPlugin.BiblesTab', 'Display style:'))
self.BibleThemeLabel.setText( self.BibleThemeLabel.setText(
translate('BiblesPlugin,BiblesTab', 'Bible Theme:')) translate('BiblesPlugin.BiblesTab', 'Bible theme:'))
self.LayoutStyleComboBox.setItemText(0, self.LayoutStyleComboBox.setItemText(0,
translate('BiblesPlugin,BiblesTab', 'verse per slide')) translate('BiblesPlugin.BiblesTab', 'Verse Per Slide'))
self.LayoutStyleComboBox.setItemText(1, self.LayoutStyleComboBox.setItemText(1,
translate('BiblesPlugin,BiblesTab', 'verse per line')) translate('BiblesPlugin.BiblesTab', 'Verse Per Line'))
self.LayoutStyleComboBox.setItemText(2, self.LayoutStyleComboBox.setItemText(2,
translate('BiblesPlugin,BiblesTab', 'continuous')) translate('BiblesPlugin.BiblesTab', 'Continuous'))
self.DisplayStyleComboBox.setItemText(0, self.DisplayStyleComboBox.setItemText(0,
translate('BiblesPlugin,BiblesTab', 'No brackets')) translate('BiblesPlugin.BiblesTab', 'No Brackets'))
self.DisplayStyleComboBox.setItemText(1, self.DisplayStyleComboBox.setItemText(1,
translate('BiblesPlugin,BiblesTab', '( and )')) translate('BiblesPlugin.BiblesTab', '( And )'))
self.DisplayStyleComboBox.setItemText(2, self.DisplayStyleComboBox.setItemText(2,
translate('BiblesPlugin,BiblesTab', '{ and }')) translate('BiblesPlugin.BiblesTab', '{ And }'))
self.DisplayStyleComboBox.setItemText(3, self.DisplayStyleComboBox.setItemText(3,
translate('BiblesPlugin,BiblesTab', '[ and ]')) translate('BiblesPlugin.BiblesTab', '[ And ]'))
self.ChangeNoteLabel.setText(translate('BiblesPlugin.BiblesTab', self.ChangeNoteLabel.setText(translate('BiblesPlugin.BiblesTab',
'Note:\nChanges don\'t affect verses already in the service')) 'Note:\nChanges do not affect verses already in the service.'))
self.BibleDualCheckBox.setText( self.BibleDualCheckBox.setText(
translate('BiblesPlugin,BiblesTab', 'Display Dual Bible Verses')) translate('BiblesPlugin.BiblesTab', 'Display dual Bible verses'))
def onBibleThemeComboBoxChanged(self): def onBibleThemeComboBoxChanged(self):
self.bible_theme = self.BibleThemeComboBox.currentText() self.bible_theme = self.BibleThemeComboBox.currentText()
@ -240,10 +241,10 @@ class BiblesTab(SettingsTab):
self.BibleThemeComboBox.addItem(u'') self.BibleThemeComboBox.addItem(u'')
for theme in theme_list: for theme in theme_list:
self.BibleThemeComboBox.addItem(theme) self.BibleThemeComboBox.addItem(theme)
id = self.BibleThemeComboBox.findText( index = self.BibleThemeComboBox.findText(
unicode(self.bible_theme), QtCore.Qt.MatchExactly) unicode(self.bible_theme), QtCore.Qt.MatchExactly)
if id == -1: if index == -1:
# Not Found # Not Found
id = 0 index = 0
self.bible_theme = u'' self.bible_theme = u''
self.BibleThemeComboBox.setCurrentIndex(id) self.BibleThemeComboBox.setCurrentIndex(index)

View File

@ -1,280 +0,0 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# 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 urllib2
import logging
import re
import chardet
import htmlentitydefs
only_verses = re.compile(r'([\w .]+)[ ]+([0-9]+)[ ]*[:|v|V][ ]*([0-9]+)'
r'(?:[ ]*-[ ]*([0-9]+|end))?(?:[ ]*,[ ]*([0-9]+)'
r'(?:[ ]*-[ ]*([0-9]+|end))?)?',
re.UNICODE)
chapter_range = re.compile(r'([\w .]+)[ ]+([0-9]+)[ ]*[:|v|V][ ]*'
r'([0-9]+|end)[ ]*-[ ]*([0-9]+)[ ]*[:|v|V][ ]*([0-9]+|end)',
re.UNICODE)
log = logging.getLogger(__name__)
def parse_reference(reference):
"""
This is the über-awesome function that takes a person's typed in string
and converts it to a reference list, a list of references to be queried
from the Bible database files.
The reference list is a list of tuples, with each tuple structured like
this::
(book, chapter, start_verse, end_verse)
"""
reference = reference.strip()
log.debug('parse_reference("%s")', reference)
reference_list = []
# We start with the most "complicated" match first, so that they are found
# first, and we don't have any "false positives".
match = chapter_range.match(reference)
if match:
log.debug('Found a chapter range.')
book = match.group(1)
from_verse = match.group(3)
to_verse = match.group(5)
if int(match.group(2)) == int(match.group(4)):
reference_list.append(
(match.group(1), int(match.group(2)), from_verse, to_verse)
)
else:
if int(match.group(2)) > int(match.group(4)):
from_chapter = int(match.group(4))
to_chapter = int(match.group(2))
else:
from_chapter = int(match.group(2))
to_chapter = int(match.group(4))
for chapter in xrange(from_chapter, to_chapter + 1):
if chapter == from_chapter:
reference_list.append(
(match.group(1), chapter, from_verse, -1)
)
elif chapter == to_chapter:
reference_list.append(
(match.group(1), chapter, 1, to_verse)
)
else:
reference_list.append(
(match.group(1), chapter, 1, -1)
)
else:
match = only_verses.match(reference)
if match:
log.debug('Found a verse range.')
book = match.group(1)
chapter = match.group(2)
verse = match.group(3)
if match.group(4) is None:
reference_list.append((book, chapter, verse, verse))
elif match.group(5) is None:
end_verse = match.group(4)
if end_verse == u'end':
end_verse = -1
reference_list.append((book, chapter, verse, end_verse))
elif match.group(6) is None:
reference_list.extend([
(book, chapter, verse, match.group(4)),
(book, chapter, match.group(5), match.group(5))
])
else:
end_verse = match.group(6)
if end_verse == u'end':
end_verse = -1
reference_list.extend([
(book, chapter, verse, match.group(4)),
(book, chapter, match.group(5), end_verse)
])
else:
log.debug('Didn\'t find anything.')
log.debug(reference_list)
return reference_list
class SearchResults(object):
"""
Encapsulate a set of search results. This is Bible-type independant.
"""
def __init__(self, book, chapter, verselist):
"""
Create the search result object.
``book``
The book of the Bible.
``chapter``
The chapter of the book.
``verselist``
The list of verses for this reading
"""
self.book = book
self.chapter = chapter
self.verselist = verselist
def get_verselist(self):
"""
Returns the list of verses.
"""
return self.verselist
def get_book(self):
"""
Returns the book of the Bible.
"""
return self.book
def get_chapter(self):
"""
Returns the chapter of the book.
"""
return self.chapter
def has_verselist(self):
"""
Returns whether or not the verse list contains verses.
"""
return len(self.verselist) > 0
class BibleCommon(object):
"""
A common ancestor for bible download sites.
"""
log.info(u'BibleCommon')
def _get_web_text(self, urlstring, proxyurl):
"""
Get the HTML from the web page.
``urlstring``
The URL of the page to open.
``proxyurl``
The URL of a proxy server used to access the Internet.
"""
log.debug(u'get_web_text %s %s', proxyurl, urlstring)
if proxyurl:
proxy_support = urllib2.ProxyHandler({'http': self.proxyurl})
http_support = urllib2.HTTPHandler()
opener = urllib2.build_opener(proxy_support, http_support)
urllib2.install_opener(opener)
xml_string = u''
req = urllib2.Request(urlstring)
#Make us look like an IE Browser on XP to stop blocking by web site
req.add_header(u'User-Agent',
u'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)')
try:
handle = urllib2.urlopen(req)
html = handle.read()
details = chardet.detect(html)
xml_string = unicode(html, details[u'encoding'])
except IOError, e:
if hasattr(e, u'reason'):
log.exception(u'Reason for failure: %s', e.reason)
return xml_string
def _clean_text(self, text):
"""
Clean up text and remove extra characters after been downloaded from
the Internet.
``text``
The text from the web page that needs to be cleaned up.
"""
#return text.rstrip()
# Remove Headings from the Text
start_tag = text.find(u'<h')
while start_tag > -1:
end_tag = text.find(u'</h', start_tag)
text = text[:(start_tag - 1)] + text[(end_tag + 4)]
start_tag = text.find(u'<h')
# Remove Support References from the Text
start_tag = text.find(u'<sup>')
while start_tag > -1:
end_tag = text.find(u'</sup>')
text = text[:start_tag] + text[end_tag + 6:len(text)]
start_tag = text.find(u'<sup>')
start_tag = text.find(u'<SUP>')
while start_tag > -1:
end_tag = text.find(u'</SUP>')
text = text[:start_tag] + text[end_tag + 6:len(text)]
start_tag = text.find(u'<SUP>')
# Static Clean ups
text = text.replace(u'\n', u'')
text = text.replace(u'\r', u'')
text = text.replace(u'&nbsp;', u'')
text = text.replace(u'<P>', u'')
text = text.replace(u'<I>', u'')
text = text.replace(u'</I>', u'')
text = text.replace(u'<P />', u'')
text = text.replace(u'<p />', u'')
text = text.replace(u'</P>', u'')
text = text.replace(u'<BR>', u'')
text = text.replace(u'<BR />', u'')
text = text.replace(u'&quot;', u'\"')
text = text.replace(u'&apos;', u'\'')
# Remove some other tags
start_tag = text.find(u'<')
while start_tag > -1:
end_tag = text.find(u'>', start_tag)
text = text[:start_tag] + text[end_tag + 1:]
start_tag = text.find(u'<')
text = text.replace(u'>', u'')
return text.rstrip().lstrip()
def unescape(text):
"""
Removes HTML or XML character references and entities from a text string.
Courtesy of Fredrik Lundh, http://effbot.org/zone/re-sub.htm#unescape-html
@param text The HTML (or XML) source text.
@return The plain text, as a Unicode string, if necessary.
"""
def fixup(markup):
text = markup.group(0)
if text.startswith(u'&#'):
# character reference
try:
if text.startswith(u'&#x'):
return unichr(int(text[3:-1], 16))
else:
return unichr(int(text[2:-1]))
except ValueError:
pass
else:
# named entity
try:
text = unichr(htmlentitydefs.name2codepoint[text[1:-1]])
except KeyError:
pass
return text # leave as is
return re.sub(u'&#?\w+;', fixup, text)

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -305,6 +306,13 @@ class BibleDB(QtCore.QObject, Manager):
Book.abbreviation.like(book + u'%')) Book.abbreviation.like(book + u'%'))
return db_book return db_book
def get_books(self):
"""
A wrapper so both local and web bibles have a get_books() method that
manager can call. Used in the media manager advanced search tab.
"""
return self.get_all_objects(Book, order_by_ref=Book.id)
def get_verses(self, reference_list): def get_verses(self, reference_list):
""" """
This is probably the most used function. It retrieves the list of This is probably the most used function. It retrieves the list of
@ -343,11 +351,11 @@ class BibleDB(QtCore.QObject, Manager):
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, QtGui.QMessageBox.information(self.bible_plugin.mediaItem,
translate('BibleDB', 'Book not found'), translate('BiblesPlugin.BibleDB', 'Book not found'),
translate('BibleDB', u'The book you requested could not ' translate('BiblesPlugin.BibleDB', 'The book you requested '
'be found in this bible. Please check your spelling ' 'could not be found in this bible. Please check your '
'and that this is a complete bible not just one ' 'spelling and that this is a complete bible not just '
'testament.')) 'one testament.'))
return verse_list return verse_list
def verse_search(self, text): def verse_search(self, text):

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -24,17 +25,18 @@
############################################################################### ###############################################################################
import logging import logging
import urllib2
import os import os
import sqlite3
import re import re
import sqlite3
import urllib
import urllib2
from HTMLParser import HTMLParseError
from BeautifulSoup import BeautifulSoup, Tag, NavigableString from BeautifulSoup import BeautifulSoup, NavigableString
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib.common import BibleCommon, SearchResults, \ from openlp.plugins.bibles.lib import SearchResults
unescape
from openlp.plugins.bibles.lib.db import BibleDB, Book from openlp.plugins.bibles.lib.db import BibleDB, Book
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -104,6 +106,7 @@ class HTTPBooks(object):
""" """
if not isinstance(name, unicode): if not isinstance(name, unicode):
name = unicode(name) name = unicode(name)
name = name.title()
books = HTTPBooks.run_sql(u'SELECT id, testament_id, name, ' books = HTTPBooks.run_sql(u'SELECT id, testament_id, name, '
u'abbreviation, chapters FROM books WHERE name = ? OR ' u'abbreviation, chapters FROM books WHERE name = ? OR '
u'abbreviation = ?', (name, name)) u'abbreviation = ?', (name, name))
@ -136,10 +139,10 @@ class HTTPBooks(object):
u'verses FROM chapters WHERE book_id = ?', (book[u'id'],)) u'verses FROM chapters WHERE book_id = ?', (book[u'id'],))
if chapters: if chapters:
return { return {
u'id': chapters[chapter][0], u'id': chapters[chapter-1][0],
u'book_id': chapters[chapter][1], u'book_id': chapters[chapter-1][1],
u'chapter': chapters[chapter][2], u'chapter': chapters[chapter-1][2],
u'verses': chapters[chapter][3] u'verses': chapters[chapter-1][3]
} }
else: else:
return None return None
@ -174,11 +177,10 @@ class HTTPBooks(object):
return 0 return 0
class BGExtract(BibleCommon): class BGExtract(object):
""" """
Extract verses from BibleGateway Extract verses from BibleGateway
""" """
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
@ -197,79 +199,51 @@ class BGExtract(BibleCommon):
Chapter number Chapter number
""" """
log.debug(u'get_bible_chapter %s, %s, %s', version, bookname, chapter) log.debug(u'get_bible_chapter %s, %s, %s', version, bookname, chapter)
urlstring = u'http://www.biblegateway.com/passage/?search=%s+%s' \ url_params = urllib.urlencode(
u'&version=%s' % (bookname, chapter, version) {u'search': u'%s %s' % (bookname, chapter),
log.debug(u'BibleGateway url = %s' % urlstring) u'version': u'%s' % version})
# Let's get the page, and then open it in BeautifulSoup, so as to page = None
# attempt to make "easy" work of bad HTML. try:
page = urllib2.urlopen(urlstring) page = urllib2.urlopen(
Receiver.send_message(u'openlp_process_events') u'http://www.biblegateway.com/passage/?%s' % url_params)
soup = BeautifulSoup(page) log.debug(u'BibleGateway url = %s' % page.geturl())
Receiver.send_message(u'openlp_process_events')
verses = soup.find(u'div', u'result-text-style-normal')
verse_number = 0
verse_list = {0: u''}
# http://www.codinghorror.com/blog/2009/11/parsing-html-the-cthulhu-way.html
# This is a PERFECT example of opening the Cthulu tag!
# O Bible Gateway, why doth ye such horrific HTML produce?
for verse in verses:
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
if isinstance(verse, Tag) and verse.name == u'div' and filter(lambda a: a[0] == u'class', verse.attrs)[0][1] == u'footnotes': except urllib2.URLError:
break log.exception(u'The web bible page could not be downloaded.')
if isinstance(verse, Tag) and verse.name == u'sup' and filter(lambda a: a[0] == u'class', verse.attrs)[0][1] != u'versenum': finally:
continue if not page:
if isinstance(verse, Tag) and verse.name == u'p' and not verse.contents: return None
continue cleaner = [(re.compile('&nbsp;|<br />'), lambda match: '')]
if isinstance(verse, Tag) and (verse.name == u'p' or verse.name == u'font') and verse.contents: soup = None
for item in verse.contents: try:
Receiver.send_message(u'openlp_process_events') soup = BeautifulSoup(page, markupMassage=cleaner)
if isinstance(item, Tag) and (item.name == u'h4' or item.name == u'h5'): except HTMLParseError:
continue log.exception(u'BeautifulSoup could not parse the bible page.')
if isinstance(item, Tag) and item.name == u'sup' and filter(lambda a: a[0] == u'class', item.attrs)[0][1] != u'versenum': finally:
continue if not soup:
if isinstance(item, Tag) and item.name == u'p' and not item.contents: return None
continue Receiver.send_message(u'openlp_process_events')
if isinstance(item, Tag) and item.name == u'sup': footnotes = soup.findAll(u'sup', u'footnote')
verse_number = int(str(item.contents[0])) [footnote.extract() for footnote in footnotes]
verse_list[verse_number] = u'' cleanup = [(re.compile('\s+'), lambda match: ' ')]
continue verses = BeautifulSoup(str(soup), markupMassage=cleanup)
if isinstance(item, Tag) and item.name == u'font': content = verses.find(u'div', u'result-text-style-normal')
for subitem in item.contents: verse_count = len(verses.findAll(u'sup', u'versenum'))
Receiver.send_message(u'openlp_process_events') found_count = 0
if isinstance(subitem, Tag) and subitem.name == u'sup' and filter(lambda a: a[0] == u'class', subitem.attrs)[0][1] != u'versenum': verse_list = {}
continue while found_count < verse_count:
if isinstance(subitem, Tag) and subitem.name == u'p' and not subitem.contents: content = content.findNext(u'sup', u'versenum')
continue raw_verse_num = content.next
if isinstance(subitem, Tag) and subitem.name == u'sup': raw_verse_text = raw_verse_num.next
verse_number = int(str(subitem.contents[0])) verse_list[int(str(raw_verse_num))] = unicode(raw_verse_text)
verse_list[verse_number] = u'' found_count += 1
continue
if isinstance(subitem, NavigableString):
verse_list[verse_number] = verse_list[verse_number] + subitem.replace(u'&nbsp;', u' ')
continue
if isinstance(item, NavigableString):
verse_list[verse_number] = verse_list[verse_number] + item.replace(u'&nbsp;', u' ')
continue
if isinstance(verse, Tag) and verse.name == u'sup':
verse_number = int(str(verse.contents[0]))
verse_list[verse_number] = u''
continue
if isinstance(verse, NavigableString):
if not isinstance(verse, unicode):
verse = unicode(verse, u'utf8')
verse_list[verse_number] = verse_list[verse_number] + \
unescape(verse.replace(u'&nbsp;', u' '))
# Delete the "0" element, since we don't need it, it's just there for
# some stupid initial whitespace, courtesy of Bible Gateway.
del verse_list[0]
# Finally, return the list of verses in a "SearchResults" object.
return SearchResults(bookname, chapter, verse_list) return SearchResults(bookname, chapter, verse_list)
class CWExtract(BibleCommon):
class CWExtract(object):
""" """
Extract verses from CrossWalk/BibleStudyTools Extract verses from CrossWalk/BibleStudyTools
""" """
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
@ -292,11 +266,23 @@ class CWExtract(BibleCommon):
chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % \ chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % \
(version, urlbookname.lower(), chapter) (version, urlbookname.lower(), chapter)
log.debug(u'URL: %s', chapter_url) log.debug(u'URL: %s', chapter_url)
page = urllib2.urlopen(chapter_url) page = None
Receiver.send_message(u'openlp_process_events') try:
if not page: page = urllib2.urlopen(chapter_url)
return None Receiver.send_message(u'openlp_process_events')
soup = BeautifulSoup(page) except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.')
finally:
if not page:
return None
soup = None
try:
soup = BeautifulSoup(page)
except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.')
finally:
if not soup:
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 = {}
@ -429,13 +415,12 @@ class HTTPBible(BibleDB):
## if it was there. By reusing the returned book name ## if it was there. By reusing the returned book name
## we get a correct book. For example it is possible ## we get a correct book. For example it is possible
## to request ac and get Acts back. ## to request ac and get Acts back.
bookname = search_results.get_book() bookname = search_results.book
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
# check to see if book/chapter exists # check to see if book/chapter exists
db_book = self.get_book(bookname) db_book = self.get_book(bookname)
self.create_chapter(db_book.id, self.create_chapter(db_book.id, search_results.chapter,
search_results.get_chapter(), search_results.verselist)
search_results.get_verselist())
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
Receiver.send_message(u'bibles_hideprogress') Receiver.send_message(u'bibles_hideprogress')
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
@ -447,15 +432,11 @@ class HTTPBible(BibleDB):
""" """
log.debug(u'get_chapter %s, %s', book, chapter) log.debug(u'get_chapter %s, %s', book, chapter)
log.debug(u'source = %s', self.download_source) log.debug(u'source = %s', self.download_source)
try: if self.download_source.lower() == u'crosswalk':
if self.download_source.lower() == u'crosswalk': ev = CWExtract(self.proxy_server)
ev = CWExtract(self.proxy_server) else:
else: ev = BGExtract(self.proxy_server)
ev = BGExtract(self.proxy_server) return ev.get_bible_chapter(self.download_name, book, chapter)
return ev.get_bible_chapter(self.download_name, book, chapter)
except:
log.exception("Failed to get bible chapter")
return None
def get_books(self): def get_books(self):
""" """
@ -487,14 +468,3 @@ class HTTPBible(BibleDB):
The chapter whose verses are being counted. The chapter whose verses are being counted.
""" """
return HTTPBooks.get_verse_count(book, chapter) return HTTPBooks.get_verse_count(book, chapter)
def set_proxy_server(self, server):
"""
Sets the proxy server.
**Note: This is not actually used.**
``server``
The hostname or IP address of the proxy server.
"""
self.proxy_server = server

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -25,13 +26,13 @@
import logging import logging
from PyQt4 import QtCore from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsManager from openlp.core.lib import SettingsManager, translate
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib.db import BibleDB, Book, BibleMeta from openlp.plugins.bibles.lib import parse_reference
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
from common import parse_reference
from opensong import OpenSongBible from opensong import OpenSongBible
from osis import OSISBible from osis import OSISBible
from csvbible import CSVBible from csvbible import CSVBible
@ -62,20 +63,20 @@ class BibleFormat(object):
WebDownload = 3 WebDownload = 3
@staticmethod @staticmethod
def get_class(id): def get_class(format):
""" """
Return the appropriate imeplementation class. Return the appropriate imeplementation class.
``id`` ``format``
The Bible format. The Bible format.
""" """
if id == BibleFormat.OSIS: if format == BibleFormat.OSIS:
return OSISBible return OSISBible
elif id == BibleFormat.CSV: elif format == BibleFormat.CSV:
return CSVBible return CSVBible
elif id == BibleFormat.OpenSong: elif format == BibleFormat.OpenSong:
return OpenSongBible return OpenSongBible
elif id == BibleFormat.WebDownload: elif format == BibleFormat.WebDownload:
return HTTPBible return HTTPBible
else: else:
return None return None
@ -148,7 +149,7 @@ class BibleManager(object):
file=filename, download_source=source.value, file=filename, download_source=source.value,
download_name=download_name) download_name=download_name)
if meta_proxy: if meta_proxy:
web_bible.set_proxy_server(meta_proxy.value) web_bible.proxy_server = meta_proxy.value
self.db_cache[name] = web_bible self.db_cache[name] = web_bible
log.debug(u'Bibles reloaded') log.debug(u'Bibles reloaded')
@ -198,7 +199,7 @@ class BibleManager(object):
u'name': book.name, u'name': book.name,
u'chapters': self.db_cache[bible].get_chapter_count(book.name) u'chapters': self.db_cache[bible].get_chapter_count(book.name)
} }
for book in self.db_cache[bible].get_all_objects(Book, Book.id) for book in self.db_cache[bible].get_books()
] ]
def get_chapter_count(self, bible, book): def get_chapter_count(self, bible, book):
@ -228,13 +229,33 @@ class BibleManager(object):
``versetext`` ``versetext``
Unicode. The scripture reference. Valid scripture references are: Unicode. The scripture reference. Valid scripture references are:
- Genesis 1
- Genesis 1-2
- Genesis 1:1 - Genesis 1:1
- Genesis 1:1-10 - Genesis 1:1-10
- Genesis 1:1-10,15-20
- Genesis 1:1-2:10 - Genesis 1:1-2:10
- Genesis 1:1-10,2:1-10
""" """
log.debug(u'BibleManager.get_verses("%s", "%s")', bible, versetext) log.debug(u'BibleManager.get_verses("%s", "%s")', bible, versetext)
reflist = parse_reference(versetext) reflist = parse_reference(versetext)
return self.db_cache[bible].get_verses(reflist) if reflist:
return self.db_cache[bible].get_verses(reflist)
else:
QtGui.QMessageBox.information(self.parent.mediaItem,
translate('BiblesPlugin.BibleManager',
'Scripture Reference Error'),
translate('BiblesPlugin.BibleManager', 'Your scripture '
'reference is either not supported by OpenLP or invalid. '
'Please make sure your reference conforms to one of the '
'following patterns:\n\n'
'Book Chapter\n'
'Book Chapter-Chapter\n'
'Book Chapter:Verse-Verse\n'
'Book Chapter:Verse-Verse,Verse-Verse\n'
'Book Chapter:Verse-Verse,Chapter:Verse-Verse\n'
'Book Chapter:Verse-Chapter:Verse\n'))
return None
def save_meta_data(self, bible, version, copyright, permissions): def save_meta_data(self, bible, version, copyright, permissions):
""" """

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -129,8 +130,7 @@ class BibleMediaItem(MediaManagerItem):
self.QuickClearLabel.setObjectName(u'QuickSearchLabel') self.QuickClearLabel.setObjectName(u'QuickSearchLabel')
self.QuickLayout.addWidget(self.QuickClearLabel, 4, 0, 1, 1) self.QuickLayout.addWidget(self.QuickClearLabel, 4, 0, 1, 1)
self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab) self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab)
self.ClearQuickSearchComboBox.setObjectName( self.ClearQuickSearchComboBox.setObjectName(u'ClearQuickSearchComboBox')
u'ClearQuickSearchComboBox')
self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 4, 1, 1, 2) self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 4, 1, 1, 2)
self.QuickSearchButtonLayout = QtGui.QHBoxLayout() self.QuickSearchButtonLayout = QtGui.QHBoxLayout()
self.QuickSearchButtonLayout.setMargin(0) self.QuickSearchButtonLayout.setMargin(0)
@ -168,8 +168,7 @@ class BibleMediaItem(MediaManagerItem):
self.AdvancedVersionComboBox.setObjectName(u'AdvancedVersionComboBox') self.AdvancedVersionComboBox.setObjectName(u'AdvancedVersionComboBox')
self.AdvancedLayout.addWidget(self.AdvancedVersionComboBox, 0, 1, 1, 2) self.AdvancedLayout.addWidget(self.AdvancedVersionComboBox, 0, 1, 1, 2)
self.AdvancedSecondBibleLabel = QtGui.QLabel(self.AdvancedTab) self.AdvancedSecondBibleLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedSecondBibleLabel.setObjectName( self.AdvancedSecondBibleLabel.setObjectName(u'AdvancedSecondBibleLabel')
u'AdvancedSecondBibleLabel')
self.AdvancedLayout.addWidget(self.AdvancedSecondBibleLabel, 1, 0, 1, 1) self.AdvancedLayout.addWidget(self.AdvancedSecondBibleLabel, 1, 0, 1, 1)
self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab) self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedSecondBibleComboBox.setSizeAdjustPolicy( self.AdvancedSecondBibleComboBox.setSizeAdjustPolicy(
@ -223,8 +222,7 @@ class BibleMediaItem(MediaManagerItem):
u'AdvancedSearchButtonLayout') u'AdvancedSearchButtonLayout')
self.AdvancedSearchButtonSpacer = QtGui.QSpacerItem(40, 20, self.AdvancedSearchButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.AdvancedSearchButtonLayout.addItem( self.AdvancedSearchButtonLayout.addItem(self.AdvancedSearchButtonSpacer)
self.AdvancedSearchButtonSpacer)
self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab) self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab)
self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton') self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton')
self.AdvancedSearchButtonLayout.addWidget(self.AdvancedSearchButton) self.AdvancedSearchButtonLayout.addWidget(self.AdvancedSearchButton)
@ -297,7 +295,7 @@ class BibleMediaItem(MediaManagerItem):
self.QuickSecondVersionLabel.setText( self.QuickSecondVersionLabel.setText(
translate('BiblesPlugin.MediaItem', 'Dual:')) translate('BiblesPlugin.MediaItem', 'Dual:'))
self.QuickSearchLabel.setText( self.QuickSearchLabel.setText(
translate('BiblesPlugin.MediaItem', 'Search Type:')) translate('BiblesPlugin.MediaItem', 'Search type:'))
self.QuickSearchLabel.setText( self.QuickSearchLabel.setText(
translate('BiblesPlugin.MediaItem', 'Find:')) translate('BiblesPlugin.MediaItem', 'Find:'))
self.QuickSearchButton.setText( self.QuickSearchButton.setText(
@ -389,10 +387,7 @@ class BibleMediaItem(MediaManagerItem):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.MediaItem', 'No Book Found'), translate('BiblesPlugin.MediaItem', 'No Book Found'),
translate('BiblesPlugin.MediaItem', translate('BiblesPlugin.MediaItem',
'No matching book could be found in this Bible.'), 'No matching book could be found in this Bible.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok
)
def onAdvancedVersionComboBox(self): def onAdvancedVersionComboBox(self):
self.initialiseBible( self.initialiseBible(
@ -433,8 +428,8 @@ class BibleMediaItem(MediaManagerItem):
chapter_to = int(self.AdvancedToChapter.currentText()) chapter_to = int(self.AdvancedToChapter.currentText())
verse_from = int(self.AdvancedFromVerse.currentText()) verse_from = int(self.AdvancedFromVerse.currentText())
verse_to = int(self.AdvancedToVerse.currentText()) verse_to = int(self.AdvancedToVerse.currentText())
versetext = u'%s %s:%s-%s:%s' % (book, chapter_from, verse_from, \ versetext = u'%s %s:%s-%s:%s' % (book, chapter_from, verse_from,
chapter_to, verse_to) chapter_to, verse_to)
self.search_results = self.parent.manager.get_verses(bible, versetext) self.search_results = self.parent.manager.get_verses(bible, versetext)
if self.ClearAdvancedSearchComboBox.currentIndex() == 0: if self.ClearAdvancedSearchComboBox.currentIndex() == 0:
self.listView.clear() self.listView.clear()
@ -511,17 +506,17 @@ class BibleMediaItem(MediaManagerItem):
reference = bitem.data(QtCore.Qt.UserRole) reference = bitem.data(QtCore.Qt.UserRole)
if isinstance(reference, QtCore.QVariant): if isinstance(reference, QtCore.QVariant):
reference = reference.toPyObject() reference = reference.toPyObject()
bible = self._decodeQtObject(reference, 'bible') #bible = self._decodeQtObject(reference, 'bible')
book = self._decodeQtObject(reference, 'book') book = self._decodeQtObject(reference, 'book')
chapter = self._decodeQtObject(reference, 'chapter') chapter = self._decodeQtObject(reference, 'chapter')
verse = self._decodeQtObject(reference, 'verse') verse = self._decodeQtObject(reference, 'verse')
text = self._decodeQtObject(reference, 'text') text = self._decodeQtObject(reference, 'text')
version = self._decodeQtObject(reference, 'version') version = self._decodeQtObject(reference, 'version')
copyright = self._decodeQtObject(reference, 'copyright') copyright = self._decodeQtObject(reference, 'copyright')
permission = self._decodeQtObject(reference, 'permission') #permission = self._decodeQtObject(reference, 'permission')
if self.parent.settings_tab.display_style == 1: if self.parent.settings_tab.display_style == 1:
verse_text = self.formatVerse(old_chapter, chapter, verse, verse_text = self.formatVerse(old_chapter, chapter, verse,
u'(u', u')') u'(', u')')
elif self.parent.settings_tab.display_style == 2: elif self.parent.settings_tab.display_style == 2:
verse_text = self.formatVerse(old_chapter, chapter, verse, verse_text = self.formatVerse(old_chapter, chapter, verse,
u'{', u'}') u'{', u'}')
@ -614,12 +609,11 @@ class BibleMediaItem(MediaManagerItem):
if self.verses == 0: if self.verses == 0:
self.AdvancedSearchButton.setEnabled(False) self.AdvancedSearchButton.setEnabled(False)
self.AdvancedMessage.setText( self.AdvancedMessage.setText(
translate('BiblesPlugin.MediaItem', 'Bible not fully loaded')) translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.'))
else: else:
self.AdvancedSearchButton.setEnabled(True) self.AdvancedSearchButton.setEnabled(True)
self.AdvancedMessage.setText(u'') self.AdvancedMessage.setText(u'')
self.adjustComboBox(1, self.chapters_from, self.adjustComboBox(1, self.chapters_from, self.AdvancedFromChapter)
self.AdvancedFromChapter)
self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter) self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter)
self.adjustComboBox(1, self.verses, self.AdvancedFromVerse) self.adjustComboBox(1, self.verses, self.AdvancedFromVerse)
self.adjustComboBox(1, self.verses, self.AdvancedToVerse) self.adjustComboBox(1, self.verses, self.AdvancedToVerse)
@ -659,7 +653,3 @@ class BibleMediaItem(MediaManagerItem):
row = self.listView.setCurrentRow(count) row = self.listView.setCurrentRow(count)
if row: if row:
row.setSelected(True) row.setSelected(True)
def searchByReference(self, bible, search):
log.debug(u'searchByReference %s, %s', bible, search)
self.search_results = self.parent.manager.get_verses(bible, search)

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -102,4 +103,3 @@ class OpenSongBible(BibleDB):
return False return False
else: else:
return success return success

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -184,4 +185,3 @@ class OSISBible(BibleDB):
return False return False
else: else:
return success return success

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -27,7 +28,7 @@ import logging
from forms import EditCustomForm from forms import EditCustomForm
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.plugins.custom.lib import CustomMediaItem, CustomTab from openlp.plugins.custom.lib import CustomMediaItem, CustomTab
from openlp.plugins.custom.lib.db import CustomSlide, init_schema from openlp.plugins.custom.lib.db import CustomSlide, init_schema
@ -52,7 +53,6 @@ class CustomPlugin(Plugin):
self.edit_custom_form = EditCustomForm(self.custommanager) self.edit_custom_form = EditCustomForm(self.custommanager)
self.icon_path = u':/plugins/plugin_custom.png' self.icon_path = u':/plugins/plugin_custom.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
self.status = PluginStatus.Active
def getSettingsTab(self): def getSettingsTab(self):
return CustomTab(self.name) return CustomTab(self.name)
@ -62,11 +62,11 @@ class CustomPlugin(Plugin):
return CustomMediaItem(self, self.icon, self.name) return CustomMediaItem(self, self.icon, self.name)
def about(self): def about(self):
about_text = translate('CustomPlugin', about_text = translate('CustomPlugin', '<strong>Custom Plugin</strong>'
'<b>Custom Plugin</b><br>This plugin ' '<br />The custom plugin provides the ability to set up custom '
'allows slides to be displayed on the screen in the same way ' 'text slides that can be displayed on the screen the same way '
'songs are. This plugin provides greater freedom over the ' 'songs are. This plugin provides greater freedom over the songs '
'songs plugin.<br>') 'plugin.')
return about_text return about_text
def usesTheme(self, theme): def usesTheme(self, theme):
@ -75,7 +75,7 @@ class CustomPlugin(Plugin):
Returns True if the theme is being used, otherwise returns False. Returns True if the theme is being used, otherwise returns False.
""" """
if self.custommanager.get_all_objects_filtered(CustomSlide, if self.custommanager.get_all_objects(CustomSlide,
CustomSlide.theme_name == theme): CustomSlide.theme_name == theme):
return True return True
return False return False
@ -91,8 +91,8 @@ class CustomPlugin(Plugin):
``newTheme`` ``newTheme``
The new name the plugin should now use. The new name the plugin should now use.
""" """
customsUsingTheme = self.custommanager.get_all_objects_filtered( customsUsingTheme = self.custommanager.get_all_objects(CustomSlide,
CustomSlide, CustomSlide.theme_name == oldTheme) CustomSlide.theme_name == oldTheme)
for custom in customsUsingTheme: for custom in customsUsingTheme:
custom.theme_name = newTheme custom.theme_name = newTheme
self.custommanager.save_object(custom) self.custommanager.save_object(custom)

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -27,7 +28,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
class Ui_customEditDialog(object): class Ui_CustomEditDialog(object):
def setupUi(self, customEditDialog): def setupUi(self, customEditDialog):
customEditDialog.setObjectName(u'customEditDialog') customEditDialog.setObjectName(u'customEditDialog')
customEditDialog.resize(590, 541) customEditDialog.resize(590, 541)
@ -37,94 +38,94 @@ class Ui_customEditDialog(object):
self.gridLayout.setObjectName(u'gridLayout') self.gridLayout.setObjectName(u'gridLayout')
self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(u'horizontalLayout') self.horizontalLayout.setObjectName(u'horizontalLayout')
self.TitleLabel = QtGui.QLabel(customEditDialog) self.titleLabel = QtGui.QLabel(customEditDialog)
self.TitleLabel.setObjectName(u'TitleLabel') self.titleLabel.setObjectName(u'titleLabel')
self.horizontalLayout.addWidget(self.TitleLabel) self.horizontalLayout.addWidget(self.titleLabel)
self.TitleEdit = QtGui.QLineEdit(customEditDialog) self.titleEdit = QtGui.QLineEdit(customEditDialog)
self.TitleLabel.setBuddy(self.TitleEdit) self.titleLabel.setBuddy(self.titleEdit)
self.TitleEdit.setObjectName(u'TitleEdit') self.titleEdit.setObjectName(u'titleEdit')
self.horizontalLayout.addWidget(self.TitleEdit) self.horizontalLayout.addWidget(self.titleEdit)
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout4 = QtGui.QHBoxLayout()
self.horizontalLayout_4.setObjectName(u'horizontalLayout_4') self.horizontalLayout4.setObjectName(u'horizontalLayout4')
self.VerseListView = QtGui.QListWidget(customEditDialog) self.verseListView = QtGui.QListWidget(customEditDialog)
self.VerseListView.setAlternatingRowColors(True) self.verseListView.setAlternatingRowColors(True)
self.VerseListView.setObjectName(u'VerseListView') self.verseListView.setObjectName(u'verseListView')
self.horizontalLayout_4.addWidget(self.VerseListView) self.horizontalLayout4.addWidget(self.verseListView)
self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(u'verticalLayout') self.verticalLayout.setObjectName(u'verticalLayout')
self.UpButton = QtGui.QPushButton(customEditDialog) self.upButton = QtGui.QPushButton(customEditDialog)
self.UpButton.setIcon(build_icon(u':/services/service_up.png')) self.upButton.setIcon(build_icon(u':/services/service_up.png'))
self.UpButton.setObjectName(u'UpButton') self.upButton.setObjectName(u'upButton')
self.verticalLayout.addWidget(self.UpButton) self.verticalLayout.addWidget(self.upButton)
spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum, spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem) self.verticalLayout.addItem(spacerItem)
self.DownButton = QtGui.QPushButton(customEditDialog) self.downButton = QtGui.QPushButton(customEditDialog)
self.DownButton.setIcon(build_icon(u':/services/service_down.png')) self.downButton.setIcon(build_icon(u':/services/service_down.png'))
self.DownButton.setObjectName(u'DownButton') self.downButton.setObjectName(u'downButton')
self.verticalLayout.addWidget(self.DownButton) self.verticalLayout.addWidget(self.downButton)
self.horizontalLayout_4.addLayout(self.verticalLayout) self.horizontalLayout4.addLayout(self.verticalLayout)
self.gridLayout.addLayout(self.horizontalLayout_4, 1, 0, 1, 1) self.gridLayout.addLayout(self.horizontalLayout4, 1, 0, 1, 1)
self.EditWidget = QtGui.QWidget(customEditDialog) self.editWidget = QtGui.QWidget(customEditDialog)
self.EditWidget.setObjectName(u'EditWidget') self.editWidget.setObjectName(u'editWidget')
self.EditLayout_3 = QtGui.QHBoxLayout(self.EditWidget) self.editLayout3 = QtGui.QHBoxLayout(self.editWidget)
self.EditLayout_3.setSpacing(8) self.editLayout3.setSpacing(8)
self.EditLayout_3.setMargin(0) self.editLayout3.setMargin(0)
self.EditLayout_3.setObjectName(u'EditLayout_3') self.editLayout3.setObjectName(u'editLayout3')
self.VerseTextEdit = QtGui.QTextEdit(self.EditWidget) self.verseTextEdit = QtGui.QTextEdit(self.editWidget)
self.VerseTextEdit.setObjectName(u'VerseTextEdit') self.verseTextEdit.setObjectName(u'verseTextEdit')
self.EditLayout_3.addWidget(self.VerseTextEdit) self.editLayout3.addWidget(self.verseTextEdit)
self.ButtonWidge = QtGui.QWidget(self.EditWidget) self.buttonWidget = QtGui.QWidget(self.editWidget)
self.ButtonWidge.setObjectName(u'ButtonWidge') self.buttonWidget.setObjectName(u'buttonWidget')
self.verticalLayout_2 = QtGui.QVBoxLayout(self.ButtonWidge) self.verticalLayout2 = QtGui.QVBoxLayout(self.buttonWidget)
self.verticalLayout_2.setObjectName(u'verticalLayout_2') self.verticalLayout2.setObjectName(u'verticalLayout2')
self.AddButton = QtGui.QPushButton(self.ButtonWidge) self.addButton = QtGui.QPushButton(self.buttonWidget)
self.AddButton.setObjectName(u'AddButton') self.addButton.setObjectName(u'addButton')
self.verticalLayout_2.addWidget(self.AddButton) self.verticalLayout2.addWidget(self.addButton)
self.EditButton = QtGui.QPushButton(self.ButtonWidge) self.editButton = QtGui.QPushButton(self.buttonWidget)
self.EditButton.setObjectName(u'EditButton') self.editButton.setObjectName(u'editButton')
self.verticalLayout_2.addWidget(self.EditButton) self.verticalLayout2.addWidget(self.editButton)
self.EditAllButton = QtGui.QPushButton(self.ButtonWidge) self.editAllButton = QtGui.QPushButton(self.buttonWidget)
self.EditAllButton.setObjectName(u'EditAllButton') self.editAllButton.setObjectName(u'editAllButton')
self.verticalLayout_2.addWidget(self.EditAllButton) self.verticalLayout2.addWidget(self.editAllButton)
self.SaveButton = QtGui.QPushButton(self.ButtonWidge) self.saveButton = QtGui.QPushButton(self.buttonWidget)
self.SaveButton.setObjectName(u'SaveButton') self.saveButton.setObjectName(u'saveButton')
self.verticalLayout_2.addWidget(self.SaveButton) self.verticalLayout2.addWidget(self.saveButton)
self.DeleteButton = QtGui.QPushButton(self.ButtonWidge) self.deleteButton = QtGui.QPushButton(self.buttonWidget)
self.DeleteButton.setObjectName(u'DeleteButton') self.deleteButton.setObjectName(u'deleteButton')
self.verticalLayout_2.addWidget(self.DeleteButton) self.verticalLayout2.addWidget(self.deleteButton)
self.ClearButton = QtGui.QPushButton(self.ButtonWidge) self.clearButton = QtGui.QPushButton(self.buttonWidget)
self.ClearButton.setObjectName(u'ClearButton') self.clearButton.setObjectName(u'clearButton')
self.verticalLayout_2.addWidget(self.ClearButton) self.verticalLayout2.addWidget(self.clearButton)
self.SplitButton = QtGui.QPushButton(self.ButtonWidge) self.splitButton = QtGui.QPushButton(self.buttonWidget)
self.SplitButton.setObjectName(u'SplitButton') self.splitButton.setObjectName(u'splitButton')
self.verticalLayout_2.addWidget(self.SplitButton) self.verticalLayout2.addWidget(self.splitButton)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem1) self.verticalLayout2.addItem(spacerItem1)
self.EditLayout_3.addWidget(self.ButtonWidge) self.editLayout3.addWidget(self.buttonWidget)
self.gridLayout.addWidget(self.EditWidget, 2, 0, 1, 1) self.gridLayout.addWidget(self.editWidget, 2, 0, 1, 1)
self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName(u'horizontalLayout_3') self.horizontalLayout3.setObjectName(u'horizontalLayout3')
self.ThemeLabel = QtGui.QLabel(customEditDialog) self.themeLabel = QtGui.QLabel(customEditDialog)
self.ThemeLabel.setObjectName(u'ThemeLabel') self.themeLabel.setObjectName(u'themeLabel')
self.horizontalLayout_3.addWidget(self.ThemeLabel) self.horizontalLayout3.addWidget(self.themeLabel)
self.ThemeComboBox = QtGui.QComboBox(customEditDialog) self.themeComboBox = QtGui.QComboBox(customEditDialog)
self.ThemeLabel.setBuddy(self.ThemeComboBox) self.themeLabel.setBuddy(self.themeComboBox)
self.ThemeComboBox.setObjectName(u'ThemeComboBox') self.themeComboBox.setObjectName(u'themeComboBox')
self.horizontalLayout_3.addWidget(self.ThemeComboBox) self.horizontalLayout3.addWidget(self.themeComboBox)
self.gridLayout.addLayout(self.horizontalLayout_3, 3, 0, 1, 1) self.gridLayout.addLayout(self.horizontalLayout3, 3, 0, 1, 1)
self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') self.horizontalLayout2.setObjectName(u'horizontalLayout2')
self.CreditLabel = QtGui.QLabel(customEditDialog) self.creditLabel = QtGui.QLabel(customEditDialog)
self.CreditLabel.setObjectName(u'CreditLabel') self.creditLabel.setObjectName(u'creditLabel')
self.horizontalLayout_2.addWidget(self.CreditLabel) self.horizontalLayout2.addWidget(self.creditLabel)
self.CreditEdit = QtGui.QLineEdit(customEditDialog) self.creditEdit = QtGui.QLineEdit(customEditDialog)
self.CreditLabel.setBuddy(self.CreditEdit) self.creditLabel.setBuddy(self.creditEdit)
self.CreditEdit.setObjectName(u'CreditEdit') self.creditEdit.setObjectName(u'creditEdit')
self.horizontalLayout_2.addWidget(self.CreditEdit) self.horizontalLayout2.addWidget(self.creditEdit)
self.gridLayout.addLayout(self.horizontalLayout_2, 4, 0, 1, 1) self.gridLayout.addLayout(self.horizontalLayout2, 4, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog) self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Save)
@ -140,42 +141,49 @@ class Ui_customEditDialog(object):
def retranslateUi(self, customEditDialog): def retranslateUi(self, customEditDialog):
customEditDialog.setWindowTitle( customEditDialog.setWindowTitle(
translate('CustomPlugin.EditCustomForm', 'Edit Custom Slides')) translate('CustomPlugin.EditCustomForm', 'Edit Custom Slides'))
self.UpButton.setToolTip( self.upButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Move slide Up 1')) translate('CustomPlugin.EditCustomForm', 'Move slide up once '
self.DownButton.setToolTip( 'position.'))
translate('CustomPlugin.EditCustomForm', 'Move slide down 1')) self.downButton.setToolTip(
self.TitleLabel.setText( translate('CustomPlugin.EditCustomForm', 'Move slide down one '
'position.'))
self.titleLabel.setText(
translate('CustomPlugin.EditCustomForm', '&Title:')) translate('CustomPlugin.EditCustomForm', '&Title:'))
self.AddButton.setText( self.addButton.setText(
translate('CustomPlugin.EditCustomForm', 'Add New')) translate('CustomPlugin.EditCustomForm', 'Add New'))
self.AddButton.setToolTip( self.addButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Add new slide at bottom')) translate('CustomPlugin.EditCustomForm', 'Add a new slide at '
self.EditButton.setText( 'bottom.'))
self.editButton.setText(
translate('CustomPlugin.EditCustomForm', 'Edit')) translate('CustomPlugin.EditCustomForm', 'Edit'))
self.EditButton.setToolTip( self.editButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Edit selected slide')) translate('CustomPlugin.EditCustomForm', 'Edit the selected '
self.EditAllButton.setText( 'slide.'))
self.editAllButton.setText(
translate('CustomPlugin.EditCustomForm', 'Edit All')) translate('CustomPlugin.EditCustomForm', 'Edit All'))
self.EditAllButton.setToolTip( self.editAllButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Edit all slides')) translate('CustomPlugin.EditCustomForm', 'Edit all the slides at '
self.SaveButton.setText( 'once.'))
self.saveButton.setText(
translate('CustomPlugin.EditCustomForm', 'Save')) translate('CustomPlugin.EditCustomForm', 'Save'))
self.SaveButton.setToolTip( self.saveButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Replace edited slide')) translate('CustomPlugin.EditCustomForm', 'Save the slide currently '
self.DeleteButton.setText( 'being edited.'))
self.deleteButton.setText(
translate('CustomPlugin.EditCustomForm', 'Delete')) translate('CustomPlugin.EditCustomForm', 'Delete'))
self.DeleteButton.setToolTip( self.deleteButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Delete selected slide')) translate('CustomPlugin.EditCustomForm', 'Delete the selected '
self.ClearButton.setText( 'slide.'))
self.clearButton.setText(
translate('CustomPlugin.EditCustomForm', 'Clear')) translate('CustomPlugin.EditCustomForm', 'Clear'))
self.ClearButton.setToolTip( self.clearButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Clear edit area')) translate('CustomPlugin.EditCustomForm', 'Clear edit area'))
self.SplitButton.setText( self.splitButton.setText(
translate('CustomPlugin.EditCustomForm', 'Split Slide')) translate('CustomPlugin.EditCustomForm', 'Split Slide'))
self.SplitButton.setToolTip( self.splitButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Add slide split')) translate('CustomPlugin.EditCustomForm', 'Split a slide into two '
self.ThemeLabel.setText( 'by inserting a slide splitter.'))
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

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -27,14 +28,14 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from editcustomdialog import Ui_customEditDialog
from openlp.core.lib import Receiver, translate from openlp.core.lib import Receiver, translate
from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser
from openlp.plugins.custom.lib.db import CustomSlide from openlp.plugins.custom.lib.db import CustomSlide
from editcustomdialog import Ui_CustomEditDialog
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
""" """
Class documentation goes here. Class documentation goes here.
""" """
@ -54,28 +55,28 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
self.previewButton, QtGui.QDialogButtonBox.ActionRole) self.previewButton, QtGui.QDialogButtonBox.ActionRole)
QtCore.QObject.connect(self.buttonBox, QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview) QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
QtCore.QObject.connect(self.AddButton, QtCore.QObject.connect(self.addButton,
QtCore.SIGNAL(u'pressed()'), self.onAddButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onAddButtonPressed)
QtCore.QObject.connect(self.EditButton, QtCore.QObject.connect(self.editButton,
QtCore.SIGNAL(u'pressed()'), self.onEditButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onEditButtonPressed)
QtCore.QObject.connect(self.EditAllButton, QtCore.QObject.connect(self.editAllButton,
QtCore.SIGNAL(u'pressed()'), self.onEditAllButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onEditAllButtonPressed)
QtCore.QObject.connect(self.SaveButton, QtCore.QObject.connect(self.saveButton,
QtCore.SIGNAL(u'pressed()'), self.onSaveButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onSaveButtonPressed)
QtCore.QObject.connect(self.DeleteButton, QtCore.QObject.connect(self.deleteButton,
QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonPressed)
QtCore.QObject.connect(self.ClearButton, QtCore.QObject.connect(self.clearButton,
QtCore.SIGNAL(u'pressed()'), self.onClearButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onClearButtonPressed)
QtCore.QObject.connect(self.UpButton, QtCore.QObject.connect(self.upButton,
QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed)
QtCore.QObject.connect(self.DownButton, QtCore.QObject.connect(self.downButton,
QtCore.SIGNAL(u'pressed()'), self.onDownButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onDownButtonPressed)
QtCore.QObject.connect(self.SplitButton, QtCore.QObject.connect(self.splitButton,
QtCore.SIGNAL(u'pressed()'), self.onSplitButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onSplitButtonPressed)
QtCore.QObject.connect(self.VerseListView, QtCore.QObject.connect(self.verseListView,
QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'), QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'),
self.onVerseListViewSelected) self.onVerseListViewSelected)
QtCore.QObject.connect(self.VerseListView, QtCore.QObject.connect(self.verseListView,
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
self.onVerseListViewPressed) self.onVerseListViewPressed)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -92,45 +93,45 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
def initialise(self): def initialise(self):
self.editAll = False self.editAll = False
self.AddButton.setEnabled(True) self.addButton.setEnabled(True)
self.DeleteButton.setEnabled(False) self.deleteButton.setEnabled(False)
self.EditButton.setEnabled(False) self.editButton.setEnabled(False)
self.EditAllButton.setEnabled(True) self.editAllButton.setEnabled(True)
self.SaveButton.setEnabled(False) self.saveButton.setEnabled(False)
self.ClearButton.setEnabled(False) self.clearButton.setEnabled(False)
self.SplitButton.setEnabled(False) self.splitButton.setEnabled(False)
self.TitleEdit.setText(u'') self.titleEdit.setText(u'')
self.CreditEdit.setText(u'') self.creditEdit.setText(u'')
self.VerseTextEdit.clear() self.verseTextEdit.clear()
self.VerseListView.clear() self.verseListView.clear()
#make sure we have a new item #make sure we have a new item
self.customSlide = CustomSlide() self.customSlide = CustomSlide()
self.ThemeComboBox.addItem(u'') self.themeComboBox.addItem(u'')
def loadThemes(self, themelist): def loadThemes(self, themelist):
self.ThemeComboBox.clear() self.themeComboBox.clear()
self.ThemeComboBox.addItem(u'') self.themeComboBox.addItem(u'')
for themename in themelist: for themename in themelist:
self.ThemeComboBox.addItem(themename) self.themeComboBox.addItem(themename)
def loadCustom(self, id, preview=False): def loadCustom(self, id, preview=False):
self.customSlide = CustomSlide() self.customSlide = CustomSlide()
self.initialise() self.initialise()
if id != 0: if id != 0:
self.customSlide = self.custommanager.get_object(CustomSlide, id) self.customSlide = self.custommanager.get_object(CustomSlide, id)
self.TitleEdit.setText(self.customSlide.title) self.titleEdit.setText(self.customSlide.title)
self.CreditEdit.setText(self.customSlide.credits) self.creditEdit.setText(self.customSlide.credits)
customXML = CustomXMLParser(self.customSlide.text) customXML = CustomXMLParser(self.customSlide.text)
verseList = customXML.get_verses() verseList = customXML.get_verses()
for verse in verseList: for verse in verseList:
self.VerseListView.addItem(verse[1]) self.verseListView.addItem(verse[1])
theme = self.customSlide.theme_name theme = self.customSlide.theme_name
id = self.ThemeComboBox.findText(theme, QtCore.Qt.MatchExactly) id = self.themeComboBox.findText(theme, QtCore.Qt.MatchExactly)
if id == -1: if id == -1:
id = 0 # Not Found id = 0 # Not Found
self.ThemeComboBox.setCurrentIndex(id) self.themeComboBox.setCurrentIndex(id)
else: else:
self.ThemeComboBox.setCurrentIndex(0) self.themeComboBox.setCurrentIndex(0)
#if not preview hide the preview button #if not preview hide the preview button
self.previewButton.setVisible(False) self.previewButton.setVisible(False)
if preview: if preview:
@ -150,133 +151,133 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
valid, message = self._validate() valid, message = self._validate()
if not valid: if not valid:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('CustomPlugin.EditCustomForm', 'Error'), message, translate('CustomPlugin.EditCustomForm', 'Error'), message)
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return False return False
sxml = CustomXMLBuilder() sxml = CustomXMLBuilder()
sxml.new_document() sxml.new_document()
sxml.add_lyrics_to_song() sxml.add_lyrics_to_song()
count = 1 count = 1
for i in range (0, self.VerseListView.count()): for i in range(0, self.verseListView.count()):
sxml.add_verse_to_lyrics(u'custom', unicode(count), sxml.add_verse_to_lyrics(u'custom', unicode(count),
unicode(self.VerseListView.item(i).text())) unicode(self.verseListView.item(i).text()))
count += 1 count += 1
self.customSlide.title = unicode(self.TitleEdit.displayText(), u'utf-8') self.customSlide.title = unicode(self.titleEdit.displayText(), u'utf-8')
self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8') self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8')
self.customSlide.credits = unicode(self.CreditEdit.displayText(), self.customSlide.credits = unicode(self.creditEdit.displayText(),
u'utf-8') u'utf-8')
self.customSlide.theme_name = unicode(self.ThemeComboBox.currentText(), self.customSlide.theme_name = unicode(self.themeComboBox.currentText(),
u'utf-8') u'utf-8')
return self.custommanager.save_object(self.customSlide) return self.custommanager.save_object(self.customSlide)
def onUpButtonPressed(self): def onUpButtonPressed(self):
selectedRow = self.VerseListView.currentRow() selectedRow = self.verseListView.currentRow()
if selectedRow != 0: if selectedRow != 0:
qw = self.VerseListView.takeItem(selectedRow) qw = self.verseListView.takeItem(selectedRow)
self.VerseListView.insertItem(selectedRow - 1, qw) self.verseListView.insertItem(selectedRow - 1, qw)
self.VerseListView.setCurrentRow(selectedRow - 1) self.verseListView.setCurrentRow(selectedRow - 1)
def onDownButtonPressed(self): def onDownButtonPressed(self):
selectedRow = self.VerseListView.currentRow() selectedRow = self.verseListView.currentRow()
# zero base arrays # zero base arrays
if selectedRow != self.VerseListView.count() - 1: if selectedRow != self.verseListView.count() - 1:
qw = self.VerseListView.takeItem(selectedRow) qw = self.verseListView.takeItem(selectedRow)
self.VerseListView.insertItem(selectedRow + 1, qw) self.verseListView.insertItem(selectedRow + 1, qw)
self.VerseListView.setCurrentRow(selectedRow + 1) self.verseListView.setCurrentRow(selectedRow + 1)
def onClearButtonPressed(self): def onClearButtonPressed(self):
self.VerseTextEdit.clear() self.verseTextEdit.clear()
self.editAll = False self.editAll = False
self.AddButton.setEnabled(True) self.addButton.setEnabled(True)
self.EditAllButton.setEnabled(True) self.editAllButton.setEnabled(True)
self.SaveButton.setEnabled(False) self.saveButton.setEnabled(False)
def onVerseListViewPressed(self, item): def onVerseListViewPressed(self, item):
self.DeleteButton.setEnabled(True) self.deleteButton.setEnabled(True)
self.EditButton.setEnabled(True) self.editButton.setEnabled(True)
def onVerseListViewSelected(self, item): def onVerseListViewSelected(self, item):
self.editText(item.text()) self.editText(item.text())
def onAddButtonPressed(self): def onAddButtonPressed(self):
self.VerseListView.addItem(self.VerseTextEdit.toPlainText()) self.verseListView.addItem(self.verseTextEdit.toPlainText())
self.DeleteButton.setEnabled(False) self.deleteButton.setEnabled(False)
self.VerseTextEdit.clear() self.verseTextEdit.clear()
def onEditButtonPressed(self): def onEditButtonPressed(self):
self.editText(self.VerseListView.currentItem().text()) self.editText(self.verseListView.currentItem().text())
def onEditAllButtonPressed(self): def onEditAllButtonPressed(self):
self.editAll = True self.editAll = True
self.AddButton.setEnabled(False) self.addButton.setEnabled(False)
self.SplitButton.setEnabled(True) self.splitButton.setEnabled(True)
if self.VerseListView.count() > 0: if self.verseListView.count() > 0:
verse_list = u'' verse_list = u''
for row in range(0, self.VerseListView.count()): for row in range(0, self.verseListView.count()):
item = self.VerseListView.item(row) item = self.verseListView.item(row)
verse_list += item.text() verse_list += item.text()
if row != self.VerseListView.count() - 1: if row != self.verseListView.count() - 1:
verse_list += u'\n[---]\n' verse_list += u'\n[---]\n'
self.editText(verse_list) self.editText(verse_list)
def editText(self, text): def editText(self, text):
self.beforeText = text self.beforeText = text
self.VerseTextEdit.setPlainText(text) self.verseTextEdit.setPlainText(text)
self.DeleteButton.setEnabled(False) self.deleteButton.setEnabled(False)
self.EditButton.setEnabled(False) self.editButton.setEnabled(False)
self.EditAllButton.setEnabled(False) self.editAllButton.setEnabled(False)
self.SaveButton.setEnabled(True) self.saveButton.setEnabled(True)
self.ClearButton.setEnabled(True) self.clearButton.setEnabled(True)
def onSaveButtonPressed(self): def onSaveButtonPressed(self):
if self.editAll: if self.editAll:
self.VerseListView.clear() self.verseListView.clear()
for row in unicode(self.VerseTextEdit.toPlainText()).split( for row in unicode(self.verseTextEdit.toPlainText()).split(
u'\n[---]\n'): u'\n[---]\n'):
self.VerseListView.addItem(row) self.verseListView.addItem(row)
else: else:
self.VerseListView.currentItem().setText( self.verseListView.currentItem().setText(
self.VerseTextEdit.toPlainText()) self.verseTextEdit.toPlainText())
#number of lines has change #number of lines has change
if len(self.beforeText.split(u'\n')) != \ if len(self.beforeText.split(u'\n')) != \
len(self.VerseTextEdit.toPlainText().split(u'\n')): len(self.verseTextEdit.toPlainText().split(u'\n')):
tempList = {} tempList = {}
for row in range(0, self.VerseListView.count()): for row in range(0, self.verseListView.count()):
tempList[row] = self.VerseListView.item(row).text() tempList[row] = self.verseListView.item(row).text()
self.VerseListView.clear() self.verseListView.clear()
for row in range (0, len(tempList)): for row in range (0, len(tempList)):
self.VerseListView.addItem(tempList[row]) self.verseListView.addItem(tempList[row])
self.VerseListView.repaint() self.verseListView.repaint()
self.AddButton.setEnabled(True) self.addButton.setEnabled(True)
self.SaveButton.setEnabled(False) self.saveButton.setEnabled(False)
self.EditButton.setEnabled(False) self.editButton.setEnabled(False)
self.EditAllButton.setEnabled(True) self.editAllButton.setEnabled(True)
self.SplitButton.setEnabled(False) self.splitButton.setEnabled(False)
self.VerseTextEdit.clear() self.verseTextEdit.clear()
def onSplitButtonPressed(self): def onSplitButtonPressed(self):
if self.VerseTextEdit.textCursor().columnNumber() != 0: if self.verseTextEdit.textCursor().columnNumber() != 0:
self.VerseTextEdit.insertPlainText(u'\n') self.verseTextEdit.insertPlainText(u'\n')
self.VerseTextEdit.insertPlainText(u'[---]\n' ) self.verseTextEdit.insertPlainText(u'[---]\n' )
self.VerseTextEdit.setFocus() self.verseTextEdit.setFocus()
def onDeleteButtonPressed(self): def onDeleteButtonPressed(self):
self.VerseListView.takeItem(self.VerseListView.currentRow()) self.verseListView.takeItem(self.verseListView.currentRow())
self.EditButton.setEnabled(False) self.editButton.setEnabled(False)
self.EditAllButton.setEnabled(True) self.editAllButton.setEnabled(True)
def _validate(self): def _validate(self):
if len(self.TitleEdit.displayText()) == 0: if len(self.titleEdit.displayText()) == 0:
self.TitleEdit.setFocus() self.titleEdit.setFocus()
return False, translate('CustomPlugin.EditCustomForm', return False, translate('CustomPlugin.EditCustomForm',
'You need to enter a title') 'You need to type in a title.')
# must have 1 slide # must have 1 slide
if self.VerseListView.count() == 0: if self.verseListView.count() == 0:
self.VerseTextEdit.setFocus() self.verseTextEdit.setFocus()
return False, translate('CustomPlugin.EditCustomForm', return False, translate('CustomPlugin.EditCustomForm',
'You need to enter a slide') 'You need to add at least one slide')
if self.VerseTextEdit.toPlainText(): if self.verseTextEdit.toPlainText():
self.VerseTextEdit.setFocus() self.verseTextEdit.setFocus()
return False, translate('CustomPlugin.editCustomForm', return False, translate('CustomPlugin.EditCustomForm',
'You have unsaved data, please save or clear') 'You have one or more unsaved slides, please either save your '
'slide(s) or clear your changes.')
return True, u'' return True, u''

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -37,28 +38,30 @@ class CustomTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'CustomTab') self.setObjectName(u'CustomTab')
self.tabTitleVisible = translate('CustomPlugin.CustomTab', 'Custom') self.tabTitleVisible = translate('CustomPlugin.CustomTab', 'Custom')
self.CustomLayout = QtGui.QFormLayout(self) self.customLayout = QtGui.QFormLayout(self)
self.CustomLayout.setObjectName(u'CustomLayout') self.customLayout.setSpacing(8)
self.CustomModeGroupBox = QtGui.QGroupBox(self) self.customLayout.setMargin(8)
self.CustomModeGroupBox.setObjectName(u'CustomModeGroupBox') self.customLayout.setObjectName(u'customLayout')
self.CustomModeLayout = QtGui.QVBoxLayout(self.CustomModeGroupBox) self.customModeGroupBox = QtGui.QGroupBox(self)
self.CustomModeLayout.setSpacing(8) self.customModeGroupBox.setObjectName(u'customModeGroupBox')
self.CustomModeLayout.setMargin(8) self.customModeLayout = QtGui.QVBoxLayout(self.customModeGroupBox)
self.CustomModeLayout.setObjectName(u'CustomModeLayout') self.customModeLayout.setSpacing(8)
self.DisplayFooterCheckBox = QtGui.QCheckBox(self.CustomModeGroupBox) self.customModeLayout.setMargin(8)
self.DisplayFooterCheckBox.setObjectName(u'DisplayFooterCheckBox') self.customModeLayout.setObjectName(u'customModeLayout')
self.CustomModeLayout.addWidget(self.DisplayFooterCheckBox) self.displayFooterCheckBox = QtGui.QCheckBox(self.customModeGroupBox)
self.CustomLayout.setWidget( self.displayFooterCheckBox.setObjectName(u'displayFooterCheckBox')
0, QtGui.QFormLayout.LabelRole, self.CustomModeGroupBox) self.customModeLayout.addWidget(self.displayFooterCheckBox)
QtCore.QObject.connect(self.DisplayFooterCheckBox, self.customLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.customModeGroupBox)
QtCore.QObject.connect(self.displayFooterCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onDisplayFooterCheckBoxChanged) self.onDisplayFooterCheckBoxChanged)
def retranslateUi(self): def retranslateUi(self):
self.CustomModeGroupBox.setTitle(translate('CustomPlugin.CustomTab', self.customModeGroupBox.setTitle(translate('CustomPlugin.CustomTab',
'Custom Display')) 'Custom Display'))
self.DisplayFooterCheckBox.setText( self.displayFooterCheckBox.setText(
translate('CustomPlugin.CustomTab', 'Display Footer')) translate('CustomPlugin.CustomTab', 'Display footer'))
def onDisplayFooterCheckBoxChanged(self, check_state): def onDisplayFooterCheckBoxChanged(self, check_state):
self.displayFooter = False self.displayFooter = False
@ -70,7 +73,7 @@ class CustomTab(SettingsTab):
self.displayFooter = QtCore.QSettings().value( self.displayFooter = QtCore.QSettings().value(
self.settingsSection + u'/display footer', self.settingsSection + u'/display footer',
QtCore.QVariant(True)).toBool() QtCore.QVariant(True)).toBool()
self.DisplayFooterCheckBox.setChecked(self.displayFooter) self.displayFooterCheckBox.setChecked(self.displayFooter)
def save(self): def save(self):
QtCore.QSettings().setValue(self.settingsSection + u'/display footer', QtCore.QSettings().setValue(self.settingsSection + u'/display footer',

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -73,7 +74,7 @@ class CustomMediaItem(MediaManagerItem):
def initialise(self): def initialise(self):
self.loadCustomListView(self.parent.custommanager.get_all_objects( self.loadCustomListView(self.parent.custommanager.get_all_objects(
CustomSlide, CustomSlide.title)) CustomSlide, order_by_ref=CustomSlide.title))
#Called to redisplay the song list screen edith from a search #Called to redisplay the song list screen edith from a search
#or from the exit of the Song edit dialog. If remote editing is active #or from the exit of the Song edit dialog. If remote editing is active
#Trigger it and clean up so it will not update again. #Trigger it and clean up so it will not update again.
@ -121,7 +122,7 @@ class CustomMediaItem(MediaManagerItem):
""" """
if check_item_selected(self.listView, if check_item_selected(self.listView,
translate('CustomPlugin.MediaItem', translate('CustomPlugin.MediaItem',
'You must select an item to edit.')): 'You haven\'t selected an item to edit.')):
item = self.listView.currentItem() item = self.listView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.edit_custom_form.loadCustom(item_id, False) self.parent.edit_custom_form.loadCustom(item_id, False)
@ -134,7 +135,7 @@ class CustomMediaItem(MediaManagerItem):
""" """
if check_item_selected(self.listView, if check_item_selected(self.listView,
translate('CustomPlugin.MediaItem', translate('CustomPlugin.MediaItem',
'You must select an item to delete.')): 'You haven\'t selected an item to delete.')):
row_list = [item.row() for item in self.listView.selectedIndexes()] row_list = [item.row() for item in self.listView.selectedIndexes()]
row_list.sort(reverse=True) row_list.sort(reverse=True)
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0] id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -25,8 +26,8 @@
import logging import logging
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate from openlp.core.lib import Plugin, build_icon, translate
from openlp.plugins.images.lib import ImageMediaItem, ImageTab from openlp.plugins.images.lib import ImageMediaItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -38,22 +39,21 @@ class ImagePlugin(Plugin):
self.weight = -7 self.weight = -7
self.icon_path = u':/plugins/plugin_images.png' self.icon_path = u':/plugins/plugin_images.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
self.status = PluginStatus.Active
def getSettingsTab(self):
return ImageTab(self.name)
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the MediaManagerItem object # Create the MediaManagerItem object
return ImageMediaItem(self, self.icon, self.name) return ImageMediaItem(self, self.icon, self.name)
def about(self): def about(self):
about_text = translate('ImagePlugin', '<b>Image Plugin' about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
'</b><br>Allows images of all types to be displayed. If a number ' '<br />The image plugin provides displaying of images.<br />One '
'of images are selected together and presented on the live ' 'of the distinguishing features of this plugin is the ability to '
'controller it is possible to turn them into a timed loop.<br<br>' 'group a number of images together in the service manager, making '
'From the plugin if the <i>Override background</i> is chosen and ' 'the displaying of multiple images easier. This plugin can also '
'an image is selected any songs which are rendered will use the ' 'make use of OpenLP\'s "timed looping" feature to create a slide '
'selected image from the background instead of the one provied by ' 'show that runs automatically. In addition to this, images from '
'the theme.<br>') 'the plugin can be used to override the current theme\'s '
return about_text 'background, which renders text-based items like songs with the '
'selected image as a background instead of the background '
'provided by the theme.')
return about_text

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -24,4 +25,3 @@
############################################################################### ###############################################################################
from mediaitem import ImageMediaItem from mediaitem import ImageMediaItem
from imagetab import ImageTab

View File

@ -1,90 +0,0 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, Receiver, translate
class ImageTab(SettingsTab):
"""
ImageTab is the Image settings tab in the settings dialog.
"""
def __init__(self, title):
SettingsTab.__init__(self, title)
def setupUi(self):
self.setObjectName(u'ImageTab')
self.tabTitleVisible = translate('ImagePlugin.ImageTab', 'Images')
self.ImageLayout = QtGui.QFormLayout(self)
self.ImageLayout.setObjectName(u'ImageLayout')
self.ImageSettingsGroupBox = QtGui.QGroupBox(self)
self.ImageSettingsGroupBox.setObjectName(u'ImageSettingsGroupBox')
self.TimeoutLayout = QtGui.QHBoxLayout(self.ImageSettingsGroupBox)
self.TimeoutLayout.setSpacing(8)
self.TimeoutLayout.setMargin(8)
self.TimeoutLayout.setObjectName(u'TimeoutLayout')
self.TimeoutLabel = QtGui.QLabel(self.ImageSettingsGroupBox)
self.TimeoutLabel.setObjectName(u'TimeoutLabel')
self.TimeoutLayout.addWidget(self.TimeoutLabel)
self.TimeoutSpinBox = QtGui.QSpinBox(self.ImageSettingsGroupBox)
self.TimeoutSpinBox.setMinimum(1)
self.TimeoutSpinBox.setMaximum(180)
self.TimeoutSpinBox.setObjectName(u'TimeoutSpinBox')
self.TimeoutLayout.addWidget(self.TimeoutSpinBox)
self.TimeoutSpacer = QtGui.QSpacerItem(147, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.TimeoutLayout.addItem(self.TimeoutSpacer)
self.ImageLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.ImageSettingsGroupBox)
# Signals and slots
QtCore.QObject.connect(self.TimeoutSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)
def retranslateUi(self):
self.ImageSettingsGroupBox.setTitle(
translate('ImagePlugin.ImageTab', 'Image Settings'))
self.TimeoutLabel.setText(
translate('ImagePlugin.ImageTab', 'Slide Loop Delay:'))
self.TimeoutSpinBox.setSuffix(
translate('ImagePlugin.ImageTab', 'sec'))
def onTimeoutSpinBoxChanged(self):
self.loop_delay = self.TimeoutSpinBox.value()
def load(self):
self.loop_delay = QtCore.QSettings().value(
self.settingsSection + u'/loop delay',
QtCore.QVariant(5)).toInt()[0]
self.TimeoutSpinBox.setValue(self.loop_delay)
def save(self):
QtCore.QSettings().setValue(self.settingsSection + u'/loop delay',
QtCore.QVariant(self.loop_delay))
Receiver.send_message(u'slidecontroller_live_spin_delay',
self.loop_delay)
def postSetUp(self):
Receiver.send_message(u'slidecontroller_live_spin_delay',
self.loop_delay)

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -105,9 +106,10 @@ class ImageMediaItem(MediaManagerItem):
self.ImageWidget.setSizePolicy(sizePolicy) self.ImageWidget.setSizePolicy(sizePolicy)
self.ImageWidget.setObjectName(u'ImageWidget') self.ImageWidget.setObjectName(u'ImageWidget')
self.blankButton = self.toolbar.addToolbarButton( self.blankButton = self.toolbar.addToolbarButton(
u'Replace Background', u':/slides/slide_blank.png', translate('ImagePlugin.MediaItem', 'Replace Background'),
u':/slides/slide_blank.png',
translate('ImagePlugin.MediaItem', 'Replace Live Background'), translate('ImagePlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick, False) self.onReplaceClick, 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)
@ -116,7 +118,7 @@ class ImageMediaItem(MediaManagerItem):
Remove an image item from the list Remove an image item from the list
""" """
if check_item_selected(self.listView, translate('ImagePlugin.MediaItem', if check_item_selected(self.listView, translate('ImagePlugin.MediaItem',
'You must select an item to delete.')): 'You must select an image to delete.')):
row_list = [item.row() for item in self.listView.selectedIndexes()] row_list = [item.row() for item in self.listView.selectedIndexes()]
row_list.sort(reverse=True) row_list.sort(reverse=True)
for row in row_list: for row in row_list:
@ -170,7 +172,7 @@ class ImageMediaItem(MediaManagerItem):
def onReplaceClick(self): def onReplaceClick(self):
if check_item_selected(self.listView, if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem', translate('ImagePlugin.MediaItem',
'You must select an item to process.')): 'You must select an image to replace the background with.')):
items = self.listView.selectedIndexes() items = self.listView.selectedIndexes()
for item in items: for item in items:
bitem = self.listView.item(item.row()) bitem = self.listView.item(item.row())

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -92,17 +93,17 @@ class MediaMediaItem(MediaManagerItem):
self.ImageWidget.setObjectName(u'ImageWidget') self.ImageWidget.setObjectName(u'ImageWidget')
#Replace backgrounds do not work at present so remove functionality. #Replace backgrounds do not work at present so remove functionality.
self.blankButton = self.toolbar.addToolbarButton( self.blankButton = self.toolbar.addToolbarButton(
u'Replace Background', u':/slides/slide_blank.png', translate('MediaPlugin.MediaItem', 'Replace Background'),
u':/slides/slide_blank.png',
translate('MediaPlugin.MediaItem', 'Replace Live Background'), translate('MediaPlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick, False) self.onReplaceClick, 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)
def onReplaceClick(self): def onReplaceClick(self):
if check_item_selected(self.listView, if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem', translate('ImagePlugin.MediaItem',
'You must select an item to process.')): 'You must select a media file to replace the background with.')):
item = self.listView.currentItem() item = self.listView.currentItem()
filename = unicode(item.data(QtCore.Qt.UserRole).toString()) filename = unicode(item.data(QtCore.Qt.UserRole).toString())
self.parent.displayManager.displayVideo(filename) self.parent.displayManager.displayVideo(filename)
@ -133,7 +134,7 @@ class MediaMediaItem(MediaManagerItem):
Remove a media item from the list Remove a media item from the list
""" """
if check_item_selected(self.listView, translate('MediaPlugin.MediaItem', if check_item_selected(self.listView, translate('MediaPlugin.MediaItem',
'You must select an item to delete.')): 'You must select a media file to delete.')):
row_list = [item.row() for item in self.listView.selectedIndexes()] row_list = [item.row() for item in self.listView.selectedIndexes()]
row_list.sort(reverse=True) row_list.sort(reverse=True)
for row in row_list: for row in row_list:

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -27,7 +28,7 @@ import logging
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate from openlp.core.lib import Plugin, build_icon, translate
from openlp.plugins.media.lib import MediaMediaItem from openlp.plugins.media.lib import MediaMediaItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -42,7 +43,6 @@ class MediaPlugin(Plugin):
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
# passed with drag and drop messages # passed with drag and drop messages
self.dnd_id = u'Media' self.dnd_id = u'Media'
self.status = PluginStatus.Active
self.audio_list = u'' self.audio_list = u''
self.video_list = u'' self.video_list = u''
for mimetype in Phonon.BackendCapabilities.availableMimeTypes(): for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
@ -73,7 +73,6 @@ class MediaPlugin(Plugin):
return MediaMediaItem(self, self.icon, self.name) return MediaMediaItem(self, self.icon, self.name)
def about(self): def about(self):
about_text = translate('MediaPlugin', about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
'<b>Media Plugin</b><br>This plugin ' '<br />The media plugin provides playback of audio and video.')
'allows the playing of audio and video media')
return about_text return about_text

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -68,8 +69,8 @@ class ImpressController(PresentationController):
""" """
log.debug(u'Initialising') log.debug(u'Initialising')
PresentationController.__init__(self, plugin, u'Impress') PresentationController.__init__(self, plugin, u'Impress')
self.supports = [u'.odp'] self.supports = [u'odp']
self.alsosupports = [u'.ppt', u'.pps', u'.pptx', u'.ppsx'] self.alsosupports = [u'ppt', u'pps', u'pptx', u'ppsx']
self.process = None self.process = None
self.desktop = None self.desktop = None
self.manager = None self.manager = None
@ -463,4 +464,3 @@ class ImpressDocument(PresentationDocument):
if shape.supportsService("com.sun.star.drawing.Text"): if shape.supportsService("com.sun.star.drawing.Text"):
text += shape.getString() + '\n' text += shape.getString() + '\n'
return text return text

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -29,7 +30,7 @@ import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
SettingsManager, translate, check_item_selected SettingsManager, translate, check_item_selected, Receiver
from openlp.plugins.presentations.lib import MessageListener from openlp.plugins.presentations.lib import MessageListener
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -67,7 +68,9 @@ class PresentationMediaItem(MediaManagerItem):
self.ListViewWithDnD_class = PresentationListView self.ListViewWithDnD_class = PresentationListView
MediaManagerItem.__init__(self, parent, icon, title) MediaManagerItem.__init__(self, parent, icon, title)
self.message_listener = MessageListener(self) self.message_listener = MessageListener(self)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'mediaitem_presentation_rebuild'), self.rebuild)
def retranslateUi(self): def retranslateUi(self):
""" """
The name of the plugin media displayed in UI The name of the plugin media displayed in UI
@ -76,14 +79,19 @@ class PresentationMediaItem(MediaManagerItem):
'Select Presentation(s)') 'Select Presentation(s)')
self.Automatic = translate('PresentationPlugin.MediaItem', self.Automatic = translate('PresentationPlugin.MediaItem',
'Automatic') 'Automatic')
def buildFileMaskString(self):
"""
Build the list of file extensions to be used in the Open file dialog
"""
fileType = u'' fileType = u''
for controller in self.controllers: for controller in self.controllers:
if self.controllers[controller].enabled: if self.controllers[controller].enabled():
types = self.controllers[controller].supports + \ types = self.controllers[controller].supports + \
self.controllers[controller].alsosupports self.controllers[controller].alsosupports
for type in types: for type in types:
if fileType.find(type) == -1: if fileType.find(type) == -1:
fileType += u'*%s ' % type fileType += u'*.%s ' % type
self.parent.serviceManager.supportedSuffixes(type) self.parent.serviceManager.supportedSuffixes(type)
self.OnNewFileMasks = translate('PresentationPlugin.MediaItem', self.OnNewFileMasks = translate('PresentationPlugin.MediaItem',
'Presentations (%s)' % fileType) 'Presentations (%s)' % fileType)
@ -131,13 +139,34 @@ class PresentationMediaItem(MediaManagerItem):
list = SettingsManager.load_list( list = SettingsManager.load_list(
self.settingsSection, u'presentations') self.settingsSection, u'presentations')
self.loadList(list, True) self.loadList(list, True)
self.populateDisplayTypes()
def rebuild(self):
"""
Rebuild the tab in the media manager when changes are made in
the settings
"""
self.populateDisplayTypes()
self.buildFileMaskString()
def populateDisplayTypes(self):
"""
Load the combobox with the enabled presentation controllers,
allowing user to select a specific app if settings allow
"""
self.DisplayTypeComboBox.clear()
for item in self.controllers: for item in self.controllers:
#load the drop down selection #load the drop down selection
if self.controllers[item].enabled: if self.controllers[item].enabled():
self.DisplayTypeComboBox.addItem(item) self.DisplayTypeComboBox.addItem(item)
if self.DisplayTypeComboBox.count() > 1: if self.DisplayTypeComboBox.count() > 1:
self.DisplayTypeComboBox.insertItem(0, self.Automatic) self.DisplayTypeComboBox.insertItem(0, self.Automatic)
self.DisplayTypeComboBox.setCurrentIndex(0) self.DisplayTypeComboBox.setCurrentIndex(0)
if QtCore.QSettings().value(self.settingsSection + u'/override app',
QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
self.PresentationWidget.show()
else:
self.PresentationWidget.hide()
def loadList(self, list, initialLoad=False): def loadList(self, list, initialLoad=False):
""" """
@ -155,12 +184,11 @@ class PresentationMediaItem(MediaManagerItem):
filename = os.path.split(unicode(file))[1] filename = os.path.split(unicode(file))[1]
if titles.count(filename) > 0: if titles.count(filename) > 0:
if not initialLoad: if not initialLoad:
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(self,
self, translate('PresentationPlugin.MediaItem',
'File exists'),
translate('PresentationPlugin.MediaItem', translate('PresentationPlugin.MediaItem',
'A presentation with that filename already exists.'), 'File Exists'),
QtGui.QMessageBox.Ok) translate('PresentationPlugin.MediaItem',
'A presentation with that filename already exists.'))
continue continue
controller_name = self.findControllerByType(filename) controller_name = self.findControllerByType(filename)
if controller_name: if controller_name:
@ -182,10 +210,9 @@ class PresentationMediaItem(MediaManagerItem):
else: else:
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('PresentationPlugin.MediaItem', self, translate('PresentationPlugin.MediaItem',
'Unsupported file'), 'Unsupported File'),
translate('PresentationPlugin.MediaItem', translate('PresentationPlugin.MediaItem',
'This type of presentation is not supported'), 'This type of presentation is not supported'))
QtGui.QMessageBox.Ok)
continue continue
item_name = QtGui.QListWidgetItem(filename) item_name = QtGui.QListWidgetItem(filename)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
@ -258,15 +285,15 @@ class PresentationMediaItem(MediaManagerItem):
"supports" the extension. If none found, then look for a controller "supports" the extension. If none found, then look for a controller
which "alsosupports" it instead. which "alsosupports" it instead.
""" """
filetype = os.path.splitext(filename)[1] filetype = filename.split(u'.')[1]
if not filetype: if not filetype:
return None return None
for controller in self.controllers: for controller in self.controllers:
if self.controllers[controller].enabled: if self.controllers[controller].enabled():
if filetype in self.controllers[controller].supports: if filetype in self.controllers[controller].supports:
return controller return controller
for controller in self.controllers: for controller in self.controllers:
if self.controllers[controller].enabled: if self.controllers[controller].enabled():
if filetype in self.controllers[controller].alsosupports: if filetype in self.controllers[controller].alsosupports:
return controller return controller
return None return None

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -53,7 +54,7 @@ class PowerpointController(PresentationController):
""" """
log.debug(u'Initialising') log.debug(u'Initialising')
PresentationController.__init__(self, plugin, u'Powerpoint') PresentationController.__init__(self, plugin, u'Powerpoint')
self.supports = [u'.ppt', u'.pps', u'.pptx', u'.ppsx'] self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
self.process = None self.process = None
def check_available(self): def check_available(self):

View File

@ -6,8 +6,9 @@
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Thompson, Jon Tibble, Carsten Tinggaard # # 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 # # 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 # # under the terms of the GNU General Public License as published by the Free #
@ -49,7 +50,7 @@ class PptviewController(PresentationController):
log.debug(u'Initialising') log.debug(u'Initialising')
self.process = None self.process = None
PresentationController.__init__(self, plugin, u'Powerpoint Viewer') PresentationController.__init__(self, plugin, u'Powerpoint Viewer')
self.supports = [u'.ppt', u'.pps', u'.pptx', u'.ppsx'] self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
def check_available(self): def check_available(self):
""" """
@ -149,7 +150,8 @@ class PptviewDocument(PresentationDocument):
if self.check_thumbnails(): if self.check_thumbnails():
return return
for idx in range(self.get_slide_count()): for idx in range(self.get_slide_count()):
path = u'%s\\slide%s.bmp' % (self.get_temp_folder(), unicode(idx + 1)) path = u'%s\\slide%s.bmp' % (self.get_temp_folder(),
unicode(idx + 1))
self.convert_thumbnail(path, idx + 1) self.convert_thumbnail(path, idx + 1)
def close_presentation(self): def close_presentation(self):
@ -246,4 +248,3 @@ class PptviewDocument(PresentationDocument):
Triggers the previous slide on the running presentation Triggers the previous slide on the running presentation
""" """
self.controller.process.PrevStep(self.pptid) self.controller.process.PrevStep(self.pptid)

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