diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index 4072672f4..96b4832e2 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -129,16 +129,16 @@ class EventReceiver(QtCore.QObject): class Receiver(): """ - 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 QT - signal/slot architecture can send messages across the system. + 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'<>', data)`` + ``Receiver.send_message(u'<>', data)`` To receive a Message - ``QtCore.QObject.connect(Receiver().get_receiver(), QtCore.SIGNAL(u'<>'), <>)`` + ``QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'<>'), <>)`` """ eventreceiver = EventReceiver() diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 7884b5d80..6b7ca55bb 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -48,16 +48,16 @@ class DisplayWidget(QtGui.QWidget): if type(event) == QtGui.QKeyEvent: #here accept the event and do something if event.key() == QtCore.Qt.Key_Up: - Receiver().send_message(u'live_slidecontroller_previous') + Receiver.send_message(u'live_slidecontroller_previous') event.accept() elif event.key() == QtCore.Qt.Key_Down: - Receiver().send_message(u'live_slidecontroller_next') + Receiver.send_message(u'live_slidecontroller_next') event.accept() elif event.key() == QtCore.Qt.Key_PageUp: - Receiver().send_message(u'live_slidecontroller_first') + Receiver.send_message(u'live_slidecontroller_first') event.accept() elif event.key() == QtCore.Qt.Key_PageDown: - Receiver().send_message(u'live_slidecontroller_last') + Receiver.send_message(u'live_slidecontroller_last') event.accept() elif event.key() == QtCore.Qt.Key_Escape: self.resetDisplay() @@ -111,8 +111,6 @@ class MainDisplay(DisplayWidget): self.timer_id = 0 self.firstTime = True self.mediaLoaded = False - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'live_slide_blank'), self.blankDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'alert_text'), self.displayAlert) QtCore.QObject.connect(Receiver.get_receiver(), @@ -209,15 +207,15 @@ class MainDisplay(DisplayWidget): # self.setWindowOpacity(1) def blankDisplay(self, blanked=True): - if not self.displayBlank: + if blanked: self.displayBlank = True self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) else: self.displayBlank = False if self.frame: self.frameView(self.frame) - if blanked != self.displayBlank: - self.parent.LiveController.blankButton.setChecked(self.displayBlank) + #if blanked != self.displayBlank: + # self.parent.LiveController.blankButton.setChecked(self.displayBlank) self.parent.generalConfig.set_config(u'Screen Blank', self.displayBlank) def displayAlert(self, text=u''): diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index bb39b573e..3ba2ebbb5 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -599,7 +599,7 @@ class ServiceManager(QtGui.QWidget): item, count = self.findServiceItem() if self.serviceItems[item][u'data'].editEnabled: self.remoteEditTriggered = True - Receiver().send_message(u'%s_edit' % self.serviceItems[item][u'data'].name, u'L:%s' % + Receiver.send_message(u'%s_edit' % self.serviceItems[item][u'data'].name, u'L:%s' % self.serviceItems[item][u'data'].editId ) def onRemoteEditClear(self): @@ -666,7 +666,7 @@ class ServiceManager(QtGui.QWidget): self.serviceItems.insert(newpos, serviceItem) self.repaintServiceList(endpos, startCount) else: - Receiver().send_message(u'%s_add_service_item' % plugin) + Receiver.send_message(u'%s_add_service_item' % plugin) def updateThemeList(self, theme_list): """ diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index a91e1aecb..f14c64ebd 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -67,7 +67,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): def accept(self): for tab_index in range(0, self.SettingsTabWidget.count()): self.SettingsTabWidget.widget(tab_index).save() - Receiver().send_message(u'config_updated') + Receiver.send_message(u'config_updated') return QtGui.QDialog.accept(self) def postSetUp(self): diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 1fe31d666..787488c31 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -162,6 +162,8 @@ class SlideController(QtGui.QWidget): self.blankButton = self.Toolbar.addToolbarButton( u'Blank Screen', u':/slides/slide_close.png', self.trUtf8(u'Blank Screen'), self.onBlankScreen, True) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'live_slide_blank'), self.onBlankDisplay) if not self.isLive: self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarButton( @@ -504,6 +506,9 @@ class SlideController(QtGui.QWidget): self.PreviewListWidget.selectRow(0) self.onSlideSelected() + def onBlankDisplay(self): + self.blankButton.setChecked(not self.parent.mainDisplay.displayBlank) + def onBlankScreen(self, blanked): """ Blank the screen. diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 51f1f2425..c165075eb 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -145,7 +145,7 @@ class ThemeManager(QtGui.QWidget): name = u'%s (%s)' % (self.global_theme, self.trUtf8(u'default')) self.ThemeListWidget.item(count).setText(name) self.config.set_config(u'theme global theme', self.global_theme) - Receiver().send_message( + Receiver.send_message( u'update_global_theme', self.global_theme) self.pushThemes() @@ -265,7 +265,7 @@ class ThemeManager(QtGui.QWidget): self.pushThemes() def pushThemes(self): - Receiver().send_message(u'update_themes', self.getThemes() ) + Receiver.send_message(u'update_themes', self.getThemes() ) def getThemes(self): return self.themelist diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 2afbf297c..d5c91c5e3 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -135,10 +135,10 @@ class ThemesTab(SettingsTab): def save(self): self.config.set_config(u'theme global style', self.global_style ) self.config.set_config(u'theme global theme',self.global_theme) - Receiver().send_message(u'update_global_theme', self.global_theme ) + Receiver.send_message(u'update_global_theme', self.global_theme ) def postSetUp(self): - Receiver().send_message(u'update_global_theme', self.global_theme ) + Receiver.send_message(u'update_global_theme', self.global_theme ) def onSongLevelButtonPressed(self): self.global_style = u'Song' diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 62210d44f..633855ceb 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -199,9 +199,9 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): def onCancelButtonClicked(self): # tell import to stop self.message = self.trUtf8(u'Bible import stopped') - Receiver().send_message(u'stop_import') + Receiver.send_message(u'stop_import') # tell bibleplugin to reload the bibles - Receiver().send_message(u'pre_load_bibles') + Receiver.send_message(u'pre_load_bibles') self.close() def onImportButtonClicked(self): @@ -220,7 +220,7 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): self.MessageLabel.setText(message) self.ProgressBar.setValue(self.barmax) # tell bibleplugin to reload the bibles - Receiver().send_message(u'pre_load_bibles') + Receiver.send_message(u'pre_load_bibles') QtGui.QMessageBox.information(self, self.trUtf8(u'Information'), self.trUtf8(message)) diff --git a/openlp/plugins/bibles/lib/bibleCSVimpl.py b/openlp/plugins/bibles/lib/bibleCSVimpl.py index 15a29f900..3410478fb 100644 --- a/openlp/plugins/bibles/lib/bibleCSVimpl.py +++ b/openlp/plugins/bibles/lib/bibleCSVimpl.py @@ -40,7 +40,7 @@ class BibleCSVImpl(BibleCommon): """ self.bibledb = bibledb self.loadbible = True - QtCore.QObject.connect(Receiver().get_receiver(), + QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlpstopimport'), self.stop_import) def stop_import(self): @@ -66,7 +66,7 @@ class BibleCSVImpl(BibleCommon): count += 1 #Flush the screen events if count % 3 == 0: - Receiver().send_message(u'process_events') + Receiver.send_message(u'process_events') count = 0 except: log.exception(u'Loading books from file failed') @@ -97,7 +97,7 @@ class BibleCSVImpl(BibleCommon): count += 1 #Every x verses repaint the screen if count % 3 == 0: - Receiver().send_message(u'process_events') + Receiver.send_message(u'process_events') count = 0 except: log.exception(u'Loading verses from file failed') diff --git a/openlp/plugins/bibles/lib/bibleOSISimpl.py b/openlp/plugins/bibles/lib/bibleOSISimpl.py index d4f94d6c3..0e16c0256 100644 --- a/openlp/plugins/bibles/lib/bibleOSISimpl.py +++ b/openlp/plugins/bibles/lib/bibleOSISimpl.py @@ -74,7 +74,7 @@ class BibleOSISImpl(): self.loadbible = False if fbibles: fbibles.close() - QtCore.QObject.connect(Receiver().get_receiver(), + QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlpstopimport'), self.stop_import) def stop_import(self): @@ -173,13 +173,13 @@ class BibleOSISImpl(): testament) dialogobject.incrementProgressBar( self.booksOfBible[p[0]]) - Receiver().send_message(u'process_events') + Receiver.send_message(u'process_events') count = 0 self.bibledb.add_verse(book.id, p[1], p[2], text) count += 1 #Every 3 verses repaint the screen if count % 3 == 0: - Receiver().send_message(u'process_events') + Receiver.send_message(u'process_events') count = 0 except: log.exception(u'Loading bible from OSIS file failed') diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index a8106d4f6..d2f469242 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -54,7 +54,7 @@ class BibleMediaItem(MediaManagerItem): MediaManagerItem.__init__(self, parent, icon, title) # place to store the search results self.search_results = {} - QtCore.QObject.connect(Receiver().get_receiver(), + QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlpreloadbibles'), self.reloadBibles) def initPluginNameVisible(self): @@ -284,7 +284,7 @@ class BibleMediaItem(MediaManagerItem): def setQuickMessage(self, text): self.QuickMessage.setText(text) self.AdvancedMessage.setText(text) - Receiver().send_message(u'process_events') + Receiver.send_message(u'process_events') #minor delay to get the events processed time.sleep(0.1) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 35d1e9ab0..1fef1df65 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -82,7 +82,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): log.debug(u'onPreview') if button.text() == unicode(self.trUtf8(u'Save && Preview')) \ and self.saveCustom(): - Receiver().send_message(u'preview_custom') + Receiver.send_message(u'preview_custom') def initialise(self): self.editAll = False @@ -130,13 +130,13 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): self.previewButton.setVisible(True) def closePressed(self): - Receiver().send_message(u'remote_edit_clear') + Receiver.send_message(u'remote_edit_clear') self.close() def accept(self): log.debug(u'accept') if self.saveCustom(): - Receiver().send_message(u'load_custom_list') + Receiver.send_message(u'load_custom_list') self.close() def saveCustom(self): diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py index 84da616d0..40653706f 100644 --- a/openlp/plugins/images/lib/imagetab.py +++ b/openlp/plugins/images/lib/imagetab.py @@ -74,7 +74,7 @@ class ImageTab(SettingsTab): def save(self): self.config.set_config(u'loop delay', self.loop_delay) - Receiver().send_message(u'update_spin_delay', self.loop_delay) + Receiver.send_message(u'update_spin_delay', self.loop_delay) def postSetUp(self): - Receiver().send_message(u'update_spin_delay', self.loop_delay) + Receiver.send_message(u'update_spin_delay', self.loop_delay) diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 12e1b6570..022b2cd3f 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -77,7 +77,7 @@ class MessageListener(object): self.controller.load_presentation(file) if self.is_live: self.controller.start_presentation() - Receiver().send_message(u'live_slide_hide') + Receiver.send_message(u'live_slide_hide') self.controller.slidenumber = 0 self.timer.start() @@ -89,7 +89,7 @@ class MessageListener(object): self.controller.start_presentation() if self.controller.slidenumber > 1: self.controller.goto_slide(self.controller.slidenumber) - + def slide(self, message): if not self.is_live: return @@ -143,7 +143,7 @@ class MessageListener(object): Based on the handler passed at startup triggers slide show to shut down """ if self.is_live: - Receiver().send_message(u'live_slide_show') + Receiver.send_message(u'live_slide_show') self.controller.close_presentation() self.controller.slidenumber = 0 self.timer.stop() @@ -155,13 +155,13 @@ class MessageListener(object): return if not self.controller.is_active(): return - self.controller.blank_screen() + self.controller.blank_screen() def unblank(self): if not self.is_live: return self.activate() - self.controller.unblank_screen() + self.controller.unblank_screen() def decodeMessage(self, message): """ diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index caa6fcd3f..1e33ceab4 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -50,25 +50,25 @@ class PresentationController(object): ``name`` The name that appears in the options and the media manager - + ``enabled`` The controller is enabled ``available`` The controller is available on this machine. Set by init via call to check_available - + ``plugin`` The presentationplugin object **Hook Functions** - + ``kill()`` Called at system exit to clean up any running presentations ``check_available()`` Returns True if presentation application is installed/can run on this machine - + ``presentation_deleted()`` Deletes presentation specific files, e.g. thumbnails @@ -83,7 +83,7 @@ class PresentationController(object): ``is_active()`` Returns True if a presentation is currently running - + ``blank_screen()`` Blanks the screen, making it black. @@ -118,7 +118,7 @@ class PresentationController(object): global log log = logging.getLogger(u'PresentationController') log.info(u'loaded') - + def __init__(self, plugin=None, name=u'PresentationController'): """ This is the constructor for the presentationcontroller object. @@ -163,7 +163,7 @@ class PresentationController(object): """ self.store_filename(presentation) shutil.rmtree(self.thumbnailpath) - + def start_process(self): """ Loads a running version of the presentation application in the background. @@ -229,7 +229,7 @@ class PresentationController(object): Returns true if a presentation is loaded """ return False - + def blank_screen(self): """ Blanks the screen, making it black. @@ -311,5 +311,5 @@ class PresentationController(object): prefix = u'live' else: prefix = u'preview' - Receiver().send_message(u'%s_slidecontroller_change' % prefix, + Receiver.send_message(u'%s_slidecontroller_change' % prefix, self.slidenumber - 1) diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 451887751..13664da1e 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -73,9 +73,9 @@ class RemotesPlugin(Plugin): pos = datagram.find(u':') event = unicode(datagram[:pos].lower()) if event == u'alert': - Receiver().send_message(u'alert_text', unicode(datagram[pos + 1:])) + Receiver.send_message(u'alert_text', unicode(datagram[pos + 1:])) if event == u'next_slide': - Receiver().send_message(u'live_slide_next') + Receiver.send_message(u'live_slide_next') def about(self): about_text = self.trUtf8(u'Remote Plugin
This plugin ' diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 26d5bbc1e..714442de1 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -404,16 +404,16 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): log.debug(u'onPreview') if button.text() == unicode(self.trUtf8(u'Save && Preview')) \ and self.saveSong(): - Receiver().send_message(u'preview_song') + Receiver.send_message(u'preview_song') def closePressed(self): - Receiver().send_message(u'remote_edit_clear') + Receiver.send_message(u'remote_edit_clear') self.close() def accept(self): log.debug(u'accept') if self.saveSong(): - Receiver().send_message(u'load_song_list') + Receiver.send_message(u'load_song_list') self.close() def saveSong(self):