diff --git a/openlp/core/ui/mediadockmanager.py b/openlp/core/ui/mediadockmanager.py
index f3061a35a..cca6b8448 100644
--- a/openlp/core/ui/mediadockmanager.py
+++ b/openlp/core/ui/mediadockmanager.py
@@ -1,84 +1,84 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
-# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-import logging
-
-log = logging.getLogger(__name__)
-
-class MediaDockManager(object):
- """
- Provide a repository for MediaManagerItems
- """
- def __init__(self, media_dock):
- """
- Initialise the media dock
- """
- self.media_dock = media_dock
-
- def add_dock(self, media_item, icon, weight):
- """
- Add a MediaManagerItem to the dock
-
- ``media_item``
- The item to add to the dock
-
- ``icon``
- An icon for this dock item
- """
- log.info(u'Adding %s dock' % media_item.title)
- self.media_dock.addItem(media_item, icon, media_item.title)
-
- def insert_dock(self, media_item, icon, weight):
- """
- This should insert a dock item at a given location
- This does not work as it gives a Segmentation error.
- For now add at end of stack if not present
- """
- log.debug(u'Inserting %s dock' % media_item.title)
- match = False
- for dock_index in range(0, self.media_dock.count()):
- if self.media_dock.widget(dock_index).settingsSection == \
- media_item.parent.name_lower:
- match = True
- break
- if not match:
- self.media_dock.addItem(media_item, icon, media_item.title)
-
- def remove_dock(self, name):
- """
- Removes a MediaManagerItem from the dock
-
- ``name``
- The item to remove
- """
- log.debug(u'remove %s dock' % name)
- for dock_index in range(0, self.media_dock.count()):
- if self.media_dock.widget(dock_index):
- log.debug(u'%s %s' % (name, self.media_dock.widget(dock_index).settingsSection))
- if self.media_dock.widget(dock_index).settingsSection == \
- name:
- self.media_dock.widget(dock_index).hide()
- self.media_dock.removeItem(dock_index)
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+
+log = logging.getLogger(__name__)
+
+class MediaDockManager(object):
+ """
+ Provide a repository for MediaManagerItems
+ """
+ def __init__(self, media_dock):
+ """
+ Initialise the media dock
+ """
+ self.media_dock = media_dock
+
+ def add_dock(self, media_item, icon, weight):
+ """
+ Add a MediaManagerItem to the dock
+
+ ``media_item``
+ The item to add to the dock
+
+ ``icon``
+ An icon for this dock item
+ """
+ log.info(u'Adding %s dock' % media_item.title)
+ self.media_dock.addItem(media_item, icon, media_item.title)
+
+ def insert_dock(self, media_item, icon, weight):
+ """
+ This should insert a dock item at a given location
+ This does not work as it gives a Segmentation error.
+ For now add at end of stack if not present
+ """
+ log.debug(u'Inserting %s dock' % media_item.title)
+ match = False
+ for dock_index in range(0, self.media_dock.count()):
+ if self.media_dock.widget(dock_index).settingsSection == \
+ media_item.parent.name_lower:
+ match = True
+ break
+ if not match:
+ self.media_dock.addItem(media_item, icon, media_item.title)
+
+ def remove_dock(self, name):
+ """
+ Removes a MediaManagerItem from the dock
+
+ ``name``
+ The item to remove
+ """
+ log.debug(u'remove %s dock' % name)
+ for dock_index in range(0, self.media_dock.count()):
+ if self.media_dock.widget(dock_index):
+ log.debug(u'%s %s' % (name, self.media_dock.widget(dock_index).settingsSection))
+ if self.media_dock.widget(dock_index).settingsSection == \
+ name:
+ self.media_dock.widget(dock_index).hide()
+ self.media_dock.removeItem(dock_index)
diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py
index 1bfd1e777..15a404db1 100644
--- a/openlp/core/ui/slidecontroller.py
+++ b/openlp/core/ui/slidecontroller.py
@@ -1,988 +1,988 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
-# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-import logging
-import os
-
-from PyQt4 import QtCore, QtGui
-from PyQt4.phonon import Phonon
-
-from openlp.core.ui import HideMode, MainDisplay
-from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \
- ItemCapabilities, translate
-
-log = logging.getLogger(__name__)
-
-class SlideList(QtGui.QTableWidget):
- """
- Customised version of QTableWidget which can respond to keyboard
- events.
- """
- def __init__(self, parent=None, name=None):
- QtGui.QTableWidget.__init__(self, parent.Controller)
- self.parent = parent
- self.hotkeyMap = {
- QtCore.Qt.Key_Return: 'servicemanager_next_item',
- QtCore.Qt.Key_Space: 'slidecontroller_live_next_noloop',
- QtCore.Qt.Key_Enter: 'slidecontroller_live_next_noloop',
- QtCore.Qt.Key_0: 'servicemanager_next_item',
- QtCore.Qt.Key_Backspace: 'slidecontroller_live_previous_noloop'}
-
- def keyPressEvent(self, event):
- if isinstance(event, QtGui.QKeyEvent):
- #here accept the event and do something
- if event.key() == QtCore.Qt.Key_Up:
- self.parent.onSlideSelectedPrevious()
- event.accept()
- elif event.key() == QtCore.Qt.Key_Down:
- self.parent.onSlideSelectedNext()
- event.accept()
- elif event.key() == QtCore.Qt.Key_PageUp:
- self.parent.onSlideSelectedFirst()
- event.accept()
- elif event.key() == QtCore.Qt.Key_PageDown:
- self.parent.onSlideSelectedLast()
- event.accept()
- elif event.key() in self.hotkeyMap and self.parent.isLive:
- Receiver.send_message(self.hotkeyMap[event.key()])
- event.accept()
- event.ignore()
- else:
- event.ignore()
-
-class SlideController(QtGui.QWidget):
- """
- SlideController is the slide controller widget. This widget is what the
- user uses to control the displaying of verses/slides/etc on the screen.
- """
- def __init__(self, parent, settingsmanager, screens, isLive=False):
- """
- Set up the Slide Controller.
- """
- QtGui.QWidget.__init__(self, parent)
- self.settingsmanager = settingsmanager
- self.isLive = isLive
- self.parent = parent
- self.screens = screens
- self.ratio = float(self.screens.current[u'size'].width()) / \
- float(self.screens.current[u'size'].height())
- self.display = MainDisplay(self, screens, isLive)
- self.loopList = [
- u'Start Loop',
- u'Loop Separator',
- u'Image SpinBox'
- ]
- self.songEditList = [
- u'Edit Song',
- ]
- self.volume = 10
- self.timer_id = 0
- self.songEdit = False
- self.selectedRow = 0
- self.serviceItem = None
- self.alertTab = None
- self.Panel = QtGui.QWidget(parent.ControlSplitter)
- self.slideList = {}
- # Layout for holding panel
- self.PanelLayout = QtGui.QVBoxLayout(self.Panel)
- self.PanelLayout.setSpacing(0)
- self.PanelLayout.setMargin(0)
- # Type label for the top of the slide controller
- self.TypeLabel = QtGui.QLabel(self.Panel)
- if self.isLive:
- self.TypeLabel.setText(translate('OpenLP.SlideController', 'Live'))
- self.split = 1
- self.typePrefix = u'live'
- else:
- self.TypeLabel.setText(translate('OpenLP.SlideController',
- 'Preview'))
- self.split = 0
- self.typePrefix = u'preview'
- self.TypeLabel.setStyleSheet(u'font-weight: bold; font-size: 12pt;')
- self.TypeLabel.setAlignment(QtCore.Qt.AlignCenter)
- self.PanelLayout.addWidget(self.TypeLabel)
- # Splitter
- self.Splitter = QtGui.QSplitter(self.Panel)
- self.Splitter.setOrientation(QtCore.Qt.Vertical)
- self.Splitter.setOpaqueResize(False)
- self.PanelLayout.addWidget(self.Splitter)
- # Actual controller section
- self.Controller = QtGui.QWidget(self.Splitter)
- self.Controller.setGeometry(QtCore.QRect(0, 0, 100, 536))
- self.Controller.setSizePolicy(
- QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
- QtGui.QSizePolicy.Maximum))
- self.ControllerLayout = QtGui.QVBoxLayout(self.Controller)
- self.ControllerLayout.setSpacing(0)
- self.ControllerLayout.setMargin(0)
- # Controller list view
- self.PreviewListWidget = SlideList(self)
- self.PreviewListWidget.setColumnCount(1)
- self.PreviewListWidget.horizontalHeader().setVisible(False)
- self.PreviewListWidget.setColumnWidth(
- 0, self.Controller.width())
- self.PreviewListWidget.isLive = self.isLive
- self.PreviewListWidget.setObjectName(u'PreviewListWidget')
- self.PreviewListWidget.setSelectionBehavior(1)
- self.PreviewListWidget.setEditTriggers(
- QtGui.QAbstractItemView.NoEditTriggers)
- self.PreviewListWidget.setHorizontalScrollBarPolicy(
- QtCore.Qt.ScrollBarAlwaysOff)
- self.PreviewListWidget.setAlternatingRowColors(True)
- self.ControllerLayout.addWidget(self.PreviewListWidget)
- # Build the full toolbar
- self.Toolbar = OpenLPToolbar(self)
- sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
- QtGui.QSizePolicy.Fixed)
- sizeToolbarPolicy.setHorizontalStretch(0)
- sizeToolbarPolicy.setVerticalStretch(0)
- sizeToolbarPolicy.setHeightForWidth(
- self.Toolbar.sizePolicy().hasHeightForWidth())
- self.Toolbar.setSizePolicy(sizeToolbarPolicy)
- self.Toolbar.addToolbarButton(
- u'Previous Slide', u':/slides/slide_previous.png',
- translate('OpenLP.SlideController', 'Move to previous'),
- self.onSlideSelectedPrevious)
- self.Toolbar.addToolbarButton(
- u'Next Slide', u':/slides/slide_next.png',
- translate('OpenLP.SlideController', 'Move to next'),
- self.onSlideSelectedNext)
- if self.isLive:
- self.Toolbar.addToolbarSeparator(u'Close Separator')
- self.HideMenu = QtGui.QToolButton(self.Toolbar)
- self.HideMenu.setText(translate('OpenLP.SlideController', 'Hide'))
- self.HideMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
- self.Toolbar.addToolbarWidget(u'Hide Menu', self.HideMenu)
- self.HideMenu.setMenu(QtGui.QMenu(
- translate('OpenLP.SlideController', 'Hide'), self.Toolbar))
- self.BlankScreen = QtGui.QAction(QtGui.QIcon(
- u':/slides/slide_blank.png'), u'Blank Screen', self.HideMenu)
- self.BlankScreen.setText(
- translate('OpenLP.SlideController', 'Blank Screen'))
- self.BlankScreen.setCheckable(True)
- QtCore.QObject.connect(self.BlankScreen,
- QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay)
- self.ThemeScreen = QtGui.QAction(QtGui.QIcon(
- u':/slides/slide_theme.png'), u'Blank to Theme', self.HideMenu)
- self.ThemeScreen.setText(
- translate('OpenLP.SlideController', 'Blank to Theme'))
- self.ThemeScreen.setCheckable(True)
- QtCore.QObject.connect(self.ThemeScreen,
- QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
- if self.screens.display_count > 1:
- self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
- u':/slides/slide_desktop.png'), u'Show Desktop',
- self.HideMenu)
- self.DesktopScreen.setText(
- translate('OpenLP.SlideController', 'Show Desktop'))
- self.DesktopScreen.setCheckable(True)
- QtCore.QObject.connect(self.DesktopScreen,
- QtCore.SIGNAL("triggered(bool)"), self.onHideDisplay)
- self.HideMenu.setDefaultAction(self.BlankScreen)
- self.HideMenu.menu().addAction(self.BlankScreen)
- self.HideMenu.menu().addAction(self.ThemeScreen)
- if self.screens.display_count > 1:
- self.HideMenu.menu().addAction(self.DesktopScreen)
- if not self.isLive:
- self.Toolbar.addToolbarSeparator(u'Close Separator')
- self.Toolbar.addToolbarButton(
- u'Go Live', u':/general/general_live.png',
- translate('OpenLP.SlideController', 'Move to live'),
- self.onGoLive)
- self.Toolbar.addToolbarSeparator(u'Close Separator')
- self.Toolbar.addToolbarButton(
- u'Edit Song', u':/general/general_edit.png',
- translate('OpenLP.SlideController', 'Edit and re-preview Song'),
- self.onEditSong)
- if isLive:
- self.Toolbar.addToolbarSeparator(u'Loop Separator')
- self.Toolbar.addToolbarButton(
- u'Start Loop', u':/media/media_time.png',
- translate('OpenLP.SlideController', 'Start continuous loop'),
- self.onStartLoop)
- self.Toolbar.addToolbarButton(
- u'Stop Loop', u':/media/media_stop.png',
- translate('OpenLP.SlideController', 'Stop continuous loop'),
- self.onStopLoop)
- self.DelaySpinBox = QtGui.QSpinBox()
- self.DelaySpinBox.setMinimum(1)
- self.DelaySpinBox.setMaximum(180)
- self.Toolbar.addToolbarWidget(
- u'Image SpinBox', self.DelaySpinBox)
- self.DelaySpinBox.setSuffix(translate('OpenLP.SlideController',
- 's'))
- self.DelaySpinBox.setToolTip(translate('OpenLP.SlideController',
- 'Delay between slides in seconds'))
- self.ControllerLayout.addWidget(self.Toolbar)
- # Build a Media ToolBar
- self.Mediabar = OpenLPToolbar(self)
- self.Mediabar.addToolbarButton(
- u'Media Start', u':/slides/media_playback_start.png',
- translate('OpenLP.SlideController', 'Start playing media'),
- self.onMediaPlay)
- self.Mediabar.addToolbarButton(
- u'Media Pause', u':/slides/media_playback_pause.png',
- translate('OpenLP.SlideController', 'Start playing media'),
- self.onMediaPause)
- self.Mediabar.addToolbarButton(
- u'Media Stop', u':/slides/media_playback_stop.png',
- translate('OpenLP.SlideController', 'Start playing media'),
- self.onMediaStop)
- if not self.isLive:
- self.seekSlider = Phonon.SeekSlider()
- self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
- self.seekSlider.setObjectName(u'seekSlider')
- self.Mediabar.addToolbarWidget(
- u'Seek Slider', self.seekSlider)
- self.volumeSlider = Phonon.VolumeSlider()
- self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
- self.volumeSlider.setObjectName(u'volumeSlider')
- self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
- else:
- self.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
- self.volumeSlider.setTickInterval(1)
- self.volumeSlider.setTickPosition(QtGui.QSlider.TicksAbove)
- self.volumeSlider.setMinimum(0)
- self.volumeSlider.setMaximum(10)
- self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
- self.volumeSlider.setObjectName(u'volumeSlider')
- self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
- self.ControllerLayout.addWidget(self.Mediabar)
- # Build the Song Toolbar
- if isLive:
- self.SongMenu = QtGui.QToolButton(self.Toolbar)
- self.SongMenu.setText(translate('OpenLP.SlideController',
- 'Go to'))
- self.SongMenu.setPopupMode(QtGui.QToolButton.InstantPopup)
- self.Toolbar.addToolbarWidget(u'Song Menu', self.SongMenu)
- self.SongMenu.setMenu(QtGui.QMenu(
- translate('OpenLP.SlideController', 'Go to'),
- self.Toolbar))
- self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
- # Screen preview area
- self.PreviewFrame = QtGui.QFrame(self.Splitter)
- self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 225))
- self.PreviewFrame.setSizePolicy(QtGui.QSizePolicy(
- QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum,
- QtGui.QSizePolicy.Label))
- self.PreviewFrame.setFrameShape(QtGui.QFrame.StyledPanel)
- self.PreviewFrame.setFrameShadow(QtGui.QFrame.Sunken)
- self.PreviewFrame.setObjectName(u'PreviewFrame')
- self.grid = QtGui.QGridLayout(self.PreviewFrame)
- self.grid.setMargin(8)
- self.grid.setObjectName(u'grid')
- self.SlideLayout = QtGui.QVBoxLayout()
- self.SlideLayout.setSpacing(0)
- self.SlideLayout.setMargin(0)
- self.SlideLayout.setObjectName(u'SlideLayout')
- self.mediaObject = Phonon.MediaObject(self)
- self.video = Phonon.VideoWidget()
- self.video.setVisible(False)
- self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
- Phonon.createPath(self.mediaObject, self.video)
- Phonon.createPath(self.mediaObject, self.audio)
- if not self.isLive:
- self.video.setGeometry(QtCore.QRect(0, 0, 300, 225))
- self.video.setVisible(False)
- self.SlideLayout.insertWidget(0, self.video)
- # Actual preview screen
- self.SlidePreview = QtGui.QLabel(self)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
- QtGui.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(
- self.SlidePreview.sizePolicy().hasHeightForWidth())
- self.SlidePreview.setSizePolicy(sizePolicy)
- self.SlidePreview.setFixedSize(
- QtCore.QSize(self.settingsmanager.slidecontroller_image,
- self.settingsmanager.slidecontroller_image / self.ratio))
- self.SlidePreview.setFrameShape(QtGui.QFrame.Box)
- self.SlidePreview.setFrameShadow(QtGui.QFrame.Plain)
- self.SlidePreview.setLineWidth(1)
- self.SlidePreview.setScaledContents(True)
- self.SlidePreview.setObjectName(u'SlidePreview')
- self.SlideLayout.insertWidget(0, self.SlidePreview)
- self.grid.addLayout(self.SlideLayout, 0, 0, 1, 1)
- # Signals
- QtCore.QObject.connect(self.PreviewListWidget,
- QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
- if not self.isLive:
- if QtCore.QSettings().value(u'advanced/double click live',
- QtCore.QVariant(False)).toBool():
- QtCore.QObject.connect(self.PreviewListWidget,
- QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLive)
- if isLive:
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
- self.receiveSpinDelay)
- if isLive:
- self.Toolbar.makeWidgetsInvisible(self.loopList)
- self.Toolbar.actions[u'Stop Loop'].setVisible(False)
- else:
- self.Toolbar.makeWidgetsInvisible(self.songEditList)
- self.Mediabar.setVisible(False)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.typePrefix),
- self.onStopLoop)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_first' % self.typePrefix),
- self.onSlideSelectedFirst)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_next' % self.typePrefix),
- self.onSlideSelectedNext)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.typePrefix),
- self.onSlideSelectedPrevious)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_next_noloop' % self.typePrefix),
- self.onSlideSelectedNextNoloop)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_previous_noloop' %
- self.typePrefix),
- self.onSlideSelectedPreviousNoloop)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_last' % self.typePrefix),
- self.onSlideSelectedLast)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_change' % self.typePrefix),
- self.onSlideChange)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_set' % self.typePrefix),
- self.onSlideSelectedIndex)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.typePrefix),
- self.onSlideBlank)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.typePrefix),
- self.onSlideUnblank)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix),
- self.onTextRequest)
- QtCore.QObject.connect(self.Splitter,
- QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged)
- if self.isLive:
- QtCore.QObject.connect(self.volumeSlider,
- QtCore.SIGNAL(u'sliderReleased()'), self.mediaVolume)
-
- def screenSizeChanged(self):
- """
- Settings dialog has changed the screen size of adjust output and
- screen previews
- """
- log.debug(u'screenSizeChanged live = %s' % self.isLive)
- # rebuild display as screen size changed
- self.display = MainDisplay(self, self.screens, self.isLive)
- self.display.alertTab = self.alertTab
- self.ratio = float(self.screens.current[u'size'].width()) / \
- float(self.screens.current[u'size'].height())
- self.display.setup()
- self.SlidePreview.setFixedSize(
- QtCore.QSize(self.settingsmanager.slidecontroller_image,
- self.settingsmanager.slidecontroller_image / self.ratio))
-
- def widthChanged(self):
- """
- Handle changes of width from the splitter between the live and preview
- controller. Event only issues when changes have finished
- """
- log.debug(u'widthChanged live = %s' % self.isLive)
- width = self.parent.ControlSplitter.sizes()[self.split]
- height = width * self.parent.RenderManager.screen_ratio
- self.PreviewListWidget.setColumnWidth(0, width)
- # Sort out image heights (Songs, bibles excluded)
- if self.serviceItem and not self.serviceItem.is_text():
- for framenumber in range(len(self.serviceItem.get_frames())):
- self.PreviewListWidget.setRowHeight(framenumber, height)
-
- def trackSplitter(self, tab, pos):
- """
- Splitter between the slide list and the preview panel
- """
- pass
-
- def onSongBarHandler(self):
- request = unicode(self.sender().text())
- slideno = self.slideList[request]
- if slideno > self.PreviewListWidget.rowCount():
- self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
- else:
- self.PreviewListWidget.selectRow(slideno)
- self.onSlideSelected()
-
- def receiveSpinDelay(self, value):
- self.DelaySpinBox.setValue(int(value))
-
- def enableToolBar(self, item):
- """
- Allows the toolbars to be reconfigured based on Controller Type
- and ServiceItem Type
- """
- if self.isLive:
- self.enableLiveToolBar(item)
- else:
- self.enablePreviewToolBar(item)
-
- def enableLiveToolBar(self, item):
- """
- Allows the live toolbar to be customised
- """
- self.Toolbar.setVisible(True)
- self.Mediabar.setVisible(False)
- self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
- self.Toolbar.makeWidgetsInvisible(self.loopList)
- self.Toolbar.actions[u'Stop Loop'].setVisible(False)
- if item.is_text():
- if QtCore.QSettings().value(
- self.parent.songsSettingsSection + u'/show songbar',
- QtCore.QVariant(True)).toBool() and len(self.slideList) > 0:
- self.Toolbar.makeWidgetsVisible([u'Song Menu'])
- if item.is_capable(ItemCapabilities.AllowsLoop) and \
- len(item.get_frames()) > 1:
- self.Toolbar.makeWidgetsVisible(self.loopList)
- if item.is_media():
- self.Toolbar.setVisible(False)
- self.Mediabar.setVisible(True)
-
- def enablePreviewToolBar(self, item):
- """
- Allows the Preview toolbar to be customised
- """
- self.Toolbar.setVisible(True)
- self.Mediabar.setVisible(False)
- self.Toolbar.makeWidgetsInvisible(self.songEditList)
- if item.is_capable(ItemCapabilities.AllowsEdit) and item.from_plugin:
- self.Toolbar.makeWidgetsVisible(self.songEditList)
- elif item.is_media():
- self.Toolbar.setVisible(False)
- self.Mediabar.setVisible(True)
- self.volumeSlider.setAudioOutput(self.audio)
-
- def refreshServiceItem(self):
- """
- Method to update the service item if the screen has changed
- """
- log.debug(u'refreshServiceItem live = %s' % self.isLive)
- if self.serviceItem:
- if self.serviceItem.is_text() or self.serviceItem.is_image():
- item = self.serviceItem
- item.render()
- self._processItem(item, self.selectedRow)
-
- def addServiceItem(self, item):
- """
- Method to install the service item into the controller
- Called by plugins
- """
- log.debug(u'addServiceItem live = %s' % self.isLive)
- item.render()
- slideno = 0
- if self.songEdit:
- slideno = self.selectedRow
- self.songEdit = False
- self._processItem(item, slideno)
-
- def replaceServiceManagerItem(self, item):
- """
- Replacement item following a remote edit
- """
- if item.__eq__(self.serviceItem):
- self._processItem(item, self.PreviewListWidget.currentRow())
-
- def addServiceManagerItem(self, item, slideno):
- """
- Method to install the service item into the controller and
- request the correct toolbar for the plugin.
- Called by ServiceManager
- """
- log.debug(u'addServiceManagerItem live = %s' % self.isLive)
- # If service item is the same as the current on only change slide
- if item.__eq__(self.serviceItem):
- self.PreviewListWidget.selectRow(slideno)
- self.onSlideSelected()
- return
- self._processItem(item, slideno)
-
- def _processItem(self, serviceItem, slideno):
- """
- Loads a ServiceItem into the system from ServiceManager
- Display the slide number passed
- """
- log.debug(u'processManagerItem live = %s' % self.isLive)
- self.onStopLoop()
- # If old item was a command tell it to stop
- if self.serviceItem:
- if self.serviceItem.is_command():
- Receiver.send_message(u'%s_stop' %
- self.serviceItem.name.lower(), [serviceItem, self.isLive])
- if self.serviceItem.is_media():
- self.onMediaStop()
- if self.isLive:
- blanked = self.BlankScreen.isChecked()
- else:
- blanked = False
- Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
- [serviceItem, self.isLive, blanked, slideno])
- self.slideList = {}
- width = self.parent.ControlSplitter.sizes()[self.split]
- # Set pointing cursor when we have somthing to point at
- self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor)
- self.serviceItem = serviceItem
- self.PreviewListWidget.clear()
- self.PreviewListWidget.setRowCount(0)
- self.PreviewListWidget.setColumnWidth(0, width)
- if self.isLive:
- self.SongMenu.menu().clear()
- row = 0
- text = []
- for framenumber, frame in enumerate(self.serviceItem.get_frames()):
- self.PreviewListWidget.setRowCount(
- self.PreviewListWidget.rowCount() + 1)
- item = QtGui.QTableWidgetItem()
- slideHeight = 0
- if self.serviceItem.is_text():
- if frame[u'verseTag']:
- bits = frame[u'verseTag'].split(u':')
- tag = u'%s\n%s' % (bits[0][0], bits[1][0:] )
- tag1 = u'%s%s' % (bits[0][0], bits[1][0:] )
- row = tag
- if self.isLive:
- if tag1 not in self.slideList:
- self.slideList[tag1] = framenumber
- self.SongMenu.menu().addAction(tag1,
- self.onSongBarHandler)
- else:
- row += 1
- item.setText(frame[u'text'])
- else:
- label = QtGui.QLabel()
- label.setMargin(4)
- pixmap = resize_image(frame[u'image'],
- self.parent.RenderManager.width,
- self.parent.RenderManager.height)
- label.setScaledContents(True)
- label.setPixmap(QtGui.QPixmap.fromImage(pixmap))
- self.PreviewListWidget.setCellWidget(framenumber, 0, label)
- slideHeight = width * self.parent.RenderManager.screen_ratio
- row += 1
- text.append(unicode(row))
- self.PreviewListWidget.setItem(framenumber, 0, item)
- if slideHeight != 0:
- self.PreviewListWidget.setRowHeight(framenumber, slideHeight)
- self.PreviewListWidget.setVerticalHeaderLabels(text)
- if self.serviceItem.is_text():
- self.PreviewListWidget.resizeRowsToContents()
- self.PreviewListWidget.setColumnWidth(0,
- self.PreviewListWidget.viewport().size().width())
- if slideno > self.PreviewListWidget.rowCount():
- self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
- else:
- self.PreviewListWidget.selectRow(slideno)
- self.enableToolBar(serviceItem)
- # Pass to display for viewing
- self.display.buildHtml(self.serviceItem)
- if serviceItem.is_media():
- self.onMediaStart(serviceItem)
- self.onSlideSelected()
- self.PreviewListWidget.setFocus()
- Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix,
- [serviceItem])
-
- def onTextRequest(self):
- """
- Return the text for the current item in controller
- """
- data = []
- if self.serviceItem:
- for framenumber, frame in enumerate(self.serviceItem.get_frames()):
- dataItem = {}
- if self.serviceItem.is_text():
- dataItem[u'tag'] = unicode(frame[u'verseTag'])
- dataItem[u'text'] = unicode(frame[u'html'])
- else:
- dataItem[u'tag'] = unicode(framenumber)
- dataItem[u'text'] = u''
- dataItem[u'selected'] = \
- (self.PreviewListWidget.currentRow() == framenumber)
- data.append(dataItem)
- Receiver.send_message(u'slidecontroller_%s_text_response'
- % self.typePrefix, data)
-
- # Screen event methods
- def onSlideSelectedFirst(self):
- """
- Go to the first slide.
- """
- if not self.serviceItem:
- return
- Receiver.send_message(u'%s_first' % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
- if self.serviceItem.is_command():
- self.updatePreview()
- else:
- self.PreviewListWidget.selectRow(0)
- self.onSlideSelected()
-
- def onSlideSelectedIndex(self, message):
- """
- Go to the requested slide
- """
- index = int(message[0])
- if not self.serviceItem:
- return
- Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive, index])
- if self.serviceItem.is_command():
- self.updatePreview()
- else:
- self.PreviewListWidget.selectRow(index)
- self.onSlideSelected()
-
- def mainDisplaySetBackground(self):
- """
- Allow the main display to blank the main display at startup time
- """
- log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
- if not self.display.primary:
- self.onHideDisplay(True)
-
- def onSlideBlank(self):
- """
- Handle the slidecontroller blank event
- """
- self.onBlankDisplay(True)
-
- def onSlideUnblank(self):
- """
- Handle the slidecontroller unblank event
- """
- self.onBlankDisplay(False)
-
- def onBlankDisplay(self, checked):
- """
- Handle the blank screen button actions
- """
- log.debug(u'onBlankDisplay %s' % checked)
- self.HideMenu.setDefaultAction(self.BlankScreen)
- self.BlankScreen.setChecked(checked)
- self.ThemeScreen.setChecked(False)
- if self.screens.display_count > 1:
- self.DesktopScreen.setChecked(False)
- QtCore.QSettings().setValue(
- self.parent.generalSettingsSection + u'/screen blank',
- QtCore.QVariant(checked))
- if checked:
- Receiver.send_message(u'maindisplay_hide', HideMode.Blank)
- else:
- Receiver.send_message(u'maindisplay_show')
- self.blankPlugin(checked)
-
- def onThemeDisplay(self, checked):
- """
- Handle the Theme screen button
- """
- log.debug(u'onThemeDisplay %s' % checked)
- self.HideMenu.setDefaultAction(self.ThemeScreen)
- self.BlankScreen.setChecked(False)
- self.ThemeScreen.setChecked(checked)
- if self.screens.display_count > 1:
- self.DesktopScreen.setChecked(False)
- if checked:
- Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
- else:
- Receiver.send_message(u'maindisplay_show')
- self.blankPlugin(checked)
-
- def onHideDisplay(self, checked):
- """
- Handle the Hide screen button
- """
- log.debug(u'onHideDisplay %s' % checked)
- self.HideMenu.setDefaultAction(self.DesktopScreen)
- self.BlankScreen.setChecked(False)
- self.ThemeScreen.setChecked(False)
- if self.screens.display_count > 1:
- self.DesktopScreen.setChecked(checked)
- if checked:
- Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
- else:
- Receiver.send_message(u'maindisplay_show')
- self.hidePlugin(checked)
-
- def blankPlugin(self, blank):
- """
- Blank the display screen within a plugin if required.
- """
- log.debug(u'blankPlugin %s ', blank)
- if self.serviceItem is not None:
- if blank:
- Receiver.send_message(u'%s_blank'
- % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
- else:
- Receiver.send_message(u'%s_unblank'
- % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
-
- def hidePlugin(self, hide):
- """
- Tell the plugin to hide the display screen.
- """
- log.debug(u'hidePlugin %s ', hide)
- if self.serviceItem is not None:
- if hide:
- Receiver.send_message(u'%s_hide'
- % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
- else:
- Receiver.send_message(u'%s_unblank'
- % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
-
- def onSlideSelected(self):
- """
- Generate the preview when you click on a slide.
- if this is the Live Controller also display on the screen
- """
- row = self.PreviewListWidget.currentRow()
- self.selectedRow = 0
- if row > -1 and row < self.PreviewListWidget.rowCount():
- Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive, row])
- if self.serviceItem.is_command() and self.isLive:
- self.updatePreview()
- else:
- frame, raw_html = self.serviceItem.get_rendered_frame(row)
- if self.serviceItem.is_text():
- frame = self.display.text(raw_html)
- else:
- self.display.image(frame)
- if isinstance(frame, QtGui.QImage):
- self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
- else:
- self.SlidePreview.setPixmap(QtGui.QPixmap(frame))
- self.selectedRow = row
- Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
- row)
-
- def onSlideChange(self, row):
- """
- The slide has been changed. Update the slidecontroller accordingly
- """
- self.PreviewListWidget.selectRow(row)
- self.updatePreview()
- Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
- row)
-
- def updatePreview(self):
- if not self.screens.current[u'primary']:
- # Grab now, but try again in a couple of seconds if slide change
- # is slow
- QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
- QtCore.QTimer.singleShot(2.5, self.grabMainDisplay)
- else:
- label = self.PreviewListWidget.cellWidget(
- self.PreviewListWidget.currentRow(), 1)
- if label:
- self.SlidePreview.setPixmap(label.pixmap())
-
- def grabMainDisplay(self):
- winid = QtGui.QApplication.desktop().winId()
- rect = self.screens.current[u'size']
- winimg = QtGui.QPixmap.grabWindow(winid, rect.x(),
- rect.y(), rect.width(), rect.height())
- self.SlidePreview.setPixmap(winimg)
-
- def onSlideSelectedNextNoloop(self):
- self.onSlideSelectedNext(False)
-
- def onSlideSelectedNext(self, loop=True):
- """
- Go to the next slide.
- """
- if not self.serviceItem:
- return
- Receiver.send_message(u'%s_next' % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
- if self.serviceItem.is_command() and self.isLive:
- self.updatePreview()
- else:
- row = self.PreviewListWidget.currentRow() + 1
- if row == self.PreviewListWidget.rowCount():
- if loop:
- row = 0
- else:
- Receiver.send_message('servicemanager_next_item')
- return
- self.PreviewListWidget.selectRow(row)
- self.onSlideSelected()
-
- def onSlideSelectedPreviousNoloop(self):
- self.onSlideSelectedPrevious(False)
-
- def onSlideSelectedPrevious(self, loop=True):
- """
- Go to the previous slide.
- """
- if not self.serviceItem:
- return
- Receiver.send_message(u'%s_previous' % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
- if self.serviceItem.is_command() and self.isLive:
- self.updatePreview()
- else:
- row = self.PreviewListWidget.currentRow() - 1
- if row == -1:
- if loop:
- row = self.PreviewListWidget.rowCount() - 1
- else:
- row = 0
- self.PreviewListWidget.selectRow(row)
- self.onSlideSelected()
-
- def onSlideSelectedLast(self):
- """
- Go to the last slide.
- """
- if not self.serviceItem:
- return
- Receiver.send_message(u'%s_last' % self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
- if self.serviceItem.is_command():
- self.updatePreview()
- else:
- self.PreviewListWidget.selectRow(
- self.PreviewListWidget.rowCount() - 1)
- self.onSlideSelected()
-
- def onStartLoop(self):
- """
- Start the timer loop running and store the timer id
- """
- if self.PreviewListWidget.rowCount() > 1:
- self.timer_id = self.startTimer(
- int(self.DelaySpinBox.value()) * 1000)
- self.Toolbar.actions[u'Stop Loop'].setVisible(True)
- self.Toolbar.actions[u'Start Loop'].setVisible(False)
-
- def onStopLoop(self):
- """
- Stop the timer loop running
- """
- if self.timer_id != 0:
- self.killTimer(self.timer_id)
- self.timer_id = 0
- self.Toolbar.actions[u'Start Loop'].setVisible(True)
- self.Toolbar.actions[u'Stop Loop'].setVisible(False)
-
- def timerEvent(self, event):
- """
- If the timer event is for this window select next slide
- """
- if event.timerId() == self.timer_id:
- self.onSlideSelectedNext()
-
- def onEditSong(self):
- """
- From the preview display requires the service Item to be editied
- """
- self.songEdit = True
- Receiver.send_message(u'%s_edit' % self.serviceItem.name.lower(),
- u'P:%s' % self.serviceItem.editId)
-
- def onGoLive(self):
- """
- If preview copy slide item to live
- """
- row = self.PreviewListWidget.currentRow()
- if row > -1 and row < self.PreviewListWidget.rowCount():
- self.parent.LiveController.addServiceManagerItem(
- self.serviceItem, row)
-
- def onMediaStart(self, item):
- """
- Respond to the arrival of a media service item
- """
- log.debug(u'SlideController onMediaStart')
- if self.isLive:
- file = os.path.join(item.get_frame_path(), item.get_frame_title())
- self.display.video(file, self.volume)
- self.volumeSlider.setValue(self.volume)
- else:
- self.mediaObject.stop()
- self.mediaObject.clearQueue()
- file = os.path.join(item.get_frame_path(), item.get_frame_title())
- self.mediaObject.setCurrentSource(Phonon.MediaSource(file))
- self.seekSlider.setMediaObject(self.mediaObject)
- self.seekSlider.show()
- self.onMediaPlay()
-
- def mediaVolume(self):
- """
- Respond to the release of Volume Slider
- """
- log.debug(u'SlideController mediaVolume')
- self.volume = self.volumeSlider.value()
- self.display.videoVolume(self.volume)
-
- def onMediaPause(self):
- """
- Respond to the Pause from the media Toolbar
- """
- log.debug(u'SlideController onMediaPause')
- if self.isLive:
- self.display.videoPause()
- else:
- self.mediaObject.pause()
-
- def onMediaPlay(self):
- """
- Respond to the Play from the media Toolbar
- """
- log.debug(u'SlideController onMediaPlay')
- if self.isLive:
- self.display.videoPlay()
- else:
- self.SlidePreview.hide()
- self.video.show()
- self.mediaObject.play()
-
- def onMediaStop(self):
- """
- Respond to the Stop from the media Toolbar
- """
- log.debug(u'SlideController onMediaStop')
- if self.isLive:
- self.display.videoStop()
- else:
- self.mediaObject.stop()
- self.video.hide()
- self.SlidePreview.clear()
- self.SlidePreview.show()
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+import os
+
+from PyQt4 import QtCore, QtGui
+from PyQt4.phonon import Phonon
+
+from openlp.core.ui import HideMode, MainDisplay
+from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \
+ ItemCapabilities, translate
+
+log = logging.getLogger(__name__)
+
+class SlideList(QtGui.QTableWidget):
+ """
+ Customised version of QTableWidget which can respond to keyboard
+ events.
+ """
+ def __init__(self, parent=None, name=None):
+ QtGui.QTableWidget.__init__(self, parent.Controller)
+ self.parent = parent
+ self.hotkeyMap = {
+ QtCore.Qt.Key_Return: 'servicemanager_next_item',
+ QtCore.Qt.Key_Space: 'slidecontroller_live_next_noloop',
+ QtCore.Qt.Key_Enter: 'slidecontroller_live_next_noloop',
+ QtCore.Qt.Key_0: 'servicemanager_next_item',
+ QtCore.Qt.Key_Backspace: 'slidecontroller_live_previous_noloop'}
+
+ def keyPressEvent(self, event):
+ if isinstance(event, QtGui.QKeyEvent):
+ #here accept the event and do something
+ if event.key() == QtCore.Qt.Key_Up:
+ self.parent.onSlideSelectedPrevious()
+ event.accept()
+ elif event.key() == QtCore.Qt.Key_Down:
+ self.parent.onSlideSelectedNext()
+ event.accept()
+ elif event.key() == QtCore.Qt.Key_PageUp:
+ self.parent.onSlideSelectedFirst()
+ event.accept()
+ elif event.key() == QtCore.Qt.Key_PageDown:
+ self.parent.onSlideSelectedLast()
+ event.accept()
+ elif event.key() in self.hotkeyMap and self.parent.isLive:
+ Receiver.send_message(self.hotkeyMap[event.key()])
+ event.accept()
+ event.ignore()
+ else:
+ event.ignore()
+
+class SlideController(QtGui.QWidget):
+ """
+ SlideController is the slide controller widget. This widget is what the
+ user uses to control the displaying of verses/slides/etc on the screen.
+ """
+ def __init__(self, parent, settingsmanager, screens, isLive=False):
+ """
+ Set up the Slide Controller.
+ """
+ QtGui.QWidget.__init__(self, parent)
+ self.settingsmanager = settingsmanager
+ self.isLive = isLive
+ self.parent = parent
+ self.screens = screens
+ self.ratio = float(self.screens.current[u'size'].width()) / \
+ float(self.screens.current[u'size'].height())
+ self.display = MainDisplay(self, screens, isLive)
+ self.loopList = [
+ u'Start Loop',
+ u'Loop Separator',
+ u'Image SpinBox'
+ ]
+ self.songEditList = [
+ u'Edit Song',
+ ]
+ self.volume = 10
+ self.timer_id = 0
+ self.songEdit = False
+ self.selectedRow = 0
+ self.serviceItem = None
+ self.alertTab = None
+ self.Panel = QtGui.QWidget(parent.ControlSplitter)
+ self.slideList = {}
+ # Layout for holding panel
+ self.PanelLayout = QtGui.QVBoxLayout(self.Panel)
+ self.PanelLayout.setSpacing(0)
+ self.PanelLayout.setMargin(0)
+ # Type label for the top of the slide controller
+ self.TypeLabel = QtGui.QLabel(self.Panel)
+ if self.isLive:
+ self.TypeLabel.setText(translate('OpenLP.SlideController', 'Live'))
+ self.split = 1
+ self.typePrefix = u'live'
+ else:
+ self.TypeLabel.setText(translate('OpenLP.SlideController',
+ 'Preview'))
+ self.split = 0
+ self.typePrefix = u'preview'
+ self.TypeLabel.setStyleSheet(u'font-weight: bold; font-size: 12pt;')
+ self.TypeLabel.setAlignment(QtCore.Qt.AlignCenter)
+ self.PanelLayout.addWidget(self.TypeLabel)
+ # Splitter
+ self.Splitter = QtGui.QSplitter(self.Panel)
+ self.Splitter.setOrientation(QtCore.Qt.Vertical)
+ self.Splitter.setOpaqueResize(False)
+ self.PanelLayout.addWidget(self.Splitter)
+ # Actual controller section
+ self.Controller = QtGui.QWidget(self.Splitter)
+ self.Controller.setGeometry(QtCore.QRect(0, 0, 100, 536))
+ self.Controller.setSizePolicy(
+ QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
+ QtGui.QSizePolicy.Maximum))
+ self.ControllerLayout = QtGui.QVBoxLayout(self.Controller)
+ self.ControllerLayout.setSpacing(0)
+ self.ControllerLayout.setMargin(0)
+ # Controller list view
+ self.PreviewListWidget = SlideList(self)
+ self.PreviewListWidget.setColumnCount(1)
+ self.PreviewListWidget.horizontalHeader().setVisible(False)
+ self.PreviewListWidget.setColumnWidth(
+ 0, self.Controller.width())
+ self.PreviewListWidget.isLive = self.isLive
+ self.PreviewListWidget.setObjectName(u'PreviewListWidget')
+ self.PreviewListWidget.setSelectionBehavior(1)
+ self.PreviewListWidget.setEditTriggers(
+ QtGui.QAbstractItemView.NoEditTriggers)
+ self.PreviewListWidget.setHorizontalScrollBarPolicy(
+ QtCore.Qt.ScrollBarAlwaysOff)
+ self.PreviewListWidget.setAlternatingRowColors(True)
+ self.ControllerLayout.addWidget(self.PreviewListWidget)
+ # Build the full toolbar
+ self.Toolbar = OpenLPToolbar(self)
+ sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
+ QtGui.QSizePolicy.Fixed)
+ sizeToolbarPolicy.setHorizontalStretch(0)
+ sizeToolbarPolicy.setVerticalStretch(0)
+ sizeToolbarPolicy.setHeightForWidth(
+ self.Toolbar.sizePolicy().hasHeightForWidth())
+ self.Toolbar.setSizePolicy(sizeToolbarPolicy)
+ self.Toolbar.addToolbarButton(
+ u'Previous Slide', u':/slides/slide_previous.png',
+ translate('OpenLP.SlideController', 'Move to previous'),
+ self.onSlideSelectedPrevious)
+ self.Toolbar.addToolbarButton(
+ u'Next Slide', u':/slides/slide_next.png',
+ translate('OpenLP.SlideController', 'Move to next'),
+ self.onSlideSelectedNext)
+ if self.isLive:
+ self.Toolbar.addToolbarSeparator(u'Close Separator')
+ self.HideMenu = QtGui.QToolButton(self.Toolbar)
+ self.HideMenu.setText(translate('OpenLP.SlideController', 'Hide'))
+ self.HideMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
+ self.Toolbar.addToolbarWidget(u'Hide Menu', self.HideMenu)
+ self.HideMenu.setMenu(QtGui.QMenu(
+ translate('OpenLP.SlideController', 'Hide'), self.Toolbar))
+ self.BlankScreen = QtGui.QAction(QtGui.QIcon(
+ u':/slides/slide_blank.png'), u'Blank Screen', self.HideMenu)
+ self.BlankScreen.setText(
+ translate('OpenLP.SlideController', 'Blank Screen'))
+ self.BlankScreen.setCheckable(True)
+ QtCore.QObject.connect(self.BlankScreen,
+ QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay)
+ self.ThemeScreen = QtGui.QAction(QtGui.QIcon(
+ u':/slides/slide_theme.png'), u'Blank to Theme', self.HideMenu)
+ self.ThemeScreen.setText(
+ translate('OpenLP.SlideController', 'Blank to Theme'))
+ self.ThemeScreen.setCheckable(True)
+ QtCore.QObject.connect(self.ThemeScreen,
+ QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
+ if self.screens.display_count > 1:
+ self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
+ u':/slides/slide_desktop.png'), u'Show Desktop',
+ self.HideMenu)
+ self.DesktopScreen.setText(
+ translate('OpenLP.SlideController', 'Show Desktop'))
+ self.DesktopScreen.setCheckable(True)
+ QtCore.QObject.connect(self.DesktopScreen,
+ QtCore.SIGNAL("triggered(bool)"), self.onHideDisplay)
+ self.HideMenu.setDefaultAction(self.BlankScreen)
+ self.HideMenu.menu().addAction(self.BlankScreen)
+ self.HideMenu.menu().addAction(self.ThemeScreen)
+ if self.screens.display_count > 1:
+ self.HideMenu.menu().addAction(self.DesktopScreen)
+ if not self.isLive:
+ self.Toolbar.addToolbarSeparator(u'Close Separator')
+ self.Toolbar.addToolbarButton(
+ u'Go Live', u':/general/general_live.png',
+ translate('OpenLP.SlideController', 'Move to live'),
+ self.onGoLive)
+ self.Toolbar.addToolbarSeparator(u'Close Separator')
+ self.Toolbar.addToolbarButton(
+ u'Edit Song', u':/general/general_edit.png',
+ translate('OpenLP.SlideController', 'Edit and re-preview Song'),
+ self.onEditSong)
+ if isLive:
+ self.Toolbar.addToolbarSeparator(u'Loop Separator')
+ self.Toolbar.addToolbarButton(
+ u'Start Loop', u':/media/media_time.png',
+ translate('OpenLP.SlideController', 'Start continuous loop'),
+ self.onStartLoop)
+ self.Toolbar.addToolbarButton(
+ u'Stop Loop', u':/media/media_stop.png',
+ translate('OpenLP.SlideController', 'Stop continuous loop'),
+ self.onStopLoop)
+ self.DelaySpinBox = QtGui.QSpinBox()
+ self.DelaySpinBox.setMinimum(1)
+ self.DelaySpinBox.setMaximum(180)
+ self.Toolbar.addToolbarWidget(
+ u'Image SpinBox', self.DelaySpinBox)
+ self.DelaySpinBox.setSuffix(translate('OpenLP.SlideController',
+ 's'))
+ self.DelaySpinBox.setToolTip(translate('OpenLP.SlideController',
+ 'Delay between slides in seconds'))
+ self.ControllerLayout.addWidget(self.Toolbar)
+ # Build a Media ToolBar
+ self.Mediabar = OpenLPToolbar(self)
+ self.Mediabar.addToolbarButton(
+ u'Media Start', u':/slides/media_playback_start.png',
+ translate('OpenLP.SlideController', 'Start playing media'),
+ self.onMediaPlay)
+ self.Mediabar.addToolbarButton(
+ u'Media Pause', u':/slides/media_playback_pause.png',
+ translate('OpenLP.SlideController', 'Start playing media'),
+ self.onMediaPause)
+ self.Mediabar.addToolbarButton(
+ u'Media Stop', u':/slides/media_playback_stop.png',
+ translate('OpenLP.SlideController', 'Start playing media'),
+ self.onMediaStop)
+ if not self.isLive:
+ self.seekSlider = Phonon.SeekSlider()
+ self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
+ self.seekSlider.setObjectName(u'seekSlider')
+ self.Mediabar.addToolbarWidget(
+ u'Seek Slider', self.seekSlider)
+ self.volumeSlider = Phonon.VolumeSlider()
+ self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
+ self.volumeSlider.setObjectName(u'volumeSlider')
+ self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
+ else:
+ self.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
+ self.volumeSlider.setTickInterval(1)
+ self.volumeSlider.setTickPosition(QtGui.QSlider.TicksAbove)
+ self.volumeSlider.setMinimum(0)
+ self.volumeSlider.setMaximum(10)
+ self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
+ self.volumeSlider.setObjectName(u'volumeSlider')
+ self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
+ self.ControllerLayout.addWidget(self.Mediabar)
+ # Build the Song Toolbar
+ if isLive:
+ self.SongMenu = QtGui.QToolButton(self.Toolbar)
+ self.SongMenu.setText(translate('OpenLP.SlideController',
+ 'Go to'))
+ self.SongMenu.setPopupMode(QtGui.QToolButton.InstantPopup)
+ self.Toolbar.addToolbarWidget(u'Song Menu', self.SongMenu)
+ self.SongMenu.setMenu(QtGui.QMenu(
+ translate('OpenLP.SlideController', 'Go to'),
+ self.Toolbar))
+ self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
+ # Screen preview area
+ self.PreviewFrame = QtGui.QFrame(self.Splitter)
+ self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 225))
+ self.PreviewFrame.setSizePolicy(QtGui.QSizePolicy(
+ QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum,
+ QtGui.QSizePolicy.Label))
+ self.PreviewFrame.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.PreviewFrame.setFrameShadow(QtGui.QFrame.Sunken)
+ self.PreviewFrame.setObjectName(u'PreviewFrame')
+ self.grid = QtGui.QGridLayout(self.PreviewFrame)
+ self.grid.setMargin(8)
+ self.grid.setObjectName(u'grid')
+ self.SlideLayout = QtGui.QVBoxLayout()
+ self.SlideLayout.setSpacing(0)
+ self.SlideLayout.setMargin(0)
+ self.SlideLayout.setObjectName(u'SlideLayout')
+ self.mediaObject = Phonon.MediaObject(self)
+ self.video = Phonon.VideoWidget()
+ self.video.setVisible(False)
+ self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
+ Phonon.createPath(self.mediaObject, self.video)
+ Phonon.createPath(self.mediaObject, self.audio)
+ if not self.isLive:
+ self.video.setGeometry(QtCore.QRect(0, 0, 300, 225))
+ self.video.setVisible(False)
+ self.SlideLayout.insertWidget(0, self.video)
+ # Actual preview screen
+ self.SlidePreview = QtGui.QLabel(self)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
+ QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(
+ self.SlidePreview.sizePolicy().hasHeightForWidth())
+ self.SlidePreview.setSizePolicy(sizePolicy)
+ self.SlidePreview.setFixedSize(
+ QtCore.QSize(self.settingsmanager.slidecontroller_image,
+ self.settingsmanager.slidecontroller_image / self.ratio))
+ self.SlidePreview.setFrameShape(QtGui.QFrame.Box)
+ self.SlidePreview.setFrameShadow(QtGui.QFrame.Plain)
+ self.SlidePreview.setLineWidth(1)
+ self.SlidePreview.setScaledContents(True)
+ self.SlidePreview.setObjectName(u'SlidePreview')
+ self.SlideLayout.insertWidget(0, self.SlidePreview)
+ self.grid.addLayout(self.SlideLayout, 0, 0, 1, 1)
+ # Signals
+ QtCore.QObject.connect(self.PreviewListWidget,
+ QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
+ if not self.isLive:
+ if QtCore.QSettings().value(u'advanced/double click live',
+ QtCore.QVariant(False)).toBool():
+ QtCore.QObject.connect(self.PreviewListWidget,
+ QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLive)
+ if isLive:
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
+ self.receiveSpinDelay)
+ if isLive:
+ self.Toolbar.makeWidgetsInvisible(self.loopList)
+ self.Toolbar.actions[u'Stop Loop'].setVisible(False)
+ else:
+ self.Toolbar.makeWidgetsInvisible(self.songEditList)
+ self.Mediabar.setVisible(False)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.typePrefix),
+ self.onStopLoop)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_first' % self.typePrefix),
+ self.onSlideSelectedFirst)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_next' % self.typePrefix),
+ self.onSlideSelectedNext)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.typePrefix),
+ self.onSlideSelectedPrevious)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_next_noloop' % self.typePrefix),
+ self.onSlideSelectedNextNoloop)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_previous_noloop' %
+ self.typePrefix),
+ self.onSlideSelectedPreviousNoloop)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_last' % self.typePrefix),
+ self.onSlideSelectedLast)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_change' % self.typePrefix),
+ self.onSlideChange)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_set' % self.typePrefix),
+ self.onSlideSelectedIndex)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.typePrefix),
+ self.onSlideBlank)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.typePrefix),
+ self.onSlideUnblank)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix),
+ self.onTextRequest)
+ QtCore.QObject.connect(self.Splitter,
+ QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged)
+ if self.isLive:
+ QtCore.QObject.connect(self.volumeSlider,
+ QtCore.SIGNAL(u'sliderReleased()'), self.mediaVolume)
+
+ def screenSizeChanged(self):
+ """
+ Settings dialog has changed the screen size of adjust output and
+ screen previews
+ """
+ log.debug(u'screenSizeChanged live = %s' % self.isLive)
+ # rebuild display as screen size changed
+ self.display = MainDisplay(self, self.screens, self.isLive)
+ self.display.alertTab = self.alertTab
+ self.ratio = float(self.screens.current[u'size'].width()) / \
+ float(self.screens.current[u'size'].height())
+ self.display.setup()
+ self.SlidePreview.setFixedSize(
+ QtCore.QSize(self.settingsmanager.slidecontroller_image,
+ self.settingsmanager.slidecontroller_image / self.ratio))
+
+ def widthChanged(self):
+ """
+ Handle changes of width from the splitter between the live and preview
+ controller. Event only issues when changes have finished
+ """
+ log.debug(u'widthChanged live = %s' % self.isLive)
+ width = self.parent.ControlSplitter.sizes()[self.split]
+ height = width * self.parent.RenderManager.screen_ratio
+ self.PreviewListWidget.setColumnWidth(0, width)
+ # Sort out image heights (Songs, bibles excluded)
+ if self.serviceItem and not self.serviceItem.is_text():
+ for framenumber in range(len(self.serviceItem.get_frames())):
+ self.PreviewListWidget.setRowHeight(framenumber, height)
+
+ def trackSplitter(self, tab, pos):
+ """
+ Splitter between the slide list and the preview panel
+ """
+ pass
+
+ def onSongBarHandler(self):
+ request = unicode(self.sender().text())
+ slideno = self.slideList[request]
+ if slideno > self.PreviewListWidget.rowCount():
+ self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
+ else:
+ self.PreviewListWidget.selectRow(slideno)
+ self.onSlideSelected()
+
+ def receiveSpinDelay(self, value):
+ self.DelaySpinBox.setValue(int(value))
+
+ def enableToolBar(self, item):
+ """
+ Allows the toolbars to be reconfigured based on Controller Type
+ and ServiceItem Type
+ """
+ if self.isLive:
+ self.enableLiveToolBar(item)
+ else:
+ self.enablePreviewToolBar(item)
+
+ def enableLiveToolBar(self, item):
+ """
+ Allows the live toolbar to be customised
+ """
+ self.Toolbar.setVisible(True)
+ self.Mediabar.setVisible(False)
+ self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
+ self.Toolbar.makeWidgetsInvisible(self.loopList)
+ self.Toolbar.actions[u'Stop Loop'].setVisible(False)
+ if item.is_text():
+ if QtCore.QSettings().value(
+ self.parent.songsSettingsSection + u'/show songbar',
+ QtCore.QVariant(True)).toBool() and len(self.slideList) > 0:
+ self.Toolbar.makeWidgetsVisible([u'Song Menu'])
+ if item.is_capable(ItemCapabilities.AllowsLoop) and \
+ len(item.get_frames()) > 1:
+ self.Toolbar.makeWidgetsVisible(self.loopList)
+ if item.is_media():
+ self.Toolbar.setVisible(False)
+ self.Mediabar.setVisible(True)
+
+ def enablePreviewToolBar(self, item):
+ """
+ Allows the Preview toolbar to be customised
+ """
+ self.Toolbar.setVisible(True)
+ self.Mediabar.setVisible(False)
+ self.Toolbar.makeWidgetsInvisible(self.songEditList)
+ if item.is_capable(ItemCapabilities.AllowsEdit) and item.from_plugin:
+ self.Toolbar.makeWidgetsVisible(self.songEditList)
+ elif item.is_media():
+ self.Toolbar.setVisible(False)
+ self.Mediabar.setVisible(True)
+ self.volumeSlider.setAudioOutput(self.audio)
+
+ def refreshServiceItem(self):
+ """
+ Method to update the service item if the screen has changed
+ """
+ log.debug(u'refreshServiceItem live = %s' % self.isLive)
+ if self.serviceItem:
+ if self.serviceItem.is_text() or self.serviceItem.is_image():
+ item = self.serviceItem
+ item.render()
+ self._processItem(item, self.selectedRow)
+
+ def addServiceItem(self, item):
+ """
+ Method to install the service item into the controller
+ Called by plugins
+ """
+ log.debug(u'addServiceItem live = %s' % self.isLive)
+ item.render()
+ slideno = 0
+ if self.songEdit:
+ slideno = self.selectedRow
+ self.songEdit = False
+ self._processItem(item, slideno)
+
+ def replaceServiceManagerItem(self, item):
+ """
+ Replacement item following a remote edit
+ """
+ if item.__eq__(self.serviceItem):
+ self._processItem(item, self.PreviewListWidget.currentRow())
+
+ def addServiceManagerItem(self, item, slideno):
+ """
+ Method to install the service item into the controller and
+ request the correct toolbar for the plugin.
+ Called by ServiceManager
+ """
+ log.debug(u'addServiceManagerItem live = %s' % self.isLive)
+ # If service item is the same as the current on only change slide
+ if item.__eq__(self.serviceItem):
+ self.PreviewListWidget.selectRow(slideno)
+ self.onSlideSelected()
+ return
+ self._processItem(item, slideno)
+
+ def _processItem(self, serviceItem, slideno):
+ """
+ Loads a ServiceItem into the system from ServiceManager
+ Display the slide number passed
+ """
+ log.debug(u'processManagerItem live = %s' % self.isLive)
+ self.onStopLoop()
+ # If old item was a command tell it to stop
+ if self.serviceItem:
+ if self.serviceItem.is_command():
+ Receiver.send_message(u'%s_stop' %
+ self.serviceItem.name.lower(), [serviceItem, self.isLive])
+ if self.serviceItem.is_media():
+ self.onMediaStop()
+ if self.isLive:
+ blanked = self.BlankScreen.isChecked()
+ else:
+ blanked = False
+ Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
+ [serviceItem, self.isLive, blanked, slideno])
+ self.slideList = {}
+ width = self.parent.ControlSplitter.sizes()[self.split]
+ # Set pointing cursor when we have somthing to point at
+ self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor)
+ self.serviceItem = serviceItem
+ self.PreviewListWidget.clear()
+ self.PreviewListWidget.setRowCount(0)
+ self.PreviewListWidget.setColumnWidth(0, width)
+ if self.isLive:
+ self.SongMenu.menu().clear()
+ row = 0
+ text = []
+ for framenumber, frame in enumerate(self.serviceItem.get_frames()):
+ self.PreviewListWidget.setRowCount(
+ self.PreviewListWidget.rowCount() + 1)
+ item = QtGui.QTableWidgetItem()
+ slideHeight = 0
+ if self.serviceItem.is_text():
+ if frame[u'verseTag']:
+ bits = frame[u'verseTag'].split(u':')
+ tag = u'%s\n%s' % (bits[0][0], bits[1][0:] )
+ tag1 = u'%s%s' % (bits[0][0], bits[1][0:] )
+ row = tag
+ if self.isLive:
+ if tag1 not in self.slideList:
+ self.slideList[tag1] = framenumber
+ self.SongMenu.menu().addAction(tag1,
+ self.onSongBarHandler)
+ else:
+ row += 1
+ item.setText(frame[u'text'])
+ else:
+ label = QtGui.QLabel()
+ label.setMargin(4)
+ pixmap = resize_image(frame[u'image'],
+ self.parent.RenderManager.width,
+ self.parent.RenderManager.height)
+ label.setScaledContents(True)
+ label.setPixmap(QtGui.QPixmap.fromImage(pixmap))
+ self.PreviewListWidget.setCellWidget(framenumber, 0, label)
+ slideHeight = width * self.parent.RenderManager.screen_ratio
+ row += 1
+ text.append(unicode(row))
+ self.PreviewListWidget.setItem(framenumber, 0, item)
+ if slideHeight != 0:
+ self.PreviewListWidget.setRowHeight(framenumber, slideHeight)
+ self.PreviewListWidget.setVerticalHeaderLabels(text)
+ if self.serviceItem.is_text():
+ self.PreviewListWidget.resizeRowsToContents()
+ self.PreviewListWidget.setColumnWidth(0,
+ self.PreviewListWidget.viewport().size().width())
+ if slideno > self.PreviewListWidget.rowCount():
+ self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
+ else:
+ self.PreviewListWidget.selectRow(slideno)
+ self.enableToolBar(serviceItem)
+ # Pass to display for viewing
+ self.display.buildHtml(self.serviceItem)
+ if serviceItem.is_media():
+ self.onMediaStart(serviceItem)
+ self.onSlideSelected()
+ self.PreviewListWidget.setFocus()
+ Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix,
+ [serviceItem])
+
+ def onTextRequest(self):
+ """
+ Return the text for the current item in controller
+ """
+ data = []
+ if self.serviceItem:
+ for framenumber, frame in enumerate(self.serviceItem.get_frames()):
+ dataItem = {}
+ if self.serviceItem.is_text():
+ dataItem[u'tag'] = unicode(frame[u'verseTag'])
+ dataItem[u'text'] = unicode(frame[u'html'])
+ else:
+ dataItem[u'tag'] = unicode(framenumber)
+ dataItem[u'text'] = u''
+ dataItem[u'selected'] = \
+ (self.PreviewListWidget.currentRow() == framenumber)
+ data.append(dataItem)
+ Receiver.send_message(u'slidecontroller_%s_text_response'
+ % self.typePrefix, data)
+
+ # Screen event methods
+ def onSlideSelectedFirst(self):
+ """
+ Go to the first slide.
+ """
+ if not self.serviceItem:
+ return
+ Receiver.send_message(u'%s_first' % self.serviceItem.name.lower(),
+ [self.serviceItem, self.isLive])
+ if self.serviceItem.is_command():
+ self.updatePreview()
+ else:
+ self.PreviewListWidget.selectRow(0)
+ self.onSlideSelected()
+
+ def onSlideSelectedIndex(self, message):
+ """
+ Go to the requested slide
+ """
+ index = int(message[0])
+ if not self.serviceItem:
+ return
+ Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
+ [self.serviceItem, self.isLive, index])
+ if self.serviceItem.is_command():
+ self.updatePreview()
+ else:
+ self.PreviewListWidget.selectRow(index)
+ self.onSlideSelected()
+
+ def mainDisplaySetBackground(self):
+ """
+ Allow the main display to blank the main display at startup time
+ """
+ log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
+ if not self.display.primary:
+ self.onHideDisplay(True)
+
+ def onSlideBlank(self):
+ """
+ Handle the slidecontroller blank event
+ """
+ self.onBlankDisplay(True)
+
+ def onSlideUnblank(self):
+ """
+ Handle the slidecontroller unblank event
+ """
+ self.onBlankDisplay(False)
+
+ def onBlankDisplay(self, checked):
+ """
+ Handle the blank screen button actions
+ """
+ log.debug(u'onBlankDisplay %s' % checked)
+ self.HideMenu.setDefaultAction(self.BlankScreen)
+ self.BlankScreen.setChecked(checked)
+ self.ThemeScreen.setChecked(False)
+ if self.screens.display_count > 1:
+ self.DesktopScreen.setChecked(False)
+ QtCore.QSettings().setValue(
+ self.parent.generalSettingsSection + u'/screen blank',
+ QtCore.QVariant(checked))
+ if checked:
+ Receiver.send_message(u'maindisplay_hide', HideMode.Blank)
+ else:
+ Receiver.send_message(u'maindisplay_show')
+ self.blankPlugin(checked)
+
+ def onThemeDisplay(self, checked):
+ """
+ Handle the Theme screen button
+ """
+ log.debug(u'onThemeDisplay %s' % checked)
+ self.HideMenu.setDefaultAction(self.ThemeScreen)
+ self.BlankScreen.setChecked(False)
+ self.ThemeScreen.setChecked(checked)
+ if self.screens.display_count > 1:
+ self.DesktopScreen.setChecked(False)
+ if checked:
+ Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
+ else:
+ Receiver.send_message(u'maindisplay_show')
+ self.blankPlugin(checked)
+
+ def onHideDisplay(self, checked):
+ """
+ Handle the Hide screen button
+ """
+ log.debug(u'onHideDisplay %s' % checked)
+ self.HideMenu.setDefaultAction(self.DesktopScreen)
+ self.BlankScreen.setChecked(False)
+ self.ThemeScreen.setChecked(False)
+ if self.screens.display_count > 1:
+ self.DesktopScreen.setChecked(checked)
+ if checked:
+ Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
+ else:
+ Receiver.send_message(u'maindisplay_show')
+ self.hidePlugin(checked)
+
+ def blankPlugin(self, blank):
+ """
+ Blank the display screen within a plugin if required.
+ """
+ log.debug(u'blankPlugin %s ', blank)
+ if self.serviceItem is not None:
+ if blank:
+ Receiver.send_message(u'%s_blank'
+ % self.serviceItem.name.lower(),
+ [self.serviceItem, self.isLive])
+ else:
+ Receiver.send_message(u'%s_unblank'
+ % self.serviceItem.name.lower(),
+ [self.serviceItem, self.isLive])
+
+ def hidePlugin(self, hide):
+ """
+ Tell the plugin to hide the display screen.
+ """
+ log.debug(u'hidePlugin %s ', hide)
+ if self.serviceItem is not None:
+ if hide:
+ Receiver.send_message(u'%s_hide'
+ % self.serviceItem.name.lower(),
+ [self.serviceItem, self.isLive])
+ else:
+ Receiver.send_message(u'%s_unblank'
+ % self.serviceItem.name.lower(),
+ [self.serviceItem, self.isLive])
+
+ def onSlideSelected(self):
+ """
+ Generate the preview when you click on a slide.
+ if this is the Live Controller also display on the screen
+ """
+ row = self.PreviewListWidget.currentRow()
+ self.selectedRow = 0
+ if row > -1 and row < self.PreviewListWidget.rowCount():
+ Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
+ [self.serviceItem, self.isLive, row])
+ if self.serviceItem.is_command() and self.isLive:
+ self.updatePreview()
+ else:
+ frame, raw_html = self.serviceItem.get_rendered_frame(row)
+ if self.serviceItem.is_text():
+ frame = self.display.text(raw_html)
+ else:
+ self.display.image(frame)
+ if isinstance(frame, QtGui.QImage):
+ self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
+ else:
+ self.SlidePreview.setPixmap(QtGui.QPixmap(frame))
+ self.selectedRow = row
+ Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
+ row)
+
+ def onSlideChange(self, row):
+ """
+ The slide has been changed. Update the slidecontroller accordingly
+ """
+ self.PreviewListWidget.selectRow(row)
+ self.updatePreview()
+ Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
+ row)
+
+ def updatePreview(self):
+ if not self.screens.current[u'primary']:
+ # Grab now, but try again in a couple of seconds if slide change
+ # is slow
+ QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
+ QtCore.QTimer.singleShot(2.5, self.grabMainDisplay)
+ else:
+ label = self.PreviewListWidget.cellWidget(
+ self.PreviewListWidget.currentRow(), 1)
+ if label:
+ self.SlidePreview.setPixmap(label.pixmap())
+
+ def grabMainDisplay(self):
+ winid = QtGui.QApplication.desktop().winId()
+ rect = self.screens.current[u'size']
+ winimg = QtGui.QPixmap.grabWindow(winid, rect.x(),
+ rect.y(), rect.width(), rect.height())
+ self.SlidePreview.setPixmap(winimg)
+
+ def onSlideSelectedNextNoloop(self):
+ self.onSlideSelectedNext(False)
+
+ def onSlideSelectedNext(self, loop=True):
+ """
+ Go to the next slide.
+ """
+ if not self.serviceItem:
+ return
+ Receiver.send_message(u'%s_next' % self.serviceItem.name.lower(),
+ [self.serviceItem, self.isLive])
+ if self.serviceItem.is_command() and self.isLive:
+ self.updatePreview()
+ else:
+ row = self.PreviewListWidget.currentRow() + 1
+ if row == self.PreviewListWidget.rowCount():
+ if loop:
+ row = 0
+ else:
+ Receiver.send_message('servicemanager_next_item')
+ return
+ self.PreviewListWidget.selectRow(row)
+ self.onSlideSelected()
+
+ def onSlideSelectedPreviousNoloop(self):
+ self.onSlideSelectedPrevious(False)
+
+ def onSlideSelectedPrevious(self, loop=True):
+ """
+ Go to the previous slide.
+ """
+ if not self.serviceItem:
+ return
+ Receiver.send_message(u'%s_previous' % self.serviceItem.name.lower(),
+ [self.serviceItem, self.isLive])
+ if self.serviceItem.is_command() and self.isLive:
+ self.updatePreview()
+ else:
+ row = self.PreviewListWidget.currentRow() - 1
+ if row == -1:
+ if loop:
+ row = self.PreviewListWidget.rowCount() - 1
+ else:
+ row = 0
+ self.PreviewListWidget.selectRow(row)
+ self.onSlideSelected()
+
+ def onSlideSelectedLast(self):
+ """
+ Go to the last slide.
+ """
+ if not self.serviceItem:
+ return
+ Receiver.send_message(u'%s_last' % self.serviceItem.name.lower(),
+ [self.serviceItem, self.isLive])
+ if self.serviceItem.is_command():
+ self.updatePreview()
+ else:
+ self.PreviewListWidget.selectRow(
+ self.PreviewListWidget.rowCount() - 1)
+ self.onSlideSelected()
+
+ def onStartLoop(self):
+ """
+ Start the timer loop running and store the timer id
+ """
+ if self.PreviewListWidget.rowCount() > 1:
+ self.timer_id = self.startTimer(
+ int(self.DelaySpinBox.value()) * 1000)
+ self.Toolbar.actions[u'Stop Loop'].setVisible(True)
+ self.Toolbar.actions[u'Start Loop'].setVisible(False)
+
+ def onStopLoop(self):
+ """
+ Stop the timer loop running
+ """
+ if self.timer_id != 0:
+ self.killTimer(self.timer_id)
+ self.timer_id = 0
+ self.Toolbar.actions[u'Start Loop'].setVisible(True)
+ self.Toolbar.actions[u'Stop Loop'].setVisible(False)
+
+ def timerEvent(self, event):
+ """
+ If the timer event is for this window select next slide
+ """
+ if event.timerId() == self.timer_id:
+ self.onSlideSelectedNext()
+
+ def onEditSong(self):
+ """
+ From the preview display requires the service Item to be editied
+ """
+ self.songEdit = True
+ Receiver.send_message(u'%s_edit' % self.serviceItem.name.lower(),
+ u'P:%s' % self.serviceItem.editId)
+
+ def onGoLive(self):
+ """
+ If preview copy slide item to live
+ """
+ row = self.PreviewListWidget.currentRow()
+ if row > -1 and row < self.PreviewListWidget.rowCount():
+ self.parent.LiveController.addServiceManagerItem(
+ self.serviceItem, row)
+
+ def onMediaStart(self, item):
+ """
+ Respond to the arrival of a media service item
+ """
+ log.debug(u'SlideController onMediaStart')
+ if self.isLive:
+ file = os.path.join(item.get_frame_path(), item.get_frame_title())
+ self.display.video(file, self.volume)
+ self.volumeSlider.setValue(self.volume)
+ else:
+ self.mediaObject.stop()
+ self.mediaObject.clearQueue()
+ file = os.path.join(item.get_frame_path(), item.get_frame_title())
+ self.mediaObject.setCurrentSource(Phonon.MediaSource(file))
+ self.seekSlider.setMediaObject(self.mediaObject)
+ self.seekSlider.show()
+ self.onMediaPlay()
+
+ def mediaVolume(self):
+ """
+ Respond to the release of Volume Slider
+ """
+ log.debug(u'SlideController mediaVolume')
+ self.volume = self.volumeSlider.value()
+ self.display.videoVolume(self.volume)
+
+ def onMediaPause(self):
+ """
+ Respond to the Pause from the media Toolbar
+ """
+ log.debug(u'SlideController onMediaPause')
+ if self.isLive:
+ self.display.videoPause()
+ else:
+ self.mediaObject.pause()
+
+ def onMediaPlay(self):
+ """
+ Respond to the Play from the media Toolbar
+ """
+ log.debug(u'SlideController onMediaPlay')
+ if self.isLive:
+ self.display.videoPlay()
+ else:
+ self.SlidePreview.hide()
+ self.video.show()
+ self.mediaObject.play()
+
+ def onMediaStop(self):
+ """
+ Respond to the Stop from the media Toolbar
+ """
+ log.debug(u'SlideController onMediaStop')
+ if self.isLive:
+ self.display.videoStop()
+ else:
+ self.mediaObject.stop()
+ self.video.hide()
+ self.SlidePreview.clear()
+ self.SlidePreview.show()
diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py
index e07329f87..d7cd08b70 100644
--- a/openlp/plugins/alerts/alertsplugin.py
+++ b/openlp/plugins/alerts/alertsplugin.py
@@ -1,117 +1,117 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
-# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-import logging
-
-from PyQt4 import QtCore, QtGui
-
-from openlp.core.lib import Plugin, StringType, build_icon, translate
-from openlp.core.lib.db import Manager
-from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
-from openlp.plugins.alerts.lib.db import init_schema
-from openlp.plugins.alerts.forms import AlertForm
-
-log = logging.getLogger(__name__)
-
-class AlertsPlugin(Plugin):
- log.info(u'Alerts Plugin loaded')
-
- def __init__(self, plugin_helpers):
- self.set_plugin_strings()
- Plugin.__init__(self, u'Alerts', u'1.9.2', plugin_helpers)
- self.weight = -3
- self.icon = build_icon(u':/plugins/plugin_alerts.png')
- self.alertsmanager = AlertsManager(self)
- self.manager = Manager(u'alerts', init_schema)
- self.alertForm = AlertForm(self)
-
- def getSettingsTab(self):
- """
- Return the settings tab for the Alerts plugin
- """
- self.alertsTab = AlertsTab(self)
- return self.alertsTab
-
- def addToolsMenuItem(self, tools_menu):
- """
- Give the alerts plugin the opportunity to add items to the
- **Tools** menu.
-
- ``tools_menu``
- The actual **Tools** menu item, so that your actions can
- use it as their parent.
- """
- log.info(u'add tools menu')
- self.toolsAlertItem = QtGui.QAction(tools_menu)
- self.toolsAlertItem.setIcon(build_icon(u':/plugins/plugin_alerts.png'))
- self.toolsAlertItem.setObjectName(u'toolsAlertItem')
- self.toolsAlertItem.setText(translate('AlertsPlugin', '&Alert'))
- self.toolsAlertItem.setStatusTip(
- translate('AlertsPlugin', 'Show an alert message.'))
- self.toolsAlertItem.setShortcut(u'F7')
- self.serviceManager.parent.ToolsMenu.addAction(self.toolsAlertItem)
- QtCore.QObject.connect(self.toolsAlertItem,
- QtCore.SIGNAL(u'triggered()'), self.onAlertsTrigger)
- self.toolsAlertItem.setVisible(False)
-
- def initialise(self):
- log.info(u'Alerts Initialising')
- Plugin.initialise(self)
- self.toolsAlertItem.setVisible(True)
- self.liveController.alertTab = self.alertsTab
-
- def finalise(self):
- log.info(u'Alerts Finalising')
- Plugin.finalise(self)
- self.toolsAlertItem.setVisible(False)
-
- def toggleAlertsState(self):
- self.alertsActive = not self.alertsActive
- QtCore.QSettings().setValue(self.settingsSection + u'/active',
- QtCore.QVariant(self.alertsActive))
-
- def onAlertsTrigger(self):
- self.alertForm.loadList()
- self.alertForm.exec_()
-
- def about(self):
- about_text = translate('AlertsPlugin', 'Alerts Plugin'
- '
The alert plugin controls the displaying of nursery alerts '
- 'on the display screen')
- return about_text
- def set_plugin_strings(self):
- """
- Called to define all translatable texts of the plugin
- """
- self.name = u'Alerts'
- self.name_lower = u'alerts'
-
- self.strings = {}
- # for names in mediamanagerdock and pluginlist
- self.strings[StringType.Name] = {
- u'singular': translate('AlertsPlugin', 'Alert'),
- u'plural': translate('AlertsPlugin', 'Alerts')
- }
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import Plugin, StringType, build_icon, translate
+from openlp.core.lib.db import Manager
+from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
+from openlp.plugins.alerts.lib.db import init_schema
+from openlp.plugins.alerts.forms import AlertForm
+
+log = logging.getLogger(__name__)
+
+class AlertsPlugin(Plugin):
+ log.info(u'Alerts Plugin loaded')
+
+ def __init__(self, plugin_helpers):
+ self.set_plugin_strings()
+ Plugin.__init__(self, u'Alerts', u'1.9.2', plugin_helpers)
+ self.weight = -3
+ self.icon = build_icon(u':/plugins/plugin_alerts.png')
+ self.alertsmanager = AlertsManager(self)
+ self.manager = Manager(u'alerts', init_schema)
+ self.alertForm = AlertForm(self)
+
+ def getSettingsTab(self):
+ """
+ Return the settings tab for the Alerts plugin
+ """
+ self.alertsTab = AlertsTab(self)
+ return self.alertsTab
+
+ def addToolsMenuItem(self, tools_menu):
+ """
+ Give the alerts plugin the opportunity to add items to the
+ **Tools** menu.
+
+ ``tools_menu``
+ The actual **Tools** menu item, so that your actions can
+ use it as their parent.
+ """
+ log.info(u'add tools menu')
+ self.toolsAlertItem = QtGui.QAction(tools_menu)
+ self.toolsAlertItem.setIcon(build_icon(u':/plugins/plugin_alerts.png'))
+ self.toolsAlertItem.setObjectName(u'toolsAlertItem')
+ self.toolsAlertItem.setText(translate('AlertsPlugin', '&Alert'))
+ self.toolsAlertItem.setStatusTip(
+ translate('AlertsPlugin', 'Show an alert message.'))
+ self.toolsAlertItem.setShortcut(u'F7')
+ self.serviceManager.parent.ToolsMenu.addAction(self.toolsAlertItem)
+ QtCore.QObject.connect(self.toolsAlertItem,
+ QtCore.SIGNAL(u'triggered()'), self.onAlertsTrigger)
+ self.toolsAlertItem.setVisible(False)
+
+ def initialise(self):
+ log.info(u'Alerts Initialising')
+ Plugin.initialise(self)
+ self.toolsAlertItem.setVisible(True)
+ self.liveController.alertTab = self.alertsTab
+
+ def finalise(self):
+ log.info(u'Alerts Finalising')
+ Plugin.finalise(self)
+ self.toolsAlertItem.setVisible(False)
+
+ def toggleAlertsState(self):
+ self.alertsActive = not self.alertsActive
+ QtCore.QSettings().setValue(self.settingsSection + u'/active',
+ QtCore.QVariant(self.alertsActive))
+
+ def onAlertsTrigger(self):
+ self.alertForm.loadList()
+ self.alertForm.exec_()
+
+ def about(self):
+ about_text = translate('AlertsPlugin', 'Alerts Plugin'
+ '
The alert plugin controls the displaying of nursery alerts '
+ 'on the display screen')
+ return about_text
+ def set_plugin_strings(self):
+ """
+ Called to define all translatable texts of the plugin
+ """
+ self.name = u'Alerts'
+ self.name_lower = u'alerts'
+
+ self.strings = {}
+ # for names in mediamanagerdock and pluginlist
+ self.strings[StringType.Name] = {
+ u'singular': translate('AlertsPlugin', 'Alert'),
+ u'plural': translate('AlertsPlugin', 'Alerts')
+ }
diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py
index f706a50a3..5bbaf7f1b 100644
--- a/openlp/plugins/bibles/bibleplugin.py
+++ b/openlp/plugins/bibles/bibleplugin.py
@@ -1,170 +1,170 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
-# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-import logging
-
-from PyQt4 import QtCore, QtGui
-
-from openlp.core.lib import Plugin, StringType, build_icon, translate
-from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
-
-log = logging.getLogger(__name__)
-
-class BiblePlugin(Plugin):
- log.info(u'Bible Plugin loaded')
-
- def __init__(self, plugin_helpers):
- self.set_plugin_strings()
- Plugin.__init__(self, u'Bibles', u'1.9.2', plugin_helpers)
- self.weight = -9
- self.icon_path = u':/plugins/plugin_bibles.png'
- self.icon = build_icon(self.icon_path)
- self.manager = None
-
- def initialise(self):
- log.info(u'bibles Initialising')
- if self.manager is None:
- self.manager = BibleManager(self)
- Plugin.initialise(self)
- self.importBibleItem.setVisible(True)
- self.exportBibleItem.setVisible(True)
-
- def finalise(self):
- log.info(u'Plugin Finalise')
- Plugin.finalise(self)
- self.importBibleItem.setVisible(False)
- self.exportBibleItem.setVisible(False)
-
- def getSettingsTab(self):
- return BiblesTab(self.name)
-
- def getMediaManagerItem(self):
- # Create the BibleManagerItem object.
- return BibleMediaItem(self, self.icon, self.name)
-
- def addImportMenuItem(self, import_menu):
- self.importBibleItem = QtGui.QAction(import_menu)
- self.importBibleItem.setObjectName(u'importBibleItem')
- import_menu.addAction(self.importBibleItem)
- self.importBibleItem.setText(
- translate('BiblesPlugin', '&Bible'))
- # signals and slots
- QtCore.QObject.connect(self.importBibleItem,
- QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick)
- self.importBibleItem.setVisible(False)
-
- def addExportMenuItem(self, export_menu):
- self.exportBibleItem = QtGui.QAction(export_menu)
- self.exportBibleItem.setObjectName(u'exportBibleItem')
- export_menu.addAction(self.exportBibleItem)
- self.exportBibleItem.setText(translate(
- 'BiblesPlugin', '&Bible'))
- self.exportBibleItem.setVisible(False)
-
- def onBibleImportClick(self):
- if self.mediaItem:
- self.mediaItem.onImportClick()
-
- def about(self):
- about_text = translate('BiblesPlugin', 'Bible Plugin'
- '
The Bible plugin provides the ability to display bible '
- 'verses from different sources during the service.')
- return about_text
-
- def usesTheme(self, theme):
- """
- Called to find out if the bible plugin is currently using a theme.
-
- Returns True if the theme is being used, otherwise returns False.
- """
- if self.settings_tab.bible_theme == theme:
- return True
- return False
-
- def renameTheme(self, oldTheme, newTheme):
- """
- Rename the theme the bible plugin is using making the plugin use the
- new name.
-
- ``oldTheme``
- The name of the theme the plugin should stop using. Unused for
- this particular plugin.
-
- ``newTheme``
- The new name the plugin should now use.
- """
- self.settings_tab.bible_theme = newTheme
-
- def set_plugin_strings(self):
- """
- Called to define all translatable texts of the plugin
- """
- self.name = u'Bibles'
- self.name_lower = u'Bibles'
-
- self.strings = {}
- # for names in mediamanagerdock and pluginlist
- self.strings[StringType.Name] = {
- u'singular': translate('BiblesPlugin', 'Bible'),
- u'plural': translate('BiblesPlugin', 'Bibles')
- }
-
- # Middle Header Bar
- ## Import Button ##
- self.strings[StringType.Import] = {
- u'title': translate('BiblesPlugin', 'Import'),
- u'tooltip': translate('BiblesPlugin', 'Import a Bible')
- }
- ## New Button ##
- self.strings[StringType.New] = {
- u'title': translate('BiblesPlugin', 'Add'),
- u'tooltip': translate('BiblesPlugin', 'Add a new Bible')
- }
- ## Edit Button ##
- self.strings[StringType.Edit] = {
- u'title': translate('BiblesPlugin', 'Edit'),
- u'tooltip': translate('BiblesPlugin', 'Edit the selected Bible')
- }
- ## Delete Button ##
- self.strings[StringType.Delete] = {
- u'title': translate('BiblesPlugin', 'Delete'),
- u'tooltip': translate('BiblesPlugin', 'Delete the selected Bible')
- }
- ## Preview ##
- self.strings[StringType.Preview] = {
- u'title': translate('BiblesPlugin', 'Preview'),
- u'tooltip': translate('BiblesPlugin', 'Preview the selected Bible')
- }
- ## Live Button ##
- self.strings[StringType.Live] = {
- u'title': translate('BiblesPlugin', 'Live'),
- u'tooltip': translate('BiblesPlugin', 'Send the selected Bible live')
- }
- ## Add to service Button ##
- self.strings[StringType.Service] = {
- u'title': translate('BiblesPlugin', 'Service'),
- u'tooltip': translate('BiblesPlugin', 'Add the selected Bible to the service')
- }
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import Plugin, StringType, build_icon, translate
+from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
+
+log = logging.getLogger(__name__)
+
+class BiblePlugin(Plugin):
+ log.info(u'Bible Plugin loaded')
+
+ def __init__(self, plugin_helpers):
+ self.set_plugin_strings()
+ Plugin.__init__(self, u'Bibles', u'1.9.2', plugin_helpers)
+ self.weight = -9
+ self.icon_path = u':/plugins/plugin_bibles.png'
+ self.icon = build_icon(self.icon_path)
+ self.manager = None
+
+ def initialise(self):
+ log.info(u'bibles Initialising')
+ if self.manager is None:
+ self.manager = BibleManager(self)
+ Plugin.initialise(self)
+ self.importBibleItem.setVisible(True)
+ self.exportBibleItem.setVisible(True)
+
+ def finalise(self):
+ log.info(u'Plugin Finalise')
+ Plugin.finalise(self)
+ self.importBibleItem.setVisible(False)
+ self.exportBibleItem.setVisible(False)
+
+ def getSettingsTab(self):
+ return BiblesTab(self.name)
+
+ def getMediaManagerItem(self):
+ # Create the BibleManagerItem object.
+ return BibleMediaItem(self, self.icon, self.name)
+
+ def addImportMenuItem(self, import_menu):
+ self.importBibleItem = QtGui.QAction(import_menu)
+ self.importBibleItem.setObjectName(u'importBibleItem')
+ import_menu.addAction(self.importBibleItem)
+ self.importBibleItem.setText(
+ translate('BiblesPlugin', '&Bible'))
+ # signals and slots
+ QtCore.QObject.connect(self.importBibleItem,
+ QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick)
+ self.importBibleItem.setVisible(False)
+
+ def addExportMenuItem(self, export_menu):
+ self.exportBibleItem = QtGui.QAction(export_menu)
+ self.exportBibleItem.setObjectName(u'exportBibleItem')
+ export_menu.addAction(self.exportBibleItem)
+ self.exportBibleItem.setText(translate(
+ 'BiblesPlugin', '&Bible'))
+ self.exportBibleItem.setVisible(False)
+
+ def onBibleImportClick(self):
+ if self.mediaItem:
+ self.mediaItem.onImportClick()
+
+ def about(self):
+ about_text = translate('BiblesPlugin', 'Bible Plugin'
+ '
The Bible plugin provides the ability to display bible '
+ 'verses from different sources during the service.')
+ return about_text
+
+ def usesTheme(self, theme):
+ """
+ Called to find out if the bible plugin is currently using a theme.
+
+ Returns True if the theme is being used, otherwise returns False.
+ """
+ if self.settings_tab.bible_theme == theme:
+ return True
+ return False
+
+ def renameTheme(self, oldTheme, newTheme):
+ """
+ Rename the theme the bible plugin is using making the plugin use the
+ new name.
+
+ ``oldTheme``
+ The name of the theme the plugin should stop using. Unused for
+ this particular plugin.
+
+ ``newTheme``
+ The new name the plugin should now use.
+ """
+ self.settings_tab.bible_theme = newTheme
+
+ def set_plugin_strings(self):
+ """
+ Called to define all translatable texts of the plugin
+ """
+ self.name = u'Bibles'
+ self.name_lower = u'Bibles'
+
+ self.strings = {}
+ # for names in mediamanagerdock and pluginlist
+ self.strings[StringType.Name] = {
+ u'singular': translate('BiblesPlugin', 'Bible'),
+ u'plural': translate('BiblesPlugin', 'Bibles')
+ }
+
+ # Middle Header Bar
+ ## Import Button ##
+ self.strings[StringType.Import] = {
+ u'title': translate('BiblesPlugin', 'Import'),
+ u'tooltip': translate('BiblesPlugin', 'Import a Bible')
+ }
+ ## New Button ##
+ self.strings[StringType.New] = {
+ u'title': translate('BiblesPlugin', 'Add'),
+ u'tooltip': translate('BiblesPlugin', 'Add a new Bible')
+ }
+ ## Edit Button ##
+ self.strings[StringType.Edit] = {
+ u'title': translate('BiblesPlugin', 'Edit'),
+ u'tooltip': translate('BiblesPlugin', 'Edit the selected Bible')
+ }
+ ## Delete Button ##
+ self.strings[StringType.Delete] = {
+ u'title': translate('BiblesPlugin', 'Delete'),
+ u'tooltip': translate('BiblesPlugin', 'Delete the selected Bible')
+ }
+ ## Preview ##
+ self.strings[StringType.Preview] = {
+ u'title': translate('BiblesPlugin', 'Preview'),
+ u'tooltip': translate('BiblesPlugin', 'Preview the selected Bible')
+ }
+ ## Live Button ##
+ self.strings[StringType.Live] = {
+ u'title': translate('BiblesPlugin', 'Live'),
+ u'tooltip': translate('BiblesPlugin', 'Send the selected Bible live')
+ }
+ ## Add to service Button ##
+ self.strings[StringType.Service] = {
+ u'title': translate('BiblesPlugin', 'Service'),
+ u'tooltip': translate('BiblesPlugin', 'Add the selected Bible to the service')
+ }
diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py
index e387369ee..d61e2f09c 100644
--- a/openlp/plugins/custom/customplugin.py
+++ b/openlp/plugins/custom/customplugin.py
@@ -1,154 +1,154 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
-# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-import logging
-
-from forms import EditCustomForm
-
-from openlp.core.lib import Plugin, StringType, build_icon, translate
-from openlp.core.lib.db import Manager
-from openlp.plugins.custom.lib import CustomMediaItem, CustomTab
-from openlp.plugins.custom.lib.db import CustomSlide, init_schema
-
-log = logging.getLogger(__name__)
-
-class CustomPlugin(Plugin):
- """
- This plugin enables the user to create, edit and display
- custom slide shows. Custom shows are divided into slides.
- Each show is able to have it's own theme.
- Custom shows are designed to replace the use of Customs where
- the Customs plugin has become restrictive. Examples could be
- Welcome slides, Bible Reading information, Orders of service.
- """
- log.info(u'Custom Plugin loaded')
-
- def __init__(self, plugin_helpers):
- self.set_plugin_strings()
- Plugin.__init__(self, u'Custom', u'1.9.2', plugin_helpers)
- self.weight = -5
- self.custommanager = Manager(u'custom', init_schema)
- self.edit_custom_form = EditCustomForm(self.custommanager)
- self.icon_path = u':/plugins/plugin_custom.png'
- self.icon = build_icon(self.icon_path)
-
- def getSettingsTab(self):
- return CustomTab(self.name)
-
- def getMediaManagerItem(self):
- # Create the CustomManagerItem object
- return CustomMediaItem(self, self.icon, self.name)
-
- def about(self):
- about_text = translate('CustomPlugin', 'Custom Plugin'
- '
The custom plugin provides the ability to set up custom '
- 'text slides that can be displayed on the screen the same way '
- 'Customs are. This plugin provides greater freedom over the Customs '
- 'plugin.')
- return about_text
-
- def usesTheme(self, theme):
- """
- Called to find out if the custom plugin is currently using a theme.
-
- Returns True if the theme is being used, otherwise returns False.
- """
- if self.custommanager.get_all_objects(CustomSlide,
- CustomSlide.theme_name == theme):
- return True
- return False
-
- def renameTheme(self, oldTheme, newTheme):
- """
- Renames a theme the custom plugin is using making the plugin use the
- new name.
-
- ``oldTheme``
- The name of the theme the plugin should stop using.
-
- ``newTheme``
- The new name the plugin should now use.
- """
- customsUsingTheme = self.custommanager.get_all_objects(CustomSlide,
- CustomSlide.theme_name == oldTheme)
- for custom in customsUsingTheme:
- custom.theme_name = newTheme
- self.custommanager.save_object(custom)
- def set_plugin_strings(self):
- """
- Called to define all translatable texts of the plugin
- """
- self.name = u'Custom'
- self.name_lower = u'custom'
-
- self.strings = {}
- # for names in mediamanagerdock and pluginlist
- self.strings[StringType.Name] = {
- u'singular': translate('CustomsPlugin', 'Custom'),
- u'plural': translate('CustomsPlugin', 'Customs')
- }
-
- # Middle Header Bar
- ## Import Button ##
- self.strings[StringType.Import] = {
- u'title': translate('CustomsPlugin', 'Import'),
- u'tooltip': translate('CustomsPlugin', 'Import a Custom')
- }
- ## Load Button ##
- self.strings[StringType.Load] = {
- u'title': translate('CustomsPlugin', 'Load'),
- u'tooltip': translate('CustomsPlugin', 'Load a new Custom')
- }
- ## New Button ##
- self.strings[StringType.New] = {
- u'title': translate('CustomsPlugin', 'Add'),
- u'tooltip': translate('CustomsPlugin', 'Add a new Custom')
- }
- ## Edit Button ##
- self.strings[StringType.Edit] = {
- u'title': translate('CustomsPlugin', 'Edit'),
- u'tooltip': translate('CustomsPlugin', 'Edit the selected Custom')
- }
- ## Delete Button ##
- self.strings[StringType.Delete] = {
- u'title': translate('CustomsPlugin', 'Delete'),
- u'tooltip': translate('CustomsPlugin', 'Delete the selected Custom')
- }
- ## Preview ##
- self.strings[StringType.Preview] = {
- u'title': translate('CustomsPlugin', 'Preview'),
- u'tooltip': translate('CustomsPlugin', 'Preview the selected Custom')
- }
- ## Live Button ##
- self.strings[StringType.Live] = {
- u'title': translate('CustomsPlugin', 'Live'),
- u'tooltip': translate('CustomsPlugin', 'Send the selected Custom live')
- }
- ## Add to service Button ##
- self.strings[StringType.Service] = {
- u'title': translate('CustomsPlugin', 'Service'),
- u'tooltip': translate('CustomsPlugin', 'Add the selected Custom to the service')
- }
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+
+from forms import EditCustomForm
+
+from openlp.core.lib import Plugin, StringType, build_icon, translate
+from openlp.core.lib.db import Manager
+from openlp.plugins.custom.lib import CustomMediaItem, CustomTab
+from openlp.plugins.custom.lib.db import CustomSlide, init_schema
+
+log = logging.getLogger(__name__)
+
+class CustomPlugin(Plugin):
+ """
+ This plugin enables the user to create, edit and display
+ custom slide shows. Custom shows are divided into slides.
+ Each show is able to have it's own theme.
+ Custom shows are designed to replace the use of Customs where
+ the Customs plugin has become restrictive. Examples could be
+ Welcome slides, Bible Reading information, Orders of service.
+ """
+ log.info(u'Custom Plugin loaded')
+
+ def __init__(self, plugin_helpers):
+ self.set_plugin_strings()
+ Plugin.__init__(self, u'Custom', u'1.9.2', plugin_helpers)
+ self.weight = -5
+ self.custommanager = Manager(u'custom', init_schema)
+ self.edit_custom_form = EditCustomForm(self.custommanager)
+ self.icon_path = u':/plugins/plugin_custom.png'
+ self.icon = build_icon(self.icon_path)
+
+ def getSettingsTab(self):
+ return CustomTab(self.name)
+
+ def getMediaManagerItem(self):
+ # Create the CustomManagerItem object
+ return CustomMediaItem(self, self.icon, self.name)
+
+ def about(self):
+ about_text = translate('CustomPlugin', 'Custom Plugin'
+ '
The custom plugin provides the ability to set up custom '
+ 'text slides that can be displayed on the screen the same way '
+ 'Customs are. This plugin provides greater freedom over the Customs '
+ 'plugin.')
+ return about_text
+
+ def usesTheme(self, theme):
+ """
+ Called to find out if the custom plugin is currently using a theme.
+
+ Returns True if the theme is being used, otherwise returns False.
+ """
+ if self.custommanager.get_all_objects(CustomSlide,
+ CustomSlide.theme_name == theme):
+ return True
+ return False
+
+ def renameTheme(self, oldTheme, newTheme):
+ """
+ Renames a theme the custom plugin is using making the plugin use the
+ new name.
+
+ ``oldTheme``
+ The name of the theme the plugin should stop using.
+
+ ``newTheme``
+ The new name the plugin should now use.
+ """
+ customsUsingTheme = self.custommanager.get_all_objects(CustomSlide,
+ CustomSlide.theme_name == oldTheme)
+ for custom in customsUsingTheme:
+ custom.theme_name = newTheme
+ self.custommanager.save_object(custom)
+ def set_plugin_strings(self):
+ """
+ Called to define all translatable texts of the plugin
+ """
+ self.name = u'Custom'
+ self.name_lower = u'custom'
+
+ self.strings = {}
+ # for names in mediamanagerdock and pluginlist
+ self.strings[StringType.Name] = {
+ u'singular': translate('CustomsPlugin', 'Custom'),
+ u'plural': translate('CustomsPlugin', 'Customs')
+ }
+
+ # Middle Header Bar
+ ## Import Button ##
+ self.strings[StringType.Import] = {
+ u'title': translate('CustomsPlugin', 'Import'),
+ u'tooltip': translate('CustomsPlugin', 'Import a Custom')
+ }
+ ## Load Button ##
+ self.strings[StringType.Load] = {
+ u'title': translate('CustomsPlugin', 'Load'),
+ u'tooltip': translate('CustomsPlugin', 'Load a new Custom')
+ }
+ ## New Button ##
+ self.strings[StringType.New] = {
+ u'title': translate('CustomsPlugin', 'Add'),
+ u'tooltip': translate('CustomsPlugin', 'Add a new Custom')
+ }
+ ## Edit Button ##
+ self.strings[StringType.Edit] = {
+ u'title': translate('CustomsPlugin', 'Edit'),
+ u'tooltip': translate('CustomsPlugin', 'Edit the selected Custom')
+ }
+ ## Delete Button ##
+ self.strings[StringType.Delete] = {
+ u'title': translate('CustomsPlugin', 'Delete'),
+ u'tooltip': translate('CustomsPlugin', 'Delete the selected Custom')
+ }
+ ## Preview ##
+ self.strings[StringType.Preview] = {
+ u'title': translate('CustomsPlugin', 'Preview'),
+ u'tooltip': translate('CustomsPlugin', 'Preview the selected Custom')
+ }
+ ## Live Button ##
+ self.strings[StringType.Live] = {
+ u'title': translate('CustomsPlugin', 'Live'),
+ u'tooltip': translate('CustomsPlugin', 'Send the selected Custom live')
+ }
+ ## Add to service Button ##
+ self.strings[StringType.Service] = {
+ u'title': translate('CustomsPlugin', 'Service'),
+ u'tooltip': translate('CustomsPlugin', 'Add the selected Custom to the service')
+ }
diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py
index 0f2f08e26..3aa981681 100644
--- a/openlp/plugins/images/imageplugin.py
+++ b/openlp/plugins/images/imageplugin.py
@@ -1,111 +1,111 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
-# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-import logging
-
-from openlp.core.lib import Plugin, StringType, build_icon, translate
-from openlp.plugins.images.lib import ImageMediaItem
-
-log = logging.getLogger(__name__)
-
-class ImagePlugin(Plugin):
- log.info(u'Image Plugin loaded')
-
- def __init__(self, plugin_helpers):
- self.set_plugin_strings()
- Plugin.__init__(self, u'Images', u'1.9.2', plugin_helpers)
- self.weight = -7
- self.icon_path = u':/plugins/plugin_images.png'
- self.icon = build_icon(self.icon_path)
-
- def getMediaManagerItem(self):
- # Create the MediaManagerItem object
- return ImageMediaItem(self, self.icon, self.name)
-
- def about(self):
- about_text = translate('ImagePlugin', 'Image Plugin'
- '
The image plugin provides displaying of images.
One '
- 'of the distinguishing features of this plugin is the ability to '
- 'group a number of images together in the service manager, making '
- 'the displaying of multiple images easier. This plugin can also '
- 'make use of OpenLP\'s "timed looping" feature to create a slide '
- 'show that runs automatically. In addition to this, images from '
- 'the plugin can be used to override the current theme\'s '
- 'background, which renders text-based items like Images with the '
- 'selected image as a background instead of the background '
- 'provided by the theme.')
- return about_text
- # rimach
- def set_plugin_strings(self):
- """
- Called to define all translatable texts of the plugin
- """
- self.name = u'Images'
- self.name_lower = u'images'
-
- self.strings = {}
- # for names in mediamanagerdock and pluginlist
- self.strings[StringType.Name] = {
- u'singular': translate('ImagePlugin', 'Image'),
- u'plural': translate('ImagePlugin', 'Images')
- }
-
- # Middle Header Bar
- ## Load Button ##
- self.strings[StringType.Load] = {
- u'title': translate('ImagePlugin', 'Load'),
- u'tooltip': translate('ImagePlugin', 'Load a new Image')
- }
- ## New Button ##
- self.strings[StringType.New] = {
- u'title': translate('ImagePlugin', 'Add'),
- u'tooltip': translate('ImagePlugin', 'Add a new Image')
- }
- ## Edit Button ##
- self.strings[StringType.Edit] = {
- u'title': translate('ImagePlugin', 'Edit'),
- u'tooltip': translate('ImagePlugin', 'Edit the selected Image')
- }
- ## Delete Button ##
- self.strings[StringType.Delete] = {
- u'title': translate('ImagePlugin', 'Delete'),
- u'tooltip': translate('ImagePlugin', 'Delete the selected Image')
- }
- ## Preview ##
- self.strings[StringType.Preview] = {
- u'title': translate('ImagePlugin', 'Preview'),
- u'tooltip': translate('ImagePlugin', 'Preview the selected Image')
- }
- ## Live Button ##
- self.strings[StringType.Live] = {
- u'title': translate('ImagePlugin', 'Live'),
- u'tooltip': translate('ImagePlugin', 'Send the selected Image live')
- }
- ## Add to service Button ##
- self.strings[StringType.Service] = {
- u'title': translate('ImagePlugin', 'Service'),
- u'tooltip': translate('ImagePlugin', 'Add the selected Image to the service')
- }
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+
+from openlp.core.lib import Plugin, StringType, build_icon, translate
+from openlp.plugins.images.lib import ImageMediaItem
+
+log = logging.getLogger(__name__)
+
+class ImagePlugin(Plugin):
+ log.info(u'Image Plugin loaded')
+
+ def __init__(self, plugin_helpers):
+ self.set_plugin_strings()
+ Plugin.__init__(self, u'Images', u'1.9.2', plugin_helpers)
+ self.weight = -7
+ self.icon_path = u':/plugins/plugin_images.png'
+ self.icon = build_icon(self.icon_path)
+
+ def getMediaManagerItem(self):
+ # Create the MediaManagerItem object
+ return ImageMediaItem(self, self.icon, self.name)
+
+ def about(self):
+ about_text = translate('ImagePlugin', 'Image Plugin'
+ '
The image plugin provides displaying of images.
One '
+ 'of the distinguishing features of this plugin is the ability to '
+ 'group a number of images together in the service manager, making '
+ 'the displaying of multiple images easier. This plugin can also '
+ 'make use of OpenLP\'s "timed looping" feature to create a slide '
+ 'show that runs automatically. In addition to this, images from '
+ 'the plugin can be used to override the current theme\'s '
+ 'background, which renders text-based items like Images with the '
+ 'selected image as a background instead of the background '
+ 'provided by the theme.')
+ return about_text
+ # rimach
+ def set_plugin_strings(self):
+ """
+ Called to define all translatable texts of the plugin
+ """
+ self.name = u'Images'
+ self.name_lower = u'images'
+
+ self.strings = {}
+ # for names in mediamanagerdock and pluginlist
+ self.strings[StringType.Name] = {
+ u'singular': translate('ImagePlugin', 'Image'),
+ u'plural': translate('ImagePlugin', 'Images')
+ }
+
+ # Middle Header Bar
+ ## Load Button ##
+ self.strings[StringType.Load] = {
+ u'title': translate('ImagePlugin', 'Load'),
+ u'tooltip': translate('ImagePlugin', 'Load a new Image')
+ }
+ ## New Button ##
+ self.strings[StringType.New] = {
+ u'title': translate('ImagePlugin', 'Add'),
+ u'tooltip': translate('ImagePlugin', 'Add a new Image')
+ }
+ ## Edit Button ##
+ self.strings[StringType.Edit] = {
+ u'title': translate('ImagePlugin', 'Edit'),
+ u'tooltip': translate('ImagePlugin', 'Edit the selected Image')
+ }
+ ## Delete Button ##
+ self.strings[StringType.Delete] = {
+ u'title': translate('ImagePlugin', 'Delete'),
+ u'tooltip': translate('ImagePlugin', 'Delete the selected Image')
+ }
+ ## Preview ##
+ self.strings[StringType.Preview] = {
+ u'title': translate('ImagePlugin', 'Preview'),
+ u'tooltip': translate('ImagePlugin', 'Preview the selected Image')
+ }
+ ## Live Button ##
+ self.strings[StringType.Live] = {
+ u'title': translate('ImagePlugin', 'Live'),
+ u'tooltip': translate('ImagePlugin', 'Send the selected Image live')
+ }
+ ## Add to service Button ##
+ self.strings[StringType.Service] = {
+ u'title': translate('ImagePlugin', 'Service'),
+ u'tooltip': translate('ImagePlugin', 'Add the selected Image to the service')
+ }
diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py
index 0ffa8cfbd..6c8a2eaea 100644
--- a/openlp/plugins/media/mediaplugin.py
+++ b/openlp/plugins/media/mediaplugin.py
@@ -1,129 +1,129 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
-# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-import logging
-
-from PyQt4.phonon import Phonon
-
-from openlp.core.lib import Plugin, StringType, build_icon, translate
-from openlp.plugins.media.lib import MediaMediaItem
-
-log = logging.getLogger(__name__)
-
-class MediaPlugin(Plugin):
- log.info(u'%s MediaPlugin loaded', __name__)
-
- def __init__(self, plugin_helpers):
- self.set_plugin_strings()
- Plugin.__init__(self, u'Media', u'1.9.2', plugin_helpers)
- self.weight = -6
- self.icon_path = u':/plugins/plugin_media.png'
- self.icon = build_icon(self.icon_path)
- # passed with drag and drop messages
- self.dnd_id = u'Media'
- self.audio_list = u''
- self.video_list = u''
- for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
- mimetype = unicode(mimetype)
- type = mimetype.split(u'audio/x-')
- self.audio_list, mimetype = self._addToList(self.audio_list,
- type, mimetype)
- type = mimetype.split(u'audio/')
- self.audio_list, mimetype = self._addToList(self.audio_list,
- type, mimetype)
- type = mimetype.split(u'video/x-')
- self.video_list, mimetype = self._addToList(self.video_list,
- type, mimetype)
- type = mimetype.split(u'video/')
- self.video_list, mimetype = self._addToList(self.video_list,
- type, mimetype)
-
- def _addToList(self, list, value, type):
- if len(value) == 2:
- if list.find(value[1]) == -1:
- list += u'*.%s ' % value[1]
- self.serviceManager.supportedSuffixes(value[1])
- type = u''
- return list, type
-
- def getMediaManagerItem(self):
- # Create the MediaManagerItem object
- return MediaMediaItem(self, self.icon, self.name)
-
- def about(self):
- about_text = translate('MediaPlugin', 'Media Plugin'
- '
The media plugin provides playback of audio and video.')
- return about_text
- def set_plugin_strings(self):
- """
- Called to define all translatable texts of the plugin
- """
- self.name = u'Media'
- self.name_lower = u'media'
-
- self.strings = {}
- # for names in mediamanagerdock and pluginlist
- self.strings[StringType.Name] = {
- u'singular': translate('MediaPlugin', 'Media'),
- u'plural': translate('MediaPlugin', 'Medias')
- }
-
- # Middle Header Bar
- ## Load Button ##
- self.strings[StringType.Load] = {
- u'title': translate('MediaPlugin', 'Load'),
- u'tooltip': translate('MediaPlugin', 'Load a new Media')
- }
- ## New Button ##
- self.strings[StringType.New] = {
- u'title': translate('MediaPlugin', 'Add'),
- u'tooltip': translate('MediaPlugin', 'Add a new Media')
- }
- ## Edit Button ##
- self.strings[StringType.Edit] = {
- u'title': translate('MediaPlugin', 'Edit'),
- u'tooltip': translate('MediaPlugin', 'Edit the selected Media')
- }
- ## Delete Button ##
- self.strings[StringType.Delete] = {
- u'title': translate('MediaPlugin', 'Delete'),
- u'tooltip': translate('MediaPlugin', 'Delete the selected Media')
- }
- ## Preview ##
- self.strings[StringType.Preview] = {
- u'title': translate('MediaPlugin', 'Preview'),
- u'tooltip': translate('MediaPlugin', 'Preview the selected Media')
- }
- ## Live Button ##
- self.strings[StringType.Live] = {
- u'title': translate('MediaPlugin', 'Live'),
- u'tooltip': translate('MediaPlugin', 'Send the selected Media live')
- }
- ## Add to service Button ##
- self.strings[StringType.Service] = {
- u'title': translate('MediaPlugin', 'Service'),
- u'tooltip': translate('MediaPlugin', 'Add the selected Media to the service')
- }
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+
+from PyQt4.phonon import Phonon
+
+from openlp.core.lib import Plugin, StringType, build_icon, translate
+from openlp.plugins.media.lib import MediaMediaItem
+
+log = logging.getLogger(__name__)
+
+class MediaPlugin(Plugin):
+ log.info(u'%s MediaPlugin loaded', __name__)
+
+ def __init__(self, plugin_helpers):
+ self.set_plugin_strings()
+ Plugin.__init__(self, u'Media', u'1.9.2', plugin_helpers)
+ self.weight = -6
+ self.icon_path = u':/plugins/plugin_media.png'
+ self.icon = build_icon(self.icon_path)
+ # passed with drag and drop messages
+ self.dnd_id = u'Media'
+ self.audio_list = u''
+ self.video_list = u''
+ for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
+ mimetype = unicode(mimetype)
+ type = mimetype.split(u'audio/x-')
+ self.audio_list, mimetype = self._addToList(self.audio_list,
+ type, mimetype)
+ type = mimetype.split(u'audio/')
+ self.audio_list, mimetype = self._addToList(self.audio_list,
+ type, mimetype)
+ type = mimetype.split(u'video/x-')
+ self.video_list, mimetype = self._addToList(self.video_list,
+ type, mimetype)
+ type = mimetype.split(u'video/')
+ self.video_list, mimetype = self._addToList(self.video_list,
+ type, mimetype)
+
+ def _addToList(self, list, value, type):
+ if len(value) == 2:
+ if list.find(value[1]) == -1:
+ list += u'*.%s ' % value[1]
+ self.serviceManager.supportedSuffixes(value[1])
+ type = u''
+ return list, type
+
+ def getMediaManagerItem(self):
+ # Create the MediaManagerItem object
+ return MediaMediaItem(self, self.icon, self.name)
+
+ def about(self):
+ about_text = translate('MediaPlugin', 'Media Plugin'
+ '
The media plugin provides playback of audio and video.')
+ return about_text
+ def set_plugin_strings(self):
+ """
+ Called to define all translatable texts of the plugin
+ """
+ self.name = u'Media'
+ self.name_lower = u'media'
+
+ self.strings = {}
+ # for names in mediamanagerdock and pluginlist
+ self.strings[StringType.Name] = {
+ u'singular': translate('MediaPlugin', 'Media'),
+ u'plural': translate('MediaPlugin', 'Medias')
+ }
+
+ # Middle Header Bar
+ ## Load Button ##
+ self.strings[StringType.Load] = {
+ u'title': translate('MediaPlugin', 'Load'),
+ u'tooltip': translate('MediaPlugin', 'Load a new Media')
+ }
+ ## New Button ##
+ self.strings[StringType.New] = {
+ u'title': translate('MediaPlugin', 'Add'),
+ u'tooltip': translate('MediaPlugin', 'Add a new Media')
+ }
+ ## Edit Button ##
+ self.strings[StringType.Edit] = {
+ u'title': translate('MediaPlugin', 'Edit'),
+ u'tooltip': translate('MediaPlugin', 'Edit the selected Media')
+ }
+ ## Delete Button ##
+ self.strings[StringType.Delete] = {
+ u'title': translate('MediaPlugin', 'Delete'),
+ u'tooltip': translate('MediaPlugin', 'Delete the selected Media')
+ }
+ ## Preview ##
+ self.strings[StringType.Preview] = {
+ u'title': translate('MediaPlugin', 'Preview'),
+ u'tooltip': translate('MediaPlugin', 'Preview the selected Media')
+ }
+ ## Live Button ##
+ self.strings[StringType.Live] = {
+ u'title': translate('MediaPlugin', 'Live'),
+ u'tooltip': translate('MediaPlugin', 'Send the selected Media live')
+ }
+ ## Add to service Button ##
+ self.strings[StringType.Service] = {
+ u'title': translate('MediaPlugin', 'Service'),
+ u'tooltip': translate('MediaPlugin', 'Add the selected Media to the service')
+ }
diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py
index e3df350d8..d53931e28 100644
--- a/openlp/plugins/presentations/presentationplugin.py
+++ b/openlp/plugins/presentations/presentationplugin.py
@@ -1,187 +1,187 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
-# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-"""
-The :mod:`presentationplugin` module provides the ability for OpenLP to display
-presentations from a variety of document formats.
-"""
-import os
-import logging
-
-from openlp.core.lib import Plugin, StringType, build_icon, translate
-from openlp.core.utils import AppLocation
-from openlp.plugins.presentations.lib import PresentationController, \
- PresentationMediaItem, PresentationTab
-
-log = logging.getLogger(__name__)
-
-class PresentationPlugin(Plugin):
- """
- This plugin allowed a Presentation to be opened, controlled and displayed
- on the output display. The plugin controls third party applications such
- as OpenOffice.org Impress, Microsoft PowerPoint and the PowerPoint viewer
- """
- log = logging.getLogger(u'PresentationPlugin')
-
- def __init__(self, plugin_helpers):
- """
- PluginPresentation constructor.
- """
- log.debug(u'Initialised')
- self.controllers = {}
- self.set_plugin_strings()
- Plugin.__init__(self, u'Presentations', u'1.9.2', plugin_helpers)
- self.weight = -8
- self.icon_path = u':/plugins/plugin_presentations.png'
- self.icon = build_icon(self.icon_path)
-
- def getSettingsTab(self):
- """
- Create the settings Tab
- """
- return PresentationTab(self.name, self.controllers)
-
- def initialise(self):
- """
- Initialise the plugin. Determine which controllers are enabled
- are start their processes.
- """
- log.info(u'Presentations Initialising')
- Plugin.initialise(self)
- self.insertToolboxItem()
- for controller in self.controllers:
- if self.controllers[controller].enabled():
- self.controllers[controller].start_process()
- self.mediaItem.buildFileMaskString()
-
- def finalise(self):
- """
- Finalise the plugin. Ask all the enabled presentation applications
- to close down their applications and release resources.
- """
- log.info(u'Plugin Finalise')
- #Ask each controller to tidy up
- for key in self.controllers:
- controller = self.controllers[key]
- if controller.enabled():
- controller.kill()
- Plugin.finalise(self)
-
- def getMediaManagerItem(self):
- """
- Create the Media Manager List
- """
- return PresentationMediaItem(
- self, self.icon, self.name, self.controllers)
-
- def registerControllers(self, controller):
- """
- Register each presentation controller (Impress, PPT etc) and
- store for later use
- """
- self.controllers[controller.name] = controller
-
- def checkPreConditions(self):
- """
- Check to see if we have any presentation software available
- If Not do not install the plugin.
- """
- log.debug(u'checkPreConditions')
- controller_dir = os.path.join(
- AppLocation.get_directory(AppLocation.PluginsDir),
- u'presentations', u'lib')
- for filename in os.listdir(controller_dir):
- if filename.endswith(u'controller.py') and \
- not filename == 'presentationcontroller.py':
- path = os.path.join(controller_dir, filename)
- if os.path.isfile(path):
- modulename = u'openlp.plugins.presentations.lib.' + \
- os.path.splitext(filename)[0]
- log.debug(u'Importing controller %s', modulename)
- try:
- __import__(modulename, globals(), locals(), [])
- except ImportError:
- log.exception(u'Failed to import %s on path %s',
- modulename, path)
- controller_classes = PresentationController.__subclasses__()
- for controller_class in controller_classes:
- controller = controller_class(self)
- self.registerControllers(controller)
- if self.controllers:
- return True
- else:
- return False
-
- def about(self):
- """
- Return information about this plugin
- """
- about_text = translate('PresentationPlugin', 'Presentation '
- 'Plugin
The presentation plugin provides the '
- 'ability to show presentations using a number of different '
- 'programs. The choice of available presentation programs is '
- 'available to the user in a drop down box.')
- return about_text
-
- def set_plugin_strings(self):
- """
- Called to define all translatable texts of the plugin
- """
- self.name = u'Presentations'
- self.name_lower = u'presentations'
-
- self.strings = {}
- # for names in mediamanagerdock and pluginlist
- self.strings[StringType.Name] = {
- u'singular': translate('PresentationPlugin', 'Presentation'),
- u'plural': translate('PresentationPlugin', 'Presentations')
- }
-
- # Middle Header Bar
- ## Load Button ##
- self.strings[StringType.Load] = {
- u'title': translate('PresentationPlugin', 'Load'),
- u'tooltip': translate('PresentationPlugin', 'Load a new Presentation')
- }
- ## Delete Button ##
- self.strings[StringType.Delete] = {
- u'title': translate('PresentationPlugin', 'Delete'),
- u'tooltip': translate('PresentationPlugin', 'Delete the selected Presentation')
- }
- ## Preview ##
- self.strings[StringType.Preview] = {
- u'title': translate('PresentationPlugin', 'Preview'),
- u'tooltip': translate('PresentationPlugin', 'Preview the selected Presentation')
- }
- ## Live Button ##
- self.strings[StringType.Live] = {
- u'title': translate('PresentationPlugin', 'Live'),
- u'tooltip': translate('PresentationPlugin', 'Send the selected Presentation live')
- }
- ## Add to service Button ##
- self.strings[StringType.Service] = {
- u'title': translate('PresentationPlugin', 'Service'),
- u'tooltip': translate('PresentationPlugin', 'Add the selected Presentation to the service')
- }
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+"""
+The :mod:`presentationplugin` module provides the ability for OpenLP to display
+presentations from a variety of document formats.
+"""
+import os
+import logging
+
+from openlp.core.lib import Plugin, StringType, build_icon, translate
+from openlp.core.utils import AppLocation
+from openlp.plugins.presentations.lib import PresentationController, \
+ PresentationMediaItem, PresentationTab
+
+log = logging.getLogger(__name__)
+
+class PresentationPlugin(Plugin):
+ """
+ This plugin allowed a Presentation to be opened, controlled and displayed
+ on the output display. The plugin controls third party applications such
+ as OpenOffice.org Impress, Microsoft PowerPoint and the PowerPoint viewer
+ """
+ log = logging.getLogger(u'PresentationPlugin')
+
+ def __init__(self, plugin_helpers):
+ """
+ PluginPresentation constructor.
+ """
+ log.debug(u'Initialised')
+ self.controllers = {}
+ self.set_plugin_strings()
+ Plugin.__init__(self, u'Presentations', u'1.9.2', plugin_helpers)
+ self.weight = -8
+ self.icon_path = u':/plugins/plugin_presentations.png'
+ self.icon = build_icon(self.icon_path)
+
+ def getSettingsTab(self):
+ """
+ Create the settings Tab
+ """
+ return PresentationTab(self.name, self.controllers)
+
+ def initialise(self):
+ """
+ Initialise the plugin. Determine which controllers are enabled
+ are start their processes.
+ """
+ log.info(u'Presentations Initialising')
+ Plugin.initialise(self)
+ self.insertToolboxItem()
+ for controller in self.controllers:
+ if self.controllers[controller].enabled():
+ self.controllers[controller].start_process()
+ self.mediaItem.buildFileMaskString()
+
+ def finalise(self):
+ """
+ Finalise the plugin. Ask all the enabled presentation applications
+ to close down their applications and release resources.
+ """
+ log.info(u'Plugin Finalise')
+ #Ask each controller to tidy up
+ for key in self.controllers:
+ controller = self.controllers[key]
+ if controller.enabled():
+ controller.kill()
+ Plugin.finalise(self)
+
+ def getMediaManagerItem(self):
+ """
+ Create the Media Manager List
+ """
+ return PresentationMediaItem(
+ self, self.icon, self.name, self.controllers)
+
+ def registerControllers(self, controller):
+ """
+ Register each presentation controller (Impress, PPT etc) and
+ store for later use
+ """
+ self.controllers[controller.name] = controller
+
+ def checkPreConditions(self):
+ """
+ Check to see if we have any presentation software available
+ If Not do not install the plugin.
+ """
+ log.debug(u'checkPreConditions')
+ controller_dir = os.path.join(
+ AppLocation.get_directory(AppLocation.PluginsDir),
+ u'presentations', u'lib')
+ for filename in os.listdir(controller_dir):
+ if filename.endswith(u'controller.py') and \
+ not filename == 'presentationcontroller.py':
+ path = os.path.join(controller_dir, filename)
+ if os.path.isfile(path):
+ modulename = u'openlp.plugins.presentations.lib.' + \
+ os.path.splitext(filename)[0]
+ log.debug(u'Importing controller %s', modulename)
+ try:
+ __import__(modulename, globals(), locals(), [])
+ except ImportError:
+ log.exception(u'Failed to import %s on path %s',
+ modulename, path)
+ controller_classes = PresentationController.__subclasses__()
+ for controller_class in controller_classes:
+ controller = controller_class(self)
+ self.registerControllers(controller)
+ if self.controllers:
+ return True
+ else:
+ return False
+
+ def about(self):
+ """
+ Return information about this plugin
+ """
+ about_text = translate('PresentationPlugin', 'Presentation '
+ 'Plugin
The presentation plugin provides the '
+ 'ability to show presentations using a number of different '
+ 'programs. The choice of available presentation programs is '
+ 'available to the user in a drop down box.')
+ return about_text
+
+ def set_plugin_strings(self):
+ """
+ Called to define all translatable texts of the plugin
+ """
+ self.name = u'Presentations'
+ self.name_lower = u'presentations'
+
+ self.strings = {}
+ # for names in mediamanagerdock and pluginlist
+ self.strings[StringType.Name] = {
+ u'singular': translate('PresentationPlugin', 'Presentation'),
+ u'plural': translate('PresentationPlugin', 'Presentations')
+ }
+
+ # Middle Header Bar
+ ## Load Button ##
+ self.strings[StringType.Load] = {
+ u'title': translate('PresentationPlugin', 'Load'),
+ u'tooltip': translate('PresentationPlugin', 'Load a new Presentation')
+ }
+ ## Delete Button ##
+ self.strings[StringType.Delete] = {
+ u'title': translate('PresentationPlugin', 'Delete'),
+ u'tooltip': translate('PresentationPlugin', 'Delete the selected Presentation')
+ }
+ ## Preview ##
+ self.strings[StringType.Preview] = {
+ u'title': translate('PresentationPlugin', 'Preview'),
+ u'tooltip': translate('PresentationPlugin', 'Preview the selected Presentation')
+ }
+ ## Live Button ##
+ self.strings[StringType.Live] = {
+ u'title': translate('PresentationPlugin', 'Live'),
+ u'tooltip': translate('PresentationPlugin', 'Send the selected Presentation live')
+ }
+ ## Add to service Button ##
+ self.strings[StringType.Service] = {
+ u'title': translate('PresentationPlugin', 'Service'),
+ u'tooltip': translate('PresentationPlugin', 'Add the selected Presentation to the service')
+ }
diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py
index bf42c6d57..088e47fc7 100644
--- a/openlp/plugins/remotes/remoteplugin.py
+++ b/openlp/plugins/remotes/remoteplugin.py
@@ -1,93 +1,93 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
-# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-import logging
-
-from openlp.core.lib import Plugin, StringType, translate, build_icon
-from openlp.plugins.remotes.lib import RemoteTab, HttpServer
-
-log = logging.getLogger(__name__)
-
-class RemotesPlugin(Plugin):
- log.info(u'Remote Plugin loaded')
-
- def __init__(self, plugin_helpers):
- """
- remotes constructor
- """
- self.set_plugin_strings()
- Plugin.__init__(self, u'Remotes', u'1.9.2', plugin_helpers)
- self.icon = build_icon(u':/plugins/plugin_remote.png')
- self.weight = -1
- self.server = None
-
- def initialise(self):
- """
- Initialise the remotes plugin, and start the http server
- """
- log.debug(u'initialise')
- Plugin.initialise(self)
- self.insertToolboxItem()
- self.server = HttpServer(self)
-
- def finalise(self):
- """
- Tidy up and close down the http server
- """
- log.debug(u'finalise')
- Plugin.finalise(self)
- if self.server:
- self.server.close()
-
- def getSettingsTab(self):
- """
- Create the settings Tab
- """
- return RemoteTab(self.name)
-
- def about(self):
- """
- Information about this plugin
- """
- about_text = translate('RemotePlugin', 'Remote Plugin'
- '
The remote plugin provides the ability to send messages to '
- 'a running version of OpenLP on a different computer via a web '
- 'browser or through the remote API.')
- return about_text
-
- def set_plugin_strings(self):
- """
- Called to define all translatable texts of the plugin
- """
- self.name = u'Remotes'
- self.name_lower = u'remotes'
-
- self.strings = {}
- # for names in mediamanagerdock and pluginlist
- self.strings[StringType.Name] = {
- u'singular': translate('RemotePlugin', 'Remote'),
- u'plural': translate('RemotePlugin', 'Remotes')
- }
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+
+from openlp.core.lib import Plugin, StringType, translate, build_icon
+from openlp.plugins.remotes.lib import RemoteTab, HttpServer
+
+log = logging.getLogger(__name__)
+
+class RemotesPlugin(Plugin):
+ log.info(u'Remote Plugin loaded')
+
+ def __init__(self, plugin_helpers):
+ """
+ remotes constructor
+ """
+ self.set_plugin_strings()
+ Plugin.__init__(self, u'Remotes', u'1.9.2', plugin_helpers)
+ self.icon = build_icon(u':/plugins/plugin_remote.png')
+ self.weight = -1
+ self.server = None
+
+ def initialise(self):
+ """
+ Initialise the remotes plugin, and start the http server
+ """
+ log.debug(u'initialise')
+ Plugin.initialise(self)
+ self.insertToolboxItem()
+ self.server = HttpServer(self)
+
+ def finalise(self):
+ """
+ Tidy up and close down the http server
+ """
+ log.debug(u'finalise')
+ Plugin.finalise(self)
+ if self.server:
+ self.server.close()
+
+ def getSettingsTab(self):
+ """
+ Create the settings Tab
+ """
+ return RemoteTab(self.name)
+
+ def about(self):
+ """
+ Information about this plugin
+ """
+ about_text = translate('RemotePlugin', 'Remote Plugin'
+ '
The remote plugin provides the ability to send messages to '
+ 'a running version of OpenLP on a different computer via a web '
+ 'browser or through the remote API.')
+ return about_text
+
+ def set_plugin_strings(self):
+ """
+ Called to define all translatable texts of the plugin
+ """
+ self.name = u'Remotes'
+ self.name_lower = u'remotes'
+
+ self.strings = {}
+ # for names in mediamanagerdock and pluginlist
+ self.strings[StringType.Name] = {
+ u'singular': translate('RemotePlugin', 'Remote'),
+ u'plural': translate('RemotePlugin', 'Remotes')
+ }
diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py
index 839a42b8f..54d85083a 100644
--- a/openlp/plugins/songs/songsplugin.py
+++ b/openlp/plugins/songs/songsplugin.py
@@ -1,196 +1,196 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
-# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-import logging
-
-from PyQt4 import QtCore, QtGui
-
-from openlp.core.lib import Plugin, StringType, build_icon, translate
-from openlp.core.lib.db import Manager
-from openlp.plugins.songs.lib import SongMediaItem, SongsTab
-from openlp.plugins.songs.lib.db import init_schema, Song
-from openlp.plugins.songs.lib.importer import SongFormat
-
-log = logging.getLogger(__name__)
-
-class SongsPlugin(Plugin):
- """
- This is the number 1 plugin, if importance were placed on any
- plugins. This plugin enables the user to create, edit and display
- songs. Songs are divided into verses, and the verse order can be
- specified. Authors, topics and song books can be assigned to songs
- as well.
- """
- log.info(u'Song Plugin loaded')
-
- def __init__(self, plugin_helpers):
- """
- Create and set up the Songs plugin.
- """
- self.set_plugin_strings()
- Plugin.__init__(self, u'Songs', u'1.9.2', plugin_helpers)
- self.weight = -10
- self.manager = Manager(u'songs', init_schema)
- self.icon_path = u':/plugins/plugin_songs.png'
- self.icon = build_icon(self.icon_path)
-
- def getSettingsTab(self):
- return SongsTab(self.name)
-
- def initialise(self):
- log.info(u'Songs Initialising')
- Plugin.initialise(self)
- self.mediaItem.displayResultsSong(
- self.manager.get_all_objects(Song, order_by_ref=Song.title))
-
- def getMediaManagerItem(self):
- """
- Create the MediaManagerItem object, which is displaed in the
- Media Manager.
- """
- return SongMediaItem(self, self.icon, self.name)
-
- def addImportMenuItem(self, import_menu):
- """
- Give the Songs plugin the opportunity to add items to the
- **Import** menu.
-
- ``import_menu``
- The actual **Import** menu item, so that your actions can
- use it as their parent.
- """
- # Main song import menu item - will eventually be the only one
- self.SongImportItem = QtGui.QAction(import_menu)
- self.SongImportItem.setObjectName(u'SongImportItem')
- self.SongImportItem.setText(translate(
- 'SongsPlugin', '&Song'))
- self.SongImportItem.setToolTip(translate('SongsPlugin',
- 'Import songs using the import wizard.'))
- import_menu.addAction(self.SongImportItem)
- # Signals and slots
- QtCore.QObject.connect(self.SongImportItem,
- QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
-
- def addExportMenuItem(self, export_menu):
- """
- Give the Songs plugin the opportunity to add items to the
- **Export** menu.
-
- ``export_menu``
- The actual **Export** menu item, so that your actions can
- use it as their parent.
- """
- # No menu items for now.
- pass
-
- def onSongImportItemClicked(self):
- if self.mediaItem:
- self.mediaItem.onImportClick()
-
- def about(self):
- about_text = translate('SongsPlugin', 'Songs Plugin'
- '
The songs plugin provides the ability to display and '
- 'manage songs.')
- return about_text
-
- def usesTheme(self, theme):
- """
- Called to find out if the song plugin is currently using a theme.
-
- Returns True if the theme is being used, otherwise returns False.
- """
- if self.manager.get_all_objects(Song, Song.theme_name == theme):
- return True
- return False
-
- def renameTheme(self, oldTheme, newTheme):
- """
- Renames a theme the song plugin is using making the plugin use the new
- name.
-
- ``oldTheme``
- The name of the theme the plugin should stop using.
-
- ``newTheme``
- The new name the plugin should now use.
- """
- songsUsingTheme = self.manager.get_all_objects(Song,
- Song.theme_name == oldTheme)
- for song in songsUsingTheme:
- song.theme_name = newTheme
- self.custommanager.save_object(song)
-
- def importSongs(self, format, **kwargs):
- class_ = SongFormat.get_class(format)
- importer = class_(self.manager, **kwargs)
- importer.register(self.mediaItem.import_wizard)
- return importer
-
- def set_plugin_strings(self):
- """
- Called to define all translatable texts of the plugin
- """
- self.name = u'Songs'
- self.name_lower = u'songs'
-
- self.strings = {}
- # for names in mediamanagerdock and pluginlist
- self.strings[StringType.Name] = {
- u'singular': translate('SongsPlugin', 'Song'),
- u'plural': translate('SongsPlugin', 'Songs')
- }
-
- # Middle Header Bar
- ## New Button ##
- self.strings[StringType.New] = {
- u'title': translate('SongsPlugin', 'Add'),
- u'tooltip': translate('SongsPlugin', 'Add a new Song')
- }
- ## Edit Button ##
- self.strings[StringType.Edit] = {
- u'title': translate('SongsPlugin', 'Edit'),
- u'tooltip': translate('SongsPlugin', 'Edit the selected Song')
- }
- ## Delete Button ##
- self.strings[StringType.Delete] = {
- u'title': translate('SongsPlugin', 'Delete'),
- u'tooltip': translate('SongsPlugin', 'Delete the selected Song')
- }
- ## Preview ##
- self.strings[StringType.Preview] = {
- u'title': translate('SongsPlugin', 'Preview'),
- u'tooltip': translate('SongsPlugin', 'Preview the selected Song')
- }
- ## Live Button ##
- self.strings[StringType.Live] = {
- u'title': translate('SongsPlugin', 'Live'),
- u'tooltip': translate('SongsPlugin', 'Send the selected Song live')
- }
- ## Add to service Button ##
- self.strings[StringType.Service] = {
- u'title': translate('SongsPlugin', 'Service'),
- u'tooltip': translate('SongsPlugin', 'Add the selected Song to the service')
- }
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import Plugin, StringType, build_icon, translate
+from openlp.core.lib.db import Manager
+from openlp.plugins.songs.lib import SongMediaItem, SongsTab
+from openlp.plugins.songs.lib.db import init_schema, Song
+from openlp.plugins.songs.lib.importer import SongFormat
+
+log = logging.getLogger(__name__)
+
+class SongsPlugin(Plugin):
+ """
+ This is the number 1 plugin, if importance were placed on any
+ plugins. This plugin enables the user to create, edit and display
+ songs. Songs are divided into verses, and the verse order can be
+ specified. Authors, topics and song books can be assigned to songs
+ as well.
+ """
+ log.info(u'Song Plugin loaded')
+
+ def __init__(self, plugin_helpers):
+ """
+ Create and set up the Songs plugin.
+ """
+ self.set_plugin_strings()
+ Plugin.__init__(self, u'Songs', u'1.9.2', plugin_helpers)
+ self.weight = -10
+ self.manager = Manager(u'songs', init_schema)
+ self.icon_path = u':/plugins/plugin_songs.png'
+ self.icon = build_icon(self.icon_path)
+
+ def getSettingsTab(self):
+ return SongsTab(self.name)
+
+ def initialise(self):
+ log.info(u'Songs Initialising')
+ Plugin.initialise(self)
+ self.mediaItem.displayResultsSong(
+ self.manager.get_all_objects(Song, order_by_ref=Song.title))
+
+ def getMediaManagerItem(self):
+ """
+ Create the MediaManagerItem object, which is displaed in the
+ Media Manager.
+ """
+ return SongMediaItem(self, self.icon, self.name)
+
+ def addImportMenuItem(self, import_menu):
+ """
+ Give the Songs plugin the opportunity to add items to the
+ **Import** menu.
+
+ ``import_menu``
+ The actual **Import** menu item, so that your actions can
+ use it as their parent.
+ """
+ # Main song import menu item - will eventually be the only one
+ self.SongImportItem = QtGui.QAction(import_menu)
+ self.SongImportItem.setObjectName(u'SongImportItem')
+ self.SongImportItem.setText(translate(
+ 'SongsPlugin', '&Song'))
+ self.SongImportItem.setToolTip(translate('SongsPlugin',
+ 'Import songs using the import wizard.'))
+ import_menu.addAction(self.SongImportItem)
+ # Signals and slots
+ QtCore.QObject.connect(self.SongImportItem,
+ QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
+
+ def addExportMenuItem(self, export_menu):
+ """
+ Give the Songs plugin the opportunity to add items to the
+ **Export** menu.
+
+ ``export_menu``
+ The actual **Export** menu item, so that your actions can
+ use it as their parent.
+ """
+ # No menu items for now.
+ pass
+
+ def onSongImportItemClicked(self):
+ if self.mediaItem:
+ self.mediaItem.onImportClick()
+
+ def about(self):
+ about_text = translate('SongsPlugin', 'Songs Plugin'
+ '
The songs plugin provides the ability to display and '
+ 'manage songs.')
+ return about_text
+
+ def usesTheme(self, theme):
+ """
+ Called to find out if the song plugin is currently using a theme.
+
+ Returns True if the theme is being used, otherwise returns False.
+ """
+ if self.manager.get_all_objects(Song, Song.theme_name == theme):
+ return True
+ return False
+
+ def renameTheme(self, oldTheme, newTheme):
+ """
+ Renames a theme the song plugin is using making the plugin use the new
+ name.
+
+ ``oldTheme``
+ The name of the theme the plugin should stop using.
+
+ ``newTheme``
+ The new name the plugin should now use.
+ """
+ songsUsingTheme = self.manager.get_all_objects(Song,
+ Song.theme_name == oldTheme)
+ for song in songsUsingTheme:
+ song.theme_name = newTheme
+ self.custommanager.save_object(song)
+
+ def importSongs(self, format, **kwargs):
+ class_ = SongFormat.get_class(format)
+ importer = class_(self.manager, **kwargs)
+ importer.register(self.mediaItem.import_wizard)
+ return importer
+
+ def set_plugin_strings(self):
+ """
+ Called to define all translatable texts of the plugin
+ """
+ self.name = u'Songs'
+ self.name_lower = u'songs'
+
+ self.strings = {}
+ # for names in mediamanagerdock and pluginlist
+ self.strings[StringType.Name] = {
+ u'singular': translate('SongsPlugin', 'Song'),
+ u'plural': translate('SongsPlugin', 'Songs')
+ }
+
+ # Middle Header Bar
+ ## New Button ##
+ self.strings[StringType.New] = {
+ u'title': translate('SongsPlugin', 'Add'),
+ u'tooltip': translate('SongsPlugin', 'Add a new Song')
+ }
+ ## Edit Button ##
+ self.strings[StringType.Edit] = {
+ u'title': translate('SongsPlugin', 'Edit'),
+ u'tooltip': translate('SongsPlugin', 'Edit the selected Song')
+ }
+ ## Delete Button ##
+ self.strings[StringType.Delete] = {
+ u'title': translate('SongsPlugin', 'Delete'),
+ u'tooltip': translate('SongsPlugin', 'Delete the selected Song')
+ }
+ ## Preview ##
+ self.strings[StringType.Preview] = {
+ u'title': translate('SongsPlugin', 'Preview'),
+ u'tooltip': translate('SongsPlugin', 'Preview the selected Song')
+ }
+ ## Live Button ##
+ self.strings[StringType.Live] = {
+ u'title': translate('SongsPlugin', 'Live'),
+ u'tooltip': translate('SongsPlugin', 'Send the selected Song live')
+ }
+ ## Add to service Button ##
+ self.strings[StringType.Service] = {
+ u'title': translate('SongsPlugin', 'Service'),
+ u'tooltip': translate('SongsPlugin', 'Add the selected Song to the service')
+ }
diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py
index ac9007e6e..2a734e830 100644
--- a/openlp/plugins/songusage/songusageplugin.py
+++ b/openlp/plugins/songusage/songusageplugin.py
@@ -1,179 +1,179 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
-# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard, Frode Woldsund #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# You should have received a copy of the GNU General Public License along #
-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
-
-import logging
-from datetime import datetime
-
-from PyQt4 import QtCore, QtGui
-
-from openlp.core.lib import Plugin, StringType, Receiver, build_icon, translate
-from openlp.core.lib.db import Manager
-from openlp.plugins.songusage.forms import SongUsageDetailForm, \
- SongUsageDeleteForm
-from openlp.plugins.songusage.lib.db import init_schema, SongUsageItem
-
-log = logging.getLogger(__name__)
-
-class SongUsagePlugin(Plugin):
- log.info(u'SongUsage Plugin loaded')
-
- def __init__(self, plugin_helpers):
- self.set_plugin_strings()
- Plugin.__init__(self, u'SongUsage', u'1.9.2', plugin_helpers)
- self.weight = -4
- self.icon = build_icon(u':/plugins/plugin_songusage.png')
- self.songusagemanager = None
- self.songusageActive = False
-
- def addToolsMenuItem(self, tools_menu):
- """
- Give the SongUsage plugin the opportunity to add items to the
- **Tools** menu.
-
- ``tools_menu``
- The actual **Tools** menu item, so that your actions can
- use it as their parent.
- """
- log.info(u'add tools menu')
- self.toolsMenu = tools_menu
- self.SongUsageMenu = QtGui.QMenu(tools_menu)
- self.SongUsageMenu.setObjectName(u'SongUsageMenu')
- self.SongUsageMenu.setTitle(translate(
- 'SongUsagePlugin', '&Song Usage Tracking'))
- #SongUsage Delete
- self.SongUsageDelete = QtGui.QAction(tools_menu)
- self.SongUsageDelete.setText(translate('SongUsagePlugin',
- '&Delete Tracking Data'))
- self.SongUsageDelete.setStatusTip(translate('SongUsagePlugin',
- 'Delete song usage data up to a specified date.'))
- self.SongUsageDelete.setObjectName(u'SongUsageDelete')
- #SongUsage Report
- self.SongUsageReport = QtGui.QAction(tools_menu)
- self.SongUsageReport.setText(
- translate('SongUsagePlugin', '&Extract Tracking Data'))
- self.SongUsageReport.setStatusTip(
- translate('SongUsagePlugin', 'Generate a report on song usage.'))
- self.SongUsageReport.setObjectName(u'SongUsageReport')
- #SongUsage activation
- self.SongUsageStatus = QtGui.QAction(tools_menu)
- self.SongUsageStatus.setCheckable(True)
- self.SongUsageStatus.setChecked(False)
- self.SongUsageStatus.setText(translate(
- 'SongUsagePlugin', 'Toggle Tracking'))
- self.SongUsageStatus.setStatusTip(translate('SongUsagePlugin',
- 'Toggle the tracking of song usage.'))
- self.SongUsageStatus.setShortcut(u'F4')
- self.SongUsageStatus.setObjectName(u'SongUsageStatus')
- #Add Menus together
- self.toolsMenu.addAction(self.SongUsageMenu.menuAction())
- self.SongUsageMenu.addAction(self.SongUsageStatus)
- self.SongUsageMenu.addSeparator()
- self.SongUsageMenu.addAction(self.SongUsageDelete)
- self.SongUsageMenu.addAction(self.SongUsageReport)
- # Signals and slots
- QtCore.QObject.connect(self.SongUsageStatus,
- QtCore.SIGNAL(u'visibilityChanged(bool)'),
- self.SongUsageStatus.setChecked)
- QtCore.QObject.connect(self.SongUsageStatus,
- QtCore.SIGNAL(u'triggered(bool)'),
- self.toggleSongUsageState)
- QtCore.QObject.connect(self.SongUsageDelete,
- QtCore.SIGNAL(u'triggered()'), self.onSongUsageDelete)
- QtCore.QObject.connect(self.SongUsageReport,
- QtCore.SIGNAL(u'triggered()'), self.onSongUsageReport)
- self.SongUsageMenu.menuAction().setVisible(False)
-
- def initialise(self):
- log.info(u'SongUsage Initialising')
- Plugin.initialise(self)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_live_started'),
- self.onReceiveSongUsage)
- self.SongUsageActive = QtCore.QSettings().value(
- self.settingsSection + u'/active',
- QtCore.QVariant(False)).toBool()
- self.SongUsageStatus.setChecked(self.SongUsageActive)
- if self.songusagemanager is None:
- self.songusagemanager = Manager(u'songusage', init_schema)
- self.SongUsagedeleteform = SongUsageDeleteForm(self.songusagemanager,
- self.formparent)
- self.SongUsagedetailform = SongUsageDetailForm(self, self.formparent)
- self.SongUsageMenu.menuAction().setVisible(True)
-
- def finalise(self):
- log.info(u'Plugin Finalise')
- self.SongUsageMenu.menuAction().setVisible(False)
- #stop any events being processed
- self.SongUsageActive = False
-
- def toggleSongUsageState(self):
- self.SongUsageActive = not self.SongUsageActive
- QtCore.QSettings().setValue(self.settingsSection + u'/active',
- QtCore.QVariant(self.SongUsageActive))
-
- def onReceiveSongUsage(self, item):
- """
- Song Usage for live song from SlideController
- """
- audit = item[0].audit
- if self.SongUsageActive and audit:
- song_usage_item = SongUsageItem()
- song_usage_item.usagedate = datetime.today()
- song_usage_item.usagetime = datetime.now().time()
- song_usage_item.title = audit[0]
- song_usage_item.copyright = audit[2]
- song_usage_item.ccl_number = audit[3]
- song_usage_item.authors = u''
- for author in audit[1]:
- song_usage_item.authors += author + u' '
- self.songusagemanager.save_object(song_usage_item)
-
- def onSongUsageDelete(self):
- self.SongUsagedeleteform.exec_()
-
- def onSongUsageReport(self):
- self.SongUsagedetailform.initialise()
- self.SongUsagedetailform.exec_()
-
- def about(self):
- about_text = translate('SongUsagePlugin', 'SongUsage Plugin'
- '
This plugin tracks the usage of songs in '
- 'services.')
- return about_text
-
- def set_plugin_strings(self):
- """
- Called to define all translatable texts of the plugin
- """
- self.name = u'SongUsage'
- self.name_lower = u'songusage'
-
- self.strings = {}
- # for names in mediamanagerdock and pluginlist
- self.strings[StringType.Name] = {
- u'singular': translate('SongUsagePlugin', 'SongUsage'),
- u'plural': translate('SongUsagePlugin', 'SongUsage')
- }
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+from datetime import datetime
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import Plugin, StringType, Receiver, build_icon, translate
+from openlp.core.lib.db import Manager
+from openlp.plugins.songusage.forms import SongUsageDetailForm, \
+ SongUsageDeleteForm
+from openlp.plugins.songusage.lib.db import init_schema, SongUsageItem
+
+log = logging.getLogger(__name__)
+
+class SongUsagePlugin(Plugin):
+ log.info(u'SongUsage Plugin loaded')
+
+ def __init__(self, plugin_helpers):
+ self.set_plugin_strings()
+ Plugin.__init__(self, u'SongUsage', u'1.9.2', plugin_helpers)
+ self.weight = -4
+ self.icon = build_icon(u':/plugins/plugin_songusage.png')
+ self.songusagemanager = None
+ self.songusageActive = False
+
+ def addToolsMenuItem(self, tools_menu):
+ """
+ Give the SongUsage plugin the opportunity to add items to the
+ **Tools** menu.
+
+ ``tools_menu``
+ The actual **Tools** menu item, so that your actions can
+ use it as their parent.
+ """
+ log.info(u'add tools menu')
+ self.toolsMenu = tools_menu
+ self.SongUsageMenu = QtGui.QMenu(tools_menu)
+ self.SongUsageMenu.setObjectName(u'SongUsageMenu')
+ self.SongUsageMenu.setTitle(translate(
+ 'SongUsagePlugin', '&Song Usage Tracking'))
+ #SongUsage Delete
+ self.SongUsageDelete = QtGui.QAction(tools_menu)
+ self.SongUsageDelete.setText(translate('SongUsagePlugin',
+ '&Delete Tracking Data'))
+ self.SongUsageDelete.setStatusTip(translate('SongUsagePlugin',
+ 'Delete song usage data up to a specified date.'))
+ self.SongUsageDelete.setObjectName(u'SongUsageDelete')
+ #SongUsage Report
+ self.SongUsageReport = QtGui.QAction(tools_menu)
+ self.SongUsageReport.setText(
+ translate('SongUsagePlugin', '&Extract Tracking Data'))
+ self.SongUsageReport.setStatusTip(
+ translate('SongUsagePlugin', 'Generate a report on song usage.'))
+ self.SongUsageReport.setObjectName(u'SongUsageReport')
+ #SongUsage activation
+ self.SongUsageStatus = QtGui.QAction(tools_menu)
+ self.SongUsageStatus.setCheckable(True)
+ self.SongUsageStatus.setChecked(False)
+ self.SongUsageStatus.setText(translate(
+ 'SongUsagePlugin', 'Toggle Tracking'))
+ self.SongUsageStatus.setStatusTip(translate('SongUsagePlugin',
+ 'Toggle the tracking of song usage.'))
+ self.SongUsageStatus.setShortcut(u'F4')
+ self.SongUsageStatus.setObjectName(u'SongUsageStatus')
+ #Add Menus together
+ self.toolsMenu.addAction(self.SongUsageMenu.menuAction())
+ self.SongUsageMenu.addAction(self.SongUsageStatus)
+ self.SongUsageMenu.addSeparator()
+ self.SongUsageMenu.addAction(self.SongUsageDelete)
+ self.SongUsageMenu.addAction(self.SongUsageReport)
+ # Signals and slots
+ QtCore.QObject.connect(self.SongUsageStatus,
+ QtCore.SIGNAL(u'visibilityChanged(bool)'),
+ self.SongUsageStatus.setChecked)
+ QtCore.QObject.connect(self.SongUsageStatus,
+ QtCore.SIGNAL(u'triggered(bool)'),
+ self.toggleSongUsageState)
+ QtCore.QObject.connect(self.SongUsageDelete,
+ QtCore.SIGNAL(u'triggered()'), self.onSongUsageDelete)
+ QtCore.QObject.connect(self.SongUsageReport,
+ QtCore.SIGNAL(u'triggered()'), self.onSongUsageReport)
+ self.SongUsageMenu.menuAction().setVisible(False)
+
+ def initialise(self):
+ log.info(u'SongUsage Initialising')
+ Plugin.initialise(self)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_live_started'),
+ self.onReceiveSongUsage)
+ self.SongUsageActive = QtCore.QSettings().value(
+ self.settingsSection + u'/active',
+ QtCore.QVariant(False)).toBool()
+ self.SongUsageStatus.setChecked(self.SongUsageActive)
+ if self.songusagemanager is None:
+ self.songusagemanager = Manager(u'songusage', init_schema)
+ self.SongUsagedeleteform = SongUsageDeleteForm(self.songusagemanager,
+ self.formparent)
+ self.SongUsagedetailform = SongUsageDetailForm(self, self.formparent)
+ self.SongUsageMenu.menuAction().setVisible(True)
+
+ def finalise(self):
+ log.info(u'Plugin Finalise')
+ self.SongUsageMenu.menuAction().setVisible(False)
+ #stop any events being processed
+ self.SongUsageActive = False
+
+ def toggleSongUsageState(self):
+ self.SongUsageActive = not self.SongUsageActive
+ QtCore.QSettings().setValue(self.settingsSection + u'/active',
+ QtCore.QVariant(self.SongUsageActive))
+
+ def onReceiveSongUsage(self, item):
+ """
+ Song Usage for live song from SlideController
+ """
+ audit = item[0].audit
+ if self.SongUsageActive and audit:
+ song_usage_item = SongUsageItem()
+ song_usage_item.usagedate = datetime.today()
+ song_usage_item.usagetime = datetime.now().time()
+ song_usage_item.title = audit[0]
+ song_usage_item.copyright = audit[2]
+ song_usage_item.ccl_number = audit[3]
+ song_usage_item.authors = u''
+ for author in audit[1]:
+ song_usage_item.authors += author + u' '
+ self.songusagemanager.save_object(song_usage_item)
+
+ def onSongUsageDelete(self):
+ self.SongUsagedeleteform.exec_()
+
+ def onSongUsageReport(self):
+ self.SongUsagedetailform.initialise()
+ self.SongUsagedetailform.exec_()
+
+ def about(self):
+ about_text = translate('SongUsagePlugin', 'SongUsage Plugin'
+ '
This plugin tracks the usage of songs in '
+ 'services.')
+ return about_text
+
+ def set_plugin_strings(self):
+ """
+ Called to define all translatable texts of the plugin
+ """
+ self.name = u'SongUsage'
+ self.name_lower = u'songusage'
+
+ self.strings = {}
+ # for names in mediamanagerdock and pluginlist
+ self.strings[StringType.Name] = {
+ u'singular': translate('SongUsagePlugin', 'SongUsage'),
+ u'plural': translate('SongUsagePlugin', 'SongUsage')
+ }