forked from openlp/openlp
Presentations - service item handling
This commit is contained in:
parent
f4a8d8b52a
commit
3784838a36
@ -54,6 +54,10 @@ class EventReceiver(QtCore.QObject):
|
|||||||
``request_spin_delay``
|
``request_spin_delay``
|
||||||
Requests a spin delay
|
Requests a spin delay
|
||||||
|
|
||||||
|
``{plugin}_start``
|
||||||
|
Requests a plugin to start a external program
|
||||||
|
Path and file provided in message
|
||||||
|
|
||||||
"""
|
"""
|
||||||
global log
|
global log
|
||||||
log = logging.getLogger(u'EventReceiver')
|
log = logging.getLogger(u'EventReceiver')
|
||||||
|
@ -51,6 +51,7 @@ class ServiceItem(object):
|
|||||||
if hostplugin is not None:
|
if hostplugin is not None:
|
||||||
self.RenderManager = self.plugin.render_manager
|
self.RenderManager = self.plugin.render_manager
|
||||||
self.shortname = hostplugin.name
|
self.shortname = hostplugin.name
|
||||||
|
self.name = self.plugin.name
|
||||||
self.title = u''
|
self.title = u''
|
||||||
self.items = []
|
self.items = []
|
||||||
self.iconic_representation = None
|
self.iconic_representation = None
|
||||||
@ -158,6 +159,7 @@ class ServiceItem(object):
|
|||||||
file to represent this item.
|
file to represent this item.
|
||||||
"""
|
"""
|
||||||
oos_header = {
|
oos_header = {
|
||||||
|
u'name': self.name.lower(),
|
||||||
u'plugin': self.shortname,
|
u'plugin': self.shortname,
|
||||||
u'theme':self.theme,
|
u'theme':self.theme,
|
||||||
u'title':self.title,
|
u'title':self.title,
|
||||||
@ -190,6 +192,7 @@ class ServiceItem(object):
|
|||||||
"""
|
"""
|
||||||
header = serviceitem[u'serviceitem'][u'header']
|
header = serviceitem[u'serviceitem'][u'header']
|
||||||
self.title = header[u'title']
|
self.title = header[u'title']
|
||||||
|
self.name = header[u'name']
|
||||||
self.service_item_type = header[u'type']
|
self.service_item_type = header[u'type']
|
||||||
self.shortname = header[u'plugin']
|
self.shortname = header[u'plugin']
|
||||||
self.theme = header[u'theme']
|
self.theme = header[u'theme']
|
||||||
|
@ -18,6 +18,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import cPickle
|
import cPickle
|
||||||
import zipfile
|
import zipfile
|
||||||
@ -409,6 +410,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
#if not present do not worry
|
#if not present do not worry
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
|
log.error(u'Problem processing oos load %s', sys.exc_info()[0])
|
||||||
pass
|
pass
|
||||||
self.serviceName = name[len(name) - 1]
|
self.serviceName = name[len(name) - 1]
|
||||||
self.parent.OosChanged(True, self.serviceName)
|
self.parent.OosChanged(True, self.serviceName)
|
||||||
|
@ -231,7 +231,11 @@ class SlideController(QtGui.QWidget):
|
|||||||
log.debug(u'addServiceItem')
|
log.debug(u'addServiceItem')
|
||||||
item.render()
|
item.render()
|
||||||
self.enableToolBar(item)
|
self.enableToolBar(item)
|
||||||
self.displayServiceManagerItems(item, 0)
|
if item.service_item_type == ServiceType.Command:
|
||||||
|
Receiver().send_message(u'%s_start'%item.name.lower(), \
|
||||||
|
u'%s:%s:%s' % (item.shortname, item.service_item_path, item.service_frames[0][u'title']))
|
||||||
|
else:
|
||||||
|
self.displayServiceManagerItems(item, 0)
|
||||||
|
|
||||||
def addServiceManagerItem(self, item, slideno):
|
def addServiceManagerItem(self, item, slideno):
|
||||||
"""
|
"""
|
||||||
@ -241,7 +245,11 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'addServiceItem')
|
log.debug(u'addServiceItem')
|
||||||
self.enableToolBar(item)
|
self.enableToolBar(item)
|
||||||
self.displayServiceManagerItems(item, slideno)
|
if item.service_item_type == ServiceType.Command:
|
||||||
|
Receiver().send_message(u'%s_start'%item.name.lower(), \
|
||||||
|
u'%s:%s:%s' % (item.shortname, item.service_item_path, item.service_frames[0][u'title']))
|
||||||
|
else:
|
||||||
|
self.displayServiceManagerItems(item, slideno)
|
||||||
|
|
||||||
def displayServiceManagerItems(self, serviceitem, slideno):
|
def displayServiceManagerItems(self, serviceitem, slideno):
|
||||||
"""
|
"""
|
||||||
|
@ -17,8 +17,11 @@ 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
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
|
from impresscontroller import ImpressController
|
||||||
|
from messagelistener import MessageListener
|
||||||
from mediaitem import PresentationMediaItem
|
from mediaitem import PresentationMediaItem
|
||||||
from presentationtab import PresentationTab
|
from presentationtab import PresentationTab
|
||||||
from impresscontroller import impressController
|
|
||||||
|
|
||||||
__all__ = ['PresentationMediaItem', 'PresentationTab', 'impressController']
|
|
||||||
|
__all__ = ['PresentationMediaItem', 'PresentationTab',
|
||||||
|
'ImpressController', 'MessageListener']
|
||||||
|
@ -34,7 +34,7 @@ import uno
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
|
|
||||||
class impressController(object):
|
class ImpressController(object):
|
||||||
global log
|
global log
|
||||||
log = logging.getLogger(u'ImpressController')
|
log = logging.getLogger(u'ImpressController')
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD
|
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD
|
||||||
|
from openlp.plugins.presentations.lib import MessageListener
|
||||||
|
|
||||||
# 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.
|
||||||
@ -54,6 +55,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
# be instanced by the base MediaManagerItem
|
# be instanced by the base MediaManagerItem
|
||||||
self.ListViewWithDnD_class = PresentationListView
|
self.ListViewWithDnD_class = PresentationListView
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
|
self.message_listener = MessageListener(controllers)
|
||||||
|
|
||||||
def addHeaderBar(self):
|
def addHeaderBar(self):
|
||||||
self.PresentationWidget = QtGui.QWidget(self)
|
self.PresentationWidget = QtGui.QWidget(self)
|
||||||
|
37
openlp/plugins/presentations/lib/messagelistener.py
Normal file
37
openlp/plugins/presentations/lib/messagelistener.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
|
"""
|
||||||
|
OpenLP - Open Source Lyrics Projection
|
||||||
|
Copyright (c) 2008 Raoul Snyman
|
||||||
|
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; version 2 of the License.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
"""
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
|
from openlp.core.lib import Receiver
|
||||||
|
from openlp.plugins.presentations.lib import ImpressController
|
||||||
|
|
||||||
|
class MessageListener(object):
|
||||||
|
"""
|
||||||
|
This is the Presentation listener who acts on events from the slide controller
|
||||||
|
and passes the messages on the the correct presentation handlers
|
||||||
|
"""
|
||||||
|
global log
|
||||||
|
log=logging.getLogger(u'MessageListener')
|
||||||
|
log.info(u'Message Listener loaded')
|
||||||
|
|
||||||
|
def __init__(self, controllers):
|
||||||
|
self.controllers = controllers
|
||||||
|
print controllers
|
@ -25,7 +25,7 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, MediaManagerItem
|
from openlp.core.lib import Plugin, MediaManagerItem
|
||||||
from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab, impressController
|
from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab, ImpressController
|
||||||
|
|
||||||
class PresentationPlugin(Plugin):
|
class PresentationPlugin(Plugin):
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class PresentationPlugin(Plugin):
|
|||||||
try:
|
try:
|
||||||
#Check to see if we have uno installed
|
#Check to see if we have uno installed
|
||||||
import uno
|
import uno
|
||||||
openoffice = impressController()
|
openoffice = ImpressController()
|
||||||
self.registerControllers(u'Impress', openoffice)
|
self.registerControllers(u'Impress', openoffice)
|
||||||
except:
|
except:
|
||||||
log.error(u'Reason : %s', sys.exc_info()[0])
|
log.error(u'Reason : %s', sys.exc_info()[0])
|
||||||
|
Loading…
Reference in New Issue
Block a user