openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00351
[Merge] lp:~trb143/openlp/audit into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/audit into lp:openlp.
--
https://code.launchpad.net/~trb143/openlp/audit/+merge/12043
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/eventreceiver.py'
--- openlp/core/lib/eventreceiver.py 2009-09-12 17:24:16 +0000
+++ openlp/core/lib/eventreceiver.py 2009-09-16 18:37:25 +0000
@@ -78,6 +78,8 @@
``{plugin}_stop``
Requests a plugin to handle a stop event
+ ``audit_live``
+ Sends live song audit requests to the audit component
"""
global log
log = logging.getLogger(u'EventReceiver')
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2009-09-12 18:27:17 +0000
+++ openlp/core/lib/mediamanageritem.py 2009-09-16 04:59:38 +0000
@@ -178,8 +178,16 @@
"""
# Add a toolbar
self.addToolbar()
- #Allow the plugin to define it's own header
+ #Allow the plugin to define buttons at start of bar
self.addStartHeaderBar()
+ #Add the middle of the tool bar (pre defined)
+ self.addMiddleHeaderBar()
+ #Allow the plugin to define buttons at end of bar
+ self.addEndHeaderBar()
+ #Add the list view
+ self.addListViewToToolBar()
+
+ def addMiddleHeaderBar(self):
# Create buttons for the toolbar
## File Button ##
if self.hasFileIcon:
@@ -221,8 +229,8 @@
translate(self.TranslationContext, u'Add '+self.PluginTextShort+u' To Service'),
translate(self.TranslationContext, u'Add the selected item(s) to the service'),
u':/system/system_add.png', self.onAddClick, self.PluginTextShort+u'AddItem')
- #Allow the plugin to define it's own header
- self.addEndHeaderBar()
+
+ def addListViewToToolBar(self):
#Add the List widget
self.ListView = self.ListViewWithDnD_class()
self.ListView.uniformItemSizes = True
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2009-09-12 17:24:16 +0000
+++ openlp/core/lib/plugin.py 2009-09-17 18:24:13 +0000
@@ -166,6 +166,15 @@
"""
pass
+ def add_tools_menu_item(self, tools_menu):
+ """
+ Create a menu item and add it to the "Tools" menu.
+
+ ``tools_menu``
+ The Tools menu
+ """
+ pass
+
def get_settings_tab(self):
"""
Create a tab for the settings window.
=== modified file 'openlp/core/lib/pluginmanager.py'
--- openlp/core/lib/pluginmanager.py 2009-09-08 19:58:05 +0000
+++ openlp/core/lib/pluginmanager.py 2009-09-17 18:24:13 +0000
@@ -178,6 +178,18 @@
if plugin[u'status'] == u'Active':
plugin[u'plugin'].add_export_menu_item(export_menu)
+ def hook_tools_menu(self, tools_menu):
+ """
+ Loop through all the plugins and give them an opportunity to add an
+ item to the tools menu.
+
+ ``tools_menu``
+ The Tools menu.
+ """
+ for plugin in self.plugins:
+ if plugin[u'status'] == u'Active':
+ plugin[u'plugin'].add_tools_menu_item(tools_menu)
+
def initialise_plugins(self):
"""
Loop through all the plugins and give them an opportunity to
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2009-09-15 19:06:40 +0000
+++ openlp/core/lib/serviceitem.py 2009-09-16 04:59:38 +0000
@@ -58,6 +58,7 @@
self.shortname = hostplugin.name
self.name = self.plugin.name
self.title = u''
+ self.audit = u''
self.items = []
self.iconic_representation = None
self.raw_slides = None
@@ -185,7 +186,8 @@
u'title':self.title,
u'icon':self.icon,
u'footer':self.raw_footer,
- u'type':self.service_item_type
+ u'type':self.service_item_type,
+ u'audit':self.audit
}
oos_data = []
if self.service_item_type == ServiceType.Text:
@@ -218,6 +220,7 @@
self.theme = header[u'theme']
self.addIcon(header[u'icon'])
self.raw_footer = header[u'footer']
+ self.audit = header[u'audit']
if self.service_item_type == ServiceType.Text:
for slide in serviceitem[u'serviceitem'][u'data']:
self.service_frames.append(slide)
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2009-09-12 18:27:17 +0000
+++ openlp/core/ui/mainwindow.py 2009-09-17 18:24:13 +0000
@@ -545,6 +545,8 @@
self.plugin_manager.hook_import_menu(self.FileImportMenu)
# Call the hook method to pull in export menus.
self.plugin_manager.hook_export_menu(self.FileExportMenu)
+ # Call the hook method to pull in tools menus.
+ self.plugin_manager.hook_tools_menu(self.ToolsMenu)
# Call the initialise method to setup plugins.
log.info(u'initialise plugins')
self.plugin_manager.initialise_plugins()
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-09-18 06:07:10 +0000
+++ openlp/core/ui/slidecontroller.py 2009-09-18 10:36:32 +0000
@@ -314,6 +314,7 @@
self.onSlideSelected()
self.PreviewListWidget.setFocus()
log.info(u'Display Rendering took %4s' % (time.time() - before))
+ Receiver().send_message(u'audit_live', self.serviceitem.audit)
log.debug(u'displayServiceManagerItems End')
#Screen event methods
@@ -382,22 +383,28 @@
def onStartLoop(self):
"""
- Go to the last slide.
+ Start the timer loop running and store the timer id
"""
if self.PreviewListWidget.rowCount() > 1:
self.timer_id = self.startTimer(int(self.DelaySpinBox.value()) * 1000)
def onStopLoop(self):
"""
- Go to the last slide.
+ Stop the timer loop running
"""
self.killTimer(self.timer_id)
def timerEvent(self, event):
+ """
+ If the timer event is for this window select next slide
+ """
if event.timerId() == self.timer_id:
self.onSlideSelectedNext()
def onGoLive(self):
+ """
+ If preview copy slide item to live
+ """
row = self.PreviewListWidget.currentRow()
if row > -1 and row < self.PreviewListWidget.rowCount():
self.parent.LiveController.addServiceManagerItem(self.commandItem, row)
=== added directory 'openlp/plugins/audit'
=== added file 'openlp/plugins/audit/__init__.py'
--- openlp/plugins/audit/__init__.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/audit/__init__.py 2009-09-16 05:01:11 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2009 Raoul Snyman #
+# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
+# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
=== added file 'openlp/plugins/audit/auditplugin.py'
--- openlp/plugins/audit/auditplugin.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/audit/auditplugin.py 2009-09-18 10:47:57 +0000
@@ -0,0 +1,112 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2009 Raoul Snyman #
+# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
+# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+
+from PyQt4 import QtCore, QtGui
+from datetime import date
+
+from openlp.core.lib import Plugin, Receiver, translate
+from openlp.plugins.audit.lib import AuditTab
+
+class AuditPlugin(Plugin):
+ global log
+ log = logging.getLogger(u'AuditPlugin')
+ log.info(u'Audit Plugin loaded')
+
+ def __init__(self, plugin_helpers):
+ # Call the parent constructor
+ Plugin.__init__(self, u'Audit', u'1.9.0', plugin_helpers)
+ self.weight = -4
+ # Create the plugin icon
+ self.icon = QtGui.QIcon()
+ self.icon.addPixmap(QtGui.QPixmap(u':/media/media_image.png'),
+ QtGui.QIcon.Normal, QtGui.QIcon.Off)
+ self.auditfile = None
+
+ def check_pre_conditions(self):
+ """
+ Check to see if auditing is required
+ """
+ log.debug('check_pre_conditions')
+ #Lets see if audit is required
+ if int(self.config.get_config(u'startup', 0)) == QtCore.Qt.Checked:
+ return True
+ else:
+ return False
+
+ def add_tools_menu_item(self, tools_menu):
+ """
+ Give the Audit plugin the opportunity to add items to the
+ **Tools** menu.
+
+ ``tools_menu``
+ The actual **Tools** menu item, so that your actions can
+ use it as their parent.
+ """
+ AuditIcon = QtGui.QIcon()
+ AuditIcon.addPixmap(QtGui.QPixmap(u':/tools/tools_alert.png'),
+ QtGui.QIcon.Normal, QtGui.QIcon.Off)
+ self.ToolsAuditItem = QtGui.QAction(tools_menu)
+ self.ToolsAuditItem.setIcon(AuditIcon)
+ self.ToolsAuditItem.setCheckable(True)
+ self.ToolsAuditItem.setChecked(False)
+ self.ToolsAuditItem.setText(translate(u'AuditPlugin', u'A&udit'))
+ self.ToolsAuditItem.setStatusTip(
+ translate(u'AuditPlugin', u'Start/Stop live song auditing'))
+ self.ToolsAuditItem.setShortcut(translate(u'AuditPlugin', u'F4'))
+ self.ToolsAuditItem.setObjectName(u'ToolsAuditItem')
+ tools_menu.addSeparator()
+ tools_menu.addAction(self.ToolsAuditItem)
+ # Signals and slots
+ QtCore.QObject.connect(self.ToolsAuditItem,
+ QtCore.SIGNAL(u'visibilityChanged(bool)'),
+ self.ToolsAuditItem.setChecked)
+ QtCore.QObject.connect(self.ToolsAuditItem,
+ QtCore.SIGNAL(u'triggered(bool)'),
+ self.toggleAuditState)
+
+ def get_settings_tab(self):
+ self.AuditTab = AuditTab()
+ return self.AuditTab
+
+ def initialise(self):
+ log.info(u'Plugin Initialising')
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'audit_live'), self.onReceiveAudit)
+ self.auditFile = open(u'openlp.aud', 'a')
+ self.auditActive = False
+
+ def toggleAuditState(self):
+ self.auditActive = not self.auditActive
+
+ def onReceiveAudit(self, auditData):
+ if self.auditActive:
+ self.auditFile.write(u'%s,%s\n' % (date.today(), auditData))
+ self.auditFile.flush()
+
+ def finalise(self):
+ log.debug(u'Finalise')
+ if self.auditFile is not None:
+ self.auditFile.close()
=== added directory 'openlp/plugins/audit/lib'
=== added file 'openlp/plugins/audit/lib/__init__.py'
--- openlp/plugins/audit/lib/__init__.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/audit/lib/__init__.py 2009-09-17 18:24:13 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2009 Raoul Snyman #
+# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
+# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+from audittab import AuditTab
=== added file 'openlp/plugins/audit/lib/audittab.py'
--- openlp/plugins/audit/lib/audittab.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/audit/lib/audittab.py 2009-09-16 18:37:25 +0000
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2009 Raoul Snyman #
+# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
+# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import SettingsTab, str_to_bool, translate, Receiver
+
+class AuditTab(SettingsTab):
+ """
+ AuditTab is the Audit settings tab in the settings dialog.
+ """
+ def __init__(self):
+ SettingsTab.__init__(self, translate(u'AuditTab', u'Audit'), u'Audit')
+
+ def setupUi(self):
+ self.setObjectName(u'AuditTab')
+ self.AuditLayout = QtGui.QFormLayout(self)
+ self.AuditLayout.setObjectName(u'AuditLayout')
+ self.AuditModeGroupBox = QtGui.QGroupBox(self)
+ self.AuditModeGroupBox.setObjectName(u'AuditModeGroupBox')
+ self.AuditModeLayout = QtGui.QVBoxLayout(self.AuditModeGroupBox)
+ self.AuditModeLayout.setSpacing(8)
+ self.AuditModeLayout.setMargin(8)
+ self.AuditModeLayout.setObjectName(u'AuditModeLayout')
+ self.AuditPortSpinBox = QtGui.QSpinBox(self.AuditModeGroupBox)
+ self.AuditPortSpinBox.setObjectName(u'AuditPortSpinBox')
+ self.AuditPortSpinBox.setMaximum(32767)
+ self.AuditModeLayout.addWidget(self.AuditPortSpinBox)
+ self.AuditActive = QtGui.QCheckBox(self.AuditModeGroupBox)
+ self.AuditActive.setObjectName(u'AuditPortSpinBox')
+ self.AuditModeLayout.addWidget(self.AuditActive)
+ self.WarningLabel = QtGui.QLabel(self.AuditModeGroupBox)
+ self.WarningLabel.setObjectName(u'WarningLabel')
+ self.AuditModeLayout.addWidget(self.WarningLabel)
+ self.AuditLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.AuditModeGroupBox)
+
+ def retranslateUi(self):
+ self.AuditModeGroupBox.setTitle(translate(u'AuditTab', u'Audit File'))
+ self.AuditActive.setText(translate(u'AuditTab', 'Audit available:'))
+ self.WarningLabel.setText(translate(u'AuditTab', u'A restart is needed for this change to become effective'))
+
+ def load(self):
+ self.AuditPortSpinBox.setValue(int(self.config.get_config(u'Audit port', 4316)))
+ self.AuditActive.setChecked(int(self.config.get_config(u'startup', 0)))
+
+ def save(self):
+ self.config.set_config(u'Audit port', unicode(self.AuditPortSpinBox.value()))
+ self.config.set_config(u'startup', unicode(self.AuditActive.checkState()))
+
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2009-09-16 10:50:13 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2009-09-16 19:03:11 +0000
@@ -269,12 +269,6 @@
self.parent.songmanager.delete_song(item_id)
row = self.ListView.row(item)
self.ListView.takeItem(row)
-#
-# def onSongPreviewClick(self):
-# service_item = ServiceItem(self.parent)
-# service_item.addIcon(u':/media/media_song.png')
-# self.generateSlideData(service_item)
-# self.parent.preview_controller.addServiceItem(service_item)
def generateSlideData(self, service_item):
raw_slides =[]
@@ -312,16 +306,5 @@
raw_footer.append(unicode(
translate(u'SongMediaItem', u'CCL Licence: ') + ccl ))
service_item.raw_footer = raw_footer
+ service_item.audit = u'%s,%s,%s' % (service_item.title, author_list, ccl)
return True
-
-# def onSongLiveClick(self):
-# service_item = ServiceItem(self.parent)
-# service_item.addIcon(u':/media/media_song.png')
-# self.generateSlideData(service_item)
-# self.parent.live_controller.addServiceItem(service_item)
-#
-# def onSongAddClick(self):
-# service_item = ServiceItem(self.parent)
-# service_item.addIcon( u':/media/media_song.png')
-# self.generateSlideData(service_item)
-# self.parent.service_manager.addServiceItem(service_item)
=== modified file 'resources/images/openlp-2.qrc'
--- resources/images/openlp-2.qrc 2009-07-24 22:13:40 +0000
+++ resources/images/openlp-2.qrc 2009-09-16 04:59:38 +0000
@@ -49,6 +49,10 @@
<file>import_remove.png</file>
<file>import_load.png</file>
</qresource>
+ <qresource prefix="audit" >
+ <file>audit_start.png</file>
+ <file>audit_stop.png</file>
+ </qresource>
<qresource prefix="exports" >
<file>export_selectall.png</file>
<file>export_remove.png</file>
Follow ups