diff --git a/openlp/plugins/audit/__init__.py b/openlp/plugins/audit/__init__.py new file mode 100644 index 000000000..df3741192 --- /dev/null +++ b/openlp/plugins/audit/__init__.py @@ -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 # +############################################################################### diff --git a/openlp/plugins/audit/auditplugin.py b/openlp/plugins/audit/auditplugin.py new file mode 100644 index 000000000..130954003 --- /dev/null +++ b/openlp/plugins/audit/auditplugin.py @@ -0,0 +1,56 @@ +# -*- 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 openlp.core.lib import Plugin +from openlp.plugins.audit.lib import AuditMediaItem, 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) + + def get_settings_tab(self): + self.AuditTab = AuditTab() + return self.AuditTab + + def get_media_manager_item(self): + # Create the MediaManagerItem object + self.media_item = AuditMediaItem(self, self.icon, u'Audit') + return self.media_item + + def initialise(self): + log.info(u'Plugin Initialising') diff --git a/openlp/plugins/audit/lib/__init__.py b/openlp/plugins/audit/lib/__init__.py new file mode 100644 index 000000000..544b1dec2 --- /dev/null +++ b/openlp/plugins/audit/lib/__init__.py @@ -0,0 +1,26 @@ +# -*- 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 mediaitem import AuditMediaItem +from audittab import AuditTab diff --git a/openlp/plugins/audit/lib/audittab.py b/openlp/plugins/audit/lib/audittab.py new file mode 100644 index 000000000..91e6a88b3 --- /dev/null +++ b/openlp/plugins/audit/lib/audittab.py @@ -0,0 +1,77 @@ +# -*- 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.TimeoutLayout = QtGui.QHBoxLayout(self.AuditModeGroupBox) + self.TimeoutLayout.setSpacing(8) + self.TimeoutLayout.setMargin(0) + self.TimeoutLayout.setObjectName(u'TimeoutLayout') + self.TimeoutLabel = QtGui.QLabel(self.AuditModeGroupBox) + self.TimeoutLabel.setObjectName(u'TimeoutLabel') + self.TimeoutLayout.addWidget(self.TimeoutLabel) + self.TimeoutSpinBox = QtGui.QSpinBox(self.AuditModeGroupBox) + self.TimeoutSpinBox.setMaximum(180) + self.TimeoutSpinBox.setObjectName(u'TimeoutSpinBox') + self.TimeoutLayout.addWidget(self.TimeoutSpinBox) + self.TimeoutSpacer = QtGui.QSpacerItem(147, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.TimeoutLayout.addItem(self.TimeoutSpacer) + self.AuditLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.AuditModeGroupBox) + # Signals and slots + QtCore.QObject.connect(self.TimeoutSpinBox, + QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged) + + def retranslateUi(self): + self.TimeoutLabel.setText(translate(u'AuditTab', u'Slide Loop Delay:')) + self.TimeoutSpinBox.setSuffix(translate(u'AuditTab', u's')) + + def onTimeoutSpinBoxChanged(self): + self.loop_delay = self.TimeoutSpinBox.value() + + def load(self): + self.loop_delay = int(self.config.get_config(u'loop delay', 5)) + self.TimeoutSpinBox.setValue(self.loop_delay) + + def save(self): + self.config.set_config(u'loop delay', self.loop_delay) + Receiver().send_message(u'update_spin_delay', self.loop_delay ) + + def postSetUp(self): + Receiver().send_message(u'update_spin_delay', self.loop_delay ) diff --git a/openlp/plugins/audit/lib/mediaitem.py b/openlp/plugins/audit/lib/mediaitem.py new file mode 100644 index 000000000..9b7a5aa7f --- /dev/null +++ b/openlp/plugins/audit/lib/mediaitem.py @@ -0,0 +1,83 @@ +# -*- 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 +import os + +from PyQt4 import QtCore, QtGui +from openlp.core.lib import MediaManagerItem, translate, buildIcon + +class AuditMediaItem(MediaManagerItem): + """ + This is the custom media manager item for Audits. + """ + global log + log = logging.getLogger(u'AuditMediaItem') + log.info(u'Audit Media Item loaded') + + def __init__(self, parent, icon, title): + self.TranslationContext = u'AuditPlugin' + self.PluginTextShort = u'Audit' + self.ConfigSection = u'Audits' + self.IconPath = u'Audit/Audit' + self.hasFileIcon = False + self.hasNewIcon = False + self.hasEditIcon = False + MediaManagerItem.__init__(self, parent, icon, title) + + def initialise(self): + pass + + def addStartHeaderBar(self): + self.startMessage = translate(self.TranslationContext, u'Start Collecting') + self.addToolbarButton(self.startMessage, + translate(self.TranslationContext, u'Start collecting alert messages '), + u':audit/audit_start.png', self.onStartClick, u'AuditStartItem') + self.stopMessage = translate(self.TranslationContext, u'Stop Collecting') + self.addToolbarButton(self.stopMessage, + translate(self.TranslationContext, u'Stop collecting alert messages '), + u':audit/audit_stop.png', self.onStopClick, u'AuditStopItem') + + def addMiddleHeaderBar(self): + pass + + def addListViewToToolBar(self): + self.ListView = QtGui.QListWidget() + self.ListView.uniformItemSizes = True + self.ListView.setGeometry(QtCore.QRect(10, 100, 256, 591)) + self.ListView.setSpacing(1) + self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) + self.ListView.setAlternatingRowColors(True) + self.ListView.setDragEnabled(True) + self.ListView.setObjectName(u'AlertListView') + #Add tp PageLayout + self.PageLayout.addWidget(self.ListView) + + def onStartClick(self): + self.Toolbar.actions[self.startMessage].setVisible(False) + self.Toolbar.actions[self.stopMessage].setVisible(True) + + def onStopClick(self): + self.Toolbar.actions[self.startMessage].setVisible(True) + self.Toolbar.actions[self.stopMessage].setVisible(False) diff --git a/resources/images/audit_start.png b/resources/images/audit_start.png new file mode 100644 index 000000000..1a741be17 Binary files /dev/null and b/resources/images/audit_start.png differ diff --git a/resources/images/audit_stop.png b/resources/images/audit_stop.png new file mode 100644 index 000000000..0dfaa6af3 Binary files /dev/null and b/resources/images/audit_stop.png differ