This commit is contained in:
Erik Lundin 2012-12-22 17:41:41 +01:00
commit 9366872c37
237 changed files with 2180 additions and 73453 deletions

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -113,33 +113,25 @@ class OpenLP(QtGui.QApplication):
args.remove('OpenLP') args.remove('OpenLP')
self.args.extend(args) self.args.extend(args)
# provide a listener for widgets to reqest a screen update. # provide a listener for widgets to reqest a screen update.
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_process_events'), self.processEvents)
QtCore.SIGNAL(u'openlp_process_events'), self.processEvents) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cursor_busy'), self.setBusyCursor)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cursor_normal'), self.setNormalCursor)
QtCore.SIGNAL(u'cursor_busy'), self.setBusyCursor)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'cursor_normal'), self.setNormalCursor)
# Decide how many screens we have and their size # Decide how many screens we have and their size
screens = ScreenList.create(self.desktop()) screens = ScreenList.create(self.desktop())
# First time checks in settings # First time checks in settings
has_run_wizard = Settings().value( has_run_wizard = Settings().value(u'general/has run wizard', QtCore.QVariant(False)).toBool()
u'general/has run wizard', QtCore.QVariant(False)).toBool()
if not has_run_wizard: if not has_run_wizard:
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted: if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
Settings().setValue(u'general/has run wizard', Settings().setValue(u'general/has run wizard', QtCore.QVariant(True))
QtCore.QVariant(True))
# Correct stylesheet bugs # Correct stylesheet bugs
if os.name == u'nt': if os.name == u'nt':
base_color = self.palette().color(QtGui.QPalette.Active, base_color = self.palette().color(QtGui.QPalette.Active, QtGui.QPalette.Base)
QtGui.QPalette.Base)
application_stylesheet = \ application_stylesheet = \
u'* {alternate-background-color: ' + \ u'QTableWidget, QListWidget, QTreeWidget {alternate-background-color: ' + base_color.name() + ';}\n'
base_color.name() + ';}\n'
application_stylesheet += nt_repair_stylesheet application_stylesheet += nt_repair_stylesheet
self.setStyleSheet(application_stylesheet) self.setStyleSheet(application_stylesheet)
# show the splashscreen # show the splashscreen
show_splash = Settings().value( show_splash = Settings().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.splash = SplashScreen()
self.splash.show() self.splash.show()
@ -158,8 +150,7 @@ class OpenLP(QtGui.QApplication):
self.processEvents() self.processEvents()
if not has_run_wizard: if not has_run_wizard:
self.mainWindow.firstTime() self.mainWindow.firstTime()
update_check = Settings().value( update_check = Settings().value(u'general/update check', QtCore.QVariant(True)).toBool()
u'general/update check', QtCore.QVariant(True)).toBool()
if update_check: if update_check:
VersionThread(self.mainWindow).start() VersionThread(self.mainWindow).start()
Receiver.send_message(u'live_display_blank_check') Receiver.send_message(u'live_display_blank_check')
@ -175,10 +166,8 @@ class OpenLP(QtGui.QApplication):
""" """
self.sharedMemory = QtCore.QSharedMemory('OpenLP') self.sharedMemory = QtCore.QSharedMemory('OpenLP')
if self.sharedMemory.attach(): if self.sharedMemory.attach():
status = QtGui.QMessageBox.critical(None, status = QtGui.QMessageBox.critical(None, UiStrings().Error, UiStrings().OpenLPStart,
UiStrings().Error, UiStrings().OpenLPStart, QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
if status == QtGui.QMessageBox.No: if status == QtGui.QMessageBox.No:
return True return True
return False return False
@ -192,8 +181,7 @@ class OpenLP(QtGui.QApplication):
return return
if not hasattr(self, u'exceptionForm'): if not hasattr(self, u'exceptionForm'):
self.exceptionForm = ExceptionForm(self.mainWindow) self.exceptionForm = ExceptionForm(self.mainWindow)
self.exceptionForm.exceptionTextEdit.setPlainText( self.exceptionForm.exceptionTextEdit.setPlainText(''.join(format_exception(exctype, value, traceback)))
''.join(format_exception(exctype, value, traceback)))
self.setNormalCursor() self.setNormalCursor()
self.exceptionForm.exec_() self.exceptionForm.exec_()
@ -230,8 +218,7 @@ def set_up_logging(log_path):
check_directory_exists(log_path) check_directory_exists(log_path)
filename = os.path.join(log_path, u'openlp.log') filename = os.path.join(log_path, u'openlp.log')
logfile = logging.FileHandler(filename, u'w') logfile = logging.FileHandler(filename, u'w')
logfile.setFormatter(logging.Formatter( logfile.setFormatter(logging.Formatter(u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
log.addHandler(logfile) log.addHandler(logfile)
if log.isEnabledFor(logging.DEBUG): if log.isEnabledFor(logging.DEBUG):
print 'Logging to:', filename print 'Logging to:', filename
@ -245,28 +232,22 @@ def main(args=None):
# Set up command line options. # Set up command line options.
usage = 'Usage: %prog [options] [qt-options]' usage = 'Usage: %prog [options] [qt-options]'
parser = OptionParser(usage=usage) parser = OptionParser(usage=usage)
parser.add_option('-e', '--no-error-form', dest='no_error_form', parser.add_option('-e', '--no-error-form', dest='no_error_form', action='store_true',
action='store_true', help='Disable the error notification form.') help='Disable the error notification form.')
parser.add_option('-l', '--log-level', dest='loglevel', parser.add_option('-l', '--log-level', dest='loglevel', default='warning', metavar='LEVEL',
default='warning', metavar='LEVEL', help='Set logging to LEVEL ' help='Set logging to LEVEL level. Valid values are "debug", "info", "warning".')
'level. Valid values are "debug", "info", "warning".') parser.add_option('-p', '--portable', dest='portable', action='store_true',
parser.add_option('-p', '--portable', dest='portable', help='Specify if this should be run as a portable app, off a USB flash drive (not implemented).')
action='store_true', help='Specify if this should be run as a ' parser.add_option('-d', '--dev-version', dest='dev_version', action='store_true',
'portable app, off a USB flash drive (not implemented).') help='Ignore the version file and pull the version directly from Bazaar')
parser.add_option('-d', '--dev-version', dest='dev_version', parser.add_option('-s', '--style', dest='style', help='Set the Qt4 style (passed directly to Qt4).')
action='store_true', help='Ignore the version file and pull the ' parser.add_option('--testing', dest='testing', action='store_true', help='Run by testing framework')
'version directly from Bazaar')
parser.add_option('-s', '--style', dest='style',
help='Set the Qt4 style (passed directly to Qt4).')
parser.add_option('--testing', dest='testing',
action='store_true', help='Run by testing framework')
# Parse command line options and deal with them. # Parse command line options and deal with them.
# Use args supplied programatically if possible. # Use args supplied programatically if possible.
(options, args) = parser.parse_args(args) if args else parser.parse_args() (options, args) = parser.parse_args(args) if args else parser.parse_args()
if options.portable: if options.portable:
app_path = AppLocation.get_directory(AppLocation.AppDir) app_path = AppLocation.get_directory(AppLocation.AppDir)
set_up_logging(os.path.abspath(os.path.join(app_path, u'..', set_up_logging(os.path.abspath(os.path.join(app_path, u'..', u'..', u'Other')))
u'..', u'Other')))
log.info(u'Running portable') log.info(u'Running portable')
else: else:
set_up_logging(AppLocation.get_directory(AppLocation.CacheDir)) set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
@ -294,8 +275,7 @@ def main(args=None):
app.setApplicationName(u'OpenLPPortable') app.setApplicationName(u'OpenLPPortable')
Settings.setDefaultFormat(Settings.IniFormat) Settings.setDefaultFormat(Settings.IniFormat)
# Get location OpenLPPortable.ini # Get location OpenLPPortable.ini
portable_settings_file = os.path.abspath(os.path.join(app_path, u'..', portable_settings_file = os.path.abspath(os.path.join(app_path, u'..', u'..', u'Data', u'OpenLP.ini'))
u'..', u'Data', u'OpenLP.ini'))
# Make this our settings file # Make this our settings file
log.info(u'INI file: %s', portable_settings_file) log.info(u'INI file: %s', portable_settings_file)
Settings.setFilename(portable_settings_file) Settings.setFilename(portable_settings_file)
@ -324,8 +304,7 @@ def main(args=None):
sys.exit() sys.exit()
# i18n Set Language # i18n Set Language
language = LanguageManager.get_language() language = LanguageManager.get_language()
app_translator, default_translator = \ app_translator, default_translator = LanguageManager.get_translator(language)
LanguageManager.get_translator(language)
if not app_translator.isEmpty(): if not app_translator.isEmpty():
app.installTranslator(app_translator) app.installTranslator(app_translator)
if not default_translator.isEmpty(): if not default_translator.isEmpty():
@ -337,7 +316,7 @@ def main(args=None):
# Do not run method app.exec_() when running gui tests # Do not run method app.exec_() when running gui tests
if options.testing: if options.testing:
app.run(qt_args, testing=True) app.run(qt_args, testing=True)
# For gui tests we need access to window intances and their components # For gui tests we need access to window instances and their components
return app return app
else: else:
sys.exit(app.run(qt_args)) sys.exit(app.run(qt_args))

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 +37,14 @@ from PyQt4 import QtCore, QtGui, Qt
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class ServiceItemContext(object):
"""
The context in which a Service Item is being generated
"""
Preview = 0
Live = 1
Service = 2
class ImageSource(object): class ImageSource(object):
""" """
@ -395,4 +403,4 @@ from dockwidget import OpenLPDockWidget
from imagemanager import ImageManager from imagemanager import ImageManager
from renderer import Renderer from renderer import Renderer
from mediamanageritem import MediaManagerItem from mediamanageritem import MediaManagerItem
from openlp.core.utils.actions import ActionList

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -36,7 +36,8 @@ import re
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \ from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \
StringContent, build_icon, translate, Receiver, ListWidgetWithDnD StringContent, build_icon, translate, Receiver, ListWidgetWithDnD, \
ServiceItemContext
from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.searchedit import SearchEdit
from openlp.core.lib.ui import UiStrings, create_widget_action, \ from openlp.core.lib.ui import UiStrings, create_widget_action, \
critical_error_message_box critical_error_message_box
@ -459,7 +460,7 @@ class MediaManagerItem(QtGui.QWidget):
pass pass
def generateSlideData(self, serviceItem, item=None, xmlVersion=False, def generateSlideData(self, serviceItem, item=None, xmlVersion=False,
remote=False): remote=False, context=ServiceItemContext.Live):
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs ' raise NotImplementedError(u'MediaManagerItem.generateSlideData needs '
u'to be defined by the plugin') u'to be defined by the plugin')
@ -521,6 +522,8 @@ class MediaManagerItem(QtGui.QWidget):
if serviceItem: if serviceItem:
if not item_id: if not item_id:
serviceItem.from_plugin = True serviceItem.from_plugin = True
if remote:
serviceItem.will_auto_start = True
self.plugin.liveController.addServiceItem(serviceItem) self.plugin.liveController.addServiceItem(serviceItem)
def createItemFromId(self, item_id): def createItemFromId(self, item_id):
@ -548,7 +551,8 @@ class MediaManagerItem(QtGui.QWidget):
self.addToService(item) self.addToService(item)
def addToService(self, item=None, replace=None, remote=False): def addToService(self, item=None, replace=None, remote=False):
serviceItem = self.buildServiceItem(item, True, remote=remote) serviceItem = self.buildServiceItem(item, True, remote=remote,
context=ServiceItemContext.Service)
if serviceItem: if serviceItem:
serviceItem.from_plugin = False serviceItem.from_plugin = False
self.plugin.serviceManager.addServiceItem(serviceItem, self.plugin.serviceManager.addServiceItem(serviceItem,
@ -581,13 +585,15 @@ class MediaManagerItem(QtGui.QWidget):
unicode(translate('OpenLP.MediaManagerItem', 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, xmlVersion=False, remote=False): def buildServiceItem(self, item=None, xmlVersion=False, remote=False,
context=ServiceItemContext.Live):
""" """
Common method for generating a service item Common method for generating a service item
""" """
serviceItem = ServiceItem(self.plugin) serviceItem = ServiceItem(self.plugin)
serviceItem.add_icon(self.plugin.iconPath) serviceItem.add_icon(self.plugin.iconPath)
if self.generateSlideData(serviceItem, item, xmlVersion, remote): if self.generateSlideData(serviceItem, item, xmlVersion, remote,
context):
return serviceItem return serviceItem
else: else:
return None return None

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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,8 +37,7 @@ import logging
import os import os
import uuid import uuid
from openlp.core.lib import build_icon, clean_tags, expand_tags, translate, \ from openlp.core.lib import build_icon, clean_tags, expand_tags, translate, ImageSource
ImageSource
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -53,7 +52,65 @@ class ServiceItemType(object):
class ItemCapabilities(object): class ItemCapabilities(object):
""" """
Provides an enumeration of a serviceitem's capabilities Provides an enumeration of a service item's capabilities
``CanPreview``
The capability to allow the ServiceManager to add to the preview
tab when making the previous item live.
``CanEdit``
The capability to allow the ServiceManager to allow the item to be
edited
``CanMaintain``
The capability to allow the ServiceManager to allow the item to be
reordered.
``RequiresMedia``
Determines is the serviceItem needs a Media Player
``CanLoop``
The capability to allow the SlideController to allow the loop
processing.
``CanAppend``
The capability to allow the ServiceManager to add leaves to the
item
``NoLineBreaks``
The capability to remove lines breaks in the renderer
``OnLoadUpdate``
The capability to update MediaManager when a service Item is
loaded.
``AddIfNewItem``
Not Used
``ProvidesOwnDisplay``
The capability to tell the SlideController the service Item has a
different display.
``HasDetailedTitleDisplay``
ServiceItem provides a title
``HasVariableStartTime``
The capability to tell the ServiceManager that a change to start
time is possible.
``CanSoftBreak``
The capability to tell the renderer that Soft Break is allowed
``CanWordSplit``
The capability to tell the renderer that it can split words is
allowed
``HasBackgroundAudio``
That a audio file is present with the text.
``CanAutoStartForLive``
The capability to ignore the do not play if display blank flag.
""" """
CanPreview = 1 CanPreview = 1
CanEdit = 2 CanEdit = 2
@ -70,6 +127,7 @@ class ItemCapabilities(object):
CanSoftBreak = 13 CanSoftBreak = 13
CanWordSplit = 14 CanWordSplit = 14
HasBackgroundAudio = 15 HasBackgroundAudio = 15
CanAutoStartForLive = 16
class ServiceItem(object): class ServiceItem(object):
@ -123,6 +181,7 @@ class ServiceItem(object):
self.background_audio = [] self.background_audio = []
self.theme_overwritten = False self.theme_overwritten = False
self.temporary_edit = False self.temporary_edit = False
self.will_auto_start = False
self._new_item() self._new_item()
def _new_item(self): def _new_item(self):
@ -181,8 +240,17 @@ class ServiceItem(object):
self.themedata, self.main, self.footer = self.renderer.pre_render() self.themedata, self.main, self.footer = self.renderer.pre_render()
if self.service_item_type == ServiceItemType.Text: if self.service_item_type == ServiceItemType.Text:
log.debug(u'Formatting slides: %s' % self.title) log.debug(u'Formatting slides: %s' % self.title)
# Save rendered pages to this dict. In the case that a slide is used
# twice we can use the pages saved to the dict instead of rendering
# them again.
previous_pages = {}
for slide in self._raw_frames: for slide in self._raw_frames:
verse_tag = slide[u'verseTag']
if verse_tag in previous_pages and previous_pages[verse_tag][0] == slide[u'raw_slide']:
pages = previous_pages[verse_tag][1]
else:
pages = self.renderer.format_slide(slide[u'raw_slide'], self) pages = self.renderer.format_slide(slide[u'raw_slide'], self)
previous_pages[verse_tag] = (slide[u'raw_slide'], pages)
for page in pages: for page in pages:
page = page.replace(u'<br>', u'{br}') page = page.replace(u'<br>', u'{br}')
html = expand_tags(cgi.escape(page.rstrip())) html = expand_tags(cgi.escape(page.rstrip()))
@ -190,10 +258,9 @@ class ServiceItem(object):
u'title': clean_tags(page), u'title': clean_tags(page),
u'text': clean_tags(page.rstrip()), u'text': clean_tags(page.rstrip()),
u'html': html.replace(u'&amp;nbsp;', u'&nbsp;'), u'html': html.replace(u'&amp;nbsp;', u'&nbsp;'),
u'verseTag': slide[u'verseTag'] u'verseTag': verse_tag
}) })
elif self.service_item_type == ServiceItemType.Image or \ elif self.service_item_type == ServiceItemType.Image or self.service_item_type == ServiceItemType.Command:
self.service_item_type == ServiceItemType.Command:
pass pass
else: else:
log.error(u'Invalid value renderer: %s' % self.service_item_type) log.error(u'Invalid value renderer: %s' % self.service_item_type)
@ -219,8 +286,7 @@ class ServiceItem(object):
self.image_border = background self.image_border = background
self.service_item_type = ServiceItemType.Image self.service_item_type = ServiceItemType.Image
self._raw_frames.append({u'title': title, u'path': path}) self._raw_frames.append({u'title': title, u'path': path})
self.renderer.image_manager.addImage( self.renderer.image_manager.addImage(path, ImageSource.ImagePlugin, self.image_border)
path, ImageSource.ImagePlugin, self.image_border)
self._new_item() self._new_item()
def add_from_text(self, raw_slide, verse_tag=None): def add_from_text(self, raw_slide, verse_tag=None):
@ -234,8 +300,7 @@ class ServiceItem(object):
verse_tag = verse_tag.upper() verse_tag = verse_tag.upper()
self.service_item_type = ServiceItemType.Text self.service_item_type = ServiceItemType.Text
title = raw_slide[:30].split(u'\n')[0] title = raw_slide[:30].split(u'\n')[0]
self._raw_frames.append( self._raw_frames.append({u'title': title, u'raw_slide': raw_slide, u'verseTag': verse_tag})
{u'title': title, u'raw_slide': raw_slide, u'verseTag': verse_tag})
self._new_item() self._new_item()
def add_from_command(self, path, file_name, image): def add_from_command(self, path, file_name, image):
@ -252,11 +317,10 @@ class ServiceItem(object):
The command of/for the slide. The command of/for the slide.
""" """
self.service_item_type = ServiceItemType.Command self.service_item_type = ServiceItemType.Command
self._raw_frames.append( self._raw_frames.append({u'title': file_name, u'image': image, u'path': path})
{u'title': file_name, u'image': image, u'path': path})
self._new_item() self._new_item()
def get_service_repr(self): def get_service_repr(self, lite_save):
""" """
This method returns some text which can be saved into the service This method returns some text which can be saved into the service
file to represent this item. file to represent this item.
@ -280,17 +344,21 @@ class ServiceItem(object):
u'end_time': self.end_time, u'end_time': self.end_time,
u'media_length': self.media_length, u'media_length': self.media_length,
u'background_audio': self.background_audio, u'background_audio': self.background_audio,
u'theme_overwritten': self.theme_overwritten u'theme_overwritten': self.theme_overwritten,
u'will_auto_start': self.will_auto_start
} }
service_data = [] service_data = []
if self.service_item_type == ServiceItemType.Text: if self.service_item_type == ServiceItemType.Text:
service_data = [slide for slide in self._raw_frames] service_data = [slide for slide in self._raw_frames]
elif self.service_item_type == ServiceItemType.Image: elif self.service_item_type == ServiceItemType.Image:
if lite_save:
for slide in self._raw_frames:
service_data.append({u'title': slide[u'title'], u'path': slide[u'path']})
else:
service_data = [slide[u'title'] for slide in self._raw_frames] service_data = [slide[u'title'] for slide in self._raw_frames]
elif self.service_item_type == ServiceItemType.Command: elif self.service_item_type == ServiceItemType.Command:
for slide in self._raw_frames: for slide in self._raw_frames:
service_data.append( service_data.append({u'title': slide[u'title'], u'image': slide[u'image'], u'path': slide[u'path']})
{u'title': slide[u'title'], u'image': slide[u'image']})
return {u'header': service_header, u'data': service_data} return {u'header': service_header, u'data': service_data}
def set_from_service(self, serviceitem, path=None): def set_from_service(self, serviceitem, path=None):
@ -302,7 +370,9 @@ class ServiceItem(object):
The item to extract data from. The item to extract data from.
``path`` ``path``
Defaults to *None*. Any path data, usually for images. Defaults to *None*. This is the service manager path for things
which have their files saved with them or None when the saved
service is lite and the original file paths need to be preserved..
""" """
log.debug(u'set_from_service called with path %s' % path) log.debug(u'set_from_service called with path %s' % path)
header = serviceitem[u'serviceitem'][u'header'] header = serviceitem[u'serviceitem'][u'header']
@ -324,6 +394,7 @@ class ServiceItem(object):
self.start_time = header.get(u'start_time', 0) self.start_time = header.get(u'start_time', 0)
self.end_time = header.get(u'end_time', 0) self.end_time = header.get(u'end_time', 0)
self.media_length = header.get(u'media_length', 0) self.media_length = header.get(u'media_length', 0)
self.will_auto_start = header.get(u'will_auto_start', False)
if u'background_audio' in header: if u'background_audio' in header:
self.background_audio = [] self.background_audio = []
for filename in header[u'background_audio']: for filename in header[u'background_audio']:
@ -334,14 +405,20 @@ class ServiceItem(object):
for slide in serviceitem[u'serviceitem'][u'data']: for slide in serviceitem[u'serviceitem'][u'data']:
self._raw_frames.append(slide) self._raw_frames.append(slide)
elif self.service_item_type == ServiceItemType.Image: elif self.service_item_type == ServiceItemType.Image:
if path:
for text_image in serviceitem[u'serviceitem'][u'data']: for text_image in serviceitem[u'serviceitem'][u'data']:
filename = os.path.join(path, text_image) filename = os.path.join(path, text_image)
self.add_from_image(filename, text_image) self.add_from_image(filename, text_image)
else:
for text_image in serviceitem[u'serviceitem'][u'data']:
self.add_from_image(text_image[u'path'], text_image[u'title'])
elif self.service_item_type == ServiceItemType.Command: elif self.service_item_type == ServiceItemType.Command:
for text_image in serviceitem[u'serviceitem'][u'data']: for text_image in serviceitem[u'serviceitem'][u'data']:
filename = os.path.join(path, text_image[u'title']) if path:
self.add_from_command( self.add_from_command(path, text_image[u'title'], text_image[u'image'])
path, text_image[u'title'], text_image[u'image']) else:
self.add_from_command(text_image[u'path'], text_image[u'title'], text_image[u'image'])
self._new_item() self._new_item()
def get_display_title(self): def get_display_title(self):
@ -414,8 +491,7 @@ class ServiceItem(object):
""" """
Confirms if the ServiceItem uses a file Confirms if the ServiceItem uses a file
""" """
return self.service_item_type == ServiceItemType.Image or \ return self.service_item_type == ServiceItemType.Image or self.service_item_type == ServiceItemType.Command
self.service_item_type == ServiceItemType.Command
def is_text(self): def is_text(self):
""" """
@ -423,6 +499,17 @@ class ServiceItem(object):
""" """
return self.service_item_type == ServiceItemType.Text return self.service_item_type == ServiceItemType.Text
def set_media_length(self, length):
"""
Stores the media length of the item
``length``
The length of the media item
"""
self.media_length = length
if length > 0:
self.add_capability(ItemCapabilities.HasVariableStartTime)
def get_frames(self): def get_frames(self):
""" """
Returns the frames for the ServiceItem Returns the frames for the ServiceItem
@ -435,6 +522,8 @@ class ServiceItem(object):
def get_rendered_frame(self, row): def get_rendered_frame(self, row):
""" """
Returns the correct frame for a given list and renders it if required. Returns the correct frame for a given list and renders it if required.
``row``
The service item slide to be returned
""" """
if self.service_item_type == ServiceItemType.Text: if self.service_item_type == ServiceItemType.Text:
return self._display_frames[row][u'html'].split(u'\n')[0] return self._display_frames[row][u'html'].split(u'\n')[0]
@ -469,7 +558,7 @@ class ServiceItem(object):
def remove_frame(self, frame): def remove_frame(self, frame):
""" """
Remove the soecified frame from the item Remove the specified frame from the item
""" """
if frame in self._raw_frames: if frame in self._raw_frames:
self._raw_frames.remove(frame) self._raw_frames.remove(frame)

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -61,6 +61,8 @@ class UiStrings(object):
self.Add = translate('OpenLP.Ui', '&Add') self.Add = translate('OpenLP.Ui', '&Add')
self.Advanced = translate('OpenLP.Ui', 'Advanced') self.Advanced = translate('OpenLP.Ui', 'Advanced')
self.AllFiles = translate('OpenLP.Ui', 'All Files') self.AllFiles = translate('OpenLP.Ui', 'All Files')
self.Automatic = translate('OpenLP.Ui', 'Automatic')
self.BackgroundColor = translate('OpenLP.Ui', 'Background Color')
self.Bottom = translate('OpenLP.Ui', 'Bottom') self.Bottom = translate('OpenLP.Ui', 'Bottom')
self.Browse = translate('OpenLP.Ui', 'Browse...') self.Browse = translate('OpenLP.Ui', 'Browse...')
self.Cancel = translate('OpenLP.Ui', 'Cancel') self.Cancel = translate('OpenLP.Ui', 'Cancel')
@ -69,6 +71,7 @@ class UiStrings(object):
self.ConfirmDelete = translate('OpenLP.Ui', 'Confirm Delete') self.ConfirmDelete = translate('OpenLP.Ui', 'Confirm Delete')
self.Continuous = translate('OpenLP.Ui', 'Continuous') self.Continuous = translate('OpenLP.Ui', 'Continuous')
self.Default = unicode(translate('OpenLP.Ui', 'Default')) self.Default = unicode(translate('OpenLP.Ui', 'Default'))
self.DefaultColor = translate('OpenLP.Ui', 'Default Color:')
self.Delete = translate('OpenLP.Ui', '&Delete') self.Delete = translate('OpenLP.Ui', '&Delete')
self.DisplayStyle = translate('OpenLP.Ui', 'Display style:') self.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error') self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error')
@ -106,7 +109,8 @@ class UiStrings(object):
self.NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular') self.NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular')
self.NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural') self.NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural')
self.OLPV1 = translate('OpenLP.Ui', 'openlp.org 1.x') self.OLPV1 = translate('OpenLP.Ui', 'openlp.org 1.x')
self.OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0') self.OLPV2 = translate('OpenLP.Ui', 'OpenLP 2')
self.OLPV2x = translate('OpenLP.Ui', 'OpenLP 2.1')
self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. ' self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. '
'Do you wish to continue?') 'Do you wish to continue?')
self.OpenService = translate('OpenLP.Ui', 'Open service.') self.OpenService = translate('OpenLP.Ui', 'Open service.')
@ -465,9 +469,8 @@ def create_valign_selection_widgets(parent):
label = QtGui.QLabel(parent) label = QtGui.QLabel(parent)
label.setText(translate('OpenLP.Ui', '&Vertical Align:')) label.setText(translate('OpenLP.Ui', '&Vertical Align:'))
combo_box = QtGui.QComboBox(parent) combo_box = QtGui.QComboBox(parent)
combo_box.addItem(UiStrings().Top) combo_box.addItems(
combo_box.addItem(UiStrings().Middle) [UiStrings().Top, UiStrings().Middle, UiStrings().Bottom])
combo_box.addItem(UiStrings().Bottom)
label.setBuddy(combo_box) label.setBuddy(combo_box)
return label, combo_box return label, combo_box
@ -482,8 +485,7 @@ def find_and_set_in_combo_box(combo_box, value_to_find):
``value_to_find`` ``value_to_find``
The value to find The value to find
""" """
index = combo_box.findText(value_to_find, index = combo_box.findText(value_to_find, QtCore.Qt.MatchExactly)
QtCore.Qt.MatchExactly)
if index == -1: if index == -1:
# Not Found. # Not Found.
index = 0 index = 0

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -72,6 +72,16 @@ class AlertLocation(object):
Middle = 1 Middle = 1
Bottom = 2 Bottom = 2
class DisplayControllerType(object):
"""
This is an enumeration class which says where a display controller
originated from.
"""
Live = 0
Preview = 1
Plugin = 2
from firsttimeform import FirstTimeForm from firsttimeform import FirstTimeForm
from firsttimelanguageform import FirstTimeLanguageForm from firsttimelanguageform import FirstTimeLanguageForm
from themelayoutform import ThemeLayoutForm from themelayoutform import ThemeLayoutForm
@ -82,7 +92,7 @@ from screen import ScreenList
from maindisplay import MainDisplay, Display from maindisplay import MainDisplay, Display
from servicenoteform import ServiceNoteForm from servicenoteform import ServiceNoteForm
from serviceitemeditform import ServiceItemEditForm from serviceitemeditform import ServiceItemEditForm
from slidecontroller import SlideController, Controller from slidecontroller import SlideController, DisplayController
from splashscreen import SplashScreen from splashscreen import SplashScreen
from generaltab import GeneralTab from generaltab import GeneralTab
from themestab import ThemesTab from themestab import ThemesTab
@ -98,4 +108,4 @@ from thememanager import ThemeManager
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay', __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay',
'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager', 'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager',
'ServiceItemEditForm', u'FirstTimeForm'] 'ServiceItemEditForm', 'FirstTimeForm']

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -116,7 +116,7 @@ class Ui_AboutDialog(object):
u'Philip "Phill" Ridout', u'Simon "samscudder" Scudder', u'Philip "Phill" Ridout', u'Simon "samscudder" Scudder',
u'Jeffrey "whydoubt" Smith', u'Maikel Stuivenberg', u'Jeffrey "whydoubt" Smith', u'Maikel Stuivenberg',
u'Dave "Dave42W" Warnock', u'Frode "frodus" Woldsund', u'Dave "Dave42W" Warnock', u'Frode "frodus" Woldsund',
u'Martin "matysek" Zibricky'] u'Martin "matysek" Zibricky', u'Patrick "mohij" Zimmermann']
testers = [u'Philip "Phill" Ridout', u'Wesley "wrst" Stout', testers = [u'Philip "Phill" Ridout', u'Wesley "wrst" Stout',
u'John "jseagull1" Cegalis (lead)'] u'John "jseagull1" Cegalis (lead)']
packagers = ['Thomas "tabthorpe" Abthorpe (FreeBSD)', packagers = ['Thomas "tabthorpe" Abthorpe (FreeBSD)',
@ -139,8 +139,11 @@ class Ui_AboutDialog(object):
u'el': [u'Alexander Siozos'], u'el': [u'Alexander Siozos'],
u'es': [u'Josu\xe9 Z\xfa\xf1iga',u'Christian Gonzalez'], u'es': [u'Josu\xe9 Z\xfa\xf1iga',u'Christian Gonzalez'],
u'et': [u'Mattias "mahfiaz" P\xf5ldaru'], u'et': [u'Mattias "mahfiaz" P\xf5ldaru'],
u'fr': [u'Stephan\xe9 "stbrunner" Brunner', u'Jeremie'], u'fi': [u'Jori "joribu" Brander', u'Tobbe "tobbeb" Bildo'],
u'fr': [u'Stephan\xe9 "stbrunner" Brunner', u'Jeremie "jnau05"',
u'Carl "carl.fischer" Fischer'],
u'hu': [u'Gyuris Gell\xe9rt'], u'hu': [u'Gyuris Gell\xe9rt'],
u'id': [u'Mico "bangmico" Siahaan' ,u' ign_christian'],
u'ja': [u'Kunio "Kunio" Nakamaru', u'Chris Haris'], u'ja': [u'Kunio "Kunio" Nakamaru', u'Chris Haris'],
u'nb': [u'Atle "pendlaren" Weibell', u'Frode "frodus" Woldsund'], u'nb': [u'Atle "pendlaren" Weibell', u'Frode "frodus" Woldsund'],
u'nl': [u'Arjen "typovar" van Voorst'], u'nl': [u'Arjen "typovar" van Voorst'],
@ -149,7 +152,9 @@ class Ui_AboutDialog(object):
u'Gustavo Bim', u'Rog\xeanio Bel\xe9m', u'Samuel' u'Gustavo Bim', u'Rog\xeanio Bel\xe9m', u'Samuel'
u'Simon "samscudder" Scudder', u'Van Der Fran'], u'Simon "samscudder" Scudder', u'Van Der Fran'],
u'ru': [u'Sergey "ratz" Ratz'], u'ru': [u'Sergey "ratz" Ratz'],
u'sv': [u'Erik "luen" Lundin'] u'sv': [u'Erik "luen" Lundin'],
u'ta_LK': [u'"Prasad"'],
u'zh_CN': [u' "executor" ']
} }
documentors = [u'Wesley "wrst" Stout', documentors = [u'Wesley "wrst" Stout',
u'John "jseagull1" Cegalis (lead)'] u'John "jseagull1" Cegalis (lead)']
@ -172,7 +177,7 @@ class Ui_AboutDialog(object):
'Translators\n' 'Translators\n'
' Afrikaans (af)\n' ' Afrikaans (af)\n'
' %s\n' ' %s\n'
' Czeck (cs)\n' ' Czech (cs)\n'
' %s\n' ' %s\n'
' Danish (da)\n' ' Danish (da)\n'
' %s\n' ' %s\n'
@ -188,10 +193,14 @@ class Ui_AboutDialog(object):
' %s\n' ' %s\n'
' Estonian (et)\n' ' Estonian (et)\n'
' %s\n' ' %s\n'
' Finnish (fi)\n'
' %s\n'
' French (fr)\n' ' French (fr)\n'
' %s\n' ' %s\n'
' Hungarian (hu)\n' ' Hungarian (hu)\n'
' %s\n' ' %s\n'
' Indonesian (id)\n'
' %s\n'
' Japanese (ja)\n' ' Japanese (ja)\n'
' %s\n' ' %s\n'
' Norwegian Bokm\xe5l (nb)\n' ' Norwegian Bokm\xe5l (nb)\n'
@ -204,6 +213,10 @@ class Ui_AboutDialog(object):
' %s\n' ' %s\n'
' Swedish (sv)\n' ' Swedish (sv)\n'
' %s\n' ' %s\n'
' Tamil(Sri-Lanka) (ta_LK)\n'
' %s\n'
' Chinese(China) (zh_CN)\n'
' %s\n'
'\n' '\n'
'Documentation\n' 'Documentation\n'
' %s\n' ' %s\n'
@ -235,14 +248,18 @@ class Ui_AboutDialog(object):
u'\n '.join(translators[u'en_ZA']), u'\n '.join(translators[u'en_ZA']),
u'\n '.join(translators[u'es']), u'\n '.join(translators[u'es']),
u'\n '.join(translators[u'et']), u'\n '.join(translators[u'et']),
u'\n '.join(translators[u'fi']),
u'\n '.join(translators[u'fr']), u'\n '.join(translators[u'fr']),
u'\n '.join(translators[u'hu']), u'\n '.join(translators[u'hu']),
u'\n '.join(translators[u'id']),
u'\n '.join(translators[u'ja']), u'\n '.join(translators[u'ja']),
u'\n '.join(translators[u'nb']), u'\n '.join(translators[u'nb']),
u'\n '.join(translators[u'nl']), u'\n '.join(translators[u'nl']),
u'\n '.join(translators[u'pt_BR']), u'\n '.join(translators[u'pt_BR']),
u'\n '.join(translators[u'ru']), u'\n '.join(translators[u'ru']),
u'\n '.join(translators[u'sv']), u'\n '.join(translators[u'sv']),
u'\n '.join(translators[u'ta_LK']),
u'\n '.join(translators[u'zh_CN']),
u'\n '.join(documentors))) u'\n '.join(documentors)))
self.aboutNotebook.setTabText( self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.creditsTab), self.aboutNotebook.indexOf(self.creditsTab),
@ -257,7 +274,7 @@ class Ui_AboutDialog(object):
u'Mattias P\xf5ldaru, Christian Richter, ' u'Mattias P\xf5ldaru, Christian Richter, '
u'Philip Ridout, Simon Scudder, Jeffrey Smith, Maikel Stuivenberg, ' u'Philip Ridout, Simon Scudder, Jeffrey Smith, Maikel Stuivenberg, '
u'Martin Thompson, Jon Tibble, Dave Warnock, Frode Woldsund, ' u'Martin Thompson, Jon Tibble, Dave Warnock, Frode Woldsund, '
u'Martin Zibricky') u'Martin Zibricky, Patrick Zimmermann')
licence = translate('OpenLP.AboutForm', licence = translate('OpenLP.AboutForm',
'This program is free software; you can redistribute it and/or ' 'This program is free software; you can redistribute it and/or '
'modify it under the terms of the GNU General Public License as ' 'modify it under the terms of the GNU General Public License as '

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -103,28 +103,22 @@ class AdvancedTab(SettingsTab):
u'expandServiceItemCheckBox') u'expandServiceItemCheckBox')
self.uiLayout.addRow(self.expandServiceItemCheckBox) self.uiLayout.addRow(self.expandServiceItemCheckBox)
self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox) self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.enableAutoCloseCheckBox.setObjectName( self.enableAutoCloseCheckBox.setObjectName(u'enableAutoCloseCheckBox')
u'enableAutoCloseCheckBox')
self.uiLayout.addRow(self.enableAutoCloseCheckBox) self.uiLayout.addRow(self.enableAutoCloseCheckBox)
self.leftLayout.addWidget(self.uiGroupBox) self.leftLayout.addWidget(self.uiGroupBox)
# Default service name # Default service name
self.serviceNameGroupBox = QtGui.QGroupBox(self.leftColumn) self.serviceNameGroupBox = QtGui.QGroupBox(self.leftColumn)
self.serviceNameGroupBox.setObjectName(u'serviceNameGroupBox') self.serviceNameGroupBox.setObjectName(u'serviceNameGroupBox')
self.serviceNameLayout = QtGui.QFormLayout( self.serviceNameLayout = QtGui.QFormLayout(self.serviceNameGroupBox)
self.serviceNameGroupBox) self.serviceNameCheckBox = QtGui.QCheckBox(self.serviceNameGroupBox)
self.serviceNameCheckBox = QtGui.QCheckBox(
self.serviceNameGroupBox)
self.serviceNameCheckBox.setObjectName(u'serviceNameCheckBox') self.serviceNameCheckBox.setObjectName(u'serviceNameCheckBox')
self.serviceNameLayout.setObjectName(u'serviceNameLayout') self.serviceNameLayout.setObjectName(u'serviceNameLayout')
self.serviceNameLayout.addRow(self.serviceNameCheckBox) self.serviceNameLayout.addRow(self.serviceNameCheckBox)
self.serviceNameTimeLabel = QtGui.QLabel(self.serviceNameGroupBox) self.serviceNameTimeLabel = QtGui.QLabel(self.serviceNameGroupBox)
self.serviceNameTimeLabel.setObjectName(u'serviceNameTimeLabel') self.serviceNameTimeLabel.setObjectName(u'serviceNameTimeLabel')
self.serviceNameDay = QtGui.QComboBox( self.serviceNameDay = QtGui.QComboBox(self.serviceNameGroupBox)
self.serviceNameGroupBox) self.serviceNameDay.addItems([u'', u'', u'', u'', u'', u'', u'', u''])
self.serviceNameDay.addItems( self.serviceNameDay.setObjectName(u'serviceNameDay')
[u'', u'', u'', u'', u'', u'', u'', u''])
self.serviceNameDay.setObjectName(
u'serviceNameDay')
self.serviceNameTime = QtGui.QTimeEdit(self.serviceNameGroupBox) self.serviceNameTime = QtGui.QTimeEdit(self.serviceNameGroupBox)
self.serviceNameTime.setObjectName(u'serviceNameTime') self.serviceNameTime.setObjectName(u'serviceNameTime')
self.serviceNameTimeHBox = QtGui.QHBoxLayout() self.serviceNameTimeHBox = QtGui.QHBoxLayout()
@ -151,8 +145,7 @@ class AdvancedTab(SettingsTab):
self.serviceNameHBox.addWidget(self.serviceNameRevertButton) self.serviceNameHBox.addWidget(self.serviceNameRevertButton)
self.serviceNameLayout.addRow(self.serviceNameLabel, self.serviceNameLayout.addRow(self.serviceNameLabel,
self.serviceNameHBox) self.serviceNameHBox)
self.serviceNameExampleLabel = QtGui.QLabel( self.serviceNameExampleLabel = QtGui.QLabel(self.serviceNameGroupBox)
self.serviceNameGroupBox)
self.serviceNameExampleLabel.setObjectName( self.serviceNameExampleLabel.setObjectName(
u'serviceNameExampleLabel') u'serviceNameExampleLabel')
self.serviceNameExample = QtGui.QLabel(self.serviceNameGroupBox) self.serviceNameExample = QtGui.QLabel(self.serviceNameGroupBox)
@ -202,8 +195,7 @@ class AdvancedTab(SettingsTab):
self.newDataDirectoryLabelHBox.setObjectName( self.newDataDirectoryLabelHBox.setObjectName(
u'newDataDirectoryLabelHBox') u'newDataDirectoryLabelHBox')
self.newDataDirectoryLabelHBox.addWidget(self.newDataDirectoryEdit) self.newDataDirectoryLabelHBox.addWidget(self.newDataDirectoryEdit)
self.newDataDirectoryLabelHBox.addWidget( self.newDataDirectoryLabelHBox.addWidget(self.dataDirectoryBrowseButton)
self.dataDirectoryBrowseButton)
self.newDataDirectoryLabelHBox.addWidget( self.newDataDirectoryLabelHBox.addWidget(
self.dataDirectoryDefaultButton) self.dataDirectoryDefaultButton)
self.dataDirectoryCopyCheckHBox = QtGui.QHBoxLayout() self.dataDirectoryCopyCheckHBox = QtGui.QHBoxLayout()
@ -340,8 +332,7 @@ class AdvancedTab(SettingsTab):
Setup the interface translation strings. Setup the interface translation strings.
""" """
self.tabTitleVisible = UiStrings().Advanced self.tabTitleVisible = UiStrings().Advanced
self.uiGroupBox.setTitle( self.uiGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
translate('OpenLP.AdvancedTab', 'UI Settings'))
self.dataDirectoryGroupBox.setTitle( self.dataDirectoryGroupBox.setTitle(
translate('OpenLP.AdvancedTab', 'Data Location')) translate('OpenLP.AdvancedTab', 'Data Location'))
self.recentLabel.setText( self.recentLabel.setText(
@ -477,7 +468,7 @@ class AdvancedTab(SettingsTab):
settings.value(u'enable exit confirmation', settings.value(u'enable exit confirmation',
QtCore.QVariant(True)).toBool()) QtCore.QVariant(True)).toBool())
self.hideMouseCheckBox.setChecked( self.hideMouseCheckBox.setChecked(
settings.value(u'hide mouse', QtCore.QVariant(False)).toBool()) settings.value(u'hide mouse', QtCore.QVariant(True)).toBool())
self.serviceNameDay.setCurrentIndex( self.serviceNameDay.setCurrentIndex(
settings.value(u'default service day', settings.value(u'default service day',
QtCore.QVariant(self.defaultServiceDay)).toInt()[0]) QtCore.QVariant(self.defaultServiceDay)).toInt()[0])
@ -504,8 +495,7 @@ class AdvancedTab(SettingsTab):
self.defaultColor = settings.value(u'default color', self.defaultColor = settings.value(u'default color',
QtCore.QVariant(u'#ffffff')).toString() QtCore.QVariant(u'#ffffff')).toString()
self.defaultFileEdit.setText(settings.value(u'default image', self.defaultFileEdit.setText(settings.value(u'default image',
QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\ QtCore.QVariant(u':/graphics/openlp-splash-screen.png')).toString())
.toString())
self.slide_limits = settings.value( self.slide_limits = settings.value(
u'slide limits', QtCore.QVariant(SlideLimits.End)).toInt()[0] u'slide limits', QtCore.QVariant(SlideLimits.End)).toInt()[0]
if self.slide_limits == SlideLimits.End: if self.slide_limits == SlideLimits.End:
@ -547,8 +537,7 @@ class AdvancedTab(SettingsTab):
self.currentDataPath = AppLocation.get_data_path() self.currentDataPath = AppLocation.get_data_path()
log.warning(u'User requested data path set to default %s' log.warning(u'User requested data path set to default %s'
% self.currentDataPath) % self.currentDataPath)
self.dataDirectoryLabel.setText(os.path.abspath( self.dataDirectoryLabel.setText(os.path.abspath(self.currentDataPath))
self.currentDataPath))
self.defaultColorButton.setStyleSheet( self.defaultColorButton.setStyleSheet(
u'background-color: %s' % self.defaultColor) u'background-color: %s' % self.defaultColor)
# Don't allow data directory move if running portable. # Don't allow data directory move if running portable.
@ -662,8 +651,7 @@ class AdvancedTab(SettingsTab):
file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(), file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(),
UiStrings().AllFiles) UiStrings().AllFiles)
filename = QtGui.QFileDialog.getOpenFileName(self, filename = QtGui.QFileDialog.getOpenFileName(self,
translate('OpenLP.AdvancedTab', 'Open File'), '', translate('OpenLP.AdvancedTab', 'Open File'), '', file_filters)
file_filters)
if filename: if filename:
self.defaultFileEdit.setText(filename) self.defaultFileEdit.setText(filename)
self.defaultFileEdit.setFocus() self.defaultFileEdit.setFocus()
@ -713,7 +701,8 @@ class AdvancedTab(SettingsTab):
""" """
new_data_path = AppLocation.get_directory(AppLocation.DataDir) new_data_path = AppLocation.get_directory(AppLocation.DataDir)
if self.currentDataPath.lower() != new_data_path.lower(): if self.currentDataPath.lower() != new_data_path.lower():
# Make sure they want to change the data location back to the default. # Make sure they want to change the data location back to the
# default.
answer = QtGui.QMessageBox.question(self, answer = QtGui.QMessageBox.question(self,
translate('OpenLP.AdvancedTab', 'Reset Data Directory'), translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
translate('OpenLP.AdvancedTab', translate('OpenLP.AdvancedTab',

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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,7 +105,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_screen_changed'), self.updateScreenListCombo) QtCore.SIGNAL(u'config_screen_changed'), self.updateScreenListCombo)
def exec_(self, edit=False): def exec_(self):
""" """
Run the wizard. Run the wizard.
""" """
@ -271,8 +271,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self._performWizard() self._performWizard()
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
Settings().setValue(u'general/has run wizard', Settings().setValue(u'general/has run wizard', QtCore.QVariant(True))
QtCore.QVariant(True))
self.close() self.close()
def urlGetFile(self, url, fpath): def urlGetFile(self, url, fpath):
@ -283,7 +282,6 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
block_count = 0 block_count = 0
block_size = 4096 block_size = 4096
urlfile = urllib2.urlopen(url) urlfile = urllib2.urlopen(url)
filesize = urlfile.headers["Content-Length"]
filename = open(fpath, "wb") filename = open(fpath, "wb")
# Download until finished or canceled. # Download until finished or canceled.
while not self.downloadCancelled: while not self.downloadCancelled:
@ -292,7 +290,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
break break
filename.write(data) filename.write(data)
block_count += 1 block_count += 1
self._downloadProgress(block_count, block_size, filesize) self._downloadProgress(block_count, block_size)
filename.close() filename.close()
# Delete file if cancelled, it may be a partial file. # Delete file if cancelled, it may be a partial file.
if self.downloadCancelled: if self.downloadCancelled:
@ -320,7 +318,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
meta = site.info() meta = site.info()
return int(meta.getheaders("Content-Length")[0]) return int(meta.getheaders("Content-Length")[0])
def _downloadProgress(self, count, block_size, total_size): def _downloadProgress(self, count, block_size):
increment = (count * block_size) - self.previous_size increment = (count * block_size) - self.previous_size
self._incrementProgressBar(None, increment) self._incrementProgressBar(None, increment)
self.previous_size = count * block_size self.previous_size = count * block_size

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -327,7 +327,7 @@ class MainDisplay(Display):
""" """
log.debug(u'image to display') log.debug(u'image to display')
image = self.imageManager.getImageBytes(path, ImageSource.ImagePlugin) image = self.imageManager.getImageBytes(path, ImageSource.ImagePlugin)
self.controller.mediaController.video_reset(self.controller) self.controller.mediaController.media_reset(self.controller)
self.displayImage(image) self.displayImage(image)
def displayImage(self, image): def displayImage(self, image):
@ -498,7 +498,7 @@ class MainDisplay(Display):
Hide mouse cursor when moved over display. Hide mouse cursor when moved over display.
""" """
if Settings().value(u'advanced/hide mouse', if Settings().value(u'advanced/hide mouse',
QtCore.QVariant(False)).toBool(): QtCore.QVariant(True)).toBool():
self.setCursor(QtCore.Qt.BlankCursor) self.setCursor(QtCore.Qt.BlankCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "none"') self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
else: else:

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -395,7 +395,7 @@ class Ui_MainWindow(object):
""" """
Set up the translation system Set up the translation system
""" """
mainWindow.mainTitle = UiStrings().OLPV2 mainWindow.mainTitle = UiStrings().OLPV2x
mainWindow.setWindowTitle(mainWindow.mainTitle) mainWindow.setWindowTitle(mainWindow.mainTitle)
self.fileMenu.setTitle(translate('OpenLP.MainWindow', '&File')) self.fileMenu.setTitle(translate('OpenLP.MainWindow', '&File'))
self.fileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import')) self.fileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import'))
@ -576,6 +576,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.headerSection = u'SettingsImport' self.headerSection = u'SettingsImport'
self.serviceNotSaved = False self.serviceNotSaved = False
self.aboutForm = AboutForm(self) self.aboutForm = AboutForm(self)
self.mediaController = MediaController(self)
self.settingsForm = SettingsForm(self, self) self.settingsForm = SettingsForm(self, self)
self.formattingTagForm = FormattingTagForm(self) self.formattingTagForm = FormattingTagForm(self)
self.shortcutForm = ShortcutListForm(self) self.shortcutForm = ShortcutListForm(self)
@ -585,9 +586,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.pluginManager = PluginManager(plugin_path) self.pluginManager = PluginManager(plugin_path)
self.pluginHelpers = {} self.pluginHelpers = {}
self.imageManager = ImageManager() self.imageManager = ImageManager()
self.mediaController = MediaController(self)
# Set up the interface # Set up the interface
self.setupUi(self) self.setupUi(self)
# Register the active media players and suffixes
self.mediaController.check_available_media_players()
# Load settings after setupUi so default UI sizes are overwritten # Load settings after setupUi so default UI sizes are overwritten
self.loadSettings() self.loadSettings()
# Once settings are loaded update the menu with the recent files. # Once settings are loaded update the menu with the recent files.
@ -1169,7 +1171,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if self.serviceManagerContents.isModified(): if self.serviceManagerContents.isModified():
ret = self.serviceManagerContents.saveModifiedService() ret = self.serviceManagerContents.saveModifiedService()
if ret == QtGui.QMessageBox.Save: if ret == QtGui.QMessageBox.Save:
if self.serviceManagerContents.saveFile(): if self.serviceManagerContents.decideSaveMethod():
self.cleanUp() self.cleanUp()
event.accept() event.accept()
else: else:

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -47,7 +47,7 @@ class MediaState(object):
class MediaType(object): class MediaType(object):
""" """
An enumeration of possibible Media Types An enumeration of possible Media Types
""" """
Unused = 0 Unused = 0
Audio = 1 Audio = 1
@ -59,7 +59,7 @@ class MediaType(object):
class MediaInfo(object): class MediaInfo(object):
""" """
This class hold the media related infos This class hold the media related info
""" """
file_info = None file_info = None
volume = 100 volume = 100
@ -72,30 +72,25 @@ class MediaInfo(object):
def get_media_players(): def get_media_players():
""" """
This method extract the configured media players and overridden player from This method extracts the configured media players and overridden player
the settings. from the settings.
``players_list``
A list with all active media players.
``overridden_player``
Here an special media player is chosen for all media actions.
""" """
log.debug(u'get_media_players') log.debug(u'get_media_players')
players = unicode(Settings().value(u'media/players').toString()) saved_players = unicode(Settings().value(u'media/players').toString())
if not players: if not saved_players:
players = u'webkit' # we must always have a player and Webkit is the core one.
saved_players = u'webkit'
reg_ex = QtCore.QRegExp(".*\[(.*)\].*") reg_ex = QtCore.QRegExp(".*\[(.*)\].*")
if Settings().value(u'media/override player', if Settings().value(u'media/override player',
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == QtCore.Qt.Checked: QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == QtCore.Qt.Checked:
if reg_ex.exactMatch(players): if reg_ex.exactMatch(saved_players):
overridden_player = u'%s' % reg_ex.cap(1) overridden_player = u'%s' % reg_ex.cap(1)
else: else:
overridden_player = u'auto' overridden_player = u'auto'
else: else:
overridden_player = u'' overridden_player = u''
players_list = players.replace(u'[', u'').replace(u']', u'').split(u',') saved_players_list = saved_players.replace(u'[', u'').replace(u']',u'').split(u',')
return players_list, overridden_player return saved_players_list, overridden_player
def set_media_players(players_list, overridden_player=u'auto'): def set_media_players(players_list, overridden_player=u'auto'):
@ -111,10 +106,10 @@ def set_media_players(players_list, overridden_player=u'auto'):
""" """
log.debug(u'set_media_players') log.debug(u'set_media_players')
players = u','.join(players_list) players = u','.join(players_list)
if Settings().value(u'media/override player', if Settings().value(u'media/override player', QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == \
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == \
QtCore.Qt.Checked and overridden_player != u'auto': QtCore.Qt.Checked and overridden_player != u'auto':
players = players.replace(overridden_player, u'[%s]' % overridden_player) players = players.replace(overridden_player, u'[%s]' % overridden_player)
Settings().setValue(u'media/players', QtCore.QVariant(players)) Settings().setValue(u'media/players', QtCore.QVariant(players))
from mediacontroller import MediaController from mediacontroller import MediaController
from playertab import PlayerTab

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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,11 +34,12 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, Receiver, translate from openlp.core.lib import OpenLPToolbar, Receiver, translate
from openlp.core.lib.settings import Settings from openlp.core.lib.settings import Settings
from openlp.core.lib.mediaplayer import MediaPlayer from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.media import MediaState, MediaInfo, MediaType, \ from openlp.core.ui.media import MediaState, MediaInfo, MediaType, \
get_media_players, set_media_players get_media_players, set_media_players
from openlp.core.ui.media.mediaplayer import MediaPlayer
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
from openlp.core.ui import DisplayControllerType
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -46,119 +47,138 @@ class MediaController(object):
""" """
The implementation of the Media Controller. The Media Controller adds an own The implementation of the Media Controller. The Media Controller adds an own
class for every Player. Currently these are QtWebkit, Phonon and Vlc. class for every Player. Currently these are QtWebkit, Phonon and Vlc.
"""
displayControllers are an array of controllers keyed on the
slidecontroller or plugin which built them. ControllerType is the class
containing the key values.
mediaPlayers are an array of media players keyed on player name.
currentMediaPlayer is an array of player instances keyed on ControllerType.
"""
def __init__(self, parent): def __init__(self, parent):
self.parent = parent self.mainWindow = parent
self.mediaPlayers = {} self.mediaPlayers = {}
self.controller = [] self.displayControllers = {}
self.curDisplayMediaPlayer = {} self.currentMediaPlayer = {}
# Timer for video state # Timer for video state
self.timer = QtCore.QTimer() self.timer = QtCore.QTimer()
self.timer.setInterval(200) self.timer.setInterval(200)
self.withLivePreview = False
self.check_available_media_players()
# Signals # Signals
QtCore.QObject.connect(self.timer, QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.media_state)
QtCore.SIGNAL("timeout()"), self.video_state) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'playbackPlay'), self.media_play_msg)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'playbackPause'), self.media_pause_msg)
QtCore.SIGNAL(u'playbackPlay'), self.video_play) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'playbackStop'), self.media_stop_msg)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'seekSlider'), self.media_seek)
QtCore.SIGNAL(u'playbackPause'), self.video_pause) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'volumeSlider'), self.media_volume)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'media_hide'), self.media_hide)
QtCore.SIGNAL(u'playbackStop'), self.video_stop) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'media_blank'), self.media_blank)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'media_unblank'), self.media_unblank)
QtCore.SIGNAL(u'seekSlider'), self.video_seek)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'volumeSlider'), self.video_volume)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'media_hide'), self.video_hide)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'media_blank'), self.video_blank)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'media_unblank'), self.video_unblank)
# Signals for background video # Signals for background video
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_hide'), self.media_hide)
QtCore.SIGNAL(u'songs_hide'), self.video_hide) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_unblank'), self.media_unblank)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mediaitem_media_rebuild'),
QtCore.SIGNAL(u'songs_unblank'), self.video_unblank) self._set_active_players)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mediaitem_suffixes'),
QtCore.SIGNAL(u'mediaitem_media_rebuild'), self.set_active_players) self._generate_extensions_lists)
def set_active_players(self): def _set_active_players(self):
"""
Set the active players and available media files
"""
savedPlayers = get_media_players()[0] savedPlayers = get_media_players()[0]
for player in self.mediaPlayers.keys(): for player in self.mediaPlayers.keys():
self.mediaPlayers[player].isActive = player in savedPlayers self.mediaPlayers[player].isActive = player in savedPlayers
def register_controllers(self, controller): def _generate_extensions_lists(self):
""" """
Register each media Player controller (Webkit, Phonon, etc) and store Set the active players and available media files
"""
self.audio_extensions_list = []
for player in self.mediaPlayers.values():
if player.isActive:
for item in player.audio_extensions_list:
if not item in self.audio_extensions_list:
self.audio_extensions_list.append(item)
self.mainWindow.serviceManagerContents.supportedSuffixes(item[2:])
self.video_extensions_list = []
for player in self.mediaPlayers.values():
if player.isActive:
for item in player.video_extensions_list:
if item not in self.video_extensions_list:
self.video_extensions_list.extend(item)
self.mainWindow.serviceManagerContents.supportedSuffixes(item[2:])
def register_players(self, player):
"""
Register each media Player (Webkit, Phonon, etc) and store
for later use for later use
``player``
Individual player class which has been enabled
""" """
self.mediaPlayers[controller.name] = controller self.mediaPlayers[player.name] = player
def check_available_media_players(self): def check_available_media_players(self):
""" """
Check to see if we have any media Player's available. If Not do not Check to see if we have any media Player's available.
install the plugin.
""" """
log.debug(u'check_available_media_players') log.debug(u'_check_available_media_players')
controller_dir = os.path.join( controller_dir = os.path.join(
AppLocation.get_directory(AppLocation.AppDir), AppLocation.get_directory(AppLocation.AppDir),
u'core', u'ui', u'media') u'core', u'ui', u'media')
for filename in os.listdir(controller_dir): for filename in os.listdir(controller_dir):
if filename.endswith(u'player.py'): if filename.endswith(u'player.py') and not filename == 'mediaplayer.py':
path = os.path.join(controller_dir, filename) path = os.path.join(controller_dir, filename)
if os.path.isfile(path): if os.path.isfile(path):
modulename = u'openlp.core.ui.media.' + \ modulename = u'openlp.core.ui.media.' + os.path.splitext(filename)[0]
os.path.splitext(filename)[0]
log.debug(u'Importing controller %s', modulename) log.debug(u'Importing controller %s', modulename)
try: try:
__import__(modulename, globals(), locals(), []) __import__(modulename, globals(), locals(), [])
# On some platforms importing vlc.py might cause # On some platforms importing vlc.py might cause
# also OSError exceptions. (e.g. Mac OS X) # also OSError exceptions. (e.g. Mac OS X)
except (ImportError, OSError): except (ImportError, OSError):
log.warn(u'Failed to import %s on path %s', log.warn(u'Failed to import %s on path %s', modulename, path)
modulename, path) player_classes = MediaPlayer.__subclasses__()
controller_classes = MediaPlayer.__subclasses__() for player_class in player_classes:
for controller_class in controller_classes: player = player_class(self)
controller = controller_class(self) self.register_players(player)
self.register_controllers(controller)
if not self.mediaPlayers: if not self.mediaPlayers:
return False return False
savedPlayers, overriddenPlayer = get_media_players() savedPlayers, overriddenPlayer = get_media_players()
invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers
if not mediaPlayer in self.mediaPlayers or not if not mediaPlayer in self.mediaPlayers or not self.mediaPlayers[mediaPlayer].check_available()]
self.mediaPlayers[mediaPlayer].check_available()]
if invalidMediaPlayers: if invalidMediaPlayers:
for invalidPlayer in invalidMediaPlayers: for invalidPlayer in invalidMediaPlayers:
savedPlayers.remove(invalidPlayer) savedPlayers.remove(invalidPlayer)
set_media_players(savedPlayers, overriddenPlayer) set_media_players(savedPlayers, overriddenPlayer)
self.set_active_players() self._set_active_players()
self._generate_extensions_lists()
return True return True
def video_state(self): def media_state(self):
""" """
Check if there is a running media Player and do updating stuff (e.g. Check if there is a running media Player and do updating stuff (e.g.
update the UI) update the UI)
""" """
if not self.curDisplayMediaPlayer.keys(): if not self.currentMediaPlayer.keys():
self.timer.stop() self.timer.stop()
else: else:
any_active = False any_active = False
for display in self.curDisplayMediaPlayer.keys(): for source in self.currentMediaPlayer.keys():
self.curDisplayMediaPlayer[display].resize(display) display = self._define_display(self.displayControllers[source])
self.curDisplayMediaPlayer[display].update_ui(display) self.currentMediaPlayer[source].resize(display)
if self.curDisplayMediaPlayer[display].state == \ self.currentMediaPlayer[source].update_ui(display)
MediaState.Playing: if self.currentMediaPlayer[source].state == MediaState.Playing:
any_active = True any_active = True
# There are still any active players - no need to stop timer. # There are still any active players - no need to stop timer.
if any_active: if any_active:
return return
# no players are active anymore
# No players are active anymore. for source in self.currentMediaPlayer.keys():
for display in self.curDisplayMediaPlayer.keys(): if self.currentMediaPlayer[source].state != MediaState.Paused:
if self.curDisplayMediaPlayer[display].state != MediaState.Paused: display = self._define_display(self.displayControllers[source])
display.controller.seekSlider.setSliderPosition(0) display.controller.seekSlider.setSliderPosition(0)
self.timer.stop() self.timer.stop()
@ -192,39 +212,40 @@ class MediaController(object):
html += player.get_media_display_html() html += player.get_media_display_html()
return html return html
def add_controller_items(self, controller, control_panel): def register_controller(self, controller):
self.controller.append(controller)
self.setup_generic_controls(controller, control_panel)
self.setup_special_controls(controller, control_panel)
def setup_generic_controls(self, controller, control_panel):
""" """
Add generic media control items (valid for all types of medias) Registers media controls where the players will be placed to run.
``controller``
The controller where a player will be placed
"""
self.displayControllers[controller.controllerType] = controller
self.setup_generic_controls(controller)
def setup_generic_controls(self, controller):
"""
Set up controls on the control_panel for a given controller
``controller``
First element is the controller which should be used
""" """
controller.media_info = MediaInfo() controller.media_info = MediaInfo()
# Build a Media ToolBar # Build a Media ToolBar
controller.mediabar = OpenLPToolbar(controller) controller.mediabar = OpenLPToolbar(controller)
controller.mediabar.addToolbarAction(u'playbackPlay', controller.mediabar.addToolbarAction(u'playbackPlay', text=u'media_playback_play',
text=u'media_playback_play',
icon=u':/slides/media_playback_start.png', icon=u':/slides/media_playback_start.png',
tooltip=translate('OpenLP.SlideController', 'Start playing media.'), tooltip=translate('OpenLP.SlideController', 'Start playing media.'), triggers=controller.sendToPlugins)
triggers=controller.sendToPlugins) controller.mediabar.addToolbarAction(u'playbackPause', text=u'media_playback_pause',
controller.mediabar.addToolbarAction(u'playbackPause',
text=u'media_playback_pause',
icon=u':/slides/media_playback_pause.png', icon=u':/slides/media_playback_pause.png',
tooltip=translate('OpenLP.SlideController', 'Pause playing media.'), tooltip=translate('OpenLP.SlideController', 'Pause playing media.'), triggers=controller.sendToPlugins)
triggers=controller.sendToPlugins) controller.mediabar.addToolbarAction(u'playbackStop', text=u'media_playback_stop',
controller.mediabar.addToolbarAction(u'playbackStop',
text=u'media_playback_stop',
icon=u':/slides/media_playback_stop.png', icon=u':/slides/media_playback_stop.png',
tooltip=translate('OpenLP.SlideController', 'Stop playing media.'), tooltip=translate('OpenLP.SlideController', 'Stop playing media.'), triggers=controller.sendToPlugins)
triggers=controller.sendToPlugins)
# Build the seekSlider. # Build the seekSlider.
controller.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal) controller.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
controller.seekSlider.setMaximum(1000) controller.seekSlider.setMaximum(1000)
controller.seekSlider.setTracking(False) controller.seekSlider.setTracking(False)
controller.seekSlider.setToolTip(translate( controller.seekSlider.setToolTip(translate('OpenLP.SlideController', 'Video position.'))
'OpenLP.SlideController', 'Video position.'))
controller.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24)) controller.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
controller.seekSlider.setObjectName(u'seekSlider') controller.seekSlider.setObjectName(u'seekSlider')
controller.mediabar.addToolbarWidget(controller.seekSlider) controller.mediabar.addToolbarWidget(controller.seekSlider)
@ -235,89 +256,105 @@ class MediaController(object):
controller.volumeSlider.setMinimum(0) controller.volumeSlider.setMinimum(0)
controller.volumeSlider.setMaximum(100) controller.volumeSlider.setMaximum(100)
controller.volumeSlider.setTracking(True) controller.volumeSlider.setTracking(True)
controller.volumeSlider.setToolTip(translate( controller.volumeSlider.setToolTip(translate('OpenLP.SlideController', 'Audio Volume.'))
'OpenLP.SlideController', 'Audio Volume.'))
controller.volumeSlider.setValue(controller.media_info.volume) controller.volumeSlider.setValue(controller.media_info.volume)
controller.volumeSlider.setGeometry(QtCore.QRect(90, 160, 221, 24)) controller.volumeSlider.setGeometry(QtCore.QRect(90, 160, 221, 24))
controller.volumeSlider.setObjectName(u'volumeSlider') controller.volumeSlider.setObjectName(u'volumeSlider')
controller.mediabar.addToolbarWidget(controller.volumeSlider) controller.mediabar.addToolbarWidget(controller.volumeSlider)
control_panel.addWidget(controller.mediabar) controller.controllerLayout.addWidget(controller.mediabar)
controller.mediabar.setVisible(False) controller.mediabar.setVisible(False)
# Signals # Signals
QtCore.QObject.connect(controller.seekSlider, QtCore.QObject.connect(controller.seekSlider, QtCore.SIGNAL(u'valueChanged(int)'), controller.sendToPlugins)
QtCore.SIGNAL(u'valueChanged(int)'), controller.sendToPlugins) QtCore.QObject.connect(controller.volumeSlider, QtCore.SIGNAL(u'valueChanged(int)'), controller.sendToPlugins)
QtCore.QObject.connect(controller.volumeSlider,
QtCore.SIGNAL(u'valueChanged(int)'), controller.sendToPlugins)
def setup_special_controls(self, controller, control_panel):
"""
Special media Toolbars will be created here (e.g. for DVD Playback)
"""
controller.media_info = MediaInfo()
# TODO: add Toolbar for DVD, ...
def setup_display(self, display): def setup_display(self, display, preview):
""" """
After a new display is configured, all media related widget will be After a new display is configured, all media related widget will be
created too created too
``display``
Display on which the output is to be played
``preview``
Whether the display is a main or preview display
""" """
# clean up possible running old media files # clean up possible running old media files
self.finalise() self.finalise()
# update player status # update player status
self.set_active_players() self._set_active_players()
display.hasAudio = True display.hasAudio = True
if not self.withLivePreview and \ if display.isLive and preview:
display == self.parent.liveController.previewDisplay:
return return
if display == self.parent.previewController.previewDisplay or \ if preview:
display == self.parent.liveController.previewDisplay:
display.hasAudio = False display.hasAudio = False
for player in self.mediaPlayers.values(): for player in self.mediaPlayers.values():
if player.isActive: if player.isActive:
player.setup(display) player.setup(display)
def set_controls_visible(self, controller, value): def set_controls_visible(self, controller, value):
"""
After a new display is configured, all media related widget will be
created too
``controller``
The controller on which controls act.
``value``
control name to be changed.
"""
# Generic controls # Generic controls
controller.mediabar.setVisible(value) controller.mediabar.setVisible(value)
if controller.isLive and controller.display: if controller.isLive and controller.display:
if self.curDisplayMediaPlayer and value: if self.currentMediaPlayer and value:
if self.curDisplayMediaPlayer[controller.display] != \ if self.currentMediaPlayer[controller.controllerType] != self.mediaPlayers[u'webkit']:
self.mediaPlayers[u'webkit']:
controller.display.setTransparency(False) controller.display.setTransparency(False)
# Special controls: Here media type specific Controls will be enabled
# (e.g. for DVD control, ...)
# TODO
def resize(self, controller, display, player): def resize(self, display, player):
""" """
After Mainwindow changes or Splitter moved all related media widgets After Mainwindow changes or Splitter moved all related media widgets
have to be resized have to be resized
``display``
The display on which output is playing.
``player``
The player which is doing the playing.
""" """
player.resize(display) player.resize(display)
def video(self, controller, file, muted, isBackground, hidden=False, def video(self, source, serviceItem, hidden=False, videoBehindText=False):
isInfo=False, controlsVisible=True):
""" """
Loads and starts a video to run with the option of sound Loads and starts a video to run with the option of sound
``source``
Where the call originated form
``serviceItem``
The player which is doing the playing
``hidden``
The player which is doing the playing
``videoBehindText``
Is the video to be played behind text.
""" """
log.debug(u'video') log.debug(u'video')
isValid = False isValid = False
controller = self.displayControllers[source]
# stop running videos # stop running videos
self.video_reset(controller) self.media_reset(controller)
controller.media_info = MediaInfo() controller.media_info = MediaInfo()
if muted: if videoBehindText:
controller.media_info.volume = 0 controller.media_info.volume = 0
controller.media_info.is_background = True
else: else:
controller.media_info.volume = controller.volumeSlider.value() controller.media_info.volume = controller.volumeSlider.value()
controller.media_info.file_info = QtCore.QFileInfo(file) controller.media_info.is_background = False
controller.media_info.is_background = isBackground controller.media_info.file_info = QtCore.QFileInfo(serviceItem.get_frame_path())
display = None display = self._define_display(controller)
if controller.isLive: if controller.isLive:
if self.withLivePreview and controller.previewDisplay: isValid = self._check_file_type(controller, display, serviceItem)
display = controller.previewDisplay
isValid = self.check_file_type(controller, display)
display = controller.display
isValid = self.check_file_type(controller, display)
display.override[u'theme'] = u'' display.override[u'theme'] = u''
display.override[u'video'] = True display.override[u'video'] = True
if controller.media_info.is_background: if controller.media_info.is_background:
@ -325,103 +362,142 @@ class MediaController(object):
controller.media_info.start_time = 0 controller.media_info.start_time = 0
controller.media_info.end_time = 0 controller.media_info.end_time = 0
else: else:
controller.media_info.start_time = \ controller.media_info.start_time = display.serviceItem.start_time
display.serviceItem.start_time controller.media_info.end_time = serviceItem.end_time
controller.media_info.end_time = display.serviceItem.end_time
elif controller.previewDisplay: elif controller.previewDisplay:
display = controller.previewDisplay isValid = self._check_file_type(controller, display, serviceItem)
isValid = self.check_file_type(controller, display)
if not isValid: if not isValid:
# Media could not be loaded correctly # Media could not be loaded correctly
critical_error_message_box( critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
translate('MediaPlugin.MediaItem', 'Unsupported File'), unicode(translate('MediaPlugin.MediaItem', 'Unsupported File')))
unicode(translate('MediaPlugin.MediaItem',
'Unsupported File')))
return False return False
# dont care about actual theme, set a black background # dont care about actual theme, set a black background
if controller.isLive and not controller.media_info.is_background: if controller.isLive and not controller.media_info.is_background:
display.frame.evaluateJavaScript(u'show_video( \ display.frame.evaluateJavaScript(u'show_video( "setBackBoard", null, null, null,"visible");')
"setBackBoard", null, null, null,"visible");')
# now start playing - Preview is autoplay! # now start playing - Preview is autoplay!
autoplay = False autoplay = False
# Preview requested # Preview requested
if not controller.isLive: if not controller.isLive:
autoplay = True autoplay = True
# Visible or background requested # Visible or background requested or Service Item wants to autostart
elif not hidden or controller.media_info.is_background: elif not hidden or controller.media_info.is_background or serviceItem.will_auto_start:
autoplay = True autoplay = True
# Unblank on load set # Unblank on load set
elif Settings().value(u'general/auto unblank', elif Settings().value(u'general/auto unblank', QtCore.QVariant(False)).toBool():
QtCore.QVariant(False)).toBool():
autoplay = True autoplay = True
# Start playback only for visible widgets. If we need just load a video if autoplay:
# and get video information, do not start playback. if not self.media_play(controller):
if autoplay and not isInfo: critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
if not self.video_play([controller]): unicode(translate('MediaPlugin.MediaItem', 'Unsupported File')))
critical_error_message_box(
translate('MediaPlugin.MediaItem', 'Unsupported File'),
unicode(translate('MediaPlugin.MediaItem',
'Unsupported File')))
return False return False
self.set_controls_visible(controller, controlsVisible) self.set_controls_visible(controller, True)
log.debug(u'use %s controller' % self.curDisplayMediaPlayer[display]) log.debug(u'use %s controller' % self.currentMediaPlayer[controller.controllerType])
return True return True
def check_file_type(self, controller, display): def media_length(self, serviceItem):
"""
Loads and starts a media item to obtain the media length
``serviceItem``
The ServiceItem containing the details to be played.
"""
controller = self.displayControllers[DisplayControllerType.Plugin]
log.debug(u'media_length')
# stop running videos
self.media_reset(controller)
controller.media_info = MediaInfo()
controller.media_info.volume = 0
controller.media_info.file_info = QtCore.QFileInfo(serviceItem.get_frame_path())
display = controller.previewDisplay
if not self._check_file_type(controller, display, serviceItem):
# Media could not be loaded correctly
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
unicode(translate('MediaPlugin.MediaItem', 'Unsupported File')))
return False
if not self.media_play(controller):
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
unicode(translate('MediaPlugin.MediaItem', 'Unsupported File')))
return False
serviceItem.set_media_length(controller.media_info.length)
self.media_stop(controller)
log.debug(u'use %s controller' % self.currentMediaPlayer[controller.controllerType])
return True
def _check_file_type(self, controller, display, serviceItem):
""" """
Select the correct media Player type from the prioritized Player list Select the correct media Player type from the prioritized Player list
``controller``
First element is the controller which should be used
``serviceItem``
The ServiceItem containing the details to be played.
""" """
usedPlayers, overriddenPlayer = get_media_players() usedPlayers = get_media_players()[0]
if overriddenPlayer and overriddenPlayer != u'auto': if serviceItem.title != UiStrings().Automatic:
usedPlayers = [overriddenPlayer] usedPlayers = [serviceItem.title.lower()]
if controller.media_info.file_info.isFile(): if controller.media_info.file_info.isFile():
suffix = u'*.%s' % \ suffix = u'*.%s' % controller.media_info.file_info.suffix().toLower()
controller.media_info.file_info.suffix().toLower()
for title in usedPlayers: for title in usedPlayers:
player = self.mediaPlayers[title] player = self.mediaPlayers[title]
if suffix in player.video_extensions_list: if suffix in player.video_extensions_list:
if not controller.media_info.is_background or \ if not controller.media_info.is_background or controller.media_info.is_background and \
controller.media_info.is_background and \
player.canBackground: player.canBackground:
self.resize(controller, display, player) self.resize(display, player)
if player.load(display): if player.load(display):
self.curDisplayMediaPlayer[display] = player self.currentMediaPlayer[controller.controllerType] = player
controller.media_info.media_type = MediaType.Video controller.media_info.media_type = MediaType.Video
return True return True
if suffix in player.audio_extensions_list: if suffix in player.audio_extensions_list:
if player.load(display): if player.load(display):
self.curDisplayMediaPlayer[display] = player self.currentMediaPlayer[controller.controllerType] = player
controller.media_info.media_type = MediaType.Audio controller.media_info.media_type = MediaType.Audio
return True return True
else: else:
for title in usedPlayers: for title in usedPlayers:
player = self.mediaPlayers[title] player = self.mediaPlayers[title]
if player.canFolder: if player.canFolder:
self.resize(controller, display, player) self.resize(display, player)
if player.load(display): if player.load(display):
self.curDisplayMediaPlayer[display] = player self.currentMediaPlayer[controller.controllerType] = player
controller.media_info.media_type = MediaType.Video controller.media_info.media_type = MediaType.Video
return True return True
# no valid player found # no valid player found
return False return False
def video_play(self, msg, status=True): def media_play_msg(self, msg, status=True):
""" """
Responds to the request to play a loaded video Responds to the request to play a loaded video
``msg`` ``msg``
First element is the controller which should be used First element is the controller which should be used
""" """
log.debug(u'video_play') log.debug(u'media_play_msg')
controller = msg[0] self.media_play(msg[0],status)
for display in self.curDisplayMediaPlayer.keys():
if display.controller == controller:
if not self.curDisplayMediaPlayer[display].play(display): def media_play(self, controller, status=True):
"""
Responds to the request to play a loaded video
``controller``
The controller to be played
"""
log.debug(u'media_play')
display = self._define_display(controller)
if not self.currentMediaPlayer[controller.controllerType].play(display):
return False return False
if status: if status:
display.frame.evaluateJavaScript(u'show_blank("desktop");') display.frame.evaluateJavaScript(u'show_blank("desktop");')
self.curDisplayMediaPlayer[display].set_visible(display, self.currentMediaPlayer[controller.controllerType].set_visible(display, True)
True) # Flash needs to be played and will not AutoPlay
if controller.media_info.is_flash:
controller.mediabar.actions[u'playbackPlay'].setVisible(True)
controller.mediabar.actions[u'playbackPause'].setVisible(False)
else:
controller.mediabar.actions[u'playbackPlay'].setVisible(False)
controller.mediabar.actions[u'playbackPause'].setVisible(True)
controller.mediabar.actions[u'playbackStop'].setVisible(True)
if controller.isLive: if controller.isLive:
if controller.hideMenu.defaultAction().isChecked(): if controller.hideMenu.defaultAction().isChecked():
controller.hideMenu.defaultAction().trigger() controller.hideMenu.defaultAction().trigger()
@ -430,36 +506,59 @@ class MediaController(object):
self.timer.start() self.timer.start()
return True return True
def video_pause(self, msg): def media_pause_msg(self, msg):
""" """
Responds to the request to pause a loaded video Responds to the request to pause a loaded video
``msg`` ``msg``
First element is the controller which should be used First element is the controller which should be used
""" """
log.debug(u'video_pause') log.debug(u'media_pause_msg')
controller = msg[0] self.media_pause( msg[0])
for display in self.curDisplayMediaPlayer.keys():
if display.controller == controller:
self.curDisplayMediaPlayer[display].pause(display)
def video_stop(self, msg): def media_pause(self, controller):
"""
Responds to the request to pause a loaded video
``controller``
The Controller to be paused
"""
log.debug(u'media_pause')
display = self._define_display(controller)
self.currentMediaPlayer[controller.controllerType].pause(display)
controller.mediabar.actions[u'playbackPlay'].setVisible(True)
controller.mediabar.actions[u'playbackStop'].setVisible(True)
controller.mediabar.actions[u'playbackPause'].setVisible(False)
def media_stop_msg(self, msg):
""" """
Responds to the request to stop a loaded video Responds to the request to stop a loaded video
``msg`` ``msg``
First element is the controller which should be used First element is the controller which should be used
""" """
log.debug(u'video_stop') log.debug(u'media_stop_msg')
controller = msg[0] self.media_stop(msg[0])
for display in self.curDisplayMediaPlayer.keys():
if display.controller == controller:
display.frame.evaluateJavaScript(u'show_blank("black");')
self.curDisplayMediaPlayer[display].stop(display)
self.curDisplayMediaPlayer[display].set_visible(display, False)
controller.seekSlider.setSliderPosition(0)
def video_volume(self, msg): def media_stop(self, controller):
"""
Responds to the request to stop a loaded video
``controller``
The controller that needs to be stopped
"""
log.debug(u'media_stop')
display = self._define_display(controller)
if controller.controllerType in self.currentMediaPlayer:
display.frame.evaluateJavaScript(u'show_blank("black");')
self.currentMediaPlayer[controller.controllerType].stop(display)
self.currentMediaPlayer[controller.controllerType].set_visible(display, False)
controller.seekSlider.setSliderPosition(0)
controller.mediabar.actions[u'playbackPlay'].setVisible(True)
controller.mediabar.actions[u'playbackStop'].setVisible(False)
controller.mediabar.actions[u'playbackPause'].setVisible(False)
def media_volume(self, msg):
""" """
Changes the volume of a running video Changes the volume of a running video
@ -468,12 +567,11 @@ class MediaController(object):
""" """
controller = msg[0] controller = msg[0]
vol = msg[1][0] vol = msg[1][0]
log.debug(u'video_volume %d' % vol) log.debug(u'media_volume %d' % vol)
for display in self.curDisplayMediaPlayer.keys(): display = self._define_display(controller)
if display.controller == controller: self.currentMediaPlayer[controller.controllerType].volume(display, vol)
self.curDisplayMediaPlayer[display].volume(display, vol)
def video_seek(self, msg): def media_seek(self, msg):
""" """
Responds to the request to change the seek Slider of a loaded video Responds to the request to change the seek Slider of a loaded video
@ -481,29 +579,27 @@ class MediaController(object):
First element is the controller which should be used First element is the controller which should be used
Second element is a list with the seek Value as first element Second element is a list with the seek Value as first element
""" """
log.debug(u'video_seek') log.debug(u'media_seek')
controller = msg[0] controller = msg[0]
seekVal = msg[1][0] seekVal = msg[1][0]
for display in self.curDisplayMediaPlayer.keys(): display = self._define_display(controller)
if display.controller == controller: self.currentMediaPlayer[controller.controllerType].seek(display, seekVal)
self.curDisplayMediaPlayer[display].seek(display, seekVal)
def video_reset(self, controller): def media_reset(self, controller):
""" """
Responds to the request to reset a loaded video Responds to the request to reset a loaded video
""" """
log.debug(u'video_reset') log.debug(u'media_reset')
self.set_controls_visible(controller, False) self.set_controls_visible(controller, False)
for display in self.curDisplayMediaPlayer.keys(): display = self._define_display(controller)
if display.controller == controller: if controller.controllerType in self.currentMediaPlayer:
display.override = {} display.override = {}
self.curDisplayMediaPlayer[display].reset(display) self.currentMediaPlayer[controller.controllerType].reset(display)
self.curDisplayMediaPlayer[display].set_visible(display, False) self.currentMediaPlayer[controller.controllerType].set_visible(display, False)
display.frame.evaluateJavaScript(u'show_video( \ display.frame.evaluateJavaScript(u'show_video( "setBackBoard", null, null, null,"hidden");')
"setBackBoard", null, null, null,"hidden");') del self.currentMediaPlayer[controller.controllerType]
del self.curDisplayMediaPlayer[display]
def video_hide(self, msg): def media_hide(self, msg):
""" """
Hide the related video Widget Hide the related video Widget
@ -513,15 +609,13 @@ class MediaController(object):
isLive = msg[1] isLive = msg[1]
if not isLive: if not isLive:
return return
controller = self.parent.liveController controller = self.mainWindow.liveController
for display in self.curDisplayMediaPlayer.keys(): display = self._define_display(controller)
if display.controller != controller or \ if self.currentMediaPlayer[controller.controllerType].state == MediaState.Playing:
self.curDisplayMediaPlayer[display].state != MediaState.Playing: self.currentMediaPlayer[controller.controllerType].pause(display)
continue self.currentMediaPlayer[controller.controllerType].set_visible(display, False)
self.curDisplayMediaPlayer[display].pause(display)
self.curDisplayMediaPlayer[display].set_visible(display, False)
def video_blank(self, msg): def media_blank(self, msg):
""" """
Blank the related video Widget Blank the related video Widget
@ -534,15 +628,13 @@ class MediaController(object):
if not isLive: if not isLive:
return return
Receiver.send_message(u'live_display_hide', hide_mode) Receiver.send_message(u'live_display_hide', hide_mode)
controller = self.parent.liveController controller = self.mainWindow.liveController
for display in self.curDisplayMediaPlayer.keys(): display = self._define_display(controller)
if display.controller != controller or \ if self.currentMediaPlayer[controller.controllerType].state == MediaState.Playing:
self.curDisplayMediaPlayer[display].state != MediaState.Playing: self.currentMediaPlayer[controller.controllerType].pause(display)
continue self.currentMediaPlayer[controller.controllerType].set_visible(display, False)
self.curDisplayMediaPlayer[display].pause(display)
self.curDisplayMediaPlayer[display].set_visible(display, False)
def video_unblank(self, msg): def media_unblank(self, msg):
""" """
Unblank the related video Widget Unblank the related video Widget
@ -554,35 +646,28 @@ class MediaController(object):
isLive = msg[1] isLive = msg[1]
if not isLive: if not isLive:
return return
controller = self.parent.liveController controller = self.mainWindow.liveController
for display in self.curDisplayMediaPlayer.keys(): display = self._define_display(controller)
if display.controller != controller or \ if controller.controllerType in self.currentMediaPlayer and \
self.curDisplayMediaPlayer[display].state != MediaState.Paused: self.currentMediaPlayer[controller.controllerType].state != MediaState.Playing:
continue if self.currentMediaPlayer[controller.controllerType].play(display):
if self.curDisplayMediaPlayer[display].play(display): self.currentMediaPlayer[controller.controllerType].set_visible(display, True)
self.curDisplayMediaPlayer[display].set_visible(display, True)
# Start Timer for ui updates # Start Timer for ui updates
if not self.timer.isActive(): if not self.timer.isActive():
self.timer.start() self.timer.start()
def get_audio_extensions_list(self):
audio_list = []
for player in self.mediaPlayers.values():
if player.isActive:
for item in player.audio_extensions_list:
if not item in audio_list:
audio_list.append(item)
return audio_list
def get_video_extensions_list(self):
video_list = []
for player in self.mediaPlayers.values():
if player.isActive:
video_list.extend([item for item in player.video_extensions_list
if item not in video_list])
return video_list
def finalise(self): def finalise(self):
self.timer.stop() self.timer.stop()
for controller in self.controller: for controller in self.displayControllers:
self.video_reset(controller) self.media_reset(self.displayControllers[controller])
def _define_display(self, controller):
"""
Extract the correct display for a given controller
``controller``
Controller to be used
"""
if controller.isLive:
return controller.display
return controller.previewDisplay

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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,8 +31,8 @@ from openlp.core.ui.media import MediaState
class MediaPlayer(object): class MediaPlayer(object):
""" """
This is the base class media Player class to provide OpenLP with a pluggable media display This is the base class media Player class to provide OpenLP with a
framework. pluggable media display framework.
""" """
def __init__(self, parent, name=u'media_player'): def __init__(self, parent, name=u'media_player'):
@ -137,3 +137,9 @@ class MediaPlayer(object):
Add html code to htmlbuilder Add html code to htmlbuilder
""" """
return u'' return u''
def get_info(self):
"""
Returns Information about the player
"""
return u''

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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,11 +31,15 @@ import logging
import mimetypes import mimetypes
from datetime import datetime from datetime import datetime
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver from openlp.core.lib import Receiver, translate
from openlp.core.lib.mediaplayer import MediaPlayer from openlp.core.lib.settings import Settings
from openlp.core.ui.media import MediaState from openlp.core.ui.media import MediaState
from openlp.core.ui.media.mediaplayer import MediaPlayer
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -56,6 +60,20 @@ ADDITIONAL_EXT = {
u'video/mpeg' : [u'.mp4', u'.mts', u'.mov'], u'video/mpeg' : [u'.mp4', u'.mts', u'.mov'],
u'video/x-ms-wmv': [u'.wmv']} u'video/x-ms-wmv': [u'.wmv']}
VIDEO_CSS = u"""
#videobackboard {
z-index:3;
background-color: %s;
}
#video1 {
background-color: %s;
z-index:4;
}
#video2 {
background-color: %s;
z-index:4;
}
"""
class PhononPlayer(MediaPlayer): class PhononPlayer(MediaPlayer):
""" """
@ -84,8 +102,7 @@ class PhononPlayer(MediaPlayer):
ext = u'*%s' % extension ext = u'*%s' % extension
if ext not in list: if ext not in list:
list.append(ext) list.append(ext)
log.info(u'MediaPlugin: %s extensions: %s' % (mimetype, log.info(u'MediaPlugin: %s extensions: %s' % (mimetype, u' '.join(extensions)))
u' '.join(extensions)))
# Add extensions for this mimetype from self.additional_extensions. # Add extensions for this mimetype from self.additional_extensions.
# This hack clears mimetypes' and operating system's shortcomings # This hack clears mimetypes' and operating system's shortcomings
# by providing possibly missing extensions. # by providing possibly missing extensions.
@ -94,8 +111,8 @@ class PhononPlayer(MediaPlayer):
ext = u'*%s' % extension ext = u'*%s' % extension
if ext not in list: if ext not in list:
list.append(ext) list.append(ext)
log.info(u'MediaPlugin: %s additional extensions: %s' % (mimetype, log.info(u'MediaPlugin: %s additional extensions: %s' %
u' '.join(self.additional_extensions[mimetype]))) (mimetype, u' '.join(self.additional_extensions[mimetype])))
def setup(self, display): def setup(self, display):
display.phononWidget = Phonon.VideoWidget(display) display.phononWidget = Phonon.VideoWidget(display)
@ -103,8 +120,7 @@ class PhononPlayer(MediaPlayer):
display.mediaObject = Phonon.MediaObject(display) display.mediaObject = Phonon.MediaObject(display)
Phonon.createPath(display.mediaObject, display.phononWidget) Phonon.createPath(display.mediaObject, display.phononWidget)
if display.hasAudio: if display.hasAudio:
display.audio = Phonon.AudioOutput( display.audio = Phonon.AudioOutput(Phonon.VideoCategory, display.mediaObject)
Phonon.VideoCategory, display.mediaObject)
Phonon.createPath(display.mediaObject, display.audio) Phonon.createPath(display.mediaObject, display.audio)
display.phononWidget.raise_() display.phononWidget.raise_()
display.phononWidget.hide() display.phononWidget.hide()
@ -155,8 +171,7 @@ class PhononPlayer(MediaPlayer):
if start_time > 0: if start_time > 0:
self.seek(display, controller.media_info.start_time * 1000) self.seek(display, controller.media_info.start_time * 1000)
self.volume(display, controller.media_info.volume) self.volume(display, controller.media_info.volume)
controller.media_info.length = \ controller.media_info.length = int(display.mediaObject.totalTime() / 1000)
int(display.mediaObject.totalTime() / 1000)
controller.seekSlider.setMaximum(controller.media_info.length * 1000) controller.seekSlider.setMaximum(controller.media_info.length * 1000)
self.state = MediaState.Playing self.state = MediaState.Playing
display.phononWidget.raise_() display.phononWidget.raise_()
@ -193,15 +208,29 @@ class PhononPlayer(MediaPlayer):
display.phononWidget.setVisible(status) display.phononWidget.setVisible(status)
def update_ui(self, display): def update_ui(self, display):
if display.mediaObject.state() == Phonon.PausedState and \ if display.mediaObject.state() == Phonon.PausedState and self.state != MediaState.Paused:
self.state != MediaState.Paused:
self.stop(display) self.stop(display)
controller = display.controller controller = display.controller
if controller.media_info.end_time > 0: if controller.media_info.end_time > 0:
if display.mediaObject.currentTime() > \ if display.mediaObject.currentTime() > controller.media_info.end_time * 1000:
controller.media_info.end_time * 1000:
self.stop(display) self.stop(display)
self.set_visible(display, False) self.set_visible(display, False)
if not controller.seekSlider.isSliderDown(): if not controller.seekSlider.isSliderDown():
controller.seekSlider.setSliderPosition( controller.seekSlider.setSliderPosition(
display.mediaObject.currentTime()) display.mediaObject.currentTime())
def get_media_display_css(self):
"""
Add css style sheets to htmlbuilder
"""
background = unicode(QtGui.QColor(Settings().value(u'players/background color',
QtCore.QVariant(u'#000000'))).name())
return VIDEO_CSS % (background,background,background)
def get_info(self):
return(translate('Media.player', 'Phonon is a media player which '
'interacts with the operating system to provide media capabilities.') +
u'<br/> <strong>' + translate('Media.player', 'Audio') +
u'</strong><br/>' + unicode(self.audio_extensions_list) +
u'<br/><strong>' + translate('Media.player', 'Video') +
u'</strong><br/>' + unicode(self.video_extensions_list) + u'<br/>')

View File

@ -0,0 +1,236 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2012 Raoul Snyman #
# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Eric Ludin, Edwin Lunando, Brian T. Meyer, #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Erode Woldsund, Martin Zibricky #
# --------------------------------------------------------------------------- #
# 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, translate, Receiver
from openlp.core.lib.ui import UiStrings, create_button
from openlp.core.lib.settings import Settings
from openlp.core.ui.media import get_media_players, set_media_players
class MediaQCheckBox(QtGui.QCheckBox):
"""
MediaQCheckBox adds an extra property, playerName to the QCheckBox class.
"""
def setPlayerName(self, name):
self.playerName = name
class PlayerTab(SettingsTab):
"""
MediaTab is the Media settings tab in the settings dialog.
"""
def __init__(self, parent, mainWindow):
self.parent = parent
self.mainWindow = mainWindow
self.mediaPlayers = mainWindow.mediaController.mediaPlayers
self.savedUsedPlayers = None
self.iconPath = u':/media/multimedia-player.png'
player_translated = translate('OpenLP.PlayerTab', 'Players')
SettingsTab.__init__(self, parent, u'Players', player_translated)
def setupUi(self):
self.setObjectName(u'MediaTab')
SettingsTab.setupUi(self)
self.bgColorGroupBox = QtGui.QGroupBox(self.leftColumn)
self.bgColorGroupBox.setObjectName(u'FontGroupBox')
self.formLayout = QtGui.QFormLayout(self.bgColorGroupBox)
self.formLayout.setObjectName(u'FormLayout')
self.colorLayout = QtGui.QHBoxLayout()
self.backgroundColorLabel = QtGui.QLabel(self.bgColorGroupBox)
self.backgroundColorLabel.setObjectName(u'BackgroundColorLabel')
self.colorLayout.addWidget(self.backgroundColorLabel)
self.backgroundColorButton = QtGui.QPushButton(self.bgColorGroupBox)
self.backgroundColorButton.setObjectName(u'BackgroundColorButton')
self.colorLayout.addWidget(self.backgroundColorButton)
self.formLayout.addRow(self.colorLayout)
self.informationLabel = QtGui.QLabel(self.bgColorGroupBox)
self.informationLabel.setObjectName(u'InformationLabel')
self.informationLabel.setWordWrap(True)
self.formLayout.addRow(self.informationLabel)
self.leftLayout.addWidget(self.bgColorGroupBox)
self.leftLayout.addStretch()
self.rightColumn.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.rightLayout.addStretch()
self.mediaPlayerGroupBox = QtGui.QGroupBox(self.leftColumn)
self.mediaPlayerGroupBox.setObjectName(u'mediaPlayerGroupBox')
self.mediaPlayerLayout = QtGui.QVBoxLayout(self.mediaPlayerGroupBox)
self.mediaPlayerLayout.setObjectName(u'mediaPlayerLayout')
self.playerCheckBoxes = {}
self.leftLayout.addWidget(self.mediaPlayerGroupBox)
self.playerOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
self.playerOrderGroupBox.setObjectName(u'playerOrderGroupBox')
self.playerOrderLayout = QtGui.QHBoxLayout(self.playerOrderGroupBox)
self.playerOrderLayout.setObjectName(u'playerOrderLayout')
self.playerOrderlistWidget = QtGui.QListWidget(
self.playerOrderGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.playerOrderlistWidget.sizePolicy().hasHeightForWidth())
self.playerOrderlistWidget.setSizePolicy(sizePolicy)
self.playerOrderlistWidget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.playerOrderlistWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.playerOrderlistWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.playerOrderlistWidget.setObjectName(u'playerOrderlistWidget')
self.playerOrderLayout.addWidget(self.playerOrderlistWidget)
self.orderingButtonLayout = QtGui.QVBoxLayout()
self.orderingButtonLayout.setObjectName(u'orderingButtonLayout')
self.orderingButtonLayout.addStretch(1)
self.orderingUpButton = create_button(self, u'orderingUpButton', role=u'up', click=self.onUpButtonClicked)
self.orderingDownButton = create_button(self, u'orderingDownButton', role=u'down',
click=self.onDownButtonClicked)
self.orderingButtonLayout.addWidget(self.orderingUpButton)
self.orderingButtonLayout.addWidget(self.orderingDownButton)
self.orderingButtonLayout.addStretch(1)
self.playerOrderLayout.addLayout(self.orderingButtonLayout)
self.leftLayout.addWidget(self.playerOrderGroupBox)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
# Signals and slots
QtCore.QObject.connect(self.backgroundColorButton, QtCore.SIGNAL(u'clicked()'),
self.onbackgroundColorButtonClicked)
def retranslateUi(self):
self.mediaPlayerGroupBox.setTitle(translate('OpenLP.PlayerTab', 'Available Media Players'))
self.playerOrderGroupBox.setTitle(translate('OpenLP.PlayerTab', 'Player Search Order'))
self.bgColorGroupBox.setTitle(UiStrings().BackgroundColor)
self.backgroundColorLabel.setText(UiStrings().DefaultColor)
self.informationLabel.setText(translate('OpenLP.PlayerTab',
'Visible background for videos with aspect ratio different to screen.'))
self.retranslatePlayers()
def onbackgroundColorButtonClicked(self):
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.bg_color), self)
if new_color.isValid():
self.bg_color = new_color.name()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)
def onPlayerCheckBoxChanged(self, check_state):
player = self.sender().playerName
if check_state == QtCore.Qt.Checked:
if player not in self.usedPlayers:
self.usedPlayers.append(player)
else:
if player in self.usedPlayers:
self.usedPlayers.remove(player)
self.updatePlayerList()
def updatePlayerList(self):
self.playerOrderlistWidget.clear()
for player in self.usedPlayers:
if player in self.playerCheckBoxes.keys():
if len(self.usedPlayers) == 1:
# At least one media player has to stay active
self.playerCheckBoxes[u'%s' % player].setEnabled(False)
else:
self.playerCheckBoxes[u'%s' % player].setEnabled(True)
self.playerOrderlistWidget.addItem(self.mediaPlayers[unicode(player)].original_name)
def onUpButtonClicked(self):
row = self.playerOrderlistWidget.currentRow()
if row <= 0:
return
item = self.playerOrderlistWidget.takeItem(row)
self.playerOrderlistWidget.insertItem(row - 1, item)
self.playerOrderlistWidget.setCurrentRow(row - 1)
self.usedPlayers.insert(row - 1, self.usedPlayers.pop(row))
def onDownButtonClicked(self):
row = self.playerOrderlistWidget.currentRow()
if row == -1 or row > self.playerOrderlistWidget.count() - 1:
return
item = self.playerOrderlistWidget.takeItem(row)
self.playerOrderlistWidget.insertItem(row + 1, item)
self.playerOrderlistWidget.setCurrentRow(row + 1)
self.usedPlayers.insert(row + 1, self.usedPlayers.pop(row))
def load(self):
if self.savedUsedPlayers:
self.usedPlayers = self.savedUsedPlayers
self.usedPlayers = get_media_players()[0]
self.savedUsedPlayers = self.usedPlayers
settings = Settings()
settings.beginGroup(self.settingsSection)
self.updatePlayerList()
self.bg_color = unicode(settings.value(u'background color', QtCore.QVariant(u'#000000')).toString())
self.initial_color = self.bg_color
settings.endGroup()
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)
def save(self):
player_string_changed = False
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
settings.endGroup()
old_players, override_player = get_media_players()
if self.usedPlayers != old_players:
# clean old Media stuff
set_media_players(self.usedPlayers, override_player)
player_string_changed = True
if player_string_changed:
self.parent.resetSupportedSuffixes()
Receiver.send_message(u'mediaitem_media_rebuild')
Receiver.send_message(u'config_screen_changed')
def postSetUp(self, postUpdate=False):
"""
Late setup for players as the MediaController has to be initialised
first.
"""
for key, player in self.mediaPlayers.iteritems():
player = self.mediaPlayers[key]
checkbox = MediaQCheckBox(self.mediaPlayerGroupBox)
checkbox.setEnabled(player.available)
checkbox.setObjectName(player.name + u'CheckBox')
checkbox.setToolTip(player.get_info())
checkbox.setPlayerName(player.name)
self.playerCheckBoxes[player.name] = checkbox
QtCore.QObject.connect(checkbox,QtCore.SIGNAL(u'stateChanged(int)'), self.onPlayerCheckBoxChanged)
self.mediaPlayerLayout.addWidget(checkbox)
if player.available and player.name in self.usedPlayers:
checkbox.setChecked(True)
else:
checkbox.setChecked(False)
self.updatePlayerList()
self.retranslatePlayers()
def retranslatePlayers(self):
"""
Translations for players is dependent on their setup as well
"""
for key in self.mediaPlayers:
player = self.mediaPlayers[key]
checkbox = self.playerCheckBoxes[player.name]
checkbox.setPlayerName(player.name)
if player.available:
checkbox.setText(player.display_name)
else:
checkbox.setText(unicode(translate('OpenLP.PlayerTab', '%s (unavailable)')) % player.display_name)

28
openlp/core/ui/media/vendor/__init__.py vendored Normal file
View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2012 Raoul Snyman #
# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Eric Ludin, Edwin Lunando, Brian T. Meyer, #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Erode Woldsund, Martin Zibricky #
# --------------------------------------------------------------------------- #
# 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 #
###############################################################################

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -35,16 +35,16 @@ import sys
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver from openlp.core.lib import Receiver, translate
from openlp.core.lib.settings import Settings from openlp.core.lib.settings import Settings
from openlp.core.lib.mediaplayer import MediaPlayer
from openlp.core.ui.media import MediaState from openlp.core.ui.media import MediaState
from openlp.core.ui.media.mediaplayer import MediaPlayer
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
VLC_AVAILABLE = False VLC_AVAILABLE = False
try: try:
import vlc from openlp.core.ui.media.vendor import vlc
VLC_AVAILABLE = bool(vlc.get_default_instance()) VLC_AVAILABLE = bool(vlc.get_default_instance())
except (ImportError, NameError, NotImplementedError): except (ImportError, NameError, NotImplementedError):
pass pass
@ -114,9 +114,7 @@ class VlcPlayer(MediaPlayer):
command_line_options = u'--no-video-title-show' command_line_options = u'--no-video-title-show'
if not display.hasAudio: if not display.hasAudio:
command_line_options += u' --no-audio --no-video-title-show' command_line_options += u' --no-audio --no-video-title-show'
if Settings().value(u'advanced/hide mouse', if Settings().value(u'advanced/hide mouse', QtCore.QVariant(True)).toBool() and display.controller.isLive:
QtCore.QVariant(False)).toBool() and \
display.controller.isLive:
command_line_options += u' --mouse-hide-timeout=0' command_line_options += u' --mouse-hide-timeout=0'
display.vlcInstance = vlc.Instance(command_line_options) display.vlcInstance = vlc.Instance(command_line_options)
display.vlcInstance.set_log_verbosity(2) display.vlcInstance.set_log_verbosity(2)
@ -149,8 +147,7 @@ class VlcPlayer(MediaPlayer):
log.debug(u'load vid in Vlc Controller') log.debug(u'load vid in Vlc Controller')
controller = display.controller controller = display.controller
volume = controller.media_info.volume volume = controller.media_info.volume
file_path = str( file_path = str(controller.media_info.file_info.absoluteFilePath().toUtf8())
controller.media_info.file_info.absoluteFilePath().toUtf8())
path = os.path.normcase(file_path) path = os.path.normcase(file_path)
# create the media # create the media
display.vlcMedia = display.vlcInstance.media_new_path(path) display.vlcMedia = display.vlcInstance.media_new_path(path)
@ -164,8 +161,7 @@ class VlcPlayer(MediaPlayer):
# and once to just get media length. # and once to just get media length.
# #
# Media plugin depends on knowing media length before playback. # Media plugin depends on knowing media length before playback.
controller.media_info.length = \ controller.media_info.length = int(display.vlcMediaPlayer.get_media().get_duration() / 1000)
int(display.vlcMediaPlayer.get_media().get_duration() / 1000)
return True return True
def media_state_wait(self, display, mediaState): def media_state_wait(self, display, mediaState):
@ -188,15 +184,14 @@ class VlcPlayer(MediaPlayer):
def play(self, display): def play(self, display):
controller = display.controller controller = display.controller
start_time = 0 start_time = 0
if controller.media_info.start_time > 0: if self.state != MediaState.Paused and controller.media_info.start_time > 0:
start_time = controller.media_info.start_time start_time = controller.media_info.start_time
display.vlcMediaPlayer.play() display.vlcMediaPlayer.play()
if not self.media_state_wait(display, vlc.State.Playing): if not self.media_state_wait(display, vlc.State.Playing):
return False return False
if start_time > 0: if start_time > 0:
self.seek(display, controller.media_info.start_time * 1000) self.seek(display, controller.media_info.start_time * 1000)
controller.media_info.length = \ controller.media_info.length = int(display.vlcMediaPlayer.get_media().get_duration() / 1000)
int(display.vlcMediaPlayer.get_media().get_duration() / 1000)
controller.seekSlider.setMaximum(controller.media_info.length * 1000) controller.seekSlider.setMaximum(controller.media_info.length * 1000)
self.state = MediaState.Playing self.state = MediaState.Playing
display.vlcWidget.raise_() display.vlcWidget.raise_()
@ -236,11 +231,16 @@ class VlcPlayer(MediaPlayer):
self.stop(display) self.stop(display)
controller = display.controller controller = display.controller
if controller.media_info.end_time > 0: if controller.media_info.end_time > 0:
if display.vlcMediaPlayer.get_time() > \ if display.vlcMediaPlayer.get_time() > controller.media_info.end_time * 1000:
controller.media_info.end_time * 1000:
self.stop(display) self.stop(display)
self.set_visible(display, False) self.set_visible(display, False)
if not controller.seekSlider.isSliderDown(): if not controller.seekSlider.isSliderDown():
controller.seekSlider.setSliderPosition( \ controller.seekSlider.setSliderPosition(display.vlcMediaPlayer.get_time())
display.vlcMediaPlayer.get_time())
def get_info(self):
return(translate('Media.player', 'VLC is an external player which '
'supports a number of different formats.') +
u'<br/> <strong>' + translate('Media.player', 'Audio') +
u'</strong><br/>' + unicode(AUDIO_EXT) + u'<br/><strong>' +
translate('Media.player', 'Video') + u'</strong><br/>' +
unicode(VIDEO_EXT) + u'<br/>')

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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,22 +27,28 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from PyQt4 import QtCore, QtGui
import logging import logging
from openlp.core.lib.mediaplayer import MediaPlayer from openlp.core.lib import translate
from openlp.core.ui.media import MediaState from openlp.core.ui.media import MediaState
from openlp.core.ui.media.mediaplayer import MediaPlayer
from openlp.core.lib.settings import Settings
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
VIDEO_CSS = u""" VIDEO_CSS = u"""
#videobackboard { #videobackboard {
z-index:3; z-index:3;
background-color: black; background-color: %s;
} }
#video1 { #video1 {
background-color: %s;
z-index:4; z-index:4;
} }
#video2 { #video2 {
background-color: %s;
z-index:4; z-index:4;
} }
""" """
@ -277,7 +283,10 @@ class WebkitPlayer(MediaPlayer):
""" """
Add css style sheets to htmlbuilder Add css style sheets to htmlbuilder
""" """
return VIDEO_CSS + FLASH_CSS background = unicode(QtGui.QColor(Settings().value(u'players/background color',
QtCore.QVariant(u'#000000'))).name())
css = VIDEO_CSS % (background,background,background)
return css + FLASH_CSS
def get_media_display_javascript(self): def get_media_display_javascript(self):
""" """
@ -315,16 +324,13 @@ class WebkitPlayer(MediaPlayer):
display.webView.setVisible(True) display.webView.setVisible(True)
if controller.media_info.file_info.suffix() == u'swf': if controller.media_info.file_info.suffix() == u'swf':
controller.media_info.is_flash = True controller.media_info.is_flash = True
js = u'show_flash("load","%s");' % \ js = u'show_flash("load","%s");' % (path.replace(u'\\', u'\\\\'))
(path.replace(u'\\', u'\\\\'))
else: else:
js = u'show_video("init", "%s", %s, %s);' % \ js = u'show_video("init", "%s", %s, %s);' % (path.replace(u'\\', u'\\\\'), str(vol), loop)
(path.replace(u'\\', u'\\\\'), str(vol), loop)
display.frame.evaluateJavaScript(js) display.frame.evaluateJavaScript(js)
return True return True
def resize(self, display): def resize(self, display):
controller = display.controller
display.webView.resize(display.size()) display.webView.resize(display.size())
def play(self, display): def play(self, display):
@ -332,8 +338,7 @@ class WebkitPlayer(MediaPlayer):
display.webLoaded = True display.webLoaded = True
length = 0 length = 0
start_time = 0 start_time = 0
if self.state != MediaState.Paused and \ if self.state != MediaState.Paused and controller.media_info.start_time > 0:
controller.media_info.start_time > 0:
start_time = controller.media_info.start_time start_time = controller.media_info.start_time
self.set_visible(display, True) self.set_visible(display, True)
if controller.media_info.is_flash: if controller.media_info.is_flash:
@ -399,19 +404,15 @@ class WebkitPlayer(MediaPlayer):
else: else:
is_visible = "hidden" is_visible = "hidden"
if controller.media_info.is_flash: if controller.media_info.is_flash:
display.frame.evaluateJavaScript(u'show_flash( \ display.frame.evaluateJavaScript(u'show_flash("setVisible", null, null, "%s");' % (is_visible))
"setVisible", null, null, "%s");' % (is_visible))
else: else:
display.frame.evaluateJavaScript(u'show_video( \ display.frame.evaluateJavaScript(u'show_video("setVisible", null, null, null, "%s");' % (is_visible))
"setVisible", null, null, null, "%s");' % (is_visible))
def update_ui(self, display): def update_ui(self, display):
controller = display.controller controller = display.controller
if controller.media_info.is_flash: if controller.media_info.is_flash:
currentTime = display.frame.evaluateJavaScript( currentTime = display.frame.evaluateJavaScript(u'show_flash("currentTime");').toInt()[0]
u'show_flash("currentTime");').toInt()[0] length = display.frame.evaluateJavaScript(u'show_flash("length");').toInt()[0]
length = display.frame.evaluateJavaScript(
u'show_flash("length");').toInt()[0]
else: else:
if display.frame.evaluateJavaScript( if display.frame.evaluateJavaScript(
u'show_video("isEnded");').toString() == 'true': u'show_video("isEnded");').toString() == 'true':
@ -421,8 +422,7 @@ class WebkitPlayer(MediaPlayer):
# check if conversion was ok and value is not 'NaN' # check if conversion was ok and value is not 'NaN'
if ok and currentTime != float('inf'): if ok and currentTime != float('inf'):
currentTime = int(currentTime * 1000) currentTime = int(currentTime * 1000)
(length, ok) = display.frame.evaluateJavaScript( (length, ok) = display.frame.evaluateJavaScript(u'show_video("length");').toFloat()
u'show_video("length");').toFloat()
# check if conversion was ok and value is not 'NaN' # check if conversion was ok and value is not 'NaN'
if ok and length != float('inf'): if ok and length != float('inf'):
length = int(length * 1000) length = int(length * 1000)
@ -431,3 +431,12 @@ class WebkitPlayer(MediaPlayer):
controller.seekSlider.setMaximum(length) controller.seekSlider.setMaximum(length)
if not controller.seekSlider.isSliderDown(): if not controller.seekSlider.isSliderDown():
controller.seekSlider.setSliderPosition(currentTime) controller.seekSlider.setSliderPosition(currentTime)
def get_info(self):
return(translate('Media.player', 'Webkit is a media player which runs '
'inside a web browser. This player allows text over video to be '
'rendered.') +
u'<br/> <strong>' + translate('Media.player', 'Audio') +
u'</strong><br/>' + unicode(AUDIO_EXT) + u'<br/><strong>' +
translate('Media.player', 'Video') + u'</strong><br/>' +
unicode(VIDEO_EXT) + u'<br/>')

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -39,17 +39,14 @@ log = logging.getLogger(__name__)
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \ from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, ItemCapabilities, SettingsManager, \
ItemCapabilities, SettingsManager, translate, str_to_bool, \ translate, str_to_bool, check_directory_exists
check_directory_exists
from openlp.core.lib.theme import ThemeLevel from openlp.core.lib.theme import ThemeLevel
from openlp.core.lib.settings import Settings from openlp.core.lib.settings import Settings
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ from openlp.core.lib.ui import UiStrings, critical_error_message_box, create_widget_action, find_and_set_in_combo_box
create_widget_action, find_and_set_in_combo_box
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
from openlp.core.ui.printserviceform import PrintServiceForm from openlp.core.ui.printserviceform import PrintServiceForm
from openlp.core.utils import AppLocation, delete_file, split_filename, \ from openlp.core.utils import AppLocation, delete_file, split_filename, format_time
format_time
from openlp.core.utils.actions import ActionList, CategoryOrder from openlp.core.utils.actions import ActionList, CategoryOrder
class ServiceManagerList(QtGui.QTreeWidget): class ServiceManagerList(QtGui.QTreeWidget):
@ -99,14 +96,16 @@ class ServiceManager(QtGui.QWidget):
""" """
Manages the services. This involves taking text strings from plugins and Manages the services. This involves taking text strings from plugins and
adding them to the service. This service can then be zipped up with all adding them to the service. This service can then be zipped up with all
the resources used into one OSZ file for use on any OpenLP v2 installation. the resources used into one OSZ or oszl file for use on any OpenLP v2
Also handles the UI tasks of moving things up and down etc. installation. Also handles the UI tasks of moving things up and down etc.
""" """
def __init__(self, mainwindow, parent=None): def __init__(self, mainwindow, parent=None):
""" """
Sets up the service manager, toolbars, list view, et al. Sets up the service manager, toolbars, list view, et al.
""" """
QtGui.QWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.active = build_icon(QtGui.QImage(u':/media/auto-start_active.png'))
self.inactive = build_icon(QtGui.QImage(u':/media/auto-start_inactive.png'))
self.mainwindow = mainwindow self.mainwindow = mainwindow
self.serviceItems = [] self.serviceItems = []
self.suffixes = [] self.suffixes = []
@ -125,30 +124,21 @@ class ServiceManager(QtGui.QWidget):
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.addToolbarAction(u'newService', self.toolbar.addToolbarAction(u'newService', text=UiStrings().NewService, icon=u':/general/general_new.png',
text=UiStrings().NewService, icon=u':/general/general_new.png', tooltip=UiStrings().CreateService, triggers=self.onNewServiceClicked)
tooltip=UiStrings().CreateService, self.toolbar.addToolbarAction(u'openService', text=UiStrings().OpenService, icon=u':/general/general_open.png',
triggers=self.onNewServiceClicked) tooltip=translate('OpenLP.ServiceManager', 'Load an existing service.'), triggers=self.onLoadServiceClicked)
self.toolbar.addToolbarAction(u'openService', self.toolbar.addToolbarAction(u'saveService', text=UiStrings().SaveService, icon=u':/general/general_save.png',
text=UiStrings().OpenService, icon=u':/general/general_open.png', tooltip=translate('OpenLP.ServiceManager', 'Save this service.'), triggers=self.decideSaveMethod)
tooltip=translate('OpenLP.ServiceManager',
'Load an existing service.'), triggers=self.onLoadServiceClicked)
self.toolbar.addToolbarAction(u'saveService',
text=UiStrings().SaveService, icon=u':/general/general_save.png',
tooltip=translate('OpenLP.ServiceManager', 'Save this service.'),
triggers=self.saveFile)
self.toolbar.addSeparator() self.toolbar.addSeparator()
self.themeLabel = QtGui.QLabel(u'%s:' % UiStrings().Theme, self) self.themeLabel = QtGui.QLabel(u'%s:' % UiStrings().Theme, self)
self.themeLabel.setMargin(3) self.themeLabel.setMargin(3)
self.themeLabel.setObjectName(u'themeLabel') self.themeLabel.setObjectName(u'themeLabel')
self.toolbar.addToolbarWidget(self.themeLabel) self.toolbar.addToolbarWidget(self.themeLabel)
self.themeComboBox = QtGui.QComboBox(self.toolbar) self.themeComboBox = QtGui.QComboBox(self.toolbar)
self.themeComboBox.setToolTip(translate('OpenLP.ServiceManager', self.themeComboBox.setToolTip(translate('OpenLP.ServiceManager', 'Select a theme for the service.'))
'Select a theme for the service.')) self.themeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.themeComboBox.setSizeAdjustPolicy( self.themeComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.themeComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.themeComboBox.setObjectName(u'themeComboBox') self.themeComboBox.setObjectName(u'themeComboBox')
self.toolbar.addToolbarWidget(self.themeComboBox) self.toolbar.addToolbarWidget(self.themeComboBox)
self.toolbar.setObjectName(u'toolbar') self.toolbar.setObjectName(u'toolbar')
@ -159,15 +149,12 @@ class ServiceManager(QtGui.QWidget):
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.SIGNAL('customContextMenuRequested(QPoint)'),
QtCore.QObject.connect(self.serviceManagerList,
QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
self.contextMenu) self.contextMenu)
self.serviceManagerList.setObjectName(u'serviceManagerList') self.serviceManagerList.setObjectName(u'serviceManagerList')
# enable drop # enable drop
@ -180,54 +167,37 @@ class ServiceManager(QtGui.QWidget):
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_category( action_list.add_category(
unicode(UiStrings().Service), CategoryOrder.standardToolbar) unicode(UiStrings().Service), CategoryOrder.standardToolbar)
self.serviceManagerList.moveTop = self.orderToolbar.addToolbarAction( self.serviceManagerList.moveTop = self.orderToolbar.addToolbarAction(u'moveTop',
u'moveTop', text=translate('OpenLP.ServiceManager', 'Move to &top'), text=translate('OpenLP.ServiceManager', 'Move to &top'), icon=u':/services/service_top.png',
icon=u':/services/service_top.png', tooltip=translate( tooltip=translate('OpenLP.ServiceManager', 'Move item to the top of the service.'),
'OpenLP.ServiceManager', 'Move item to the top of the service.'), shortcuts=[QtCore.Qt.Key_Home], category=UiStrings().Service, triggers=self.onServiceTop)
shortcuts=[QtCore.Qt.Key_Home], category=UiStrings().Service, self.serviceManagerList.moveUp = self.orderToolbar.addToolbarAction(u'moveUp',
triggers=self.onServiceTop) text=translate('OpenLP.ServiceManager', 'Move &up'), icon=u':/services/service_up.png',
self.serviceManagerList.moveUp = self.orderToolbar.addToolbarAction( tooltip=translate('OpenLP.ServiceManager', 'Move item up one position in the service.'),
u'moveUp', text=translate('OpenLP.ServiceManager', 'Move &up'), shortcuts=[QtCore.Qt.Key_PageUp], category=UiStrings().Service, triggers=self.onServiceUp)
icon=u':/services/service_up.png', self.serviceManagerList.moveDown = self.orderToolbar.addToolbarAction(u'moveDown',
tooltip=translate('OpenLP.ServiceManager', text=translate('OpenLP.ServiceManager', 'Move &down'), icon=u':/services/service_down.png',
'Move item up one position in the service.'), tooltip=translate('OpenLP.ServiceManager', 'Move item down one position in the service.'),
shortcuts=[QtCore.Qt.Key_PageUp], category=UiStrings().Service, shortcuts=[QtCore.Qt.Key_PageDown], category=UiStrings().Service, triggers=self.onServiceDown)
triggers=self.onServiceUp) self.serviceManagerList.moveBottom = self.orderToolbar.addToolbarAction(u'moveBottom',
self.serviceManagerList.moveDown = self.orderToolbar.addToolbarAction( text=translate('OpenLP.ServiceManager', 'Move to &bottom'), icon=u':/services/service_bottom.png',
u'moveDown', text=translate('OpenLP.ServiceManager', 'Move &down'), tooltip=translate('OpenLP.ServiceManager', 'Move item to the end of the service.'),
icon=u':/services/service_down.png', shortcuts=[QtCore.Qt.Key_End], category=UiStrings().Service, triggers=self.onServiceEnd)
tooltip=translate('OpenLP.ServiceManager', self.serviceManagerList.down = self.orderToolbar.addToolbarAction(u'down',
'Move item down one position in the service.'), text=translate('OpenLP.ServiceManager', 'Move &down'), tooltip=translate('OpenLP.ServiceManager',
shortcuts=[QtCore.Qt.Key_PageDown], category=UiStrings().Service, 'Moves the selection down the window.'), visible=False, shortcuts=[QtCore.Qt.Key_Down],
triggers=self.onServiceDown) triggers=self.onMoveSelectionDown)
self.serviceManagerList.moveBottom = self.orderToolbar.addToolbarAction(
u'moveBottom',
text=translate('OpenLP.ServiceManager', 'Move to &bottom'),
icon=u':/services/service_bottom.png', tooltip=translate(
'OpenLP.ServiceManager', 'Move item to the end of the service.'),
shortcuts=[QtCore.Qt.Key_End], category=UiStrings().Service,
triggers=self.onServiceEnd)
self.serviceManagerList.down = self.orderToolbar.addToolbarAction(
u'down', text=translate('OpenLP.ServiceManager', 'Move &down'),
tooltip=translate('OpenLP.ServiceManager',
'Moves the selection down the window.'), visible=False,
shortcuts=[QtCore.Qt.Key_Down], triggers=self.onMoveSelectionDown)
action_list.add_action(self.serviceManagerList.down) action_list.add_action(self.serviceManagerList.down)
self.serviceManagerList.up = self.orderToolbar.addToolbarAction( self.serviceManagerList.up = self.orderToolbar.addToolbarAction(u'up',
u'up', text=translate('OpenLP.ServiceManager', 'Move up'), text=translate('OpenLP.ServiceManager', 'Move up'), tooltip=translate('OpenLP.ServiceManager',
tooltip=translate('OpenLP.ServiceManager', 'Moves the selection up the window.'), visible=False, shortcuts=[QtCore.Qt.Key_Up],
'Moves the selection up the window.'), visible=False, triggers=self.onMoveSelectionUp)
shortcuts=[QtCore.Qt.Key_Up], triggers=self.onMoveSelectionUp)
action_list.add_action(self.serviceManagerList.up) action_list.add_action(self.serviceManagerList.up)
self.orderToolbar.addSeparator() self.orderToolbar.addSeparator()
self.serviceManagerList.delete = self.orderToolbar.addToolbarAction( self.serviceManagerList.delete = self.orderToolbar.addToolbarAction(u'delete',
u'delete', text=translate('OpenLP.ServiceManager', '&Delete From Service'), icon=u':/general/general_delete.png',
text=translate('OpenLP.ServiceManager', '&Delete From Service'), tooltip=translate('OpenLP.ServiceManager', 'Delete the selected item from the service.'),
icon=u':/general/general_delete.png', shortcuts=[QtCore.Qt.Key_Delete], triggers=self.onDeleteFromService)
tooltip=translate('OpenLP.ServiceManager',
'Delete the selected item from the service.'),
shortcuts=[QtCore.Qt.Key_Delete],
triggers=self.onDeleteFromService)
self.orderToolbar.addSeparator() self.orderToolbar.addSeparator()
self.serviceManagerList.expand = self.orderToolbar.addToolbarAction( self.serviceManagerList.expand = self.orderToolbar.addToolbarAction(
u'expand', text=translate('OpenLP.ServiceManager', '&Expand all'), u'expand', text=translate('OpenLP.ServiceManager', '&Expand all'),
@ -235,52 +205,35 @@ class ServiceManager(QtGui.QWidget):
'OpenLP.ServiceManager', 'Expand all the service items.'), 'OpenLP.ServiceManager', 'Expand all the service items.'),
shortcuts=[QtCore.Qt.Key_Plus], category=UiStrings().Service, shortcuts=[QtCore.Qt.Key_Plus], category=UiStrings().Service,
triggers=self.onExpandAll) triggers=self.onExpandAll)
self.serviceManagerList.collapse = self.orderToolbar.addToolbarAction( self.serviceManagerList.collapse = self.orderToolbar.addToolbarAction(u'collapse',
u'collapse', text=translate('OpenLP.ServiceManager', '&Collapse all'), icon=u':/services/service_collapse_all.png',
text=translate('OpenLP.ServiceManager', '&Collapse all'), tooltip=translate('OpenLP.ServiceManager', 'Collapse all the service items.'),
icon=u':/services/service_collapse_all.png', tooltip=translate( shortcuts=[QtCore.Qt.Key_Minus], category=UiStrings().Service, triggers=self.onCollapseAll)
'OpenLP.ServiceManager', 'Collapse all the service items.'),
shortcuts=[QtCore.Qt.Key_Minus], category=UiStrings().Service,
triggers=self.onCollapseAll)
self.orderToolbar.addSeparator() self.orderToolbar.addSeparator()
self.serviceManagerList.makeLive = self.orderToolbar.addToolbarAction( self.serviceManagerList.makeLive = self.orderToolbar.addToolbarAction(u'makeLive',
u'makeLive', text=translate('OpenLP.ServiceManager', 'Go Live'), text=translate('OpenLP.ServiceManager', 'Go Live'), icon=u':/general/general_live.png',
icon=u':/general/general_live.png', tooltip=translate( tooltip=translate('OpenLP.ServiceManager', 'Send the selected item to Live.'),
'OpenLP.ServiceManager', 'Send the selected item to Live.'), shortcuts=[QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return], category=UiStrings().Service, triggers=self.makeLive)
shortcuts=[QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
category=UiStrings().Service, triggers=self.makeLive)
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.SIGNAL(u'doubleClicked(QModelIndex)'), self.onMakeLive)
QtCore.QObject.connect(self.serviceManagerList, QtCore.QObject.connect(self.serviceManagerList, QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'),
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onMakeLive) self.collapsed)
QtCore.QObject.connect(self.serviceManagerList, QtCore.QObject.connect(self.serviceManagerList, QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded)
QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'), self.collapsed) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
QtCore.QObject.connect(self.serviceManagerList, QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_preview_live'), self.previewLive)
QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_next_item'), self.nextItem)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_previous_item'),
QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList) self.previousItem)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_set_item'), self.onSetItem)
QtCore.SIGNAL(u'servicemanager_preview_live'), self.previewLive) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configUpdated)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'),
QtCore.SIGNAL(u'servicemanager_next_item'), self.nextItem)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'servicemanager_previous_item'), self.previousItem)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'servicemanager_set_item'), self.onSetItem)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_screen_changed'),
self.regenerateServiceItems) self.regenerateServiceItems)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.themeChange)
QtCore.SIGNAL(u'theme_update_global'), self.themeChange) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'service_item_update'), self.serviceItemUpdate)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'service_item_update'), self.serviceItemUpdate)
# Last little bits of setting up # Last little bits of setting up
self.service_theme = unicode(Settings().value( self.service_theme = unicode(Settings().value(self.mainwindow.serviceManagerSettingsSection + u'/service theme',
self.mainwindow.serviceManagerSettingsSection + u'/service theme',
QtCore.QVariant(u'')).toString()) QtCore.QVariant(u'')).toString())
self.servicePath = AppLocation.get_section_data_path(u'servicemanager') self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
# build the drag and drop context menu # build the drag and drop context menu
@ -293,31 +246,25 @@ class ServiceManager(QtGui.QWidget):
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 = create_widget_action(self.menu, self.editAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Edit Item'),
text=translate('OpenLP.ServiceManager', '&Edit Item'),
icon=u':/general/general_edit.png', triggers=self.remoteEdit) icon=u':/general/general_edit.png', triggers=self.remoteEdit)
self.maintainAction = create_widget_action(self.menu, self.maintainAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Reorder Item'),
text=translate('OpenLP.ServiceManager', '&Reorder Item'), icon=u':/general/general_edit.png', triggers=self.onServiceItemEditForm)
icon=u':/general/general_edit.png', self.notesAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Notes'),
triggers=self.onServiceItemEditForm) icon=u':/services/service_notes.png', triggers=self.onServiceItemNoteForm)
self.notesAction = create_widget_action(self.menu, self.timeAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', '&Start Time'),
text=translate('OpenLP.ServiceManager', '&Notes'),
icon=u':/services/service_notes.png',
triggers=self.onServiceItemNoteForm)
self.timeAction = create_widget_action(self.menu,
text=translate('OpenLP.ServiceManager', '&Start Time'),
icon=u':/media/media_time.png', triggers=self.onStartTimeForm) icon=u':/media/media_time.png', triggers=self.onStartTimeForm)
self.autoStartAction = create_widget_action(self.menu, text=u'',
icon=u':/media/auto-start_active.png', triggers=self.onAutoStart)
# Add already existing delete action to the menu. # Add already existing delete action to the menu.
self.menu.addAction(self.serviceManagerList.delete) self.menu.addAction(self.serviceManagerList.delete)
self.menu.addSeparator() self.menu.addSeparator()
self.previewAction = create_widget_action(self.menu, self.previewAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', 'Show &Preview'),
text=translate('OpenLP.ServiceManager', 'Show &Preview'),
icon=u':/general/general_preview.png', triggers=self.makePreview) icon=u':/general/general_preview.png', triggers=self.makePreview)
# Add already existing make live action to the menu. # Add already existing make live action to the menu.
self.menu.addAction(self.serviceManagerList.makeLive) self.menu.addAction(self.serviceManagerList.makeLive)
self.menu.addSeparator() self.menu.addSeparator()
self.themeMenu = QtGui.QMenu( self.themeMenu = QtGui.QMenu(translate('OpenLP.ServiceManager', '&Change Item Theme'))
translate('OpenLP.ServiceManager', '&Change Item Theme'))
self.menu.addMenu(self.themeMenu) self.menu.addMenu(self.themeMenu)
self.serviceManagerList.addActions( self.serviceManagerList.addActions(
[self.serviceManagerList.moveDown, [self.serviceManagerList.moveDown,
@ -340,8 +287,7 @@ class ServiceManager(QtGui.QWidget):
if modified: if modified:
self.serviceId += 1 self.serviceId += 1
self._modified = modified self._modified = modified
serviceFile = self.shortFileName() or translate( serviceFile = self.shortFileName() or translate('OpenLP.ServiceManager', 'Untitled Service')
'OpenLP.ServiceManager', 'Untitled Service')
self.mainwindow.setServiceModified(modified, serviceFile) self.mainwindow.setServiceModified(modified, serviceFile)
def isModified(self): def isModified(self):
@ -357,8 +303,8 @@ class ServiceManager(QtGui.QWidget):
self._fileName = unicode(fileName) self._fileName = unicode(fileName)
self.mainwindow.setServiceModified(self.isModified(), self.mainwindow.setServiceModified(self.isModified(),
self.shortFileName()) self.shortFileName())
Settings(). \ Settings().setValue(u'servicemanager/last file',QtCore.QVariant(fileName))
setValue(u'servicemanager/last file',QtCore.QVariant(fileName)) self._saveLite = True if self._fileName.endswith(u'.oszl') else False
def fileName(self): def fileName(self):
""" """
@ -376,9 +322,14 @@ class ServiceManager(QtGui.QWidget):
""" """
Triggered when Config dialog is updated. Triggered when Config dialog is updated.
""" """
self.expandTabs = Settings().value( self.expandTabs = Settings().value(u'advanced/expand service item', QtCore.QVariant(u'False')).toBool()
u'advanced/expand service item',
QtCore.QVariant(u'False')).toBool() def resetSupportedSuffixes(self):
"""
Resets the Suffixes list.
"""
self.suffixes = []
def supportedSuffixes(self, suffix): def supportedSuffixes(self, suffix):
""" """
@ -387,6 +338,7 @@ class ServiceManager(QtGui.QWidget):
``suffix`` ``suffix``
New Suffix to be supported New Suffix to be supported
""" """
if not suffix in self.suffixes:
self.suffixes.append(suffix) self.suffixes.append(suffix)
def onNewServiceClicked(self): def onNewServiceClicked(self):
@ -398,7 +350,7 @@ class ServiceManager(QtGui.QWidget):
if result == QtGui.QMessageBox.Cancel: if result == QtGui.QMessageBox.Cancel:
return False return False
elif result == QtGui.QMessageBox.Save: elif result == QtGui.QMessageBox.Save:
if not self.saveFile(): if not self.decideSaveMethod():
return False return False
self.newFile() self.newFile()
@ -416,31 +368,25 @@ class ServiceManager(QtGui.QWidget):
if result == QtGui.QMessageBox.Cancel: if result == QtGui.QMessageBox.Cancel:
return False return False
elif result == QtGui.QMessageBox.Save: elif result == QtGui.QMessageBox.Save:
self.saveFile() self.decideSaveMethod()
if not loadFile: if not loadFile:
fileName = unicode(QtGui.QFileDialog.getOpenFileName( fileName = unicode(QtGui.QFileDialog.getOpenFileName(self.mainwindow,
self.mainwindow,
translate('OpenLP.ServiceManager', 'Open File'), translate('OpenLP.ServiceManager', 'Open File'),
SettingsManager.get_last_dir( SettingsManager.get_last_dir(self.mainwindow.serviceManagerSettingsSection),
self.mainwindow.serviceManagerSettingsSection), translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)')))
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz)')))
if not fileName: if not fileName:
return False return False
else: else:
fileName = loadFile fileName = loadFile
SettingsManager.set_last_dir( SettingsManager.set_last_dir(self.mainwindow.serviceManagerSettingsSection, split_filename(fileName)[0])
self.mainwindow.serviceManagerSettingsSection,
split_filename(fileName)[0])
self.loadFile(fileName) self.loadFile(fileName)
def saveModifiedService(self): def saveModifiedService(self):
return QtGui.QMessageBox.question(self.mainwindow, return QtGui.QMessageBox.question(self.mainwindow,
translate('OpenLP.ServiceManager', 'Modified Service'), translate('OpenLP.ServiceManager', 'Modified Service'),
translate('OpenLP.ServiceManager', 'The current service has ' translate('OpenLP.ServiceManager',
'been modified. Would you like to save this service?'), 'The current service has been modified. Would you like to save this service?'),
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
def onRecentServiceClicked(self): def onRecentServiceClicked(self):
sender = self.sender() sender = self.sender()
@ -455,8 +401,7 @@ class ServiceManager(QtGui.QWidget):
self.setFileName(u'') self.setFileName(u'')
self.serviceId += 1 self.serviceId += 1
self.setModified(False) self.setModified(False)
Settings(). \ Settings().setValue(u'servicemanager/last file',QtCore.QVariant(u''))
setValue(u'servicemanager/last file',QtCore.QVariant(u''))
Receiver.send_message(u'servicemanager_new_service') Receiver.send_message(u'servicemanager_new_service')
def saveFile(self): def saveFile(self):
@ -504,16 +449,12 @@ class ServiceManager(QtGui.QWidget):
write_list.append(path_from) write_list.append(path_from)
if missing_list: if missing_list:
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
title = unicode(translate('OpenLP.ServiceManager', title = unicode(translate('OpenLP.ServiceManager', 'Service File(s) Missing'))
'Service File(s) Missing'))
message = unicode(translate('OpenLP.ServiceManager', message = unicode(translate('OpenLP.ServiceManager',
'The following file(s) in the service are missing:\n\t%s\n\n' 'The following file(s) in the service are missing:\n\t%s\n\n'
'These files will be removed if you continue to save.') 'These files will be removed if you continue to save.')) % "\n\t".join(missing_list)
) % "\n\t".join(missing_list) answer = QtGui.QMessageBox.critical(self, title, message,
answer = QtGui.QMessageBox.critical(self, title, QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel))
message,
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel))
if answer == QtGui.QMessageBox.Cancel: if answer == QtGui.QMessageBox.Cancel:
self.mainwindow.finishedProgressBar() self.mainwindow.finishedProgressBar()
return False return False
@ -525,23 +466,21 @@ class ServiceManager(QtGui.QWidget):
if not item[u'service_item'].validate(): if not item[u'service_item'].validate():
self.serviceItems.remove(item) self.serviceItems.remove(item)
else: else:
service_item = item[u'service_item'].get_service_repr() service_item = item[u'service_item'].get_service_repr(self._saveLite)
if service_item[u'header'][u'background_audio']: if service_item[u'header'][u'background_audio']:
for i, filename in enumerate( for i, filename in enumerate(
service_item[u'header'][u'background_audio']): service_item[u'header'][u'background_audio']):
new_file = os.path.join(u'audio', new_file = os.path.join(u'audio',
item[u'service_item']._uuid, filename) item[u'service_item']._uuid, filename)
audio_files.append((filename, new_file)) audio_files.append((filename, new_file))
service_item[u'header'][u'background_audio'][i] = \ service_item[u'header'][u'background_audio'][i] = new_file
new_file
# Add the service item to the service. # Add the service item to the service.
service.append({u'serviceitem': service_item}) service.append({u'serviceitem': service_item})
self.repaintServiceList(-1, -1) self.repaintServiceList(-1, -1)
for file in write_list: for file in write_list:
file_size = os.path.getsize(file) file_size = os.path.getsize(file)
total_size += file_size total_size += file_size
log.debug(u'ServiceManager.saveFile - ZIP contents size is %i bytes' % log.debug(u'ServiceManager.saveFile - ZIP contents size is %i bytes' % total_size)
total_size)
service_content = cPickle.dumps(service) service_content = cPickle.dumps(service)
# Usual Zip file cannot exceed 2GiB, file with Zip64 cannot be # Usual Zip file cannot exceed 2GiB, file with Zip64 cannot be
# extracted using unzip in UNIX. # extracted using unzip in UNIX.
@ -551,8 +490,7 @@ class ServiceManager(QtGui.QWidget):
success = True success = True
self.mainwindow.incrementProgressBar() self.mainwindow.incrementProgressBar()
try: try:
zip = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, zip = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64)
allow_zip_64)
# First we add service contents. # First we add service contents.
# We save ALL filenames into ZIP using UTF-8. # We save ALL filenames into ZIP using UTF-8.
zip.writestr(service_file_name.encode(u'utf-8'), service_content) zip.writestr(service_file_name.encode(u'utf-8'), service_content)
@ -575,10 +513,70 @@ class ServiceManager(QtGui.QWidget):
except IOError: except IOError:
log.exception(u'Failed to save service to disk: %s', temp_file_name) log.exception(u'Failed to save service to disk: %s', temp_file_name)
Receiver.send_message(u'openlp_error_message', { Receiver.send_message(u'openlp_error_message', {
u'title': translate(u'OpenLP.ServiceManager', u'title': translate(u'OpenLP.ServiceManager', u'Error Saving File'),
u'Error Saving File'), u'message': translate(u'OpenLP.ServiceManager', u'There was an error saving your file.')
u'message': translate(u'OpenLP.ServiceManager', })
u'There was an error saving your file.') success = False
finally:
if zip:
zip.close()
self.mainwindow.finishedProgressBar()
Receiver.send_message(u'cursor_normal')
if success:
try:
shutil.copy(temp_file_name, path_file_name)
except:
return self.saveFileAs()
self.mainwindow.addRecentFile(path_file_name)
self.setModified(False)
delete_file(temp_file_name)
return success
def saveLocalFile(self):
"""
Save the current service file.
A temporary file is created so that we don't overwrite the existing one
and leave a mangled service file should there be an error when saving.
No files are added to this version of the service as it is deisgned
to only work on the machine it was save on if there are files.
"""
if not self.fileName():
return self.saveFileAs()
temp_file, temp_file_name = mkstemp(u'.oszl', u'openlp_')
# We don't need the file handle.
os.close(temp_file)
log.debug(temp_file_name)
path_file_name = unicode(self.fileName())
path, file_name = os.path.split(path_file_name)
basename = os.path.splitext(file_name)[0]
service_file_name = '%s.osd' % basename
log.debug(u'ServiceManager.saveFile - %s', path_file_name)
SettingsManager.set_last_dir(self.mainwindow.serviceManagerSettingsSection, path)
service = []
Receiver.send_message(u'cursor_busy')
# Number of items + 1 to zip it
self.mainwindow.displayProgressBar(len(self.serviceItems) + 1)
for item in self.serviceItems:
self.mainwindow.incrementProgressBar()
service_item = item[u'service_item'].get_service_repr(self._saveLite)
#@todo check for file item on save.
service.append({u'serviceitem': service_item})
self.mainwindow.incrementProgressBar()
service_content = cPickle.dumps(service)
zip = None
success = True
self.mainwindow.incrementProgressBar()
try:
zip = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED,
True)
# First we add service contents.
zip.writestr(service_file_name.encode(u'utf-8'), service_content)
except IOError:
log.exception(u'Failed to save service to disk: %s', temp_file_name)
Receiver.send_message(u'openlp_error_message', {
u'title': translate(u'OpenLP.ServiceManager', u'Error Saving File'),
u'message': translate(u'OpenLP.ServiceManager', u'There was an error saving your file.')
}) })
success = False success = False
finally: finally:
@ -601,40 +599,39 @@ class ServiceManager(QtGui.QWidget):
Get a file name and then call :func:`ServiceManager.saveFile` to Get a file name and then call :func:`ServiceManager.saveFile` to
save the file. save the file.
""" """
default_service_enabled = Settings().value( default_service_enabled = Settings().value(u'advanced/default service enabled', QtCore.QVariant(True)).toBool()
u'advanced/default service enabled', QtCore.QVariant(True)).toBool()
if default_service_enabled: if default_service_enabled:
service_day = Settings().value( service_day = Settings().value(u'advanced/default service day', 7).toInt()[0]
u'advanced/default service day', 7).toInt()[0]
if service_day == 7: if service_day == 7:
local_time = datetime.now() local_time = datetime.now()
else: else:
service_hour = Settings().value( service_hour = Settings().value(u'advanced/default service hour', 11).toInt()[0]
u'advanced/default service hour', 11).toInt()[0] service_minute = Settings().value(u'advanced/default service minute', 0).toInt()[0]
service_minute = Settings().value(
u'advanced/default service minute', 0).toInt()[0]
now = datetime.now() now = datetime.now()
day_delta = service_day - now.weekday() day_delta = service_day - now.weekday()
if day_delta < 0: if day_delta < 0:
day_delta += 7 day_delta += 7
time = now + timedelta(days=day_delta) time = now + timedelta(days=day_delta)
local_time = time.replace(hour=service_hour, minute=service_minute) local_time = time.replace(hour=service_hour, minute=service_minute)
default_pattern = unicode(Settings().value( default_pattern = unicode(Settings().value(u'advanced/default service name',
u'advanced/default service name',
translate('OpenLP.AdvancedTab', 'Service %Y-%m-%d %H-%M', translate('OpenLP.AdvancedTab', 'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: ' 'This may not contain any of the following characters: '
'/\\?*|<>\[\]":+\nSee http://docs.python.org/library/' '/\\?*|<>\[\]":+\nSee http://docs.python.org/library/'
'datetime.html#strftime-strptime-behavior for more ' 'datetime.html#strftime-strptime-behavior for more information.')).toString())
'information.')).toString())
default_filename = format_time(default_pattern, local_time) default_filename = format_time(default_pattern, local_time)
else: else:
default_filename = u'' default_filename = u''
directory = unicode(SettingsManager.get_last_dir( directory = unicode(SettingsManager.get_last_dir(self.mainwindow.serviceManagerSettingsSection))
self.mainwindow.serviceManagerSettingsSection))
path = os.path.join(directory, default_filename) path = os.path.join(directory, default_filename)
fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, # SaveAs from osz to oszl is not valid as the files will be deleted
UiStrings().SaveService, path, # on exit which is not sensible or usable in the long term.
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))) if self._fileName.endswith(u'oszl') or not self._fileName:
fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)')))
else:
fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz);;')))
if not fileName: if not fileName:
return False return False
if os.path.splitext(fileName)[1] == u'': if os.path.splitext(fileName)[1] == u'':
@ -643,9 +640,23 @@ class ServiceManager(QtGui.QWidget):
ext = os.path.splitext(fileName)[1] ext = os.path.splitext(fileName)[1]
fileName.replace(ext, u'.osz') fileName.replace(ext, u'.osz')
self.setFileName(fileName) self.setFileName(fileName)
self.decideSaveMethod()
def decideSaveMethod(self):
"""
Determine which type of save method to use.
"""
if not self.fileName():
return self.saveFileAs()
if self._saveLite:
return self.saveLocalFile()
else:
return self.saveFile() return self.saveFile()
def loadFile(self, fileName): def loadFile(self, fileName):
"""
Load an existing service file
"""
if not fileName: if not fileName:
return False return False
fileName = unicode(fileName) fileName = unicode(fileName)
@ -659,12 +670,9 @@ class ServiceManager(QtGui.QWidget):
try: try:
ucsfile = zipinfo.filename.decode(u'utf-8') ucsfile = zipinfo.filename.decode(u'utf-8')
except UnicodeDecodeError: except UnicodeDecodeError:
log.exception(u'Filename "%s" is not valid UTF-8' % log.exception(u'Filename "%s" is not valid UTF-8' % zipinfo.filename.decode(u'utf-8', u'replace'))
zipinfo.filename.decode(u'utf-8', u'replace')) critical_error_message_box(message=translate('OpenLP.ServiceManager',
critical_error_message_box( 'File is not a valid service.\n The content encoding is not UTF-8.'))
message=translate('OpenLP.ServiceManager',
'File is not a valid service.\n'
'The content encoding is not UTF-8.'))
continue continue
osfile = ucsfile.replace(u'/', os.path.sep) osfile = ucsfile.replace(u'/', os.path.sep)
if not osfile.startswith(u'audio'): if not osfile.startswith(u'audio'):
@ -680,52 +688,47 @@ class ServiceManager(QtGui.QWidget):
items = cPickle.load(fileTo) items = cPickle.load(fileTo)
fileTo.close() fileTo.close()
self.newFile() self.newFile()
self.setFileName(fileName)
self.mainwindow.displayProgressBar(len(items)) self.mainwindow.displayProgressBar(len(items))
for item in items: for item in items:
self.mainwindow.incrementProgressBar() self.mainwindow.incrementProgressBar()
serviceItem = ServiceItem() serviceItem = ServiceItem()
serviceItem.renderer = self.mainwindow.renderer serviceItem.renderer = self.mainwindow.renderer
if self._saveLite:
serviceItem.set_from_service(item)
else:
serviceItem.set_from_service(item, self.servicePath) serviceItem.set_from_service(item, self.servicePath)
self.validateItem(serviceItem) self.validateItem(serviceItem)
self.load_item_uuid = 0 self.load_item_uuid = 0
if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate): if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate):
Receiver.send_message(u'%s_service_load' % Receiver.send_message(u'%s_service_load' % serviceItem.name.lower(), serviceItem)
serviceItem.name.lower(), serviceItem)
# if the item has been processed # if the item has been processed
if serviceItem._uuid == self.load_item_uuid: if serviceItem._uuid == self.load_item_uuid:
serviceItem.edit_id = int(self.load_item_edit_id) serviceItem.edit_id = int(self.load_item_edit_id)
serviceItem.temporary_edit = self.load_item_temporary serviceItem.temporary_edit = self.load_item_temporary
self.addServiceItem(serviceItem, repaint=False) self.addServiceItem(serviceItem, repaint=False)
delete_file(p_file) delete_file(p_file)
self.setFileName(fileName)
self.mainwindow.addRecentFile(fileName) self.mainwindow.addRecentFile(fileName)
self.setModified(False) self.setModified(False)
Settings().setValue( Settings().setValue(u'servicemanager/last file', QtCore.QVariant(fileName))
'servicemanager/last file', QtCore.QVariant(fileName))
else: else:
critical_error_message_box( critical_error_message_box(message=translate('OpenLP.ServiceManager', 'File is not a valid service.'))
message=translate('OpenLP.ServiceManager',
'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, zipfile.BadZipfile): except (IOError, NameError, zipfile.BadZipfile):
log.exception(u'Problem loading service file %s' % fileName) log.exception(u'Problem loading service file %s' % fileName)
critical_error_message_box( critical_error_message_box(message=translate('OpenLP.ServiceManager',
message=translate('OpenLP.ServiceManager',
'File could not be opened because it is corrupt.')) 'File could not be opened because it is corrupt.'))
except zipfile.BadZipfile: except zipfile.BadZipfile:
if os.path.getsize(fileName) == 0: if os.path.getsize(fileName) == 0:
log.exception(u'Service file is zero sized: %s' % fileName) log.exception(u'Service file is zero sized: %s' % fileName)
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Empty File'),
translate('OpenLP.ServiceManager', 'Empty File'), translate('OpenLP.ServiceManager', 'This service file does not contain any data.'))
translate('OpenLP.ServiceManager', 'This service file '
'does not contain any data.'))
else: else:
log.exception(u'Service file is cannot be extracted as zip: ' log.exception(u'Service file is cannot be extracted as zip: '
u'%s' % fileName) u'%s' % fileName)
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
translate('OpenLP.ServiceManager', 'Corrupt File'), translate('OpenLP.ServiceManager',
translate('OpenLP.ServiceManager', 'This file is either ' 'This file is either corrupt or it is not an OpenLP 2 service file.'))
'corrupt or it is not an OpenLP 2.0 service file.'))
return return
finally: finally:
if fileTo: if fileTo:
@ -742,8 +745,7 @@ class ServiceManager(QtGui.QWidget):
service was last closed. Can be blank if there was no service service was last closed. Can be blank if there was no service
present. present.
""" """
fileName = Settings(). \ fileName = Settings().value(u'servicemanager/last file',QtCore.QVariant(u'')).toString()
value(u'servicemanager/last file',QtCore.QVariant(u'')).toString()
if fileName: if fileName:
self.loadFile(fileName) self.loadFile(fileName)
@ -760,28 +762,31 @@ class ServiceManager(QtGui.QWidget):
self.maintainAction.setVisible(False) self.maintainAction.setVisible(False)
self.notesAction.setVisible(False) self.notesAction.setVisible(False)
self.timeAction.setVisible(False) self.timeAction.setVisible(False)
if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanEdit)\ self.autoStartAction.setVisible(False)
and serviceItem[u'service_item'].edit_id: if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanEdit) and serviceItem[u'service_item'].edit_id:
self.editAction.setVisible(True) self.editAction.setVisible(True)
if serviceItem[u'service_item']\ if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanMaintain):
.is_capable(ItemCapabilities.CanMaintain):
self.maintainAction.setVisible(True) self.maintainAction.setVisible(True)
if item.parent() is None: if item.parent() is None:
self.notesAction.setVisible(True) self.notesAction.setVisible(True)
if serviceItem[u'service_item']\ if serviceItem[u'service_item'].is_capable(ItemCapabilities.HasVariableStartTime):
.is_capable(ItemCapabilities.HasVariableStartTime):
self.timeAction.setVisible(True) self.timeAction.setVisible(True)
if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanAutoStartForLive):
self.autoStartAction.setVisible(True)
self.autoStartAction.setIcon(self.inactive)
self.autoStartAction.setText(translate('OpenLP.ServiceManager','&Auto Start - inactive'))
if serviceItem[u'service_item'].will_auto_start:
self.autoStartAction.setText(translate('OpenLP.ServiceManager', '&Auto Start - active'))
self.autoStartAction.setIcon(self.active)
self.themeMenu.menuAction().setVisible(False) self.themeMenu.menuAction().setVisible(False)
# Set up the theme menu. # Set up the theme menu.
if serviceItem[u'service_item'].is_text() and \ if serviceItem[u'service_item'].is_text() and self.mainwindow.renderer.theme_level == ThemeLevel.Song:
self.mainwindow.renderer.theme_level == ThemeLevel.Song:
self.themeMenu.menuAction().setVisible(True) self.themeMenu.menuAction().setVisible(True)
# The service item does not have a theme, check the "Default". # The service item does not have a theme, check the "Default".
if serviceItem[u'service_item'].theme is None: if serviceItem[u'service_item'].theme is None:
themeAction = self.themeMenu.defaultAction() themeAction = self.themeMenu.defaultAction()
else: else:
themeAction = self.themeMenu.findChild( themeAction = self.themeMenu.findChild(QtGui.QAction, serviceItem[u'service_item'].theme)
QtGui.QAction, serviceItem[u'service_item'].theme)
if themeAction is not None: if themeAction is not None:
themeAction.setChecked(True) themeAction.setChecked(True)
self.menu.exec_(self.serviceManagerList.mapToGlobal(point)) self.menu.exec_(self.serviceManagerList.mapToGlobal(point))
@ -791,8 +796,7 @@ class ServiceManager(QtGui.QWidget):
self.serviceNoteForm.textEdit.setPlainText( self.serviceNoteForm.textEdit.setPlainText(
self.serviceItems[item][u'service_item'].notes) self.serviceItems[item][u'service_item'].notes)
if self.serviceNoteForm.exec_(): if self.serviceNoteForm.exec_():
self.serviceItems[item][u'service_item'].notes = \ self.serviceItems[item][u'service_item'].notes = self.serviceNoteForm.textEdit.toPlainText()
self.serviceNoteForm.textEdit.toPlainText()
self.repaintServiceList(item, -1) self.repaintServiceList(item, -1)
self.setModified() self.setModified()
@ -805,6 +809,14 @@ class ServiceManager(QtGui.QWidget):
if self.startTimeForm.exec_(): if self.startTimeForm.exec_():
self.repaintServiceList(item, -1) self.repaintServiceList(item, -1)
def onAutoStart(self):
"""
Toggles to Auto Start Setting.
"""
item = self.findServiceItem()[0]
self.serviceItems[item][u'service_item'].will_auto_start = \
not self.serviceItems[item][u'service_item'].will_auto_start
def onServiceItemEditForm(self): def onServiceItemEditForm(self):
""" """
Opens a dialog to edit the service item and update the service Opens a dialog to edit the service item and update the service
@ -1030,22 +1042,18 @@ class ServiceManager(QtGui.QWidget):
if serviceitem.is_valid: if serviceitem.is_valid:
if serviceitem.notes: if serviceitem.notes:
icon = QtGui.QImage(serviceitem.icon) icon = QtGui.QImage(serviceitem.icon)
icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
QtCore.Qt.SmoothTransformation)
overlay = QtGui.QImage(':/services/service_item_notes.png') overlay = QtGui.QImage(':/services/service_item_notes.png')
overlay = overlay.scaled(80, 80, QtCore.Qt.KeepAspectRatio, overlay = overlay.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
QtCore.Qt.SmoothTransformation)
painter = QtGui.QPainter(icon) painter = QtGui.QPainter(icon)
painter.drawImage(0, 0, overlay) painter.drawImage(0, 0, overlay)
painter.end() painter.end()
treewidgetitem.setIcon(0, build_icon(icon)) treewidgetitem.setIcon(0, build_icon(icon))
elif serviceitem.temporary_edit: elif serviceitem.temporary_edit:
icon = QtGui.QImage(serviceitem.icon) icon = QtGui.QImage(serviceitem.icon)
icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
QtCore.Qt.SmoothTransformation)
overlay = QtGui.QImage(':/general/general_export.png') overlay = QtGui.QImage(':/general/general_export.png')
overlay = overlay.scaled(40, 40, QtCore.Qt.KeepAspectRatio, overlay = overlay.scaled(40, 40, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
QtCore.Qt.SmoothTransformation)
painter = QtGui.QPainter(icon) painter = QtGui.QPainter(icon)
painter.drawImage(40, 0, overlay) painter.drawImage(40, 0, overlay)
painter.end() painter.end()
@ -1053,29 +1061,23 @@ class ServiceManager(QtGui.QWidget):
else: else:
treewidgetitem.setIcon(0, serviceitem.iconic_representation) treewidgetitem.setIcon(0, serviceitem.iconic_representation)
else: else:
treewidgetitem.setIcon(0, treewidgetitem.setIcon(0, build_icon(u':/general/general_delete.png'))
build_icon(u':/general/general_delete.png'))
treewidgetitem.setText(0, serviceitem.get_display_title()) treewidgetitem.setText(0, serviceitem.get_display_title())
tips = [] tips = []
if serviceitem.temporary_edit: if serviceitem.temporary_edit:
tips.append(u'<strong>%s:</strong> <em>%s</em>' % tips.append(u'<strong>%s:</strong> <em>%s</em>' %
(unicode(translate('OpenLP.ServiceManager', 'Edit')), (unicode(translate('OpenLP.ServiceManager', 'Edit')),
(unicode(translate('OpenLP.ServiceManager', (unicode(translate('OpenLP.ServiceManager', 'Service copy only')))))
'Service copy only')))))
if serviceitem.theme and serviceitem.theme != -1: if serviceitem.theme and serviceitem.theme != -1:
tips.append(u'<strong>%s:</strong> <em>%s</em>' % tips.append(u'<strong>%s:</strong> <em>%s</em>' %
(unicode(translate('OpenLP.ServiceManager', 'Slide theme')), (unicode(translate('OpenLP.ServiceManager', 'Slide theme')), serviceitem.theme))
serviceitem.theme))
if serviceitem.notes: if serviceitem.notes:
tips.append(u'<strong>%s: </strong> %s' % tips.append(u'<strong>%s: </strong> %s' %
(unicode(translate('OpenLP.ServiceManager', 'Notes')), (unicode(translate('OpenLP.ServiceManager', 'Notes')), cgi.escape(unicode(serviceitem.notes))))
cgi.escape(unicode(serviceitem.notes)))) if item[u'service_item'].is_capable(ItemCapabilities.HasVariableStartTime):
if item[u'service_item'] \
.is_capable(ItemCapabilities.HasVariableStartTime):
tips.append(item[u'service_item'].get_media_time()) tips.append(item[u'service_item'].get_media_time())
treewidgetitem.setToolTip(0, u'<br>'.join(tips)) treewidgetitem.setToolTip(0, u'<br>'.join(tips))
treewidgetitem.setData(0, QtCore.Qt.UserRole, treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(item[u'order']))
QtCore.QVariant(item[u'order']))
treewidgetitem.setSelected(item[u'selected']) treewidgetitem.setSelected(item[u'selected'])
# Add the children to their parent treewidgetitem. # Add the children to their parent treewidgetitem.
for count, frame in enumerate(serviceitem.get_frames()): for count, frame in enumerate(serviceitem.get_frames()):
@ -1095,10 +1097,12 @@ class ServiceManager(QtGui.QWidget):
Validates the service item and if the suffix matches an accepted Validates the service item and if the suffix matches an accepted
one it allows the item to be displayed. one it allows the item to be displayed.
""" """
#@todo check file items exist
if serviceItem.is_command(): if serviceItem.is_command():
type = serviceItem._raw_frames[0][u'title'].split(u'.')[-1] type = serviceItem._raw_frames[0][u'title'].split(u'.')[-1]
if type.lower() not in self.suffixes: if type.lower() not in self.suffixes:
serviceItem.is_valid = False serviceItem.is_valid = False
#@todo check file items exist
def cleanUp(self): def cleanUp(self):
""" """
@ -1118,9 +1122,7 @@ class ServiceManager(QtGui.QWidget):
log.debug(u'onThemeComboBoxSelected') log.debug(u'onThemeComboBoxSelected')
self.service_theme = unicode(self.themeComboBox.currentText()) self.service_theme = unicode(self.themeComboBox.currentText())
self.mainwindow.renderer.set_service_theme(self.service_theme) self.mainwindow.renderer.set_service_theme(self.service_theme)
Settings().setValue( Settings().setValue(self.mainwindow.serviceManagerSettingsSection + u'/service theme',
self.mainwindow.serviceManagerSettingsSection +
u'/service theme',
QtCore.QVariant(self.service_theme)) QtCore.QVariant(self.service_theme))
self.regenerateServiceItems(True) self.regenerateServiceItems(True)
@ -1146,8 +1148,7 @@ class ServiceManager(QtGui.QWidget):
if self.serviceItems: if self.serviceItems:
for item in self.serviceItems: for item in self.serviceItems:
item[u'selected'] = False item[u'selected'] = False
serviceIterator = QtGui.QTreeWidgetItemIterator( serviceIterator = QtGui.QTreeWidgetItemIterator(self.serviceManagerList)
self.serviceManagerList)
selectedItem = None selectedItem = None
while serviceIterator.value(): while serviceIterator.value():
if serviceIterator.value().isSelected(): if serviceIterator.value().isSelected():
@ -1157,17 +1158,15 @@ class ServiceManager(QtGui.QWidget):
if selectedItem.parent() is None: if selectedItem.parent() is None:
pos = selectedItem.data(0, QtCore.Qt.UserRole).toInt()[0] pos = selectedItem.data(0, QtCore.Qt.UserRole).toInt()[0]
else: else:
pos = selectedItem.parent().data(0, QtCore.Qt.UserRole). \ pos = selectedItem.parent().data(0, QtCore.Qt.UserRole).toInt()[0]
toInt()[0]
self.serviceItems[pos - 1][u'selected'] = True self.serviceItems[pos - 1][u'selected'] = True
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:
self.addServiceItem( self.addServiceItem(item[u'service_item'], False, expand=item[u'expanded'], repaint=False,
item[u'service_item'], False, expand=item[u'expanded'], selected=item[u'selected'])
repaint=False, selected=item[u'selected'])
# Set to False as items may have changed rendering # Set to False as items may have changed rendering
# does not impact the saved song so True may also be valid # does not impact the saved song so True may also be valid
if changed: if changed:
@ -1191,18 +1190,15 @@ class ServiceManager(QtGui.QWidget):
if found. if found.
""" """
for itemcount, item in enumerate(self.serviceItems): for itemcount, item in enumerate(self.serviceItems):
if item[u'service_item'].edit_id == newItem.edit_id and \ if item[u'service_item'].edit_id == newItem.edit_id and item[u'service_item'].name == newItem.name:
item[u'service_item'].name == newItem.name:
newItem.render() newItem.render()
newItem.merge(item[u'service_item']) newItem.merge(item[u'service_item'])
item[u'service_item'] = newItem item[u'service_item'] = newItem
self.repaintServiceList(itemcount + 1, 0) self.repaintServiceList(itemcount + 1, 0)
self.mainwindow.liveController.replaceServiceManagerItem( self.mainwindow.liveController.replaceServiceManagerItem(newItem)
newItem)
self.setModified() self.setModified()
def addServiceItem(self, item, rebuild=False, expand=None, replace=False, def addServiceItem(self, item, rebuild=False, expand=None, replace=False, repaint=True, selected=False):
repaint=True, selected=False):
""" """
Add a Service item to the list Add a Service item to the list
@ -1258,10 +1254,9 @@ class ServiceManager(QtGui.QWidget):
self.mainwindow.previewController.addServiceManagerItem( self.mainwindow.previewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], child) self.serviceItems[item][u'service_item'], child)
else: else:
critical_error_message_box( critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
translate('OpenLP.ServiceManager', 'Missing Display Handler'), translate('OpenLP.ServiceManager',
translate('OpenLP.ServiceManager', 'Your item cannot be ' 'Your item cannot be displayed as there is no handler to display it'))
'displayed as there is no handler to display it'))
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
def getServiceItem(self): def getServiceItem(self):
@ -1304,17 +1299,13 @@ class ServiceManager(QtGui.QWidget):
QtCore.QVariant(False)).toBool(): QtCore.QVariant(False)).toBool():
item += 1 item += 1
if self.serviceItems and item < len(self.serviceItems) and \ if self.serviceItems and item < len(self.serviceItems) and \
self.serviceItems[item][u'service_item'].is_capable( self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.CanPreview):
ItemCapabilities.CanPreview): self.mainwindow.previewController.addServiceManagerItem(self.serviceItems[item][u'service_item'], 0)
self.mainwindow.previewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], 0)
self.mainwindow.liveController.previewListWidget.setFocus() self.mainwindow.liveController.previewListWidget.setFocus()
else: else:
critical_error_message_box( critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
translate('OpenLP.ServiceManager', 'Missing Display Handler'), translate('OpenLP.ServiceManager',
translate('OpenLP.ServiceManager', 'Your item cannot be ' 'Your item cannot be displayed as the plugin required to display it is missing or inactive'))
'displayed as the plugin required to display it is missing '
'or inactive'))
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
def remoteEdit(self): def remoteEdit(self):
@ -1322,10 +1313,8 @@ class ServiceManager(QtGui.QWidget):
Posts a remote edit message to a plugin to allow item to be edited. Posts a remote edit message to a plugin to allow item to be edited.
""" """
item = self.findServiceItem()[0] item = self.findServiceItem()[0]
if self.serviceItems[item][u'service_item']\ if self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.CanEdit):
.is_capable(ItemCapabilities.CanEdit): Receiver.send_message(u'%s_edit' % self.serviceItems[item][u'service_item'].name.lower(),
Receiver.send_message(u'%s_edit' %
self.serviceItems[item][u'service_item'].name.lower(),
u'L:%s' % self.serviceItems[item][u'service_item'].edit_id) u'L:%s' % self.serviceItems[item][u'service_item'].edit_id)
def findServiceItem(self): def findServiceItem(self):
@ -1379,6 +1368,9 @@ class ServiceManager(QtGui.QWidget):
filename = unicode(url.toLocalFile()) filename = unicode(url.toLocalFile())
if filename.endswith(u'.osz'): if filename.endswith(u'.osz'):
self.onLoadServiceClicked(filename) self.onLoadServiceClicked(filename)
elif filename.endswith(u'.oszl'):
# todo correct
self.onLoadServiceClicked(filename)
elif link.hasText(): elif link.hasText():
plugin = unicode(link.text()) plugin = unicode(link.text())
item = self.serviceManagerList.itemAt(event.pos()) item = self.serviceManagerList.itemAt(event.pos())
@ -1407,8 +1399,7 @@ class ServiceManager(QtGui.QWidget):
pos = self._getParentItemData(item) - 1 pos = self._getParentItemData(item) - 1
serviceItem = self.serviceItems[pos] serviceItem = self.serviceItems[pos]
if (plugin == serviceItem[u'service_item'].name and if (plugin == serviceItem[u'service_item'].name and
serviceItem[u'service_item'].is_capable( serviceItem[u'service_item'].is_capable(ItemCapabilities.CanAppend)):
ItemCapabilities.CanAppend)):
action = self.dndMenu.exec_(QtGui.QCursor.pos()) action = self.dndMenu.exec_(QtGui.QCursor.pos())
# New action required # New action required
if action == self.newAction: if action == self.newAction:
@ -1437,16 +1428,15 @@ class ServiceManager(QtGui.QWidget):
themeGroup.setObjectName(u'themeGroup') themeGroup.setObjectName(u'themeGroup')
# Create a "Default" theme, which allows the user to reset the item's # Create a "Default" theme, which allows the user to reset the item's
# theme to the service theme or global theme. # theme to the service theme or global theme.
defaultTheme = create_widget_action(self.themeMenu, defaultTheme = create_widget_action(self.themeMenu, text=UiStrings().Default, checked=False,
text=UiStrings().Default, checked=False,
triggers=self.onThemeChangeAction) triggers=self.onThemeChangeAction)
self.themeMenu.setDefaultAction(defaultTheme) self.themeMenu.setDefaultAction(defaultTheme)
themeGroup.addAction(defaultTheme) themeGroup.addAction(defaultTheme)
self.themeMenu.addSeparator() self.themeMenu.addSeparator()
for theme in theme_list: for theme in theme_list:
self.themeComboBox.addItem(theme) self.themeComboBox.addItem(theme)
themeGroup.addAction(create_widget_action(self.themeMenu, theme, themeGroup.addAction(create_widget_action(self.themeMenu, theme, text=theme, checked=False,
text=theme, checked=False, triggers=self.onThemeChangeAction)) triggers=self.onThemeChangeAction))
find_and_set_in_combo_box(self.themeComboBox, self.service_theme) find_and_set_in_combo_box(self.themeComboBox, self.service_theme)
self.mainwindow.renderer.set_service_theme(self.service_theme) self.mainwindow.renderer.set_service_theme(self.service_theme)
self.regenerateServiceItems() self.regenerateServiceItems()

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -35,6 +35,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, build_icon, PluginStatus from openlp.core.lib import Receiver, build_icon, PluginStatus
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab
from openlp.core.ui.media import PlayerTab
from settingsdialog import Ui_SettingsDialog from settingsdialog import Ui_SettingsDialog
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -47,6 +48,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
""" """
Initialise the settings form Initialise the settings form
""" """
self.mainWindow = mainWindow
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
# General tab # General tab
@ -55,6 +57,8 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
self.themesTab = ThemesTab(self, mainWindow) self.themesTab = ThemesTab(self, mainWindow)
# Advanced tab # Advanced tab
self.advancedTab = AdvancedTab(self) self.advancedTab = AdvancedTab(self)
# Advanced tab
self.playerTab = PlayerTab(self, mainWindow)
def exec_(self): def exec_(self):
# load all the settings # load all the settings
@ -65,7 +69,8 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
self.insertTab(self.generalTab, 0, PluginStatus.Active) self.insertTab(self.generalTab, 0, PluginStatus.Active)
self.insertTab(self.themesTab, 1, PluginStatus.Active) self.insertTab(self.themesTab, 1, PluginStatus.Active)
self.insertTab(self.advancedTab, 2, PluginStatus.Active) self.insertTab(self.advancedTab, 2, PluginStatus.Active)
count = 3 self.insertTab(self.playerTab, 3, PluginStatus.Active)
count = 4
for plugin in self.plugins: for plugin in self.plugins:
if plugin.settingsTab: if plugin.settingsTab:
self.insertTab(plugin.settingsTab, count, plugin.status) self.insertTab(plugin.settingsTab, count, plugin.status)
@ -94,6 +99,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
""" """
Process the form saving the settings Process the form saving the settings
""" """
self.resetSuffixes = True
for tabIndex in range(self.stackedLayout.count()): for tabIndex in range(self.stackedLayout.count()):
self.stackedLayout.widget(tabIndex).save() self.stackedLayout.widget(tabIndex).save()
# Must go after all settings are save # Must go after all settings are save
@ -115,6 +121,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
self.generalTab.postSetUp() self.generalTab.postSetUp()
self.themesTab.postSetUp() self.themesTab.postSetUp()
self.advancedTab.postSetUp() self.advancedTab.postSetUp()
self.playerTab.postSetUp()
for plugin in self.plugins: for plugin in self.plugins:
if plugin.settingsTab: if plugin.settingsTab:
plugin.settingsTab.postSetUp() plugin.settingsTab.postSetUp()
@ -125,3 +132,13 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
""" """
self.stackedLayout.setCurrentIndex(tabIndex) self.stackedLayout.setCurrentIndex(tabIndex)
self.stackedLayout.currentWidget().tabVisible() self.stackedLayout.currentWidget().tabVisible()
def resetSupportedSuffixes(self):
"""
Control the resetting of the serviceManager suffix list as can be
called by a number of settings tab and only needs to be called once
per save.
"""
if self.resetSuffixes:
self.mainWindow.serviceManagerContents.resetSupportedSuffixes()
self.resetSuffixes = False

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -223,10 +223,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
self.alternatePushButton.setChecked(column not in [0, 1]) self.alternatePushButton.setChecked(column not in [0, 1])
if column in [0, 1]: if column in [0, 1]:
self.primaryPushButton.setText(u'') self.primaryPushButton.setText(u'')
self.primaryPushButton.setFocus(QtCore.Qt.OtherFocusReason) self.primaryPushButton.setFocus()
else: else:
self.alternatePushButton.setText(u'') self.alternatePushButton.setText(u'')
self.alternatePushButton.setFocus(QtCore.Qt.OtherFocusReason) self.alternatePushButton.setFocus()
def onCurrentItemChanged(self, item=None, previousItem=None): def onCurrentItemChanged(self, item=None, previousItem=None):
""" """

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -39,23 +39,16 @@ from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
from openlp.core.lib.ui import UiStrings, create_action from openlp.core.lib.ui import UiStrings, create_action
from openlp.core.lib.settings import Settings from openlp.core.lib.settings import Settings
from openlp.core.lib import SlideLimits, ServiceItemAction from openlp.core.lib import SlideLimits, ServiceItemAction
from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList, \
DisplayControllerType
from openlp.core.utils.actions import ActionList, CategoryOrder from openlp.core.utils.actions import ActionList, CategoryOrder
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class SlideList(QtGui.QTableWidget):
"""
Customised version of QTableWidget which can respond to keyboard
events.
"""
def __init__(self, parent=None):
QtGui.QTableWidget.__init__(self, parent.controller)
class DisplayController(QtGui.QWidget):
class Controller(QtGui.QWidget):
""" """
Controller is a general controller widget. Controller is a general display controller widget.
""" """
def __init__(self, parent, isLive=False): def __init__(self, parent, isLive=False):
""" """
@ -64,6 +57,7 @@ class Controller(QtGui.QWidget):
QtGui.QWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.isLive = isLive self.isLive = isLive
self.display = None self.display = None
self.controllerType = DisplayControllerType.Plugin
def sendToPlugins(self, *args): def sendToPlugins(self, *args):
""" """
@ -71,13 +65,12 @@ class Controller(QtGui.QWidget):
created from within other plugins created from within other plugins
This function is needed to catch the current controller This function is needed to catch the current controller
""" """
sender = self.sender().objectName() if self.sender().objectName() \ sender = self.sender().objectName() if self.sender().objectName() else self.sender().text()
else self.sender().text()
controller = self controller = self
Receiver.send_message('%s' % sender, [controller, args]) Receiver.send_message('%s' % sender, [controller, args])
class SlideController(Controller): class SlideController(DisplayController):
""" """
SlideController is the slide controller widget. This widget is what the SlideController is the slide controller widget. This widget is what the
user uses to control the displaying of verses/slides/etc on the screen. user uses to control the displaying of verses/slides/etc on the screen.
@ -86,11 +79,10 @@ class SlideController(Controller):
""" """
Set up the Slide Controller. Set up the Slide Controller.
""" """
Controller.__init__(self, parent, isLive) DisplayController.__init__(self, parent, isLive)
self.screens = ScreenList() self.screens = ScreenList()
try: try:
self.ratio = float(self.screens.current[u'size'].width()) / \ self.ratio = float(self.screens.current[u'size'].width()) / float(self.screens.current[u'size'].height())
float(self.screens.current[u'size'].height())
except ZeroDivisionError: except ZeroDivisionError:
self.ratio = 1 self.ratio = 1
self.imageManager = self.parent().imageManager self.imageManager = self.parent().imageManager
@ -126,8 +118,7 @@ class SlideController(Controller):
self.keypress_queue = deque() self.keypress_queue = deque()
self.keypress_loop = False self.keypress_loop = False
self.category = UiStrings().LiveToolbar self.category = UiStrings().LiveToolbar
ActionList.get_instance().add_category( ActionList.get_instance().add_category(unicode(self.category), CategoryOrder.standardToolbar)
unicode(self.category), CategoryOrder.standardToolbar)
else: else:
self.typeLabel.setText(UiStrings().Preview) self.typeLabel.setText(UiStrings().Preview)
self.split = 0 self.split = 0
@ -143,80 +134,64 @@ class SlideController(Controller):
# Actual controller section # Actual controller section
self.controller = QtGui.QWidget(self.splitter) self.controller = QtGui.QWidget(self.splitter)
self.controller.setGeometry(QtCore.QRect(0, 0, 100, 536)) self.controller.setGeometry(QtCore.QRect(0, 0, 100, 536))
self.controller.setSizePolicy( self.controller.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum))
QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
QtGui.QSizePolicy.Maximum))
self.controllerLayout = QtGui.QVBoxLayout(self.controller) self.controllerLayout = QtGui.QVBoxLayout(self.controller)
self.controllerLayout.setSpacing(0) self.controllerLayout.setSpacing(0)
self.controllerLayout.setMargin(0) self.controllerLayout.setMargin(0)
# Controller list view # Controller list view
self.previewListWidget = SlideList(self) self.previewListWidget = QtGui.QTableWidget(self.controller)
self.previewListWidget.setColumnCount(1) self.previewListWidget.setColumnCount(1)
self.previewListWidget.horizontalHeader().setVisible(False) self.previewListWidget.horizontalHeader().setVisible(False)
self.previewListWidget.setColumnWidth(0, self.controller.width()) self.previewListWidget.setColumnWidth(0, self.controller.width())
self.previewListWidget.isLive = self.isLive self.previewListWidget.isLive = self.isLive
self.previewListWidget.setObjectName(u'previewListWidget') self.previewListWidget.setObjectName(u'previewListWidget')
self.previewListWidget.setSelectionBehavior( self.previewListWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
QtGui.QAbstractItemView.SelectRows) self.previewListWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.previewListWidget.setSelectionMode( self.previewListWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
QtGui.QAbstractItemView.SingleSelection) self.previewListWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.previewListWidget.setEditTriggers(
QtGui.QAbstractItemView.NoEditTriggers)
self.previewListWidget.setHorizontalScrollBarPolicy(
QtCore.Qt.ScrollBarAlwaysOff)
self.previewListWidget.setAlternatingRowColors(True) self.previewListWidget.setAlternatingRowColors(True)
self.controllerLayout.addWidget(self.previewListWidget) self.controllerLayout.addWidget(self.previewListWidget)
# Build the full toolbar # Build the full toolbar
self.toolbar = OpenLPToolbar(self) self.toolbar = OpenLPToolbar(self)
sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
QtGui.QSizePolicy.Fixed)
sizeToolbarPolicy.setHorizontalStretch(0) sizeToolbarPolicy.setHorizontalStretch(0)
sizeToolbarPolicy.setVerticalStretch(0) sizeToolbarPolicy.setVerticalStretch(0)
sizeToolbarPolicy.setHeightForWidth( sizeToolbarPolicy.setHeightForWidth(self.toolbar.sizePolicy().hasHeightForWidth())
self.toolbar.sizePolicy().hasHeightForWidth())
self.toolbar.setSizePolicy(sizeToolbarPolicy) self.toolbar.setSizePolicy(sizeToolbarPolicy)
self.previousItem = create_action(self, self.previousItem = create_action(self, u'previousItem_' + self.typePrefix,
u'previousItem_' + self.typePrefix, text=translate('OpenLP.SlideController', 'Previous Slide'), icon=u':/slides/slide_previous.png',
text=translate('OpenLP.SlideController', 'Previous Slide'),
icon=u':/slides/slide_previous.png',
tooltip=translate('OpenLP.SlideController', 'Move to previous.'), tooltip=translate('OpenLP.SlideController', 'Move to previous.'),
shortcuts=[QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp], shortcuts=[QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp], context=QtCore.Qt.WidgetWithChildrenShortcut,
context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, triggers=self.onSlideSelectedPrevious) category=self.category, triggers=self.onSlideSelectedPrevious)
self.toolbar.addAction(self.previousItem) self.toolbar.addAction(self.previousItem)
self.nextItem = create_action(self, u'nextItem_' + self.typePrefix, self.nextItem = create_action(self, u'nextItem_' + self.typePrefix,
text=translate('OpenLP.SlideController', 'Next Slide'), text=translate('OpenLP.SlideController', 'Next Slide'), icon=u':/slides/slide_next.png',
icon=u':/slides/slide_next.png',
tooltip=translate('OpenLP.SlideController', 'Move to next.'), tooltip=translate('OpenLP.SlideController', 'Move to next.'),
shortcuts=[QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown], shortcuts=[QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown], context=QtCore.Qt.WidgetWithChildrenShortcut,
context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, triggers=self.onSlideSelectedNextAction) category=self.category, triggers=self.onSlideSelectedNextAction)
self.toolbar.addAction(self.nextItem) self.toolbar.addAction(self.nextItem)
self.toolbar.addSeparator() self.toolbar.addSeparator()
self.controllerType = DisplayControllerType.Preview
if self.isLive: if self.isLive:
self.controllerType = DisplayControllerType.Live
# Hide Menu # Hide Menu
self.hideMenu = QtGui.QToolButton(self.toolbar) self.hideMenu = QtGui.QToolButton(self.toolbar)
self.hideMenu.setObjectName(u'hideMenu') self.hideMenu.setObjectName(u'hideMenu')
self.hideMenu.setText(translate('OpenLP.SlideController', 'Hide')) self.hideMenu.setText(translate('OpenLP.SlideController', 'Hide'))
self.hideMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup) self.hideMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.hideMenu.setMenu(QtGui.QMenu( self.hideMenu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
translate('OpenLP.SlideController', 'Hide'), self.toolbar))
self.toolbar.addToolbarWidget(self.hideMenu) self.toolbar.addToolbarWidget(self.hideMenu)
self.blankScreen = create_action(self, u'blankScreen', self.blankScreen = create_action(self, u'blankScreen',
text=translate('OpenLP.SlideController', 'Blank Screen'), text=translate('OpenLP.SlideController', 'Blank Screen'), icon=u':/slides/slide_blank.png',
icon=u':/slides/slide_blank.png', checked=False, checked=False, shortcuts=[QtCore.Qt.Key_Period], category=self.category, triggers=self.onBlankDisplay)
shortcuts=[QtCore.Qt.Key_Period],
category=self.category, triggers=self.onBlankDisplay)
self.themeScreen = create_action(self, u'themeScreen', self.themeScreen = create_action(self, u'themeScreen',
text=translate('OpenLP.SlideController', 'Blank to Theme'), text=translate('OpenLP.SlideController', 'Blank to Theme'), icon=u':/slides/slide_theme.png',
icon=u':/slides/slide_theme.png', checked=False, checked=False, shortcuts=[QtGui.QKeySequence(u'T')], category=self.category,
shortcuts=[QtGui.QKeySequence(u'T')], triggers=self.onThemeDisplay)
category=self.category, triggers=self.onThemeDisplay)
self.desktopScreen = create_action(self, u'desktopScreen', self.desktopScreen = create_action(self, u'desktopScreen',
text=translate('OpenLP.SlideController', 'Show Desktop'), text=translate('OpenLP.SlideController', 'Show Desktop'), icon=u':/slides/slide_desktop.png',
icon=u':/slides/slide_desktop.png', checked=False, checked=False, shortcuts=[QtGui.QKeySequence(u'D')], category=self.category,
shortcuts=[QtGui.QKeySequence(u'D')], triggers=self.onHideDisplay)
category=self.category, triggers=self.onHideDisplay)
self.hideMenu.setDefaultAction(self.blankScreen) self.hideMenu.setDefaultAction(self.blankScreen)
self.hideMenu.menu().addAction(self.blankScreen) self.hideMenu.menu().addAction(self.blankScreen)
self.hideMenu.menu().addAction(self.themeScreen) self.hideMenu.menu().addAction(self.themeScreen)
@ -225,23 +200,18 @@ class SlideController(Controller):
# Play Slides Menu # Play Slides Menu
self.playSlidesMenu = QtGui.QToolButton(self.toolbar) self.playSlidesMenu = QtGui.QToolButton(self.toolbar)
self.playSlidesMenu.setObjectName(u'playSlidesMenu') self.playSlidesMenu.setObjectName(u'playSlidesMenu')
self.playSlidesMenu.setText(translate('OpenLP.SlideController', self.playSlidesMenu.setText(translate('OpenLP.SlideController', 'Play Slides'))
'Play Slides'))
self.playSlidesMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup) self.playSlidesMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.playSlidesMenu.setMenu(QtGui.QMenu( self.playSlidesMenu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Play Slides'), self.toolbar))
translate('OpenLP.SlideController', 'Play Slides'),
self.toolbar))
self.toolbar.addToolbarWidget(self.playSlidesMenu) self.toolbar.addToolbarWidget(self.playSlidesMenu)
self.playSlidesLoop = create_action(self, u'playSlidesLoop', self.playSlidesLoop = create_action(self, u'playSlidesLoop', text=UiStrings().PlaySlidesInLoop,
text=UiStrings().PlaySlidesInLoop, icon=u':/media/media_time.png', checked=False, shortcuts=[], category=self.category,
icon=u':/media/media_time.png', checked=False, shortcuts=[], triggers=self.onPlaySlidesLoop)
category=self.category, triggers=self.onPlaySlidesLoop) self.playSlidesOnce = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
self.playSlidesOnce = create_action(self, u'playSlidesOnce', icon=u':/media/media_time.png', checked=False, shortcuts=[], category=self.category,
text=UiStrings().PlaySlidesToEnd, triggers=self.onPlaySlidesOnce)
icon=u':/media/media_time.png', checked=False, shortcuts=[], if Settings().value(self.parent().generalSettingsSection + u'/enable slide loop',
category=self.category, triggers=self.onPlaySlidesOnce) QtCore.QVariant(True)).toBool():
if Settings().value(self.parent().generalSettingsSection +
u'/enable slide loop', QtCore.QVariant(True)).toBool():
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop) self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
else: else:
self.playSlidesMenu.setDefaultAction(self.playSlidesOnce) self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
@ -252,61 +222,46 @@ class SlideController(Controller):
self.delaySpinBox.setObjectName(u'delaySpinBox') self.delaySpinBox.setObjectName(u'delaySpinBox')
self.delaySpinBox.setRange(1, 180) self.delaySpinBox.setRange(1, 180)
self.delaySpinBox.setSuffix(UiStrings().Seconds) self.delaySpinBox.setSuffix(UiStrings().Seconds)
self.delaySpinBox.setToolTip(translate('OpenLP.SlideController', self.delaySpinBox.setToolTip(translate('OpenLP.SlideController', 'Delay between slides in seconds.'))
'Delay between slides in seconds.'))
self.toolbar.addToolbarWidget(self.delaySpinBox) self.toolbar.addToolbarWidget(self.delaySpinBox)
else: else:
self.toolbar.addToolbarAction(u'goLive', self.toolbar.addToolbarAction(u'goLive', icon=u':/general/general_live.png',
icon=u':/general/general_live.png', tooltip=translate('OpenLP.SlideController', 'Move to live.'), triggers=self.onGoLive)
tooltip=translate('OpenLP.SlideController', 'Move to live.'), self.toolbar.addToolbarAction(u'addToService', icon=u':/general/general_add.png',
triggers=self.onGoLive) tooltip=translate('OpenLP.SlideController', 'Add to Service.'), triggers=self.onPreviewAddToService)
self.toolbar.addToolbarAction(u'addToService',
icon=u':/general/general_add.png',
tooltip=translate('OpenLP.SlideController', 'Add to Service.'),
triggers=self.onPreviewAddToService)
self.toolbar.addSeparator() self.toolbar.addSeparator()
self.toolbar.addToolbarAction(u'editSong', self.toolbar.addToolbarAction(u'editSong', icon=u':/general/general_edit.png',
icon=u':/general/general_edit.png', tooltip=translate('OpenLP.SlideController', 'Edit and reload song preview.'), triggers=self.onEditSong)
tooltip=translate('OpenLP.SlideController',
'Edit and reload song preview.'), triggers=self.onEditSong)
self.controllerLayout.addWidget(self.toolbar) self.controllerLayout.addWidget(self.toolbar)
# Build the Media Toolbar # Build the Media Toolbar
self.mediaController.add_controller_items(self, self.controllerLayout) self.mediaController.register_controller(self)
if self.isLive: if self.isLive:
# Build the Song Toolbar # Build the Song Toolbar
self.songMenu = QtGui.QToolButton(self.toolbar) self.songMenu = QtGui.QToolButton(self.toolbar)
self.songMenu.setObjectName(u'songMenu') self.songMenu.setObjectName(u'songMenu')
self.songMenu.setText(translate('OpenLP.SlideController', 'Go To')) self.songMenu.setText(translate('OpenLP.SlideController', 'Go To'))
self.songMenu.setPopupMode(QtGui.QToolButton.InstantPopup) self.songMenu.setPopupMode(QtGui.QToolButton.InstantPopup)
self.songMenu.setMenu(QtGui.QMenu( self.songMenu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Go To'), self.toolbar))
translate('OpenLP.SlideController', 'Go To'), self.toolbar))
self.toolbar.addToolbarWidget(self.songMenu) self.toolbar.addToolbarWidget(self.songMenu)
# Stuff for items with background audio. # Stuff for items with background audio.
self.audioPauseItem = self.toolbar.addToolbarAction( self.audioPauseItem = self.toolbar.addToolbarAction(u'audioPauseItem',
u'audioPauseItem', icon=u':/slides/media_playback_pause.png', icon=u':/slides/media_playback_pause.png', text=translate('OpenLP.SlideController', 'Pause Audio'),
text=translate('OpenLP.SlideController', 'Pause Audio'),
tooltip=translate('OpenLP.SlideController', 'Pause audio.'), tooltip=translate('OpenLP.SlideController', 'Pause audio.'),
checked=False, visible=False, category=self.category, checked=False, visible=False, category=self.category, context=QtCore.Qt.WindowShortcut,
context=QtCore.Qt.WindowShortcut,
shortcuts=[], triggers=self.onAudioPauseClicked) shortcuts=[], triggers=self.onAudioPauseClicked)
self.audioMenu = QtGui.QMenu( self.audioMenu = QtGui.QMenu(translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
self.audioPauseItem.setMenu(self.audioMenu) self.audioPauseItem.setMenu(self.audioMenu)
self.audioPauseItem.setParent(self.toolbar) self.audioPauseItem.setParent(self.toolbar)
self.toolbar.widgetForAction(self.audioPauseItem).setPopupMode( self.toolbar.widgetForAction(self.audioPauseItem).setPopupMode(
QtGui.QToolButton.MenuButtonPopup) QtGui.QToolButton.MenuButtonPopup)
self.nextTrackItem = create_action(self, u'nextTrackItem', self.nextTrackItem = create_action(self, u'nextTrackItem', text=UiStrings().NextTrack,
text=UiStrings().NextTrack, icon=u':/slides/media_playback_next.png',
icon=u':/slides/media_playback_next.png', tooltip=translate( tooltip=translate('OpenLP.SlideController', 'Go to next audio track.'),
'OpenLP.SlideController', 'Go to next audio track.'), category=self.category, shortcuts=[], triggers=self.onNextTrackClicked)
category=self.category,
shortcuts=[], triggers=self.onNextTrackClicked)
self.audioMenu.addAction(self.nextTrackItem) self.audioMenu.addAction(self.nextTrackItem)
self.trackMenu = self.audioMenu.addMenu( self.trackMenu = self.audioMenu.addMenu(translate('OpenLP.SlideController', 'Tracks'))
translate('OpenLP.SlideController', 'Tracks'))
self.audioTimeLabel = QtGui.QLabel(u' 00:00 ', self.toolbar) self.audioTimeLabel = QtGui.QLabel(u' 00:00 ', self.toolbar)
self.audioTimeLabel.setAlignment( self.audioTimeLabel.setAlignment(QtCore.Qt.AlignCenter|QtCore.Qt.AlignHCenter)
QtCore.Qt.AlignCenter|QtCore.Qt.AlignHCenter)
self.audioTimeLabel.setStyleSheet( self.audioTimeLabel.setStyleSheet(
u'background-color: palette(background); ' u'background-color: palette(background); '
u'border-top-color: palette(shadow); ' u'border-top-color: palette(shadow); '
@ -323,8 +278,7 @@ class SlideController(Controller):
self.previewFrame = QtGui.QFrame(self.splitter) self.previewFrame = QtGui.QFrame(self.splitter)
self.previewFrame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio)) self.previewFrame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio))
self.previewFrame.setMinimumHeight(100) self.previewFrame.setMinimumHeight(100)
self.previewFrame.setSizePolicy(QtGui.QSizePolicy( self.previewFrame.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored,
QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored,
QtGui.QSizePolicy.Label)) QtGui.QSizePolicy.Label))
self.previewFrame.setFrameShape(QtGui.QFrame.StyledPanel) self.previewFrame.setFrameShape(QtGui.QFrame.StyledPanel)
self.previewFrame.setFrameShadow(QtGui.QFrame.Sunken) self.previewFrame.setFrameShadow(QtGui.QFrame.Sunken)
@ -344,8 +298,7 @@ class SlideController(Controller):
self.previewDisplay.hide() self.previewDisplay.hide()
# Actual preview screen # Actual preview screen
self.slidePreview = QtGui.QLabel(self) self.slidePreview = QtGui.QLabel(self)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth( sizePolicy.setHeightForWidth(
@ -389,20 +342,16 @@ class SlideController(Controller):
self.shortcutTimer, QtCore.SIGNAL(u'timeout()'), self.shortcutTimer, QtCore.SIGNAL(u'timeout()'),
self._slideShortcutActivated) self._slideShortcutActivated)
# Signals # Signals
QtCore.QObject.connect(self.previewListWidget, QtCore.QObject.connect(self.previewListWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
if self.isLive: if self.isLive:
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'), QtCore.SIGNAL(u'slidecontroller_live_spin_delay'), self.receiveSpinDelay)
self.receiveSpinDelay)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_toggle_display'), QtCore.SIGNAL(u'slidecontroller_toggle_display'), self.toggleDisplay)
self.toggleDisplay)
self.toolbar.setWidgetVisible(self.loopList, False) self.toolbar.setWidgetVisible(self.loopList, False)
else: else:
QtCore.QObject.connect(self.previewListWidget, QtCore.QObject.connect(self.previewListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLiveClick)
self.onGoLiveClick)
self.toolbar.setWidgetVisible([u'editSong'], False) self.toolbar.setWidgetVisible([u'editSong'], False)
if self.isLive: if self.isLive:
self.setLiveHotkeys(self) self.setLiveHotkeys(self)
@ -411,29 +360,21 @@ class SlideController(Controller):
self.previewListWidget.addActions( self.previewListWidget.addActions(
[self.nextItem, self.previousItem]) [self.nextItem, self.previousItem])
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.typePrefix), QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.typePrefix), self.onStopLoop)
self.onStopLoop)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_next' % self.typePrefix), QtCore.SIGNAL(u'slidecontroller_%s_next' % self.typePrefix), self.onSlideSelectedNext)
self.onSlideSelectedNext)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.typePrefix), QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.typePrefix), self.onSlideSelectedPrevious)
self.onSlideSelectedPrevious)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_change' % self.typePrefix), QtCore.SIGNAL(u'slidecontroller_%s_change' % self.typePrefix), self.onSlideChange)
self.onSlideChange)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_set' % self.typePrefix), QtCore.SIGNAL(u'slidecontroller_%s_set' % self.typePrefix), self.onSlideSelectedIndex)
self.onSlideSelectedIndex)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.typePrefix), QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.typePrefix), self.onSlideBlank)
self.onSlideBlank)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.typePrefix), QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.typePrefix), self.onSlideUnblank)
self.onSlideUnblank)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_update_slide_limits'), QtCore.SIGNAL(u'slidecontroller_update_slide_limits'), self.updateSlideLimits)
self.updateSlideLimits)
def _slideShortcutActivated(self): def _slideShortcutActivated(self):
""" """
@ -452,30 +393,22 @@ class SlideController(Controller):
except ImportError: except ImportError:
SONGS_PLUGIN_AVAILABLE = False SONGS_PLUGIN_AVAILABLE = False
sender_name = unicode(self.sender().objectName()) sender_name = unicode(self.sender().objectName())
verse_type = sender_name[15:] \ verse_type = sender_name[15:] if sender_name[:15] == u'shortcutAction_' else u''
if sender_name[:15] == u'shortcutAction_' else u''
if SONGS_PLUGIN_AVAILABLE: if SONGS_PLUGIN_AVAILABLE:
if verse_type == u'V': if verse_type == u'V':
self.current_shortcut = \ self.current_shortcut = VerseType.TranslatedTags[VerseType.Verse]
VerseType.TranslatedTags[VerseType.Verse]
elif verse_type == u'C': elif verse_type == u'C':
self.current_shortcut = \ self.current_shortcut = VerseType.TranslatedTags[VerseType.Chorus]
VerseType.TranslatedTags[VerseType.Chorus]
elif verse_type == u'B': elif verse_type == u'B':
self.current_shortcut = \ self.current_shortcut = VerseType.TranslatedTags[VerseType.Bridge]
VerseType.TranslatedTags[VerseType.Bridge]
elif verse_type == u'P': elif verse_type == u'P':
self.current_shortcut = \ self.current_shortcut = VerseType.TranslatedTags[VerseType.PreChorus]
VerseType.TranslatedTags[VerseType.PreChorus]
elif verse_type == u'I': elif verse_type == u'I':
self.current_shortcut = \ self.current_shortcut = VerseType.TranslatedTags[VerseType.Intro]
VerseType.TranslatedTags[VerseType.Intro]
elif verse_type == u'E': elif verse_type == u'E':
self.current_shortcut = \ self.current_shortcut = VerseType.TranslatedTags[VerseType.Ending]
VerseType.TranslatedTags[VerseType.Ending]
elif verse_type == u'O': elif verse_type == u'O':
self.current_shortcut = \ self.current_shortcut = VerseType.TranslatedTags[VerseType.Other]
VerseType.TranslatedTags[VerseType.Other]
elif verse_type.isnumeric(): elif verse_type.isnumeric():
self.current_shortcut += verse_type self.current_shortcut += verse_type
self.current_shortcut = self.current_shortcut.upper() self.current_shortcut = self.current_shortcut.upper()
@ -499,8 +432,7 @@ class SlideController(Controller):
if self.current_shortcut in keys: if self.current_shortcut in keys:
# We had more than one match for example "V1" and "V10", but # We had more than one match for example "V1" and "V10", but
# "V1" was the slide we wanted to go. # "V1" was the slide we wanted to go.
self.__checkUpdateSelectedSlide( self.__checkUpdateSelectedSlide(self.slideList[self.current_shortcut])
self.slideList[self.current_shortcut])
self.slideSelected() self.slideSelected()
# Reset the shortcut. # Reset the shortcut.
self.current_shortcut = u'' self.current_shortcut = u''
@ -508,23 +440,20 @@ class SlideController(Controller):
def setLiveHotkeys(self, parent=None): def setLiveHotkeys(self, parent=None):
self.previousService = create_action(parent, u'previousService', self.previousService = create_action(parent, u'previousService',
text=translate('OpenLP.SlideController', 'Previous Service'), text=translate('OpenLP.SlideController', 'Previous Service'),
shortcuts=[QtCore.Qt.Key_Left], shortcuts=[QtCore.Qt.Key_Left], context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
context=QtCore.Qt.WidgetWithChildrenShortcut, triggers=self.servicePrevious)
category=self.category, triggers=self.servicePrevious)
self.nextService = create_action(parent, 'nextService', self.nextService = create_action(parent, 'nextService',
text=translate('OpenLP.SlideController', 'Next Service'), text=translate('OpenLP.SlideController', 'Next Service'),
shortcuts=[QtCore.Qt.Key_Right], shortcuts=[QtCore.Qt.Key_Right], context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
context=QtCore.Qt.WidgetWithChildrenShortcut, triggers=self.serviceNext)
category=self.category, triggers=self.serviceNext)
self.escapeItem = create_action(parent, 'escapeItem', self.escapeItem = create_action(parent, 'escapeItem',
text=translate('OpenLP.SlideController', 'Escape Item'), text=translate('OpenLP.SlideController', 'Escape Item'),
shortcuts=[QtCore.Qt.Key_Escape], shortcuts=[QtCore.Qt.Key_Escape],context=QtCore.Qt.WidgetWithChildrenShortcut, category=self.category,
context=QtCore.Qt.WidgetWithChildrenShortcut, triggers=self.liveEscape)
category=self.category, triggers=self.liveEscape)
def liveEscape(self): def liveEscape(self):
self.display.setVisible(False) self.display.setVisible(False)
self.mediaController.video_stop([self]) self.mediaController.media_stop(self)
def toggleDisplay(self, action): def toggleDisplay(self, action):
""" """
@ -568,8 +497,7 @@ class SlideController(Controller):
Receiver.send_message('servicemanager_previous_item') Receiver.send_message('servicemanager_previous_item')
elif keypressCommand == ServiceItemAction.PreviousLastSlide: elif keypressCommand == ServiceItemAction.PreviousLastSlide:
# Go to the last slide of the previous item # Go to the last slide of the previous item
Receiver.send_message('servicemanager_previous_item', Receiver.send_message('servicemanager_previous_item', u'last slide')
u'last slide')
else: else:
Receiver.send_message('servicemanager_next_item') Receiver.send_message('servicemanager_next_item')
self.keypress_loop = False self.keypress_loop = False
@ -586,22 +514,19 @@ class SlideController(Controller):
self.display.setup() self.display.setup()
if self.isLive: if self.isLive:
self.__addActionsToWidget(self.display) self.__addActionsToWidget(self.display)
self.display.audioPlayer.connectSlot( self.display.audioPlayer.connectSlot(QtCore.SIGNAL(u'tick(qint64)'), self.onAudioTimeRemaining)
QtCore.SIGNAL(u'tick(qint64)'), self.onAudioTimeRemaining)
# The SlidePreview's ratio. # The SlidePreview's ratio.
try: try:
self.ratio = float(self.screens.current[u'size'].width()) / \ self.ratio = float(self.screens.current[u'size'].width()) / float(self.screens.current[u'size'].height())
float(self.screens.current[u'size'].height())
except ZeroDivisionError: except ZeroDivisionError:
self.ratio = 1 self.ratio = 1
self.mediaController.setup_display(self.display) self.mediaController.setup_display(self.display, False)
self.previewSizeChanged() self.previewSizeChanged()
self.previewDisplay.setup() self.previewDisplay.setup()
serviceItem = ServiceItem() serviceItem = ServiceItem()
self.previewDisplay.webView.setHtml(build_html(serviceItem, self.previewDisplay.webView.setHtml(build_html(serviceItem, self.previewDisplay.screen, None, self.isLive,
self.previewDisplay.screen, None, self.isLive,
plugins=PluginManager.get_instance().plugins)) plugins=PluginManager.get_instance().plugins))
self.mediaController.setup_display(self.previewDisplay) self.mediaController.setup_display(self.previewDisplay,True)
if self.serviceItem: if self.serviceItem:
self.refreshServiceItem() self.refreshServiceItem()
@ -617,23 +542,18 @@ class SlideController(Controller):
splitters is moved or when the screen size is changed. Note, that this splitters is moved or when the screen size is changed. Note, that this
method is (also) called frequently from the mainwindow *paintEvent*. method is (also) called frequently from the mainwindow *paintEvent*.
""" """
if self.ratio < float(self.previewFrame.width()) / float( if self.ratio < float(self.previewFrame.width()) / float(self.previewFrame.height()):
self.previewFrame.height()):
# We have to take the height as limit. # We have to take the height as limit.
max_height = self.previewFrame.height() - self.grid.margin() * 2 max_height = self.previewFrame.height() - self.grid.margin() * 2
self.slidePreview.setFixedSize(QtCore.QSize( self.slidePreview.setFixedSize(QtCore.QSize(max_height * self.ratio, max_height))
max_height * self.ratio, max_height)) self.previewDisplay.setFixedSize(QtCore.QSize(max_height * self.ratio, max_height))
self.previewDisplay.setFixedSize(QtCore.QSize(
max_height * self.ratio, max_height))
self.previewDisplay.screen = { self.previewDisplay.screen = {
u'size': self.previewDisplay.geometry()} u'size': self.previewDisplay.geometry()}
else: else:
# We have to take the width as limit. # We have to take the width as limit.
max_width = self.previewFrame.width() - self.grid.margin() * 2 max_width = self.previewFrame.width() - self.grid.margin() * 2
self.slidePreview.setFixedSize(QtCore.QSize(max_width, self.slidePreview.setFixedSize(QtCore.QSize(max_width, max_width / self.ratio))
max_width / self.ratio)) self.previewDisplay.setFixedSize(QtCore.QSize(max_width, max_width / self.ratio))
self.previewDisplay.setFixedSize(QtCore.QSize(max_width,
max_width / self.ratio))
self.previewDisplay.screen = { self.previewDisplay.screen = {
u'size': self.previewDisplay.geometry()} u'size': self.previewDisplay.geometry()}
# Make sure that the frames have the correct size. # Make sure that the frames have the correct size.
@ -647,8 +567,7 @@ class SlideController(Controller):
# Sort out image heights. # Sort out image heights.
width = self.parent().controlSplitter.sizes()[self.split] width = self.parent().controlSplitter.sizes()[self.split]
for framenumber in range(len(self.serviceItem.get_frames())): for framenumber in range(len(self.serviceItem.get_frames())):
self.previewListWidget.setRowHeight( self.previewListWidget.setRowHeight(framenumber, width / self.ratio)
framenumber, width / self.ratio)
def onSongBarHandler(self): def onSongBarHandler(self):
request = unicode(self.sender().text()) request = unicode(self.sender().text())
@ -666,8 +585,7 @@ class SlideController(Controller):
""" """
Updates the Slide Limits variable from the settings. Updates the Slide Limits variable from the settings.
""" """
self.slide_limits = Settings().value( self.slide_limits = Settings().value(self.parent().advancedSettingsSection + u'/slide limits',
self.parent().advancedSettingsSection + u'/slide limits',
QtCore.QVariant(SlideLimits.End)).toInt()[0] QtCore.QVariant(SlideLimits.End)).toInt()[0]
def enableToolBar(self, item): def enableToolBar(self, item):
@ -696,12 +614,10 @@ class SlideController(Controller):
self.playSlidesLoop.setChecked(False) self.playSlidesLoop.setChecked(False)
self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png')) self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
if item.is_text(): if item.is_text():
if Settings().value( if Settings().value(self.parent().songsSettingsSection + u'/display songbar',
self.parent().songsSettingsSection + u'/display songbar',
QtCore.QVariant(True)).toBool() and self.slideList: QtCore.QVariant(True)).toBool() and self.slideList:
self.songMenu.show() self.songMenu.show()
if item.is_capable(ItemCapabilities.CanLoop) and \ if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1:
len(item.get_frames()) > 1:
self.toolbar.setWidgetVisible(self.loopList) self.toolbar.setWidgetVisible(self.loopList)
if item.is_media(): if item.is_media():
self.mediabar.show() self.mediabar.show()
@ -789,8 +705,7 @@ class SlideController(Controller):
old_item = self.serviceItem old_item = self.serviceItem
# take a copy not a link to the servicemanager copy. # take a copy not a link to the servicemanager copy.
self.serviceItem = copy.copy(serviceItem) self.serviceItem = copy.copy(serviceItem)
if old_item and self.isLive and old_item.is_capable( if old_item and self.isLive and old_item.is_capable(ItemCapabilities.ProvidesOwnDisplay):
ItemCapabilities.ProvidesOwnDisplay):
self._resetBlank() self._resetBlank()
Receiver.send_message(u'%s_start' % serviceItem.name.lower(), Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
[serviceItem, self.isLive, self.hideMode(), slideno]) [serviceItem, self.isLive, self.hideMode(), slideno])
@ -807,24 +722,16 @@ class SlideController(Controller):
# If the current item has background audio # If the current item has background audio
if self.serviceItem.is_capable(ItemCapabilities.HasBackgroundAudio): if self.serviceItem.is_capable(ItemCapabilities.HasBackgroundAudio):
log.debug(u'Starting to play...') log.debug(u'Starting to play...')
self.display.audioPlayer.addToPlaylist( self.display.audioPlayer.addToPlaylist(self.serviceItem.background_audio)
self.serviceItem.background_audio)
self.trackMenu.clear() self.trackMenu.clear()
for counter in range(len(self.serviceItem.background_audio)): for counter in range(len(self.serviceItem.background_audio)):
action = self.trackMenu.addAction(os.path.basename( action = self.trackMenu.addAction(os.path.basename(self.serviceItem.background_audio[counter]))
self.serviceItem.background_audio[counter]))
action.setData(counter) action.setData(counter)
QtCore.QObject.connect(action, QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), self.onTrackTriggered)
QtCore.SIGNAL(u'triggered(bool)'),
self.onTrackTriggered)
self.display.audioPlayer.repeat = Settings().value( self.display.audioPlayer.repeat = Settings().value(
self.parent().generalSettingsSection + \ self.parent().generalSettingsSection + u'/audio repeat list', QtCore.QVariant(False)).toBool()
u'/audio repeat list',
QtCore.QVariant(False)).toBool()
if Settings().value( if Settings().value(
self.parent().generalSettingsSection + \ self.parent().generalSettingsSection + u'/audio start paused', QtCore.QVariant(True)).toBool():
u'/audio start paused',
QtCore.QVariant(True)).toBool():
self.audioPauseItem.setChecked(True) self.audioPauseItem.setChecked(True)
self.display.audioPlayer.pause() self.display.audioPlayer.pause()
else: else:
@ -833,8 +740,7 @@ class SlideController(Controller):
row = 0 row = 0
text = [] text = []
for framenumber, frame in enumerate(self.serviceItem.get_frames()): for framenumber, frame in enumerate(self.serviceItem.get_frames()):
self.previewListWidget.setRowCount( self.previewListWidget.setRowCount(self.previewListWidget.rowCount() + 1)
self.previewListWidget.rowCount() + 1)
item = QtGui.QTableWidgetItem() item = QtGui.QTableWidgetItem()
slideHeight = 0 slideHeight = 0
if self.serviceItem.is_text(): if self.serviceItem.is_text():
@ -857,8 +763,7 @@ class SlideController(Controller):
label = QtGui.QLabel() label = QtGui.QLabel()
label.setMargin(4) label.setMargin(4)
if serviceItem.is_media(): if serviceItem.is_media():
label.setAlignment(QtCore.Qt.AlignHCenter | label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
QtCore.Qt.AlignVCenter)
else: else:
label.setScaledContents(True) label.setScaledContents(True)
if self.serviceItem.is_command(): if self.serviceItem.is_command():
@ -866,11 +771,9 @@ class SlideController(Controller):
else: else:
# If current slide set background to image # If current slide set background to image
if framenumber == slideno: if framenumber == slideno:
self.serviceItem.bg_image_bytes = \ self.serviceItem.bg_image_bytes = self.imageManager.getImageBytes(frame[u'path'],
self.imageManager.getImageBytes(frame[u'path'],
ImageSource.ImagePlugin)
image = self.imageManager.getImage(frame[u'path'],
ImageSource.ImagePlugin) ImageSource.ImagePlugin)
image = self.imageManager.getImage(frame[u'path'], ImageSource.ImagePlugin)
label.setPixmap(QtGui.QPixmap.fromImage(image)) label.setPixmap(QtGui.QPixmap.fromImage(image))
self.previewListWidget.setCellWidget(framenumber, 0, label) self.previewListWidget.setCellWidget(framenumber, 0, label)
slideHeight = width * (1 / self.ratio) slideHeight = width * (1 / self.ratio)
@ -902,12 +805,10 @@ class SlideController(Controller):
# However opening a new item of the same type will automatically # However opening a new item of the same type will automatically
# close the previous, so make sure we don't close the new one. # close the previous, so make sure we don't close the new one.
if old_item.is_command() and not serviceItem.is_command(): if old_item.is_command() and not serviceItem.is_command():
Receiver.send_message(u'%s_stop' % Receiver.send_message(u'%s_stop' % old_item.name.lower(), [old_item, self.isLive])
old_item.name.lower(), [old_item, self.isLive])
if old_item.is_media() and not serviceItem.is_media(): if old_item.is_media() and not serviceItem.is_media():
self.onMediaClose() self.onMediaClose()
Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix, Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix, [serviceItem])
[serviceItem])
def __updatePreviewSelection(self, slideno): def __updatePreviewSelection(self, slideno):
""" """
@ -928,8 +829,7 @@ class SlideController(Controller):
if not self.serviceItem: if not self.serviceItem:
return return
if self.serviceItem.is_command(): if self.serviceItem.is_command():
Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(), Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive, index])
[self.serviceItem, self.isLive, index])
self.updatePreview() self.updatePreview()
else: else:
self.__checkUpdateSelectedSlide(index) self.__checkUpdateSelectedSlide(index)
@ -940,11 +840,9 @@ class SlideController(Controller):
Allow the main display to blank the main display at startup time Allow the main display to blank the main display at startup time
""" """
log.debug(u'mainDisplaySetBackground live = %s' % self.isLive) log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
display_type = Settings().value( display_type = Settings().value(self.parent().generalSettingsSection + u'/screen blank',
self.parent().generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'')).toString() QtCore.QVariant(u'')).toString()
if self.screens.which_screen(self.window()) != \ if self.screens.which_screen(self.window()) != self.screens.which_screen(self.display):
self.screens.which_screen(self.display):
# Order done to handle initial conversion # Order done to handle initial conversion
if display_type == u'themed': if display_type == u'themed':
self.onThemeDisplay(True) self.onThemeDisplay(True)
@ -981,12 +879,9 @@ class SlideController(Controller):
self.themeScreen.setChecked(False) self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(False) self.desktopScreen.setChecked(False)
if checked: if checked:
Settings().setValue( Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'blanked'))
self.parent().generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'blanked'))
else: else:
Settings().remove( Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.parent().generalSettingsSection + u'/screen blank')
self.blankPlugin() self.blankPlugin()
self.updatePreview() self.updatePreview()
@ -1002,12 +897,9 @@ class SlideController(Controller):
self.themeScreen.setChecked(checked) self.themeScreen.setChecked(checked)
self.desktopScreen.setChecked(False) self.desktopScreen.setChecked(False)
if checked: if checked:
Settings().setValue( Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'themed'))
self.parent().generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'themed'))
else: else:
Settings().remove( Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.parent().generalSettingsSection + u'/screen blank')
self.blankPlugin() self.blankPlugin()
self.updatePreview() self.updatePreview()
@ -1023,12 +915,9 @@ class SlideController(Controller):
self.themeScreen.setChecked(False) self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(checked) self.desktopScreen.setChecked(checked)
if checked: if checked:
Settings().setValue( Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'hidden'))
self.parent().generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'hidden'))
else: else:
Settings().remove( Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.parent().generalSettingsSection + u'/screen blank')
self.hidePlugin(checked) self.hidePlugin(checked)
self.updatePreview() self.updatePreview()
@ -1042,14 +931,12 @@ class SlideController(Controller):
if hide_mode: if hide_mode:
if not self.serviceItem.is_command(): if not self.serviceItem.is_command():
Receiver.send_message(u'live_display_hide', hide_mode) Receiver.send_message(u'live_display_hide', hide_mode)
Receiver.send_message(u'%s_blank' Receiver.send_message(u'%s_blank' % self.serviceItem.name.lower(),
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive, hide_mode]) [self.serviceItem, self.isLive, hide_mode])
else: else:
if not self.serviceItem.is_command(): if not self.serviceItem.is_command():
Receiver.send_message(u'live_display_show') Receiver.send_message(u'live_display_show')
Receiver.send_message(u'%s_unblank' Receiver.send_message(u'%s_unblank' % self.serviceItem.name.lower(),
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive]) [self.serviceItem, self.isLive])
else: else:
if hide_mode: if hide_mode:
@ -1065,14 +952,12 @@ class SlideController(Controller):
if self.serviceItem is not None: if self.serviceItem is not None:
if hide: if hide:
Receiver.send_message(u'live_display_hide', HideMode.Screen) Receiver.send_message(u'live_display_hide', HideMode.Screen)
Receiver.send_message(u'%s_hide' Receiver.send_message(u'%s_hide' % self.serviceItem.name.lower(),
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive]) [self.serviceItem, self.isLive])
else: else:
if not self.serviceItem.is_command(): if not self.serviceItem.is_command():
Receiver.send_message(u'live_display_show') Receiver.send_message(u'live_display_show')
Receiver.send_message(u'%s_unblank' Receiver.send_message(u'%s_unblank' % self.serviceItem.name.lower(),
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive]) [self.serviceItem, self.isLive])
else: else:
if hide: if hide:
@ -1096,8 +981,7 @@ class SlideController(Controller):
if -1 < row < self.previewListWidget.rowCount(): if -1 < row < self.previewListWidget.rowCount():
if self.serviceItem.is_command(): if self.serviceItem.is_command():
if self.isLive and not start: if self.isLive and not start:
Receiver.send_message( Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
u'%s_slide' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive, row]) [self.serviceItem, self.isLive, row])
else: else:
to_display = self.serviceItem.get_rendered_frame(row) to_display = self.serviceItem.get_rendered_frame(row)
@ -1113,8 +997,7 @@ class SlideController(Controller):
self.updatePreview() self.updatePreview()
self.selectedRow = row self.selectedRow = row
self.__checkUpdateSelectedSlide(row) self.__checkUpdateSelectedSlide(row)
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, row)
row)
def onSlideChange(self, row): def onSlideChange(self, row):
""" """
@ -1122,8 +1005,7 @@ class SlideController(Controller):
""" """
self.__checkUpdateSelectedSlide(row) self.__checkUpdateSelectedSlide(row)
self.updatePreview() self.updatePreview()
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, row)
row)
def updatePreview(self): def updatePreview(self):
""" """
@ -1146,8 +1028,7 @@ class SlideController(Controller):
""" """
winid = QtGui.QApplication.desktop().winId() winid = QtGui.QApplication.desktop().winId()
rect = self.screens.current[u'size'] rect = self.screens.current[u'size']
winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height())
rect.y(), rect.width(), rect.height())
self.slidePreview.setPixmap(winimg) self.slidePreview.setPixmap(winimg)
def onSlideSelectedNextAction(self, checked): def onSlideSelectedNextAction(self, checked):
@ -1163,8 +1044,7 @@ class SlideController(Controller):
""" """
if not self.serviceItem: if not self.serviceItem:
return return
Receiver.send_message(u'%s_next' % self.serviceItem.name.lower(), Receiver.send_message(u'%s_next' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
[self.serviceItem, self.isLive])
if self.serviceItem.is_command() and self.isLive: if self.serviceItem.is_command() and self.isLive:
self.updatePreview() self.updatePreview()
else: else:
@ -1191,8 +1071,7 @@ class SlideController(Controller):
""" """
if not self.serviceItem: if not self.serviceItem:
return return
Receiver.send_message(u'%s_previous' % self.serviceItem.name.lower(), Receiver.send_message(u'%s_previous' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
[self.serviceItem, self.isLive])
if self.serviceItem.is_command() and self.isLive: if self.serviceItem.is_command() and self.isLive:
self.updatePreview() self.updatePreview()
else: else:
@ -1201,8 +1080,7 @@ class SlideController(Controller):
if self.slide_limits == SlideLimits.Wrap: if self.slide_limits == SlideLimits.Wrap:
row = self.previewListWidget.rowCount() - 1 row = self.previewListWidget.rowCount() - 1
elif self.isLive and self.slide_limits == SlideLimits.Next: elif self.isLive and self.slide_limits == SlideLimits.Next:
self.keypress_queue.append( self.keypress_queue.append(ServiceItemAction.PreviousLastSlide)
ServiceItemAction.PreviousLastSlide)
self._process_queue() self._process_queue()
return return
else: else:
@ -1212,8 +1090,7 @@ class SlideController(Controller):
def __checkUpdateSelectedSlide(self, row): def __checkUpdateSelectedSlide(self, row):
if row + 1 < self.previewListWidget.rowCount(): if row + 1 < self.previewListWidget.rowCount():
self.previewListWidget.scrollToItem( self.previewListWidget.scrollToItem(self.previewListWidget.item(row + 1, 0))
self.previewListWidget.item(row + 1, 0))
self.previewListWidget.selectRow(row) self.previewListWidget.selectRow(row)
def onToggleLoop(self): def onToggleLoop(self):
@ -1230,8 +1107,7 @@ class SlideController(Controller):
Start the timer loop running and store the timer id Start the timer loop running and store the timer id
""" """
if self.previewListWidget.rowCount() > 1: if self.previewListWidget.rowCount() > 1:
self.timer_id = self.startTimer( self.timer_id = self.startTimer(int(self.delaySpinBox.value()) * 1000)
int(self.delaySpinBox.value()) * 1000)
def onStopLoop(self): def onStopLoop(self):
""" """
@ -1306,29 +1182,24 @@ class SlideController(Controller):
From the preview display requires the service Item to be editied From the preview display requires the service Item to be editied
""" """
self.songEdit = True self.songEdit = True
Receiver.send_message(u'%s_edit' % self.serviceItem.name.lower(), Receiver.send_message(u'%s_edit' % self.serviceItem.name.lower(), u'P:%s' % self.serviceItem.edit_id)
u'P:%s' % self.serviceItem.edit_id)
def onPreviewAddToService(self): def onPreviewAddToService(self):
""" """
From the preview display request the Item to be added to service From the preview display request the Item to be added to service
""" """
if self.serviceItem: if self.serviceItem:
self.parent().serviceManagerContents.addServiceItem( self.parent().serviceManagerContents.addServiceItem(self.serviceItem)
self.serviceItem)
def onGoLiveClick(self): def onGoLiveClick(self):
""" """
triggered by clicking the Preview slide items triggered by clicking the Preview slide items
""" """
if Settings().value(u'advanced/double click live', if Settings().value(u'advanced/double click live', QtCore.QVariant(False)).toBool():
QtCore.QVariant(False)).toBool():
# Live and Preview have issues if we have video or presentations # Live and Preview have issues if we have video or presentations
# playing in both at the same time. # playing in both at the same time.
if self.serviceItem.is_command(): if self.serviceItem.is_command():
Receiver.send_message(u'%s_stop' % Receiver.send_message(u'%s_stop' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
if self.serviceItem.is_media(): if self.serviceItem.is_media():
self.onMediaClose() self.onMediaClose()
self.onGoLive() self.onGoLive()
@ -1340,20 +1211,17 @@ class SlideController(Controller):
row = self.previewListWidget.currentRow() row = self.previewListWidget.currentRow()
if -1 < row < self.previewListWidget.rowCount(): if -1 < row < self.previewListWidget.rowCount():
if self.serviceItem.from_service: if self.serviceItem.from_service:
Receiver.send_message('servicemanager_preview_live', Receiver.send_message('servicemanager_preview_live', u'%s:%s' % (self.serviceItem._uuid, row))
u'%s:%s' % (self.serviceItem._uuid, row))
else: else:
self.parent().liveController.addServiceManagerItem( self.parent().liveController.addServiceManagerItem(self.serviceItem, row)
self.serviceItem, row)
def onMediaStart(self, item): def onMediaStart(self, item):
""" """
Respond to the arrival of a media service item Respond to the arrival of a media service item
""" """
log.debug(u'SlideController onMediaStart') log.debug(u'SlideController onMediaStart')
file = item.get_frame_path() self.mediaController.video(self.controllerType, item, self.hideMode())
self.mediaController.video(self, file, False, False, self.hideMode()) if not self.isLive:
if not self.isLive or self.mediaController.withLivePreview:
self.previewDisplay.show() self.previewDisplay.show()
self.slidePreview.hide() self.slidePreview.hide()
@ -1362,7 +1230,7 @@ class SlideController(Controller):
Respond to a request to close the Video Respond to a request to close the Video
""" """
log.debug(u'SlideController onMediaClose') log.debug(u'SlideController onMediaClose')
self.mediaController.video_reset(self) self.mediaController.media_reset(self)
self.previewDisplay.hide() self.previewDisplay.hide()
self.slidePreview.show() self.slidePreview.show()

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -458,7 +458,7 @@ class ThemeManager(QtGui.QWidget):
QtCore.QVariant(theme.theme_name)) QtCore.QVariant(theme.theme_name))
self.configUpdated() self.configUpdated()
files = SettingsManager.get_files(self.settingsSection, u'.png') files = SettingsManager.get_files(self.settingsSection, u'.png')
# Sort the themes by its name considering language specific characters. # Sort the themes by its name considering language specific
files.sort(key=lambda file_name: unicode(file_name), files.sort(key=lambda file_name: unicode(file_name),
cmp=locale_compare) cmp=locale_compare)
# now process the file list of png files # now process the file list of png files

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #
@ -123,7 +123,7 @@ class AlertsTab(SettingsTab):
translate('AlertsPlugin.AlertsTab', 'Alert timeout:')) translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
self.timeoutSpinBox.setSuffix(UiStrings().Seconds) self.timeoutSpinBox.setSuffix(UiStrings().Seconds)
self.previewGroupBox.setTitle(UiStrings().Preview) self.previewGroupBox.setTitle(UiStrings().Preview)
self.fontPreview.setText(UiStrings().OLPV2) self.fontPreview.setText(UiStrings().OLPV2x)
def onBackgroundColorButtonClicked(self): def onBackgroundColorButtonClicked(self):
new_color = QtGui.QColorDialog.getColor( new_color = QtGui.QColorDialog.getColor(

View File

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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

@ -11,7 +11,7 @@
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # # Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # # Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky # # Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# 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 #

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