Merged head in.

This commit is contained in:
Raoul Snyman 2010-03-05 20:37:52 +02:00
commit 250fb09737
61 changed files with 915 additions and 640 deletions

View File

@ -38,8 +38,6 @@ from openlp.core.resources import qInitResources
from openlp.core.ui import MainWindow, SplashScreen, ScreenList from openlp.core.ui import MainWindow, SplashScreen, ScreenList
from openlp.core.utils import AppLocation, ConfigHelper from openlp.core.utils import AppLocation, ConfigHelper
log = logging.getLogger()
application_stylesheet = u""" application_stylesheet = u"""
QMainWindow::separator QMainWindow::separator
{ {
@ -68,7 +66,6 @@ class OpenLP(QtGui.QApplication):
The core application class. This class inherits from Qt's QApplication The core application class. This class inherits from Qt's QApplication
class in order to provide the core of the application. class in order to provide the core of the application.
""" """
global log
log.info(u'OpenLP Application Loaded') log.info(u'OpenLP Application Loaded')
def notify(self, obj, evt): def notify(self, obj, evt):
@ -163,11 +160,13 @@ def main():
parser.add_option("-s", "--style", dest="style", parser.add_option("-s", "--style", dest="style",
help="Set the Qt4 style (passed directly to Qt4).") help="Set the Qt4 style (passed directly to Qt4).")
# Set up logging # Set up logging
filename = os.path.join(AppLocation.get_directory(AppLocation.ConfigDir), log_path = AppLocation.get_directory(AppLocation.ConfigDir)
u'openlp.log') if not os.path.exists(log_path):
os.makedirs(log_path)
filename = os.path.join(log_path, u'openlp.log')
logfile = FileHandler(filename, u'w') logfile = FileHandler(filename, u'w')
logfile.setFormatter(logging.Formatter( logfile.setFormatter(logging.Formatter(
u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s')) u'%(asctime)s %(name)-20s %(levelname)-8s %(message)s'))
log.addHandler(logfile) log.addHandler(logfile)
logging.addLevelName(15, u'Timer') logging.addLevelName(15, u'Timer')
# Parse command line options and deal with them. # Parse command line options and deal with them.

1
openlp/.version Normal file
View File

@ -0,0 +1 @@
1.9.0-bzr722

View File

@ -27,6 +27,8 @@ import logging
from PyQt4 import QtGui from PyQt4 import QtGui
log = logging.getLogger(__name__)
class OpenLPDockWidget(QtGui.QDockWidget): class OpenLPDockWidget(QtGui.QDockWidget):
""" """
Custom DockWidget class to handle events Custom DockWidget class to handle events
@ -40,10 +42,9 @@ class OpenLPDockWidget(QtGui.QDockWidget):
if name: if name:
self.setObjectName(name) self.setObjectName(name)
self.setFloating(False) self.setFloating(False)
self.log = logging.getLogger(u'OpenLPDockWidget') log.debug(u'Init done')
self.log.debug(u'Init done')
def closeEvent(self, event): def closeEvent(self, event):
self.parent.settingsmanager.setUIItemVisibility( self.parent.settingsmanager.setUIItemVisibility(
self.objectName(), False) self.objectName(), False)
event.accept() event.accept()

View File

@ -27,6 +27,8 @@ import logging
from PyQt4 import QtCore from PyQt4 import QtCore
log = logging.getLogger(__name__)
class EventReceiver(QtCore.QObject): class EventReceiver(QtCore.QObject):
""" """
Class to allow events to be passed from different parts of the Class to allow events to be passed from different parts of the
@ -108,9 +110,6 @@ class EventReceiver(QtCore.QObject):
Informs all components of the presentation types supported. Informs all components of the presentation types supported.
""" """
global log
log = logging.getLogger(u'EventReceiver')
def __init__(self): def __init__(self):
""" """
Initialise the event receiver, calling the parent constructor. Initialise the event receiver, calling the parent constructor.

View File

@ -32,6 +32,8 @@ from openlp.core.lib.toolbar import *
from openlp.core.lib import contextMenuAction, contextMenuSeparator from openlp.core.lib import contextMenuAction, contextMenuSeparator
from serviceitem import ServiceItem from serviceitem import ServiceItem
log = logging.getLogger(__name__)
class MediaManagerItem(QtGui.QWidget): class MediaManagerItem(QtGui.QWidget):
""" """
MediaManagerItem is a helper widget for plugins. MediaManagerItem is a helper widget for plugins.
@ -92,9 +94,6 @@ class MediaManagerItem(QtGui.QWidget):
method is not defined, a default will be used (treat the method is not defined, a default will be used (treat the
filename as an image). filename as an image).
""" """
global log
log = logging.getLogger(u'MediaManagerItem')
log.info(u'Media Item loaded') log.info(u'Media Item loaded')
def __init__(self, parent=None, icon=None, title=None): def __init__(self, parent=None, icon=None, title=None):

View File

@ -28,6 +28,8 @@ from PyQt4 import QtCore
from openlp.core.lib import PluginConfig, Receiver from openlp.core.lib import PluginConfig, Receiver
log = logging.getLogger(__name__)
class PluginStatus(object): class PluginStatus(object):
""" """
Defines the status of the plugin Defines the status of the plugin
@ -88,8 +90,6 @@ class Plugin(QtCore.QObject):
Used in the plugin manager, when a person clicks on the 'About' button. Used in the plugin manager, when a person clicks on the 'About' button.
""" """
global log
log = logging.getLogger(u'Plugin')
log.info(u'loaded') log.info(u'loaded')
def __init__(self, name, version=None, plugin_helpers=None): def __init__(self, name, version=None, plugin_helpers=None):
@ -254,3 +254,9 @@ class Plugin(QtCore.QObject):
self.mediadock.insert_dock(self.media_item, self.icon, self.weight) self.mediadock.insert_dock(self.media_item, self.icon, self.weight)
if self.settings_tab: if self.settings_tab:
self.settings.insertTab(self.settings_tab, self.weight) self.settings.insertTab(self.settings_tab, self.weight)
def can_delete_theme(self, theme):
"""
Called to ask the plugin if a theme can be deleted
"""
return True

View File

@ -29,13 +29,13 @@ import logging
from openlp.core.lib import Plugin, PluginStatus from openlp.core.lib import Plugin, PluginStatus
log = logging.getLogger(__name__)
class PluginManager(object): class PluginManager(object):
""" """
This is the Plugin manager, which loads all the plugins, This is the Plugin manager, which loads all the plugins,
and executes all the hooks, as and when necessary. and executes all the hooks, as and when necessary.
""" """
global log
log = logging.getLogger(u'PluginMgr')
log.info(u'Plugin manager loaded') log.info(u'Plugin manager loaded')
def __init__(self, dir): def __init__(self, dir):

View File

@ -28,13 +28,13 @@ import logging
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
from openlp.core.lib import resize_image from openlp.core.lib import resize_image
log = logging.getLogger(__name__)
class Renderer(object): class Renderer(object):
""" """
Genarates a pixmap image of a array of text. The Text is formatted to Genarates a pixmap image of a array of text. The Text is formatted to
make sure it fits on the screen and if not extra frames are generated. make sure it fits on the screen and if not extra frames are generated.
""" """
global log
log = logging.getLogger(u'Renderer')
log.info(u'Renderer Loaded') log.info(u'Renderer Loaded')
def __init__(self): def __init__(self):

View File

@ -30,6 +30,8 @@ from PyQt4 import QtCore
from renderer import Renderer from renderer import Renderer
from openlp.core.lib import ThemeLevel from openlp.core.lib import ThemeLevel
log = logging.getLogger(__name__)
class RenderManager(object): class RenderManager(object):
""" """
Class to pull all Renderer interactions into one place. The plugins will Class to pull all Renderer interactions into one place. The plugins will
@ -45,8 +47,6 @@ class RenderManager(object):
``screen_number`` ``screen_number``
Defaults to *0*. The index of the output/display screen. Defaults to *0*. The index of the output/display screen.
""" """
global log
log = logging.getLogger(u'RenderManager')
log.info(u'RenderManager Loaded') log.info(u'RenderManager Loaded')
def __init__(self, theme_manager, screens, screen_number=0): def __init__(self, theme_manager, screens, screen_number=0):

View File

@ -32,6 +32,8 @@ from PyQt4 import QtGui
from openlp.core.lib import build_icon, Receiver, resize_image from openlp.core.lib import build_icon, Receiver, resize_image
log = logging.getLogger(__name__)
class ServiceItemType(object): class ServiceItemType(object):
""" """
Defines the type of service item Defines the type of service item
@ -46,8 +48,6 @@ class ServiceItem(object):
the service manager, the slide controller, and the projection screen the service manager, the slide controller, and the projection screen
compositor. compositor.
""" """
global log
log = logging.getLogger(u'ServiceItem')
log.info(u'Service Item created') log.info(u'Service Item created')
def __init__(self, plugin=None): def __init__(self, plugin=None):
@ -73,6 +73,7 @@ class ServiceItem(object):
self._display_frames = [] self._display_frames = []
self._uuid = unicode(uuid.uuid1()) self._uuid = unicode(uuid.uuid1())
self.autoPreviewAllowed = False self.autoPreviewAllowed = False
self.notes = u''
def addIcon(self, icon): def addIcon(self, icon):
""" """
@ -202,6 +203,7 @@ class ServiceItem(object):
u'footer':self.raw_footer, u'footer':self.raw_footer,
u'type':self.service_item_type, u'type':self.service_item_type,
u'audit':self.audit, u'audit':self.audit,
u'notes':self.notes,
u'preview':self.autoPreviewAllowed u'preview':self.autoPreviewAllowed
} }
service_data = [] service_data = []
@ -237,6 +239,7 @@ class ServiceItem(object):
self.raw_footer = header[u'footer'] self.raw_footer = header[u'footer']
self.audit = header[u'audit'] self.audit = header[u'audit']
self.autoPreviewAllowed = header[u'preview'] self.autoPreviewAllowed = header[u'preview']
self.notes = header[u'notes']
if self.service_item_type == ServiceItemType.Text: if self.service_item_type == ServiceItemType.Text:
for slide in serviceitem[u'serviceitem'][u'data']: for slide in serviceitem[u'serviceitem'][u'data']:
self._raw_frames.append(slide) self._raw_frames.append(slide)

View File

@ -27,6 +27,8 @@ import logging
from xml.dom.minidom import Document from xml.dom.minidom import Document
from xml.etree.ElementTree import ElementTree, XML, dump from xml.etree.ElementTree import ElementTree, XML, dump
log = logging.getLogger(__name__)
class SongXMLBuilder(object): class SongXMLBuilder(object):
""" """
This class builds the XML used to describe songs. This class builds the XML used to describe songs.
@ -42,8 +44,6 @@ class SongXMLBuilder(object):
</lyrics> </lyrics>
</song> </song>
""" """
global log
log = logging.getLogger(u'SongXMLBuilder')
log.info(u'SongXMLBuilder Loaded') log.info(u'SongXMLBuilder Loaded')
def __init__(self): def __init__(self):
@ -123,8 +123,6 @@ class SongXMLParser(object):
</lyrics> </lyrics>
</song> </song>
""" """
global log
log = logging.getLogger(u'SongXMLParser')
log.info(u'SongXMLParser Loaded') log.info(u'SongXMLParser Loaded')
def __init__(self, xml): def __init__(self, xml):
@ -158,4 +156,4 @@ class SongXMLParser(object):
""" """
Debugging aid to dump XML so that we can see what we have. Debugging aid to dump XML so that we can see what we have.
""" """
return dump(self.song_xml) return dump(self.song_xml)

View File

@ -29,6 +29,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon from openlp.core.lib import build_icon
log = logging.getLogger(__name__)
class OpenLPToolbar(QtGui.QToolBar): class OpenLPToolbar(QtGui.QToolBar):
""" """
Lots of toolbars around the place, so it makes sense to have a common way Lots of toolbars around the place, so it makes sense to have a common way
@ -43,8 +45,7 @@ class OpenLPToolbar(QtGui.QToolBar):
self.icons = {} self.icons = {}
self.setIconSize(QtCore.QSize(20, 20)) self.setIconSize(QtCore.QSize(20, 20))
self.actions = {} self.actions = {}
self.log = logging.getLogger(u'OpenLPToolbar') log.debug(u'Init done')
self.log.debug(u'Init done')
def addToolbarButton(self, title, icon, tooltip=None, slot=None, def addToolbarButton(self, title, icon, tooltip=None, slot=None,
checkable=False): checkable=False):
@ -119,7 +120,7 @@ class OpenLPToolbar(QtGui.QToolBar):
if self.icons[title]: if self.icons[title]:
return self.icons[title] return self.icons[title]
else: else:
self.log.error(u'getIconFromTitle - no icon for %s' % title) log.error(u'getIconFromTitle - no icon for %s' % title)
return QtGui.QIcon() return QtGui.QIcon()
def makeWidgetsInvisible(self, widgets): def makeWidgetsInvisible(self, widgets):
@ -152,4 +153,4 @@ class OpenLPToolbar(QtGui.QToolBar):
push_button.setCheckable(True) push_button.setCheckable(True)
push_button.setFlat(True) push_button.setFlat(True)
self.addWidget(push_button) self.addWidget(push_button)
return push_button return push_button

View File

@ -23,6 +23,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from serviceitemform import ServiceItemNoteForm
from screen import ScreenList from screen import ScreenList
from maindisplay import MainDisplay from maindisplay import MainDisplay
from amendthemeform import AmendThemeForm from amendthemeform import AmendThemeForm
@ -40,4 +41,4 @@ from mainwindow import MainWindow
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainWindow', __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainWindow',
'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager',
'AmendThemeForm', 'MediaDockManager'] 'AmendThemeForm', 'MediaDockManager', 'ServiceItemNoteForm']

View File

@ -31,13 +31,13 @@ from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver, resize_image from openlp.core.lib import Receiver, resize_image
log = logging.getLogger(__name__)
class DisplayWidget(QtGui.QWidget): class DisplayWidget(QtGui.QWidget):
""" """
Customised version of QTableWidget which can respond to keyboard Customised version of QTableWidget which can respond to keyboard
events. events.
""" """
global log
log = logging.getLogger(u'MainDisplay')
log.info(u'MainDisplay loaded') log.info(u'MainDisplay loaded')
def __init__(self, parent=None, name=None): def __init__(self, parent=None, name=None):
@ -78,8 +78,6 @@ class MainDisplay(DisplayWidget):
""" """
This is the form that is used to display things on the projector. This is the form that is used to display things on the projector.
""" """
global log
log = logging.getLogger(u'MainDisplay')
log.info(u'MainDisplay Loaded') log.info(u'MainDisplay Loaded')
def __init__(self, parent, screens): def __init__(self, parent, screens):
@ -188,6 +186,7 @@ class MainDisplay(DisplayWidget):
Receiver.send_message(u'screen_changed') Receiver.send_message(u'screen_changed')
def resetDisplay(self): def resetDisplay(self):
Receiver.send_message(u'stop_display_loop')
if self.primary: if self.primary:
self.setVisible(False) self.setVisible(False)
else: else:

View File

@ -36,6 +36,8 @@ from openlp.core.lib import RenderManager, PluginConfig, build_icon, \
OpenLPDockWidget, SettingsManager, PluginManager, Receiver, str_to_bool OpenLPDockWidget, SettingsManager, PluginManager, Receiver, str_to_bool
from openlp.core.utils import check_latest_version, AppLocation from openlp.core.utils import check_latest_version, AppLocation
log = logging.getLogger(__name__)
media_manager_style = """ media_manager_style = """
QToolBox::tab { QToolBox::tab {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
@ -420,8 +422,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
The main window. The main window.
""" """
global log
log = logging.getLogger(u'MainWindow')
log.info(u'MainWindow loaded') log.info(u'MainWindow loaded')
def __init__(self, screens, applicationVersion): def __init__(self, screens, applicationVersion):

View File

@ -25,7 +25,7 @@
import logging import logging
log = logging.getLogger(u'MediaDockManager') log = logging.getLogger(__name__)
class MediaDockManager(object): class MediaDockManager(object):
@ -58,4 +58,4 @@ class MediaDockManager(object):
if self.media_dock.widget(dock_index): if self.media_dock.widget(dock_index):
if self.media_dock.widget(dock_index).ConfigSection == name: if self.media_dock.widget(dock_index).ConfigSection == name:
self.media_dock.widget(dock_index).hide() self.media_dock.widget(dock_index).hide()
self.media_dock.removeItem(dock_index) self.media_dock.removeItem(dock_index)

View File

@ -30,9 +30,9 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib.plugin import PluginStatus from openlp.core.lib.plugin import PluginStatus
from plugindialog import Ui_PluginViewDialog from plugindialog import Ui_PluginViewDialog
log = logging.getLogger(__name__)
class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
global log
log = logging.getLogger(u'PluginForm')
def __init__(self, parent=None): def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
@ -126,4 +126,4 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
elif self.activePlugin.status == PluginStatus.Disabled: elif self.activePlugin.status == PluginStatus.Disabled:
status_text = 'Disabled' status_text = 'Disabled'
self.PluginListWidget.currentItem().setText( self.PluginListWidget.currentItem().setText(
u'%s (%s)' % (self.activePlugin.name, status_text)) u'%s (%s)' % (self.activePlugin.name, status_text))

View File

@ -24,12 +24,12 @@
############################################################################### ###############################################################################
import logging import logging
log = logging.getLogger(__name__)
class ScreenList(object): class ScreenList(object):
""" """
Wrapper to handle the parameters of the display screen Wrapper to handle the parameters of the display screen
""" """
global log
log = logging.getLogger(u'Screen')
log.info(u'Screen loaded') log.info(u'Screen loaded')
def __init__(self): def __init__(self):

View File

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
class Ui_ServiceNoteEdit(object):
def setupUi(self, ServiceNoteEdit):
ServiceNoteEdit.setObjectName(u'ServiceNoteEdit')
ServiceNoteEdit.resize(400, 243)
self.widget = QtGui.QWidget(ServiceNoteEdit)
self.widget.setGeometry(QtCore.QRect(20, 10, 361, 223))
self.widget.setObjectName(u'widget')
self.verticalLayout = QtGui.QVBoxLayout(self.widget)
self.verticalLayout.setObjectName(u'verticalLayout')
self.textEdit = QtGui.QTextEdit(self.widget)
self.textEdit.setObjectName(u'textEdit')
self.verticalLayout.addWidget(self.textEdit)
self.buttonBox = QtGui.QDialogButtonBox(self.widget)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox')
self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(ServiceNoteEdit)
QtCore.QMetaObject.connectSlotsByName(ServiceNoteEdit)
def retranslateUi(self, ServiceNoteEdit):
ServiceNoteEdit.setWindowTitle(self.trUtf8('Service Item Notes'))

View File

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
from serviceitemdialog import Ui_ServiceNoteEdit
class ServiceItemNoteForm(QtGui.QDialog, Ui_ServiceNoteEdit):
"""
This is the form that is used to edit the verses of the song.
"""
def __init__(self, parent=None):
"""
Constructor
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'),
self.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'),
self.reject)

View File

@ -28,33 +28,21 @@ import logging
import cPickle import cPickle
import zipfile import zipfile
log = logging.getLogger(__name__)
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \ from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
contextMenuAction, contextMenuSeparator, contextMenu, Receiver, \ contextMenuAction, contextMenuSeparator, contextMenu, Receiver, \
contextMenu, str_to_bool contextMenu, str_to_bool, build_icon
from openlp.core.ui import ServiceItemNoteForm
class ServiceManagerList(QtGui.QTreeWidget): class ServiceManagerList(QtGui.QTreeWidget):
def __init__(self, parent=None, name=None): def __init__(self, parent=None, name=None):
QtGui.QTreeWidget.__init__(self,parent) QtGui.QTreeWidget.__init__(self,parent)
self.parent = parent self.parent = parent
self.setExpandsOnDoubleClick(False)
# def mousePressEvent(self, event):
# if event.button() == QtCore.Qt.RightButton:
# item = self.itemAt(event.pos())
# parentitem = item.parent()
# if parentitem is None:
# pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
# else:
# pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
# serviceItem = self.parent.serviceItems[pos - 1]
# if serviceItem[u'data'].edit_enabled:
# self.parent.editAction.setVisible(True)
# else:
# self.parent.editAction.setVisible(False)
# event.accept()
# else:
# event.ignore()
def keyPressEvent(self, event): def keyPressEvent(self, event):
if type(event) == QtGui.QKeyEvent: if type(event) == QtGui.QKeyEvent:
@ -91,6 +79,7 @@ class ServiceManagerList(QtGui.QTreeWidget):
just tell it what plugin to call just tell it what plugin to call
""" """
if event.buttons() != QtCore.Qt.LeftButton: if event.buttons() != QtCore.Qt.LeftButton:
event.ignore()
return return
drag = QtGui.QDrag(self) drag = QtGui.QDrag(self)
mimeData = QtCore.QMimeData() mimeData = QtCore.QMimeData()
@ -105,9 +94,6 @@ class ServiceManager(QtGui.QWidget):
the resources used into one OSZ file for use on any OpenLP v2 installation. the resources used into one OSZ file for use on any OpenLP v2 installation.
Also handles the UI tasks of moving things up and down etc. Also handles the UI tasks of moving things up and down etc.
""" """
global log
log = logging.getLogger(u'ServiceManager')
def __init__(self, parent): def __init__(self, parent):
""" """
Sets up the service manager, toolbars, list view, et al. Sets up the service manager, toolbars, list view, et al.
@ -121,6 +107,7 @@ class ServiceManager(QtGui.QWidget):
#Indicates if remoteTriggering is active. If it is the next addServiceItem call #Indicates if remoteTriggering is active. If it is the next addServiceItem call
#will replace the currently selected one. #will replace the currently selected one.
self.remoteEditTriggered = False self.remoteEditTriggered = False
self.serviceItemNoteForm = ServiceItemNoteForm()
#start with the layout #start with the layout
self.Layout = QtGui.QVBoxLayout(self) self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0) self.Layout.setSpacing(0)
@ -161,37 +148,13 @@ class ServiceManager(QtGui.QWidget):
self.ServiceManagerList.setAlternatingRowColors(True) self.ServiceManagerList.setAlternatingRowColors(True)
self.ServiceManagerList.setHeaderHidden(True) self.ServiceManagerList.setHeaderHidden(True)
self.ServiceManagerList.setExpandsOnDoubleClick(False) self.ServiceManagerList.setExpandsOnDoubleClick(False)
self.ServiceManagerList.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.ServiceManagerList.customContextMenuRequested.connect(self.contextMenu)
self.ServiceManagerList.setObjectName(u'ServiceManagerList') self.ServiceManagerList.setObjectName(u'ServiceManagerList')
# enable drop # enable drop
self.ServiceManagerList.__class__.dragEnterEvent = self.dragEnterEvent self.ServiceManagerList.__class__.dragEnterEvent = self.dragEnterEvent
self.ServiceManagerList.__class__.dragMoveEvent = self.dragEnterEvent self.ServiceManagerList.__class__.dragMoveEvent = self.dragEnterEvent
self.ServiceManagerList.__class__.dropEvent = self.dropEvent self.ServiceManagerList.__class__.dropEvent = self.dropEvent
# Add a context menu to the service manager list
self.ServiceManagerList.setContextMenuPolicy(
QtCore.Qt.ActionsContextMenu)
self.editAction = contextMenuAction(
self.ServiceManagerList, ':/system/system_live.png',
self.trUtf8('&Edit Item'), self.remoteEdit)
self.ServiceManagerList.addAction(self.editAction)
self.ServiceManagerList.addAction(contextMenuSeparator(
self.ServiceManagerList))
self.ServiceManagerList.addAction(contextMenuAction(
self.ServiceManagerList, ':/system/system_preview.png',
self.trUtf8('&Preview Verse'), self.makePreview))
self.ServiceManagerList.addAction(contextMenuAction(
self.ServiceManagerList, ':/system/system_live.png',
self.trUtf8('&Show Live'), self.makeLive))
self.ServiceManagerList.addAction(contextMenuSeparator(
self.ServiceManagerList))
self.ServiceManagerList.addAction(contextMenuAction(
self.ServiceManagerList, ':/services/service_delete',
self.trUtf8('&Remove from Service'), self.onDeleteFromService))
self.ServiceManagerList.addAction(contextMenuSeparator(
self.ServiceManagerList))
self.ThemeMenu = contextMenu(
self.ServiceManagerList, '',
self.trUtf8('&Change Item Theme'))
self.ServiceManagerList.addAction(self.ThemeMenu.menuAction())
self.Layout.addWidget(self.ServiceManagerList) self.Layout.addWidget(self.ServiceManagerList)
# Add the bottom toolbar # Add the bottom toolbar
self.OrderToolbar = OpenLPToolbar(self) self.OrderToolbar = OpenLPToolbar(self)
@ -216,7 +179,7 @@ class ServiceManager(QtGui.QWidget):
QtCore.QObject.connect(self.ThemeComboBox, QtCore.QObject.connect(self.ThemeComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onThemeComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onThemeComboBoxSelected)
QtCore.QObject.connect(self.ServiceManagerList, QtCore.QObject.connect(self.ServiceManagerList,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.makeLive) QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.makeLive)
QtCore.QObject.connect(self.ServiceManagerList, QtCore.QObject.connect(self.ServiceManagerList,
QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'), self.collapsed) QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'), self.collapsed)
QtCore.QObject.connect(self.ServiceManagerList, QtCore.QObject.connect(self.ServiceManagerList,
@ -234,10 +197,60 @@ class ServiceManager(QtGui.QWidget):
self.servicePath = self.config.get_data_path() self.servicePath = self.config.get_data_path()
self.service_theme = unicode( self.service_theme = unicode(
self.config.get_config(u'service theme', u'')) self.config.get_config(u'service theme', u''))
#build the context menu
self.menu = QtGui.QMenu()
self.editAction = self.menu.addAction(self.trUtf8('&Edit Item'))
self.editAction.setIcon(build_icon(':/services/service_edit.png'))
self.notesAction = self.menu.addAction(self.trUtf8('&Notes'))
self.notesAction.setIcon(build_icon(':/services/service_notes.png'))
self.sep1 = self.menu.addAction(u'')
self.sep1.setSeparator(True)
self.previewAction = self.menu.addAction(self.trUtf8('&Preview Verse'))
self.previewAction.setIcon(build_icon(':/system/system_preview.png'))
self.liveAction = self.menu.addAction(self.trUtf8('&Live Verse'))
self.liveAction.setIcon(build_icon(':/system/system_live.png'))
self.sep2 = self.menu.addAction(u'')
self.sep2.setSeparator(True)
self.themeMenu = QtGui.QMenu(self.trUtf8('&Change Item Theme'))
self.menu.addMenu(self.themeMenu)
def contextMenu(self, point):
item = self.ServiceManagerList.itemAt(point)
if item.parent() is None:
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
else:
pos = item.parent().data(0, QtCore.Qt.UserRole).toInt()[0]
serviceItem = self.serviceItems[pos - 1]
self.editAction.setVisible(False)
self.notesAction.setVisible(False)
if serviceItem[u'service_item'].edit_enabled:
self.editAction.setVisible(True)
if item.parent() is None:
self.notesAction.setVisible(True)
self.themeMenu.menuAction().setVisible(False)
if serviceItem[u'service_item'].is_text():
self.themeMenu.menuAction().setVisible(True)
action = self.menu.exec_(self.ServiceManagerList.mapToGlobal(point))
if action == self.editAction:
self.remoteEdit()
if action == self.notesAction:
self.onServiceItemNoteForm()
if action == self.previewAction:
self.makePreview()
if action == self.liveAction:
self.makeLive()
def onPresentationTypes(self, presentation_types): def onPresentationTypes(self, presentation_types):
self.presentation_types = presentation_types self.presentation_types = presentation_types
def onServiceItemNoteForm(self):
item, count = self.findServiceItem()
self.serviceItemNoteForm.textEdit.setPlainText(
self.serviceItems[item][u'service_item'].notes)
if self.serviceItemNoteForm.exec_():
self.serviceItems[item][u'service_item'].notes = \
self.serviceItemNoteForm.textEdit.toPlainText()
def nextItem(self): def nextItem(self):
""" """
Called by the SlideController to select the Called by the SlideController to select the
@ -577,9 +590,14 @@ class ServiceManager(QtGui.QWidget):
self.parent.RenderManager.themedata = None self.parent.RenderManager.themedata = None
if len(self.serviceItems) > 0: if len(self.serviceItems) > 0:
tempServiceItems = self.serviceItems tempServiceItems = self.serviceItems
self.onNewService() self.ServiceManagerList.clear()
self.serviceItems = []
self.isNew = True
for item in tempServiceItems: for item in tempServiceItems:
self.addServiceItem(item[u'service_item'], True) self.addServiceItem(item[u'service_item'], True)
#Set to False as items may have changed rendering
#does not impact the saved song so True may aslo be valid
self.parent.serviceChanged(False, self.serviceName)
def addServiceItem(self, item, rebuild=False): def addServiceItem(self, item, rebuild=False):
""" """
@ -722,7 +740,7 @@ class ServiceManager(QtGui.QWidget):
A list of current themes to be displayed A list of current themes to be displayed
""" """
self.ThemeComboBox.clear() self.ThemeComboBox.clear()
self.ThemeMenu.clear() self.themeMenu.clear()
self.ThemeComboBox.addItem(u'') self.ThemeComboBox.addItem(u'')
for theme in theme_list: for theme in theme_list:
self.ThemeComboBox.addItem(theme) self.ThemeComboBox.addItem(theme)
@ -730,7 +748,7 @@ class ServiceManager(QtGui.QWidget):
self.ServiceManagerList, self.ServiceManagerList,
None, None,
theme , self.onThemeChangeAction) theme , self.onThemeChangeAction)
self.ThemeMenu.addAction(action) self.themeMenu.addAction(action)
id = self.ThemeComboBox.findText(self.service_theme, id = self.ThemeComboBox.findText(self.service_theme,
QtCore.Qt.MatchExactly) QtCore.Qt.MatchExactly)
# Not Found # Not Found

View File

@ -31,7 +31,7 @@ from openlp.core.ui import GeneralTab, ThemesTab
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from settingsdialog import Ui_SettingsDialog from settingsdialog import Ui_SettingsDialog
log = logging.getLogger(u'SettingsForm') log = logging.getLogger(__name__)
class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):

View File

@ -33,6 +33,8 @@ from PyQt4.phonon import Phonon
from openlp.core.lib import OpenLPToolbar, Receiver, str_to_bool, \ from openlp.core.lib import OpenLPToolbar, Receiver, str_to_bool, \
PluginConfig, resize_image PluginConfig, resize_image
log = logging.getLogger(__name__)
class SlideList(QtGui.QTableWidget): class SlideList(QtGui.QTableWidget):
""" """
Customised version of QTableWidget which can respond to keyboard Customised version of QTableWidget which can respond to keyboard
@ -74,9 +76,6 @@ class SlideController(QtGui.QWidget):
SlideController is the slide controller widget. This widget is what the SlideController is the slide controller widget. This widget is what the
user uses to control the displaying of verses/slides/etc on the screen. user uses to control the displaying of verses/slides/etc on the screen.
""" """
global log
log = logging.getLogger(u'SlideController')
def __init__(self, parent, settingsmanager, isLive=False): def __init__(self, parent, settingsmanager, isLive=False):
""" """
Set up the Slide Controller. Set up the Slide Controller.
@ -182,7 +181,7 @@ class SlideController(QtGui.QWidget):
self.trUtf8('Move to live'), self.onGoLive) self.trUtf8('Move to live'), self.onGoLive)
self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarSeparator(u'Close Separator')
self.Toolbar.addToolbarButton( self.Toolbar.addToolbarButton(
u'Edit Song', u':/songs/song_edit.png', u'Edit Song', u':/services/service_edit.png',
self.trUtf8('Edit and re-preview Song'), self.onEditSong) self.trUtf8('Edit and re-preview Song'), self.onEditSong)
if isLive: if isLive:
self.Toolbar.addToolbarSeparator(u'Loop Separator') self.Toolbar.addToolbarSeparator(u'Loop Separator')
@ -193,6 +192,8 @@ class SlideController(QtGui.QWidget):
u'Stop Loop', u':/media/media_stop.png', u'Stop Loop', u':/media/media_stop.png',
self.trUtf8('Stop continuous loop'), self.onStopLoop) self.trUtf8('Stop continuous loop'), self.onStopLoop)
self.DelaySpinBox = QtGui.QSpinBox() self.DelaySpinBox = QtGui.QSpinBox()
self.DelaySpinBox.setMinimum(1)
self.DelaySpinBox.setMaximum(180)
self.Toolbar.addToolbarWidget( self.Toolbar.addToolbarWidget(
u'Image SpinBox', self.DelaySpinBox) u'Image SpinBox', self.DelaySpinBox)
self.DelaySpinBox.setSuffix(self.trUtf8('s')) self.DelaySpinBox.setSuffix(self.trUtf8('s'))
@ -279,6 +280,8 @@ class SlideController(QtGui.QWidget):
else: else:
self.Toolbar.makeWidgetsInvisible(self.song_edit_list) self.Toolbar.makeWidgetsInvisible(self.song_edit_list)
self.Mediabar.setVisible(False) self.Mediabar.setVisible(False)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'stop_display_loop'), self.onStopLoop)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_first' % prefix), self.onSlideSelectedFirst) QtCore.SIGNAL(u'%s_first' % prefix), self.onSlideSelectedFirst)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),

View File

@ -38,13 +38,12 @@ from openlp.core.lib import PluginConfig, OpenLPToolbar, contextMenuAction, \
contextMenuSeparator contextMenuSeparator
from openlp.core.utils import ConfigHelper from openlp.core.utils import ConfigHelper
log = logging.getLogger(__name__)
class ThemeManager(QtGui.QWidget): class ThemeManager(QtGui.QWidget):
""" """
Manages the orders of Theme. Manages the orders of Theme.
""" """
global log
log = logging.getLogger(u'ThemeManager')
def __init__(self, parent): def __init__(self, parent):
QtGui.QWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.parent = parent self.parent = parent
@ -181,6 +180,19 @@ class ThemeManager(QtGui.QWidget):
self.trUtf8('You are unable to delete the default theme!'), self.trUtf8('You are unable to delete the default theme!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
else: else:
for plugin in self.parent.plugin_manager.plugins:
if not plugin.can_delete_theme(theme):
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('theme %s is use in %s plugin' % (theme, plugin.name)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return
if unicode(self.parent.ServiceManagerContents.ThemeComboBox.currentText()) == theme:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('theme %s is use Service Manager' % theme),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return
self.themelist.remove(theme) self.themelist.remove(theme)
th = theme + u'.png' th = theme + u'.png'
row = self.ThemeListWidget.row(item) row = self.ThemeListWidget.row(item)

View File

@ -25,9 +25,9 @@
import logging import logging
log = logging.getLogger(__name__)
class Display(): class Display():
global log
log = logging.getLogger(u'Display Logger')
log.info(u'Display Class loaded') log.info(u'Display Class loaded')
@staticmethod @staticmethod
@ -39,4 +39,4 @@ class Display():
def sub_output(string): def sub_output(string):
if not string is None: if not string is None:
log.debug(u' '+string); log.debug(u' '+string);
print (u' '+string) print (u' '+string)

View File

@ -31,9 +31,9 @@ from openlp.core.lib import Plugin, build_icon, PluginStatus
from openlp.plugins.alerts.lib import AlertsManager, DBManager from openlp.plugins.alerts.lib import AlertsManager, DBManager
from openlp.plugins.alerts.forms import AlertsTab, AlertForm, AlertEditForm from openlp.plugins.alerts.forms import AlertsTab, AlertForm, AlertEditForm
log = logging.getLogger(__name__)
class alertsPlugin(Plugin): class alertsPlugin(Plugin):
global log
log = logging.getLogger(u'AlertsPlugin')
log.info(u'Alerts Plugin loaded') log.info(u'Alerts Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):

View File

@ -29,12 +29,12 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
log = logging.getLogger(__name__)
class AlertsManager(QtCore.QObject): class AlertsManager(QtCore.QObject):
""" """
BiblesTab is the Bibles settings tab in the settings dialog. AlertsTab is the Alerts settings tab in the settings dialog.
""" """
global log
log = logging.getLogger(u'AlertManager')
log.info(u'Alert Manager loaded') log.info(u'Alert Manager loaded')
def __init__(self, parent): def __init__(self, parent):

View File

@ -27,14 +27,13 @@ import logging
from openlp.plugins.alerts.lib.models import init_models, metadata, AlertItem from openlp.plugins.alerts.lib.models import init_models, metadata, AlertItem
log = logging.getLogger(__name__)
class DBManager(): class DBManager():
""" """
The Song Manager provides a central location for all database code. This 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. 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') log.info(u'Alerts DB loaded')
def __init__(self, config): def __init__(self, config):

View File

@ -30,9 +30,9 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus from openlp.core.lib import Plugin, build_icon, PluginStatus
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
log = logging.getLogger(__name__)
class BiblePlugin(Plugin): class BiblePlugin(Plugin):
global log
log = logging.getLogger(u'BiblePlugin')
log.info(u'Bible Plugin loaded') log.info(u'Bible Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
@ -92,3 +92,9 @@ class BiblePlugin(Plugin):
'plugin allows bible verses from different sources to be ' 'plugin allows bible verses from different sources to be '
'displayed on the screen during the service.') 'displayed on the screen during the service.')
return about_text return about_text
def can_delete_theme(self, theme):
if self.settings_tab.bible_theme == theme:
return False
return True

View File

@ -34,6 +34,8 @@ from bibleimportwizard import Ui_BibleImportWizard
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from openlp.plugins.bibles.lib.manager import BibleFormat from openlp.plugins.bibles.lib.manager import BibleFormat
log = logging.getLogger(__name__)
class DownloadLocation(object): class DownloadLocation(object):
Unknown = -1 Unknown = -1
Crosswalk = 0 Crosswalk = 0
@ -54,9 +56,6 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
This is the Bible Import Wizard, which allows easy importing of Bibles This is the Bible Import Wizard, which allows easy importing of Bibles
into OpenLP from other formats like OSIS, CSV and OpenSong. into OpenLP from other formats like OSIS, CSV and OpenSong.
""" """
global log
log = logging.getLogger(u'BibleImportForm')
log.info(u'BibleImportForm loaded') log.info(u'BibleImportForm loaded')
def __init__(self, parent, config, manager, bibleplugin): def __init__(self, parent, config, manager, bibleplugin):
@ -371,4 +370,4 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.ImportProgressBar.setValue(self.ImportProgressBar.maximum()) self.ImportProgressBar.setValue(self.ImportProgressBar.maximum())
self.finishButton.setVisible(True) self.finishButton.setVisible(True)
self.cancelButton.setVisible(False) self.cancelButton.setVisible(False)
Receiver.send_message(u'process_events') Receiver.send_message(u'process_events')

View File

@ -29,12 +29,12 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import str_to_bool, Receiver, SettingsTab from openlp.core.lib import str_to_bool, Receiver, SettingsTab
log = logging.getLogger(__name__)
class BiblesTab(SettingsTab): class BiblesTab(SettingsTab):
""" """
BiblesTab is the Bibles settings tab in the settings dialog. BiblesTab is the Bibles settings tab in the settings dialog.
""" """
global log
log = logging.getLogger(u'BibleTab')
log.info(u'Bible Tab loaded') log.info(u'Bible Tab loaded')
def __init__(self, title, section=None): def __init__(self, title, section=None):

View File

@ -33,6 +33,8 @@ from csvbible import CSVBible
from db import BibleDB from db import BibleDB
from http import HTTPBible from http import HTTPBible
log = logging.getLogger(__name__)
class BibleMode(object): class BibleMode(object):
""" """
This is basically an enumeration class which specifies the mode of a Bible. This is basically an enumeration class which specifies the mode of a Bible.
@ -85,8 +87,6 @@ class BibleManager(object):
""" """
The Bible manager which holds and manages all the Bibles. The Bible manager which holds and manages all the Bibles.
""" """
global log
log = logging.getLogger(u'BibleManager')
log.info(u'Bible manager loaded') log.info(u'Bible manager loaded')
def __init__(self, parent, config): def __init__(self, parent, config):

View File

@ -32,6 +32,8 @@ from openlp.core.lib import MediaManagerItem, Receiver, str_to_bool, \
BaseListWithDnD BaseListWithDnD
from openlp.plugins.bibles.forms import ImportWizardForm from openlp.plugins.bibles.forms import ImportWizardForm
log = logging.getLogger(__name__)
class BibleListView(BaseListWithDnD): class BibleListView(BaseListWithDnD):
""" """
Drag and drop capable list for Bibles. Drag and drop capable list for Bibles.
@ -47,8 +49,6 @@ class BibleMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for Bibles. This is the custom media manager item for Bibles.
""" """
global log
log = logging.getLogger(u'BibleMediaItem')
log.info(u'Bible Media Item loaded') log.info(u'Bible Media Item loaded')
def __init__(self, parent, icon, title): def __init__(self, parent, icon, title):

View File

@ -30,15 +30,17 @@ import chardet
import codecs import codecs
import re import re
from PyQt4 import QtCore
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from db import BibleDB from db import BibleDB
log = logging.getLogger(__name__)
class OSISBible(BibleDB): class OSISBible(BibleDB):
""" """
OSIS Bible format importer class. OSIS Bible format importer class.
""" """
global log
log = logging.getLogger(u'BibleOSISImpl')
log.info(u'BibleOSISImpl loaded') log.info(u'BibleOSISImpl loaded')
def __init__(self, parent, **kwargs): def __init__(self, parent, **kwargs):
@ -94,10 +96,11 @@ class OSISBible(BibleDB):
Loads a Bible from file. Loads a Bible from file.
""" """
log.debug(u'Starting OSIS import from "%s"' % self.filename) log.debug(u'Starting OSIS import from "%s"' % self.filename)
self.wizard.incrementProgressBar(u'Detecting encoding (this may take a few minutes)...')
detect_file = None detect_file = None
try: try:
detect_file = open(self.filename, u'r') detect_file = open(self.filename, u'r')
details = chardet.detect(detect_file.read(3000)) details = chardet.detect(detect_file.read())
except: except:
log.exception(u'Failed to detect OSIS file encoding') log.exception(u'Failed to detect OSIS file encoding')
return return

View File

@ -29,6 +29,7 @@ from forms import EditCustomForm
from openlp.core.lib import Plugin, build_icon, PluginStatus from openlp.core.lib import Plugin, build_icon, PluginStatus
from openlp.plugins.custom.lib import CustomManager, CustomMediaItem, CustomTab from openlp.plugins.custom.lib import CustomManager, CustomMediaItem, CustomTab
log = logging.getLogger(__name__)
class CustomPlugin(Plugin): class CustomPlugin(Plugin):
""" """
@ -39,9 +40,6 @@ class CustomPlugin(Plugin):
the songs plugin has become restrictive. Examples could be the songs plugin has become restrictive. Examples could be
Welcome slides, Bible Reading information, Orders of service. Welcome slides, Bible Reading information, Orders of service.
""" """
global log
log = logging.getLogger(u'CustomPlugin')
log.info(u'Custom Plugin loaded') log.info(u'Custom Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
@ -74,3 +72,8 @@ class CustomPlugin(Plugin):
'songs are. This plugin provides greater freedom over the ' 'songs are. This plugin provides greater freedom over the '
'songs plugin.<br>') 'songs plugin.<br>')
return about_text return about_text
def can_delete_theme(self, theme):
if len(self.custommanager.get_customs_for_theme(theme)) == 0:
return True
return False

View File

@ -30,12 +30,12 @@ from editcustomdialog import Ui_customEditDialog
from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver
from openlp.plugins.custom.lib.models import CustomSlide from openlp.plugins.custom.lib.models import CustomSlide
log = logging.getLogger(__name__)
class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
""" """
Class documentation goes here. Class documentation goes here.
""" """
global log
log = logging.getLogger(u'EditCustomForm')
log.info(u'Custom Editor loaded') log.info(u'Custom Editor loaded')
def __init__(self, custommanager, parent = None): def __init__(self, custommanager, parent = None):
""" """

View File

@ -27,14 +27,13 @@ import logging
from openlp.plugins.custom.lib.models import init_models, metadata, CustomSlide from openlp.plugins.custom.lib.models import init_models, metadata, CustomSlide
log = logging.getLogger(__name__)
class CustomManager(): class CustomManager():
""" """
The Song Manager provides a central location for all database code. This 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. class takes care of connecting to the database and running all the queries.
""" """
global log
log = logging.getLogger(u'CustomManager')
log.info(u'Custom manager loaded') log.info(u'Custom manager loaded')
def __init__(self, config): def __init__(self, config):
@ -106,3 +105,6 @@ class CustomManager():
return False return False
else: else:
return True return True
def get_customs_for_theme(self, theme):
return self.session.query(CustomSlide).filter(CustomSlide.theme_name == theme).all()

View File

@ -30,6 +30,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD,\ from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD,\
Receiver, str_to_bool Receiver, str_to_bool
log = logging.getLogger(__name__)
class CustomListView(BaseListWithDnD): class CustomListView(BaseListWithDnD):
def __init__(self, parent=None): def __init__(self, parent=None):
self.PluginName = u'Custom' self.PluginName = u'Custom'
@ -39,8 +41,6 @@ class CustomMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for Custom Slides. This is the custom media manager item for Custom Slides.
""" """
global log
log = logging.getLogger(u'CustomMediaItem')
log.info(u'Custom Media Item loaded') log.info(u'Custom Media Item loaded')
def __init__(self, parent, icon, title): def __init__(self, parent, icon, title):

View File

@ -28,9 +28,9 @@ import logging
from openlp.core.lib import Plugin, build_icon, PluginStatus from openlp.core.lib import Plugin, build_icon, PluginStatus
from openlp.plugins.images.lib import ImageMediaItem, ImageTab from openlp.plugins.images.lib import ImageMediaItem, ImageTab
log = logging.getLogger(__name__)
class ImagePlugin(Plugin): class ImagePlugin(Plugin):
global log
log = logging.getLogger(u'ImagePlugin')
log.info(u'Image Plugin loaded') log.info(u'Image Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):

View File

@ -49,6 +49,7 @@ class ImageTab(SettingsTab):
self.TimeoutLabel.setObjectName(u'TimeoutLabel') self.TimeoutLabel.setObjectName(u'TimeoutLabel')
self.TimeoutLayout.addWidget(self.TimeoutLabel) self.TimeoutLayout.addWidget(self.TimeoutLabel)
self.TimeoutSpinBox = QtGui.QSpinBox(self.ImageSettingsGroupBox) self.TimeoutSpinBox = QtGui.QSpinBox(self.ImageSettingsGroupBox)
self.TimeoutSpinBox.setMinimum(1)
self.TimeoutSpinBox.setMaximum(180) self.TimeoutSpinBox.setMaximum(180)
self.TimeoutSpinBox.setObjectName(u'TimeoutSpinBox') self.TimeoutSpinBox.setObjectName(u'TimeoutSpinBox')
self.TimeoutLayout.addWidget(self.TimeoutSpinBox) self.TimeoutLayout.addWidget(self.TimeoutSpinBox)
@ -78,4 +79,4 @@ class ImageTab(SettingsTab):
Receiver.send_message(u'update_spin_delay', self.loop_delay) Receiver.send_message(u'update_spin_delay', self.loop_delay)
def postSetUp(self): def postSetUp(self):
Receiver.send_message(u'update_spin_delay', self.loop_delay) Receiver.send_message(u'update_spin_delay', self.loop_delay)

View File

@ -29,6 +29,8 @@ import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon
log = logging.getLogger(__name__)
# We have to explicitly create separate classes for each plugin # We have to explicitly create separate classes for each plugin
# in order for DnD to the Service manager to work correctly. # in order for DnD to the Service manager to work correctly.
class ImageListView(BaseListWithDnD): class ImageListView(BaseListWithDnD):
@ -40,8 +42,6 @@ class ImageMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for images. This is the custom media manager item for images.
""" """
global log
log = logging.getLogger(u'ImageMediaItem')
log.info(u'Image Media Item loaded') log.info(u'Image Media Item loaded')
def __init__(self, parent, icon, title): def __init__(self, parent, icon, title):

View File

@ -44,7 +44,9 @@ else:
from PyQt4 import QtCore from PyQt4 import QtCore
from presentationcontroller import PresentationController from presentationcontroller import PresentationController, PresentationDocument
log = logging.getLogger(__name__)
class ImpressController(PresentationController): class ImpressController(PresentationController):
""" """
@ -52,9 +54,7 @@ class ImpressController(PresentationController):
It creates the runtime environment, loads and closes the presentation as It creates the runtime environment, loads and closes the presentation as
well as triggering the correct activities based on the users input well as triggering the correct activities based on the users input
""" """
global log log.info(u'ImpressController loaded')
log = logging.getLogger(u'ImpressController')
log.info(u'loaded')
def __init__(self, plugin): def __init__(self, plugin):
""" """
@ -62,11 +62,8 @@ class ImpressController(PresentationController):
""" """
log.debug(u'Initialising') log.debug(u'Initialising')
PresentationController.__init__(self, plugin, u'Impress') PresentationController.__init__(self, plugin, u'Impress')
self.supports= [u'.odp', u'.ppt', u'.pps', u'.pptx', u'.ppsx'] self.supports = [u'.odp', u'.ppt', u'.pps', u'.pptx', u'.ppsx']
self.process = None self.process = None
self.document = None
self.presentation = None
self.controller = None
self.desktop = None self.desktop = None
def check_available(self): def check_available(self):
@ -99,97 +96,6 @@ class ImpressController(PresentationController):
self.process.startDetached(cmd) self.process.startDetached(cmd)
self.process.waitForStarted() self.process.waitForStarted()
def kill(self):
"""
Called at system exit to clean up any running presentations
"""
log.debug(u'Kill OpenOffice')
self.close_presentation()
if os.name != u'nt':
desktop = self.get_uno_desktop()
try:
desktop.terminate()
except:
pass
def load_presentation(self, presentation):
"""
Called when a presentation is added to the SlideController.
It builds the environment, starts communcations with the background
OpenOffice task started earlier. If OpenOffice is not present is is
started. Once the environment is available the presentation is loaded
and started.
``presentation``
The file name of the presentatios to the run.
"""
log.debug(u'Load Presentation OpenOffice')
self.store_filename(presentation)
#print "s.dsk1 ", self.desktop
if os.name == u'nt':
desktop = self.get_com_desktop()
if desktop is None:
self.start_process()
desktop = self.get_com_desktop()
url = u'file:///' + presentation.replace(u'\\', u'/').replace(u':', u'|').replace(u' ', u'%20')
else:
desktop = self.get_uno_desktop()
url = uno.systemPathToFileUrl(presentation)
if desktop is None:
return
self.desktop = desktop
#print "s.dsk2 ", self.desktop
properties = []
properties.append(self.create_property(u'Minimized', True))
properties = tuple(properties)
try:
self.document = desktop.loadComponentFromURL(url, u'_blank',
0, properties)
except:
log.exception(u'Failed to load presentation')
return
self.presentation = self.document.getPresentation()
self.presentation.Display = self.plugin.render_manager.screens.current_display + 1
self.controller = None
self.create_thumbnails()
def create_thumbnails(self):
"""
Create thumbnail images for presentation
"""
log.debug(u'create thumbnails OpenOffice')
if self.check_thumbnails():
return
if os.name == u'nt':
thumbdir = u'file:///' + self.thumbnailpath.replace(
u'\\', u'/').replace(u':', u'|').replace(u' ', u'%20')
else:
thumbdir = uno.systemPathToFileUrl(self.thumbnailpath)
props = []
props.append(self.create_property(u'FilterName', u'impress_png_Export'))
props = tuple(props)
doc = self.document
pages = doc.getDrawPages()
for idx in range(pages.getCount()):
page = pages.getByIndex(idx)
doc.getCurrentController().setCurrentPage(page)
path = u'%s/%s%s.png'% (thumbdir, self.thumbnailprefix,
unicode(idx + 1))
try:
doc.storeToURL(path , props)
except:
log.exception(u'%s\nUnable to store preview' % path)
def create_property(self, name, value):
log.debug(u'create property OpenOffice')
if os.name == u'nt':
prop = self.manager.Bridge_GetStruct(u'com.sun.star.beans.PropertyValue')
else:
prop = PropertyValue()
prop.Name = name
prop.Value = value
return prop
def get_uno_desktop(self): def get_uno_desktop(self):
log.debug(u'get UNO Desktop Openoffice') log.debug(u'get UNO Desktop Openoffice')
ctx = None ctx = None
@ -230,6 +136,113 @@ class ImpressController(PresentationController):
log.exception(u'Failed to get COM service manager') log.exception(u'Failed to get COM service manager')
return None return None
def kill(self):
"""
Called at system exit to clean up any running presentations
"""
log.debug(u'Kill OpenOffice')
for doc in self.docs:
doc.close_presentation()
if os.name != u'nt':
desktop = self.get_uno_desktop()
try:
desktop.terminate()
except:
pass
def add_doc(self, name):
log.debug(u'Add Doc OpenOffice')
doc = ImpressDocument(self, name)
self.docs.append(doc)
return doc
class ImpressDocument(PresentationDocument):
def __init__(self, controller, presentation):
log.debug(u'Init Presentation OpenOffice')
self.controller = controller
self.document = None
self.presentation = None
self.control = None
self.store_filename(presentation)
def load_presentation(self):
"""
Called when a presentation is added to the SlideController.
It builds the environment, starts communcations with the background
OpenOffice task started earlier. If OpenOffice is not present is is
started. Once the environment is available the presentation is loaded
and started.
``presentation``
The file name of the presentatios to the run.
"""
log.debug(u'Load Presentation OpenOffice')
#print "s.dsk1 ", self.desktop
if os.name == u'nt':
desktop = self.controller.get_com_desktop()
if desktop is None:
self.controller.start_process()
desktop = self.controller.get_com_desktop()
url = u'file:///' + self.filepath.replace(u'\\', u'/').replace(u':', u'|').replace(u' ', u'%20')
else:
desktop = self.controller.get_uno_desktop()
url = uno.systemPathToFileUrl(self.filepath)
if desktop is None:
return
self.desktop = desktop
#print "s.dsk2 ", self.desktop
properties = []
properties.append(self.create_property(u'Minimized', True))
properties = tuple(properties)
try:
self.document = desktop.loadComponentFromURL(url, u'_blank',
0, properties)
except:
log.exception(u'Failed to load presentation')
return
self.presentation = self.document.getPresentation()
self.presentation.Display = self.controller.plugin.render_manager.screens.current_display + 1
self.control = None
self.create_thumbnails()
def create_thumbnails(self):
"""
Create thumbnail images for presentation
"""
log.debug(u'create thumbnails OpenOffice')
if self.check_thumbnails():
return
if os.name == u'nt':
thumbdir = u'file:///' + self.thumbnailpath.replace(
u'\\', u'/').replace(u':', u'|').replace(u' ', u'%20')
else:
thumbdir = uno.systemPathToFileUrl(self.thumbnailpath)
props = []
props.append(self.create_property(u'FilterName', u'impress_png_Export'))
props = tuple(props)
doc = self.document
pages = doc.getDrawPages()
for idx in range(pages.getCount()):
page = pages.getByIndex(idx)
doc.getCurrentController().setCurrentPage(page)
path = u'%s/%s%s.png'% (thumbdir, self.controller.thumbnailprefix,
unicode(idx + 1))
try:
doc.storeToURL(path , props)
except:
log.exception(u'%s\nUnable to store preview' % path)
def create_property(self, name, value):
log.debug(u'create property OpenOffice')
if os.name == u'nt':
prop = self.controller.manager.Bridge_GetStruct(u'com.sun.star.beans.PropertyValue')
else:
prop = PropertyValue()
prop.Name = name
prop.Value = value
return prop
def close_presentation(self): def close_presentation(self):
""" """
Close presentation and clean up objects Close presentation and clean up objects
@ -247,6 +260,7 @@ class ImpressController(PresentationController):
#We tried! #We tried!
pass pass
self.document = None self.document = None
self.controller.remove_doc(self)
def is_loaded(self): def is_loaded(self):
log.debug(u'is loaded OpenOffice') log.debug(u'is loaded OpenOffice')
@ -268,57 +282,57 @@ class ImpressController(PresentationController):
if not self.is_loaded(): if not self.is_loaded():
#print "False " #print "False "
return False return False
#print "self.con ", self.controller #print "self.con ", self.control
if self.controller is None: if self.control is None:
return False return False
return True return True
def unblank_screen(self): def unblank_screen(self):
log.debug(u'unblank screen OpenOffice') log.debug(u'unblank screen OpenOffice')
return self.controller.resume() return self.control.resume()
def blank_screen(self): def blank_screen(self):
log.debug(u'blank screen OpenOffice') log.debug(u'blank screen OpenOffice')
self.controller.blankScreen(0) self.control.blankScreen(0)
def stop_presentation(self): def stop_presentation(self):
log.debug(u'stop presentation OpenOffice') log.debug(u'stop presentation OpenOffice')
self.controller.deactivate() self.control.deactivate()
def start_presentation(self): def start_presentation(self):
log.debug(u'start presentation OpenOffice') log.debug(u'start presentation OpenOffice')
if self.controller is None or not self.controller.isRunning(): if self.control is None or not self.control.isRunning():
self.presentation.start() self.presentation.start()
# start() returns before the getCurrentComponent is ready. Try for 5 seconds # start() returns before the getCurrentComponent is ready. Try for 5 seconds
i = 1 i = 1
while self.desktop.getCurrentComponent() is None and i < 50: while self.desktop.getCurrentComponent() is None and i < 50:
time.sleep(0.1) time.sleep(0.1)
i = i + 1 i = i + 1
self.controller = self.desktop.getCurrentComponent().Presentation.getController() self.control = self.desktop.getCurrentComponent().Presentation.getController()
else: else:
self.controller.activate() self.control.activate()
self.goto_slide(1) self.goto_slide(1)
def get_slide_number(self): def get_slide_number(self):
return self.controller.getCurrentSlideIndex() + 1 return self.control.getCurrentSlideIndex() + 1
def get_slide_count(self): def get_slide_count(self):
return self.document.getDrawPages().getCount() return self.document.getDrawPages().getCount()
def goto_slide(self, slideno): def goto_slide(self, slideno):
self.controller.gotoSlideIndex(slideno-1) self.control.gotoSlideIndex(slideno-1)
def next_step(self): def next_step(self):
""" """
Triggers the next effect of slide on the running presentation Triggers the next effect of slide on the running presentation
""" """
self.controller.gotoNextEffect() self.control.gotoNextEffect()
def previous_step(self): def previous_step(self):
""" """
Triggers the previous slide on the running presentation Triggers the previous slide on the running presentation
""" """
self.controller.gotoPreviousSlide() self.control.gotoPreviousSlide()
def get_slide_preview_file(self, slide_no): def get_slide_preview_file(self, slide_no):
""" """
@ -328,7 +342,7 @@ class ImpressController(PresentationController):
The slide an image is required for, starting at 1 The slide an image is required for, starting at 1
""" """
path = os.path.join(self.thumbnailpath, path = os.path.join(self.thumbnailpath,
self.thumbnailprefix + unicode(slide_no) + u'.png') self.controller.thumbnailprefix + unicode(slide_no) + u'.png')
if os.path.isfile(path): if os.path.isfile(path):
return path return path
else: else:

View File

@ -31,6 +31,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD from openlp.core.lib import MediaManagerItem, BaseListWithDnD
from openlp.plugins.presentations.lib import MessageListener from openlp.plugins.presentations.lib import MessageListener
log = logging.getLogger(__name__)
# We have to explicitly create separate classes for each plugin # We have to explicitly create separate classes for each plugin
# in order for DnD to the Service manager to work correctly. # in order for DnD to the Service manager to work correctly.
class PresentationListView(BaseListWithDnD): class PresentationListView(BaseListWithDnD):
@ -43,8 +45,6 @@ class PresentationMediaItem(MediaManagerItem):
This is the Presentation media manager item for Presentation Items. This is the Presentation media manager item for Presentation Items.
It can present files using Openoffice It can present files using Openoffice
""" """
global log
log = logging.getLogger(u'PresentationsMediaItem')
log.info(u'Presentations Media Item loaded') log.info(u'Presentations Media Item loaded')
def __init__(self, parent, icon, title, controllers): def __init__(self, parent, icon, title, controllers):
@ -135,7 +135,9 @@ class PresentationMediaItem(MediaManagerItem):
self.ConfigSection, self.getFileList()) self.ConfigSection, self.getFileList())
filepath = unicode((item.data(QtCore.Qt.UserRole)).toString()) filepath = unicode((item.data(QtCore.Qt.UserRole)).toString())
for cidx in self.controllers: for cidx in self.controllers:
self.controllers[cidx].presentation_deleted(filepath) doc = self.controllers[cidx].add_doc(filepath)
doc.presentation_deleted()
self.controllers[cidx].remove_doc(doc)
def generateSlideData(self, service_item): def generateSlideData(self, service_item):
items = self.ListView.selectedIndexes() items = self.ListView.selectedIndexes()
@ -148,13 +150,14 @@ class PresentationMediaItem(MediaManagerItem):
bitem = self.ListView.item(item.row()) bitem = self.ListView.item(item.row())
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString()) filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
(path, name) = os.path.split(filename) (path, name) = os.path.split(filename)
controller.store_filename(filename) doc = controller.add_doc(filename)
if controller.get_slide_preview_file(1) is None: if doc.get_slide_preview_file(1) is None:
controller.load_presentation(filename) doc.load_presentation()
i = 1 i = 1
img = controller.get_slide_preview_file(i) img = doc.get_slide_preview_file(i)
while img: while img:
service_item.add_from_command(path, name, img) service_item.add_from_command(path, name, img)
i = i + 1 i = i + 1
img = controller.get_slide_preview_file(i) img = doc.get_slide_preview_file(i)
controller.remove_doc(doc)
return True return True

View File

@ -30,48 +30,50 @@ from PyQt4 import QtCore
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
log = logging.getLogger(__name__)
class Controller(object): class Controller(object):
""" """
This is the Presentation listener who acts on events from the slide This is the Presentation listener who acts on events from the slide
controller and passes the messages on the the correct presentation handlers controller and passes the messages on the the correct presentation handlers
""" """
global log
log = logging.getLogger(u'Controller')
log.info(u'Controller loaded') log.info(u'Controller loaded')
def __init__(self, live): def __init__(self, live):
self.isLive = live self.isLive = live
self.doc = None
log.info(u'%s controller loaded' % live) log.info(u'%s controller loaded' % live)
def addHandler(self, controller, file): def addHandler(self, controller, file):
log.debug(u'Live = %s, addHandler %s' % (self.isLive, file)) log.debug(u'Live = %s, addHandler %s' % (self.isLive, file))
self.controller = controller self.controller = controller
if self.controller.is_loaded(): if self.doc is not None:
self.shutdown() self.shutdown()
self.controller.load_presentation(file) self.doc = self.controller.add_doc(file)
self.doc.load_presentation()
if self.isLive: if self.isLive:
self.controller.start_presentation() self.doc.start_presentation()
Receiver.send_message(u'live_slide_hide') Receiver.send_message(u'live_slide_hide')
self.controller.slidenumber = 0 self.doc.slidenumber = 0
def activate(self): def activate(self):
log.debug(u'Live = %s, activate' % self.isLive) log.debug(u'Live = %s, activate' % self.isLive)
if self.controller.is_active(): if self.doc.is_active():
return return
if not self.controller.is_loaded(): if not self.doc.is_loaded():
self.controller.load_presentation(self.controller.filepath) self.doc.load_presentation()
if self.isLive: if self.isLive:
self.controller.start_presentation() self.doc.start_presentation()
if self.controller.slidenumber > 1: if self.doc.slidenumber > 1:
self.controller.goto_slide(self.controller.slidenumber) self.doc.goto_slide(self.doc.slidenumber)
def slide(self, slide, live): def slide(self, slide, live):
log.debug(u'Live = %s, slide' % live) log.debug(u'Live = %s, slide' % live)
if not live: if not live:
return return
self.activate() self.activate()
self.controller.goto_slide(int(slide) + 1) self.doc.goto_slide(int(slide) + 1)
self.controller.poll_slidenumber(live) self.doc.poll_slidenumber(live)
def first(self): def first(self):
""" """
@ -81,8 +83,8 @@ class Controller(object):
if not self.isLive: if not self.isLive:
return return
self.activate() self.activate()
self.controller.start_presentation() self.doc.start_presentation()
self.controller.poll_slidenumber(self.isLive) self.doc.poll_slidenumber(self.isLive)
def last(self): def last(self):
""" """
@ -92,8 +94,8 @@ class Controller(object):
if not self.isLive: if not self.isLive:
return return
self.activate() self.activate()
self.controller.goto_slide(self.controller.get_slide_count()) self.doc.goto_slide(self.doc.get_slide_count())
self.controller.poll_slidenumber(self.isLive) self.doc.poll_slidenumber(self.isLive)
def next(self): def next(self):
""" """
@ -103,8 +105,8 @@ class Controller(object):
if not self.isLive: if not self.isLive:
return return
self.activate() self.activate()
self.controller.next_step() self.doc.next_step()
self.controller.poll_slidenumber(self.isLive) self.doc.poll_slidenumber(self.isLive)
def previous(self): def previous(self):
""" """
@ -114,43 +116,42 @@ class Controller(object):
if not self.isLive: if not self.isLive:
return return
self.activate() self.activate()
self.controller.previous_step() self.doc.previous_step()
self.controller.poll_slidenumber(self.isLive) self.doc.poll_slidenumber(self.isLive)
def shutdown(self): def shutdown(self):
""" """
Based on the handler passed at startup triggers slide show to shut down Based on the handler passed at startup triggers slide show to shut down
""" """
log.debug(u'Live = %s, shutdown' % self.isLive) log.debug(u'Live = %s, shutdown' % self.isLive)
self.controller.close_presentation() self.doc.close_presentation()
self.controller.slidenumber = 0 self.doc = None
#self.doc.slidenumber = 0
#self.timer.stop() #self.timer.stop()
def blank(self): def blank(self):
if not self.isLive: if not self.isLive:
return return
if not self.controller.is_loaded(): if not self.doc.is_loaded():
return return
if not self.controller.is_active(): if not self.doc.is_active():
return return
self.controller.blank_screen() self.doc.blank_screen()
def unblank(self): def unblank(self):
if not self.isLive: if not self.isLive:
return return
self.activate() self.activate()
self.controller.unblank_screen() self.doc.unblank_screen()
def poll(self): def poll(self):
self.controller.poll_slidenumber(self.isLive) self.doc.poll_slidenumber(self.isLive)
class MessageListener(object): class MessageListener(object):
""" """
This is the Presentation listener who acts on events from the slide This is the Presentation listener who acts on events from the slide
controller and passes the messages on the the correct presentation handlers controller and passes the messages on the the correct presentation handlers
""" """
global log
log = logging.getLogger(u'MessageListener')
log.info(u'Message Listener loaded') log.info(u'Message Listener loaded')
def __init__(self, controllers): def __init__(self, controllers):

View File

@ -31,7 +31,9 @@ if os.name == u'nt':
import _winreg import _winreg
import win32ui import win32ui
from presentationcontroller import PresentationController from presentationcontroller import PresentationController, PresentationDocument
log = logging.getLogger(__name__)
# PPT API documentation: # PPT API documentation:
# http://msdn.microsoft.com/en-us/library/aa269321(office.10).aspx # http://msdn.microsoft.com/en-us/library/aa269321(office.10).aspx
@ -42,9 +44,7 @@ class PowerpointController(PresentationController):
It creates the runtime Environment , Loads the and Closes the Presentation It creates the runtime Environment , Loads the and Closes the Presentation
As well as triggering the correct activities based on the users input As well as triggering the correct activities based on the users input
""" """
global log log.info(u'PowerpointController loaded')
log = logging.getLogger(u'PowerpointController')
log.info(u'loaded')
def __init__(self, plugin): def __init__(self, plugin):
""" """
@ -52,9 +52,8 @@ class PowerpointController(PresentationController):
""" """
log.debug(u'Initialising') log.debug(u'Initialising')
PresentationController.__init__(self, plugin, u'Powerpoint') PresentationController.__init__(self, plugin, u'Powerpoint')
self.supports= [u'.ppt', u'.pps'] self.supports = [u'.ppt', u'.pps']
self.process = None self.process = None
self.presentation = None
def check_available(self): def check_available(self):
""" """
@ -97,6 +96,8 @@ class PowerpointController(PresentationController):
""" """
Called at system exit to clean up any running presentations Called at system exit to clean up any running presentations
""" """
for doc in self.docs:
doc.close_presentation()
if self.process is None: if self.process is None:
return return
try: try:
@ -105,94 +106,110 @@ class PowerpointController(PresentationController):
pass pass
self.process = None self.process = None
def load_presentation(self, presentation): def add_doc(self, name):
""" log.debug(u'Add Doc PowerPoint')
Called when a presentation is added to the SlideController. doc = PowerpointDocument(self, name)
It builds the environment, starts communcations with the background self.docs.append(doc)
OpenOffice task started earlier. If OpenOffice is not present is is return doc
started. Once the environment is available the presentation is loaded
and started.
``presentation`` class PowerpointDocument(PresentationDocument):
The file name of the presentations to run.
"""
log.debug(u'LoadPresentation')
self.store_filename(presentation)
try:
if not self.process.Visible:
self.start_process()
except:
self.start_process()
try:
self.process.Presentations.Open(presentation, False, False, True)
except:
return
self.presentation = self.process.Presentations(self.process.Presentations.Count)
self.create_thumbnails()
def create_thumbnails(self): def __init__(self, controller, presentation):
""" log.debug(u'Init Presentation Powerpoint')
Create the thumbnail images for the current presentation. self.presentation = None
Note an alternative and quicker method would be do self.controller = controller
self.presentation.Slides[n].Copy() self.store_filename(presentation)
thumbnail = QApplication.clipboard.image()
But for now we want a physical file since it makes
life easier elsewhere
"""
if self.check_thumbnails():
return
self.presentation.Export(os.path.join(self.thumbnailpath, '')
, 'png', 600, 480)
def close_presentation(self): def load_presentation(self):
""" """
Close presentation and clean up objects Called when a presentation is added to the SlideController.
Triggerent by new object being added to SlideController orOpenLP It builds the environment, starts communcations with the background
being shut down OpenOffice task started earlier. If OpenOffice is not present is is
""" started. Once the environment is available the presentation is loaded
if self.presentation == None: and started.
return
try:
self.presentation.Close()
except:
pass
self.presentation = None
def is_active(self): ``presentation``
""" The file name of the presentations to run.
Returns true if a presentation is currently active """
""" log.debug(u'LoadPresentation')
if not self.is_loaded(): #try:
if not self.controller.process.Visible:
self.controller.start_process()
#except:
# self.controller.start_process()
#try:
self.controller.process.Presentations.Open(self.filepath, False, False, True)
#except:
# return
self.presentation = self.controller.process.Presentations(
self.controller.process.Presentations.Count)
self.create_thumbnails()
def create_thumbnails(self):
"""
Create the thumbnail images for the current presentation.
Note an alternative and quicker method would be do
self.presentation.Slides[n].Copy()
thumbnail = QApplication.clipboard.image()
But for now we want a physical file since it makes
life easier elsewhere
"""
if self.check_thumbnails():
return
self.presentation.Export(os.path.join(self.thumbnailpath, '')
, 'png', 600, 480)
def close_presentation(self):
"""
Close presentation and clean up objects
Triggerent by new object being added to SlideController orOpenLP
being shut down
"""
if self.presentation == None:
return
try:
self.presentation.Close()
except:
pass
self.presentation = None
self.controller.remove_doc(self)
def is_active(self):
"""
Returns true if a presentation is currently active
"""
if not self.controller.is_loaded():
return False
try:
if self.presentation.SlideShowWindow == None:
return False return False
try: if self.presentation.SlideShowWindow.View == None:
if self.presentation.SlideShowWindow == None:
return False
if self.presentation.SlideShowWindow.View == None:
return False
except:
return False return False
return True except:
return False
return True
def unblank_screen(self): def unblank_screen(self):
""" """
Unblanks (restores) the presentationn Unblanks (restores) the presentationn
""" """
self.presentation.SlideShowSettings.Run() self.presentation.SlideShowSettings.Run()
self.presentation.SlideShowWindow.View.State = 1 self.presentation.SlideShowWindow.View.State = 1
self.presentation.SlideShowWindow.Activate() self.presentation.SlideShowWindow.Activate()
def blank_screen(self): def blank_screen(self):
""" """
Blanks the screen Blanks the screen
""" """
self.presentation.SlideShowWindow.View.State = 3 self.presentation.SlideShowWindow.View.State = 3
def stop_presentation(self): def stop_presentation(self):
""" """
Stops the current presentation and hides the output Stops the current presentation and hides the output
""" """
self.presentation.SlideShowWindow.View.Exit() self.presentation.SlideShowWindow.View.Exit()
if os.name == u'nt':
def start_presentation(self): def start_presentation(self):
""" """
Starts a presentation from the beginning Starts a presentation from the beginning
@ -207,53 +224,53 @@ class PowerpointController(PresentationController):
dpi = 96 dpi = 96
self.presentation.SlideShowSettings.Run() self.presentation.SlideShowSettings.Run()
self.presentation.SlideShowWindow.View.GotoSlide(1) self.presentation.SlideShowWindow.View.GotoSlide(1)
rendermanager = self.plugin.render_manager rendermanager = self.controller.plugin.render_manager
rect = rendermanager.screens.current[u'size'] rect = rendermanager.screens.current[u'size']
self.presentation.SlideShowWindow.Top = rect.y() * 72 / dpi self.presentation.SlideShowWindow.Top = rect.y() * 72 / dpi
self.presentation.SlideShowWindow.Height = rect.height() * 72 / dpi self.presentation.SlideShowWindow.Height = rect.height() * 72 / dpi
self.presentation.SlideShowWindow.Left = rect.x() * 72 / dpi self.presentation.SlideShowWindow.Left = rect.x() * 72 / dpi
self.presentation.SlideShowWindow.Width = rect.width() * 72 / dpi self.presentation.SlideShowWindow.Width = rect.width() * 72 / dpi
def get_slide_number(self): def get_slide_number(self):
""" """
Returns the current slide number Returns the current slide number
""" """
return self.presentation.SlideShowWindow.View.CurrentShowPosition return self.presentation.SlideShowWindow.View.CurrentShowPosition
def get_slide_count(self): def get_slide_count(self):
""" """
Returns total number of slides Returns total number of slides
""" """
return self.presentation.Slides.Count return self.presentation.Slides.Count
def goto_slide(self, slideno): def goto_slide(self, slideno):
""" """
Moves to a specific slide in the presentation Moves to a specific slide in the presentation
""" """
self.presentation.SlideShowWindow.View.GotoSlide(slideno) self.presentation.SlideShowWindow.View.GotoSlide(slideno)
def next_step(self): def next_step(self):
""" """
Triggers the next effect of slide on the running presentation Triggers the next effect of slide on the running presentation
""" """
self.presentation.SlideShowWindow.View.Next() self.presentation.SlideShowWindow.View.Next()
def previous_step(self): def previous_step(self):
""" """
Triggers the previous slide on the running presentation Triggers the previous slide on the running presentation
""" """
self.presentation.SlideShowWindow.View.Previous() self.presentation.SlideShowWindow.View.Previous()
def get_slide_preview_file(self, slide_no): def get_slide_preview_file(self, slide_no):
""" """
Returns an image path containing a preview for the requested slide Returns an image path containing a preview for the requested slide
``slide_no`` ``slide_no``
The slide an image is required for, starting at 1 The slide an image is required for, starting at 1
""" """
path = os.path.join(self.thumbnailpath, path = os.path.join(self.thumbnailpath,
self.thumbnailprefix + unicode(slide_no) + u'.png') self.controller.thumbnailprefix + unicode(slide_no) + u'.png')
if os.path.isfile(path): if os.path.isfile(path):
return path return path
else: else:
return None return None

View File

@ -30,7 +30,9 @@ if os.name == u'nt':
from ctypes import * from ctypes import *
from ctypes.wintypes import RECT from ctypes.wintypes import RECT
from presentationcontroller import PresentationController from presentationcontroller import PresentationController, PresentationDocument
log = logging.getLogger(__name__)
class PptviewController(PresentationController): class PptviewController(PresentationController):
""" """
@ -38,9 +40,7 @@ class PptviewController(PresentationController):
It creates the runtime Environment , Loads the and Closes the Presentation It creates the runtime Environment , Loads the and Closes the Presentation
As well as triggering the correct activities based on the users input As well as triggering the correct activities based on the users input
""" """
global log log.info(u'PPTViewController loaded')
log = logging.getLogger(u'PptviewController')
log.info(u'loaded')
def __init__(self, plugin): def __init__(self, plugin):
""" """
@ -49,8 +49,7 @@ class PptviewController(PresentationController):
log.debug(u'Initialising') log.debug(u'Initialising')
self.process = None self.process = None
PresentationController.__init__(self, plugin, u'Powerpoint Viewer') PresentationController.__init__(self, plugin, u'Powerpoint Viewer')
self.supports= [u'.ppt', u'.pps'] self.supports = [u'.ppt', u'.pps']
self.pptid = None
def check_available(self): def check_available(self):
""" """
@ -90,123 +89,137 @@ class PptviewController(PresentationController):
Called at system exit to clean up any running presentations Called at system exit to clean up any running presentations
""" """
log.debug(u'Kill') log.debug(u'Kill')
self.close_presentation() for doc in self.docs:
doc.close_presentation()
def load_presentation(self, presentation): def add_doc(self, name):
""" log.debug(u'Add Doc PPTView')
Called when a presentation is added to the SlideController. doc = PptviewDocument(self, name)
It builds the environment, starts communcations with the background self.docs.append(doc)
OpenOffice task started earlier. If OpenOffice is not present is is return doc
started. Once the environment is available the presentation is loaded
and started.
``presentation`` class PptviewDocument(PresentationDocument):
The file name of the presentations to run.
"""
log.debug(u'LoadPresentation')
self.store_filename(presentation)
if self.pptid >= 0:
self.close_presentation()
rendermanager = self.plugin.render_manager
rect = rendermanager.screens.current[u'size']
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
filepath = str(presentation.replace(u'/', u'\\'));
try:
self.pptid = self.process.OpenPPT(filepath, None, rect,
str(os.path.join(self.thumbnailpath, self.thumbnailprefix)))
self.stop_presentation()
except:
log.exception(u'Failed to load presentation')
def close_presentation(self): def __init__(self, controller, presentation):
""" log.debug(u'Init Presentation PowerPoint')
Close presentation and clean up objects self.presentation = None
Triggerent by new object being added to SlideController orOpenLP self.pptid = None
being shut down self.controller = controller
""" self.store_filename(presentation)
self.process.ClosePPT(self.pptid)
self.pptid = -1
def is_loaded(self): def load_presentation(self):
""" """
Returns true if a presentation is loaded Called when a presentation is added to the SlideController.
""" It builds the environment, starts communcations with the background
if self.pptid < 0: PptView task started earlier.
return False
if self.get_slide_count() < 0:
return False
return True
def is_active(self): ``presentation``
""" The file name of the presentations to run.
Returns true if a presentation is currently active """
""" log.debug(u'LoadPresentation')
return self.is_loaded() #if self.pptid >= 0:
# self.close_presentation()
rendermanager = self.controller.plugin.render_manager
rect = rendermanager.screens.current[u'size']
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
filepath = str(self.filepath.replace(u'/', u'\\'));
try:
self.pptid = self.controller.process.OpenPPT(filepath, None, rect,
str(os.path.join(self.thumbnailpath, self.controller.thumbnailprefix)))
self.stop_presentation()
except:
log.exception(u'Failed to load presentation')
def blank_screen(self): def close_presentation(self):
""" """
Blanks the screen Close presentation and clean up objects
""" Triggerent by new object being added to SlideController orOpenLP
self.process.Blank(self.pptid) being shut down
"""
self.controller.process.ClosePPT(self.pptid)
self.pptid = -1
self.controller.remove_doc(self)
def unblank_screen(self): def is_loaded(self):
""" """
Unblanks (restores) the presentationn Returns true if a presentation is loaded
""" """
self.process.Unblank(self.pptid) if self.pptid < 0:
return False
if self.get_slide_count() < 0:
return False
return True
def stop_presentation(self): def is_active(self):
""" """
Stops the current presentation and hides the output Returns true if a presentation is currently active
""" """
self.process.Stop(self.pptid) return self.is_loaded()
def start_presentation(self): def blank_screen(self):
""" """
Starts a presentation from the beginning Blanks the screen
""" """
self.process.RestartShow(self.pptid) self.controller.process.Blank(self.pptid)
def get_slide_number(self): def unblank_screen(self):
""" """
Returns the current slide number Unblanks (restores) the presentationn
""" """
return self.process.GetCurrentSlide(self.pptid) self.controller.process.Unblank(self.pptid)
def get_slide_count(self): def stop_presentation(self):
""" """
Returns total number of slides Stops the current presentation and hides the output
""" """
return self.process.GetSlideCount(self.pptid) self.controller.process.Stop(self.pptid)
def goto_slide(self, slideno): def start_presentation(self):
""" """
Moves to a specific slide in the presentation Starts a presentation from the beginning
""" """
self.process.GotoSlide(self.pptid, slideno) self.controller.process.RestartShow(self.pptid)
def next_step(self): def get_slide_number(self):
""" """
Triggers the next effect of slide on the running presentation Returns the current slide number
""" """
self.process.NextStep(self.pptid) return self.controller.process.GetCurrentSlide(self.pptid)
def previous_step(self): def get_slide_count(self):
""" """
Triggers the previous slide on the running presentation Returns total number of slides
""" """
self.process.PrevStep(self.pptid) return self.controller.process.GetSlideCount(self.pptid)
def get_slide_preview_file(self, slide_no): def goto_slide(self, slideno):
""" """
Returns an image path containing a preview for the requested slide Moves to a specific slide in the presentation
"""
self.controller.process.GotoSlide(self.pptid, slideno)
``slide_no`` def next_step(self):
The slide an image is required for, starting at 1 """
""" Triggers the next effect of slide on the running presentation
path = os.path.join(self.thumbnailpath, """
self.thumbnailprefix + unicode(slide_no) + u'.bmp') self.controller.process.NextStep(self.pptid)
if os.path.isfile(path):
return path def previous_step(self):
else: """
return None Triggers the previous slide on the running presentation
"""
self.controller.process.PrevStep(self.pptid)
def get_slide_preview_file(self, slide_no):
"""
Returns an image path containing a preview for the requested slide
``slide_no``
The slide an image is required for, starting at 1
"""
path = os.path.join(self.thumbnailpath,
self.controller.thumbnailprefix + unicode(slide_no) + u'.bmp')
if os.path.isfile(path):
return path
else:
return None

View File

@ -31,16 +31,16 @@ from PyQt4 import QtCore
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
log = logging.getLogger(__name__)
class PresentationController(object): class PresentationController(object):
""" """
Base class for presentation controllers to inherit from Base class for presentation controllers to inherit from
Class to control interactions with presentations. Class to control interactions with presentations.
It creates the runtime environment, loads and closes the presentation as It creates the runtime environment
well as triggering the correct activities based on the users input
To create a new controller, take a copy of this file and name it To create a new controller, take a copy of this file and name it
so it ends in controller.py, i.e. foobarcontroller.py so it ends in controller.py, i.e. foobarcontroller.py
Make sure it inhetits PresentationController Make sure it inherits PresentationController
Then fill in the blanks. If possible try and make sure it loads Then fill in the blanks. If possible try and make sure it loads
on all platforms, using for example os.name checks, although on all platforms, using for example os.name checks, although
__init__, check_available and presentation_deleted should always work. __init__, check_available and presentation_deleted should always work.
@ -73,6 +73,86 @@ class PresentationController(object):
``presentation_deleted()`` ``presentation_deleted()``
Deletes presentation specific files, e.g. thumbnails Deletes presentation specific files, e.g. thumbnails
"""
log.info(u'PresentationController loaded')
def __init__(self, plugin=None, name=u'PresentationController'):
"""
This is the constructor for the presentationcontroller object.
This provides an easy way for descendent plugins to populate common data.
This method *must* be overridden, like so::
class MyPresentationController(PresentationController):
def __init__(self, plugin):
PresentationController.__init(self, plugin, u'My Presenter App')
``plugin``
Defaults to *None*. The presentationplugin object
``name``
Name of the application, to appear in the application
"""
self.supports = []
self.docs = []
self.plugin = plugin
self.name = name
self.available = self.check_available()
if self.available:
self.enabled = int(plugin.config.get_config(
name, QtCore.Qt.Unchecked)) == QtCore.Qt.Checked
else:
self.enabled = False
self.thumbnailroot = os.path.join(plugin.config.get_data_path(),
name, u'thumbnails')
self.thumbnailprefix = u'slide'
if not os.path.isdir(self.thumbnailroot):
os.makedirs(self.thumbnailroot)
def check_available(self):
"""
Presentation app is able to run on this machine
"""
return False
def start_process(self):
"""
Loads a running version of the presentation application in the background.
"""
pass
def kill(self):
"""
Called at system exit to clean up any running presentations and
close the application
"""
log.debug(u'Kill')
self.close_presentation()
def add_doc(self, name):
"""
Called when a new presentation document is opened
"""
doc = PresentationDocument(self, name)
self.docs.append(doc)
return doc
def remove_doc(self, doc):
"""
Called to remove an open document from the collection
"""
log.debug(u'remove_doc Presentation')
self.docs.remove(doc)
class PresentationDocument(object):
"""
Base class for presentation documents to inherit from.
Loads and closes the presentation as well as triggering the correct
activities based on the users input
**Hook Functions**
``load_presentation(presentation)`` ``load_presentation(presentation)``
Load a presentation file Load a presentation file
@ -116,71 +196,12 @@ class PresentationController(object):
Returns a path to an image containing a preview for the requested slide Returns a path to an image containing a preview for the requested slide
""" """
global log def __init__(self, controller, name):
log = logging.getLogger(u'PresentationController')
log.info(u'PresentationController loaded')
def __init__(self, plugin=None, name=u'PresentationController'):
"""
This is the constructor for the presentationcontroller object.
This provides an easy way for descendent plugins to populate common data.
This method *must* be overridden, like so::
class MyPresentationController(PresentationController):
def __init__(self, plugin):
PresentationController.__init(self, plugin, u'My Presenter App')
``plugin``
Defaults to *None*. The presentationplugin object
``name``
Name of the application, to appear in the application
"""
self.supports = []
self.plugin = plugin
self.name = name
self.available = self.check_available()
self.slidenumber = 0 self.slidenumber = 0
if self.available: self.controller = controller
self.enabled = int(plugin.config.get_config( self.store_filename(name)
name, QtCore.Qt.Unchecked)) == QtCore.Qt.Checked
else:
self.enabled = False
self.thumbnailroot = os.path.join(plugin.config.get_data_path(),
name, u'thumbnails')
self.thumbnailprefix = u'slide'
if not os.path.isdir(self.thumbnailroot):
os.makedirs(self.thumbnailroot)
def check_available(self): def load_presentation(self):
"""
Presentation app is able to run on this machine
"""
return False
def presentation_deleted(self, presentation):
"""
Cleans up/deletes any controller specific files created for
a file, e.g. thumbnails
"""
self.store_filename(presentation)
shutil.rmtree(self.thumbnailpath)
def start_process(self):
"""
Loads a running version of the presentation application in the background.
"""
pass
def kill(self):
"""
Called at system exit to clean up any running presentations and
close the application
"""
log.debug(u'Kill')
self.close_presentation()
def load_presentation(self, presentation):
""" """
Called when a presentation is added to the SlideController. Called when a presentation is added to the SlideController.
Loads the presentation and starts it Loads the presentation and starts it
@ -191,16 +212,29 @@ class PresentationController(object):
""" """
pass pass
def presentation_deleted(self):
"""
Cleans up/deletes any controller specific files created for
a file, e.g. thumbnails
"""
shutil.rmtree(self.thumbnailpath)
def store_filename(self, presentation): def store_filename(self, presentation):
""" """
Set properties for the filename and thumbnail paths Set properties for the filename and thumbnail paths
""" """
self.filepath = presentation self.filepath = presentation
self.filename = os.path.split(presentation)[1] self.filename = self.get_file_name(presentation)
self.thumbnailpath = os.path.join(self.thumbnailroot, self.filename) self.thumbnailpath = self.get_thumbnail_path(presentation)
if not os.path.isdir(self.thumbnailpath): if not os.path.isdir(self.thumbnailpath):
os.mkdir(self.thumbnailpath) os.mkdir(self.thumbnailpath)
def get_file_name(self, presentation):
return os.path.split(presentation)[1]
def get_thumbnail_path(self, presentation):
return os.path.join(self.controller.thumbnailroot, self.get_file_name(presentation))
def check_thumbnails(self): def check_thumbnails(self):
""" """
Returns true if the thumbnail images look to exist and are more Returns true if the thumbnail images look to exist and are more
@ -218,10 +252,10 @@ class PresentationController(object):
Close presentation and clean up objects Close presentation and clean up objects
Triggered by new object being added to SlideController Triggered by new object being added to SlideController
""" """
pass self.controller.delete_doc(self)
def is_active(self): def is_active(self):
""" """
Returns True if a presentation is currently running Returns True if a presentation is currently running
""" """
return False return False

View File

@ -29,9 +29,9 @@ import logging
from openlp.core.lib import Plugin, build_icon, Receiver, PluginStatus from openlp.core.lib import Plugin, build_icon, Receiver, PluginStatus
from openlp.plugins.presentations.lib import * from openlp.plugins.presentations.lib import *
class PresentationPlugin(Plugin): log = logging.getLogger(__name__)
global log class PresentationPlugin(Plugin):
log = logging.getLogger(u'PresentationPlugin') log = logging.getLogger(u'PresentationPlugin')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):

View File

@ -30,10 +30,9 @@ from PyQt4 import QtNetwork, QtCore
from openlp.core.lib import Plugin, Receiver from openlp.core.lib import Plugin, Receiver
from openlp.plugins.remotes.lib import RemoteTab from openlp.plugins.remotes.lib import RemoteTab
class RemotesPlugin(Plugin): log = logging.getLogger(__name__)
global log class RemotesPlugin(Plugin):
log = logging.getLogger(u'RemotesPlugin')
log.info(u'Remote Plugin loaded') log.info(u'Remote Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):

View File

@ -28,14 +28,13 @@ import logging
from openlp.plugins.songs.lib.models import init_models, metadata, Song, \ from openlp.plugins.songs.lib.models import init_models, metadata, Song, \
Author, Topic, Book Author, Topic, Book
log = logging.getLogger(__name__)
class SongManager(): class SongManager():
""" """
The Song Manager provides a central location for all database code. This 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. class takes care of connecting to the database and running all the queries.
""" """
global log
log = logging.getLogger(u'SongManager')
log.info(u'Song manager loaded') log.info(u'Song manager loaded')
def __init__(self, config): def __init__(self, config):
@ -238,3 +237,6 @@ class SongManager():
self.session.rollback() self.session.rollback()
log.exception(u'Could not delete book from song database') log.exception(u'Could not delete book from song database')
return False return False
def get_songs_for_theme(self, theme):
return self.session.query(Song).filter(Song.theme_name == theme).all()

View File

@ -31,6 +31,8 @@ from openlp.core.lib import MediaManagerItem, SongXMLParser, \
BaseListWithDnD, Receiver, str_to_bool BaseListWithDnD, Receiver, str_to_bool
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm
log = logging.getLogger(__name__)
class SongListView(BaseListWithDnD): class SongListView(BaseListWithDnD):
def __init__(self, parent=None): def __init__(self, parent=None):
self.PluginName = u'Songs' self.PluginName = u'Songs'
@ -40,8 +42,6 @@ class SongMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for Songs. This is the custom media manager item for Songs.
""" """
global log
log = logging.getLogger(u'SongMediaItem')
log.info(u'Song Media Item loaded') log.info(u'Song Media Item loaded')
def __init__(self, parent, icon, title): def __init__(self, parent, icon, title):

View File

@ -32,6 +32,8 @@ from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab
from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \ from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
OpenSongImportForm, OpenLPExportForm OpenSongImportForm, OpenLPExportForm
log = logging.getLogger(__name__)
class SongsPlugin(Plugin): class SongsPlugin(Plugin):
""" """
This is the number 1 plugin, if importance were placed on any This is the number 1 plugin, if importance were placed on any
@ -40,9 +42,6 @@ class SongsPlugin(Plugin):
specified. Authors, topics and song books can be assigned to songs specified. Authors, topics and song books can be assigned to songs
as well. as well.
""" """
global log
log = logging.getLogger(u'SongsPlugin')
log.info(u'Song Plugin loaded') log.info(u'Song Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
@ -180,3 +179,8 @@ class SongsPlugin(Plugin):
about_text = self.trUtf8('<b>Song Plugin</b> <br>This plugin allows ' about_text = self.trUtf8('<b>Song Plugin</b> <br>This plugin allows '
'Songs to be managed and displayed.<br>') 'Songs to be managed and displayed.<br>')
return about_text return about_text
def can_delete_theme(self, theme):
if len(self.songmanager.get_songs_for_theme(theme)) == 0:
return True
return False

View File

@ -29,9 +29,9 @@ import logging
from songusagedetaildialog import Ui_SongUsageDetailDialog from songusagedetaildialog import Ui_SongUsageDetailDialog
log = logging.getLogger(__name__)
class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog): class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
global log
log = logging.getLogger(u'SongUsageDetailForm')
log.info(u'SongUsage Detail Form loaded') log.info(u'SongUsage Detail Form loaded')
""" """
Class documentation goes here. Class documentation goes here.

View File

@ -27,14 +27,13 @@ import logging
from openlp.plugins.songusage.lib.models import init_models, metadata, SongUsageItem from openlp.plugins.songusage.lib.models import init_models, metadata, SongUsageItem
log = logging.getLogger(__name__)
class SongUsageManager(): class SongUsageManager():
""" """
The Song Manager provides a central location for all database code. This 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. class takes care of connecting to the database and running all the queries.
""" """
global log
log = logging.getLogger(u'SongUsageManager')
log.info(u'SongUsage manager loaded') log.info(u'SongUsage manager loaded')
def __init__(self, config): def __init__(self, config):

View File

@ -33,9 +33,9 @@ from openlp.plugins.songusage.lib import SongUsageManager
from openlp.plugins.songusage.forms import SongUsageDetailForm, SongUsageDeleteForm from openlp.plugins.songusage.forms import SongUsageDetailForm, SongUsageDeleteForm
from openlp.plugins.songusage.lib.models import SongUsageItem from openlp.plugins.songusage.lib.models import SongUsageItem
log = logging.getLogger(__name__)
class SongUsagePlugin(Plugin): class SongUsagePlugin(Plugin):
global log
log = logging.getLogger(u'SongUsagePlugin')
log.info(u'SongUsage Plugin loaded') log.info(u'SongUsage Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ServiceNoteEdit</class>
<widget class="QWidget" name="ServiceNoteEdit">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>243</height>
</rect>
</property>
<property name="windowTitle">
<string>Service Item Notes</string>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>361</width>
<height>223</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="textEdit"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,5 +1,5 @@
<RCC> <RCC>
<qresource prefix="songs" > <qresource prefix="songs">
<file>topic_edit.png</file> <file>topic_edit.png</file>
<file>author_add.png</file> <file>author_add.png</file>
<file>author_delete.png</file> <file>author_delete.png</file>
@ -21,7 +21,7 @@
<file>song_topic_edit.png</file> <file>song_topic_edit.png</file>
<file>song_book_edit.png</file> <file>song_book_edit.png</file>
</qresource> </qresource>
<qresource prefix="slides" > <qresource prefix="slides">
<file>slide_close.png</file> <file>slide_close.png</file>
<file>slide_first.png</file> <file>slide_first.png</file>
<file>slide_last.png</file> <file>slide_last.png</file>
@ -31,7 +31,7 @@
<file>media_playback_stop.png</file> <file>media_playback_stop.png</file>
<file>media_playback_pause.png</file> <file>media_playback_pause.png</file>
</qresource> </qresource>
<qresource prefix="icon" > <qresource prefix="icon">
<file>openlp-logo-16x16.png</file> <file>openlp-logo-16x16.png</file>
<file>openlp-logo-32x32.png</file> <file>openlp-logo-32x32.png</file>
<file>openlp-logo-48x48.png</file> <file>openlp-logo-48x48.png</file>
@ -39,43 +39,45 @@
<file>openlp-logo-128x128.png</file> <file>openlp-logo-128x128.png</file>
<file>openlp-logo-256x256.png</file> <file>openlp-logo-256x256.png</file>
</qresource> </qresource>
<qresource prefix="graphics" > <qresource prefix="graphics">
<file>openlp-about-logo.png</file> <file>openlp-about-logo.png</file>
<file>openlp-splash-screen.png</file> <file>openlp-splash-screen.png</file>
</qresource> </qresource>
<qresource prefix="imports" > <qresource prefix="imports">
<file>import_selectall.png</file> <file>import_selectall.png</file>
<file>import_move_to_list.png</file> <file>import_move_to_list.png</file>
<file>import_remove.png</file> <file>import_remove.png</file>
<file>import_load.png</file> <file>import_load.png</file>
</qresource> </qresource>
<qresource prefix="exports" > <qresource prefix="exports">
<file>export_selectall.png</file> <file>export_selectall.png</file>
<file>export_remove.png</file> <file>export_remove.png</file>
<file>export_load.png</file> <file>export_load.png</file>
<file>export_move_to_list.png</file> <file>export_move_to_list.png</file>
</qresource> </qresource>
<qresource prefix="custom" > <qresource prefix="custom">
<file>custom_new.png</file> <file>custom_new.png</file>
<file>custom_edit.png</file> <file>custom_edit.png</file>
<file>custom_delete.png</file> <file>custom_delete.png</file>
</qresource> </qresource>
<qresource prefix="wizards" > <qresource prefix="wizards">
<file>wizard_importbible.bmp</file> <file>wizard_importbible.bmp</file>
</qresource> </qresource>
<qresource prefix="presentations" > <qresource prefix="presentations">
<file>presentation_delete.png</file> <file>presentation_delete.png</file>
<file>presentation_load.png</file> <file>presentation_load.png</file>
</qresource> </qresource>
<qresource prefix="videos" > <qresource prefix="videos">
<file>video_delete.png</file> <file>video_delete.png</file>
<file>video_load.png</file> <file>video_load.png</file>
</qresource> </qresource>
<qresource prefix="images" > <qresource prefix="images">
<file>image_delete.png</file> <file>image_delete.png</file>
<file>image_load.png</file> <file>image_load.png</file>
</qresource> </qresource>
<qresource prefix="services" > <qresource prefix="services">
<file>service_edit.png</file>
<file>service_notes.png</file>
<file>service_bottom.png</file> <file>service_bottom.png</file>
<file>service_down.png</file> <file>service_down.png</file>
<file>service_top.png</file> <file>service_top.png</file>
@ -85,7 +87,7 @@
<file>service_open.png</file> <file>service_open.png</file>
<file>service_save.png</file> <file>service_save.png</file>
</qresource> </qresource>
<qresource prefix="system" > <qresource prefix="system">
<file>system_close.png</file> <file>system_close.png</file>
<file>system_about.png</file> <file>system_about.png</file>
<file>system_help_contents.png</file> <file>system_help_contents.png</file>
@ -99,7 +101,7 @@
<file>system_exit.png</file> <file>system_exit.png</file>
<file>system_settings.png</file> <file>system_settings.png</file>
</qresource> </qresource>
<qresource prefix="media" > <qresource prefix="media">
<file>media_custom.png</file> <file>media_custom.png</file>
<file>media_presentation.png</file> <file>media_presentation.png</file>
<file>media_image.png</file> <file>media_image.png</file>
@ -110,16 +112,16 @@
<file>media_stop.png</file> <file>media_stop.png</file>
<file>image_clapperboard.png</file> <file>image_clapperboard.png</file>
</qresource> </qresource>
<qresource prefix="messagebox" > <qresource prefix="messagebox">
<file>messagebox_critical.png</file> <file>messagebox_critical.png</file>
<file>messagebox_info.png</file> <file>messagebox_info.png</file>
<file>messagebox_warning.png</file> <file>messagebox_warning.png</file>
</qresource> </qresource>
<qresource prefix="tools" > <qresource prefix="tools">
<file>tools_add.png</file> <file>tools_add.png</file>
<file>tools_alert.png</file> <file>tools_alert.png</file>
</qresource> </qresource>
<qresource prefix="themes" > <qresource prefix="themes">
<file>theme_delete.png</file> <file>theme_delete.png</file>
<file>theme_new.png</file> <file>theme_new.png</file>
<file>theme_edit.png</file> <file>theme_edit.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

After

Width:  |  Height:  |  Size: 726 B

View File

@ -1 +1 @@
1.9.0-718 1.9.0-723