Bye Bye Event Receiver

This commit is contained in:
Tim Bentley 2013-02-07 08:42:17 +00:00
parent fae34b1b4d
commit c90d45ca73
46 changed files with 219 additions and 483 deletions

View File

@ -43,7 +43,7 @@ from traceback import format_exception
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, Settings, ScreenList, UiStrings, Registry, check_directory_exists
from openlp.core.lib import Settings, ScreenList, UiStrings, Registry, check_directory_exists
from openlp.core.resources import qInitResources
from openlp.core.ui.mainwindow import MainWindow
from openlp.core.ui.firsttimelanguageform import FirstTimeLanguageForm
@ -150,7 +150,7 @@ class OpenLP(QtGui.QApplication):
update_check = Settings().value(u'general/update check')
if update_check:
VersionThread(self.main_window).start()
Receiver.send_message(u'live_display_blank_check')
self.main_window.blank_check()
self.main_window.app_startup()
return self.exec_()

View File

@ -387,7 +387,6 @@ def create_separated_list(stringlist):
from registry import Registry
from uistrings import UiStrings
from eventreceiver import Receiver
from screen import ScreenList
from settings import Settings
from listwidgetwithdnd import ListWidgetWithDnD

View File

@ -1,227 +0,0 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2013 Raoul Snyman #
# Portions copyright (c) 2008-2013 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# 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 #
###############################################################################
"""
Provide event handling code for OpenLP
"""
import logging
from PyQt4 import QtCore
log = logging.getLogger(__name__)
class EventReceiver(QtCore.QObject):
"""
Class to allow events to be passed from different parts of the system. This
is a private class and should not be used directly but rather via the
Receiver class.
**Mainwindow related and generic signals**
``openlp_stop_wizard``
Stops a wizard before completion.
**Setting related signals**
**Slidecontroller signals**
``slidecontroller_{live|preview}_next``
Moves to the next slide.
``slidecontroller_{live|preview}_next_noloop``
Moves to the next slide without auto advance.
``slidecontroller_{live|preview}_previous``
Moves to the previous slide.
``slidecontroller_{live|preview}_previous_noloop``
Moves to the previous slide, without auto advance.
``slidecontroller_{live|preview}_set``
Moves to a specific slide, by index.
``slidecontroller_{live|preview}_started``
Broadcasts that an item has been made live/previewed.
``slidecontroller_{live|preview}_change``
Informs the slidecontroller that a slide change has occurred and to
update itself.
``slidecontroller_{live|preview}_changed``
Broadcasts that the slidecontroller has changed the current slide.
``slidecontroller_{live|preview}_blank``
Request that the output screen is blanked.
``slidecontroller_{live|preview}_unblank``
Request that the output screen is unblanked.
``slidecontroller_live_spin_delay``
Pushes out the loop delay.
``slidecontroller_update_slide_limits``
Updates the slide_limits variable from the saved settings.
``slidecontroller_live_stop_loop``
Stop the loop on the main display.
**Display signals**
``update_display_css``
CSS has been updated which needs to be changed on the main display.
**Live Display signals**
``live_display_hide``
Hide the live display.
``live_display_show``
Return the live display.
``live_display_active``
The live display has been made active.
``live_display_blank_check``
Check to see if the blank display message is required.
**Plugin specific signals**
``{plugin}_start``
Requests a plugin to start a external program. Path and file have to
be provided in the message.
``{plugin}_first``
Requests a plugin to handle a first event.
``{plugin}_previous``
Requests a plugin to handle a previous event.
``{plugin}_next``
Requests a plugin to handle a next event.
``{plugin}_last``
Requests a plugin to handle a last event.
``{plugin}_slide``
Requests a plugin to handle a go to specific slide event.
``{plugin}_stop``
Requests a plugin to handle a stop event.
``{plugin}_blank``
Requests a plugin to handle a blank screen event.
``{plugin}_unblank``
Requests a plugin to handle an unblank screen event.
``{plugin}_load_list``
Tells the the plugin to reload the media manager list.
``{plugin}_preview``
Tells the plugin it's item can be previewed.
``{plugin}_add_service_item``
Ask the plugin to push the selected items to the service item.
``{plugin}_service_load``
Ask the plugin to process an individual service item after it has been
loaded.
``{plugin}_config_updated``
The config has changed so tell the plugin about it.
``alerts_text``
Displays an alert message.
``bibles_nobook``
Attempt to find book resulted in no match.
``remotes_poll_request``
Waits for openlp to do something "interesting" and sends a
``remotes_poll_response`` signal when it does.
"""
def __init__(self):
"""
Initialise the event receiver, calling the parent constructor.
"""
QtCore.QObject.__init__(self)
def send_message(self, event, msg=None):
"""
Emit a Qt signal.
``event``
The event to that was sent.
``msg``
Defaults to *None*. The message to send with the event.
"""
log.debug(u'Event %s passed with payload %s' % (event, msg))
self.emit(QtCore.SIGNAL(event), msg)
class Receiver(object):
"""
Class to allow events to be passed from different parts of the system. This
is a static wrapper around the ``EventReceiver`` class. As there is only
one instance of it in the system the Qt4 signal/slot architecture can send
messages across the system.
To send a message:
``Receiver.send_message(u'<<Message ID>>', data)``
To receive a Message
``QtCore.QObject.connect(
Receiver.get_receiver(),
QtCore.SIGNAL(u'<<Message ID>>'),
<<ACTION>>
)``
"""
__eventreceiver__ = EventReceiver()
@staticmethod
def send_message(event, msg=None):
"""
Sends a message to the messaging system.
``event``
The event to send.
``msg``
Defaults to *None*. The message to send with the event.
"""
Receiver.__eventreceiver__.send_message(event, msg)
@staticmethod
def get_receiver():
"""
Get the global ``__eventreceiver__`` instance.
"""
return Receiver.__eventreceiver__

View File

@ -33,7 +33,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver
from openlp.core.lib import Registry
class ListWidgetWithDnD(QtGui.QListWidget):
@ -54,8 +54,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
"""
self.setAcceptDrops(True)
self.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_dnd' % self.mimeDataText),
self.parent().loadFile)
Registry().register_function((u'%s_dnd' % self.mimeDataText), self.parent().loadFile)
def mouseMoveEvent(self, event):
"""
@ -112,6 +111,6 @@ class ListWidgetWithDnD(QtGui.QListWidget):
listing = os.listdir(localFile)
for file in listing:
files.append(os.path.join(localFile, file))
Receiver.send_message(u'%s_dnd' % self.mimeDataText, files)
Registry().execute(u'%s_dnd' % self.mimeDataText, files)
else:
event.ignore()

View File

@ -35,7 +35,7 @@ import re
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ServiceItem, StringContent, Receiver, ListWidgetWithDnD, \
from openlp.core.lib import OpenLPToolbar, ServiceItem, StringContent, ListWidgetWithDnD, \
ServiceItemContext, Settings, Registry, UiStrings, build_icon, translate
from openlp.core.lib.searchedit import SearchEdit
from openlp.core.lib.ui import create_widget_action, critical_error_message_box
@ -116,8 +116,7 @@ class MediaManagerItem(QtGui.QWidget):
self.setupUi()
self.retranslateUi()
self.autoSelectId = -1
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_service_load' % self.plugin.name),
self.serviceLoad)
Registry().register_function(u'%s_service_load' % self.plugin.name, self.serviceLoad)
def requiredIcons(self):
"""

View File

@ -33,7 +33,7 @@ import logging
from PyQt4 import QtCore
from openlp.core.lib import Receiver, Settings, Registry, UiStrings
from openlp.core.lib import Settings, Registry, UiStrings
from openlp.core.utils import get_application_version
log = logging.getLogger(__name__)
@ -171,8 +171,7 @@ class Plugin(QtCore.QObject):
default_settings[u'%s/%s files' % (name, name)] = []
# Add settings to the dict of all settings.
Settings.extend_default_settings(default_settings)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_add_service_item' % self.name),
self.processAddServiceEvent)
Registry().register_function(u'%s_add_service_item' % self.name, self.processAddServiceEvent)
Registry().register_function(u'%s_config_updated' % self.name, self.config_update)
def checkPreConditions(self):

View File

@ -31,8 +31,8 @@ import logging
from PyQt4 import QtGui, QtCore, QtWebKit
from openlp.core.lib import FormattingTags, ImageSource, ItemCapabilities, Receiver, Registry, ScreenList, \
ServiceItem, expand_tags, build_lyrics_format_css, build_lyrics_outline_css
from openlp.core.lib import FormattingTags, ImageSource, ItemCapabilities, Registry, ScreenList, ServiceItem, \
expand_tags, build_lyrics_format_css, build_lyrics_outline_css
from openlp.core.lib.theme import ThemeLevel
from openlp.core.ui import MainDisplay
@ -602,7 +602,7 @@ class Renderer(object):
previous_raw = u''
# Stop here as the theme line count was requested.
if self.force_page:
Receiver.send_message(u'theme_line_count', index + 1)
Registry().execute(u'theme_line_count', index + 1)
break
else:
continue

View File

@ -36,7 +36,7 @@ import sys
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Registry, SettingsTab, Receiver, Settings, UiStrings, translate, build_icon
from openlp.core.lib import Registry, SettingsTab, Settings, UiStrings, translate, build_icon
from openlp.core.utils import AppLocation, format_time, get_images_filter
from openlp.core.lib import SlideLimits
@ -397,22 +397,19 @@ class AdvancedTab(SettingsTab):
if not os.path.exists(self.current_data_path):
log.error(u'Data path not found %s' % self.current_data_path)
answer = QtGui.QMessageBox.critical(self,
translate('OpenLP.AdvancedTab',
'Data Directory Error'),
translate('OpenLP.AdvancedTab',
'OpenLP data directory was not found\n\n%s\n\n'
translate('OpenLP.AdvancedTab', 'Data Directory Error'),
translate('OpenLP.AdvancedTab', 'OpenLP data directory was not found\n\n%s\n\n'
'This data directory was previously changed from the OpenLP '
'default location. If the new location was on removable '
'media, that media needs to be made available.\n\n'
'Click "No" to stop loading OpenLP. allowing you to fix '
'the the problem.\n\n'
'Click "No" to stop loading OpenLP. allowing you to fix the the problem.\n\n'
'Click "Yes" to reset the data directory to the default '
'location.').replace('%s', self.current_data_path),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
log.info(u'User requested termination')
Receiver.send_message(u'cleanup')
self.main_window.clean_up()
sys.exit()
# Set data location to default.
settings.remove(u'advanced/data path')
@ -457,7 +454,7 @@ class AdvancedTab(SettingsTab):
if self.display_changed:
Registry().execute(u'config_screen_changed')
self.display_changed = False
Receiver.send_message(u'slidecontroller_update_slide_limits')
Registry().execute(u'slidecontroller_update_slide_limits')
def cancel(self):
"""
@ -573,7 +570,7 @@ class AdvancedTab(SettingsTab):
# Check if data already exists here.
self.check_data_overwrite(new_data_path)
# Save the new location.
Receiver.send_message(u'set_new_data_path', new_data_path)
self.main_window.set_new_data_path(new_data_path)
self.new_data_directory_edit.setText(new_data_path)
self.data_directory_cancel_button.show()
@ -594,7 +591,7 @@ class AdvancedTab(SettingsTab):
return
self.check_data_overwrite(new_data_path)
# Save the new location.
Receiver.send_message(u'set_new_data_path', new_data_path)
self.main_window.set_new_data_path(new_data_path)
self.new_data_directory_edit.setText(os.path.abspath(new_data_path))
self.data_directory_cancel_button.show()
else:
@ -605,8 +602,7 @@ class AdvancedTab(SettingsTab):
"""
Copy existing data when you change your data directory.
"""
Receiver.send_message(u'set_copy_data',
self.data_directory_copy_check_box.isChecked())
self.main_window.set_copy_data(self.data_directory_copy_check_box.isChecked())
if self.data_exists:
if self.data_directory_copy_check_box.isChecked():
self.new_data_directory_has_files_label.show()
@ -645,8 +641,8 @@ class AdvancedTab(SettingsTab):
"""
self.new_data_directory_edit.clear()
self.data_directory_copy_check_box.setChecked(False)
Receiver.send_message(u'set_new_data_path', u'')
Receiver.send_message(u'set_copy_data', False)
self.main_window.set_new_data_path(None)
self.main_window.set_copy_data(False)
self.data_directory_copy_check_box.hide()
self.data_directory_cancel_button.hide()
self.new_data_directory_has_files_label.hide()

View File

@ -41,7 +41,7 @@ from ConfigParser import SafeConfigParser
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginStatus, Receiver, Settings, Registry, build_icon, check_directory_exists, translate
from openlp.core.lib import PluginStatus, Settings, Registry, build_icon, check_directory_exists, translate
from openlp.core.utils import AppLocation, get_web_page, get_filesystem_encoding
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage

View File

@ -33,7 +33,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Registry, Receiver, Settings, SettingsTab, translate, ScreenList, UiStrings
from openlp.core.lib import Registry, Settings, SettingsTab, translate, ScreenList, UiStrings
log = logging.getLogger(__name__)
@ -315,7 +315,7 @@ class GeneralTab(SettingsTab):
Apply settings after settings tab has loaded and most of the
system so must be delayed
"""
Receiver.send_message(u'slidecontroller_live_spin_delay', self.timeoutSpinBox.value())
Registry().execute(u'slidecontroller_live_spin_delay', self.timeoutSpinBox.value())
# Do not continue on start up.
if not postUpdate:
return

View File

@ -42,7 +42,7 @@ import sys
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver, ServiceItem, Settings, ImageSource, Registry, build_html, expand_tags, \
from openlp.core.lib import ServiceItem, Settings, ImageSource, Registry, build_html, expand_tags, \
image_to_byte, translate
from openlp.core.lib.theme import BackgroundType
@ -158,9 +158,9 @@ class MainDisplay(Display):
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.setTransparency(False)
if self.isLive:
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_hide'), self.hideDisplay)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_show'), self.showDisplay)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'update_display_css'), self.cssChanged)
Registry().register_function(u'live_display_hide', self.hideDisplay)
Registry().register_function(u'live_display_show', self.showDisplay)
Registry().register_function(u'update_display_css', self.cssChanged)
Registry().register_function(u'config_updated', self.configChanged)
def setTransparency(self, enabled):
@ -387,11 +387,11 @@ class MainDisplay(Display):
if self.override:
# We have an video override so allow it to be stopped.
if u'video' in self.override:
Receiver.send_message(u'video_background_replaced')
Registry().execute(u'video_background_replaced')
self.override = {}
# We have a different theme.
elif self.override[u'theme'] != serviceItem.themedata.background_filename:
Receiver.send_message(u'live_theme_changed')
Registry().execute(u'live_theme_changed')
self.override = {}
else:
# replace the background
@ -417,7 +417,7 @@ class MainDisplay(Display):
# if was hidden keep it hidden
if self.hideMode and self.isLive and not serviceItem.is_media():
if Settings().value(u'general/auto unblank'):
Receiver.send_message(u'slidecontroller_live_unblank')
Registry().execute(u'slidecontroller_live_unblank')
else:
self.hideDisplay(self.hideMode)
self.__hideMouse()
@ -470,7 +470,7 @@ class MainDisplay(Display):
self.hideMode = None
# Trigger actions when display is active again.
if self.isLive:
Receiver.send_message(u'live_display_active')
Registry().execute(u'live_display_active')
def __hideMouse(self):
"""

View File

@ -41,7 +41,7 @@ from datetime import datetime
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Renderer, OpenLPDockWidget, PluginManager, Receiver, ImageManager, PluginStatus, Registry, \
from openlp.core.lib import Renderer, OpenLPDockWidget, PluginManager, ImageManager, PluginStatus, Registry, \
Settings, ScreenList, build_icon, check_directory_exists, translate
from openlp.core.lib.ui import UiStrings, create_action
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \
@ -497,8 +497,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# Once settings are loaded update the menu with the recent files.
self.updateRecentFilesMenu()
self.pluginForm = PluginForm(self)
self.newDataPath = u''
self.copyData = False
self.new_data_path = None
self.copy_data = False
# Set up signals and slots
QtCore.QObject.connect(self.importThemeItem, QtCore.SIGNAL(u'triggered()'),
self.themeManagerContents.on_import_theme)
@ -528,21 +528,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QObject.connect(self.modeDefaultItem, QtCore.SIGNAL(u'triggered()'), self.onModeDefaultItemClicked)
QtCore.QObject.connect(self.modeSetupItem, QtCore.SIGNAL(u'triggered()'), self.onModeSetupItemClicked)
QtCore.QObject.connect(self.modeLiveItem, QtCore.SIGNAL(u'triggered()'), self.onModeLiveItemClicked)
Registry().register_function(u'theme_update_global', self.defaultThemeChanged)
Registry().register_function(u'openlp_version_check', self.versionNotice)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_blank_check'), self.blankCheck)
Registry().register_function(u'config_screen_changed', self.screenChanged)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cleanup'), self.clean_up)
# Media Manager
QtCore.QObject.connect(self.mediaToolBox, QtCore.SIGNAL(u'currentChanged(int)'), self.onMediaToolBoxChanged)
self.application.set_busy_cursor()
# Simple message boxes
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'set_new_data_path'), self.setNewDataPath)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'set_copy_data'), self.setCopyData)
Registry().register_function(u'theme_update_global', self.defaultThemeChanged)
Registry().register_function(u'openlp_version_check', self.versionNotice)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_blank_check'), self.blankCheck)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cleanup'), self.clean_up)
Registry().register_function(u'theme_update_global', self.default_theme_changed)
Registry().register_function(u'openlp_version_check', self.version_notice)
Registry().register_function(u'config_screen_changed', self.screen_changed)
self.renderer = Renderer()
# Define the media Dock Manager
self.mediaDockManager = MediaDockManager(self.mediaToolBox)
@ -597,7 +589,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if widget:
widget.onFocus()
def versionNotice(self, version):
def version_notice(self, version):
"""
Notifies the user that a newer version of OpenLP is available.
Triggered by delay thread.
@ -698,10 +690,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Registry().execute(u'theme_update_global', self.themeManagerContents.global_theme)
# Check if any Bibles downloaded. If there are, they will be
# processed.
Receiver.send_message(u'bibles_load_list', True)
Registry().execute(u'bibles_load_list', True)
self.application.set_normal_cursor()
def blankCheck(self):
def blank_check(self):
"""
Check and display message if screen blank on setup.
"""
@ -1015,12 +1007,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.setPreviewPanelVisibility(preview)
self.setLivePanelVisibility(live)
def screenChanged(self):
def screen_changed(self):
"""
The screen has changed so we have to update components such as the
renderer.
"""
log.debug(u'screenChanged')
log.debug(u'screen_changed')
self.application.set_busy_cursor()
self.imageManager.update_display()
self.renderer.update_display()
@ -1093,7 +1085,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# Save settings
self.saveSettings()
# Check if we need to change the data directory
if self.newDataPath:
if self.new_data_path:
self.changeDataDirectory()
# Close down the display
if self.liveController.display:
@ -1145,7 +1137,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
self.statusBar.showMessage(message)
def defaultThemeChanged(self, theme):
def default_theme_changed(self, theme):
"""
Update the default theme indicator in the status bar
"""
@ -1349,33 +1341,33 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.loadProgressBar.hide()
self.application.process_events()
def setNewDataPath(self, new_data_path):
def set_new_data_path(self, new_data_path):
"""
Set the new data path
"""
self.newDataPath = new_data_path
self.new_data_path = new_data_path
def setCopyData(self, copy_data):
def set_copy_data(self, copy_data):
"""
Set the flag to copy the data
"""
self.copyData = copy_data
self.copy_data = copy_data
def changeDataDirectory(self):
"""
Change the data directory.
"""
log.info(u'Changing data path to %s' % self.newDataPath)
log.info(u'Changing data path to %s' % self.new_data_path)
old_data_path = unicode(AppLocation.get_data_path())
# Copy OpenLP data to new location if requested.
self.application.set_busy_cursor()
if self.copyData:
if self.copy_data:
log.info(u'Copying data to new path')
try:
self.showStatusMessage(
translate('OpenLP.MainWindow', 'Copying OpenLP data to new data directory location - %s '
'- Please wait for copy to finish').replace('%s', self.newDataPath))
dir_util.copy_tree(old_data_path, self.newDataPath)
'- Please wait for copy to finish').replace('%s', self.new_data_path))
dir_util.copy_tree(old_data_path, self.new_data_path)
log.info(u'Copy sucessful')
except (IOError, os.error, DistutilsFileError), why:
self.application.set_normal_cursor()
@ -1389,9 +1381,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log.info(u'No data copy requested')
# Change the location of data directory in config file.
settings = QtCore.QSettings()
settings.setValue(u'advanced/data path', self.newDataPath)
settings.setValue(u'advanced/data path', self.new_data_path)
# Check if the new data path is our default.
if self.newDataPath == AppLocation.get_directory(AppLocation.DataDir):
if self.new_data_path == AppLocation.get_directory(AppLocation.DataDir):
settings.remove(u'advanced/data path')
self.application.set_normal_cursor()

View File

@ -35,7 +35,7 @@ import os
import datetime
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, Receiver, Settings, Registry, UiStrings, translate
from openlp.core.lib import OpenLPToolbar, Settings, Registry, UiStrings, translate
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.media import MediaState, MediaInfo, MediaType, get_media_players, set_media_players
from openlp.core.ui.media.mediaplayer import MediaPlayer
@ -107,21 +107,19 @@ class MediaController(object):
self.timer.setInterval(200)
# Signals
self.timer.timeout.connect(self.media_state)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'playbackPlay'), self.media_play_msg)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'playbackPause'), self.media_pause_msg)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'playbackStop'), self.media_stop_msg)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'seekSlider'), self.media_seek_msg)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'volumeSlider'), self.media_volume_msg)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'media_hide'), self.media_hide)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'media_blank'), self.media_blank)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'media_unblank'), self.media_unblank)
Registry().register_function(u'playbackPlay', self.media_play_msg)
Registry().register_function(u'playbackPause', self.media_pause_msg)
Registry().register_function(u'playbackStop', self.media_stop_msg)
Registry().register_function(u'seekSlider', self.media_seek_msg)
Registry().register_function(u'volumeSlider', self.media_volume_msg)
Registry().register_function(u'media_hide', self.media_hide)
Registry().register_function(u'media_blank', self.media_blank)
Registry().register_function(u'media_unblank', self.media_unblank)
# Signals for background video
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_hide'), self.media_hide)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_unblank'), self.media_unblank)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mediaitem_media_rebuild'),
self._set_active_players)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mediaitem_suffixes'),
self._generate_extensions_lists)
Registry().register_function(u'songs_hide', self.media_hide)
Registry().register_function(u'songs_unblank', self.media_unblank)
Registry().register_function(u'mediaitem_media_rebuild', self._set_active_players)
Registry().register_function(u'mediaitem_suffixes', self._generate_extensions_lists)
def _set_active_players(self):
"""
@ -694,7 +692,7 @@ class MediaController(object):
hide_mode = msg[2]
if not isLive:
return
Receiver.send_message(u'live_display_hide', hide_mode)
Registry().execute(u'live_display_hide', hide_mode)
controller = self.mainWindow.liveController
display = self._define_display(controller)
if self.currentMediaPlayer[controller.controllerType].state == MediaState.Playing:
@ -709,7 +707,7 @@ class MediaController(object):
First element is not relevant in this context
Second element is the boolean for Live indication
"""
Receiver.send_message(u'live_display_show')
Registry().execute(u'live_display_show')
isLive = msg[1]
if not isLive:
return

View File

@ -31,7 +31,7 @@ The :mod:`~openlp.core.ui.media.playertab` module holds the configuration tab fo
"""
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Registry, SettingsTab, Receiver, Settings, UiStrings, translate
from openlp.core.lib import Registry, SettingsTab, Settings, UiStrings, translate
from openlp.core.lib.ui import create_button
from openlp.core.ui.media import get_media_players, set_media_players
@ -229,7 +229,7 @@ class PlayerTab(SettingsTab):
player_string_changed = True
if player_string_changed:
self.service_manager.reset_supported_suffixes()
Receiver.send_message(u'mediaitem_media_rebuild')
Registry().execute(u'mediaitem_media_rebuild')
Registry().execute(u'config_screen_changed')
def postSetUp(self, postUpdate=False):

View File

@ -36,7 +36,7 @@ import os
from PyQt4 import QtCore, QtGui
from lxml import html
from openlp.core.lib import Receiver, Settings, UiStrings, Registry, translate, get_text_file_string
from openlp.core.lib import Settings, UiStrings, Registry, translate, get_text_file_string
from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize
from openlp.core.utils import AppLocation
@ -408,7 +408,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
return
for item in self.service_manager.serviceItems:
# Trigger Audit requests
Receiver.send_message(u'print_service_started', [item[u'service_item']])
Registry().register_function(u'print_service_started', [item[u'service_item']])
def _get_service_manager(self):
"""

View File

@ -42,7 +42,7 @@ log = logging.getLogger(__name__)
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, ItemCapabilities, Settings, PluginStatus, Registry, \
from openlp.core.lib import OpenLPToolbar, ServiceItem, ItemCapabilities, Settings, PluginStatus, Registry, \
UiStrings, build_icon, translate, str_to_bool, check_directory_exists
from openlp.core.lib.theme import ThemeLevel
from openlp.core.lib.ui import critical_error_message_box, create_widget_action, find_and_set_in_combo_box
@ -210,7 +210,7 @@ class ServiceManagerDialog(object):
self.collapsed)
QtCore.QObject.connect(self.service_manager_list, QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'),
self.expanded)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.update_theme_list)
Registry().register_function(u'theme_update_list', self.update_theme_list)
Registry().register_function(u'config_updated', self.config_updated)
Registry().register_function(u'config_screen_changed', self.regenerate_service_Items)
Registry().register_function(u'theme_update_global', self.theme_change)
@ -733,7 +733,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
service_item.validate_item(self.suffixes)
self.load_item_unique_identifier = 0
if service_item.is_capable(ItemCapabilities.OnLoadUpdate):
Receiver.send_message(u'%s_service_load' % service_item.name.lower(), service_item)
Registry().execute(u'%s_service_load' % service_item.name.lower(), service_item)
# if the item has been processed
if service_item.unique_identifier == self.load_item_unique_identifier:
service_item.edit_id = int(self.load_item_edit_id)
@ -1436,7 +1436,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
Saves the current text item as a custom slide
"""
item = self.find_service_item()[0]
Receiver.send_message(u'custom_create_from_service', self.service_items[item][u'service_item'])
Registry().execute(u'custom_create_from_service', self.service_items[item][u'service_item'])
def find_service_item(self):
"""
@ -1523,7 +1523,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
replace = True
else:
self.drop_position = self._get_parent_item_data(item)
Receiver.send_message(u'%s_add_service_item' % plugin, replace)
Registry().execute(u'%s_add_service_item' % plugin, replace)
def update_theme_list(self, theme_list):
"""

View File

@ -33,7 +33,7 @@ import logging
from PyQt4 import QtGui
from openlp.core.lib import Receiver, PluginStatus, Registry, build_icon
from openlp.core.lib import PluginStatus, Registry, build_icon
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab
from openlp.core.ui.media import PlayerTab
from settingsdialog import Ui_SettingsDialog

View File

@ -27,7 +27,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`slidecontroller` module contains argubly the most important part of OpenLP - the slide controller
The :mod:`slidecontroller` module contains the most important part of OpenLP - the slide controller
"""
import os
import logging
@ -36,7 +36,7 @@ from collections import deque
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, ServiceItem, ImageSource, SlideLimits, \
from openlp.core.lib import OpenLPToolbar, ItemCapabilities, ServiceItem, ImageSource, SlideLimits, \
ServiceItemAction, Settings, Registry, UiStrings, ScreenList, build_icon, build_html, translate
from openlp.core.ui import HideMode, MainDisplay, Display, DisplayControllerType
from openlp.core.lib.ui import create_action
@ -66,7 +66,7 @@ class DisplayController(QtGui.QWidget):
"""
sender = self.sender().objectName() if self.sender().objectName() else self.sender().text()
controller = self
Receiver.send_message('%s' % sender, [controller, args])
Registry().execute('%s' % sender, [controller, args])
class SlideController(DisplayController):
@ -362,10 +362,8 @@ class SlideController(DisplayController):
# Signals
QtCore.QObject.connect(self.previewListWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
if self.isLive:
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'), self.receiveSpinDelay)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_toggle_display'), self.toggleDisplay)
Registry().register_function(u'slidecontroller_live_spin_delay', self.receiveSpinDelay)
Registry().register_function(u'slidecontroller_toggle_display', self.toggleDisplay)
self.toolbar.setWidgetVisible(self.loopList, False)
self.toolbar.setWidgetVisible(self.wideMenu, False)
else:
@ -377,22 +375,14 @@ class SlideController(DisplayController):
self.__addActionsToWidget(self.previewListWidget)
else:
self.previewListWidget.addActions([self.nextItem, self.previousItem])
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.typePrefix), self.onStopLoop)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_next' % self.typePrefix), self.onSlideSelectedNext)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.typePrefix), self.onSlideSelectedPrevious)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_change' % self.typePrefix), self.onSlideChange)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_set' % self.typePrefix), self.onSlideSelectedIndex)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.typePrefix), self.onSlideBlank)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.typePrefix), self.onSlideUnblank)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_update_slide_limits'), self.updateSlideLimits)
Registry().register_function(u'slidecontroller_%s_stop_loop' % self.typePrefix, self.onStopLoop)
Registry().register_function(u'slidecontroller_%s_next' % self.typePrefix, self.onSlideSelectedNext)
Registry().register_function(u'slidecontroller_%s_previous' % self.typePrefix, self.onSlideSelectedPrevious)
Registry().register_function(u'slidecontroller_%s_change' % self.typePrefix, self.onSlideChange)
Registry().register_function(u'slidecontroller_%s_set' % self.typePrefix, self.onSlideSelectedIndex)
Registry().register_function(u'slidecontroller_%s_blank' % self.typePrefix, self.onSlideBlank)
Registry().register_function(u'slidecontroller_%s_unblank' % self.typePrefix, self.onSlideUnblank)
Registry().register_function(u'slidecontroller_update_slide_limits', self.updateSlideLimits)
def _slideShortcutActivated(self):
"""
@ -756,8 +746,7 @@ class SlideController(DisplayController):
self.serviceItem = copy.copy(serviceItem)
if old_item and self.isLive and old_item.is_capable(ItemCapabilities.ProvidesOwnDisplay):
self._resetBlank()
Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
[serviceItem, self.isLive, self.hideMode(), slideno])
Registry().execute(u'%s_start' % serviceItem.name.lower(), [serviceItem, self.isLive, self.hideMode(), slideno])
self.slideList = {}
width = self.parent().controlSplitter.sizes()[self.split]
self.previewListWidget.clear()
@ -853,10 +842,10 @@ class SlideController(DisplayController):
# However opening a new item of the same type will automatically
# close the previous, so make sure we don't close the new one.
if old_item.is_command() and not serviceItem.is_command():
Receiver.send_message(u'%s_stop' % old_item.name.lower(), [old_item, self.isLive])
Registry().execute(u'%s_stop' % old_item.name.lower(), [old_item, self.isLive])
if old_item.is_media() and not serviceItem.is_media():
self.onMediaClose()
Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix, [serviceItem])
Registry().execute(u'slidecontroller_%s_started' % self.typePrefix, [serviceItem])
def __updatePreviewSelection(self, slideno):
"""
@ -877,7 +866,7 @@ class SlideController(DisplayController):
if not self.serviceItem:
return
if self.serviceItem.is_command():
Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive, index])
Registry().execute(u'%s_slide' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive, index])
self.updatePreview()
else:
self.__checkUpdateSelectedSlide(index)
@ -898,7 +887,7 @@ class SlideController(DisplayController):
elif display_type == u'blanked':
self.onBlankDisplay(True)
else:
Receiver.send_message(u'live_display_show')
Registry().execute(u'live_display_show')
else:
self.liveEscape()
@ -980,18 +969,18 @@ class SlideController(DisplayController):
if self.serviceItem is not None:
if hide_mode:
if not self.serviceItem.is_command():
Receiver.send_message(u'live_display_hide', hide_mode)
Receiver.send_message(u'%s_blank' % self.serviceItem.name.lower(),
Registry().execute(u'live_display_hide', hide_mode)
Registry().execute(u'%s_blank' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive, hide_mode])
else:
if not self.serviceItem.is_command():
Receiver.send_message(u'live_display_show')
Receiver.send_message(u'%s_unblank' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
Registry().execute(u'live_display_show')
Registry().execute(u'%s_unblank' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
else:
if hide_mode:
Receiver.send_message(u'live_display_hide', hide_mode)
Registry().execute(u'live_display_hide', hide_mode)
else:
Receiver.send_message(u'live_display_show')
Registry().execute(u'live_display_show')
def hidePlugin(self, hide):
"""
@ -1000,17 +989,17 @@ class SlideController(DisplayController):
log.debug(u'hidePlugin %s ', hide)
if self.serviceItem is not None:
if hide:
Receiver.send_message(u'live_display_hide', HideMode.Screen)
Receiver.send_message(u'%s_hide' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
Registry().execute(u'live_display_hide', HideMode.Screen)
Registry().execute(u'%s_hide' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
else:
if not self.serviceItem.is_command():
Receiver.send_message(u'live_display_show')
Receiver.send_message(u'%s_unblank' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
Registry().execute(u'live_display_show')
Registry().execute(u'%s_unblank' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
else:
if hide:
Receiver.send_message(u'live_display_hide', HideMode.Screen)
Registry().execute(u'live_display_hide', HideMode.Screen)
else:
Receiver.send_message(u'live_display_show')
Registry().execute(u'live_display_show')
def onSlideSelected(self):
"""
@ -1028,7 +1017,7 @@ class SlideController(DisplayController):
if -1 < row < self.previewListWidget.rowCount():
if self.serviceItem.is_command():
if self.isLive and not start:
Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
Registry().execute(u'%s_slide' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive, row])
else:
to_display = self.serviceItem.get_rendered_frame(row)
@ -1044,7 +1033,7 @@ class SlideController(DisplayController):
self.updatePreview()
self.selectedRow = row
self.__checkUpdateSelectedSlide(row)
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, row)
Registry().execute(u'slidecontroller_%s_changed' % self.typePrefix, row)
self.display.setFocus()
def onSlideChange(self, row):
@ -1053,7 +1042,7 @@ class SlideController(DisplayController):
"""
self.__checkUpdateSelectedSlide(row)
self.updatePreview()
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, row)
Registry().execute(u'slidecontroller_%s_changed' % self.typePrefix, row)
def updatePreview(self):
"""
@ -1092,7 +1081,7 @@ class SlideController(DisplayController):
"""
if not self.serviceItem:
return
Receiver.send_message(u'%s_next' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
Registry().execute(u'%s_next' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
if self.serviceItem.is_command() and self.isLive:
self.updatePreview()
else:
@ -1119,7 +1108,7 @@ class SlideController(DisplayController):
"""
if not self.serviceItem:
return
Receiver.send_message(u'%s_previous' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
Registry().execute(u'%s_previous' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
if self.serviceItem.is_command() and self.isLive:
self.updatePreview()
else:
@ -1259,7 +1248,7 @@ class SlideController(DisplayController):
# Live and Preview have issues if we have video or presentations
# playing in both at the same time.
if self.serviceItem.is_command():
Receiver.send_message(u'%s_stop' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
Registry().execute(u'%s_stop' % self.serviceItem.name.lower(), [self.serviceItem, self.isLive])
if self.serviceItem.is_media():
self.onMediaClose()
self.onGoLive()

View File

@ -34,7 +34,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, UiStrings, Registry, translate
from openlp.core.lib import UiStrings, Registry, translate
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui import ThemeLayoutForm
@ -88,7 +88,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
QtCore.QObject.connect(self.footerPositionCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
self.onFooterPositionCheckBoxStateChanged)
QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_line_count'), self.updateLinesText)
Registry().register_function(u'theme_line_count', self.updateLinesText)
QtCore.QObject.connect(self.mainSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
QtCore.QObject.connect(self.lineSpacingSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)
QtCore.QObject.connect(self.outlineSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.calculateLines)

View File

@ -38,7 +38,7 @@ import re
from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import QtCore, QtGui
from openlp.core.lib import ImageSource, OpenLPToolbar, Receiver, Registry, SettingsManager, Settings, UiStrings, \
from openlp.core.lib import ImageSource, OpenLPToolbar, Registry, SettingsManager, Settings, UiStrings, \
get_text_file_string, build_icon, translate, check_item_selected, check_directory_exists, create_thumb, \
validate_thumb
from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, BackgroundGradientType

View File

@ -34,7 +34,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, Registry, Settings, UiStrings, build_icon, translate
from openlp.core.lib import Registry, Settings, UiStrings, build_icon, translate
from openlp.core.lib.ui import add_welcome_page
log = logging.getLogger(__name__)
@ -173,7 +173,7 @@ class OpenLPWizard(QtGui.QWizard):
"""
log.debug(u'Wizard cancelled by user.')
if self.currentPage() == self.progressPage:
Receiver.send_message(u'openlp_stop_wizard')
Registry().execute(u'openlp_stop_wizard')
self.done(QtGui.QDialog.Rejected)
def onCurrentIdChanged(self, pageId):

View File

@ -35,7 +35,7 @@ import logging
from PyQt4 import QtCore
from openlp.core.lib import Registry, Receiver, translate
from openlp.core.lib import Registry, translate
log = logging.getLogger(__name__)
@ -49,19 +49,19 @@ class AlertsManager(QtCore.QObject):
QtCore.QObject.__init__(self, parent)
self.screen = None
self.timer_id = 0
self.alertList = []
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_active'), self.generateAlert)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'alerts_text'), self.onAlertText)
self.alert_list = []
Registry().register_function(u'live_display_active', self.generate_alert)
Registry().register_function(u'alerts_text', self.alert_text)
def onAlertText(self, message):
def alert_text(self, message):
"""
Called via a alerts_text event. Message is single element array
containing text
"""
if message:
self.displayAlert(message[0])
self.display_alert(message[0])
def displayAlert(self, text=u''):
def display_alert(self, text=u''):
"""
Called from the Alert Tab to display an alert
@ -70,22 +70,22 @@ class AlertsManager(QtCore.QObject):
"""
log.debug(u'display alert called %s' % text)
if text:
self.alertList.append(text)
self.alert_list.append(text)
if self.timer_id != 0:
self.main_window.show_status_message(
translate('AlertsPlugin.AlertsManager', 'Alert message created and displayed.'))
return
self.main_window.show_status_message(u'')
self.generateAlert()
self.generate_alert()
def generateAlert(self):
def generate_alert(self):
"""
Format and request the Alert and start the timer
"""
log.debug(u'Generate Alert called')
if not self.alertList:
if not self.alert_list:
return
text = self.alertList.pop(0)
text = self.alert_list.pop(0)
alertTab = self.parent().settingsTab
self.parent().liveController.display.alert(text, alertTab.location)
# Check to see if we have a timer running.
@ -106,7 +106,7 @@ class AlertsManager(QtCore.QObject):
self.parent().liveController.display.alert(u'', alertTab.location)
self.killTimer(self.timer_id)
self.timer_id = 0
self.generateAlert()
self.generate_alert()
def _get_main_window(self):
"""

View File

@ -29,7 +29,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, Receiver, Settings, UiStrings, translate
from openlp.core.lib import Registry, SettingsTab, Settings, UiStrings, translate
from openlp.core.lib.ui import create_valign_selection_widgets
class AlertsTab(SettingsTab):
@ -174,7 +174,7 @@ class AlertsTab(SettingsTab):
settings.setValue(u'location', self.location)
settings.endGroup()
if self.changed:
Receiver.send_message(u'update_display_css')
Registry().execute(u'update_display_css')
self.changed = False
def updateDisplay(self):

View File

@ -36,7 +36,7 @@ from tempfile import gettempdir
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, Settings, UiStrings, translate, check_directory_exists
from openlp.core.lib import Registry, Settings, UiStrings, translate, check_directory_exists
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding
@ -82,7 +82,7 @@ class BibleUpgradeForm(OpenLPWizard):
Set up the UI for the bible wizard.
"""
OpenLPWizard.setupUi(self, image)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
Registry().execute(u'openlp_stop_wizard', self.stop_import)
def stop_import(self):
"""

View File

@ -31,7 +31,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, SettingsTab, Settings, UiStrings, translate
from openlp.core.lib import Registry, SettingsTab, Settings, UiStrings, translate
from openlp.core.lib.ui import find_and_set_in_combo_box
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, update_reference_separators, \
get_reference_separator, LanguageSelection
@ -168,7 +168,7 @@ class BiblesTab(SettingsTab):
self.onEndSeparatorLineEditEdited)
QtCore.QObject.connect(self.endSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
self.onEndSeparatorLineEditFinished)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
Registry().register_function(u'theme_update_list', self.update_theme_list)
QtCore.QObject.connect(self.languageSelectionComboBox, QtCore.SIGNAL(u'activated(int)'),
self.onLanguageSelectionComboBoxChanged)
@ -406,10 +406,10 @@ class BiblesTab(SettingsTab):
else:
settings.remove(u'end separator')
update_reference_separators()
Receiver.send_message(u'bibles_load_list')
Registry().execute(u'bibles_load_list')
settings.endGroup()
def updateThemeList(self, theme_list):
def update_theme_list(self, theme_list):
"""
Called from ThemeManager when the Themes have changed.

View File

@ -38,7 +38,7 @@ from sqlalchemy import Column, ForeignKey, Table, or_, types, func
from sqlalchemy.orm import class_mapper, mapper, relation
from sqlalchemy.orm.exc import UnmappedClassError
from openlp.core.lib import Receiver, Registry, translate
from openlp.core.lib import Registry, translate
from openlp.core.lib.db import BaseModel, init_db, Manager
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.utils import AppLocation, clean_filename
@ -160,7 +160,7 @@ class BibleDB(QtCore.QObject, Manager):
if u'path' in kwargs:
self.path = kwargs[u'path']
self.wizard = None
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
Registry().execute(u'openlp_stop_wizard', self.stop_import)
def stop_import(self):
"""

View File

@ -31,8 +31,8 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Registry, MediaManagerItem, Receiver, ItemCapabilities, ServiceItemContext, Settings, \
UiStrings, create_separated_list, translate
from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, Settings, UiStrings, \
create_separated_list, translate
from openlp.core.lib.searchedit import SearchEdit
from openlp.core.lib.ui import set_case_insensitive_completer, create_horizontal_adjusting_combo_box, \
critical_error_message_box, find_and_set_in_combo_box, build_icon
@ -70,7 +70,8 @@ class BibleMediaItem(MediaManagerItem):
self.search_results = {}
self.second_search_results = {}
self.checkSearchResult()
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'bibles_load_list'), self.reloadBibles)
Registry().register_function(u'bibles_load_list', self.reloadBibles)
Registry().register_function(u'config_updated', self.config_update)
def __checkSecondBible(self, bible, second_bible):
"""
@ -246,7 +247,6 @@ class BibleMediaItem(MediaManagerItem):
# Buttons
QtCore.QObject.connect(self.advancedSearchButton, QtCore.SIGNAL(u'clicked()'), self.onAdvancedSearchButton)
QtCore.QObject.connect(self.quickSearchButton, QtCore.SIGNAL(u'clicked()'), self.onQuickSearchButton)
Registry().register_function(u'config_updated', self.config_update)
# Other stuff
QtCore.QObject.connect(self.quickSearchEdit, QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton)
QtCore.QObject.connect(self.searchTabBar, QtCore.SIGNAL(u'currentChanged(int)'),

View File

@ -31,7 +31,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, Registry, translate
from openlp.core.lib import Registry, translate
from openlp.core.lib.ui import critical_error_message_box, find_and_set_in_combo_box
from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser
from openlp.plugins.custom.lib.db import CustomSlide
@ -190,7 +190,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
"""
log.debug(u'onPreview')
if self.saveCustom():
Receiver.send_message(u'custom_preview')
Registry().execute(u'custom_preview')
def updateSlideList(self, slides, edit_all=False):
"""

View File

@ -32,8 +32,8 @@ import logging
from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import or_, func, and_
from openlp.core.lib import Registry, MediaManagerItem, Receiver, ItemCapabilities, ServiceItemContext, Settings, \
PluginStatus, UiStrings, check_item_selected, translate
from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, Settings, PluginStatus,\
UiStrings, check_item_selected, translate
from openlp.plugins.custom.forms import EditCustomForm
from openlp.plugins.custom.lib import CustomXMLParser, CustomXMLBuilder
from openlp.plugins.custom.lib.db import CustomSlide
@ -73,11 +73,10 @@ class CustomMediaItem(MediaManagerItem):
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'),
self.onSearchTextButtonClicked)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_load_list'), self.loadList)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_preview'), self.onPreviewClick)
Registry().register_function(u'custom_load_list', self.loadList)
Registry().register_function(u'custom_preview', self.onPreviewClick)
Registry().register_function(u'config_updated', self.config_updated)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_create_from_service'),
self.create_from_service_item)
Registry().register_function(u'custom_create_from_service', self.create_from_service_item)
def config_updated(self):
self.add_custom_from_service = Settings().value(self.settingsSection + u'/add custom from service')
@ -280,7 +279,7 @@ class CustomMediaItem(MediaManagerItem):
self.plugin.manager.save_object(custom)
self.onSearchTextButtonClicked()
if item.name.lower() == u'custom':
Receiver.send_message(u'service_item_update', u'%s:%s:%s' % (custom.id, item.unique_identifier, False))
Registry().execute(u'service_item_update', u'%s:%s:%s' % (custom.id, item.unique_identifier, False))
def onClearTextButtonClick(self):
"""

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
import logging
from openlp.core.lib import Plugin, StringContent, Receiver, ImageSource, Settings, build_icon, translate
from openlp.core.lib import Plugin, StringContent, Registry, ImageSource, Settings, build_icon, translate
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
log = logging.getLogger(__name__)
@ -50,7 +50,7 @@ class ImagePlugin(Plugin):
self.weight = -7
self.iconPath = u':/plugins/plugin_images.png'
self.icon = build_icon(self.iconPath)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'image_updated'), self.image_updated)
Registry().execute(u'image_updated', self.image_updated)
def about(self):
about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'

View File

@ -29,7 +29,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, Receiver, Settings, UiStrings, translate
from openlp.core.lib import SettingsTab, Registry, Settings, UiStrings, translate
class ImageTab(SettingsTab):
"""
@ -91,5 +91,5 @@ class ImageTab(SettingsTab):
settings.setValue(u'background color', self.bg_color)
settings.endGroup()
if self.initial_color != self.bg_color:
Receiver.send_message(u'image_updated')
Registry().execute(u'image_updated')

View File

@ -32,7 +32,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, ItemCapabilities, Receiver, SettingsManager, ServiceItemContext, \
from openlp.core.lib import MediaManagerItem, ItemCapabilities, Registry, SettingsManager, ServiceItemContext, \
Settings, UiStrings, build_icon, check_item_selected, check_directory_exists, create_thumb, translate, \
validate_thumb
from openlp.core.lib.ui import critical_error_message_box
@ -51,7 +51,7 @@ class ImageMediaItem(MediaManagerItem):
MediaManagerItem.__init__(self, parent, plugin, icon)
self.quickPreviewAllowed = True
self.hasSearch = True
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
Registry().register_function(u'live_theme_changed', self.liveThemeChanged)
# Allow DnD from the desktop
self.listView.activateDnD()

View File

@ -32,7 +32,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import ItemCapabilities, MediaManagerItem,MediaType, Receiver, ServiceItem, ServiceItemContext, \
from openlp.core.lib import ItemCapabilities, MediaManagerItem,MediaType, Registry, ServiceItem, ServiceItemContext, \
Settings, UiStrings, build_icon, check_item_selected, check_directory_exists, translate
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
from openlp.core.ui import DisplayController, Display, DisplayControllerType
@ -71,9 +71,8 @@ class MediaMediaItem(MediaManagerItem):
self.displayController.previewDisplay.screen = {u'size':self.displayController.previewDisplay.geometry()}
self.displayController.previewDisplay.setup()
self.media_controller.setup_display(self.displayController.previewDisplay, False)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'video_background_replaced'),
self.videobackgroundReplaced)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mediaitem_media_rebuild'), self.rebuild_players)
Registry().register_function(u'video_background_replaced', self.videobackgroundReplaced)
Registry().register_function(u'mediaitem_media_rebuild', self.rebuild_players)
Registry().register_function(u'config_screen_changed', self.displaySetup)
# Allow DnD from the desktop
self.listView.activateDnD()

View File

@ -29,7 +29,7 @@
from PyQt4 import QtGui
from openlp.core.lib import Receiver, Settings, SettingsTab, UiStrings, translate
from openlp.core.lib import Registry, Settings, SettingsTab, UiStrings, translate
class MediaQCheckBox(QtGui.QCheckBox):
"""
@ -84,5 +84,5 @@ class MediaTab(SettingsTab):
Settings().setValue(setting_key, self.autoStartCheckBox.checkState())
if override_changed:
self.parent.reset_supported_suffixes()
Receiver.send_message(u'mediaitem_media_rebuild')
Receiver.send_message(u'mediaitem_suffixes')
Registry().execute(u'mediaitem_media_rebuild')
Registry().execute(u'mediaitem_suffixes')

View File

@ -32,7 +32,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, ServiceItemContext, Settings, UiStrings, \
from openlp.core.lib import MediaManagerItem, Registry, ItemCapabilities, ServiceItemContext, Settings, UiStrings, \
build_icon, check_item_selected, create_thumb, translate, validate_thumb
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
from openlp.core.utils import locale_compare
@ -60,9 +60,8 @@ class PresentationMediaItem(MediaManagerItem):
self.message_listener = MessageListener(self)
self.hasSearch = True
self.singleServiceItem = False
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mediaitem_presentation_rebuild'),
self.populateDisplayTypes)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mediaitem_suffixes'), self.buildFileMaskString)
Registry().register_function(u'mediaitem_presentation_rebuild', self.populateDisplayTypes)
Registry().register_function(u'mediaitem_suffixes', self.buildFileMaskString)
# Allow DnD from the desktop
self.listView.activateDnD()

View File

@ -31,7 +31,7 @@ import logging
from PyQt4 import QtCore
from openlp.core.lib import Receiver
from openlp.core.lib import Registry
from openlp.core.ui import HideMode
log = logging.getLogger(__name__)
@ -71,7 +71,7 @@ class Controller(object):
self.hide_mode = hide_mode
if self.is_live:
if hide_mode == HideMode.Screen:
Receiver.send_message(u'live_display_hide', HideMode.Screen)
Registry().execute(u'live_display_hide', HideMode.Screen)
self.stop()
elif hide_mode == HideMode.Theme:
self.blank(hide_mode)
@ -79,7 +79,7 @@ class Controller(object):
self.blank(hide_mode)
else:
self.doc.start_presentation()
Receiver.send_message(u'live_display_hide', HideMode.Screen)
Registry().execute(u'live_display_hide', HideMode.Screen)
self.doc.slidenumber = 1
if slide_no > 1:
self.slide(slide_no)
@ -236,7 +236,7 @@ class Controller(object):
return
if not self.doc.is_active():
return
Receiver.send_message(u'live_display_hide', HideMode.Theme)
Registry().execute(u'live_display_hide', HideMode.Theme)
elif hide_mode == HideMode.Blank:
if not self.activate():
return
@ -273,7 +273,7 @@ class Controller(object):
if self.doc.slidenumber and self.doc.slidenumber != self.doc.get_slide_number():
self.doc.goto_slide(self.doc.slidenumber)
self.doc.unblank_screen()
Receiver.send_message(u'live_display_hide', HideMode.Screen)
Registry().execute(u'live_display_hide', HideMode.Screen)
def poll(self):
if not self.doc:
@ -294,16 +294,16 @@ class MessageListener(object):
self.preview_handler = Controller(False)
self.live_handler = Controller(True)
# messages are sent from core.ui.slidecontroller
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'presentations_start'), self.startup)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'presentations_stop'), self.shutdown)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'presentations_hide'), self.hide)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'presentations_first'), self.first)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'presentations_previous'), self.previous)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'presentations_next'), self.next)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'presentations_last'), self.last)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'presentations_slide'), self.slide)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'presentations_blank'), self.blank)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'presentations_unblank'), self.unblank)
Registry().register_function(u'presentations_start', self.startup)
Registry().register_function(u'presentations_stop', self.shutdown)
Registry().register_function(u'presentations_hide', self.hide)
Registry().register_function(u'presentations_first', self.first)
Registry().register_function(u'presentations_previous', self.previous)
Registry().register_function(u'presentations_next', self.next)
Registry().register_function(u'presentations_last', self.last)
Registry().register_function(u'presentations_slide', self.slide)
Registry().register_function(u'presentations_blank', self.blank)
Registry().register_function(u'presentations_unblank', self.unblank)
self.timer = QtCore.QTimer()
self.timer.setInterval(500)
QtCore.QObject.connect(self.timer, QtCore.SIGNAL(u'timeout()'), self.timeout)

View File

@ -33,7 +33,7 @@ import shutil
from PyQt4 import QtCore
from openlp.core.lib import Receiver, Registry, Settings, check_directory_exists, create_thumb, validate_thumb
from openlp.core.lib import Registry, Settings, check_directory_exists, create_thumb, validate_thumb
from openlp.core.utils import AppLocation
log = logging.getLogger(__name__)
@ -274,7 +274,7 @@ class PresentationDocument(object):
prefix = u'live'
else:
prefix = u'preview'
Receiver.send_message(u'slidecontroller_%s_change' % prefix, self.slidenumber - 1)
Registry().execute(u'slidecontroller_%s_change' % prefix, self.slidenumber - 1)
def get_slide_text(self, slide_no):
"""

View File

@ -29,7 +29,7 @@
from PyQt4 import QtGui
from openlp.core.lib import Receiver, Settings, SettingsTab, UiStrings, translate
from openlp.core.lib import Registry, Settings, SettingsTab, UiStrings, translate
class PresentationTab(SettingsTab):
"""
@ -130,8 +130,8 @@ class PresentationTab(SettingsTab):
changed = True
if changed:
self.parent.reset_supported_suffixes()
Receiver.send_message(u'mediaitem_presentation_rebuild')
Receiver.send_message(u'mediaitem_suffixes')
Registry().execute(u'mediaitem_presentation_rebuild')
Registry().execute(u'mediaitem_suffixes')
def tabVisible(self):
"""

View File

@ -123,7 +123,7 @@ import urlparse
from PyQt4 import QtCore, QtNetwork
from mako.template import Template
from openlp.core.lib import Receiver, Settings, PluginStatus, StringContent
from openlp.core.lib import Registry, Settings, PluginStatus, StringContent
from openlp.core.utils import AppLocation, translate
log = logging.getLogger(__name__)
@ -175,10 +175,8 @@ class HttpServer(object):
address = Settings().value(self.plugin.settingsSection + u'/ip address')
self.server = QtNetwork.QTcpServer()
self.server.listen(QtNetwork.QHostAddress(address), port)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_live_changed'),
self.slide_change)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_live_started'),
self.item_change)
Registry().register_function(u'slidecontroller_live_changed', self.slide_change)
Registry().register_function(u'slidecontroller_live_started', self.item_change)
QtCore.QObject.connect(self.server, QtCore.SIGNAL(u'newConnection()'), self.new_connection)
log.debug(u'TCP listening on port %d' % port)
@ -406,7 +404,7 @@ class HttpConnection(object):
``action``
This is the action, either ``hide`` or ``show``.
"""
Receiver.send_message(u'slidecontroller_toggle_display', action)
Registry().execute(u'slidecontroller_toggle_display', action)
return HttpResponse(json.dumps({u'results': {u'success': True}}),
{u'Content-Type': u'application/json'})
@ -421,7 +419,7 @@ class HttpConnection(object):
except KeyError, ValueError:
return HttpResponse(code=u'400 Bad Request')
text = urllib.unquote(text)
Receiver.send_message(u'alerts_text', [text])
Registry().execute(u'alerts_text', [text])
success = True
else:
success = False
@ -471,9 +469,9 @@ class HttpConnection(object):
log.info(data)
# This slot expects an int within a list.
id = data[u'request'][u'id']
Receiver.send_message(event, [id])
Registry().execute(event, [id])
else:
Receiver.send_message(event)
Registry().execute(event)
json_data = {u'results': {u'success': True}}
return HttpResponse(json.dumps(json_data),
{u'Content-Type': u'application/json'})
@ -490,9 +488,9 @@ class HttpConnection(object):
data = json.loads(self.url_params[u'data'][0])
except KeyError, ValueError:
return HttpResponse(code=u'400 Bad Request')
Receiver.send_message(event, data[u'request'][u'id'])
Registry().execute(event, data[u'request'][u'id'])
else:
Receiver.send_message(event)
Registry().execute(event)
return HttpResponse(json.dumps({u'results': {u'success': True}}),
{u'Content-Type': u'application/json'})

View File

@ -29,7 +29,7 @@
from PyQt4 import QtCore, QtGui, QtNetwork
from openlp.core.lib import Registry, Settings, SettingsTab, Receiver, translate
from openlp.core.lib import Registry, Settings, SettingsTab, translate
ZERO_URL = u'0.0.0.0'

View File

@ -38,7 +38,7 @@ import shutil
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Registry, PluginStatus, Receiver, MediaType, translate, create_separated_list, \
from openlp.core.lib import Registry, PluginStatus, MediaType, translate, create_separated_list, \
check_directory_exists, UiStrings
from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, \
find_and_set_in_combo_box
@ -699,7 +699,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
log.debug(u'onPreview')
if button.objectName() == u'previewButton':
self.saveSong(True)
Receiver.send_message(u'songs_preview')
Registry().execute(u'songs_preview')
def onAudioAddFromFileButtonClicked(self):
"""

View File

@ -34,7 +34,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, UiStrings, create_separated_list, build_icon, translate
from openlp.core.lib import Registry, UiStrings, create_separated_list, build_icon, translate
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.plugins.songs.lib import natcmp
@ -62,7 +62,7 @@ class SongExportForm(OpenLPWizard):
"""
OpenLPWizard.__init__(self, parent, plugin, u'songExportWizard', u':/wizards/wizard_exportsong.bmp')
self.stop_export_flag = False
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_export)
Registry().register_function(u'openlp_stop_wizard', self.stop_export)
def stop_export(self):
"""

View File

@ -31,7 +31,7 @@ import logging
from PyQt4 import QtGui, QtCore
from sqlalchemy.sql import and_
from openlp.core.lib import Receiver, UiStrings, translate
from openlp.core.lib import Registry, UiStrings, translate
from openlp.core.lib.ui import critical_error_message_box
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
from openlp.plugins.songs.lib.db import Author, Book, Topic, Song
@ -283,7 +283,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
if self.manager.save_object(author):
self.resetAuthors()
if not self.fromSongEdit:
Receiver.send_message(u'songs_load_list')
Registry().execute(u'songs_load_list')
else:
critical_error_message_box(
message=translate('SongsPlugin.SongMaintenanceForm', 'Could not save your changes.'))
@ -378,7 +378,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
merge(dbObject)
reset()
if not self.fromSongEdit:
Receiver.send_message(u'songs_load_list')
Registry().execute(u'songs_load_list')
self.application.set_normal_cursor()
def mergeAuthors(self, oldAuthor):

View File

@ -36,8 +36,7 @@ from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import or_
from openlp.core.lib import Registry, MediaManagerItem, Receiver, ItemCapabilities, PluginStatus, ServiceItemContext, \
Settings, \
from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, PluginStatus, ServiceItemContext, Settings, \
UiStrings, translate, check_item_selected, create_separated_list, check_directory_exists
from openlp.core.lib.ui import create_widget_action
from openlp.core.utils import AppLocation
@ -101,9 +100,9 @@ class SongMediaItem(MediaManagerItem):
triggers=self.onSongMaintenanceClick)
self.addSearchToToolBar()
# Signals and slots
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_load_list'), self.onSongListLoad)
Registry().register_function(u'songs_load_list', self.onSongListLoad)
Registry().register_function(u'config_updated', self.config_update)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_preview'), self.onPreviewClick)
Registry().register_function(u'songs_preview', self.onPreviewClick)
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'),
self.onSearchTextButtonClicked)
@ -295,7 +294,7 @@ class SongMediaItem(MediaManagerItem):
self.importWizard = SongImportForm(self, self.plugin)
self.importWizard.exec_()
# Run song load as list may have been cancelled but some songs loaded
Receiver.send_message(u'songs_load_list')
Registry().execute(u'songs_load_list')
def onExportClick(self):
if not hasattr(self, u'exportWizard'):

View File

@ -34,7 +34,7 @@ import os
from PyQt4 import QtCore
from openlp.core.lib import Receiver, translate, check_directory_exists
from openlp.core.lib import Registry, translate, check_directory_exists
from openlp.core.ui.wizard import WizardStrings
from openlp.core.utils import AppLocation
from openlp.plugins.songs.lib import clean_song, VerseType
@ -83,7 +83,7 @@ class SongImport(QtCore.QObject):
self.song = None
self.stopImportFlag = False
self.setDefaults()
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_stop_wizard'), self.stopImport)
Registry().register_function(u'openlp_stop_wizard', self.stopImport)
def setDefaults(self):
"""

View File

@ -32,7 +32,7 @@ from datetime import datetime
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, Receiver, Settings, StringContent, build_icon, translate
from openlp.core.lib import Plugin, Registry, Settings, StringContent, build_icon, translate
from openlp.core.lib.db import Manager
from openlp.core.lib.ui import create_action
from openlp.core.utils.actions import ActionList
@ -123,10 +123,8 @@ class SongUsagePlugin(Plugin):
def initialise(self):
log.info(u'SongUsage Initialising')
Plugin.initialise(self)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_live_started'),
self.displaySongUsage)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'print_service_started'),
self.printSongUsage)
Registry().register_function(u'slidecontroller_live_started', self.displaySongUsage)
Registry().register_function(u'print_service_started', self.printSongUsage)
self.songUsageActive = Settings().value(self.settingsSection + u'/active')
# Set the button and checkbox state
self.setButtonState()