From dfced32cf298d19d2d6e01ee977dbd3f74f5713f Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 9 Nov 2009 21:10:28 +0200 Subject: [PATCH 1/6] Expanded commandline options to include a specific logging level, a Qt4 style, and whether or not OpenLP should be run in portable mode. --- openlp.pyw | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 4eaf8ee22..12e90a975 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -131,8 +131,16 @@ def main(): # Set up command line options. usage = u'Usage: %prog [options] [qt-options]' parser = OptionParser(usage=usage) - parser.add_option("-d", "--debug", dest="debug", - action="store_true", help="set logging to DEBUG level") + parser.add_option("-l", "--log-level", dest="loglevel", + default="info", metavar="LEVEL", + help="Set logging to LEVEL level. Valid values are " + "\"debug\", \"info\", \"warning\".") + parser.add_option("-p", "--portable", dest="portable", + action="store_true", + help="Specify if this should be run as a portable app, " + "off a USB flash drive.") + parser.add_option("-s", "--style", dest="style", + help="Set the Qt4 style (passed directly to Qt4).") # Set up logging filename = u'openlp.log' logfile = RotatingFileHandler(filename, maxBytes=200000, backupCount=5) @@ -141,14 +149,21 @@ def main(): log.addHandler(logfile) # Parse command line options and deal with them. (options, args) = parser.parse_args() - if options.debug: + qt_args = [] + if options.loglevel.lower() in ['d', 'debug']: log.setLevel(logging.DEBUG) + elif options.loglevel.lower() in ['w', 'warning']: + log.setLevel(logging.WARNING) else: log.setLevel(logging.INFO) + if options.style: + qt_args.extend(['-style', options.style]) + # Throw the rest of the arguments at Qt, just in case. + qt_args.extend(args) # Initialise the resources qInitResources() # Now create and actually run the application. - app = OpenLP(sys.argv) + app = OpenLP(qt_args) sys.exit(app.run()) if __name__ == u'__main__': From 262577bd6e72abe5a8e432b1022602c894096077 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 13 Nov 2009 20:46:47 +0200 Subject: [PATCH 2/6] Removed an unused parameter from addToolbarButton, and added a "checkable" argument. --- openlp/core/lib/toolbar.py | 9 +++++++-- openlp/core/ui/slidecontroller.py | 13 ++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/openlp/core/lib/toolbar.py b/openlp/core/lib/toolbar.py index 8ab0e1961..6ed221cf4 100644 --- a/openlp/core/lib/toolbar.py +++ b/openlp/core/lib/toolbar.py @@ -46,7 +46,7 @@ class OpenLPToolbar(QtGui.QToolBar): self.log.debug(u'Init done') def addToolbarButton(self, title, icon, tooltip=None, slot=None, - objectname=None): + checkable=False): """ A method to help developers easily add a button to the toolbar. @@ -69,12 +69,17 @@ class OpenLPToolbar(QtGui.QToolBar): """ ButtonIcon = buildIcon(icon) if ButtonIcon: - if slot: + if slot and not checkable: ToolbarButton = self.addAction(ButtonIcon, title, slot) else: ToolbarButton = self.addAction(ButtonIcon, title) if tooltip: ToolbarButton.setToolTip(tooltip) + if checkable: + ToolbarButton.setCheckable(True) + QtCore.QObject.connect(ToolbarButton, + QtCore.SIGNAL(u'toggled(bool)'), slot) + #log.debug(u'checkable') self.icons[title] = ButtonIcon self.actions[title] = ToolbarButton diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 88e81bfae..16efa6fbc 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -159,8 +159,11 @@ class SlideController(QtGui.QWidget): self.trUtf8(u'Move to last'), self.onSlideSelectedLast) if self.isLive: self.Toolbar.addToolbarSeparator(u'Close Separator') - self.blackPushButton = self.Toolbar.addPushButton( - u':/slides/slide_close.png') + self.Toolbar.addToolbarButton( + u'Blank Screen', u':/slides/slide_close.png', + self.trUtf8(u'Blank Screen'), self.onBlankScreen, True) + #self.blackPushButton = self.Toolbar.addPushButton( + # u':/slides/slide_close.png') if not self.isLive: self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarButton( @@ -197,7 +200,7 @@ class SlideController(QtGui.QWidget): self.trUtf8(u'Start playing media'), self.onMediaStop) self.volumeSlider = Phonon.VolumeSlider() self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24)) - self.volumeSlider.setObjectName("volumeSlider") + self.volumeSlider.setObjectName(u'volumeSlider') self.Mediabar.addToolbarWidget( u'Audio Volume', self.volumeSlider) self.ControllerLayout.addWidget(self.Mediabar) @@ -265,8 +268,8 @@ class SlideController(QtGui.QWidget): QtCore.QObject.connect(self.PreviewListWidget, QtCore.SIGNAL(u'activated(QModelIndex)'), self.onSlideSelected) if isLive: - QtCore.QObject.connect(self.blackPushButton, - QtCore.SIGNAL(u'clicked(bool)'), self.onBlankScreen) + #QtCore.QObject.connect(self.blackPushButton, + # QtCore.SIGNAL(u'clicked(bool)'), self.onBlankScreen) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'update_spin_delay'), self.receiveSpinDelay) Receiver().send_message(u'request_spin_delay') From 8c599b670738a347fbb5306484f9df9a63c30bcb Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 13 Nov 2009 22:10:35 +0200 Subject: [PATCH 3/6] Fixed up an issue between the display screen and the blank button --- openlp/core/lib/toolbar.py | 2 +- openlp/core/ui/maindisplay.py | 10 ++++----- openlp/core/ui/slidecontroller.py | 36 +++++++++++++++---------------- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/openlp/core/lib/toolbar.py b/openlp/core/lib/toolbar.py index 6ed221cf4..564a30db7 100644 --- a/openlp/core/lib/toolbar.py +++ b/openlp/core/lib/toolbar.py @@ -79,9 +79,9 @@ class OpenLPToolbar(QtGui.QToolBar): ToolbarButton.setCheckable(True) QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL(u'toggled(bool)'), slot) - #log.debug(u'checkable') self.icons[title] = ButtonIcon self.actions[title] = ToolbarButton + return ToolbarButton def addToolbarSeparator(self, handle): """ diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 5fea3268e..7884b5d80 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -208,7 +208,7 @@ class MainDisplay(DisplayWidget): # def aa(self): # self.setWindowOpacity(1) - def blankDisplay(self): + def blankDisplay(self, blanked=True): if not self.displayBlank: self.displayBlank = True self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) @@ -216,11 +216,9 @@ class MainDisplay(DisplayWidget): self.displayBlank = False if self.frame: self.frameView(self.frame) - if self.parent.LiveController.blackPushButton.isChecked() != \ - self.displayBlank: - self.parent.LiveController.blackPushButton.setChecked( - self.displayBlank) - self.parent.generalConfig.set_config(u'Screen Blank',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/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 16efa6fbc..1fe31d666 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -159,11 +159,9 @@ class SlideController(QtGui.QWidget): self.trUtf8(u'Move to last'), self.onSlideSelectedLast) if self.isLive: self.Toolbar.addToolbarSeparator(u'Close Separator') - self.Toolbar.addToolbarButton( + self.blankButton = self.Toolbar.addToolbarButton( u'Blank Screen', u':/slides/slide_close.png', self.trUtf8(u'Blank Screen'), self.onBlankScreen, True) - #self.blackPushButton = self.Toolbar.addPushButton( - # u':/slides/slide_close.png') if not self.isLive: self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarButton( @@ -272,7 +270,7 @@ class SlideController(QtGui.QWidget): # QtCore.SIGNAL(u'clicked(bool)'), self.onBlankScreen) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'update_spin_delay'), self.receiveSpinDelay) - Receiver().send_message(u'request_spin_delay') + Receiver.send_message(u'request_spin_delay') if isLive: self.Toolbar.makeWidgetsInvisible(self.image_list) else: @@ -405,7 +403,7 @@ class SlideController(QtGui.QWidget): self.enableToolBar(item) if item.isCommand(): if self.isLive: - Receiver().send_message(u'%s_start' % item.name.lower(), \ + Receiver.send_message(u'%s_start' % item.name.lower(), \ [item.shortname, item.service_item_path, item.service_frames[0][u'title'], self.isLive]) else: @@ -438,7 +436,7 @@ class SlideController(QtGui.QWidget): self.enableToolBar(item) if item.isCommand(): if self.isLive: - Receiver().send_message(u'%s_start' % item.name.lower(), \ + Receiver.send_message(u'%s_start' % item.name.lower(), \ [item.shortname, item.service_item_path, item.service_frames[0][u'title'], slideno, self.isLive]) else: @@ -491,7 +489,7 @@ class SlideController(QtGui.QWidget): self.PreviewListWidget.setFocus() log.log(15, u'Display Rendering took %4s' % (time.time() - before)) if self.serviceitem.audit and self.isLive: - Receiver().send_message(u'songusage_live', self.serviceitem.audit) + Receiver.send_message(u'songusage_live', self.serviceitem.audit) log.debug(u'displayServiceManagerItems End') #Screen event methods @@ -500,7 +498,7 @@ class SlideController(QtGui.QWidget): Go to the first slide. """ if self.commandItem and self.commandItem.isCommand(): - Receiver().send_message(u'%s_first'% self.commandItem.name.lower()) + Receiver.send_message(u'%s_first'% self.commandItem.name.lower()) self.updatePreview() else: self.PreviewListWidget.selectRow(0) @@ -512,11 +510,11 @@ class SlideController(QtGui.QWidget): """ if self.commandItem and self.commandItem.isCommand(): if blanked: - Receiver().send_message(u'%s_blank'% self.commandItem.name.lower()) + Receiver.send_message(u'%s_blank'% self.commandItem.name.lower()) else: - Receiver().send_message(u'%s_unblank'% self.commandItem.name.lower()) + Receiver.send_message(u'%s_unblank'% self.commandItem.name.lower()) else: - self.parent.mainDisplay.blankDisplay() + self.parent.mainDisplay.blankDisplay(blanked) def onSlideSelected(self): """ @@ -527,7 +525,7 @@ class SlideController(QtGui.QWidget): self.row = 0 if row > -1 and row < self.PreviewListWidget.rowCount(): if self.commandItem.isCommand(): - Receiver().send_message(u'%s_slide'% self.commandItem.name.lower(), [row]) + Receiver.send_message(u'%s_slide'% self.commandItem.name.lower(), [row]) if self.isLive: self.updatePreview() else: @@ -572,7 +570,7 @@ class SlideController(QtGui.QWidget): Go to the next slide. """ if self.commandItem and self.commandItem.isCommand(): - Receiver().send_message(u'%s_next'% self.commandItem.name.lower()) + Receiver.send_message(u'%s_next'% self.commandItem.name.lower()) self.updatePreview() else: row = self.PreviewListWidget.currentRow() + 1 @@ -586,7 +584,7 @@ class SlideController(QtGui.QWidget): Go to the previous slide. """ if self.commandItem and self.commandItem.isCommand(): - Receiver().send_message( + Receiver.send_message( u'%s_previous'% self.commandItem.name.lower()) self.updatePreview() else: @@ -601,7 +599,7 @@ class SlideController(QtGui.QWidget): Go to the last slide. """ if self.commandItem and self.commandItem.isCommand(): - Receiver().send_message(u'%s_last'% self.commandItem.name.lower()) + Receiver.send_message(u'%s_last'% self.commandItem.name.lower()) self.updatePreview() else: self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1) @@ -630,7 +628,7 @@ class SlideController(QtGui.QWidget): def onEditSong(self): self.songEdit = True - Receiver().send_message(u'%s_edit' % self.commandItem.name, u'P:%s' % + Receiver.send_message(u'%s_edit' % self.commandItem.name, u'P:%s' % self.commandItem.editId ) def onGoLive(self): @@ -651,13 +649,13 @@ class SlideController(QtGui.QWidget): def onMediaPause(self): if self.isLive: - Receiver().send_message(u'%s_pause'% self.commandItem.name.lower()) + Receiver.send_message(u'%s_pause'% self.commandItem.name.lower()) else: self.mediaObject.pause() def onMediaPlay(self): if self.isLive: - Receiver().send_message(u'%s_play'% self.commandItem.name.lower(), self.isLive) + Receiver.send_message(u'%s_play'% self.commandItem.name.lower(), self.isLive) else: self.SlidePreview.hide() self.video.show() @@ -665,7 +663,7 @@ class SlideController(QtGui.QWidget): def onMediaStop(self): if self.isLive: - Receiver().send_message(u'%s_stop'% self.commandItem.name.lower()) + Receiver.send_message(u'%s_stop'% self.commandItem.name.lower()) else: self.mediaObject.stop() self.video.hide() From 1d80bb6229f12915374221b8fc142d4497e1bd8a Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 13 Nov 2009 23:24:59 +0200 Subject: [PATCH 4/6] Attempt to fix recursion in blanking. Fixed all the Receiver.send_message instances to stop instantiating the Receiver class. --- openlp/core/lib/eventreceiver.py | 12 ++++++------ openlp/core/ui/maindisplay.py | 16 +++++++--------- openlp/core/ui/servicemanager.py | 4 ++-- openlp/core/ui/settingsform.py | 2 +- openlp/core/ui/slidecontroller.py | 5 +++++ openlp/core/ui/thememanager.py | 4 ++-- openlp/core/ui/themestab.py | 4 ++-- openlp/plugins/bibles/forms/bibleimportform.py | 6 +++--- openlp/plugins/bibles/lib/bibleCSVimpl.py | 6 +++--- openlp/plugins/bibles/lib/bibleOSISimpl.py | 6 +++--- openlp/plugins/bibles/lib/mediaitem.py | 4 ++-- openlp/plugins/custom/forms/editcustomform.py | 6 +++--- openlp/plugins/images/lib/imagetab.py | 4 ++-- .../presentations/lib/messagelistener.py | 10 +++++----- .../lib/presentationcontroller.py | 18 +++++++++--------- openlp/plugins/remotes/remoteplugin.py | 4 ++-- openlp/plugins/songs/forms/editsongform.py | 6 +++--- 17 files changed, 60 insertions(+), 57 deletions(-) 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): From 9e96aac8499159bca3b0bd97d3376ec9863ee215 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 13 Nov 2009 23:37:11 +0200 Subject: [PATCH 5/6] Make sure screen and button are still black after coming back from media. --- openlp/core/ui/slidecontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 787488c31..a21edd994 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -507,7 +507,7 @@ class SlideController(QtGui.QWidget): self.onSlideSelected() def onBlankDisplay(self): - self.blankButton.setChecked(not self.parent.mainDisplay.displayBlank) + self.blankButton.setChecked(self.parent.mainDisplay.displayBlank) def onBlankScreen(self, blanked): """ From 461acc2bc8328895f4f7f923d82de521531bc1b0 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 14 Nov 2009 22:18:14 +0200 Subject: [PATCH 6/6] Added a small fix, courtesy of Jon Tibble. --- openlp/core/ui/maindisplay.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 6b7ca55bb..fd2b08af3 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -214,8 +214,8 @@ class MainDisplay(DisplayWidget): self.displayBlank = False if self.frame: self.frameView(self.frame) - #if blanked != self.displayBlank: - # self.parent.LiveController.blankButton.setChecked(self.displayBlank) + if blanked != self.parent.LiveController.blankButton.isChecked(): + self.parent.LiveController.blankButton.setChecked(self.displayBlank) self.parent.generalConfig.set_config(u'Screen Blank', self.displayBlank) def displayAlert(self, text=u''):