openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #01024
[Merge] lp:~trb143/openlp/futures into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/futures into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Fix SongUsage Dialog so should be complete
Minor bug fixes discovered and fixed.
Alerts - Major refactor
* Make a plugin
* Move code from maindisplay into plugin
* Add Location , Font size and History option to Font Tab and fix code to use them
* Add button to Alert Tab to allow History to be edited
* Amend Alert screen to be able to use History if option set
* Build screen to allow alerts to be Added / Edited and Deleted.
--
https://code.launchpad.net/~trb143/openlp/futures/+merge/19299
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2009-12-31 12:52:01 +0000
+++ openlp/core/lib/plugin.py 2010-02-14 20:33:16 +0000
@@ -127,6 +127,7 @@
self.service_manager = plugin_helpers[u'service']
self.settings = plugin_helpers[u'settings']
self.mediadock = plugin_helpers[u'toolbox']
+ self.maindisplay = plugin_helpers[u'maindisplay']
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_add_service_item' % self.name),
self.process_add_service_event)
@@ -252,4 +253,4 @@
if self.media_item:
self.mediadock.insert_dock(self.media_item, self.icon, self.weight)
if self.settings_tab:
- self.settings.insertTab(self.settings_tab, self.weight)
\ No newline at end of file
+ self.settings.insertTab(self.settings_tab, self.weight)
=== modified file 'openlp/core/lib/pluginmanager.py'
--- openlp/core/lib/pluginmanager.py 2010-02-06 17:13:55 +0000
+++ openlp/core/lib/pluginmanager.py 2010-02-14 20:33:16 +0000
@@ -101,7 +101,7 @@
log.debug(u'Loaded plugin %s with helpers', unicode(p))
plugin_objects.append(plugin)
except TypeError:
- log.error(u'loaded plugin %s has no helpers', unicode(p))
+ log.exception(u'loaded plugin %s has no helpers', unicode(p))
plugins_list = sorted(plugin_objects, self.order_by_weight)
for plugin in plugins_list:
if plugin.check_pre_conditions():
=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py 2010-02-06 08:04:01 +0000
+++ openlp/core/ui/__init__.py 2010-02-14 20:33:16 +0000
@@ -28,11 +28,9 @@
from amendthemeform import AmendThemeForm
from slidecontroller import SlideController
from splashscreen import SplashScreen
-from alertstab import AlertsTab
from generaltab import GeneralTab
from themestab import ThemesTab
from aboutform import AboutForm
-from alertform import AlertForm
from pluginform import PluginForm
from settingsform import SettingsForm
from mediadockmanager import MediaDockManager
=== removed file 'openlp/core/ui/alertform.py'
--- openlp/core/ui/alertform.py 2010-02-06 08:04:01 +0000
+++ openlp/core/ui/alertform.py 1970-01-01 00:00:00 +0000
@@ -1,102 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 build_icon
-
-class AlertForm(QtGui.QDialog):
- global log
- log = logging.getLogger(u'AlertForm')
-
- def __init__(self, parent=None):
- QtGui.QDialog.__init__(self, parent)
- self.parent = parent
- self.setupUi(self)
- log.debug(u'Defined')
-
- def setupUi(self, AlertForm):
- AlertForm.setObjectName(u'AlertForm')
- AlertForm.resize(370, 110)
- icon = build_icon(u':/icon/openlp-logo-16x16.png')
- AlertForm.setWindowIcon(icon)
- self.AlertFormLayout = QtGui.QVBoxLayout(AlertForm)
- self.AlertFormLayout.setSpacing(8)
- self.AlertFormLayout.setMargin(8)
- self.AlertFormLayout.setObjectName(u'AlertFormLayout')
- self.AlertEntryWidget = QtGui.QWidget(AlertForm)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.AlertEntryWidget.sizePolicy().hasHeightForWidth())
- self.AlertEntryWidget.setSizePolicy(sizePolicy)
- self.AlertEntryWidget.setObjectName(u'AlertEntryWidget')
- self.AlertEntryLabel = QtGui.QLabel(self.AlertEntryWidget)
- self.AlertEntryLabel.setGeometry(QtCore.QRect(0, 0, 353, 16))
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.AlertEntryLabel.sizePolicy().hasHeightForWidth())
- self.AlertEntryLabel.setSizePolicy(sizePolicy)
- self.AlertEntryLabel.setObjectName(u'AlertEntryLabel')
- self.AlertEntryEditItem = QtGui.QLineEdit(self.AlertEntryWidget)
- self.AlertEntryEditItem.setGeometry(QtCore.QRect(0, 20, 353, 26))
- self.AlertEntryEditItem.setObjectName(u'AlertEntryEditItem')
- self.AlertFormLayout.addWidget(self.AlertEntryWidget)
- self.ButtonBoxWidget = QtGui.QWidget(AlertForm)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.ButtonBoxWidget.sizePolicy().hasHeightForWidth())
- self.ButtonBoxWidget.setSizePolicy(sizePolicy)
- self.ButtonBoxWidget.setObjectName(u'ButtonBoxWidget')
- self.horizontalLayout = QtGui.QHBoxLayout(self.ButtonBoxWidget)
- self.horizontalLayout.setSpacing(8)
- self.horizontalLayout.setMargin(0)
- self.horizontalLayout.setObjectName(u'horizontalLayout')
- spacerItem = QtGui.QSpacerItem(267, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.horizontalLayout.addItem(spacerItem)
- self.DisplayButton = QtGui.QPushButton(self.ButtonBoxWidget)
- self.DisplayButton.setObjectName(u'DisplayButton')
- self.horizontalLayout.addWidget(self.DisplayButton)
- self.CancelButton = QtGui.QPushButton(self.ButtonBoxWidget)
- self.CancelButton.setObjectName(u'CancelButton')
- self.horizontalLayout.addWidget(self.CancelButton)
- self.AlertFormLayout.addWidget(self.ButtonBoxWidget)
-
- self.retranslateUi(AlertForm)
-
- QtCore.QObject.connect(self.CancelButton, QtCore.SIGNAL(u'clicked()'), AlertForm.close)
- QtCore.QObject.connect(self.DisplayButton, QtCore.SIGNAL(u'clicked()'), self.onDisplayClicked)
- QtCore.QMetaObject.connectSlotsByName(AlertForm)
-
- def retranslateUi(self, AlertForm):
- AlertForm.setWindowTitle(self.trUtf8('Alert Message'))
- self.AlertEntryLabel.setText(self.trUtf8('Alert Text:'))
- self.DisplayButton.setText(self.trUtf8('Display'))
- self.CancelButton.setText(self.trUtf8('Cancel'))
-
- def onDisplayClicked(self):
- self.parent.mainDisplay.displayAlert(unicode(self.AlertEntryEditItem.text()))
=== removed file 'openlp/core/ui/alertstab.py'
--- openlp/core/ui/alertstab.py 2009-12-31 12:52:01 +0000
+++ openlp/core/ui/alertstab.py 1970-01-01 00:00:00 +0000
@@ -1,212 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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
-
-class AlertsTab(SettingsTab):
- """
- AlertsTab is the alerts settings tab in the settings dialog.
- """
- def __init__(self):
- SettingsTab.__init__(self, u'Alerts')
- self.font_color = '#ffffff'
- self.bg_color = '#660000'
-
- def setupUi(self):
- self.setObjectName(u'AlertsTab')
- self.tabTitleVisible = self.trUtf8('Alerts')
- self.AlertsLayout = QtGui.QHBoxLayout(self)
- self.AlertsLayout.setSpacing(8)
- self.AlertsLayout.setMargin(8)
- self.AlertsLayout.setObjectName(u'AlertsLayout')
- self.AlertLeftColumn = QtGui.QWidget(self)
- self.AlertLeftColumn.setObjectName(u'AlertLeftColumn')
- self.SlideLeftLayout = QtGui.QVBoxLayout(self.AlertLeftColumn)
- self.SlideLeftLayout.setSpacing(8)
- self.SlideLeftLayout.setMargin(0)
- self.SlideLeftLayout.setObjectName(u'SlideLeftLayout')
- self.FontGroupBox = QtGui.QGroupBox(self.AlertLeftColumn)
- self.FontGroupBox.setObjectName(u'FontGroupBox')
- self.FontLayout = QtGui.QVBoxLayout(self.FontGroupBox)
- self.FontLayout.setSpacing(8)
- self.FontLayout.setMargin(8)
- self.FontLayout.setObjectName(u'FontLayout')
- self.FontLabel = QtGui.QLabel(self.FontGroupBox)
- self.FontLabel.setObjectName(u'FontLabel')
- self.FontLayout.addWidget(self.FontLabel)
- self.FontComboBox = QtGui.QFontComboBox(self.FontGroupBox)
- self.FontComboBox.setObjectName(u'FontComboBox')
- self.FontLayout.addWidget(self.FontComboBox)
- self.ColorWidget = QtGui.QWidget(self.FontGroupBox)
- self.ColorWidget.setObjectName(u'ColorWidget')
- self.ColorLayout = QtGui.QHBoxLayout(self.ColorWidget)
- self.ColorLayout.setSpacing(8)
- self.ColorLayout.setMargin(0)
- self.ColorLayout.setObjectName(u'ColorLayout')
- self.FontColorLabel = QtGui.QLabel(self.ColorWidget)
- self.FontColorLabel.setObjectName(u'FontColorLabel')
- self.ColorLayout.addWidget(self.FontColorLabel)
- self.FontColorButton = QtGui.QPushButton(self.ColorWidget)
- self.FontColorButton.setObjectName(u'FontColorButton')
- self.ColorLayout.addWidget(self.FontColorButton)
- self.ColorSpacerItem = QtGui.QSpacerItem(40, 20,
- QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.ColorLayout.addItem(self.ColorSpacerItem)
- self.BackgroundColorLabel = QtGui.QLabel(self.ColorWidget)
- self.BackgroundColorLabel.setObjectName(u'BackgroundColorLabel')
- self.ColorLayout.addWidget(self.BackgroundColorLabel)
- self.BackgroundColorButton = QtGui.QPushButton(self.ColorWidget)
- self.BackgroundColorButton.setObjectName(u'BackgroundColorButton')
- self.ColorLayout.addWidget(self.BackgroundColorButton)
- self.FontLayout.addWidget(self.ColorWidget)
- self.TimeoutWidget = QtGui.QWidget(self.FontGroupBox)
- self.TimeoutWidget.setObjectName(u'TimeoutWidget')
- self.TimeoutLayout = QtGui.QHBoxLayout(self.TimeoutWidget)
- self.TimeoutLayout.setSpacing(8)
- self.TimeoutLayout.setMargin(0)
- self.TimeoutLayout.setObjectName(u'TimeoutLayout')
- self.TimeoutLabel = QtGui.QLabel(self.TimeoutWidget)
- self.TimeoutLabel.setObjectName(u'TimeoutLabel')
- self.TimeoutLayout.addWidget(self.TimeoutLabel)
- self.TimeoutSpinBox = QtGui.QSpinBox(self.TimeoutWidget)
- 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.FontLayout.addWidget(self.TimeoutWidget)
- self.SlideLeftLayout.addWidget(self.FontGroupBox)
- self.SlideLeftSpacer = QtGui.QSpacerItem(20, 94,
- QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self.SlideLeftLayout.addItem(self.SlideLeftSpacer)
- self.AlertsLayout.addWidget(self.AlertLeftColumn)
- self.AlertRightColumn = QtGui.QWidget(self)
- self.AlertRightColumn.setObjectName(u'AlertRightColumn')
- self.SlideRightLayout = QtGui.QVBoxLayout(self.AlertRightColumn)
- self.SlideRightLayout.setSpacing(8)
- self.SlideRightLayout.setMargin(0)
- self.SlideRightLayout.setObjectName(u'SlideRightLayout')
- self.PreviewGroupBox = QtGui.QGroupBox(self.AlertRightColumn)
- sizePolicy = QtGui.QSizePolicy(
- QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(
- self.PreviewGroupBox.sizePolicy().hasHeightForWidth())
- self.PreviewGroupBox.setSizePolicy(sizePolicy)
- self.PreviewGroupBox.setObjectName(u'PreviewGroupBox')
- self.PreviewLayout = QtGui.QVBoxLayout(self.PreviewGroupBox)
- self.PreviewLayout.setSpacing(8)
- self.PreviewLayout.setMargin(8)
- self.PreviewLayout.setObjectName(u'PreviewLayout')
- self.FontPreview = QtGui.QLineEdit(self.PreviewGroupBox)
- self.FontPreview.setMinimumSize(QtCore.QSize(280, 100))
- self.FontPreview.setReadOnly(True)
- self.FontPreview.setFocusPolicy(QtCore.Qt.NoFocus)
- self.FontPreview.setAlignment(
- QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
- self.FontPreview.setObjectName(u'FontPreview')
- self.PreviewLayout.addWidget(self.FontPreview)
- self.SlideRightLayout.addWidget(self.PreviewGroupBox)
- self.SlideRightSpacer = QtGui.QSpacerItem(20, 40,
- QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self.SlideRightLayout.addItem(self.SlideRightSpacer)
- self.AlertsLayout.addWidget(self.AlertRightColumn)
- # Signals and slots
- QtCore.QObject.connect(self.BackgroundColorButton,
- QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked)
- QtCore.QObject.connect(self.FontColorButton,
- QtCore.SIGNAL(u'pressed()'), self.onFontColorButtonClicked)
- QtCore.QObject.connect(self.FontComboBox,
- QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked)
- QtCore.QObject.connect(self.TimeoutSpinBox,
- QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)
-
- def retranslateUi(self):
- self.FontGroupBox.setTitle(self.trUtf8('Font'))
- self.FontLabel.setText(self.trUtf8('Font Name:'))
- self.FontColorLabel.setText(self.trUtf8('Font Color:'))
- self.BackgroundColorLabel.setText(self.trUtf8('Background Color:'))
- self.TimeoutLabel.setText(self.trUtf8('Alert timeout:'))
- self.TimeoutSpinBox.setSuffix(self.trUtf8('s'))
- self.PreviewGroupBox.setTitle(self.trUtf8('Preview'))
- self.FontPreview.setText(self.trUtf8('openlp.org 2.0 rocks!'))
-
- def onBackgroundColorButtonClicked(self):
- self.bg_color = QtGui.QColorDialog.getColor(
- QtGui.QColor(self.bg_color), self).name()
- self.BackgroundColorButton.setStyleSheet(
- u'background-color: %s' % self.bg_color)
- self.updateDisplay()
-
- def onFontComboBoxClicked(self):
- self.updateDisplay()
-
- def onFontColorButtonClicked(self):
- self.font_color = QtGui.QColorDialog.getColor(
- QtGui.QColor(self.font_color), self).name()
- self.FontColorButton.setStyleSheet(
- u'background-color: %s' % self.font_color)
- self.updateDisplay()
-
- def onTimeoutSpinBoxChanged(self):
- self.timeout = self.TimeoutSpinBox.value()
-
- def load(self):
- self.timeout = int(self.config.get_config(u'timeout', 5))
- self.font_color = unicode(
- self.config.get_config(u'font color', u'#ffffff'))
- self.bg_color = unicode(
- self.config.get_config(u'background color', u'#660000'))
- self.font_face = unicode(
- self.config.get_config(u'font face', QtGui.QFont().family()))
- self.TimeoutSpinBox.setValue(self.timeout)
- self.FontColorButton.setStyleSheet(
- u'background-color: %s' % self.font_color)
- self.BackgroundColorButton.setStyleSheet(
- u'background-color: %s' % self.bg_color)
- font = QtGui.QFont()
- font.setFamily(self.font_face)
- self.FontComboBox.setCurrentFont(font)
- self.updateDisplay()
-
- def save(self):
- self.font_face = self.FontComboBox.currentFont().family()
- self.config.set_config(u'background color', unicode(self.bg_color))
- self.config.set_config(u'font color', unicode(self.font_color))
- self.config.set_config(u'font face', unicode(self.font_face))
- self.config.set_config(u'timeout', unicode(self.timeout))
-
- def updateDisplay(self):
- font = QtGui.QFont()
- font.setFamily(self.FontComboBox.currentFont().family())
- font.setBold(True)
- font.setPointSize(16)
- self.FontPreview.setFont(font)
- self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' % \
- (self.bg_color, self.font_color))
\ No newline at end of file
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2010-02-06 08:04:01 +0000
+++ openlp/core/ui/maindisplay.py 2010-02-14 20:33:16 +0000
@@ -114,15 +114,11 @@
self.displayBlank = False
self.blankFrame = None
self.frame = None
- self.timer_id = 0
self.firstTime = True
self.mediaLoaded = False
self.hasTransition = False
- self.alertList = []
self.mediaBackground = False
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'alert_text'), self.displayAlert)
- QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'live_slide_hide'), self.hideDisplay)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'live_slide_show'), self.showDisplay)
@@ -147,11 +143,7 @@
self.screen = self.screens.current
#Sort out screen locations and sizes
self.setGeometry(self.screen[u'size'])
- self.alertScreenPosition = self.screen[u'size'].height() * 0.9
- self.alertHeight = self.screen[u'size'].height() - self.alertScreenPosition
- self.display_alert.setGeometry(
- QtCore.QRect(0, self.alertScreenPosition,
- self.screen[u'size'].width(),self.alertHeight))
+ self.display_alert.setGeometry(self.screen[u'size'])
self.video.setGeometry(self.screen[u'size'])
self.display_image.resize(self.screen[u'size'].width(),
self.screen[u'size'].height())
@@ -194,6 +186,7 @@
else:
self.setVisible(False)
self.primary = True
+ Receiver.send_message(u'screen_changed')
def resetDisplay(self):
if self.primary:
@@ -218,6 +211,17 @@
self.screen[u'size'].height() )
self.display_image.setPixmap(QtGui.QPixmap.fromImage(frame))
+ def setAlertSize(self, top, height):
+ self.display_alert.setGeometry(
+ QtCore.QRect(0, top,
+ self.screen[u'size'].width(), height))
+
+ def addAlertImage(self, frame, blank=False):
+ if blank:
+ self.display_alert.setPixmap(self.transparent)
+ else:
+ self.display_alert.setPixmap(frame)
+
def frameView(self, frame, transition=False):
"""
Called from a slide controller to display a frame
@@ -257,64 +261,6 @@
if self.display_frame:
self.frameView(self.display_frame)
-
- def displayAlert(self, text=u''):
- """
- Called from the Alert Tab to display an alert
-
- ``text``
- display text
- """
- log.debug(u'display alert called %s' % text)
- self.parent.StatusBar.showMessage(self.trUtf8(u''))
- self.alertList.append(text)
- if self.timer_id != 0 or self.mediaLoaded:
- self.parent.StatusBar.showMessage(\
- self.trUtf8(u'Alert message created and delayed'))
- return
- self.generateAlert()
-
- def generateAlert(self):
- log.debug(u'Generate Alert called')
- if len(self.alertList) == 0:
- return
- text = self.alertList.pop(0)
- alertTab = self.parent.settingsForm.AlertsTab
- alertframe = \
- QtGui.QPixmap(self.screen[u'size'].width(), self.alertHeight)
- alertframe.fill(QtCore.Qt.transparent)
- painter = QtGui.QPainter(alertframe)
- painter.fillRect(alertframe.rect(), QtCore.Qt.transparent)
- painter.setRenderHint(QtGui.QPainter.Antialiasing)
- painter.fillRect(
- QtCore.QRect(
- 0, 0, alertframe.rect().width(),
- alertframe.rect().height()),
- QtGui.QColor(alertTab.bg_color))
- font = QtGui.QFont()
- font.setFamily(alertTab.font_face)
- font.setBold(True)
- font.setPointSize(40)
- painter.setFont(font)
- painter.setPen(QtGui.QColor(alertTab.font_color))
- x, y = (0, 0)
- metrics = QtGui.QFontMetrics(font)
- painter.drawText(
- x, y + metrics.height() - metrics.descent() - 1, text)
- painter.end()
- self.display_alert.setPixmap(alertframe)
- self.display_alert.setVisible(True)
- # check to see if we have a timer running
- if self.timer_id == 0:
- self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)
-
- def timerEvent(self, event):
- if event.timerId() == self.timer_id:
- self.display_alert.setPixmap(self.transparent)
- self.killTimer(self.timer_id)
- self.timer_id = 0
- self.generateAlert()
-
def onMediaQueue(self, message):
log.debug(u'Queue new media message %s' % message)
self.display_image.close()
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2010-02-06 08:04:01 +0000
+++ openlp/core/ui/mainwindow.py 2010-02-14 20:33:16 +0000
@@ -29,7 +29,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
+from openlp.core.ui import AboutForm, SettingsForm, \
ServiceManager, ThemeManager, MainDisplay, SlideController, \
PluginForm, MediaDockManager
from openlp.core.lib import RenderManager, PluginConfig, build_icon, \
@@ -227,13 +227,8 @@
self.settingsmanager.showServiceManager)
self.ViewServiceManagerItem.setIcon(ServiceManagerIcon)
self.ViewServiceManagerItem.setObjectName(u'ViewServiceManagerItem')
- self.ToolsAlertItem = QtGui.QAction(MainWindow)
- AlertIcon = build_icon(u':/tools/tools_alert.png')
- self.ToolsAlertItem.setIcon(AlertIcon)
- self.ToolsAlertItem.setObjectName(u'ToolsAlertItem')
self.PluginItem = QtGui.QAction(MainWindow)
- #PluginIcon = build_icon(u':/tools/tools_alert.png')
- self.PluginItem.setIcon(AlertIcon)
+ #self.PluginItem.setIcon(AlertIcon)
self.PluginItem.setObjectName(u'PluginItem')
self.HelpDocumentationItem = QtGui.QAction(MainWindow)
ContentsIcon = build_icon(u':/system/system_help_contents.png')
@@ -292,7 +287,6 @@
self.OptionsMenu.addAction(self.OptionsViewMenu.menuAction())
self.OptionsMenu.addSeparator()
self.OptionsMenu.addAction(self.OptionsSettingsItem)
- self.ToolsMenu.addAction(self.ToolsAlertItem)
self.ToolsMenu.addAction(self.PluginItem)
self.ToolsMenu.addSeparator()
self.ToolsMenu.addAction(self.ToolsAddToolItem)
@@ -394,9 +388,6 @@
self.action_Preview_Panel.setStatusTip(
self.trUtf8('Toggle the visibility of the Preview Panel'))
self.action_Preview_Panel.setShortcut(self.trUtf8('F11'))
- self.ToolsAlertItem.setText(self.trUtf8('&Alert'))
- self.ToolsAlertItem.setStatusTip(self.trUtf8('Show an alert message'))
- self.ToolsAlertItem.setShortcut(self.trUtf8('F7'))
self.PluginItem.setText(self.trUtf8('&Plugin List'))
self.PluginItem.setStatusTip(self.trUtf8('List the Plugins'))
self.PluginItem.setShortcut(self.trUtf8('Alt+F7'))
@@ -440,7 +431,6 @@
self.settingsmanager = SettingsManager(screens)
self.generalConfig = PluginConfig(u'General')
self.mainDisplay = MainDisplay(self, screens)
- self.alertForm = AlertForm(self)
self.aboutForm = AboutForm(self, applicationVersion)
self.settingsForm = SettingsForm(self.screens, self, self)
# Set up the path with plugins
@@ -485,8 +475,6 @@
self.action_Preview_Panel.setChecked)
QtCore.QObject.connect(self.HelpAboutItem,
QtCore.SIGNAL(u'triggered()'), self.onHelpAboutItemClicked)
- QtCore.QObject.connect(self.ToolsAlertItem,
- QtCore.SIGNAL(u'triggered()'), self.onToolsAlertItemClicked)
QtCore.QObject.connect(self.PluginItem,
QtCore.SIGNAL(u'triggered()'), self.onPluginItemClicked)
QtCore.QObject.connect(self.OptionsSettingsItem,
@@ -522,6 +510,7 @@
self.plugin_helpers[u'service'] = self.ServiceManagerContents
self.plugin_helpers[u'settings'] = self.settingsForm
self.plugin_helpers[u'toolbox'] = self.mediaDockManager
+ self.plugin_helpers[u'maindisplay'] = self.mainDisplay
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
# hook methods have to happen after find_plugins. Find plugins needs
# the controllers hence the hooks have moved from setupUI() to here
@@ -605,12 +594,6 @@
self.aboutForm.applicationVersion = self.applicationVersion
self.aboutForm.exec_()
- def onToolsAlertItemClicked(self):
- """
- Show the Alert form
- """
- self.alertForm.exec_()
-
def onPluginItemClicked(self):
"""
Show the Plugin form
=== modified file 'openlp/core/ui/settingsform.py'
--- openlp/core/ui/settingsform.py 2009-12-31 12:52:01 +0000
+++ openlp/core/ui/settingsform.py 2010-02-14 20:33:16 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtGui
-from openlp.core.ui import GeneralTab, ThemesTab, AlertsTab
+from openlp.core.ui import GeneralTab, ThemesTab
from openlp.core.lib import Receiver
from settingsdialog import Ui_SettingsDialog
@@ -44,9 +44,6 @@
# Themes tab
self.ThemesTab = ThemesTab(mainWindow)
self.addTab(u'Themes', self.ThemesTab)
- # Alert tab
- self.AlertsTab = AlertsTab()
- self.addTab(u'Alerts', self.AlertsTab)
def addTab(self, name, tab):
log.info(u'Adding %s tab' % tab.tabTitle)
@@ -73,4 +70,4 @@
def postSetUp(self):
for tab_index in range(0, self.SettingsTabWidget.count()):
- self.SettingsTabWidget.widget(tab_index).postSetUp()
\ No newline at end of file
+ self.SettingsTabWidget.widget(tab_index).postSetUp()
=== added directory 'openlp/plugins/alerts'
=== added file 'openlp/plugins/alerts/__init__.py'
--- openlp/plugins/alerts/__init__.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/__init__.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/alertsplugin.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,101 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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 datetime import datetime
+import logging
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import Plugin, Receiver, str_to_bool, build_icon, PluginStatus
+from openlp.plugins.alerts.lib import AlertsManager, DBManager
+from openlp.plugins.alerts.forms import AlertsTab, AlertForm, AlertEditForm
+
+class alertsPlugin(Plugin):
+ global log
+ log = logging.getLogger(u'alertsPlugin')
+ log.info(u'alerts Plugin loaded')
+
+ def __init__(self, plugin_helpers):
+ Plugin.__init__(self, u'alerts', u'1.9.1', plugin_helpers)
+ self.weight = -3
+ self.icon = build_icon(u':/media/media_image.png')
+ self.alertsmanager = AlertsManager(self)
+ self.manager = DBManager(self.config)
+ self.alertForm = AlertForm(self.manager, self)
+ self.alertEditForm = AlertEditForm(self.manager, self)
+ self.status = PluginStatus.Active
+
+ def get_settings_tab(self):
+ self.alertsTab = AlertsTab(self)
+ return self.alertsTab
+
+ def add_tools_menu_item(self, tools_menu):
+ """
+ Give the alerts plugin the opportunity to add items to the
+ **Tools** menu.
+
+ ``tools_menu``
+ The actual **Tools** menu item, so that your actions can
+ use it as their parent.
+ """
+ log.info(u'add tools menu')
+ self.toolsAlertItem = QtGui.QAction(tools_menu)
+ AlertIcon = build_icon(u':/tools/tools_alert.png')
+ self.toolsAlertItem.setIcon(AlertIcon)
+ self.toolsAlertItem.setObjectName(u'toolsAlertItem')
+ self.toolsAlertItem.setText(self.trUtf8('&Alert'))
+ self.toolsAlertItem.setStatusTip(self.trUtf8('Show an alert message'))
+ self.toolsAlertItem.setShortcut(self.trUtf8('F7'))
+ self.service_manager.parent.ToolsMenu.addAction(self.toolsAlertItem)
+ QtCore.QObject.connect(self.toolsAlertItem,
+ QtCore.SIGNAL(u'triggered()'), self.onAlertsTrigger)
+ self.toolsAlertItem.setVisible(False)
+
+ def initialise(self):
+ log.info(u'alerts Initialising')
+ Plugin.initialise(self)
+ self.toolsAlertItem.setVisible(True)
+
+ def finalise(self):
+ log.info(u'Plugin Finalise')
+ self.toolsAlertItem.setVisible(False)
+ #stop any events being processed
+
+ def togglealertsState(self):
+ self.alertsActive = not self.alertsActive
+ self.config.set_config(u'active', self.alertsActive)
+
+ def onAlertsTrigger(self):
+ self.alertForm.loadList()
+ self.alertForm.exec_()
+
+ def onAlertsEdit(self):
+ self.alertEditForm.loadList()
+ self.alertEditForm.exec_()
+
+ def about(self):
+ about_text = self.trUtf8('<b>Alerts Plugin</b><br>This plugin '
+ 'controls the displaying of alerts on the presentations screen')
+ return about_text
=== added directory 'openlp/plugins/alerts/forms'
=== added file 'openlp/plugins/alerts/forms/__init__.py'
--- openlp/plugins/alerts/forms/__init__.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/forms/__init__.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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 alertstab import AlertsTab
+from alertform import AlertForm
+from alerteditform import AlertEditForm
=== added file 'openlp/plugins/alerts/forms/alertdialog.py'
--- openlp/plugins/alerts/forms/alertdialog.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/forms/alertdialog.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'alertform.ui'
+#
+# Created: Sat Feb 13 08:19:51 2010
+# by: PyQt4 UI code generator 4.6.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_AlertDialog(object):
+ def setupUi(self, AlertForm):
+ AlertForm.setObjectName("AlertDialog")
+ AlertForm.resize(430, 320)
+ icon = QtGui.QIcon()
+ icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
+ AlertForm.setWindowIcon(icon)
+ self.AlertFormLayout = QtGui.QVBoxLayout(AlertForm)
+ self.AlertFormLayout.setSpacing(8)
+ self.AlertFormLayout.setMargin(8)
+ self.AlertFormLayout.setObjectName("AlertFormLayout")
+ self.AlertEntryWidget = QtGui.QWidget(AlertForm)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.AlertEntryWidget.sizePolicy().hasHeightForWidth())
+ self.AlertEntryWidget.setSizePolicy(sizePolicy)
+ self.AlertEntryWidget.setObjectName("AlertEntryWidget")
+ self.verticalLayout_2 = QtGui.QVBoxLayout(self.AlertEntryWidget)
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.verticalLayout = QtGui.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.AlertEntryLabel = QtGui.QLabel(self.AlertEntryWidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.AlertEntryLabel.sizePolicy().hasHeightForWidth())
+ self.AlertEntryLabel.setSizePolicy(sizePolicy)
+ self.AlertEntryLabel.setObjectName("AlertEntryLabel")
+ self.verticalLayout.addWidget(self.AlertEntryLabel)
+ self.AlertEntryEditItem = QtGui.QLineEdit(self.AlertEntryWidget)
+ self.AlertEntryEditItem.setObjectName("AlertEntryEditItem")
+ self.verticalLayout.addWidget(self.AlertEntryEditItem)
+ self.AlertListWidget = QtGui.QListWidget(self.AlertEntryWidget)
+ self.AlertListWidget.setAlternatingRowColors(True)
+ self.AlertListWidget.setObjectName("AlertListWidget")
+ self.verticalLayout.addWidget(self.AlertListWidget)
+ self.verticalLayout_2.addLayout(self.verticalLayout)
+ self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ spacerItem = QtGui.QSpacerItem(181, 38, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.horizontalLayout.addItem(spacerItem)
+ self.DisplayButton = QtGui.QPushButton(self.AlertEntryWidget)
+ self.DisplayButton.setObjectName("DisplayButton")
+ self.horizontalLayout.addWidget(self.DisplayButton)
+ self.CancelButton = QtGui.QPushButton(self.AlertEntryWidget)
+ self.CancelButton.setObjectName("CancelButton")
+ self.horizontalLayout.addWidget(self.CancelButton)
+ self.verticalLayout_2.addLayout(self.horizontalLayout)
+ self.AlertFormLayout.addWidget(self.AlertEntryWidget)
+
+ self.retranslateUi(AlertForm)
+ QtCore.QObject.connect(self.CancelButton, QtCore.SIGNAL("clicked()"), self.close)
+ QtCore.QMetaObject.connectSlotsByName(AlertForm)
+
+ def retranslateUi(self, AlertForm):
+ AlertForm.setWindowTitle(QtGui.QApplication.translate("AlertForm", "Alert Message", None, QtGui.QApplication.UnicodeUTF8))
+ self.AlertEntryLabel.setText(QtGui.QApplication.translate("AlertForm", "Alert Text:", None, QtGui.QApplication.UnicodeUTF8))
+ self.DisplayButton.setText(QtGui.QApplication.translate("AlertForm", "Display", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("AlertForm", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
=== added file 'openlp/plugins/alerts/forms/alerteditdialog.py'
--- openlp/plugins/alerts/forms/alerteditdialog.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/forms/alerteditdialog.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'alerteditdialog.ui'
+#
+# Created: Sun Feb 14 16:45:10 2010
+# by: PyQt4 UI code generator 4.6.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_AlertEditDialog(object):
+ def setupUi(self, AlertEditDialog):
+ AlertEditDialog.setObjectName("AlertEditDialog")
+ AlertEditDialog.resize(400, 300)
+ self.buttonBox = QtGui.QDialogButtonBox(AlertEditDialog)
+ self.buttonBox.setGeometry(QtCore.QRect(220, 270, 173, 27))
+ self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel)
+ self.buttonBox.setObjectName("buttonBox")
+ self.layoutWidget = QtGui.QWidget(AlertEditDialog)
+ self.layoutWidget.setGeometry(QtCore.QRect(20, 10, 361, 251))
+ self.layoutWidget.setObjectName("layoutWidget")
+ self.verticalLayout_2 = QtGui.QVBoxLayout(self.layoutWidget)
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.horizontalLayout_2 = QtGui.QHBoxLayout()
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.AlertLineEdit = QtGui.QLineEdit(self.layoutWidget)
+ self.AlertLineEdit.setObjectName("AlertLineEdit")
+ self.horizontalLayout_2.addWidget(self.AlertLineEdit)
+ self.verticalLayout_2.addLayout(self.horizontalLayout_2)
+ self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.AlertListWidget = QtGui.QListWidget(self.layoutWidget)
+ self.AlertListWidget.setAlternatingRowColors(True)
+ self.AlertListWidget.setObjectName("AlertListWidget")
+ self.horizontalLayout.addWidget(self.AlertListWidget)
+ self.verticalLayout = QtGui.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.SaveButton = QtGui.QPushButton(self.layoutWidget)
+ self.SaveButton.setObjectName("SaveButton")
+ self.verticalLayout.addWidget(self.SaveButton)
+ self.ClearButton = QtGui.QPushButton(self.layoutWidget)
+ self.ClearButton.setObjectName("ClearButton")
+ self.verticalLayout.addWidget(self.ClearButton)
+ self.AddButton = QtGui.QPushButton(self.layoutWidget)
+ self.AddButton.setObjectName("AddButton")
+ self.verticalLayout.addWidget(self.AddButton)
+ self.EditButton = QtGui.QPushButton(self.layoutWidget)
+ self.EditButton.setObjectName("EditButton")
+ self.verticalLayout.addWidget(self.EditButton)
+ self.DeleteButton = QtGui.QPushButton(self.layoutWidget)
+ self.DeleteButton.setObjectName("DeleteButton")
+ self.verticalLayout.addWidget(self.DeleteButton)
+ self.horizontalLayout.addLayout(self.verticalLayout)
+ self.verticalLayout_2.addLayout(self.horizontalLayout)
+
+ self.retranslateUi(AlertEditDialog)
+ QtCore.QMetaObject.connectSlotsByName(AlertEditDialog)
+
+ def retranslateUi(self, AlertEditDialog):
+ AlertEditDialog.setWindowTitle(QtGui.QApplication.translate("AlertEditDialog", "Maintain Alerts", None, QtGui.QApplication.UnicodeUTF8))
+ self.SaveButton.setText(QtGui.QApplication.translate("AlertEditDialog", "Save", None, QtGui.QApplication.UnicodeUTF8))
+ self.ClearButton.setText(QtGui.QApplication.translate("AlertEditDialog", "Clear", None, QtGui.QApplication.UnicodeUTF8))
+ self.AddButton.setText(QtGui.QApplication.translate("AlertEditDialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
+ self.EditButton.setText(QtGui.QApplication.translate("AlertEditDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8))
+ self.DeleteButton.setText(QtGui.QApplication.translate("AlertEditDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8))
+
=== added file 'openlp/plugins/alerts/forms/alerteditform.py'
--- openlp/plugins/alerts/forms/alerteditform.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/forms/alerteditform.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,168 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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 datetime import date
+
+from PyQt4 import QtGui, QtCore
+from openlp.plugins.alerts.lib.models import AlertItem
+
+from alerteditdialog import Ui_AlertEditDialog
+
+class AlertEditForm(QtGui.QDialog, Ui_AlertEditDialog):
+ """
+ Class documentation goes here.
+ """
+ def __init__(self, manager, parent):
+ """
+ Constructor
+ """
+ self.manager = manager
+ self.parent = parent
+ QtGui.QDialog.__init__(self, None)
+ self.setupUi(self)
+ QtCore.QObject.connect(self.DeleteButton,
+ QtCore.SIGNAL(u'clicked()'),
+ self.onDeleteClick)
+ QtCore.QObject.connect(self.ClearButton,
+ QtCore.SIGNAL(u'clicked()'),
+ self.onClearClick)
+ QtCore.QObject.connect(self.EditButton,
+ QtCore.SIGNAL(u'clicked()'),
+ self.onEditClick)
+ QtCore.QObject.connect(self.AddButton,
+ QtCore.SIGNAL(u'clicked()'),
+ self.onAddClick)
+ QtCore.QObject.connect(self.SaveButton,
+ QtCore.SIGNAL(u'clicked()'),
+ self.onSaveClick)
+ QtCore.QObject.connect(self.buttonBox,
+ QtCore.SIGNAL(u'rejected()'), self.close)
+ QtCore.QObject.connect(self.AlertLineEdit,
+ QtCore.SIGNAL(u'textChanged(const QString&)'),
+ self.onTextChanged)
+ QtCore.QObject.connect(self.AlertListWidget,
+ QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
+ self.onItemSelected)
+ QtCore.QObject.connect(self.AlertListWidget,
+ QtCore.SIGNAL(u'clicked(QModelIndex)'),
+ self.onItemSelected)
+
+ def loadList(self):
+ self.AlertListWidget.clear()
+ alerts = self.manager.get_all_alerts()
+ for alert in alerts:
+ item_name = QtGui.QListWidgetItem(alert.text)
+ item_name.setData(
+ QtCore.Qt.UserRole, QtCore.QVariant(alert.id))
+ self.AlertListWidget.addItem(item_name)
+ self.AddButton.setEnabled(True)
+ self.ClearButton.setEnabled(False)
+ self.SaveButton.setEnabled(False)
+ self.EditButton.setEnabled(False)
+ self.DeleteButton.setEnabled(False)
+
+ def onItemSelected(self):
+ if len(self.AlertLineEdit.text()) > 0:
+ QtGui.QMessageBox.information(self,
+ self.trUtf8('Item selected to Edit'),
+ self.trUtf8('Please Save or Clear seletced item'))
+ else:
+ self.EditButton.setEnabled(True)
+ self.DeleteButton.setEnabled(True)
+
+ def onDeleteClick(self):
+ item = self.AlertListWidget.currentItem()
+ if item:
+ item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ self.parent.manager.delete_alert(item_id)
+ row = self.AlertListWidget.row(item)
+ self.AlertListWidget.takeItem(row)
+ self.AddButton.setEnabled(True)
+ self.SaveButton.setEnabled(False)
+ self.DeleteButton.setEnabled(False)
+ self.EditButton.setEnabled(False)
+
+ def onEditClick(self):
+ item = self.AlertListWidget.currentItem()
+ if item:
+ self.item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ self.AlertLineEdit.setText(unicode(item.text()))
+ self.AddButton.setEnabled(True)
+ self.ClearButton.setEnabled(True)
+ self.SaveButton.setEnabled(True)
+ self.DeleteButton.setEnabled(True)
+ self.EditButton.setEnabled(False)
+
+ def onClearClick(self):
+ self.AlertLineEdit.setText(u'')
+ self.AddButton.setEnabled(False)
+ self.ClearButton.setEnabled(True)
+ self.SaveButton.setEnabled(False)
+ self.DeleteButton.setEnabled(False)
+ self.EditButton.setEnabled(False)
+
+ def onAddClick(self):
+ if len(self.AlertLineEdit.text()) == 0:
+ QtGui.QMessageBox.information(self,
+ self.trUtf8('Item selected to Add'),
+ self.trUtf8('Missing data'))
+ else:
+ alert = AlertItem()
+ alert.text = unicode(self.AlertLineEdit.text())
+ self.manager.save_alert(alert)
+ self.onClearClick()
+ self.loadList()
+
+ def onSaveClick(self):
+ alert = self.manager.get_alert(self.item_id)
+ alert.text = unicode(self.AlertLineEdit.text())
+ self.manager.save_alert(alert)
+ self.onClearClick()
+ self.loadList()
+
+ def onTextChanged(self):
+ self.AddButton.setEnabled(True)
+
+ def onDoubleClick(self):
+ """
+ List item has been double clicked to display it
+ """
+ items = self.AlertListWidget.selectedIndexes()
+ for item in items:
+ bitem = self.AlertListWidget.item(item.row())
+ self.triggerAlert(bitem.text())
+
+ def onSingleClick(self):
+ """
+ List item has been single clicked to add it to
+ the edit field so it can be changed.
+ """
+ items = self.AlertListWidget.selectedIndexes()
+ for item in items:
+ bitem = self.AlertListWidget.item(item.row())
+ self.AlertEntryEditItem.setText(bitem.text())
+
+ def triggerAlert(self, text):
+ self.parent.alertsmanager.displayAlert(text)
=== added file 'openlp/plugins/alerts/forms/alertform.py'
--- openlp/plugins/alerts/forms/alertform.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/forms/alertform.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,101 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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 datetime import date
+
+from PyQt4 import QtGui, QtCore
+from openlp.plugins.alerts.lib.models import AlertItem
+
+from alertdialog import Ui_AlertDialog
+
+class AlertForm(QtGui.QDialog, Ui_AlertDialog):
+ """
+ Class documentation goes here.
+ """
+ def __init__(self, manager, parent):
+ """
+ Constructor
+ """
+ self.manager = manager
+ self.parent = parent
+ self.history_required = True
+ QtGui.QDialog.__init__(self, None)
+ self.setupUi(self)
+ QtCore.QObject.connect(self.DisplayButton,
+ QtCore.SIGNAL(u'clicked()'),
+ self.onDisplayClicked)
+ QtCore.QObject.connect(self.AlertEntryEditItem,
+ QtCore.SIGNAL(u'textChanged(const QString&)'),
+ self.onTextChanged)
+ QtCore.QObject.connect(self.AlertListWidget,
+ QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
+ self.onDoubleClick)
+ QtCore.QObject.connect(self.AlertListWidget,
+ QtCore.SIGNAL(u'clicked(QModelIndex)'),
+ self.onSingleClick)
+
+ def loadList(self):
+ self.AlertListWidget.clear()
+ alerts = self.manager.get_all_alerts()
+ for alert in alerts:
+ item_name = QtGui.QListWidgetItem(alert.text)
+ self.AlertListWidget.addItem(item_name)
+
+ def onDisplayClicked(self):
+ self.triggerAlert(unicode(self.AlertEntryEditItem.text()))
+ if self.parent.alertsTab.save_history and self.history_required:
+ alert = AlertItem()
+ alert.text = unicode(self.AlertEntryEditItem.text())
+ self.manager.save_alert(alert)
+ self.history_required = False
+ self.loadList()
+
+ def onTextChanged(self):
+ #Data has changed by editing it so potential storage
+ self.history_required = True
+
+ def onDoubleClick(self):
+ """
+ List item has been double clicked to display it
+ """
+ items = self.AlertListWidget.selectedIndexes()
+ for item in items:
+ bitem = self.AlertListWidget.item(item.row())
+ self.triggerAlert(bitem.text())
+ self.history_required = False
+
+ def onSingleClick(self):
+ """
+ List item has been single clicked to add it to
+ the edit field so it can be changed.
+ """
+ items = self.AlertListWidget.selectedIndexes()
+ for item in items:
+ bitem = self.AlertListWidget.item(item.row())
+ self.AlertEntryEditItem.setText(bitem.text())
+ self.history_required = False
+
+ def triggerAlert(self, text):
+ self.parent.alertsmanager.displayAlert(text)
=== added file 'openlp/plugins/alerts/forms/alertstab.py'
--- openlp/plugins/alerts/forms/alertstab.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/forms/alertstab.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,320 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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
+
+class AlertsTab(SettingsTab):
+ """
+ AlertsTab is the alerts settings tab in the settings dialog.
+ """
+ def __init__(self, parent, section=None):
+ self.parent = parent
+ SettingsTab.__init__(self, parent.name, section)
+
+ def setupUi(self):
+ self.setObjectName(u'AlertsTab')
+ self.tabTitleVisible = self.trUtf8('Alerts')
+ self.AlertsLayout = QtGui.QHBoxLayout(self)
+ self.AlertsLayout.setSpacing(8)
+ self.AlertsLayout.setMargin(8)
+ self.AlertsLayout.setObjectName(u'AlertsLayout')
+ self.AlertLeftColumn = QtGui.QWidget(self)
+ self.AlertLeftColumn.setObjectName(u'AlertLeftColumn')
+ self.SlideLeftLayout = QtGui.QVBoxLayout(self.AlertLeftColumn)
+ self.SlideLeftLayout.setSpacing(8)
+ self.SlideLeftLayout.setMargin(0)
+ self.SlideLeftLayout.setObjectName(u'SlideLeftLayout')
+ self.FontGroupBox = QtGui.QGroupBox(self.AlertLeftColumn)
+ self.FontGroupBox.setObjectName(u'FontGroupBox')
+ self.FontLayout = QtGui.QVBoxLayout(self.FontGroupBox)
+ self.FontLayout.setSpacing(8)
+ self.FontLayout.setMargin(8)
+ self.FontLayout.setObjectName(u'FontLayout')
+ self.FontLabel = QtGui.QLabel(self.FontGroupBox)
+ self.FontLabel.setObjectName(u'FontLabel')
+ self.FontLayout.addWidget(self.FontLabel)
+ self.FontComboBox = QtGui.QFontComboBox(self.FontGroupBox)
+ self.FontComboBox.setObjectName(u'FontComboBox')
+ self.FontLayout.addWidget(self.FontComboBox)
+ self.ColorWidget = QtGui.QWidget(self.FontGroupBox)
+ self.ColorWidget.setObjectName(u'ColorWidget')
+ self.ColorLayout = QtGui.QHBoxLayout(self.ColorWidget)
+ self.ColorLayout.setSpacing(8)
+ self.ColorLayout.setMargin(0)
+ self.ColorLayout.setObjectName(u'ColorLayout')
+ self.FontColorLabel = QtGui.QLabel(self.ColorWidget)
+ self.FontColorLabel.setObjectName(u'FontColorLabel')
+ self.ColorLayout.addWidget(self.FontColorLabel)
+ self.FontColorButton = QtGui.QPushButton(self.ColorWidget)
+ self.FontColorButton.setObjectName(u'FontColorButton')
+ self.ColorLayout.addWidget(self.FontColorButton)
+ self.ColorSpacerItem = QtGui.QSpacerItem(40, 20,
+ QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.ColorLayout.addItem(self.ColorSpacerItem)
+ self.BackgroundColorLabel = QtGui.QLabel(self.ColorWidget)
+ self.BackgroundColorLabel.setObjectName(u'BackgroundColorLabel')
+ self.ColorLayout.addWidget(self.BackgroundColorLabel)
+ self.BackgroundColorButton = QtGui.QPushButton(self.ColorWidget)
+ self.BackgroundColorButton.setObjectName(u'BackgroundColorButton')
+ self.ColorLayout.addWidget(self.BackgroundColorButton)
+ self.FontLayout.addWidget(self.ColorWidget)
+ self.FontSizeWidget = QtGui.QWidget(self.FontGroupBox)
+ self.FontSizeWidget.setObjectName(u'FontSizeWidget')
+ self.FontSizeLayout = QtGui.QHBoxLayout(self.FontSizeWidget)
+ self.FontSizeLayout.setSpacing(8)
+ self.FontSizeLayout.setMargin(0)
+ self.FontSizeLayout.setObjectName(u'FontSizeLayout')
+ self.FontSizeLabel = QtGui.QLabel(self.FontSizeWidget)
+ self.FontSizeLabel.setObjectName(u'FontSizeLabel')
+ self.FontSizeLayout.addWidget(self.FontSizeLabel)
+ self.FontSizeSpinBox = QtGui.QSpinBox(self.FontSizeWidget)
+ self.FontSizeSpinBox.setObjectName(u'FontSizeSpinBox')
+ self.FontSizeLayout.addWidget(self.FontSizeSpinBox)
+ self.FontSizeSpacer = QtGui.QSpacerItem(147, 20,
+ QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.FontSizeLayout.addItem(self.FontSizeSpacer)
+ self.FontLayout.addWidget(self.FontSizeWidget)
+ self.TimeoutWidget = QtGui.QWidget(self.FontGroupBox)
+ self.TimeoutWidget.setObjectName(u'TimeoutWidget')
+ self.TimeoutLayout = QtGui.QHBoxLayout(self.TimeoutWidget)
+ self.TimeoutLayout.setSpacing(8)
+ self.TimeoutLayout.setMargin(0)
+ self.TimeoutLayout.setObjectName(u'TimeoutLayout')
+ self.TimeoutLabel = QtGui.QLabel(self.TimeoutWidget)
+ self.TimeoutLabel.setObjectName(u'TimeoutLabel')
+ self.TimeoutLayout.addWidget(self.TimeoutLabel)
+ self.TimeoutSpinBox = QtGui.QSpinBox(self.TimeoutWidget)
+ 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.FontLayout.addWidget(self.TimeoutWidget)
+ self.LocationWidget = QtGui.QWidget(self.FontGroupBox)
+ self.LocationWidget.setObjectName(u'LocationWidget')
+ self.LocationLayout = QtGui.QHBoxLayout(self.LocationWidget)
+ self.LocationLayout.setSpacing(8)
+ self.LocationLayout.setMargin(0)
+ self.LocationLayout.setObjectName(u'LocationLayout')
+ self.LocationLabel = QtGui.QLabel(self.LocationWidget)
+ self.LocationLabel.setObjectName(u'LocationLabel')
+ self.LocationLayout.addWidget(self.LocationLabel)
+ self.LocationComboBox = QtGui.QComboBox(self.LocationWidget)
+ self.LocationComboBox.addItem(QtCore.QString())
+ self.LocationComboBox.addItem(QtCore.QString())
+ self.LocationComboBox.setObjectName(u'LocationComboBox')
+ self.LocationLayout.addWidget(self.LocationComboBox)
+ self.LocationSpacer = QtGui.QSpacerItem(147, 20,
+ QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.LocationLayout.addItem(self.LocationSpacer)
+ self.FontLayout.addWidget(self.LocationWidget)
+ self.HistoryWidget = QtGui.QWidget(self.FontGroupBox)
+ self.HistoryWidget.setObjectName(u'HistoryWidget')
+ self.HistoryLayout = QtGui.QHBoxLayout(self.HistoryWidget)
+ self.HistoryLayout.setSpacing(8)
+ self.HistoryLayout.setMargin(0)
+ self.HistoryLayout.setObjectName(u'HistoryLayout')
+ self.HistoryLabel = QtGui.QLabel(self.HistoryWidget)
+ self.HistoryLabel.setObjectName(u'HistoryLabel')
+ self.HistoryLayout.addWidget(self.HistoryLabel)
+ self.HistoryCheckBox = QtGui.QCheckBox(self.HistoryWidget)
+ self.HistoryCheckBox.setObjectName(u'HistoryCheckBox')
+ self.HistoryLayout.addWidget(self.HistoryCheckBox)
+ self.HistorySpacer = QtGui.QSpacerItem(147, 20,
+ QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.HistoryLayout.addItem(self.HistorySpacer)
+ self.FontLayout.addWidget(self.HistoryWidget)
+ self.HistoryEditWidget = QtGui.QWidget(self.FontGroupBox)
+ self.HistoryEditWidget.setObjectName(u'HistoryEditWidget')
+ self.HistoryEditLayout = QtGui.QHBoxLayout(self.HistoryEditWidget)
+ self.HistoryEditLayout.setSpacing(8)
+ self.HistoryEditLayout.setMargin(0)
+ self.HistoryEditLayout.setObjectName(u'HistoryEditLayout')
+ self.HistoryEditLabel = QtGui.QLabel(self.HistoryEditWidget)
+ self.HistoryEditLabel.setObjectName(u'HistoryEditLabel')
+ self.HistoryEditLayout.addWidget(self.HistoryEditLabel)
+ self.HistoryEditPushButton = QtGui.QPushButton(self.HistoryEditWidget)
+ self.HistoryEditPushButton.setObjectName(u'HistoryEditPushButton')
+ self.HistoryEditLayout.addWidget(self.HistoryEditPushButton)
+ self.HistoryEditSpacer = QtGui.QSpacerItem(147, 20,
+ QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.HistoryEditLayout.addItem(self.HistoryEditSpacer)
+ self.FontLayout.addWidget(self.HistoryEditWidget)
+ self.SlideLeftLayout.addWidget(self.FontGroupBox)
+ self.SlideLeftSpacer = QtGui.QSpacerItem(20, 94,
+ QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.SlideLeftLayout.addItem(self.SlideLeftSpacer)
+ self.AlertsLayout.addWidget(self.AlertLeftColumn)
+ self.AlertRightColumn = QtGui.QWidget(self)
+ self.AlertRightColumn.setObjectName(u'AlertRightColumn')
+ self.SlideRightLayout = QtGui.QVBoxLayout(self.AlertRightColumn)
+ self.SlideRightLayout.setSpacing(8)
+ self.SlideRightLayout.setMargin(0)
+ self.SlideRightLayout.setObjectName(u'SlideRightLayout')
+ self.PreviewGroupBox = QtGui.QGroupBox(self.AlertRightColumn)
+ sizePolicy = QtGui.QSizePolicy(
+ QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(
+ self.PreviewGroupBox.sizePolicy().hasHeightForWidth())
+ self.PreviewGroupBox.setSizePolicy(sizePolicy)
+ self.PreviewGroupBox.setObjectName(u'PreviewGroupBox')
+ self.PreviewLayout = QtGui.QVBoxLayout(self.PreviewGroupBox)
+ self.PreviewLayout.setSpacing(8)
+ self.PreviewLayout.setMargin(8)
+ self.PreviewLayout.setObjectName(u'PreviewLayout')
+ self.FontPreview = QtGui.QLineEdit(self.PreviewGroupBox)
+ self.FontPreview.setFixedSize(QtCore.QSize(350, 100))
+ self.FontPreview.setReadOnly(True)
+ self.FontPreview.setFocusPolicy(QtCore.Qt.NoFocus)
+ self.FontPreview.setAlignment(
+ QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
+ self.FontPreview.setObjectName(u'FontPreview')
+ self.PreviewLayout.addWidget(self.FontPreview)
+ self.SlideRightLayout.addWidget(self.PreviewGroupBox)
+ self.SlideRightSpacer = QtGui.QSpacerItem(20, 40,
+ QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.SlideRightLayout.addItem(self.SlideRightSpacer)
+ self.AlertsLayout.addWidget(self.AlertRightColumn)
+ # Signals and slots
+ QtCore.QObject.connect(self.HistoryCheckBox,
+ QtCore.SIGNAL(u'stateChanged(int)'),
+ self.onHistoryCheckBoxChanged)
+ QtCore.QObject.connect(self.BackgroundColorButton,
+ QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked)
+ QtCore.QObject.connect(self.FontColorButton,
+ QtCore.SIGNAL(u'pressed()'), self.onFontColorButtonClicked)
+ QtCore.QObject.connect(self.HistoryEditPushButton,
+ QtCore.SIGNAL(u'pressed()'), self.onHistoryEditButtonClicked)
+ QtCore.QObject.connect(self.FontComboBox,
+ QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked)
+ QtCore.QObject.connect(self.LocationComboBox,
+ QtCore.SIGNAL(u'activated(int)'), self.onLocationComboBoxClicked)
+ QtCore.QObject.connect(self.TimeoutSpinBox,
+ QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)
+ QtCore.QObject.connect(self.FontSizeSpinBox,
+ QtCore.SIGNAL(u'valueChanged(int)'), self.onFontSizeSpinBoxChanged)
+
+ def retranslateUi(self):
+ self.FontGroupBox.setTitle(self.trUtf8('Font'))
+ self.FontLabel.setText(self.trUtf8('Font Name:'))
+ self.FontColorLabel.setText(self.trUtf8('Font Color:'))
+ self.BackgroundColorLabel.setText(self.trUtf8('Background Color:'))
+ self.FontSizeLabel.setText(self.trUtf8('Font Size:'))
+ self.FontSizeSpinBox.setSuffix(self.trUtf8('pt'))
+ self.TimeoutLabel.setText(self.trUtf8('Alert timeout:'))
+ self.TimeoutSpinBox.setSuffix(self.trUtf8('s'))
+ self.LocationLabel.setText(self.trUtf8('Location:'))
+ self.HistoryLabel.setText(self.trUtf8('Keep History:'))
+ self.HistoryEditLabel.setText(self.trUtf8('Edit History:'))
+ self.PreviewGroupBox.setTitle(self.trUtf8('Preview'))
+ self.FontPreview.setText(self.trUtf8('openlp.org'))
+ self.LocationComboBox.setItemText(0, self.trUtf8('Top'))
+ self.LocationComboBox.setItemText(1, self.trUtf8('Bottom'))
+
+ def onBackgroundColorButtonClicked(self):
+ self.bg_color = QtGui.QColorDialog.getColor(
+ QtGui.QColor(self.bg_color), self).name()
+ self.BackgroundColorButton.setStyleSheet(
+ u'background-color: %s' % self.bg_color)
+ self.updateDisplay()
+
+ def onFontComboBoxClicked(self):
+ self.updateDisplay()
+
+ def onLocationComboBoxClicked(self, location):
+ self.location = location
+
+ def onHistoryCheckBoxChanged(self, check_state):
+ self.save_history = False
+ # we have a set value convert to True/False
+ if check_state == QtCore.Qt.Checked:
+ self.save_history = True
+
+ def onFontColorButtonClicked(self):
+ self.font_color = QtGui.QColorDialog.getColor(
+ QtGui.QColor(self.font_color), self).name()
+ self.FontColorButton.setStyleSheet(
+ u'background-color: %s' % self.font_color)
+ self.updateDisplay()
+
+ def onTimeoutSpinBoxChanged(self):
+ self.timeout = self.TimeoutSpinBox.value()
+
+ def onFontSizeSpinBoxChanged(self):
+ self.font_size = self.FontSizeSpinBox.value()
+ self.updateDisplay()
+
+ def onHistoryEditButtonClicked(self):
+ self.parent.onAlertsEdit()
+
+ def load(self):
+ self.timeout = int(self.config.get_config(u'timeout', 5))
+ self.font_color = unicode(
+ self.config.get_config(u'font color', u'#ffffff'))
+ self.font_size = int(self.config.get_config(u'font size', 40))
+ self.bg_color = unicode(
+ self.config.get_config(u'background color', u'#660000'))
+ self.font_face = unicode(
+ self.config.get_config(u'font face', QtGui.QFont().family()))
+ self.location = int(self.config.get_config(u'location', 0))
+ self.save_history = str_to_bool(
+ self.config.get_config(u'save history', u'False'))
+ self.FontSizeSpinBox.setValue(self.font_size)
+ self.TimeoutSpinBox.setValue(self.timeout)
+ self.FontColorButton.setStyleSheet(
+ u'background-color: %s' % self.font_color)
+ self.BackgroundColorButton.setStyleSheet(
+ u'background-color: %s' % self.bg_color)
+ self.LocationComboBox.setCurrentIndex(self.location)
+ self.HistoryCheckBox.setChecked(self.save_history)
+ font = QtGui.QFont()
+ font.setFamily(self.font_face)
+ self.FontComboBox.setCurrentFont(font)
+ self.updateDisplay()
+
+ def save(self):
+ self.font_face = self.FontComboBox.currentFont().family()
+ self.config.set_config(u'background color', unicode(self.bg_color))
+ self.config.set_config(u'font color', unicode(self.font_color))
+ self.config.set_config(u'font size', unicode(self.font_size))
+ self.config.set_config(u'font face', unicode(self.font_face))
+ self.config.set_config(u'timeout', unicode(self.timeout))
+ self.config.set_config(u'location',
+ unicode(self.LocationComboBox.currentIndex()))
+ self.config.set_config(u'save history', unicode(self.save_history))
+
+ def updateDisplay(self):
+ font = QtGui.QFont()
+ font.setFamily(self.FontComboBox.currentFont().family())
+ font.setBold(True)
+ font.setPointSize(self.font_size)
+ self.FontPreview.setFont(font)
+ self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' % \
+ (self.bg_color, self.font_color))
=== added directory 'openlp/plugins/alerts/lib'
=== added file 'openlp/plugins/alerts/lib/__init__.py'
--- openlp/plugins/alerts/lib/__init__.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/lib/__init__.py 2010-02-14 20:33:16 +0000
@@ -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-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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 alertsmanager import AlertsManager
+from manager import DBManager
=== added file 'openlp/plugins/alerts/lib/alertsmanager.py'
--- openlp/plugins/alerts/lib/alertsmanager.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/lib/alertsmanager.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,95 @@
+
+import logging
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import str_to_bool, Receiver
+from openlp.core.lib import SettingsTab
+
+class AlertsManager(QtCore.QObject):
+ """
+ BiblesTab is the Bibles settings tab in the settings dialog.
+ """
+ global log
+ log = logging.getLogger(u'AlertManager')
+ log.info(u'Alert Manager loaded')
+
+ def __init__(self, parent):
+ QtCore.QObject.__init__(self)
+ self.parent = parent
+ self.timer_id = 0
+ self.alertList = []
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'alert_text'), self.displayAlert)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'screen_changed'), self.screenChanged)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'config_updated'), self.screenChanged)
+
+ def screenChanged(self):
+ log.debug(u'screen changed')
+ self.screen = self.parent.maindisplay.screen
+ self.alertTab = self.parent.alertsTab
+ self.font = QtGui.QFont()
+ self.font.setFamily(self.alertTab.font_face)
+ self.font.setBold(True)
+ self.font.setPointSize(self.alertTab.font_size)
+ self.metrics = QtGui.QFontMetrics(self.font)
+ self.alertHeight = self.metrics.height() + 4
+ if self.alertTab.location == 0:
+ self.alertScreenPosition = 0
+ else:
+ self.alertScreenPosition = self.screen[u'size'].height() - self.alertHeight
+ self.alertHeight = self.screen[u'size'].height() - self.alertScreenPosition
+ self.parent.maindisplay.setAlertSize(self.alertScreenPosition, self.alertHeight)
+
+ def displayAlert(self, text=u''):
+ """
+ Called from the Alert Tab to display an alert
+
+ ``text``
+ display text
+ """
+ log.debug(u'display alert called %s' % text)
+ self.parent.maindisplay.parent.StatusBar.showMessage(self.trUtf8(u''))
+ self.alertList.append(text)
+ if self.timer_id != 0 or self.parent.maindisplay.mediaLoaded:
+ self.parent.maindisplay.parent.StatusBar.showMessage(\
+ self.trUtf8(u'Alert message created and delayed'))
+ return
+ self.generateAlert()
+
+ def generateAlert(self):
+ log.debug(u'Generate Alert called')
+ if len(self.alertList) == 0:
+ return
+ text = self.alertList.pop(0)
+ alertTab = self.parent.alertsTab
+ alertframe = \
+ QtGui.QPixmap(self.screen[u'size'].width(), self.alertHeight)
+ alertframe.fill(QtCore.Qt.transparent)
+ painter = QtGui.QPainter(alertframe)
+ painter.fillRect(alertframe.rect(), QtCore.Qt.transparent)
+ painter.setRenderHint(QtGui.QPainter.Antialiasing)
+ painter.fillRect(
+ QtCore.QRect(
+ 0, 0, alertframe.rect().width(),
+ alertframe.rect().height()),
+ QtGui.QColor(self.alertTab.bg_color))
+ painter.setFont(self.font)
+ painter.setPen(QtGui.QColor(self.alertTab.font_color))
+ x, y = (0, 2)
+ painter.drawText(
+ x, y + self.metrics.height() - self.metrics.descent() - 1, text)
+ painter.end()
+ self.parent.maindisplay.addAlertImage(alertframe)
+ # check to see if we have a timer running
+ if self.timer_id == 0:
+ self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)
+
+ def timerEvent(self, event):
+ if event.timerId() == self.timer_id:
+ self.parent.maindisplay.addAlertImage(None, True)
+ self.killTimer(self.timer_id)
+ self.timer_id = 0
+ self.generateAlert()
=== added file 'openlp/plugins/alerts/lib/classes.py'
--- openlp/plugins/alerts/lib/classes.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/lib/classes.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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 #
+###############################################################################
+
+class BaseModel(object):
+ """
+ BaseModel provides a base object with a set of generic functions
+ """
+
+ @classmethod
+ def populate(cls, **kwargs):
+ """
+ Creates an instance of a class and populates it, returning the instance
+ """
+ me = cls()
+ keys = kwargs.keys()
+ for key in keys:
+ me.__setattr__(key, kwargs[key])
+ return me
+
+class AlertItem(BaseModel):
+ """
+ Custom Slide model
+ """
+ pass
=== added file 'openlp/plugins/alerts/lib/manager.py'
--- openlp/plugins/alerts/lib/manager.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/lib/manager.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,108 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+import logging
+
+from openlp.plugins.alerts.lib.models import init_models, metadata, AlertItem
+
+class DBManager():
+ """
+ The Song Manager provides a central location for all database code. This
+ class takes care of connecting to the database and running all the queries.
+ """
+
+ global log
+ log = logging.getLogger(u'AlertsDBManager')
+ log.info(u'Alerts DB loaded')
+
+ def __init__(self, config):
+ """
+ Creates the connection to the database, and creates the tables if they
+ don't exist.
+ """
+ self.config = config
+ log.debug(u'Alerts Initialising')
+ self.db_url = u''
+ db_type = self.config.get_config(u'db type', u'sqlite')
+ if db_type == u'sqlite':
+ self.db_url = u'sqlite:///%s/alerts.sqlite' % \
+ self.config.get_data_path()
+ else:
+ self.db_url = u'%s://%s:%s@%s/%s' % \
+ (db_type, self.config.get_config(u'db username'),
+ self.config.get_config(u'db password'),
+ self.config.get_config(u'db hostname'),
+ self.config.get_config(u'db database'))
+ self.session = init_models(self.db_url)
+ metadata.create_all(checkfirst=True)
+
+ log.debug(u'Alerts Initialised')
+
+ def get_all_alerts(self):
+ """
+ Returns the details of a Alert Show
+ """
+ return self.session.query(AlertItem).order_by(AlertItem.text).all()
+
+ def save_alert(self, AlertItem):
+ """
+ Saves a Alert show to the database
+ """
+ log.debug(u'Alert added')
+ try:
+ self.session.add(AlertItem)
+ self.session.commit()
+ log.debug(u'Alert saved')
+ return True
+ except:
+ self.session.rollback()
+ log.exception(u'Alert save failed')
+ return False
+
+ def get_alert(self, id=None):
+ """
+ Returns the details of a Alert
+ """
+ if id is None:
+ return AlertItem()
+ else:
+ return self.session.query(AlertItem).get(id)
+
+ def delete_alert(self, id):
+ """
+ Delete a Alert show
+ """
+ if id != 0:
+ AlertItem = self.get_alert(id)
+ try:
+ self.session.delete(AlertItem)
+ self.session.commit()
+ return True
+ except:
+ self.session.rollback()
+ log.exception(u'Alert deleton failed')
+ return False
+ else:
+ return True
=== added file 'openlp/plugins/alerts/lib/meta.py'
--- openlp/plugins/alerts/lib/meta.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/lib/meta.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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 sqlalchemy import MetaData
+
+__all__ = ['session', 'metadata', 'engine']
+
+# SQLAlchemy database engine. Updated by model.init_model()
+engine = None
+
+# SQLAlchemy session manager. Updated by model.init_model()
+session = None
+
+# Global metadata. If you have multiple databases with overlapping table
+# names, you'll need a metadata for each database
+metadata = MetaData()
\ No newline at end of file
=== added file 'openlp/plugins/alerts/lib/models.py'
--- openlp/plugins/alerts/lib/models.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/lib/models.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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 sqlalchemy import create_engine
+from sqlalchemy.orm import scoped_session, sessionmaker, mapper
+
+from openlp.plugins.alerts.lib.meta import metadata
+from openlp.plugins.alerts.lib.tables import *
+from openlp.plugins.alerts.lib.classes import *
+
+def init_models(url):
+ engine = create_engine(url)
+ metadata.bind = engine
+ session = scoped_session(sessionmaker(autoflush=True, autocommit=False,
+ bind=engine))
+ mapper(AlertItem, alerts_table)
+ return session
=== added file 'openlp/plugins/alerts/lib/tables.py'
--- openlp/plugins/alerts/lib/tables.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/alerts/lib/tables.py 2010-02-14 20:33:16 +0000
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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 sqlalchemy import Column, Table, types
+
+from openlp.plugins.alerts.lib.meta import metadata
+
+# Definition of the "alerts" table
+alerts_table = Table(u'alerts', metadata,
+ Column(u'id', types.Integer(), primary_key=True),
+ Column(u'text', types.UnicodeText, nullable=False))
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2009-12-31 12:52:01 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2010-02-14 20:33:16 +0000
@@ -27,8 +27,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import str_to_bool, Receiver
-from openlp.core.lib import SettingsTab
+from openlp.core.lib import str_to_bool, Receiver, SettingsTab
class BiblesTab(SettingsTab):
"""
@@ -226,4 +225,4 @@
# Not Found
id = 0
self.bible_theme = u''
- self.BibleThemeComboBox.setCurrentIndex(id)
\ No newline at end of file
+ self.BibleThemeComboBox.setCurrentIndex(id)
=== modified file 'openlp/plugins/custom/lib/manager.py'
--- openlp/plugins/custom/lib/manager.py 2009-12-31 12:52:01 +0000
+++ openlp/plugins/custom/lib/manager.py 2010-02-14 20:33:16 +0000
@@ -78,7 +78,7 @@
return True
except:
self.session.rollback()
- log.excertion(u'Custom Slide save failed')
+ log.exceptiontion(u'Custom Slide save failed')
return False
def get_custom(self, id=None):
@@ -94,7 +94,7 @@
"""
Delete a Custom slide show
"""
- if id !=0:
+ if id != 0:
customslide = self.get_custom(id)
try:
self.session.delete(customslide)
@@ -102,7 +102,7 @@
return True
except:
self.session.rollback()
- log.excertion(u'Custom Slide deleton failed')
+ log.exception(u'Custom Slide deleton failed')
return False
else:
- return True
\ No newline at end of file
+ return True
=== modified file 'openlp/plugins/custom/lib/tables.py'
--- openlp/plugins/custom/lib/tables.py 2009-12-31 12:52:01 +0000
+++ openlp/plugins/custom/lib/tables.py 2010-02-14 20:33:16 +0000
@@ -27,11 +27,11 @@
from openlp.plugins.custom.lib.meta import metadata
-# Definition of the "songs" table
+# Definition of the "custom slide" table
custom_slide_table = Table(u'custom_slide', metadata,
Column(u'id', types.Integer(), primary_key=True),
Column(u'title', types.Unicode(255), nullable=False),
Column(u'text', types.UnicodeText, nullable=False),
Column(u'credits', types.UnicodeText),
Column(u'theme_name', types.Unicode(128))
-)
\ No newline at end of file
+)
=== modified file 'openlp/plugins/songusage/forms/songusagedeleteform.py'
--- openlp/plugins/songusage/forms/songusagedeleteform.py 2010-01-28 07:15:23 +0000
+++ openlp/plugins/songusage/forms/songusagedeleteform.py 2010-02-14 20:33:16 +0000
@@ -50,7 +50,6 @@
QtGui.QMessageBox.Cancel),
QtGui.QMessageBox.Cancel)
if ret == QtGui.QMessageBox.Ok:
- qDeleteDate = self.DeleteCalendar.selectedDate()
- deleteDate = date(qDeleteDate.year(), qDeleteDate.month(), qDeleteDate.day())
+ deleteDate = self.DeleteCalendar.selectedDate().toPyDate()
self.songusagemanager.delete_to_date(deleteDate)
self.close()
=== modified file 'openlp/plugins/songusage/forms/songusagedetaildialog.py'
--- openlp/plugins/songusage/forms/songusagedetaildialog.py 2009-12-31 12:52:01 +0000
+++ openlp/plugins/songusage/forms/songusagedetaildialog.py 2010-02-14 20:33:16 +0000
@@ -1,197 +1,69 @@
# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
-# Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
+# Form implementation generated from reading ui file 'songusagedetaildialog.ui'
+#
+# Created: Tue Feb 9 07:34:05 2010
+# by: PyQt4 UI code generator 4.6.2
+#
+# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_SongUsageDetailDialog(object):
def setupUi(self, AuditDetailDialog):
- AuditDetailDialog.setObjectName(u'AuditDetailDialog')
- AuditDetailDialog.resize(593, 501)
- self.buttonBox = QtGui.QDialogButtonBox(AuditDetailDialog)
- self.buttonBox.setGeometry(QtCore.QRect(420, 470, 170, 25))
- self.buttonBox.setStandardButtons(
- QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
- self.buttonBox.setObjectName(u'buttonBox')
- self.FileGroupBox = QtGui.QGroupBox(AuditDetailDialog)
- self.FileGroupBox.setGeometry(QtCore.QRect(10, 370, 571, 70))
- self.FileGroupBox.setObjectName(u'FileGroupBox')
+ AuditDetailDialog.setObjectName("AuditDetailDialog")
+ AuditDetailDialog.resize(609, 413)
+ self.verticalLayout = QtGui.QVBoxLayout(AuditDetailDialog)
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.DateRangeGroupBox = QtGui.QGroupBox(AuditDetailDialog)
+ self.DateRangeGroupBox.setObjectName("DateRangeGroupBox")
+ self.verticalLayout_2 = QtGui.QVBoxLayout(self.DateRangeGroupBox)
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.DateHorizontalLayout = QtGui.QHBoxLayout()
+ self.DateHorizontalLayout.setObjectName("DateHorizontalLayout")
+ self.FromDate = QtGui.QCalendarWidget(self.DateRangeGroupBox)
+ self.FromDate.setObjectName("FromDate")
+ self.DateHorizontalLayout.addWidget(self.FromDate)
+ self.ToLabel = QtGui.QLabel(self.DateRangeGroupBox)
+ self.ToLabel.setScaledContents(False)
+ self.ToLabel.setAlignment(QtCore.Qt.AlignCenter)
+ self.ToLabel.setObjectName("ToLabel")
+ self.DateHorizontalLayout.addWidget(self.ToLabel)
+ self.ToDate = QtGui.QCalendarWidget(self.DateRangeGroupBox)
+ self.ToDate.setObjectName("ToDate")
+ self.DateHorizontalLayout.addWidget(self.ToDate)
+ self.verticalLayout_2.addLayout(self.DateHorizontalLayout)
+ self.FileGroupBox = QtGui.QGroupBox(self.DateRangeGroupBox)
+ self.FileGroupBox.setObjectName("FileGroupBox")
self.verticalLayout_4 = QtGui.QVBoxLayout(self.FileGroupBox)
- self.verticalLayout_4.setObjectName(u'verticalLayout_4')
+ self.verticalLayout_4.setObjectName("verticalLayout_4")
self.horizontalLayout = QtGui.QHBoxLayout()
- self.horizontalLayout.setObjectName(u'horizontalLayout')
+ self.horizontalLayout.setObjectName("horizontalLayout")
self.FileLineEdit = QtGui.QLineEdit(self.FileGroupBox)
- self.FileLineEdit.setObjectName(u'FileLineEdit')
+ self.FileLineEdit.setObjectName("FileLineEdit")
self.horizontalLayout.addWidget(self.FileLineEdit)
self.SaveFilePushButton = QtGui.QPushButton(self.FileGroupBox)
icon = QtGui.QIcon()
- icon.addPixmap(QtGui.QPixmap(u':/exports/export_load.png'),
- QtGui.QIcon.Normal, QtGui.QIcon.Off)
+ icon.addPixmap(QtGui.QPixmap(":/exports/export_load.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.SaveFilePushButton.setIcon(icon)
- self.SaveFilePushButton.setObjectName(u'SaveFilePushButton')
+ self.SaveFilePushButton.setObjectName("SaveFilePushButton")
self.horizontalLayout.addWidget(self.SaveFilePushButton)
self.verticalLayout_4.addLayout(self.horizontalLayout)
- self.layoutWidget = QtGui.QWidget(AuditDetailDialog)
- self.layoutWidget.setGeometry(QtCore.QRect(10, 10, 561, 361))
- self.layoutWidget.setObjectName(u'layoutWidget')
- self.verticalLayout_3 = QtGui.QVBoxLayout(self.layoutWidget)
- self.verticalLayout_3.setObjectName(u'verticalLayout_3')
- self.ReportTypeGroup = QtGui.QGroupBox(self.layoutWidget)
- self.ReportTypeGroup.setObjectName(u'ReportTypeGroup')
- self.layoutWidget1 = QtGui.QWidget(self.ReportTypeGroup)
- self.layoutWidget1.setGeometry(QtCore.QRect(50, 40, 481, 23))
- self.layoutWidget1.setObjectName(u'layoutWidget1')
- self.ReportHorizontalLayout = QtGui.QHBoxLayout(self.layoutWidget1)
- self.ReportHorizontalLayout.setObjectName(u'ReportHorizontalLayout')
- self.SummaryReport = QtGui.QRadioButton(self.layoutWidget1)
- self.SummaryReport.setObjectName(u'SummaryReport')
- self.ReportHorizontalLayout.addWidget(self.SummaryReport)
- self.DetailedReport = QtGui.QRadioButton(self.layoutWidget1)
- self.DetailedReport.setChecked(True)
- self.DetailedReport.setObjectName(u'DetailedReport')
- self.ReportHorizontalLayout.addWidget(self.DetailedReport)
- self.verticalLayout_3.addWidget(self.ReportTypeGroup)
- self.DateRangeGroupBox = QtGui.QGroupBox(self.layoutWidget)
- self.DateRangeGroupBox.setObjectName(u'DateRangeGroupBox')
- self.verticalLayout_2 = QtGui.QVBoxLayout(self.DateRangeGroupBox)
- self.verticalLayout_2.setObjectName(u'verticalLayout_2')
- self.DateHorizontalLayout = QtGui.QHBoxLayout()
- self.DateHorizontalLayout.setObjectName(u'DateHorizontalLayout')
- self.FromDateEdit = QtGui.QDateEdit(self.DateRangeGroupBox)
- self.FromDateEdit.setCalendarPopup(True)
- self.FromDateEdit.setObjectName(u'FromDateEdit')
- self.DateHorizontalLayout.addWidget(self.FromDateEdit)
- self.To = QtGui.QLabel(self.DateRangeGroupBox)
- self.To.setObjectName(u'To')
- self.DateHorizontalLayout.addWidget(self.To)
- self.ToDateEdit = QtGui.QDateEdit(self.DateRangeGroupBox)
- self.ToDateEdit.setCalendarPopup(True)
- self.ToDateEdit.setObjectName(u'ToDateEdit')
- self.DateHorizontalLayout.addWidget(self.ToDateEdit)
- self.verticalLayout_2.addLayout(self.DateHorizontalLayout)
- self.verticalLayout_3.addWidget(self.DateRangeGroupBox)
- self.TimePeriodGroupBox = QtGui.QGroupBox(self.layoutWidget)
- self.TimePeriodGroupBox.setObjectName(u'TimePeriodGroupBox')
- self.verticalLayout = QtGui.QVBoxLayout(self.TimePeriodGroupBox)
- self.verticalLayout.setObjectName(u'verticalLayout')
- self.FirstHorizontalLayout = QtGui.QHBoxLayout()
- self.FirstHorizontalLayout.setObjectName(u'FirstHorizontalLayout')
- self.FirstCheckBox = QtGui.QCheckBox(self.TimePeriodGroupBox)
- self.FirstCheckBox.setChecked(True)
- self.FirstCheckBox.setObjectName(u'FirstCheckBox')
- self.FirstHorizontalLayout.addWidget(self.FirstCheckBox)
- self.FirstFromTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
- self.FirstFromTimeEdit.setTime(QtCore.QTime(9, 0, 0))
- self.FirstFromTimeEdit.setObjectName(u'FirstFromTimeEdit')
- self.FirstHorizontalLayout.addWidget(self.FirstFromTimeEdit)
- self.FirstTo = QtGui.QLabel(self.TimePeriodGroupBox)
- self.FirstTo.setObjectName(u'FirstTo')
- self.FirstHorizontalLayout.addWidget(self.FirstTo)
- self.FirstToTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
- self.FirstToTimeEdit.setCalendarPopup(True)
- self.FirstToTimeEdit.setTime(QtCore.QTime(10, 0, 0))
- self.FirstToTimeEdit.setObjectName(u'FirstToTimeEdit')
- self.FirstHorizontalLayout.addWidget(self.FirstToTimeEdit)
- self.verticalLayout.addLayout(self.FirstHorizontalLayout)
- self.SecondHorizontalLayout = QtGui.QHBoxLayout()
- self.SecondHorizontalLayout.setObjectName(u'SecondHorizontalLayout')
- self.SecondCheckBox = QtGui.QCheckBox(self.TimePeriodGroupBox)
- self.SecondCheckBox.setChecked(True)
- self.SecondCheckBox.setObjectName(u'SecondCheckBox')
- self.SecondHorizontalLayout.addWidget(self.SecondCheckBox)
- self.SecondFromTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
- self.SecondFromTimeEdit.setTime(QtCore.QTime(10, 45, 0))
- self.SecondFromTimeEdit.setObjectName(u'SecondFromTimeEdit')
- self.SecondHorizontalLayout.addWidget(self.SecondFromTimeEdit)
- self.SecondTo = QtGui.QLabel(self.TimePeriodGroupBox)
- self.SecondTo.setObjectName(u'SecondTo')
- self.SecondHorizontalLayout.addWidget(self.SecondTo)
- self.SecondToTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
- self.SecondToTimeEdit.setObjectName(u'SecondToTimeEdit')
- self.SecondHorizontalLayout.addWidget(self.SecondToTimeEdit)
- self.verticalLayout.addLayout(self.SecondHorizontalLayout)
- self.ThirdHorizontalLayout = QtGui.QHBoxLayout()
- self.ThirdHorizontalLayout.setObjectName(u'ThirdHorizontalLayout')
- self.ThirdCheckBox = QtGui.QCheckBox(self.TimePeriodGroupBox)
- self.ThirdCheckBox.setChecked(True)
- self.ThirdCheckBox.setObjectName(u'ThirdCheckBox')
- self.ThirdHorizontalLayout.addWidget(self.ThirdCheckBox)
- self.ThirdFromTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
- self.ThirdFromTimeEdit.setTime(QtCore.QTime(18, 30, 0))
- self.ThirdFromTimeEdit.setObjectName(u'ThirdFromTimeEdit')
- self.ThirdHorizontalLayout.addWidget(self.ThirdFromTimeEdit)
- self.ThirdTo = QtGui.QLabel(self.TimePeriodGroupBox)
- self.ThirdTo.setObjectName(u'ThirdTo')
- self.ThirdHorizontalLayout.addWidget(self.ThirdTo)
- self.ThirdToTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
- self.ThirdToTimeEdit.setTime(QtCore.QTime(19, 30, 0))
- self.ThirdToTimeEdit.setObjectName(u'ThirdToTimeEdit')
- self.ThirdHorizontalLayout.addWidget(self.ThirdToTimeEdit)
- self.verticalLayout.addLayout(self.ThirdHorizontalLayout)
- self.verticalLayout_3.addWidget(self.TimePeriodGroupBox)
+ self.verticalLayout_2.addWidget(self.FileGroupBox)
+ self.verticalLayout.addWidget(self.DateRangeGroupBox)
+ self.buttonBox = QtGui.QDialogButtonBox(AuditDetailDialog)
+ self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
+ self.buttonBox.setObjectName("buttonBox")
+ self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(AuditDetailDialog)
- QtCore.QObject.connect(
- self.buttonBox, QtCore.SIGNAL(u'accepted()'),
- AuditDetailDialog.accept)
- QtCore.QObject.connect(
- self.buttonBox, QtCore.SIGNAL(u'rejected()'),
- AuditDetailDialog.close)
- QtCore.QObject.connect(
- self.FirstCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- AuditDetailDialog.changeFirstService)
- QtCore.QObject.connect(
- self.SecondCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- AuditDetailDialog.changeSecondService)
- QtCore.QObject.connect(
- self.ThirdCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
- AuditDetailDialog.changeThirdService)
- QtCore.QObject.connect(
- self.SaveFilePushButton, QtCore.SIGNAL(u'pressed()'),
- AuditDetailDialog.defineOutputLocation)
+ QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), AuditDetailDialog.accept)
+ QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), AuditDetailDialog.close)
+ QtCore.QObject.connect(self.SaveFilePushButton, QtCore.SIGNAL("pressed()"), AuditDetailDialog.defineOutputLocation)
QtCore.QMetaObject.connectSlotsByName(AuditDetailDialog)
def retranslateUi(self, AuditDetailDialog):
- AuditDetailDialog.setWindowTitle(self.trUtf8('Audit Detail Extraction'))
- self.FileGroupBox.setTitle(self.trUtf8('Report Location'))
- self.ReportTypeGroup.setTitle(self.trUtf8('Report Type'))
- self.SummaryReport.setText(self.trUtf8('Summary'))
- self.DetailedReport.setText(self.trUtf8('Detailed'))
- self.DateRangeGroupBox.setTitle(self.trUtf8('Select Date Range'))
- self.FromDateEdit.setDisplayFormat(self.trUtf8('dd/MM/yyyy'))
- self.To.setText(self.trUtf8('to'))
- self.ToDateEdit.setDisplayFormat(self.trUtf8('dd/MM/yyyy'))
- self.TimePeriodGroupBox.setTitle(self.trUtf8('Select Time Periods'))
- self.FirstCheckBox.setText(self.trUtf8('First Service'))
- self.FirstFromTimeEdit.setDisplayFormat(self.trUtf8('hh:mm AP'))
- self.FirstTo.setText(self.trUtf8('to'))
- self.FirstToTimeEdit.setDisplayFormat(self.trUtf8('hh:mm AP'))
- self.SecondCheckBox.setText(self.trUtf8('Second Service'))
- self.SecondFromTimeEdit.setDisplayFormat(self.trUtf8('hh:mm AP'))
- self.SecondTo.setText(self.trUtf8('to'))
- self.SecondToTimeEdit.setDisplayFormat(self.trUtf8('hh:mm AP'))
- self.ThirdCheckBox.setText(self.trUtf8('Third Service'))
- self.ThirdFromTimeEdit.setDisplayFormat(self.trUtf8('hh:mm AP'))
- self.ThirdTo.setText(self.trUtf8('to'))
- self.ThirdToTimeEdit.setDisplayFormat(self.trUtf8('hh:mm AP'))
\ No newline at end of file
+ AuditDetailDialog.setWindowTitle(QtGui.QApplication.translate("AuditDetailDialog", "Audit Detail Extraction", None, QtGui.QApplication.UnicodeUTF8))
+ self.DateRangeGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Select Date Range", None, QtGui.QApplication.UnicodeUTF8))
+ self.ToLabel.setText(QtGui.QApplication.translate("AuditDetailDialog", "to", None, QtGui.QApplication.UnicodeUTF8))
+ self.FileGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Report Location", None, QtGui.QApplication.UnicodeUTF8))
=== modified file 'openlp/plugins/songusage/forms/songusagedetailform.py'
--- openlp/plugins/songusage/forms/songusagedetailform.py 2010-01-28 07:15:23 +0000
+++ openlp/plugins/songusage/forms/songusagedetailform.py 2010-02-14 20:33:16 +0000
@@ -45,33 +45,14 @@
self.setupUi(self)
def initialise(self):
- self.FirstCheckBox.setCheckState(
- int(self.parent.config.get_config(u'first service', QtCore.Qt.Checked)))
- self.SecondCheckBox.setCheckState(
- int(self.parent.config.get_config(u'second service', QtCore.Qt.Checked)))
- self.ThirdCheckBox.setCheckState(
- int(self.parent.config.get_config(u'third service', QtCore.Qt.Checked)))
year = QtCore.QDate().currentDate().year()
if QtCore.QDate().currentDate().month() < 9:
year -= 1
toDate = QtCore.QDate(year, 8, 31)
fromDate = QtCore.QDate(year - 1, 9, 1)
- self.FromDateEdit.setDate(fromDate)
- self.ToDateEdit.setDate(toDate)
+ self.FromDate.setSelectedDate(fromDate)
+ self.ToDate.setSelectedDate(toDate)
self.FileLineEdit.setText(self.parent.config.get_last_dir(1))
- self.resetWindow()
-
- def changeFirstService(self, value):
- self.parent.config.set_config(u'first service', value)
- self.resetWindow()
-
- def changeSecondService(self, value):
- self.parent.config.set_config(u'second service', value)
- self.resetWindow()
-
- def changeThirdService(self, value):
- self.parent.config.set_config(u'third service', value)
- self.resetWindow()
def defineOutputLocation(self):
path = QtGui.QFileDialog.getExistingDirectory(self,
@@ -82,39 +63,14 @@
self.parent.config.set_last_dir(path, 1)
self.FileLineEdit.setText(path)
- def resetWindow(self):
- if self.FirstCheckBox.checkState() == QtCore.Qt.Unchecked:
- self.FirstFromTimeEdit.setEnabled(False)
- self.FirstToTimeEdit.setEnabled(False)
- else:
- self.FirstFromTimeEdit.setEnabled(True)
- self.FirstToTimeEdit.setEnabled(True)
- if self.SecondCheckBox.checkState() == QtCore.Qt.Unchecked:
- self.SecondFromTimeEdit.setEnabled(False)
- self.SecondToTimeEdit.setEnabled(False)
- else:
- self.SecondFromTimeEdit.setEnabled(True)
- self.SecondToTimeEdit.setEnabled(True)
- if self.ThirdCheckBox.checkState() == QtCore.Qt.Unchecked:
- self.ThirdFromTimeEdit.setEnabled(False)
- self.ThirdToTimeEdit.setEnabled(False)
- else:
- self.ThirdFromTimeEdit.setEnabled(True)
- self.ThirdToTimeEdit.setEnabled(True)
-
def accept(self):
- if self.DetailedReport.isChecked():
- self.detailedReport()
- else:
- self.summaryReport()
- self.close()
-
- def detailedReport(self):
log.debug(u'Detailed report generated')
filename = u'usage_detail_%s_%s.txt' % \
- (self.FromDateEdit.date().toString(u'ddMMyyyy'),
- self.ToDateEdit.date().toString(u'ddMMyyyy'))
- usage = self.parent.songusagemanager.get_all_songusage()
+ (self.FromDate.selectedDate().toString(u'ddMMyyyy'),
+ self.ToDate.selectedDate().toString(u'ddMMyyyy'))
+ usage = self.parent.songusagemanager.get_all_songusage(\
+ self.FromDate.selectedDate(), \
+ self.ToDate.selectedDate())
outname = os.path.join(unicode(self.FileLineEdit.text()), filename)
file = None
try:
@@ -130,8 +86,3 @@
if file:
file.close()
- def summaryReport(self):
- log.debug(u'Summary report generated')
- filename = u'audit_sum_%s_%s.txt' % \
- (self.FromDateEdit.date().toString(u'ddMMyyyy'),
- self.ToDateEdit.date().toString(u'ddMMyyyy'))
=== modified file 'openlp/plugins/songusage/lib/manager.py'
--- openlp/plugins/songusage/lib/manager.py 2009-12-31 12:52:01 +0000
+++ openlp/plugins/songusage/lib/manager.py 2010-02-14 20:33:16 +0000
@@ -60,12 +60,14 @@
log.debug(u'SongUsage Initialised')
- def get_all_songusage(self):
+ def get_all_songusage(self, start_date, end_date):
"""
Returns the details of SongUsage
"""
- return self.session.query(SongUsageItem).\
- order_by(SongUsageItem.usagedate, SongUsageItem.usagetime ).all()
+ return self.session.query(SongUsageItem) \
+ .filter(SongUsageItem.usagedate >= start_date.toPyDate()) \
+ .filter(SongUsageItem.usagedate < end_date.toPyDate()) \
+ .order_by(SongUsageItem.usagedate, SongUsageItem.usagetime ).all()
def insert_songusage(self, songusageitem):
"""
@@ -94,7 +96,7 @@
"""
Delete a SongUsage record
"""
- if id !=0:
+ if id != 0:
songusageitem = self.get_songusage(id)
try:
self.session.delete(songusageitem)
@@ -133,4 +135,4 @@
except:
self.session.rollback()
log.exception(u'Failed to delete all Song Usage items to %s' % date)
- return False
\ No newline at end of file
+ return False
=== renamed file 'resources/forms/alertform.ui' => 'resources/forms/alertdialog.ui'
--- resources/forms/alertform.ui 2008-11-27 20:14:38 +0000
+++ resources/forms/alertdialog.ui 2010-02-14 20:33:16 +0000
@@ -1,108 +1,95 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>AlertForm</class>
- <widget class="QWidget" name="AlertForm" >
- <property name="geometry" >
+ <widget class="QWidget" name="AlertForm">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>370</width>
- <height>105</height>
+ <width>430</width>
+ <height>320</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Alert Message</string>
</property>
- <property name="windowIcon" >
- <iconset resource="../images/openlp-2.qrc" >
+ <property name="windowIcon">
+ <iconset>
<normaloff>:/icon/openlp.org-icon-32.bmp</normaloff>:/icon/openlp.org-icon-32.bmp</iconset>
</property>
- <layout class="QVBoxLayout" name="AlertFormLayout" >
- <property name="spacing" >
- <number>8</number>
- </property>
- <property name="margin" >
- <number>8</number>
- </property>
- <item>
- <widget class="QWidget" native="1" name="AlertEntryWidget" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <widget class="QLabel" name="AlertEntryLabel" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>353</width>
- <height>16</height>
- </rect>
- </property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Alert Text:</string>
- </property>
- </widget>
- <widget class="QLineEdit" name="AlertEntryEditItem" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>20</y>
- <width>353</width>
- <height>21</height>
- </rect>
- </property>
- </widget>
- </widget>
- </item>
- <item>
- <widget class="QWidget" native="1" name="ButtonBoxWidget" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout" >
- <property name="spacing" >
- <number>8</number>
- </property>
- <property name="margin" >
- <number>0</number>
- </property>
- <item>
- <spacer name="ButtonBoxWidgetSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>267</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="DisplayButton" >
- <property name="text" >
- <string>Display</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="CancelButton" >
- <property name="text" >
- <string>Cancel</string>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="AlertFormLayout">
+ <property name="spacing">
+ <number>8</number>
+ </property>
+ <property name="margin">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QWidget" name="AlertEntryWidget" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="AlertEntryLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Alert Text:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="AlertEntryEditItem"/>
+ </item>
+ <item>
+ <widget class="QListWidget" name="AlertListWidget">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="ButtonBoxWidgetSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>181</width>
+ <height>38</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="DisplayButton">
+ <property name="text">
+ <string>Display</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="CancelButton">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>
@@ -110,7 +97,7 @@
</layout>
</widget>
<resources>
- <include location="../images/openlp-2.qrc" />
+ <include location="../images/openlp-2.qrc"/>
</resources>
<connections>
<connection>
@@ -119,11 +106,11 @@
<receiver>AlertForm</receiver>
<slot>close()</slot>
<hints>
- <hint type="sourcelabel" >
+ <hint type="sourcelabel">
<x>294</x>
<y>66</y>
</hint>
- <hint type="destinationlabel" >
+ <hint type="destinationlabel">
<x>257</x>
<y>3</y>
</hint>
=== added file 'resources/forms/alerteditdialog.ui'
--- resources/forms/alerteditdialog.ui 1970-01-01 00:00:00 +0000
+++ resources/forms/alerteditdialog.ui 2010-02-14 20:33:16 +0000
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AlertEditDialog</class>
+ <widget class="QWidget" name="AlertEditDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Maintain Alerts</string>
+ </property>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="geometry">
+ <rect>
+ <x>220</x>
+ <y>270</y>
+ <width>173</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel</set>
+ </property>
+ </widget>
+ <widget class="QWidget" name="layoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>10</y>
+ <width>361</width>
+ <height>251</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLineEdit" name="AlertLineEdit"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QListWidget" name="AlertListWidget">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QPushButton" name="SaveButton">
+ <property name="text">
+ <string>Save</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="ClearButton">
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="AddButton">
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="EdirButton">
+ <property name="text">
+ <string>Edit</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="DeleteButton">
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
=== renamed file 'resources/forms/auditdeletedialog.ui' => 'resources/forms/songusagedeletedialog.ui'
=== renamed file 'resources/forms/auditdetaildialog.ui' => 'resources/forms/songusagedetaildialog.ui'
--- resources/forms/auditdetaildialog.ui 2009-10-11 11:08:47 +0000
+++ resources/forms/songusagedetaildialog.ui 2010-02-14 20:33:16 +0000
@@ -6,299 +6,81 @@
<rect>
<x>0</x>
<y>0</y>
- <width>593</width>
- <height>501</height>
+ <width>609</width>
+ <height>413</height>
</rect>
</property>
<property name="windowTitle">
<string>Audit Detail Extraction</string>
</property>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="geometry">
- <rect>
- <x>420</x>
- <y>470</y>
- <width>170</width>
- <height>25</height>
- </rect>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- <widget class="QGroupBox" name="FileGroupBox">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>370</y>
- <width>571</width>
- <height>70</height>
- </rect>
- </property>
- <property name="title">
- <string>Report Location</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="DateRangeGroupBox">
+ <property name="title">
+ <string>Select Date Range</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QLineEdit" name="FileLineEdit"/>
+ <layout class="QHBoxLayout" name="DateHorizontalLayout">
+ <item>
+ <widget class="QCalendarWidget" name="FromDate"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="ToLabel">
+ <property name="text">
+ <string>to</string>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCalendarWidget" name="ToDate"/>
+ </item>
+ </layout>
</item>
<item>
- <widget class="QPushButton" name="SaveFilePushButton">
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../images/openlp-2.qrc">
- <normaloff>:/exports/export_load.png</normaloff>:/exports/export_load.png</iconset>
- </property>
+ <widget class="QGroupBox" name="FileGroupBox">
+ <property name="title">
+ <string>Report Location</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLineEdit" name="FileLineEdit"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="SaveFilePushButton">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../images/openlp-2.qrc">
+ <normaloff>:/exports/export_load.png</normaloff>:/exports/export_load.png</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
</item>
</layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="layoutWidget">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>10</y>
- <width>561</width>
- <height>361</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QGroupBox" name="ReportTypeGroup">
- <property name="title">
- <string>Report Type</string>
- </property>
- <widget class="QWidget" name="layoutWidget">
- <property name="geometry">
- <rect>
- <x>50</x>
- <y>40</y>
- <width>481</width>
- <height>23</height>
- </rect>
- </property>
- <layout class="QHBoxLayout" name="ReportHorizontalLayout">
- <item>
- <widget class="QRadioButton" name="SummaryReport">
- <property name="text">
- <string>Summary</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="DetailedReport">
- <property name="text">
- <string>Detailed</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="DateRangeGroupBox">
- <property name="title">
- <string>Select Date Range</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="DateHorizontalLayout">
- <item>
- <widget class="QDateEdit" name="FromDateEdit">
- <property name="displayFormat">
- <string>dd/MM/yyyy</string>
- </property>
- <property name="calendarPopup">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="To">
- <property name="text">
- <string>to</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDateEdit" name="ToDateEdit">
- <property name="displayFormat">
- <string>dd/MM/yyyy</string>
- </property>
- <property name="calendarPopup">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="TimePeriodGroupBox">
- <property name="title">
- <string>Select Time Periods</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="FirstHorizontalLayout">
- <item>
- <widget class="QCheckBox" name="FirstCheckBox">
- <property name="text">
- <string>First Service</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTimeEdit" name="FirstFromTimeEdit">
- <property name="displayFormat">
- <string>hh:mm AP</string>
- </property>
- <property name="time">
- <time>
- <hour>9</hour>
- <minute>0</minute>
- <second>0</second>
- </time>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="FirstTo">
- <property name="text">
- <string>to</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTimeEdit" name="FirstToTimeEdit">
- <property name="displayFormat">
- <string>hh:mm AP</string>
- </property>
- <property name="calendarPopup">
- <bool>true</bool>
- </property>
- <property name="time">
- <time>
- <hour>10</hour>
- <minute>0</minute>
- <second>0</second>
- </time>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="SecondHorizontalLayout">
- <item>
- <widget class="QCheckBox" name="SecondCheckBox">
- <property name="text">
- <string>Second Service</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTimeEdit" name="SecondFromTimeEdit">
- <property name="displayFormat">
- <string>hh:mm AP</string>
- </property>
- <property name="time">
- <time>
- <hour>10</hour>
- <minute>45</minute>
- <second>0</second>
- </time>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="SecondTo">
- <property name="text">
- <string>to</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTimeEdit" name="SecondToTimeEdit">
- <property name="displayFormat">
- <string>hh:mm AP</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="ThirdHorizontalLayout">
- <item>
- <widget class="QCheckBox" name="ThirdCheckBox">
- <property name="text">
- <string>Third Service</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTimeEdit" name="ThirdFromTimeEdit">
- <property name="displayFormat">
- <string>hh:mm AP</string>
- </property>
- <property name="time">
- <time>
- <hour>18</hour>
- <minute>30</minute>
- <second>0</second>
- </time>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="ThirdTo">
- <property name="text">
- <string>to</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTimeEdit" name="ThirdToTimeEdit">
- <property name="displayFormat">
- <string>hh:mm AP</string>
- </property>
- <property name="time">
- <time>
- <hour>19</hour>
- <minute>30</minute>
- <second>0</second>
- </time>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
<resources>
<include location="../images/openlp-2.qrc"/>
@@ -337,54 +119,6 @@
</hints>
</connection>
<connection>
- <sender>FirstCheckBox</sender>
- <signal>stateChanged(int)</signal>
- <receiver>AuditDetailDialog</receiver>
- <slot>changeFirstService(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>26</x>
- <y>285</y>
- </hint>
- <hint type="destinationlabel">
- <x>136</x>
- <y>483</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>SecondCheckBox</sender>
- <signal>stateChanged(int)</signal>
- <receiver>AuditDetailDialog</receiver>
- <slot>changeSecondService(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>41</x>
- <y>323</y>
- </hint>
- <hint type="destinationlabel">
- <x>103</x>
- <y>494</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>ThirdCheckBox</sender>
- <signal>stateChanged(int)</signal>
- <receiver>AuditDetailDialog</receiver>
- <slot>changeThirdService(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>38</x>
- <y>351</y>
- </hint>
- <hint type="destinationlabel">
- <x>155</x>
- <y>463</y>
- </hint>
- </hints>
- </connection>
- <connection>
<sender>SaveFilePushButton</sender>
<signal>pressed()</signal>
<receiver>AuditDetailDialog</receiver>
Follow ups