forked from openlp/openlp
EventManager Removal - complete
This commit is contained in:
parent
49a424abd1
commit
63f67ea756
@ -60,12 +60,9 @@ def contextMenuSeparator(base):
|
|||||||
from settingsmanager import SettingsManager
|
from settingsmanager import SettingsManager
|
||||||
from pluginconfig import PluginConfig
|
from pluginconfig import PluginConfig
|
||||||
from plugin import Plugin
|
from plugin import Plugin
|
||||||
from eventmanager import EventManager
|
|
||||||
from pluginmanager import PluginManager
|
from pluginmanager import PluginManager
|
||||||
from settingstab import SettingsTab
|
from settingstab import SettingsTab
|
||||||
from mediamanageritem import MediaManagerItem
|
from mediamanageritem import MediaManagerItem
|
||||||
from event import Event
|
|
||||||
from event import EventType
|
|
||||||
from xmlrootclass import XmlRootClass
|
from xmlrootclass import XmlRootClass
|
||||||
from serviceitem import ServiceItem
|
from serviceitem import ServiceItem
|
||||||
from eventreceiver import Receiver
|
from eventreceiver import Receiver
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80
|
|
||||||
"""
|
|
||||||
OpenLP - Open Source Lyrics Projection
|
|
||||||
|
|
||||||
Copyright (c) 2008 Raoul Snyman
|
|
||||||
|
|
||||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Scott Guerreri,
|
|
||||||
Carsten Tingaard, Jonathan Corwin
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
|
||||||
the terms of the GNU General Public License as published by the Free Software
|
|
||||||
Foundation; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with
|
|
||||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
"""
|
|
||||||
|
|
||||||
class EventType(object):
|
|
||||||
"""
|
|
||||||
Types of events are stored in this class.
|
|
||||||
"""
|
|
||||||
# "Default" event - a non-event
|
|
||||||
Default = 0
|
|
||||||
#TriggerAlert = 1
|
|
||||||
# General application events
|
|
||||||
# Ready = 10
|
|
||||||
# Service events
|
|
||||||
#LoadServiceItem = 20
|
|
||||||
# Preview events
|
|
||||||
#PreviewShow = 30
|
|
||||||
#LiveShow = 31
|
|
||||||
#Theme Related Events
|
|
||||||
#ThemeListChanged = 40
|
|
||||||
#Plugin Related Events
|
|
||||||
#LoadSongList = 50
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Event(object):
|
|
||||||
"""
|
|
||||||
Provides an Event class to encapsulate events within openlp.org.
|
|
||||||
"""
|
|
||||||
def __init__(self, sender, event_type=EventType.Default, payload=None):
|
|
||||||
self.event_type = event_type
|
|
||||||
self.payload = payload
|
|
||||||
self.sender = sender
|
|
@ -1,72 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80
|
|
||||||
"""
|
|
||||||
OpenLP - Open Source Lyrics Projection
|
|
||||||
|
|
||||||
Copyright (c) 2008 Raoul Snyman
|
|
||||||
|
|
||||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Scott Guerreri,
|
|
||||||
Carsten Tingaard, Jonathan Corwin
|
|
||||||
|
|
||||||
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 os
|
|
||||||
import logging
|
|
||||||
|
|
||||||
class EventManager(object):
|
|
||||||
"""
|
|
||||||
A mechanism to send events to all registered endpoints. The
|
|
||||||
endpoints are registered and listen with a handle_event method.
|
|
||||||
The endpoint will decide whether to do somthing with the event or
|
|
||||||
ignore it.
|
|
||||||
"""
|
|
||||||
global log
|
|
||||||
log = logging.getLogger(u'EventManager')
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
"""
|
|
||||||
Defines the class and a list of endpoints
|
|
||||||
"""
|
|
||||||
self.endpoints = []
|
|
||||||
log.info(u'Initialising')
|
|
||||||
self.processing = False
|
|
||||||
self.events = []
|
|
||||||
|
|
||||||
def register(self, plugin):
|
|
||||||
"""
|
|
||||||
Called by plugings who wish to receive event notifications
|
|
||||||
"""
|
|
||||||
log.debug(u'Class %s registered with EventManager', plugin)
|
|
||||||
self.endpoints.append(plugin)
|
|
||||||
|
|
||||||
def post_event(self, event):
|
|
||||||
"""
|
|
||||||
Called by any part of the system which wants send events to the plugins
|
|
||||||
|
|
||||||
``event``
|
|
||||||
The event type to be triggered
|
|
||||||
|
|
||||||
"""
|
|
||||||
log.debug(u'post event called for event %s (%s)', event.event_type, event.sender)
|
|
||||||
self.events.append(event)
|
|
||||||
if not self.processing:
|
|
||||||
self.processing = True
|
|
||||||
while len(self.events) > 0:
|
|
||||||
pEvent = self.events[0]
|
|
||||||
for point in self.endpoints:
|
|
||||||
status = point.handle_event(pEvent)
|
|
||||||
#if call returns true message is finished with
|
|
||||||
if status is not None and status :
|
|
||||||
break
|
|
||||||
self.events.remove(pEvent)
|
|
||||||
self.processing = False
|
|
@ -47,6 +47,8 @@ class EventReceiver(QtCore.QObject):
|
|||||||
send out message with new themes
|
send out message with new themes
|
||||||
``update_global_theme ``
|
``update_global_theme ``
|
||||||
Tell the components we have a new global theme
|
Tell the components we have a new global theme
|
||||||
|
``load_song_list``
|
||||||
|
Tells the the song plugin to reload the song list
|
||||||
|
|
||||||
"""
|
"""
|
||||||
global log
|
global log
|
||||||
@ -57,7 +59,6 @@ class EventReceiver(QtCore.QObject):
|
|||||||
|
|
||||||
def send_message(self, event, msg=None):
|
def send_message(self, event, msg=None):
|
||||||
log.debug(u'Event %s passed with payload %s' % (event, msg))
|
log.debug(u'Event %s passed with payload %s' % (event, msg))
|
||||||
print u'message ', event, msg
|
|
||||||
self.emit(QtCore.SIGNAL(event), msg)
|
self.emit(QtCore.SIGNAL(event), msg)
|
||||||
|
|
||||||
class Receiver():
|
class Receiver():
|
||||||
|
@ -25,7 +25,6 @@ from openlp.core.lib import PluginConfig
|
|||||||
# why does this not work???
|
# why does this not work???
|
||||||
# from openlp.core.lib import Event, EventType
|
# from openlp.core.lib import Event, EventType
|
||||||
# so I have to do this???
|
# so I have to do this???
|
||||||
from event import Event, EventType
|
|
||||||
from eventreceiver import Receiver
|
from eventreceiver import Receiver
|
||||||
|
|
||||||
class Plugin(object):
|
class Plugin(object):
|
||||||
@ -124,7 +123,6 @@ class Plugin(object):
|
|||||||
self.log = logging.getLogger(self.name)
|
self.log = logging.getLogger(self.name)
|
||||||
self.preview_controller = plugin_helpers[u'preview']
|
self.preview_controller = plugin_helpers[u'preview']
|
||||||
self.live_controller = plugin_helpers[u'live']
|
self.live_controller = plugin_helpers[u'live']
|
||||||
self.event_manager = plugin_helpers[u'event']
|
|
||||||
self.render_manager = plugin_helpers[u'render']
|
self.render_manager = plugin_helpers[u'render']
|
||||||
self.service_manager = plugin_helpers[u'service']
|
self.service_manager = plugin_helpers[u'service']
|
||||||
self.settings = plugin_helpers[u'settings']
|
self.settings = plugin_helpers[u'settings']
|
||||||
@ -185,32 +183,8 @@ class Plugin(object):
|
|||||||
Proxy method as method is not defined early enough
|
Proxy method as method is not defined early enough
|
||||||
in the processing
|
in the processing
|
||||||
"""
|
"""
|
||||||
log.debug(u'Handle event called with plugin %s' % self.name)
|
log.debug(u'process_add_service_event event called for plugin %s' % self.name)
|
||||||
self.media_item.onAddClick()
|
self.media_item.onAddClick()
|
||||||
def handle_event(self, event):
|
|
||||||
# """
|
|
||||||
# Handle the event contained in the event object. If you want
|
|
||||||
# to use this default behaviour, you must set self.dnd_id equal
|
|
||||||
# to that sent by the dnd source - eg the MediaItem
|
|
||||||
#
|
|
||||||
# ``event``
|
|
||||||
# An object describing the event.
|
|
||||||
# """
|
|
||||||
# # default behaviour - can be overridden if desired
|
|
||||||
pass
|
|
||||||
# log.debug(u'Handle event called with event %s with payload %s'%(event.event_type, event.payload))
|
|
||||||
# if event.event_type == EventType.LoadServiceItem and event.payload == self.dnd_id:
|
|
||||||
# log.debug(u'Load Service Item received')
|
|
||||||
# self.media_item.onAddClick()
|
|
||||||
# return True
|
|
||||||
# if event.event_type == EventType.PreviewShow and event.payload == self.dnd_id:
|
|
||||||
# log.debug(u'Load Preview Item received')
|
|
||||||
# self.media_item.onPreviewClick()
|
|
||||||
# return True
|
|
||||||
# if event.event_type == EventType.LiveShow and event.payload == self.dnd_id:
|
|
||||||
# log.debug(u'Load Live Show Item received')
|
|
||||||
# return True
|
|
||||||
# self.media_item.onLiveClick()
|
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
"""
|
"""
|
||||||
@ -219,38 +193,6 @@ class Plugin(object):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# def save(self, data):
|
|
||||||
# """
|
|
||||||
# Service item data is passed to this function, which should return a
|
|
||||||
# string which can be written to the service file.
|
|
||||||
#
|
|
||||||
# ``data``
|
|
||||||
# The data to be saved.
|
|
||||||
# """
|
|
||||||
# pass
|
|
||||||
#
|
|
||||||
# def load(self, string):
|
|
||||||
# """
|
|
||||||
# A string from the service file is passed in. This function parses and
|
|
||||||
# sets up the internals of the plugin.
|
|
||||||
#
|
|
||||||
# ``string``
|
|
||||||
# The data to be loaded into the plugin.
|
|
||||||
# """
|
|
||||||
# pass
|
|
||||||
#
|
|
||||||
# def render(self, theme, screen=None):
|
|
||||||
# """
|
|
||||||
# Render the screenth screenful of data using theme settings in theme.
|
|
||||||
#
|
|
||||||
# ``theme``
|
|
||||||
# The theme to use when rendering.
|
|
||||||
#
|
|
||||||
# ``screen``
|
|
||||||
# Defaults to *None*. The screen to render to.
|
|
||||||
# """
|
|
||||||
# pass
|
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
"""
|
"""
|
||||||
Called by the plugin Manager to initialise anything it needs.
|
Called by the plugin Manager to initialise anything it needs.
|
||||||
|
@ -21,7 +21,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, EventManager
|
from openlp.core.lib import Plugin
|
||||||
|
|
||||||
class PluginManager(object):
|
class PluginManager(object):
|
||||||
"""
|
"""
|
||||||
@ -50,7 +50,7 @@ class PluginManager(object):
|
|||||||
# this has to happen after the UI is sorted self.find_plugins(dir)
|
# this has to happen after the UI is sorted self.find_plugins(dir)
|
||||||
log.info(u'Plugin manager done init')
|
log.info(u'Plugin manager done init')
|
||||||
|
|
||||||
def find_plugins(self, dir, plugin_helpers, eventmanager):
|
def find_plugins(self, dir, plugin_helpers):
|
||||||
"""
|
"""
|
||||||
Scan the directory dir for objects inheriting from ``openlp.plugin``.
|
Scan the directory dir for objects inheriting from ``openlp.plugin``.
|
||||||
|
|
||||||
@ -60,8 +60,6 @@ class PluginManager(object):
|
|||||||
``plugin_helpers``
|
``plugin_helpers``
|
||||||
A list of helper objects to pass to the plugins.
|
A list of helper objects to pass to the plugins.
|
||||||
|
|
||||||
``eventmanager``
|
|
||||||
The event manager to pass to the plugins.
|
|
||||||
"""
|
"""
|
||||||
self.plugin_helpers = plugin_helpers
|
self.plugin_helpers = plugin_helpers
|
||||||
startdepth = len(os.path.abspath(dir).split(os.sep))
|
startdepth = len(os.path.abspath(dir).split(os.sep))
|
||||||
@ -103,11 +101,9 @@ class PluginManager(object):
|
|||||||
pList = {u'plugin': plugin, u'status': u'Inactive'}
|
pList = {u'plugin': plugin, u'status': u'Inactive'}
|
||||||
if plugin.check_pre_conditions():
|
if plugin.check_pre_conditions():
|
||||||
log.debug(u'Plugin %s active', unicode(plugin.name))
|
log.debug(u'Plugin %s active', unicode(plugin.name))
|
||||||
eventmanager.register(plugin)
|
|
||||||
pList[u'status'] = u'Active'
|
pList[u'status'] = u'Active'
|
||||||
self.plugins.append(pList)
|
self.plugins.append(pList)
|
||||||
|
|
||||||
|
|
||||||
def order_by_weight(self, x, y):
|
def order_by_weight(self, x, y):
|
||||||
"""
|
"""
|
||||||
Sort two plugins and order them by their weight.
|
Sort two plugins and order them by their weight.
|
||||||
|
@ -32,11 +32,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||||||
def __init__(self, thememanager, parent=None):
|
def __init__(self, thememanager, parent=None):
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, parent)
|
||||||
self.thememanager = thememanager
|
self.thememanager = thememanager
|
||||||
# Needed here as UI setup generates Events
|
|
||||||
self.path = None
|
self.path = None
|
||||||
self.theme = ThemeXML()
|
self.theme = ThemeXML()
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
#define signals
|
#define signals
|
||||||
#Buttons
|
#Buttons
|
||||||
QtCore.QObject.connect(self.Color1PushButton ,
|
QtCore.QObject.connect(self.Color1PushButton ,
|
||||||
|
@ -21,7 +21,7 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from openlp.core.lib import translate, EventManager, Event, EventType, Receiver
|
from openlp.core.lib import translate, Receiver
|
||||||
|
|
||||||
class MainDisplay(QtGui.QWidget):
|
class MainDisplay(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
@ -58,20 +58,10 @@ class MainDisplay(QtGui.QWidget):
|
|||||||
self.alertactive = False
|
self.alertactive = False
|
||||||
self.alertTab = None
|
self.alertTab = None
|
||||||
self.timer_id = 0
|
self.timer_id = 0
|
||||||
# Register the main form as an event consumer.
|
|
||||||
self.parent.EventManager.register(self)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'live_slide_blank'), self.blankDisplay)
|
QtCore.SIGNAL(u'live_slide_blank'), self.blankDisplay)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
def handle_event(self, event):
|
QtCore.SIGNAL(u'alert_text'), self.displayAlert)
|
||||||
"""
|
|
||||||
Accept Events for the system and If It's for Alert
|
|
||||||
action it and Return true to stop futher processing
|
|
||||||
"""
|
|
||||||
log.debug(u'MainDisplay received event %s with payload %s'%(event.event_type, event.payload))
|
|
||||||
if event.event_type == EventType.TriggerAlert:
|
|
||||||
self.displayAlert(event.payload)
|
|
||||||
return True
|
|
||||||
|
|
||||||
def setup(self, screenNumber):
|
def setup(self, screenNumber):
|
||||||
"""
|
"""
|
||||||
|
@ -26,8 +26,8 @@ from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
|
|||||||
ServiceManager, ThemeManager, MainDisplay, SlideController, \
|
ServiceManager, ThemeManager, MainDisplay, SlideController, \
|
||||||
PluginForm
|
PluginForm
|
||||||
from openlp.core.lib import translate, Plugin, MediaManagerItem, \
|
from openlp.core.lib import translate, Plugin, MediaManagerItem, \
|
||||||
SettingsTab, EventManager, RenderManager, PluginConfig, \
|
SettingsTab, RenderManager, PluginConfig, \
|
||||||
SettingsManager, PluginManager, EventType, Receiver
|
SettingsManager, PluginManager, Receiver
|
||||||
|
|
||||||
class Ui_MainWindow(object):
|
class Ui_MainWindow(object):
|
||||||
def setupUi(self, MainWindow):
|
def setupUi(self, MainWindow):
|
||||||
@ -416,7 +416,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
self.screenList = screens
|
self.screenList = screens
|
||||||
self.oosNotSaved = False
|
self.oosNotSaved = False
|
||||||
self.settingsmanager = SettingsManager(screens)
|
self.settingsmanager = SettingsManager(screens)
|
||||||
self.EventManager = EventManager()
|
|
||||||
self.mainDisplay = MainDisplay(self, screens)
|
self.mainDisplay = MainDisplay(self, screens)
|
||||||
self.generalConfig = PluginConfig(u'General')
|
self.generalConfig = PluginConfig(u'General')
|
||||||
self.alertForm = AlertForm(self)
|
self.alertForm = AlertForm(self)
|
||||||
@ -469,12 +468,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
#make the controllers available to the plugins
|
#make the controllers available to the plugins
|
||||||
self.plugin_helpers[u'preview'] = self.PreviewController
|
self.plugin_helpers[u'preview'] = self.PreviewController
|
||||||
self.plugin_helpers[u'live'] = self.LiveController
|
self.plugin_helpers[u'live'] = self.LiveController
|
||||||
self.plugin_helpers[u'event'] = self.EventManager
|
|
||||||
self.plugin_helpers[u'render'] = self.RenderManager
|
self.plugin_helpers[u'render'] = self.RenderManager
|
||||||
self.plugin_helpers[u'service'] = self.ServiceManagerContents
|
self.plugin_helpers[u'service'] = self.ServiceManagerContents
|
||||||
self.plugin_helpers[u'settings'] = self.settingsForm
|
self.plugin_helpers[u'settings'] = self.settingsForm
|
||||||
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers,
|
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
|
||||||
self.EventManager)
|
|
||||||
# hook methods have to happen after find_plugins. Find plugins needs the
|
# hook methods have to happen after find_plugins. Find plugins needs the
|
||||||
# controllers hence the hooks have moved from setupUI() to here
|
# controllers hence the hooks have moved from setupUI() to here
|
||||||
|
|
||||||
@ -492,8 +489,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
# Call the initialise method to setup plugins.
|
# Call the initialise method to setup plugins.
|
||||||
log.info(u'initialise plugins')
|
log.info(u'initialise plugins')
|
||||||
self.plugin_manager.initialise_plugins()
|
self.plugin_manager.initialise_plugins()
|
||||||
# Register the main form as an event consumer.
|
|
||||||
self.EventManager.register(self)
|
|
||||||
# Once all components are initialised load the Themes
|
# Once all components are initialised load the Themes
|
||||||
log.info(u'Load Themes')
|
log.info(u'Load Themes')
|
||||||
self.ThemeManagerContents.loadThemes()
|
self.ThemeManagerContents.loadThemes()
|
||||||
|
@ -28,8 +28,8 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.ui import AmendThemeForm, ServiceManager
|
from openlp.core.ui import AmendThemeForm, ServiceManager
|
||||||
from openlp.core.theme import Theme
|
from openlp.core.theme import Theme
|
||||||
from openlp.core.lib import PluginConfig, Event, EventType, \
|
from openlp.core.lib import PluginConfig, \
|
||||||
EventManager, OpenLPToolbar, ThemeXML, Renderer, translate, \
|
OpenLPToolbar, ThemeXML, Renderer, translate, \
|
||||||
file_to_xml, buildIcon, Receiver
|
file_to_xml, buildIcon, Receiver
|
||||||
from openlp.core.utils import ConfigHelper
|
from openlp.core.utils import ConfigHelper
|
||||||
|
|
||||||
@ -116,6 +116,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
name = u'%s (%s)' % (self.global_theme, translate(u'ThemeManager', u'default'))
|
name = u'%s (%s)' % (self.global_theme, translate(u'ThemeManager', u'default'))
|
||||||
self.ThemeListWidget.item(count).setText(name)
|
self.ThemeListWidget.item(count).setText(name)
|
||||||
self.config.set_config(u'theme global theme', self.global_theme)
|
self.config.set_config(u'theme global theme', self.global_theme)
|
||||||
|
Receiver().send_message(u'update_global_theme', self.global_theme )
|
||||||
self.pushThemes()
|
self.pushThemes()
|
||||||
|
|
||||||
def onAddTheme(self):
|
def onAddTheme(self):
|
||||||
|
@ -22,7 +22,7 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from PyQt4.QtCore import *
|
from PyQt4.QtCore import *
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, Event, EventType, translate
|
from openlp.core.lib import Plugin, translate
|
||||||
|
|
||||||
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
|
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from forms import EditCustomForm
|
from forms import EditCustomForm
|
||||||
from openlp.core.lib import Plugin, Event, EventType
|
from openlp.core.lib import Plugin
|
||||||
from openlp.plugins.custom.lib import CustomManager, CustomTab, CustomMediaItem
|
from openlp.plugins.custom.lib import CustomManager, CustomTab, CustomMediaItem
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, Event, EventType
|
from openlp.core.lib import Plugin
|
||||||
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
||||||
|
|
||||||
class ImagePlugin(Plugin):
|
class ImagePlugin(Plugin):
|
||||||
|
@ -22,7 +22,7 @@ import sys
|
|||||||
|
|
||||||
from PyQt4 import QtNetwork, QtGui, QtCore
|
from PyQt4 import QtNetwork, QtGui, QtCore
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, Event, EventType, 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):
|
class RemotesPlugin(Plugin):
|
||||||
@ -58,7 +58,7 @@ class RemotesPlugin(Plugin):
|
|||||||
event = unicode(datagram[:pos].lower())
|
event = unicode(datagram[:pos].lower())
|
||||||
|
|
||||||
if event == u'alert':
|
if event == u'alert':
|
||||||
self.event_manager.post_event(Event(u'RemotePlugin', EventType.TriggerAlert , unicode(datagram[pos + 1:])))
|
Receiver().send_message(u'alert_text', unicode(datagram[pos + 1:]))
|
||||||
if event == u'next_slide':
|
if event == u'next_slide':
|
||||||
Receiver().send_message(u'live_slide_next')
|
Receiver().send_message(u'live_slide_next')
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import Qt, QtCore, QtGui
|
from PyQt4 import Qt, QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SongXMLBuilder, SongXMLParser, Event, \
|
from openlp.core.lib import SongXMLBuilder, SongXMLParser, \
|
||||||
EventType, EventManager, translate, Receiver
|
translate, Receiver
|
||||||
from openlp.plugins.songs.forms import EditVerseForm
|
from openlp.plugins.songs.forms import EditVerseForm
|
||||||
from openlp.plugins.songs.lib.models import Song
|
from openlp.plugins.songs.lib.models import Song
|
||||||
from editsongdialog import Ui_EditSongDialog
|
from editsongdialog import Ui_EditSongDialog
|
||||||
@ -36,7 +36,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
log = logging.getLogger(u'EditSongForm')
|
log = logging.getLogger(u'EditSongForm')
|
||||||
log.info(u'Song Editor loaded')
|
log.info(u'Song Editor loaded')
|
||||||
|
|
||||||
def __init__(self, songmanager, eventmanager, parent=None):
|
def __init__(self, songmanager, parent=None):
|
||||||
"""
|
"""
|
||||||
Constructor
|
Constructor
|
||||||
"""
|
"""
|
||||||
@ -75,7 +75,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
QtCore.SIGNAL(u'update_themes'), self.loadThemes)
|
QtCore.SIGNAL(u'update_themes'), self.loadThemes)
|
||||||
# Create other objects and forms
|
# Create other objects and forms
|
||||||
self.songmanager = songmanager
|
self.songmanager = songmanager
|
||||||
self.eventmanager = eventmanager
|
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.verse_form = EditVerseForm()
|
self.verse_form = EditVerseForm()
|
||||||
self.initialise()
|
self.initialise()
|
||||||
@ -366,7 +365,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.processTitle()
|
self.processTitle()
|
||||||
self.songmanager.save_song(self.song)
|
self.songmanager.save_song(self.song)
|
||||||
if self.title_change:
|
if self.title_change:
|
||||||
self.eventmanager.post_event(Event(u'EditSongForm', EventType.LoadSongList))
|
Receiver().send_message(u'load_song_list')
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def processLyrics(self):
|
def processLyrics(self):
|
||||||
|
@ -22,7 +22,8 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, translate, ServiceItem, \
|
from openlp.core.lib import MediaManagerItem, translate, ServiceItem, \
|
||||||
SongXMLParser, contextMenuAction, contextMenuSeparator, BaseListWithDnD
|
SongXMLParser, contextMenuAction, contextMenuSeparator, BaseListWithDnD, \
|
||||||
|
Receiver
|
||||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm
|
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm
|
||||||
|
|
||||||
class SongListView(BaseListWithDnD):
|
class SongListView(BaseListWithDnD):
|
||||||
@ -43,7 +44,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.PluginTextShort = u'Song'
|
self.PluginTextShort = u'Song'
|
||||||
self.ConfigSection = u'song'
|
self.ConfigSection = u'song'
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
self.edit_song_form = EditSongForm(self.parent.songmanager, self.parent.event_manager, self)
|
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
|
||||||
self.song_maintenance_form = SongMaintenanceForm(self.parent.songmanager, self)
|
self.song_maintenance_form = SongMaintenanceForm(self.parent.songmanager, self)
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
@ -127,6 +128,9 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
QtCore.SIGNAL(u'textChanged(const QString&)'), self.onSearchTextEditChanged)
|
QtCore.SIGNAL(u'textChanged(const QString&)'), self.onSearchTextEditChanged)
|
||||||
QtCore.QObject.connect(self.ListView,
|
QtCore.QObject.connect(self.ListView,
|
||||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onSongPreviewClick)
|
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onSongPreviewClick)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'load_song_list'), self.onSearchTextButtonClick)
|
||||||
|
|
||||||
#define and add the context menu
|
#define and add the context menu
|
||||||
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
self.ListView.addAction(contextMenuAction(self.ListView,
|
self.ListView.addAction(contextMenuAction(self.ListView,
|
||||||
|
@ -22,7 +22,7 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, Event, EventType, translate
|
from openlp.core.lib import Plugin, translate
|
||||||
from openlp.plugins.songs.lib import SongManager, SongsTab, SongMediaItem
|
from openlp.plugins.songs.lib import SongManager, SongsTab, SongMediaItem
|
||||||
from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
|
from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
|
||||||
OpenSongImportForm, OpenLPExportForm
|
OpenSongImportForm, OpenLPExportForm
|
||||||
@ -126,13 +126,3 @@ class SongsPlugin(Plugin):
|
|||||||
|
|
||||||
def onExportOpenSongItemClicked(self):
|
def onExportOpenSongItemClicked(self):
|
||||||
self.opensong_export_form.show()
|
self.opensong_export_form.show()
|
||||||
|
|
||||||
def handle_event(self, event):
|
|
||||||
"""
|
|
||||||
Handle the event contained in the event object.
|
|
||||||
"""
|
|
||||||
log.debug(u'Handle event called with event %s' % event.event_type)
|
|
||||||
if event.event_type == EventType.LoadSongList :
|
|
||||||
log.debug(u'Load Load Song List Item received')
|
|
||||||
self.media_item.displayResultsSong(self.songmanager.get_songs())
|
|
||||||
return Plugin.handle_event(self, event)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user