hopefully Line ending corrected and resolve merge conflict, part2

This commit is contained in:
rimach 2010-09-10 21:21:14 +02:00
parent 2b700c481f
commit 6d7e7d7ad2
11 changed files with 2408 additions and 2408 deletions

View File

@ -1,84 +1,84 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. # # Software Foundation; version 2 of the License. #
# # # #
# This program is distributed in the hope that it will be useful, but WITHOUT # # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. # # more details. #
# # # #
# You should have received a copy of the GNU General Public License along # # 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 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class MediaDockManager(object): class MediaDockManager(object):
""" """
Provide a repository for MediaManagerItems Provide a repository for MediaManagerItems
""" """
def __init__(self, media_dock): def __init__(self, media_dock):
""" """
Initialise the media dock Initialise the media dock
""" """
self.media_dock = media_dock self.media_dock = media_dock
def add_dock(self, media_item, icon, weight): def add_dock(self, media_item, icon, weight):
""" """
Add a MediaManagerItem to the dock Add a MediaManagerItem to the dock
``media_item`` ``media_item``
The item to add to the dock The item to add to the dock
``icon`` ``icon``
An icon for this dock item An icon for this dock item
""" """
log.info(u'Adding %s dock' % media_item.title) log.info(u'Adding %s dock' % media_item.title)
self.media_dock.addItem(media_item, icon, media_item.title) self.media_dock.addItem(media_item, icon, media_item.title)
def insert_dock(self, media_item, icon, weight): def insert_dock(self, media_item, icon, weight):
""" """
This should insert a dock item at a given location This should insert a dock item at a given location
This does not work as it gives a Segmentation error. This does not work as it gives a Segmentation error.
For now add at end of stack if not present For now add at end of stack if not present
""" """
log.debug(u'Inserting %s dock' % media_item.title) log.debug(u'Inserting %s dock' % media_item.title)
match = False match = False
for dock_index in range(0, self.media_dock.count()): for dock_index in range(0, self.media_dock.count()):
if self.media_dock.widget(dock_index).settingsSection == \ if self.media_dock.widget(dock_index).settingsSection == \
media_item.parent.name_lower: media_item.parent.name_lower:
match = True match = True
break break
if not match: if not match:
self.media_dock.addItem(media_item, icon, media_item.title) self.media_dock.addItem(media_item, icon, media_item.title)
def remove_dock(self, name): def remove_dock(self, name):
""" """
Removes a MediaManagerItem from the dock Removes a MediaManagerItem from the dock
``name`` ``name``
The item to remove The item to remove
""" """
log.debug(u'remove %s dock' % name) log.debug(u'remove %s dock' % name)
for dock_index in range(0, self.media_dock.count()): for dock_index in range(0, self.media_dock.count()):
if self.media_dock.widget(dock_index): if self.media_dock.widget(dock_index):
log.debug(u'%s %s' % (name, self.media_dock.widget(dock_index).settingsSection)) log.debug(u'%s %s' % (name, self.media_dock.widget(dock_index).settingsSection))
if self.media_dock.widget(dock_index).settingsSection == \ if self.media_dock.widget(dock_index).settingsSection == \
name: name:
self.media_dock.widget(dock_index).hide() self.media_dock.widget(dock_index).hide()
self.media_dock.removeItem(dock_index) self.media_dock.removeItem(dock_index)

File diff suppressed because it is too large Load Diff

View File

@ -1,117 +1,117 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. # # Software Foundation; version 2 of the License. #
# # # #
# This program is distributed in the hope that it will be useful, but WITHOUT # # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. # # more details. #
# # # #
# You should have received a copy of the GNU General Public License along # # 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 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringType, build_icon, translate from openlp.core.lib import Plugin, StringType, build_icon, translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.plugins.alerts.lib import AlertsManager, AlertsTab from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
from openlp.plugins.alerts.lib.db import init_schema from openlp.plugins.alerts.lib.db import init_schema
from openlp.plugins.alerts.forms import AlertForm from openlp.plugins.alerts.forms import AlertForm
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class AlertsPlugin(Plugin): class AlertsPlugin(Plugin):
log.info(u'Alerts Plugin loaded') log.info(u'Alerts Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
self.set_plugin_strings() self.set_plugin_strings()
Plugin.__init__(self, u'Alerts', u'1.9.2', plugin_helpers) Plugin.__init__(self, u'Alerts', u'1.9.2', plugin_helpers)
self.weight = -3 self.weight = -3
self.icon = build_icon(u':/plugins/plugin_alerts.png') self.icon = build_icon(u':/plugins/plugin_alerts.png')
self.alertsmanager = AlertsManager(self) self.alertsmanager = AlertsManager(self)
self.manager = Manager(u'alerts', init_schema) self.manager = Manager(u'alerts', init_schema)
self.alertForm = AlertForm(self) self.alertForm = AlertForm(self)
def getSettingsTab(self): def getSettingsTab(self):
""" """
Return the settings tab for the Alerts plugin Return the settings tab for the Alerts plugin
""" """
self.alertsTab = AlertsTab(self) self.alertsTab = AlertsTab(self)
return self.alertsTab return self.alertsTab
def addToolsMenuItem(self, tools_menu): def addToolsMenuItem(self, tools_menu):
""" """
Give the alerts plugin the opportunity to add items to the Give the alerts plugin the opportunity to add items to the
**Tools** menu. **Tools** menu.
``tools_menu`` ``tools_menu``
The actual **Tools** menu item, so that your actions can The actual **Tools** menu item, so that your actions can
use it as their parent. use it as their parent.
""" """
log.info(u'add tools menu') log.info(u'add tools menu')
self.toolsAlertItem = QtGui.QAction(tools_menu) self.toolsAlertItem = QtGui.QAction(tools_menu)
self.toolsAlertItem.setIcon(build_icon(u':/plugins/plugin_alerts.png')) self.toolsAlertItem.setIcon(build_icon(u':/plugins/plugin_alerts.png'))
self.toolsAlertItem.setObjectName(u'toolsAlertItem') self.toolsAlertItem.setObjectName(u'toolsAlertItem')
self.toolsAlertItem.setText(translate('AlertsPlugin', '&Alert')) self.toolsAlertItem.setText(translate('AlertsPlugin', '&Alert'))
self.toolsAlertItem.setStatusTip( self.toolsAlertItem.setStatusTip(
translate('AlertsPlugin', 'Show an alert message.')) translate('AlertsPlugin', 'Show an alert message.'))
self.toolsAlertItem.setShortcut(u'F7') self.toolsAlertItem.setShortcut(u'F7')
self.serviceManager.parent.ToolsMenu.addAction(self.toolsAlertItem) self.serviceManager.parent.ToolsMenu.addAction(self.toolsAlertItem)
QtCore.QObject.connect(self.toolsAlertItem, QtCore.QObject.connect(self.toolsAlertItem,
QtCore.SIGNAL(u'triggered()'), self.onAlertsTrigger) QtCore.SIGNAL(u'triggered()'), self.onAlertsTrigger)
self.toolsAlertItem.setVisible(False) self.toolsAlertItem.setVisible(False)
def initialise(self): def initialise(self):
log.info(u'Alerts Initialising') log.info(u'Alerts Initialising')
Plugin.initialise(self) Plugin.initialise(self)
self.toolsAlertItem.setVisible(True) self.toolsAlertItem.setVisible(True)
self.liveController.alertTab = self.alertsTab self.liveController.alertTab = self.alertsTab
def finalise(self): def finalise(self):
log.info(u'Alerts Finalising') log.info(u'Alerts Finalising')
Plugin.finalise(self) Plugin.finalise(self)
self.toolsAlertItem.setVisible(False) self.toolsAlertItem.setVisible(False)
def toggleAlertsState(self): def toggleAlertsState(self):
self.alertsActive = not self.alertsActive self.alertsActive = not self.alertsActive
QtCore.QSettings().setValue(self.settingsSection + u'/active', QtCore.QSettings().setValue(self.settingsSection + u'/active',
QtCore.QVariant(self.alertsActive)) QtCore.QVariant(self.alertsActive))
def onAlertsTrigger(self): def onAlertsTrigger(self):
self.alertForm.loadList() self.alertForm.loadList()
self.alertForm.exec_() self.alertForm.exec_()
def about(self): def about(self):
about_text = translate('AlertsPlugin', '<strong>Alerts Plugin</strong>' about_text = translate('AlertsPlugin', '<strong>Alerts Plugin</strong>'
'<br />The alert plugin controls the displaying of nursery alerts ' '<br />The alert plugin controls the displaying of nursery alerts '
'on the display screen') 'on the display screen')
return about_text return about_text
def set_plugin_strings(self): def set_plugin_strings(self):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
self.name = u'Alerts' self.name = u'Alerts'
self.name_lower = u'alerts' self.name_lower = u'alerts'
self.strings = {} self.strings = {}
# for names in mediamanagerdock and pluginlist # for names in mediamanagerdock and pluginlist
self.strings[StringType.Name] = { self.strings[StringType.Name] = {
u'singular': translate('AlertsPlugin', 'Alert'), u'singular': translate('AlertsPlugin', 'Alert'),
u'plural': translate('AlertsPlugin', 'Alerts') u'plural': translate('AlertsPlugin', 'Alerts')
} }

View File

@ -1,170 +1,170 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. # # Software Foundation; version 2 of the License. #
# # # #
# This program is distributed in the hope that it will be useful, but WITHOUT # # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. # # more details. #
# # # #
# You should have received a copy of the GNU General Public License along # # 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 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringType, build_icon, translate from openlp.core.lib import Plugin, StringType, build_icon, translate
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class BiblePlugin(Plugin): class BiblePlugin(Plugin):
log.info(u'Bible Plugin loaded') log.info(u'Bible Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
self.set_plugin_strings() self.set_plugin_strings()
Plugin.__init__(self, u'Bibles', u'1.9.2', plugin_helpers) Plugin.__init__(self, u'Bibles', u'1.9.2', plugin_helpers)
self.weight = -9 self.weight = -9
self.icon_path = u':/plugins/plugin_bibles.png' self.icon_path = u':/plugins/plugin_bibles.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
self.manager = None self.manager = None
def initialise(self): def initialise(self):
log.info(u'bibles Initialising') log.info(u'bibles Initialising')
if self.manager is None: if self.manager is None:
self.manager = BibleManager(self) self.manager = BibleManager(self)
Plugin.initialise(self) Plugin.initialise(self)
self.importBibleItem.setVisible(True) self.importBibleItem.setVisible(True)
self.exportBibleItem.setVisible(True) self.exportBibleItem.setVisible(True)
def finalise(self): def finalise(self):
log.info(u'Plugin Finalise') log.info(u'Plugin Finalise')
Plugin.finalise(self) Plugin.finalise(self)
self.importBibleItem.setVisible(False) self.importBibleItem.setVisible(False)
self.exportBibleItem.setVisible(False) self.exportBibleItem.setVisible(False)
def getSettingsTab(self): def getSettingsTab(self):
return BiblesTab(self.name) return BiblesTab(self.name)
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the BibleManagerItem object. # Create the BibleManagerItem object.
return BibleMediaItem(self, self.icon, self.name) return BibleMediaItem(self, self.icon, self.name)
def addImportMenuItem(self, import_menu): def addImportMenuItem(self, import_menu):
self.importBibleItem = QtGui.QAction(import_menu) self.importBibleItem = QtGui.QAction(import_menu)
self.importBibleItem.setObjectName(u'importBibleItem') self.importBibleItem.setObjectName(u'importBibleItem')
import_menu.addAction(self.importBibleItem) import_menu.addAction(self.importBibleItem)
self.importBibleItem.setText( self.importBibleItem.setText(
translate('BiblesPlugin', '&Bible')) translate('BiblesPlugin', '&Bible'))
# signals and slots # signals and slots
QtCore.QObject.connect(self.importBibleItem, QtCore.QObject.connect(self.importBibleItem,
QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick) QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick)
self.importBibleItem.setVisible(False) self.importBibleItem.setVisible(False)
def addExportMenuItem(self, export_menu): def addExportMenuItem(self, export_menu):
self.exportBibleItem = QtGui.QAction(export_menu) self.exportBibleItem = QtGui.QAction(export_menu)
self.exportBibleItem.setObjectName(u'exportBibleItem') self.exportBibleItem.setObjectName(u'exportBibleItem')
export_menu.addAction(self.exportBibleItem) export_menu.addAction(self.exportBibleItem)
self.exportBibleItem.setText(translate( self.exportBibleItem.setText(translate(
'BiblesPlugin', '&Bible')) 'BiblesPlugin', '&Bible'))
self.exportBibleItem.setVisible(False) self.exportBibleItem.setVisible(False)
def onBibleImportClick(self): def onBibleImportClick(self):
if self.mediaItem: if self.mediaItem:
self.mediaItem.onImportClick() self.mediaItem.onImportClick()
def about(self): def about(self):
about_text = translate('BiblesPlugin', '<strong>Bible Plugin</strong>' about_text = translate('BiblesPlugin', '<strong>Bible Plugin</strong>'
'<br />The Bible plugin provides the ability to display bible ' '<br />The Bible plugin provides the ability to display bible '
'verses from different sources during the service.') 'verses from different sources during the service.')
return about_text return about_text
def usesTheme(self, theme): def usesTheme(self, theme):
""" """
Called to find out if the bible plugin is currently using a 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. Returns True if the theme is being used, otherwise returns False.
""" """
if self.settings_tab.bible_theme == theme: if self.settings_tab.bible_theme == theme:
return True return True
return False return False
def renameTheme(self, oldTheme, newTheme): def renameTheme(self, oldTheme, newTheme):
""" """
Rename the theme the bible plugin is using making the plugin use the Rename the theme the bible plugin is using making the plugin use the
new name. new name.
``oldTheme`` ``oldTheme``
The name of the theme the plugin should stop using. Unused for The name of the theme the plugin should stop using. Unused for
this particular plugin. this particular plugin.
``newTheme`` ``newTheme``
The new name the plugin should now use. The new name the plugin should now use.
""" """
self.settings_tab.bible_theme = newTheme self.settings_tab.bible_theme = newTheme
def set_plugin_strings(self): def set_plugin_strings(self):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
self.name = u'Bibles' self.name = u'Bibles'
self.name_lower = u'Bibles' self.name_lower = u'Bibles'
self.strings = {} self.strings = {}
# for names in mediamanagerdock and pluginlist # for names in mediamanagerdock and pluginlist
self.strings[StringType.Name] = { self.strings[StringType.Name] = {
u'singular': translate('BiblesPlugin', 'Bible'), u'singular': translate('BiblesPlugin', 'Bible'),
u'plural': translate('BiblesPlugin', 'Bibles') u'plural': translate('BiblesPlugin', 'Bibles')
} }
# Middle Header Bar # Middle Header Bar
## Import Button ## ## Import Button ##
self.strings[StringType.Import] = { self.strings[StringType.Import] = {
u'title': translate('BiblesPlugin', 'Import'), u'title': translate('BiblesPlugin', 'Import'),
u'tooltip': translate('BiblesPlugin', 'Import a Bible') u'tooltip': translate('BiblesPlugin', 'Import a Bible')
} }
## New Button ## ## New Button ##
self.strings[StringType.New] = { self.strings[StringType.New] = {
u'title': translate('BiblesPlugin', 'Add'), u'title': translate('BiblesPlugin', 'Add'),
u'tooltip': translate('BiblesPlugin', 'Add a new Bible') u'tooltip': translate('BiblesPlugin', 'Add a new Bible')
} }
## Edit Button ## ## Edit Button ##
self.strings[StringType.Edit] = { self.strings[StringType.Edit] = {
u'title': translate('BiblesPlugin', 'Edit'), u'title': translate('BiblesPlugin', 'Edit'),
u'tooltip': translate('BiblesPlugin', 'Edit the selected Bible') u'tooltip': translate('BiblesPlugin', 'Edit the selected Bible')
} }
## Delete Button ## ## Delete Button ##
self.strings[StringType.Delete] = { self.strings[StringType.Delete] = {
u'title': translate('BiblesPlugin', 'Delete'), u'title': translate('BiblesPlugin', 'Delete'),
u'tooltip': translate('BiblesPlugin', 'Delete the selected Bible') u'tooltip': translate('BiblesPlugin', 'Delete the selected Bible')
} }
## Preview ## ## Preview ##
self.strings[StringType.Preview] = { self.strings[StringType.Preview] = {
u'title': translate('BiblesPlugin', 'Preview'), u'title': translate('BiblesPlugin', 'Preview'),
u'tooltip': translate('BiblesPlugin', 'Preview the selected Bible') u'tooltip': translate('BiblesPlugin', 'Preview the selected Bible')
} }
## Live Button ## ## Live Button ##
self.strings[StringType.Live] = { self.strings[StringType.Live] = {
u'title': translate('BiblesPlugin', 'Live'), u'title': translate('BiblesPlugin', 'Live'),
u'tooltip': translate('BiblesPlugin', 'Send the selected Bible live') u'tooltip': translate('BiblesPlugin', 'Send the selected Bible live')
} }
## Add to service Button ## ## Add to service Button ##
self.strings[StringType.Service] = { self.strings[StringType.Service] = {
u'title': translate('BiblesPlugin', 'Service'), u'title': translate('BiblesPlugin', 'Service'),
u'tooltip': translate('BiblesPlugin', 'Add the selected Bible to the service') u'tooltip': translate('BiblesPlugin', 'Add the selected Bible to the service')
} }

View File

@ -1,154 +1,154 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. # # Software Foundation; version 2 of the License. #
# # # #
# This program is distributed in the hope that it will be useful, but WITHOUT # # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. # # more details. #
# # # #
# You should have received a copy of the GNU General Public License along # # 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 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging import logging
from forms import EditCustomForm from forms import EditCustomForm
from openlp.core.lib import Plugin, StringType, build_icon, translate from openlp.core.lib import Plugin, StringType, build_icon, translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.plugins.custom.lib import CustomMediaItem, CustomTab from openlp.plugins.custom.lib import CustomMediaItem, CustomTab
from openlp.plugins.custom.lib.db import CustomSlide, init_schema from openlp.plugins.custom.lib.db import CustomSlide, init_schema
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class CustomPlugin(Plugin): class CustomPlugin(Plugin):
""" """
This plugin enables the user to create, edit and display This plugin enables the user to create, edit and display
custom slide shows. Custom shows are divided into slides. custom slide shows. Custom shows are divided into slides.
Each show is able to have it's own theme. Each show is able to have it's own theme.
Custom shows are designed to replace the use of Customs where Custom shows are designed to replace the use of Customs where
the Customs plugin has become restrictive. Examples could be the Customs plugin has become restrictive. Examples could be
Welcome slides, Bible Reading information, Orders of service. Welcome slides, Bible Reading information, Orders of service.
""" """
log.info(u'Custom Plugin loaded') log.info(u'Custom Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
self.set_plugin_strings() self.set_plugin_strings()
Plugin.__init__(self, u'Custom', u'1.9.2', plugin_helpers) Plugin.__init__(self, u'Custom', u'1.9.2', plugin_helpers)
self.weight = -5 self.weight = -5
self.custommanager = Manager(u'custom', init_schema) self.custommanager = Manager(u'custom', init_schema)
self.edit_custom_form = EditCustomForm(self.custommanager) self.edit_custom_form = EditCustomForm(self.custommanager)
self.icon_path = u':/plugins/plugin_custom.png' self.icon_path = u':/plugins/plugin_custom.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
def getSettingsTab(self): def getSettingsTab(self):
return CustomTab(self.name) return CustomTab(self.name)
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the CustomManagerItem object # Create the CustomManagerItem object
return CustomMediaItem(self, self.icon, self.name) return CustomMediaItem(self, self.icon, self.name)
def about(self): def about(self):
about_text = translate('CustomPlugin', '<strong>Custom Plugin</strong>' about_text = translate('CustomPlugin', '<strong>Custom Plugin</strong>'
'<br />The custom plugin provides the ability to set up custom ' '<br />The custom plugin provides the ability to set up custom '
'text slides that can be displayed on the screen the same way ' 'text slides that can be displayed on the screen the same way '
'Customs are. This plugin provides greater freedom over the Customs ' 'Customs are. This plugin provides greater freedom over the Customs '
'plugin.') 'plugin.')
return about_text return about_text
def usesTheme(self, theme): def usesTheme(self, theme):
""" """
Called to find out if the custom plugin is currently using a 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. Returns True if the theme is being used, otherwise returns False.
""" """
if self.custommanager.get_all_objects(CustomSlide, if self.custommanager.get_all_objects(CustomSlide,
CustomSlide.theme_name == theme): CustomSlide.theme_name == theme):
return True return True
return False return False
def renameTheme(self, oldTheme, newTheme): def renameTheme(self, oldTheme, newTheme):
""" """
Renames a theme the custom plugin is using making the plugin use the Renames a theme the custom plugin is using making the plugin use the
new name. new name.
``oldTheme`` ``oldTheme``
The name of the theme the plugin should stop using. The name of the theme the plugin should stop using.
``newTheme`` ``newTheme``
The new name the plugin should now use. The new name the plugin should now use.
""" """
customsUsingTheme = self.custommanager.get_all_objects(CustomSlide, customsUsingTheme = self.custommanager.get_all_objects(CustomSlide,
CustomSlide.theme_name == oldTheme) CustomSlide.theme_name == oldTheme)
for custom in customsUsingTheme: for custom in customsUsingTheme:
custom.theme_name = newTheme custom.theme_name = newTheme
self.custommanager.save_object(custom) self.custommanager.save_object(custom)
def set_plugin_strings(self): def set_plugin_strings(self):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
self.name = u'Custom' self.name = u'Custom'
self.name_lower = u'custom' self.name_lower = u'custom'
self.strings = {} self.strings = {}
# for names in mediamanagerdock and pluginlist # for names in mediamanagerdock and pluginlist
self.strings[StringType.Name] = { self.strings[StringType.Name] = {
u'singular': translate('CustomsPlugin', 'Custom'), u'singular': translate('CustomsPlugin', 'Custom'),
u'plural': translate('CustomsPlugin', 'Customs') u'plural': translate('CustomsPlugin', 'Customs')
} }
# Middle Header Bar # Middle Header Bar
## Import Button ## ## Import Button ##
self.strings[StringType.Import] = { self.strings[StringType.Import] = {
u'title': translate('CustomsPlugin', 'Import'), u'title': translate('CustomsPlugin', 'Import'),
u'tooltip': translate('CustomsPlugin', 'Import a Custom') u'tooltip': translate('CustomsPlugin', 'Import a Custom')
} }
## Load Button ## ## Load Button ##
self.strings[StringType.Load] = { self.strings[StringType.Load] = {
u'title': translate('CustomsPlugin', 'Load'), u'title': translate('CustomsPlugin', 'Load'),
u'tooltip': translate('CustomsPlugin', 'Load a new Custom') u'tooltip': translate('CustomsPlugin', 'Load a new Custom')
} }
## New Button ## ## New Button ##
self.strings[StringType.New] = { self.strings[StringType.New] = {
u'title': translate('CustomsPlugin', 'Add'), u'title': translate('CustomsPlugin', 'Add'),
u'tooltip': translate('CustomsPlugin', 'Add a new Custom') u'tooltip': translate('CustomsPlugin', 'Add a new Custom')
} }
## Edit Button ## ## Edit Button ##
self.strings[StringType.Edit] = { self.strings[StringType.Edit] = {
u'title': translate('CustomsPlugin', 'Edit'), u'title': translate('CustomsPlugin', 'Edit'),
u'tooltip': translate('CustomsPlugin', 'Edit the selected Custom') u'tooltip': translate('CustomsPlugin', 'Edit the selected Custom')
} }
## Delete Button ## ## Delete Button ##
self.strings[StringType.Delete] = { self.strings[StringType.Delete] = {
u'title': translate('CustomsPlugin', 'Delete'), u'title': translate('CustomsPlugin', 'Delete'),
u'tooltip': translate('CustomsPlugin', 'Delete the selected Custom') u'tooltip': translate('CustomsPlugin', 'Delete the selected Custom')
} }
## Preview ## ## Preview ##
self.strings[StringType.Preview] = { self.strings[StringType.Preview] = {
u'title': translate('CustomsPlugin', 'Preview'), u'title': translate('CustomsPlugin', 'Preview'),
u'tooltip': translate('CustomsPlugin', 'Preview the selected Custom') u'tooltip': translate('CustomsPlugin', 'Preview the selected Custom')
} }
## Live Button ## ## Live Button ##
self.strings[StringType.Live] = { self.strings[StringType.Live] = {
u'title': translate('CustomsPlugin', 'Live'), u'title': translate('CustomsPlugin', 'Live'),
u'tooltip': translate('CustomsPlugin', 'Send the selected Custom live') u'tooltip': translate('CustomsPlugin', 'Send the selected Custom live')
} }
## Add to service Button ## ## Add to service Button ##
self.strings[StringType.Service] = { self.strings[StringType.Service] = {
u'title': translate('CustomsPlugin', 'Service'), u'title': translate('CustomsPlugin', 'Service'),
u'tooltip': translate('CustomsPlugin', 'Add the selected Custom to the service') u'tooltip': translate('CustomsPlugin', 'Add the selected Custom to the service')
} }

View File

@ -1,111 +1,111 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. # # Software Foundation; version 2 of the License. #
# # # #
# This program is distributed in the hope that it will be useful, but WITHOUT # # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. # # more details. #
# # # #
# You should have received a copy of the GNU General Public License along # # 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 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging import logging
from openlp.core.lib import Plugin, StringType, build_icon, translate from openlp.core.lib import Plugin, StringType, build_icon, translate
from openlp.plugins.images.lib import ImageMediaItem from openlp.plugins.images.lib import ImageMediaItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class ImagePlugin(Plugin): class ImagePlugin(Plugin):
log.info(u'Image Plugin loaded') log.info(u'Image Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
self.set_plugin_strings() self.set_plugin_strings()
Plugin.__init__(self, u'Images', u'1.9.2', plugin_helpers) Plugin.__init__(self, u'Images', u'1.9.2', plugin_helpers)
self.weight = -7 self.weight = -7
self.icon_path = u':/plugins/plugin_images.png' self.icon_path = u':/plugins/plugin_images.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the MediaManagerItem object # Create the MediaManagerItem object
return ImageMediaItem(self, self.icon, self.name) return ImageMediaItem(self, self.icon, self.name)
def about(self): def about(self):
about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>' about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
'<br />The image plugin provides displaying of images.<br />One ' '<br />The image plugin provides displaying of images.<br />One '
'of the distinguishing features of this plugin is the ability to ' 'of the distinguishing features of this plugin is the ability to '
'group a number of images together in the service manager, making ' 'group a number of images together in the service manager, making '
'the displaying of multiple images easier. This plugin can also ' 'the displaying of multiple images easier. This plugin can also '
'make use of OpenLP\'s "timed looping" feature to create a slide ' 'make use of OpenLP\'s "timed looping" feature to create a slide '
'show that runs automatically. In addition to this, images from ' 'show that runs automatically. In addition to this, images from '
'the plugin can be used to override the current theme\'s ' 'the plugin can be used to override the current theme\'s '
'background, which renders text-based items like Images with the ' 'background, which renders text-based items like Images with the '
'selected image as a background instead of the background ' 'selected image as a background instead of the background '
'provided by the theme.') 'provided by the theme.')
return about_text return about_text
# rimach # rimach
def set_plugin_strings(self): def set_plugin_strings(self):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
self.name = u'Images' self.name = u'Images'
self.name_lower = u'images' self.name_lower = u'images'
self.strings = {} self.strings = {}
# for names in mediamanagerdock and pluginlist # for names in mediamanagerdock and pluginlist
self.strings[StringType.Name] = { self.strings[StringType.Name] = {
u'singular': translate('ImagePlugin', 'Image'), u'singular': translate('ImagePlugin', 'Image'),
u'plural': translate('ImagePlugin', 'Images') u'plural': translate('ImagePlugin', 'Images')
} }
# Middle Header Bar # Middle Header Bar
## Load Button ## ## Load Button ##
self.strings[StringType.Load] = { self.strings[StringType.Load] = {
u'title': translate('ImagePlugin', 'Load'), u'title': translate('ImagePlugin', 'Load'),
u'tooltip': translate('ImagePlugin', 'Load a new Image') u'tooltip': translate('ImagePlugin', 'Load a new Image')
} }
## New Button ## ## New Button ##
self.strings[StringType.New] = { self.strings[StringType.New] = {
u'title': translate('ImagePlugin', 'Add'), u'title': translate('ImagePlugin', 'Add'),
u'tooltip': translate('ImagePlugin', 'Add a new Image') u'tooltip': translate('ImagePlugin', 'Add a new Image')
} }
## Edit Button ## ## Edit Button ##
self.strings[StringType.Edit] = { self.strings[StringType.Edit] = {
u'title': translate('ImagePlugin', 'Edit'), u'title': translate('ImagePlugin', 'Edit'),
u'tooltip': translate('ImagePlugin', 'Edit the selected Image') u'tooltip': translate('ImagePlugin', 'Edit the selected Image')
} }
## Delete Button ## ## Delete Button ##
self.strings[StringType.Delete] = { self.strings[StringType.Delete] = {
u'title': translate('ImagePlugin', 'Delete'), u'title': translate('ImagePlugin', 'Delete'),
u'tooltip': translate('ImagePlugin', 'Delete the selected Image') u'tooltip': translate('ImagePlugin', 'Delete the selected Image')
} }
## Preview ## ## Preview ##
self.strings[StringType.Preview] = { self.strings[StringType.Preview] = {
u'title': translate('ImagePlugin', 'Preview'), u'title': translate('ImagePlugin', 'Preview'),
u'tooltip': translate('ImagePlugin', 'Preview the selected Image') u'tooltip': translate('ImagePlugin', 'Preview the selected Image')
} }
## Live Button ## ## Live Button ##
self.strings[StringType.Live] = { self.strings[StringType.Live] = {
u'title': translate('ImagePlugin', 'Live'), u'title': translate('ImagePlugin', 'Live'),
u'tooltip': translate('ImagePlugin', 'Send the selected Image live') u'tooltip': translate('ImagePlugin', 'Send the selected Image live')
} }
## Add to service Button ## ## Add to service Button ##
self.strings[StringType.Service] = { self.strings[StringType.Service] = {
u'title': translate('ImagePlugin', 'Service'), u'title': translate('ImagePlugin', 'Service'),
u'tooltip': translate('ImagePlugin', 'Add the selected Image to the service') u'tooltip': translate('ImagePlugin', 'Add the selected Image to the service')
} }

View File

@ -1,129 +1,129 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. # # Software Foundation; version 2 of the License. #
# # # #
# This program is distributed in the hope that it will be useful, but WITHOUT # # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. # # more details. #
# # # #
# You should have received a copy of the GNU General Public License along # # 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 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging import logging
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
from openlp.core.lib import Plugin, StringType, build_icon, translate from openlp.core.lib import Plugin, StringType, build_icon, translate
from openlp.plugins.media.lib import MediaMediaItem from openlp.plugins.media.lib import MediaMediaItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class MediaPlugin(Plugin): class MediaPlugin(Plugin):
log.info(u'%s MediaPlugin loaded', __name__) log.info(u'%s MediaPlugin loaded', __name__)
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
self.set_plugin_strings() self.set_plugin_strings()
Plugin.__init__(self, u'Media', u'1.9.2', plugin_helpers) Plugin.__init__(self, u'Media', u'1.9.2', plugin_helpers)
self.weight = -6 self.weight = -6
self.icon_path = u':/plugins/plugin_media.png' self.icon_path = u':/plugins/plugin_media.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
# passed with drag and drop messages # passed with drag and drop messages
self.dnd_id = u'Media' self.dnd_id = u'Media'
self.audio_list = u'' self.audio_list = u''
self.video_list = u'' self.video_list = u''
for mimetype in Phonon.BackendCapabilities.availableMimeTypes(): for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
mimetype = unicode(mimetype) mimetype = unicode(mimetype)
type = mimetype.split(u'audio/x-') type = mimetype.split(u'audio/x-')
self.audio_list, mimetype = self._addToList(self.audio_list, self.audio_list, mimetype = self._addToList(self.audio_list,
type, mimetype) type, mimetype)
type = mimetype.split(u'audio/') type = mimetype.split(u'audio/')
self.audio_list, mimetype = self._addToList(self.audio_list, self.audio_list, mimetype = self._addToList(self.audio_list,
type, mimetype) type, mimetype)
type = mimetype.split(u'video/x-') type = mimetype.split(u'video/x-')
self.video_list, mimetype = self._addToList(self.video_list, self.video_list, mimetype = self._addToList(self.video_list,
type, mimetype) type, mimetype)
type = mimetype.split(u'video/') type = mimetype.split(u'video/')
self.video_list, mimetype = self._addToList(self.video_list, self.video_list, mimetype = self._addToList(self.video_list,
type, mimetype) type, mimetype)
def _addToList(self, list, value, type): def _addToList(self, list, value, type):
if len(value) == 2: if len(value) == 2:
if list.find(value[1]) == -1: if list.find(value[1]) == -1:
list += u'*.%s ' % value[1] list += u'*.%s ' % value[1]
self.serviceManager.supportedSuffixes(value[1]) self.serviceManager.supportedSuffixes(value[1])
type = u'' type = u''
return list, type return list, type
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the MediaManagerItem object # Create the MediaManagerItem object
return MediaMediaItem(self, self.icon, self.name) return MediaMediaItem(self, self.icon, self.name)
def about(self): def about(self):
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>' about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
'<br />The media plugin provides playback of audio and video.') '<br />The media plugin provides playback of audio and video.')
return about_text return about_text
def set_plugin_strings(self): def set_plugin_strings(self):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
self.name = u'Media' self.name = u'Media'
self.name_lower = u'media' self.name_lower = u'media'
self.strings = {} self.strings = {}
# for names in mediamanagerdock and pluginlist # for names in mediamanagerdock and pluginlist
self.strings[StringType.Name] = { self.strings[StringType.Name] = {
u'singular': translate('MediaPlugin', 'Media'), u'singular': translate('MediaPlugin', 'Media'),
u'plural': translate('MediaPlugin', 'Medias') u'plural': translate('MediaPlugin', 'Medias')
} }
# Middle Header Bar # Middle Header Bar
## Load Button ## ## Load Button ##
self.strings[StringType.Load] = { self.strings[StringType.Load] = {
u'title': translate('MediaPlugin', 'Load'), u'title': translate('MediaPlugin', 'Load'),
u'tooltip': translate('MediaPlugin', 'Load a new Media') u'tooltip': translate('MediaPlugin', 'Load a new Media')
} }
## New Button ## ## New Button ##
self.strings[StringType.New] = { self.strings[StringType.New] = {
u'title': translate('MediaPlugin', 'Add'), u'title': translate('MediaPlugin', 'Add'),
u'tooltip': translate('MediaPlugin', 'Add a new Media') u'tooltip': translate('MediaPlugin', 'Add a new Media')
} }
## Edit Button ## ## Edit Button ##
self.strings[StringType.Edit] = { self.strings[StringType.Edit] = {
u'title': translate('MediaPlugin', 'Edit'), u'title': translate('MediaPlugin', 'Edit'),
u'tooltip': translate('MediaPlugin', 'Edit the selected Media') u'tooltip': translate('MediaPlugin', 'Edit the selected Media')
} }
## Delete Button ## ## Delete Button ##
self.strings[StringType.Delete] = { self.strings[StringType.Delete] = {
u'title': translate('MediaPlugin', 'Delete'), u'title': translate('MediaPlugin', 'Delete'),
u'tooltip': translate('MediaPlugin', 'Delete the selected Media') u'tooltip': translate('MediaPlugin', 'Delete the selected Media')
} }
## Preview ## ## Preview ##
self.strings[StringType.Preview] = { self.strings[StringType.Preview] = {
u'title': translate('MediaPlugin', 'Preview'), u'title': translate('MediaPlugin', 'Preview'),
u'tooltip': translate('MediaPlugin', 'Preview the selected Media') u'tooltip': translate('MediaPlugin', 'Preview the selected Media')
} }
## Live Button ## ## Live Button ##
self.strings[StringType.Live] = { self.strings[StringType.Live] = {
u'title': translate('MediaPlugin', 'Live'), u'title': translate('MediaPlugin', 'Live'),
u'tooltip': translate('MediaPlugin', 'Send the selected Media live') u'tooltip': translate('MediaPlugin', 'Send the selected Media live')
} }
## Add to service Button ## ## Add to service Button ##
self.strings[StringType.Service] = { self.strings[StringType.Service] = {
u'title': translate('MediaPlugin', 'Service'), u'title': translate('MediaPlugin', 'Service'),
u'tooltip': translate('MediaPlugin', 'Add the selected Media to the service') u'tooltip': translate('MediaPlugin', 'Add the selected Media to the service')
} }

View File

@ -1,187 +1,187 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. # # Software Foundation; version 2 of the License. #
# # # #
# This program is distributed in the hope that it will be useful, but WITHOUT # # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. # # more details. #
# # # #
# You should have received a copy of the GNU General Public License along # # 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 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
""" """
The :mod:`presentationplugin` module provides the ability for OpenLP to display The :mod:`presentationplugin` module provides the ability for OpenLP to display
presentations from a variety of document formats. presentations from a variety of document formats.
""" """
import os import os
import logging import logging
from openlp.core.lib import Plugin, StringType, build_icon, translate from openlp.core.lib import Plugin, StringType, build_icon, translate
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
from openlp.plugins.presentations.lib import PresentationController, \ from openlp.plugins.presentations.lib import PresentationController, \
PresentationMediaItem, PresentationTab PresentationMediaItem, PresentationTab
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class PresentationPlugin(Plugin): class PresentationPlugin(Plugin):
""" """
This plugin allowed a Presentation to be opened, controlled and displayed This plugin allowed a Presentation to be opened, controlled and displayed
on the output display. The plugin controls third party applications such on the output display. The plugin controls third party applications such
as OpenOffice.org Impress, Microsoft PowerPoint and the PowerPoint viewer as OpenOffice.org Impress, Microsoft PowerPoint and the PowerPoint viewer
""" """
log = logging.getLogger(u'PresentationPlugin') log = logging.getLogger(u'PresentationPlugin')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
""" """
PluginPresentation constructor. PluginPresentation constructor.
""" """
log.debug(u'Initialised') log.debug(u'Initialised')
self.controllers = {} self.controllers = {}
self.set_plugin_strings() self.set_plugin_strings()
Plugin.__init__(self, u'Presentations', u'1.9.2', plugin_helpers) Plugin.__init__(self, u'Presentations', u'1.9.2', plugin_helpers)
self.weight = -8 self.weight = -8
self.icon_path = u':/plugins/plugin_presentations.png' self.icon_path = u':/plugins/plugin_presentations.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
def getSettingsTab(self): def getSettingsTab(self):
""" """
Create the settings Tab Create the settings Tab
""" """
return PresentationTab(self.name, self.controllers) return PresentationTab(self.name, self.controllers)
def initialise(self): def initialise(self):
""" """
Initialise the plugin. Determine which controllers are enabled Initialise the plugin. Determine which controllers are enabled
are start their processes. are start their processes.
""" """
log.info(u'Presentations Initialising') log.info(u'Presentations Initialising')
Plugin.initialise(self) Plugin.initialise(self)
self.insertToolboxItem() self.insertToolboxItem()
for controller in self.controllers: for controller in self.controllers:
if self.controllers[controller].enabled(): if self.controllers[controller].enabled():
self.controllers[controller].start_process() self.controllers[controller].start_process()
self.mediaItem.buildFileMaskString() self.mediaItem.buildFileMaskString()
def finalise(self): def finalise(self):
""" """
Finalise the plugin. Ask all the enabled presentation applications Finalise the plugin. Ask all the enabled presentation applications
to close down their applications and release resources. to close down their applications and release resources.
""" """
log.info(u'Plugin Finalise') log.info(u'Plugin Finalise')
#Ask each controller to tidy up #Ask each controller to tidy up
for key in self.controllers: for key in self.controllers:
controller = self.controllers[key] controller = self.controllers[key]
if controller.enabled(): if controller.enabled():
controller.kill() controller.kill()
Plugin.finalise(self) Plugin.finalise(self)
def getMediaManagerItem(self): def getMediaManagerItem(self):
""" """
Create the Media Manager List Create the Media Manager List
""" """
return PresentationMediaItem( return PresentationMediaItem(
self, self.icon, self.name, self.controllers) self, self.icon, self.name, self.controllers)
def registerControllers(self, controller): def registerControllers(self, controller):
""" """
Register each presentation controller (Impress, PPT etc) and Register each presentation controller (Impress, PPT etc) and
store for later use store for later use
""" """
self.controllers[controller.name] = controller self.controllers[controller.name] = controller
def checkPreConditions(self): def checkPreConditions(self):
""" """
Check to see if we have any presentation software available Check to see if we have any presentation software available
If Not do not install the plugin. If Not do not install the plugin.
""" """
log.debug(u'checkPreConditions') log.debug(u'checkPreConditions')
controller_dir = os.path.join( controller_dir = os.path.join(
AppLocation.get_directory(AppLocation.PluginsDir), AppLocation.get_directory(AppLocation.PluginsDir),
u'presentations', u'lib') u'presentations', u'lib')
for filename in os.listdir(controller_dir): for filename in os.listdir(controller_dir):
if filename.endswith(u'controller.py') and \ if filename.endswith(u'controller.py') and \
not filename == 'presentationcontroller.py': not filename == 'presentationcontroller.py':
path = os.path.join(controller_dir, filename) path = os.path.join(controller_dir, filename)
if os.path.isfile(path): if os.path.isfile(path):
modulename = u'openlp.plugins.presentations.lib.' + \ modulename = u'openlp.plugins.presentations.lib.' + \
os.path.splitext(filename)[0] os.path.splitext(filename)[0]
log.debug(u'Importing controller %s', modulename) log.debug(u'Importing controller %s', modulename)
try: try:
__import__(modulename, globals(), locals(), []) __import__(modulename, globals(), locals(), [])
except ImportError: except ImportError:
log.exception(u'Failed to import %s on path %s', log.exception(u'Failed to import %s on path %s',
modulename, path) modulename, path)
controller_classes = PresentationController.__subclasses__() controller_classes = PresentationController.__subclasses__()
for controller_class in controller_classes: for controller_class in controller_classes:
controller = controller_class(self) controller = controller_class(self)
self.registerControllers(controller) self.registerControllers(controller)
if self.controllers: if self.controllers:
return True return True
else: else:
return False return False
def about(self): def about(self):
""" """
Return information about this plugin Return information about this plugin
""" """
about_text = translate('PresentationPlugin', '<strong>Presentation ' about_text = translate('PresentationPlugin', '<strong>Presentation '
'Plugin</strong><br />The presentation plugin provides the ' 'Plugin</strong><br />The presentation plugin provides the '
'ability to show presentations using a number of different ' 'ability to show presentations using a number of different '
'programs. The choice of available presentation programs is ' 'programs. The choice of available presentation programs is '
'available to the user in a drop down box.') 'available to the user in a drop down box.')
return about_text return about_text
def set_plugin_strings(self): def set_plugin_strings(self):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
self.name = u'Presentations' self.name = u'Presentations'
self.name_lower = u'presentations' self.name_lower = u'presentations'
self.strings = {} self.strings = {}
# for names in mediamanagerdock and pluginlist # for names in mediamanagerdock and pluginlist
self.strings[StringType.Name] = { self.strings[StringType.Name] = {
u'singular': translate('PresentationPlugin', 'Presentation'), u'singular': translate('PresentationPlugin', 'Presentation'),
u'plural': translate('PresentationPlugin', 'Presentations') u'plural': translate('PresentationPlugin', 'Presentations')
} }
# Middle Header Bar # Middle Header Bar
## Load Button ## ## Load Button ##
self.strings[StringType.Load] = { self.strings[StringType.Load] = {
u'title': translate('PresentationPlugin', 'Load'), u'title': translate('PresentationPlugin', 'Load'),
u'tooltip': translate('PresentationPlugin', 'Load a new Presentation') u'tooltip': translate('PresentationPlugin', 'Load a new Presentation')
} }
## Delete Button ## ## Delete Button ##
self.strings[StringType.Delete] = { self.strings[StringType.Delete] = {
u'title': translate('PresentationPlugin', 'Delete'), u'title': translate('PresentationPlugin', 'Delete'),
u'tooltip': translate('PresentationPlugin', 'Delete the selected Presentation') u'tooltip': translate('PresentationPlugin', 'Delete the selected Presentation')
} }
## Preview ## ## Preview ##
self.strings[StringType.Preview] = { self.strings[StringType.Preview] = {
u'title': translate('PresentationPlugin', 'Preview'), u'title': translate('PresentationPlugin', 'Preview'),
u'tooltip': translate('PresentationPlugin', 'Preview the selected Presentation') u'tooltip': translate('PresentationPlugin', 'Preview the selected Presentation')
} }
## Live Button ## ## Live Button ##
self.strings[StringType.Live] = { self.strings[StringType.Live] = {
u'title': translate('PresentationPlugin', 'Live'), u'title': translate('PresentationPlugin', 'Live'),
u'tooltip': translate('PresentationPlugin', 'Send the selected Presentation live') u'tooltip': translate('PresentationPlugin', 'Send the selected Presentation live')
} }
## Add to service Button ## ## Add to service Button ##
self.strings[StringType.Service] = { self.strings[StringType.Service] = {
u'title': translate('PresentationPlugin', 'Service'), u'title': translate('PresentationPlugin', 'Service'),
u'tooltip': translate('PresentationPlugin', 'Add the selected Presentation to the service') u'tooltip': translate('PresentationPlugin', 'Add the selected Presentation to the service')
} }

View File

@ -1,93 +1,93 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. # # Software Foundation; version 2 of the License. #
# # # #
# This program is distributed in the hope that it will be useful, but WITHOUT # # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. # # more details. #
# # # #
# You should have received a copy of the GNU General Public License along # # 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 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging import logging
from openlp.core.lib import Plugin, StringType, translate, build_icon from openlp.core.lib import Plugin, StringType, translate, build_icon
from openlp.plugins.remotes.lib import RemoteTab, HttpServer from openlp.plugins.remotes.lib import RemoteTab, HttpServer
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class RemotesPlugin(Plugin): class RemotesPlugin(Plugin):
log.info(u'Remote Plugin loaded') log.info(u'Remote Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
""" """
remotes constructor remotes constructor
""" """
self.set_plugin_strings() self.set_plugin_strings()
Plugin.__init__(self, u'Remotes', u'1.9.2', plugin_helpers) Plugin.__init__(self, u'Remotes', u'1.9.2', plugin_helpers)
self.icon = build_icon(u':/plugins/plugin_remote.png') self.icon = build_icon(u':/plugins/plugin_remote.png')
self.weight = -1 self.weight = -1
self.server = None self.server = None
def initialise(self): def initialise(self):
""" """
Initialise the remotes plugin, and start the http server Initialise the remotes plugin, and start the http server
""" """
log.debug(u'initialise') log.debug(u'initialise')
Plugin.initialise(self) Plugin.initialise(self)
self.insertToolboxItem() self.insertToolboxItem()
self.server = HttpServer(self) self.server = HttpServer(self)
def finalise(self): def finalise(self):
""" """
Tidy up and close down the http server Tidy up and close down the http server
""" """
log.debug(u'finalise') log.debug(u'finalise')
Plugin.finalise(self) Plugin.finalise(self)
if self.server: if self.server:
self.server.close() self.server.close()
def getSettingsTab(self): def getSettingsTab(self):
""" """
Create the settings Tab Create the settings Tab
""" """
return RemoteTab(self.name) return RemoteTab(self.name)
def about(self): def about(self):
""" """
Information about this plugin Information about this plugin
""" """
about_text = translate('RemotePlugin', '<strong>Remote Plugin</strong>' about_text = translate('RemotePlugin', '<strong>Remote Plugin</strong>'
'<br />The remote plugin provides the ability to send messages to ' '<br />The remote plugin provides the ability to send messages to '
'a running version of OpenLP on a different computer via a web ' 'a running version of OpenLP on a different computer via a web '
'browser or through the remote API.') 'browser or through the remote API.')
return about_text return about_text
def set_plugin_strings(self): def set_plugin_strings(self):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
self.name = u'Remotes' self.name = u'Remotes'
self.name_lower = u'remotes' self.name_lower = u'remotes'
self.strings = {} self.strings = {}
# for names in mediamanagerdock and pluginlist # for names in mediamanagerdock and pluginlist
self.strings[StringType.Name] = { self.strings[StringType.Name] = {
u'singular': translate('RemotePlugin', 'Remote'), u'singular': translate('RemotePlugin', 'Remote'),
u'plural': translate('RemotePlugin', 'Remotes') u'plural': translate('RemotePlugin', 'Remotes')
} }

View File

@ -1,196 +1,196 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. # # Software Foundation; version 2 of the License. #
# # # #
# This program is distributed in the hope that it will be useful, but WITHOUT # # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. # # more details. #
# # # #
# You should have received a copy of the GNU General Public License along # # 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 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringType, build_icon, translate from openlp.core.lib import Plugin, StringType, build_icon, translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.plugins.songs.lib import SongMediaItem, SongsTab from openlp.plugins.songs.lib import SongMediaItem, SongsTab
from openlp.plugins.songs.lib.db import init_schema, Song from openlp.plugins.songs.lib.db import init_schema, Song
from openlp.plugins.songs.lib.importer import SongFormat from openlp.plugins.songs.lib.importer import SongFormat
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class SongsPlugin(Plugin): class SongsPlugin(Plugin):
""" """
This is the number 1 plugin, if importance were placed on any This is the number 1 plugin, if importance were placed on any
plugins. This plugin enables the user to create, edit and display plugins. This plugin enables the user to create, edit and display
songs. Songs are divided into verses, and the verse order can be songs. Songs are divided into verses, and the verse order can be
specified. Authors, topics and song books can be assigned to songs specified. Authors, topics and song books can be assigned to songs
as well. as well.
""" """
log.info(u'Song Plugin loaded') log.info(u'Song Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
""" """
Create and set up the Songs plugin. Create and set up the Songs plugin.
""" """
self.set_plugin_strings() self.set_plugin_strings()
Plugin.__init__(self, u'Songs', u'1.9.2', plugin_helpers) Plugin.__init__(self, u'Songs', u'1.9.2', plugin_helpers)
self.weight = -10 self.weight = -10
self.manager = Manager(u'songs', init_schema) self.manager = Manager(u'songs', init_schema)
self.icon_path = u':/plugins/plugin_songs.png' self.icon_path = u':/plugins/plugin_songs.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
def getSettingsTab(self): def getSettingsTab(self):
return SongsTab(self.name) return SongsTab(self.name)
def initialise(self): def initialise(self):
log.info(u'Songs Initialising') log.info(u'Songs Initialising')
Plugin.initialise(self) Plugin.initialise(self)
self.mediaItem.displayResultsSong( self.mediaItem.displayResultsSong(
self.manager.get_all_objects(Song, order_by_ref=Song.title)) self.manager.get_all_objects(Song, order_by_ref=Song.title))
def getMediaManagerItem(self): def getMediaManagerItem(self):
""" """
Create the MediaManagerItem object, which is displaed in the Create the MediaManagerItem object, which is displaed in the
Media Manager. Media Manager.
""" """
return SongMediaItem(self, self.icon, self.name) return SongMediaItem(self, self.icon, self.name)
def addImportMenuItem(self, import_menu): def addImportMenuItem(self, import_menu):
""" """
Give the Songs plugin the opportunity to add items to the Give the Songs plugin the opportunity to add items to the
**Import** menu. **Import** menu.
``import_menu`` ``import_menu``
The actual **Import** menu item, so that your actions can The actual **Import** menu item, so that your actions can
use it as their parent. use it as their parent.
""" """
# Main song import menu item - will eventually be the only one # Main song import menu item - will eventually be the only one
self.SongImportItem = QtGui.QAction(import_menu) self.SongImportItem = QtGui.QAction(import_menu)
self.SongImportItem.setObjectName(u'SongImportItem') self.SongImportItem.setObjectName(u'SongImportItem')
self.SongImportItem.setText(translate( self.SongImportItem.setText(translate(
'SongsPlugin', '&Song')) 'SongsPlugin', '&Song'))
self.SongImportItem.setToolTip(translate('SongsPlugin', self.SongImportItem.setToolTip(translate('SongsPlugin',
'Import songs using the import wizard.')) 'Import songs using the import wizard.'))
import_menu.addAction(self.SongImportItem) import_menu.addAction(self.SongImportItem)
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.SongImportItem, QtCore.QObject.connect(self.SongImportItem,
QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked) QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
def addExportMenuItem(self, export_menu): def addExportMenuItem(self, export_menu):
""" """
Give the Songs plugin the opportunity to add items to the Give the Songs plugin the opportunity to add items to the
**Export** menu. **Export** menu.
``export_menu`` ``export_menu``
The actual **Export** menu item, so that your actions can The actual **Export** menu item, so that your actions can
use it as their parent. use it as their parent.
""" """
# No menu items for now. # No menu items for now.
pass pass
def onSongImportItemClicked(self): def onSongImportItemClicked(self):
if self.mediaItem: if self.mediaItem:
self.mediaItem.onImportClick() self.mediaItem.onImportClick()
def about(self): def about(self):
about_text = translate('SongsPlugin', '<strong>Songs Plugin</strong>' about_text = translate('SongsPlugin', '<strong>Songs Plugin</strong>'
'<br />The songs plugin provides the ability to display and ' '<br />The songs plugin provides the ability to display and '
'manage songs.') 'manage songs.')
return about_text return about_text
def usesTheme(self, theme): def usesTheme(self, theme):
""" """
Called to find out if the song plugin is currently using a 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. Returns True if the theme is being used, otherwise returns False.
""" """
if self.manager.get_all_objects(Song, Song.theme_name == theme): if self.manager.get_all_objects(Song, Song.theme_name == theme):
return True return True
return False return False
def renameTheme(self, oldTheme, newTheme): def renameTheme(self, oldTheme, newTheme):
""" """
Renames a theme the song plugin is using making the plugin use the new Renames a theme the song plugin is using making the plugin use the new
name. name.
``oldTheme`` ``oldTheme``
The name of the theme the plugin should stop using. The name of the theme the plugin should stop using.
``newTheme`` ``newTheme``
The new name the plugin should now use. The new name the plugin should now use.
""" """
songsUsingTheme = self.manager.get_all_objects(Song, songsUsingTheme = self.manager.get_all_objects(Song,
Song.theme_name == oldTheme) Song.theme_name == oldTheme)
for song in songsUsingTheme: for song in songsUsingTheme:
song.theme_name = newTheme song.theme_name = newTheme
self.custommanager.save_object(song) self.custommanager.save_object(song)
def importSongs(self, format, **kwargs): def importSongs(self, format, **kwargs):
class_ = SongFormat.get_class(format) class_ = SongFormat.get_class(format)
importer = class_(self.manager, **kwargs) importer = class_(self.manager, **kwargs)
importer.register(self.mediaItem.import_wizard) importer.register(self.mediaItem.import_wizard)
return importer return importer
def set_plugin_strings(self): def set_plugin_strings(self):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
self.name = u'Songs' self.name = u'Songs'
self.name_lower = u'songs' self.name_lower = u'songs'
self.strings = {} self.strings = {}
# for names in mediamanagerdock and pluginlist # for names in mediamanagerdock and pluginlist
self.strings[StringType.Name] = { self.strings[StringType.Name] = {
u'singular': translate('SongsPlugin', 'Song'), u'singular': translate('SongsPlugin', 'Song'),
u'plural': translate('SongsPlugin', 'Songs') u'plural': translate('SongsPlugin', 'Songs')
} }
# Middle Header Bar # Middle Header Bar
## New Button ## ## New Button ##
self.strings[StringType.New] = { self.strings[StringType.New] = {
u'title': translate('SongsPlugin', 'Add'), u'title': translate('SongsPlugin', 'Add'),
u'tooltip': translate('SongsPlugin', 'Add a new Song') u'tooltip': translate('SongsPlugin', 'Add a new Song')
} }
## Edit Button ## ## Edit Button ##
self.strings[StringType.Edit] = { self.strings[StringType.Edit] = {
u'title': translate('SongsPlugin', 'Edit'), u'title': translate('SongsPlugin', 'Edit'),
u'tooltip': translate('SongsPlugin', 'Edit the selected Song') u'tooltip': translate('SongsPlugin', 'Edit the selected Song')
} }
## Delete Button ## ## Delete Button ##
self.strings[StringType.Delete] = { self.strings[StringType.Delete] = {
u'title': translate('SongsPlugin', 'Delete'), u'title': translate('SongsPlugin', 'Delete'),
u'tooltip': translate('SongsPlugin', 'Delete the selected Song') u'tooltip': translate('SongsPlugin', 'Delete the selected Song')
} }
## Preview ## ## Preview ##
self.strings[StringType.Preview] = { self.strings[StringType.Preview] = {
u'title': translate('SongsPlugin', 'Preview'), u'title': translate('SongsPlugin', 'Preview'),
u'tooltip': translate('SongsPlugin', 'Preview the selected Song') u'tooltip': translate('SongsPlugin', 'Preview the selected Song')
} }
## Live Button ## ## Live Button ##
self.strings[StringType.Live] = { self.strings[StringType.Live] = {
u'title': translate('SongsPlugin', 'Live'), u'title': translate('SongsPlugin', 'Live'),
u'tooltip': translate('SongsPlugin', 'Send the selected Song live') u'tooltip': translate('SongsPlugin', 'Send the selected Song live')
} }
## Add to service Button ## ## Add to service Button ##
self.strings[StringType.Service] = { self.strings[StringType.Service] = {
u'title': translate('SongsPlugin', 'Service'), u'title': translate('SongsPlugin', 'Service'),
u'tooltip': translate('SongsPlugin', 'Add the selected Song to the service') u'tooltip': translate('SongsPlugin', 'Add the selected Song to the service')
} }

View File

@ -1,179 +1,179 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman # # Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # # Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # # Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # # Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund # # Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. # # Software Foundation; version 2 of the License. #
# # # #
# This program is distributed in the hope that it will be useful, but WITHOUT # # This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. # # more details. #
# # # #
# You should have received a copy of the GNU General Public License along # # 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 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging import logging
from datetime import datetime from datetime import datetime
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringType, Receiver, build_icon, translate from openlp.core.lib import Plugin, StringType, Receiver, build_icon, translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.plugins.songusage.forms import SongUsageDetailForm, \ from openlp.plugins.songusage.forms import SongUsageDetailForm, \
SongUsageDeleteForm SongUsageDeleteForm
from openlp.plugins.songusage.lib.db import init_schema, SongUsageItem from openlp.plugins.songusage.lib.db import init_schema, SongUsageItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class SongUsagePlugin(Plugin): class SongUsagePlugin(Plugin):
log.info(u'SongUsage Plugin loaded') log.info(u'SongUsage Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
self.set_plugin_strings() self.set_plugin_strings()
Plugin.__init__(self, u'SongUsage', u'1.9.2', plugin_helpers) Plugin.__init__(self, u'SongUsage', u'1.9.2', plugin_helpers)
self.weight = -4 self.weight = -4
self.icon = build_icon(u':/plugins/plugin_songusage.png') self.icon = build_icon(u':/plugins/plugin_songusage.png')
self.songusagemanager = None self.songusagemanager = None
self.songusageActive = False self.songusageActive = False
def addToolsMenuItem(self, tools_menu): def addToolsMenuItem(self, tools_menu):
""" """
Give the SongUsage plugin the opportunity to add items to the Give the SongUsage plugin the opportunity to add items to the
**Tools** menu. **Tools** menu.
``tools_menu`` ``tools_menu``
The actual **Tools** menu item, so that your actions can The actual **Tools** menu item, so that your actions can
use it as their parent. use it as their parent.
""" """
log.info(u'add tools menu') log.info(u'add tools menu')
self.toolsMenu = tools_menu self.toolsMenu = tools_menu
self.SongUsageMenu = QtGui.QMenu(tools_menu) self.SongUsageMenu = QtGui.QMenu(tools_menu)
self.SongUsageMenu.setObjectName(u'SongUsageMenu') self.SongUsageMenu.setObjectName(u'SongUsageMenu')
self.SongUsageMenu.setTitle(translate( self.SongUsageMenu.setTitle(translate(
'SongUsagePlugin', '&Song Usage Tracking')) 'SongUsagePlugin', '&Song Usage Tracking'))
#SongUsage Delete #SongUsage Delete
self.SongUsageDelete = QtGui.QAction(tools_menu) self.SongUsageDelete = QtGui.QAction(tools_menu)
self.SongUsageDelete.setText(translate('SongUsagePlugin', self.SongUsageDelete.setText(translate('SongUsagePlugin',
'&Delete Tracking Data')) '&Delete Tracking Data'))
self.SongUsageDelete.setStatusTip(translate('SongUsagePlugin', self.SongUsageDelete.setStatusTip(translate('SongUsagePlugin',
'Delete song usage data up to a specified date.')) 'Delete song usage data up to a specified date.'))
self.SongUsageDelete.setObjectName(u'SongUsageDelete') self.SongUsageDelete.setObjectName(u'SongUsageDelete')
#SongUsage Report #SongUsage Report
self.SongUsageReport = QtGui.QAction(tools_menu) self.SongUsageReport = QtGui.QAction(tools_menu)
self.SongUsageReport.setText( self.SongUsageReport.setText(
translate('SongUsagePlugin', '&Extract Tracking Data')) translate('SongUsagePlugin', '&Extract Tracking Data'))
self.SongUsageReport.setStatusTip( self.SongUsageReport.setStatusTip(
translate('SongUsagePlugin', 'Generate a report on song usage.')) translate('SongUsagePlugin', 'Generate a report on song usage.'))
self.SongUsageReport.setObjectName(u'SongUsageReport') self.SongUsageReport.setObjectName(u'SongUsageReport')
#SongUsage activation #SongUsage activation
self.SongUsageStatus = QtGui.QAction(tools_menu) self.SongUsageStatus = QtGui.QAction(tools_menu)
self.SongUsageStatus.setCheckable(True) self.SongUsageStatus.setCheckable(True)
self.SongUsageStatus.setChecked(False) self.SongUsageStatus.setChecked(False)
self.SongUsageStatus.setText(translate( self.SongUsageStatus.setText(translate(
'SongUsagePlugin', 'Toggle Tracking')) 'SongUsagePlugin', 'Toggle Tracking'))
self.SongUsageStatus.setStatusTip(translate('SongUsagePlugin', self.SongUsageStatus.setStatusTip(translate('SongUsagePlugin',
'Toggle the tracking of song usage.')) 'Toggle the tracking of song usage.'))
self.SongUsageStatus.setShortcut(u'F4') self.SongUsageStatus.setShortcut(u'F4')
self.SongUsageStatus.setObjectName(u'SongUsageStatus') self.SongUsageStatus.setObjectName(u'SongUsageStatus')
#Add Menus together #Add Menus together
self.toolsMenu.addAction(self.SongUsageMenu.menuAction()) self.toolsMenu.addAction(self.SongUsageMenu.menuAction())
self.SongUsageMenu.addAction(self.SongUsageStatus) self.SongUsageMenu.addAction(self.SongUsageStatus)
self.SongUsageMenu.addSeparator() self.SongUsageMenu.addSeparator()
self.SongUsageMenu.addAction(self.SongUsageDelete) self.SongUsageMenu.addAction(self.SongUsageDelete)
self.SongUsageMenu.addAction(self.SongUsageReport) self.SongUsageMenu.addAction(self.SongUsageReport)
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.SongUsageStatus, QtCore.QObject.connect(self.SongUsageStatus,
QtCore.SIGNAL(u'visibilityChanged(bool)'), QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.SongUsageStatus.setChecked) self.SongUsageStatus.setChecked)
QtCore.QObject.connect(self.SongUsageStatus, QtCore.QObject.connect(self.SongUsageStatus,
QtCore.SIGNAL(u'triggered(bool)'), QtCore.SIGNAL(u'triggered(bool)'),
self.toggleSongUsageState) self.toggleSongUsageState)
QtCore.QObject.connect(self.SongUsageDelete, QtCore.QObject.connect(self.SongUsageDelete,
QtCore.SIGNAL(u'triggered()'), self.onSongUsageDelete) QtCore.SIGNAL(u'triggered()'), self.onSongUsageDelete)
QtCore.QObject.connect(self.SongUsageReport, QtCore.QObject.connect(self.SongUsageReport,
QtCore.SIGNAL(u'triggered()'), self.onSongUsageReport) QtCore.SIGNAL(u'triggered()'), self.onSongUsageReport)
self.SongUsageMenu.menuAction().setVisible(False) self.SongUsageMenu.menuAction().setVisible(False)
def initialise(self): def initialise(self):
log.info(u'SongUsage Initialising') log.info(u'SongUsage Initialising')
Plugin.initialise(self) Plugin.initialise(self)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_live_started'), QtCore.SIGNAL(u'slidecontroller_live_started'),
self.onReceiveSongUsage) self.onReceiveSongUsage)
self.SongUsageActive = QtCore.QSettings().value( self.SongUsageActive = QtCore.QSettings().value(
self.settingsSection + u'/active', self.settingsSection + u'/active',
QtCore.QVariant(False)).toBool() QtCore.QVariant(False)).toBool()
self.SongUsageStatus.setChecked(self.SongUsageActive) self.SongUsageStatus.setChecked(self.SongUsageActive)
if self.songusagemanager is None: if self.songusagemanager is None:
self.songusagemanager = Manager(u'songusage', init_schema) self.songusagemanager = Manager(u'songusage', init_schema)
self.SongUsagedeleteform = SongUsageDeleteForm(self.songusagemanager, self.SongUsagedeleteform = SongUsageDeleteForm(self.songusagemanager,
self.formparent) self.formparent)
self.SongUsagedetailform = SongUsageDetailForm(self, self.formparent) self.SongUsagedetailform = SongUsageDetailForm(self, self.formparent)
self.SongUsageMenu.menuAction().setVisible(True) self.SongUsageMenu.menuAction().setVisible(True)
def finalise(self): def finalise(self):
log.info(u'Plugin Finalise') log.info(u'Plugin Finalise')
self.SongUsageMenu.menuAction().setVisible(False) self.SongUsageMenu.menuAction().setVisible(False)
#stop any events being processed #stop any events being processed
self.SongUsageActive = False self.SongUsageActive = False
def toggleSongUsageState(self): def toggleSongUsageState(self):
self.SongUsageActive = not self.SongUsageActive self.SongUsageActive = not self.SongUsageActive
QtCore.QSettings().setValue(self.settingsSection + u'/active', QtCore.QSettings().setValue(self.settingsSection + u'/active',
QtCore.QVariant(self.SongUsageActive)) QtCore.QVariant(self.SongUsageActive))
def onReceiveSongUsage(self, item): def onReceiveSongUsage(self, item):
""" """
Song Usage for live song from SlideController Song Usage for live song from SlideController
""" """
audit = item[0].audit audit = item[0].audit
if self.SongUsageActive and audit: if self.SongUsageActive and audit:
song_usage_item = SongUsageItem() song_usage_item = SongUsageItem()
song_usage_item.usagedate = datetime.today() song_usage_item.usagedate = datetime.today()
song_usage_item.usagetime = datetime.now().time() song_usage_item.usagetime = datetime.now().time()
song_usage_item.title = audit[0] song_usage_item.title = audit[0]
song_usage_item.copyright = audit[2] song_usage_item.copyright = audit[2]
song_usage_item.ccl_number = audit[3] song_usage_item.ccl_number = audit[3]
song_usage_item.authors = u'' song_usage_item.authors = u''
for author in audit[1]: for author in audit[1]:
song_usage_item.authors += author + u' ' song_usage_item.authors += author + u' '
self.songusagemanager.save_object(song_usage_item) self.songusagemanager.save_object(song_usage_item)
def onSongUsageDelete(self): def onSongUsageDelete(self):
self.SongUsagedeleteform.exec_() self.SongUsagedeleteform.exec_()
def onSongUsageReport(self): def onSongUsageReport(self):
self.SongUsagedetailform.initialise() self.SongUsagedetailform.initialise()
self.SongUsagedetailform.exec_() self.SongUsagedetailform.exec_()
def about(self): def about(self):
about_text = translate('SongUsagePlugin', '<strong>SongUsage Plugin' about_text = translate('SongUsagePlugin', '<strong>SongUsage Plugin'
'</strong><br />This plugin tracks the usage of songs in ' '</strong><br />This plugin tracks the usage of songs in '
'services.') 'services.')
return about_text return about_text
def set_plugin_strings(self): def set_plugin_strings(self):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
self.name = u'SongUsage' self.name = u'SongUsage'
self.name_lower = u'songusage' self.name_lower = u'songusage'
self.strings = {} self.strings = {}
# for names in mediamanagerdock and pluginlist # for names in mediamanagerdock and pluginlist
self.strings[StringType.Name] = { self.strings[StringType.Name] = {
u'singular': translate('SongUsagePlugin', 'SongUsage'), u'singular': translate('SongUsagePlugin', 'SongUsage'),
u'plural': translate('SongUsagePlugin', 'SongUsage') u'plural': translate('SongUsagePlugin', 'SongUsage')
} }