diff --git a/.bzrignore b/.bzrignore
index 7bea0adb9..e7b399b49 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -10,3 +10,5 @@ openlp.org 2.0.e4*
documentation/build/html
documentation/build/doctrees
*.log*
+dist
+OpenLP.egg-info
diff --git a/openlp.pyw b/openlp.pyw
index d35591a1c..5c18486b6 100755
--- a/openlp.pyw
+++ b/openlp.pyw
@@ -35,7 +35,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, str_to_bool
from openlp.core.resources import qInitResources
from openlp.core.ui import MainWindow, SplashScreen, ScreenList
-from openlp.core.utils import ConfigHelper
+from openlp.core.utils import get_config_directory, ConfigHelper
log = logging.getLogger()
@@ -158,7 +158,7 @@ def main():
parser.add_option("-s", "--style", dest="style",
help="Set the Qt4 style (passed directly to Qt4).")
# Set up logging
- filename = u'openlp.log'
+ filename = os.path.join(get_config_directory(), u'openlp.log')
logfile = FileHandler(filename, u'w')
logfile.setFormatter(logging.Formatter(
u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py
index 598c594fd..ca291d578 100644
--- a/openlp/core/lib/plugin.py
+++ b/openlp/core/lib/plugin.py
@@ -127,6 +127,7 @@ class Plugin(QtCore.QObject):
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 @@ class Plugin(QtCore.QObject):
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)
diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py
index 4d4da144a..b06f23953 100644
--- a/openlp/core/lib/pluginmanager.py
+++ b/openlp/core/lib/pluginmanager.py
@@ -101,7 +101,7 @@ class PluginManager(object):
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():
diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py
index 600a029c0..1e8363228 100644
--- a/openlp/core/lib/rendermanager.py
+++ b/openlp/core/lib/rendermanager.py
@@ -25,10 +25,10 @@
import logging
-from PyQt4 import QtGui, QtCore
+from PyQt4 import QtCore
from renderer import Renderer
-from openlp.core.lib import ThemeLevel, resize_image
+from openlp.core.lib import ThemeLevel
class RenderManager(object):
"""
diff --git a/openlp/core/theme/theme.py b/openlp/core/theme/theme.py
index 92ffbfed2..27969c9d9 100644
--- a/openlp/core/theme/theme.py
+++ b/openlp/core/theme/theme.py
@@ -30,7 +30,7 @@ from PyQt4 import QtGui
DelphiColors={"clRed":0xFF0000,
"clBlue":0x0000FF,
- "clYellow":0x0FFFF00,
+ "clYellow":0xFFFF00,
"clBlack":0x000000,
"clWhite":0xFFFFFF}
@@ -113,6 +113,7 @@ class Theme(object):
root = ElementTree(element=XML(xml))
iter = root.getiterator()
for element in iter:
+ delphiColorChange = False
if element.tag != u'Theme':
t = element.text
val = 0
@@ -128,6 +129,7 @@ class Theme(object):
pass
elif DelphiColors.has_key(t):
val = DelphiColors[t]
+ delphiColorChange = True
else:
try:
val = int(t)
@@ -136,7 +138,10 @@ class Theme(object):
if (element.tag.find(u'Color') > 0 or
(element.tag.find(u'BackgroundParameter') == 0 and type(val) == type(0))):
# convert to a wx.Colour
- val = QtGui.QColor((val>>16) & 0xFF, (val>>8)&0xFF, val&0xFF)
+ if not delphiColorChange:
+ val = QtGui.QColor(val&0xFF, (val>>8)&0xFF, (val>>16)&0xFF)
+ else:
+ val = QtGui.QColor((val>>16)&0xFF, (val>>8)&0xFF, val&0xFF)
setattr(self, element.tag, val)
def __str__(self):
diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py
index 5d4c798d8..6e37afc7f 100644
--- a/openlp/core/ui/__init__.py
+++ b/openlp/core/ui/__init__.py
@@ -28,11 +28,9 @@ from maindisplay import MainDisplay
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
diff --git a/openlp/core/ui/aboutform.py b/openlp/core/ui/aboutform.py
index d6a97e2c9..c3eb7bdcb 100644
--- a/openlp/core/ui/aboutform.py
+++ b/openlp/core/ui/aboutform.py
@@ -25,7 +25,6 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import build_icon
from aboutdialog import Ui_AboutDialog
class AboutForm(QtGui.QDialog, Ui_AboutDialog):
diff --git a/openlp/core/ui/alertform.py b/openlp/core/ui/alertform.py
deleted file mode 100644
index beae62a53..000000000
--- a/openlp/core/ui/alertform.py
+++ /dev/null
@@ -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()))
diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py
index bf0e11cb3..bdb396498 100644
--- a/openlp/core/ui/maindisplay.py
+++ b/openlp/core/ui/maindisplay.py
@@ -25,7 +25,6 @@
import logging
import os
-import time
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
@@ -114,14 +113,10 @@ class MainDisplay(DisplayWidget):
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(),
@@ -147,11 +142,7 @@ class MainDisplay(DisplayWidget):
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 +185,7 @@ class MainDisplay(DisplayWidget):
else:
self.setVisible(False)
self.primary = True
+ Receiver.send_message(u'screen_changed')
def resetDisplay(self):
if self.primary:
@@ -210,7 +202,7 @@ class MainDisplay(DisplayWidget):
if not self.primary:
self.setVisible(True)
self.showFullScreen()
- self.generateAlert()
+ Receiver.send_message(u'flush_alert')
def addImageWithText(self, frame):
frame = resize_image(frame,
@@ -218,6 +210,17 @@ class MainDisplay(DisplayWidget):
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 +260,6 @@ class MainDisplay(DisplayWidget):
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()
diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py
index 36f427d13..df66d5e97 100644
--- a/openlp/core/ui/mainwindow.py
+++ b/openlp/core/ui/mainwindow.py
@@ -29,7 +29,7 @@ import time
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 @@ class Ui_MainWindow(object):
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 @@ class Ui_MainWindow(object):
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 @@ class Ui_MainWindow(object):
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 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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
diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py
index b96e47f97..59737420e 100644
--- a/openlp/core/ui/servicemanager.py
+++ b/openlp/core/ui/servicemanager.py
@@ -30,8 +30,8 @@ import zipfile
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
- ServiceItemType, contextMenuAction, contextMenuSeparator, contextMenu, \
- Receiver, contextMenu, str_to_bool
+ contextMenuAction, contextMenuSeparator, contextMenu, Receiver, \
+ contextMenu, str_to_bool
class ServiceManagerList(QtGui.QTreeWidget):
diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py
index ed5bd9d76..c8989625d 100644
--- a/openlp/core/ui/settingsform.py
+++ b/openlp/core/ui/settingsform.py
@@ -27,7 +27,7 @@ import logging
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 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
# 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 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
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()
diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py
index 0bf005891..577021418 100644
--- a/openlp/core/ui/thememanager.py
+++ b/openlp/core/ui/thememanager.py
@@ -34,8 +34,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.ui import AmendThemeForm
from openlp.core.theme import Theme
from openlp.core.lib import PluginConfig, OpenLPToolbar, contextMenuAction, \
- ThemeXML, ThemeLevel, str_to_bool, get_text_file_string, build_icon, \
- Receiver, contextMenuSeparator
+ ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \
+ contextMenuSeparator
from openlp.core.utils import ConfigHelper
class ThemeManager(QtGui.QWidget):
@@ -236,7 +236,7 @@ class ThemeManager(QtGui.QWidget):
log.info(u'New Themes %s', unicode(files))
if len(files) > 0:
for file in files:
- self.config.set_last_dir(filename)
+ self.config.set_last_dir(unicode(file))
self.unzipTheme(file, self.path)
self.loadThemes()
@@ -313,17 +313,23 @@ class ThemeManager(QtGui.QWidget):
filexml = None
themename = None
for file in zip.namelist():
- if file.endswith(os.path.sep):
- theme_dir = os.path.join(dir, file)
+ osfile = unicode(QtCore.QDir.toNativeSeparators(file))
+ theme_dir = None
+ if osfile.endswith(os.path.sep):
+ theme_dir = os.path.join(dir, osfile)
if not os.path.exists(theme_dir):
- os.mkdir(os.path.join(dir, file))
+ os.mkdir(os.path.join(dir, osfile))
else:
- fullpath = os.path.join(dir, file)
- names = file.split(os.path.sep)
+ fullpath = os.path.join(dir, osfile)
+ names = osfile.split(os.path.sep)
if len(names) > 1:
# not preview file
if themename is None:
themename = names[0]
+ if theme_dir is None:
+ theme_dir = os.path.join(dir, names[0])
+ if not os.path.exists(theme_dir):
+ os.mkdir(os.path.join(dir, names[0]))
xml_data = zip.read(file)
if os.path.splitext(file)[1].lower() in [u'.xml']:
if self.checkVersion1(xml_data):
@@ -335,7 +341,7 @@ class ThemeManager(QtGui.QWidget):
outfile = open(fullpath, u'w')
outfile.write(filexml)
else:
- outfile = open(fullpath, u'w')
+ outfile = open(fullpath, u'wb')
outfile.write(zip.read(file))
self.generateAndSaveImage(dir, themename, filexml)
except:
@@ -343,7 +349,7 @@ class ThemeManager(QtGui.QWidget):
self, self.trUtf8('Error'),
self.trUtf8('File is not a valid theme!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
- log.exception(u'Importing theme from zip file failed')
+ log.exception(u'Importing theme from zip file failed %s' % filename)
finally:
if zip:
zip.close()
@@ -384,7 +390,6 @@ class ThemeManager(QtGui.QWidget):
unicode(theme.BackgroundParameter2.name()), direction)
else:
newtheme.add_background_image(unicode(theme.BackgroundParameter1))
-
newtheme.add_font(unicode(theme.FontName),
unicode(theme.FontColor.name()),
unicode(theme.FontProportion * 3), u'False')
@@ -397,10 +402,15 @@ class ThemeManager(QtGui.QWidget):
shadow = True
if theme.Outline == 1:
outline = True
+ vAlignCorrection = 0
+ if theme.VerticalAlign == 2:
+ vAlignCorrection = 1
+ elif theme.VerticalAlign == 1:
+ vAlignCorrection = 2
newtheme.add_display(unicode(shadow), unicode(theme.ShadowColor.name()),
unicode(outline), unicode(theme.OutlineColor.name()),
- unicode(theme.HorizontalAlign), unicode(theme.VerticalAlign),
- unicode(theme.WrapStyle), 0)
+ unicode(theme.HorizontalAlign), unicode(vAlignCorrection),
+ unicode(theme.WrapStyle), unicode(0))
return newtheme.extract_xml()
def saveTheme(self, name, theme_xml, theme_pretty_xml, image_from,
diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py
index 9504c771e..e85b2d939 100644
--- a/openlp/core/utils/__init__.py
+++ b/openlp/core/utils/__init__.py
@@ -22,17 +22,12 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
+
+import os
import logging
import urllib2
from datetime import datetime
-from registry import Registry
-from confighelper import ConfigHelper
-
-log = logging.getLogger(__name__)
-
-__all__ = ['Registry', 'ConfigHelper']
-
log = logging.getLogger(__name__)
def check_latest_version(config, current_version):
@@ -54,3 +49,40 @@ def check_latest_version(config, current_version):
if hasattr(e, u'reason'):
log.exception(u'Reason for failure: %s', e.reason)
return version_string
+
+def get_config_directory():
+ path = u''
+ if os.name == u'nt':
+ path = os.path.join(os.getenv(u'APPDATA'), u'openlp')
+ elif os.name == u'mac':
+ path = os.path.join(os.getenv(u'HOME'), u'Library',
+ u'Application Support', u'openlp')
+ else:
+ try:
+ from xdg import BaseDirectory
+ path = os.path.join(BaseDirectory.xdg_config_home, u'openlp')
+ except ImportError:
+ path = os.path.join(os.getenv(u'HOME'), u'.openlp')
+ return path
+
+def get_data_directory():
+ path = u''
+ if os.name == u'nt':
+ # ask OS for path to application data, set on Windows XP and Vista
+ path = os.path.join(os.getenv(u'APPDATA'), u'openlp', u'data')
+ elif os.name == u'mac':
+ path = os.path.join(os.getenv(u'HOME'), u'Library',
+ u'Application Support', u'openlp', u'Data')
+ else:
+ try:
+ from xdg import BaseDirectory
+ path = os.path.join(BaseDirectory.xdg_data_home, u'openlp')
+ except ImportError:
+ path = os.path.join(os.getenv(u'HOME'), u'.openlp', u'data')
+ return path
+
+from registry import Registry
+from confighelper import ConfigHelper
+
+__all__ = [u'Registry', u'ConfigHelper', u'get_config_directory',
+ u'get_data_directory', u'check_latest_version']
diff --git a/openlp/core/utils/confighelper.py b/openlp/core/utils/confighelper.py
index 112712675..d49157f55 100644
--- a/openlp/core/utils/confighelper.py
+++ b/openlp/core/utils/confighelper.py
@@ -24,6 +24,8 @@
###############################################################################
import os
+
+from openlp.core.utils import get_data_directory, get_config_directory
from openlp.core.utils.registry import Registry
class ConfigHelper(object):
@@ -34,20 +36,7 @@ class ConfigHelper(object):
@staticmethod
def get_data_path():
- if os.name == u'nt':
- # ask OS for path to application data, set on Windows XP and Vista
- path = os.path.join(os.getenv(u'APPDATA'), u'openlp', u'data')
- elif os.name == u'mac':
- path = os.path.join(os.getenv(u'HOME'), u'Library',
- u'Application Support', u'openlp', u'Data')
- else:
- try:
- from xdg import BaseDirectory
- path = os.path.join(BaseDirectory.xdg_data_home, u'openlp')
- except ImportError:
- path = os.path.join(os.getenv(u'HOME'), u'.openlp', u'data')
- #reg = ConfigHelper.get_registry()
- #path = ConfigHelper.get_config(u'main', 'data path', path)
+ path = get_data_directory()
if not os.path.exists(path):
os.makedirs(path)
return path
@@ -81,17 +70,7 @@ class ConfigHelper(object):
current operating system, and returns an instantiation of that class.
"""
if ConfigHelper.__registry__ is None:
- config_path = u''
- if os.name == u'nt':
- config_path = os.path.join(os.getenv(u'APPDATA'), u'openlp')
- elif os.name == u'mac':
- config_path = os.path.join(os.getenv(u'HOME'), u'Library',
- u'Application Support', u'openlp')
- else:
- try:
- from xdg import BaseDirectory
- config_path = os.path.join(BaseDirectory.xdg_config_home, u'openlp')
- except ImportError:
- config_path = os.path.join(os.getenv(u'HOME'), u'.openlp')
+ config_path = get_config_directory()
ConfigHelper.__registry__ = Registry(config_path)
- return ConfigHelper.__registry__
\ No newline at end of file
+ return ConfigHelper.__registry__
+
diff --git a/openlp/plugins/alerts/__init__.py b/openlp/plugins/alerts/__init__.py
new file mode 100644
index 000000000..a78b7d0d7
--- /dev/null
+++ b/openlp/plugins/alerts/__init__.py
@@ -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 #
+###############################################################################
diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py
new file mode 100644
index 000000000..5bf268394
--- /dev/null
+++ b/openlp/plugins/alerts/alertsplugin.py
@@ -0,0 +1,100 @@
+# -*- 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 Plugin, 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('Alerts Plugin
This plugin '
+ 'controls the displaying of alerts on the presentations screen')
+ return about_text
diff --git a/openlp/plugins/alerts/forms/__init__.py b/openlp/plugins/alerts/forms/__init__.py
new file mode 100644
index 000000000..14c30d73b
--- /dev/null
+++ b/openlp/plugins/alerts/forms/__init__.py
@@ -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
diff --git a/openlp/plugins/alerts/forms/alertdialog.py b/openlp/plugins/alerts/forms/alertdialog.py
new file mode 100644
index 000000000..53fc1fff5
--- /dev/null
+++ b/openlp/plugins/alerts/forms/alertdialog.py
@@ -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(u'AlertDialog')
+ AlertForm.resize(430, 320)
+ icon = QtGui.QIcon()
+ icon.addPixmap(QtGui.QPixmap(u':/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(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.verticalLayout_2 = QtGui.QVBoxLayout(self.AlertEntryWidget)
+ self.verticalLayout_2.setObjectName(u'verticalLayout_2')
+ self.verticalLayout = QtGui.QVBoxLayout()
+ self.verticalLayout.setObjectName(u'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(u'AlertEntryLabel')
+ self.verticalLayout.addWidget(self.AlertEntryLabel)
+ self.AlertEntryEditItem = QtGui.QLineEdit(self.AlertEntryWidget)
+ self.AlertEntryEditItem.setObjectName(u'AlertEntryEditItem')
+ self.verticalLayout.addWidget(self.AlertEntryEditItem)
+ self.AlertListWidget = QtGui.QListWidget(self.AlertEntryWidget)
+ self.AlertListWidget.setAlternatingRowColors(True)
+ self.AlertListWidget.setObjectName(u'AlertListWidget')
+ self.verticalLayout.addWidget(self.AlertListWidget)
+ self.verticalLayout_2.addLayout(self.verticalLayout)
+ self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setObjectName(u'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(u'DisplayButton')
+ self.horizontalLayout.addWidget(self.DisplayButton)
+ self.CancelButton = QtGui.QPushButton(self.AlertEntryWidget)
+ self.CancelButton.setObjectName(u'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(u'clicked()'), self.close)
+ 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'))
diff --git a/openlp/plugins/alerts/forms/alerteditdialog.py b/openlp/plugins/alerts/forms/alerteditdialog.py
new file mode 100644
index 000000000..6cf4769ef
--- /dev/null
+++ b/openlp/plugins/alerts/forms/alerteditdialog.py
@@ -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(u'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(u'buttonBox')
+ self.layoutWidget = QtGui.QWidget(AlertEditDialog)
+ self.layoutWidget.setGeometry(QtCore.QRect(20, 10, 361, 251))
+ self.layoutWidget.setObjectName(u'layoutWidget')
+ self.verticalLayout_2 = QtGui.QVBoxLayout(self.layoutWidget)
+ self.verticalLayout_2.setObjectName(u'verticalLayout_2')
+ self.horizontalLayout_2 = QtGui.QHBoxLayout()
+ self.horizontalLayout_2.setObjectName(u'horizontalLayout_2')
+ self.AlertLineEdit = QtGui.QLineEdit(self.layoutWidget)
+ self.AlertLineEdit.setObjectName(u'AlertLineEdit')
+ self.horizontalLayout_2.addWidget(self.AlertLineEdit)
+ self.verticalLayout_2.addLayout(self.horizontalLayout_2)
+ self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setObjectName(u'horizontalLayout')
+ self.AlertListWidget = QtGui.QListWidget(self.layoutWidget)
+ self.AlertListWidget.setAlternatingRowColors(True)
+ self.AlertListWidget.setObjectName(u'AlertListWidget')
+ self.horizontalLayout.addWidget(self.AlertListWidget)
+ self.verticalLayout = QtGui.QVBoxLayout()
+ self.verticalLayout.setObjectName(u'verticalLayout')
+ self.SaveButton = QtGui.QPushButton(self.layoutWidget)
+ self.SaveButton.setObjectName(u'SaveButton')
+ self.verticalLayout.addWidget(self.SaveButton)
+ self.ClearButton = QtGui.QPushButton(self.layoutWidget)
+ self.ClearButton.setObjectName(u'ClearButton')
+ self.verticalLayout.addWidget(self.ClearButton)
+ self.AddButton = QtGui.QPushButton(self.layoutWidget)
+ self.AddButton.setObjectName(u'AddButton')
+ self.verticalLayout.addWidget(self.AddButton)
+ self.EditButton = QtGui.QPushButton(self.layoutWidget)
+ self.EditButton.setObjectName(u'EditButton')
+ self.verticalLayout.addWidget(self.EditButton)
+ self.DeleteButton = QtGui.QPushButton(self.layoutWidget)
+ self.DeleteButton.setObjectName(u'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(self.trUtf8('Maintain Alerts'))
+ self.SaveButton.setText(self.trUtf8('Save'))
+ self.ClearButton.setText(self.trUtf8('Clear'))
+ self.AddButton.setText(self.trUtf8('Add'))
+ self.EditButton.setText(self.trUtf8('Edit'))
+ self.DeleteButton.setText(self.trUtf8('Delete'))
+
diff --git a/openlp/plugins/alerts/forms/alerteditform.py b/openlp/plugins/alerts/forms/alerteditform.py
new file mode 100644
index 000000000..4abc8a660
--- /dev/null
+++ b/openlp/plugins/alerts/forms/alerteditform.py
@@ -0,0 +1,166 @@
+# -*- 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 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)
diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py
new file mode 100644
index 000000000..2d7dd1c21
--- /dev/null
+++ b/openlp/plugins/alerts/forms/alertform.py
@@ -0,0 +1,100 @@
+# -*- 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 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)
diff --git a/openlp/core/ui/alertstab.py b/openlp/plugins/alerts/forms/alertstab.py
similarity index 62%
rename from openlp/core/ui/alertstab.py
rename to openlp/plugins/alerts/forms/alertstab.py
index d2e38e048..c842c2e20 100644
--- a/openlp/core/ui/alertstab.py
+++ b/openlp/plugins/alerts/forms/alertstab.py
@@ -25,16 +25,15 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab
+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):
- SettingsTab.__init__(self, u'Alerts')
- self.font_color = '#ffffff'
- self.bg_color = '#660000'
+ def __init__(self, parent, section=None):
+ self.parent = parent
+ SettingsTab.__init__(self, parent.name, section)
def setupUi(self):
self.setObjectName(u'AlertsTab')
@@ -83,6 +82,22 @@ class AlertsTab(SettingsTab):
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)
@@ -100,6 +115,56 @@ class AlertsTab(SettingsTab):
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)
@@ -125,7 +190,7 @@ class AlertsTab(SettingsTab):
self.PreviewLayout.setMargin(8)
self.PreviewLayout.setObjectName(u'PreviewLayout')
self.FontPreview = QtGui.QLineEdit(self.PreviewGroupBox)
- self.FontPreview.setMinimumSize(QtCore.QSize(280, 100))
+ self.FontPreview.setFixedSize(QtCore.QSize(350, 100))
self.FontPreview.setReadOnly(True)
self.FontPreview.setFocusPolicy(QtCore.Qt.NoFocus)
self.FontPreview.setAlignment(
@@ -138,24 +203,40 @@ class AlertsTab(SettingsTab):
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 2.0 rocks!'))
+ 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(
@@ -167,6 +248,15 @@ class AlertsTab(SettingsTab):
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()
@@ -177,19 +267,33 @@ class AlertsTab(SettingsTab):
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)
@@ -199,14 +303,18 @@ class AlertsTab(SettingsTab):
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(16)
+ font.setPointSize(self.font_size)
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
+ (self.bg_color, self.font_color))
diff --git a/openlp/plugins/alerts/lib/__init__.py b/openlp/plugins/alerts/lib/__init__.py
new file mode 100644
index 000000000..c39574719
--- /dev/null
+++ b/openlp/plugins/alerts/lib/__init__.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-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
diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py
new file mode 100644
index 000000000..deda11240
--- /dev/null
+++ b/openlp/plugins/alerts/lib/alertsmanager.py
@@ -0,0 +1,120 @@
+# -*- 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 Receiver
+
+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'flush_alert'), self.generateAlert)
+ 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()
diff --git a/openlp/plugins/alerts/lib/classes.py b/openlp/plugins/alerts/lib/classes.py
new file mode 100644
index 000000000..eec21300c
--- /dev/null
+++ b/openlp/plugins/alerts/lib/classes.py
@@ -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
diff --git a/openlp/plugins/alerts/lib/manager.py b/openlp/plugins/alerts/lib/manager.py
new file mode 100644
index 000000000..3480b3103
--- /dev/null
+++ b/openlp/plugins/alerts/lib/manager.py
@@ -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
diff --git a/openlp/plugins/alerts/lib/meta.py b/openlp/plugins/alerts/lib/meta.py
new file mode 100644
index 000000000..38b0f7206
--- /dev/null
+++ b/openlp/plugins/alerts/lib/meta.py
@@ -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
diff --git a/openlp/plugins/alerts/lib/models.py b/openlp/plugins/alerts/lib/models.py
new file mode 100644
index 000000000..4f556cd23
--- /dev/null
+++ b/openlp/plugins/alerts/lib/models.py
@@ -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
diff --git a/openlp/plugins/alerts/lib/tables.py b/openlp/plugins/alerts/lib/tables.py
new file mode 100644
index 000000000..0a731fb13
--- /dev/null
+++ b/openlp/plugins/alerts/lib/tables.py
@@ -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))
diff --git a/openlp/plugins/bibles/forms/importwizardform.py b/openlp/plugins/bibles/forms/importwizardform.py
index a684c01a3..2f5e84867 100644
--- a/openlp/plugins/bibles/forms/importwizardform.py
+++ b/openlp/plugins/bibles/forms/importwizardform.py
@@ -23,11 +23,10 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
+import csv
import logging
import os
import os.path
-from time import sleep
-import csv
from PyQt4 import QtCore, QtGui
@@ -46,8 +45,8 @@ class DownloadLocation(object):
}
@classmethod
- def get_name(class_, id):
- return class_.Names[id]
+ def get_name(cls, id):
+ return cls.Names[id]
class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py
index 9c7e6b280..ef8e6a090 100644
--- a/openlp/plugins/bibles/lib/biblestab.py
+++ b/openlp/plugins/bibles/lib/biblestab.py
@@ -27,8 +27,7 @@ import logging
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 @@ class BiblesTab(SettingsTab):
# Not Found
id = 0
self.bible_theme = u''
- self.BibleThemeComboBox.setCurrentIndex(id)
\ No newline at end of file
+ self.BibleThemeComboBox.setCurrentIndex(id)
diff --git a/openlp/plugins/bibles/lib/common.py b/openlp/plugins/bibles/lib/common.py
index 5152ca496..cd9b5cf35 100644
--- a/openlp/plugins/bibles/lib/common.py
+++ b/openlp/plugins/bibles/lib/common.py
@@ -27,7 +27,6 @@ import urllib2
import chardet
import logging
import re
-import sqlite3
only_verses = re.compile(r'([\w .]+)[ ]+([0-9]+)[ ]*[:|v|V][ ]*([0-9]+)'
r'(?:[ ]*-[ ]*([0-9]+|end))?(?:[ ]*,[ ]*([0-9]+)(?:[ ]*-[ ]*([0-9]+|end))?)?',
diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py
index db70ac6db..965d0433f 100644
--- a/openlp/plugins/bibles/lib/manager.py
+++ b/openlp/plugins/bibles/lib/manager.py
@@ -25,7 +25,6 @@
import logging
import os
-import csv
from common import parse_reference
from opensong import OpenSongBible
diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py
index 648694f45..4fce998ae 100644
--- a/openlp/plugins/bibles/lib/mediaitem.py
+++ b/openlp/plugins/bibles/lib/mediaitem.py
@@ -31,8 +31,6 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, Receiver, str_to_bool, \
BaseListWithDnD
from openlp.plugins.bibles.forms import ImportWizardForm
-from openlp.plugins.bibles.lib.manager import BibleMode
-from openlp.plugins.bibles.lib.common import parse_reference
class BibleListView(BaseListWithDnD):
"""
diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py
index 830267f2a..6fa18cf6d 100644
--- a/openlp/plugins/bibles/lib/opensong.py
+++ b/openlp/plugins/bibles/lib/opensong.py
@@ -23,13 +23,9 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-import os
-import os.path
import logging
-import chardet
-import codecs
-from lxml import objectify
+from lxml import objectify
from PyQt4 import QtCore
from openlp.core.lib import Receiver
diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py
index 396b3b6ba..cfa68b213 100644
--- a/openlp/plugins/bibles/lib/osis.py
+++ b/openlp/plugins/bibles/lib/osis.py
@@ -30,8 +30,6 @@ import chardet
import codecs
import re
-from PyQt4 import QtCore
-
from openlp.core.lib import Receiver
from db import BibleDB
diff --git a/openlp/plugins/custom/lib/manager.py b/openlp/plugins/custom/lib/manager.py
index 387368016..d1d3e0349 100644
--- a/openlp/plugins/custom/lib/manager.py
+++ b/openlp/plugins/custom/lib/manager.py
@@ -78,7 +78,7 @@ class CustomManager():
return True
except:
self.session.rollback()
- log.excertion(u'Custom Slide save failed')
+ log.exception(u'Custom Slide save failed')
return False
def get_custom(self, id=None):
@@ -94,7 +94,7 @@ class CustomManager():
"""
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 @@ class CustomManager():
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
diff --git a/openlp/plugins/custom/lib/tables.py b/openlp/plugins/custom/lib/tables.py
index 061c6d5c3..13c9de5b9 100644
--- a/openlp/plugins/custom/lib/tables.py
+++ b/openlp/plugins/custom/lib/tables.py
@@ -27,11 +27,11 @@ from sqlalchemy import Column, Table, types
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
+)
diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py
index 8ea1df64b..145e07f04 100644
--- a/openlp/plugins/images/lib/mediaitem.py
+++ b/openlp/plugins/images/lib/mediaitem.py
@@ -172,6 +172,6 @@ class ImageMediaItem(MediaManagerItem):
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
self.OverrideLabel.setText(bitem.text())
frame = QtGui.QImage(unicode(filename))
- self.parent.live_controller.parent.mainDisplay.addImageWithText(frame)
+ self.parent.maindisplay.addImageWithText(frame)
else:
MediaManagerItem.onPreviewClick(self)
diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py
index c2dbc5d93..46b059c01 100644
--- a/openlp/plugins/media/lib/mediaitem.py
+++ b/openlp/plugins/media/lib/mediaitem.py
@@ -54,7 +54,7 @@ class MediaMediaItem(MediaManagerItem):
self.PreviewFunction = self.video_get_preview
MediaManagerItem.__init__(self, parent, icon, title)
self.ServiceItemIconName = u':/media/media_video.png'
- self.MainDisplay = self.parent.live_controller.parent.mainDisplay
+ self.MainDisplay = self.parent.maindisplay
def initPluginNameVisible(self):
self.PluginNameVisible = self.trUtf8('Media')
diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py
index b58a9affc..31b3ac5f6 100644
--- a/openlp/plugins/presentations/lib/impresscontroller.py
+++ b/openlp/plugins/presentations/lib/impresscontroller.py
@@ -201,7 +201,7 @@ class ImpressController(PresentationController):
try:
ctx = resolver.resolve(u'uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext')
except:
- log.exception(u'Unable to fine running instance ')
+ log.exception(u'Unable to find running instance ')
self.start_process()
loop += 1
try:
@@ -233,8 +233,8 @@ class ImpressController(PresentationController):
def close_presentation(self):
"""
Close presentation and clean up objects
- Triggerent by new object being added to SlideController orOpenLP
- being shut down
+ Triggered by new object being added to SlideController or OpenLP
+ being shutdown
"""
log.debug(u'close Presentation OpenOffice')
if self.document:
diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py
index 0b2fd6003..3c665004b 100644
--- a/openlp/plugins/presentations/lib/messagelistener.py
+++ b/openlp/plugins/presentations/lib/messagelistener.py
@@ -67,8 +67,8 @@ class Controller(object):
def slide(self, slide, live):
log.debug(u'Live = %s, slide' % live)
-# if not isLive:
-# return
+ if not live:
+ return
self.activate()
self.controller.goto_slide(int(slide) + 1)
self.controller.poll_slidenumber(live)
@@ -136,11 +136,13 @@ class Controller(object):
self.controller.blank_screen()
def unblank(self):
- if not self.is_live:
+ if not self.isLive:
return
self.activate()
self.controller.unblank_screen()
+ def poll(self):
+ self.controller.poll_slidenumber(self.isLive)
class MessageListener(object):
"""
@@ -229,16 +231,10 @@ class MessageListener(object):
self.previewHandler.shutdown()
def blank(self):
- if self.isLive:
- self.liveHandler.blank()
- else:
- self.previewHandler.blank()
+ self.liveHandler.blank()
def unblank(self):
- if self.isLive:
- self.liveHandler.unblank()
- else:
- self.previewHandler.unblank()
+ self.liveHandler.unblank()
def splitMessage(self, message):
"""
@@ -263,4 +259,4 @@ class MessageListener(object):
return message[0], file, message[4]
def timeout(self):
- self.controller.poll_slidenumber(self.is_live)
+ self.liveHandler.poll()
diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py
index 18b644112..a9775e086 100644
--- a/openlp/plugins/presentations/lib/powerpointcontroller.py
+++ b/openlp/plugins/presentations/lib/powerpointcontroller.py
@@ -208,7 +208,7 @@ class PowerpointController(PresentationController):
self.presentation.SlideShowSettings.Run()
self.presentation.SlideShowWindow.View.GotoSlide(1)
rendermanager = self.plugin.render_manager
- rect = rendermanager.screen_list[rendermanager.current_display][u'size']
+ rect = rendermanager.screens.current[u'size']
self.presentation.SlideShowWindow.Top = rect.y() * 72 / dpi
self.presentation.SlideShowWindow.Height = rect.height() * 72 / dpi
self.presentation.SlideShowWindow.Left = rect.x() * 72 / dpi
diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py
index 0cf2405f1..2ed457fc0 100644
--- a/openlp/plugins/presentations/lib/pptviewcontroller.py
+++ b/openlp/plugins/presentations/lib/pptviewcontroller.py
@@ -108,7 +108,7 @@ class PptviewController(PresentationController):
if self.pptid >= 0:
self.close_presentation()
rendermanager = self.plugin.render_manager
- rect = rendermanager.screen_list[rendermanager.current_display][u'size']
+ rect = rendermanager.screens.current[u'size']
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
filepath = str(presentation.replace(u'/', u'\\'));
try:
diff --git a/openlp/plugins/songusage/forms/songusagedeleteform.py b/openlp/plugins/songusage/forms/songusagedeleteform.py
index 98faf26ad..56eb1954a 100644
--- a/openlp/plugins/songusage/forms/songusagedeleteform.py
+++ b/openlp/plugins/songusage/forms/songusagedeleteform.py
@@ -23,8 +23,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from datetime import date
-
from PyQt4 import QtGui
from songusagedeletedialog import Ui_SongUsageDeleteDialog
@@ -50,7 +48,6 @@ class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
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()
diff --git a/openlp/plugins/songusage/forms/songusagedetaildialog.py b/openlp/plugins/songusage/forms/songusagedetaildialog.py
index bfb2efcaf..d6ba2ecfb 100644
--- a/openlp/plugins/songusage/forms/songusagedetaildialog.py
+++ b/openlp/plugins/songusage/forms/songusagedetaildialog.py
@@ -28,14 +28,28 @@ 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))
+ AuditDetailDialog.resize(609, 413)
+ self.verticalLayout = QtGui.QVBoxLayout(AuditDetailDialog)
+ self.verticalLayout.setObjectName(u'verticalLayout')
+ self.DateRangeGroupBox = QtGui.QGroupBox(AuditDetailDialog)
+ 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.FromDate = QtGui.QCalendarWidget(self.DateRangeGroupBox)
+ self.FromDate.setObjectName(u'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(u'ToLabel')
+ self.DateHorizontalLayout.addWidget(self.ToLabel)
+ self.ToDate = QtGui.QCalendarWidget(self.DateRangeGroupBox)
+ self.ToDate.setObjectName(u'ToDate')
+ self.DateHorizontalLayout.addWidget(self.ToDate)
+ self.verticalLayout_2.addLayout(self.DateHorizontalLayout)
+ self.FileGroupBox = QtGui.QGroupBox(self.DateRangeGroupBox)
self.FileGroupBox.setObjectName(u'FileGroupBox')
self.verticalLayout_4 = QtGui.QVBoxLayout(self.FileGroupBox)
self.verticalLayout_4.setObjectName(u'verticalLayout_4')
@@ -46,152 +60,32 @@ class Ui_SongUsageDetailDialog(object):
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(u':/exports/export_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.SaveFilePushButton.setIcon(icon)
self.SaveFilePushButton.setObjectName(u'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(u'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(u'accepted()'),
+ AuditDetailDialog.accept)
+ QtCore.QObject.connect(self.buttonBox,
+ QtCore.SIGNAL(u'rejected()'),
+ AuditDetailDialog.close)
+ QtCore.QObject.connect(self.SaveFilePushButton,
+ QtCore.SIGNAL(u'pressed()'),
+ AuditDetailDialog.defineOutputLocation)
QtCore.QMetaObject.connectSlotsByName(AuditDetailDialog)
def retranslateUi(self, AuditDetailDialog):
AuditDetailDialog.setWindowTitle(self.trUtf8('Audit Detail Extraction'))
+ self.DateRangeGroupBox.setTitle(self.trUtf8('ASelect Date Range'))
+ self.ToLabel.setText(self.trUtf8('to'))
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
diff --git a/openlp/plugins/songusage/forms/songusagedetailform.py b/openlp/plugins/songusage/forms/songusagedetailform.py
index ead6b5166..df749d8c0 100644
--- a/openlp/plugins/songusage/forms/songusagedetailform.py
+++ b/openlp/plugins/songusage/forms/songusagedetailform.py
@@ -45,33 +45,14 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
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 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
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 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
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'))
diff --git a/openlp/plugins/songusage/lib/manager.py b/openlp/plugins/songusage/lib/manager.py
index cf286d37f..6cae4c372 100644
--- a/openlp/plugins/songusage/lib/manager.py
+++ b/openlp/plugins/songusage/lib/manager.py
@@ -60,12 +60,14 @@ class SongUsageManager():
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 @@ class SongUsageManager():
"""
Delete a SongUsage record
"""
- if id !=0:
+ if id != 0:
songusageitem = self.get_songusage(id)
try:
self.session.delete(songusageitem)
@@ -133,4 +135,4 @@ class SongUsageManager():
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
diff --git a/openlpcnv.pyw b/openlpcnv.pyw
index 877e74744..8c3a8bcf5 100755
--- a/openlpcnv.pyw
+++ b/openlpcnv.pyw
@@ -147,4 +147,4 @@ if __name__ == u'__main__':
newdb = os.path.join(newpath, u'songs.sqlite')
mig.convert_sqlite2_to_3(olddb, newdb)
mig.process()
- #mig.move_log_file()
\ No newline at end of file
+ #mig.move_log_file()
diff --git a/resources/forms/alertdialog.ui b/resources/forms/alertdialog.ui
new file mode 100644
index 000000000..da56f3847
--- /dev/null
+++ b/resources/forms/alertdialog.ui
@@ -0,0 +1,120 @@
+
+
+ AlertForm
+
+
+
+ 0
+ 0
+ 430
+ 320
+
+
+
+ Alert Message
+
+
+
+ :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp
+
+
+
+ 8
+
+
+ 8
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Alert Text:
+
+
+
+ -
+
+
+ -
+
+
+ true
+
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 181
+ 38
+
+
+
+
+ -
+
+
+ Display
+
+
+
+ -
+
+
+ Cancel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CancelButton
+ clicked()
+ AlertForm
+ close()
+
+
+ 294
+ 66
+
+
+ 257
+ 3
+
+
+
+
+
diff --git a/resources/forms/alerteditdialog.ui b/resources/forms/alerteditdialog.ui
new file mode 100644
index 000000000..352e3d7b1
--- /dev/null
+++ b/resources/forms/alerteditdialog.ui
@@ -0,0 +1,101 @@
+
+
+ AlertEditDialog
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Maintain Alerts
+
+
+
+
+ 220
+ 270
+ 173
+ 27
+
+
+
+ QDialogButtonBox::Cancel
+
+
+
+
+
+ 20
+ 10
+ 361
+ 251
+
+
+
+ -
+
+
-
+
+
+
+
+ -
+
+
-
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+ Save
+
+
+
+ -
+
+
+ Clear
+
+
+
+ -
+
+
+ Add
+
+
+
+ -
+
+
+ Edit
+
+
+
+ -
+
+
+ Delete
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/forms/alertform.ui b/resources/forms/alertform.ui
deleted file mode 100644
index 1caf4a356..000000000
--- a/resources/forms/alertform.ui
+++ /dev/null
@@ -1,133 +0,0 @@
-
- AlertForm
-
-
-
- 0
- 0
- 370
- 105
-
-
-
- Alert Message
-
-
-
- :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp
-
-
-
- 8
-
-
- 8
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
- 0
- 0
- 353
- 16
-
-
-
-
- 0
- 0
-
-
-
- Alert Text:
-
-
-
-
-
- 0
- 20
- 353
- 21
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 8
-
-
- 0
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 267
- 20
-
-
-
-
- -
-
-
- Display
-
-
-
- -
-
-
- Cancel
-
-
-
-
-
-
-
-
-
-
-
-
-
- CancelButton
- clicked()
- AlertForm
- close()
-
-
- 294
- 66
-
-
- 257
- 3
-
-
-
-
-
diff --git a/resources/forms/auditdetaildialog.ui b/resources/forms/auditdetaildialog.ui
deleted file mode 100644
index bafcfd535..000000000
--- a/resources/forms/auditdetaildialog.ui
+++ /dev/null
@@ -1,411 +0,0 @@
-
-
- AuditDetailDialog
-
-
-
- 0
- 0
- 593
- 501
-
-
-
- Audit Detail Extraction
-
-
-
-
- 420
- 470
- 170
- 25
-
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
-
-
-
- 10
- 370
- 571
- 70
-
-
-
- Report Location
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
-
- :/exports/export_load.png:/exports/export_load.png
-
-
-
-
-
-
-
-
-
-
- 10
- 10
- 561
- 361
-
-
-
- -
-
-
- Report Type
-
-
-
-
- 50
- 40
- 481
- 23
-
-
-
-
-
-
-
- Summary
-
-
-
- -
-
-
- Detailed
-
-
- true
-
-
-
-
-
-
-
- -
-
-
- Select Date Range
-
-
-
-
-
-
-
-
-
- dd/MM/yyyy
-
-
- true
-
-
-
- -
-
-
- to
-
-
-
- -
-
-
- dd/MM/yyyy
-
-
- true
-
-
-
-
-
-
-
-
- -
-
-
- Select Time Periods
-
-
-
-
-
-
-
-
-
- First Service
-
-
- true
-
-
-
- -
-
-
- hh:mm AP
-
-
-
-
-
-
- -
-
-
- to
-
-
-
- -
-
-
- hh:mm AP
-
-
- true
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
- Second Service
-
-
- true
-
-
-
- -
-
-
- hh:mm AP
-
-
-
-
-
-
- -
-
-
- to
-
-
-
- -
-
-
- hh:mm AP
-
-
-
-
-
- -
-
-
-
-
-
- Third Service
-
-
- true
-
-
-
- -
-
-
- hh:mm AP
-
-
-
-
-
-
- -
-
-
- to
-
-
-
- -
-
-
- hh:mm AP
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- buttonBox
- accepted()
- AuditDetailDialog
- accept()
-
-
- 455
- 483
-
-
- 445
- 575
-
-
-
-
- buttonBox
- rejected()
- AuditDetailDialog
- close()
-
-
- 528
- 484
-
-
- 526
- 531
-
-
-
-
- FirstCheckBox
- stateChanged(int)
- AuditDetailDialog
- changeFirstService(int)
-
-
- 26
- 285
-
-
- 136
- 483
-
-
-
-
- SecondCheckBox
- stateChanged(int)
- AuditDetailDialog
- changeSecondService(int)
-
-
- 41
- 323
-
-
- 103
- 494
-
-
-
-
- ThirdCheckBox
- stateChanged(int)
- AuditDetailDialog
- changeThirdService(int)
-
-
- 38
- 351
-
-
- 155
- 463
-
-
-
-
- SaveFilePushButton
- pressed()
- AuditDetailDialog
- defineOutputLocation()
-
-
- 538
- 419
-
-
- 385
- 480
-
-
-
-
-
- accept()
- changeFirstService(int)
- changeSecondService(int)
- changeThirdService(int)
- defineOutputLocation()
-
-
diff --git a/resources/forms/auditdeletedialog.ui b/resources/forms/songusagedeletedialog.ui
similarity index 100%
rename from resources/forms/auditdeletedialog.ui
rename to resources/forms/songusagedeletedialog.ui
diff --git a/resources/forms/songusagedetaildialog.ui b/resources/forms/songusagedetaildialog.ui
new file mode 100644
index 000000000..a32b63899
--- /dev/null
+++ b/resources/forms/songusagedetaildialog.ui
@@ -0,0 +1,145 @@
+
+
+ AuditDetailDialog
+
+
+
+ 0
+ 0
+ 609
+ 413
+
+
+
+ Audit Detail Extraction
+
+
+ -
+
+
+ Select Date Range
+
+
+
-
+
+
-
+
+
+ -
+
+
+ to
+
+
+ false
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Report Location
+
+
+
-
+
+
-
+
+
+ -
+
+
+
+
+
+
+ :/exports/export_load.png:/exports/export_load.png
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ AuditDetailDialog
+ accept()
+
+
+ 455
+ 483
+
+
+ 445
+ 575
+
+
+
+
+ buttonBox
+ rejected()
+ AuditDetailDialog
+ close()
+
+
+ 528
+ 484
+
+
+ 526
+ 531
+
+
+
+
+ SaveFilePushButton
+ pressed()
+ AuditDetailDialog
+ defineOutputLocation()
+
+
+ 538
+ 419
+
+
+ 385
+ 480
+
+
+
+
+
+ accept()
+ changeFirstService(int)
+ changeSecondService(int)
+ changeThirdService(int)
+ defineOutputLocation()
+
+
diff --git a/scripts/bible-1to2-converter.py b/scripts/bible-1to2-converter.py
index 226c1ec2e..b1e9b6897 100755
--- a/scripts/bible-1to2-converter.py
+++ b/scripts/bible-1to2-converter.py
@@ -28,7 +28,7 @@ import sys
import os
import sqlite
import sqlite3
-import re
+
from optparse import OptionParser
from traceback import format_tb as get_traceback
diff --git a/setup.py b/setup.py
index d891b7bbf..29db13c4b 100644
--- a/setup.py
+++ b/setup.py
@@ -8,15 +8,27 @@ try:
b = Branch.open_containing('.')[0]
b.lock_read()
try:
- verno = b.tags.get_tag_dict().keys()[0]
+ # Get the branch's latest revision number.
revno = b.revno()
+ # Convert said revision number into a bzr revision id.
+ revision_id = b.dotted_revno_to_revision_id((revno,))
+ # Get a dict of tags, with the revision id as the key.
+ tags = b.tags.get_reverse_tag_dict()
+ # Check if the latest
+ if revision_id in tags:
+ version = u'%s' % tags[revision_id][0]
+ else:
+ version = '%s-bzr%s' % (sorted(b.tags.get_tag_dict().keys())[-1], revno)
+ ver_file = open(VERSION_FILE, u'w')
+ ver_file.write(version)
+ ver_file.close()
finally:
b.unlock()
except:
- verno = '1.9.0'
- revno = 0
+ ver_file = open(VERSION_FILE, u'w')
+ version = ver_file.read().strip()
+ ver_file.close()
-version = '%s-bzr%s' % (verno, revno)
setup(
name='OpenLP',
diff --git a/version.txt b/version.txt
index b40e76f0f..ed807084e 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-1.9.0-703
+1.9.0-711