From c35ff6b8d10f87560e0af1cd377ad60752174958 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 23 Jan 2010 09:49:01 +0000 Subject: [PATCH 1/5] Presentation display fixes --- openlp/core/ui/maindisplay.py | 3 ++- openlp/core/ui/slidecontroller.py | 5 +++-- .../plugins/presentations/lib/impresscontroller.py | 14 +++++++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 62457df6f..35828e85f 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -236,7 +236,7 @@ class MainDisplay(DisplayWidget): """ log.debug(u'display alert called %s' % text) self.alertList.append(text) - if self.timer_id != 0: + if self.timer_id != 0 or self.mediaLoaded: return self.generateAlert() @@ -299,6 +299,7 @@ class MainDisplay(DisplayWidget): self.firstTime = True self.mediaLoaded = True self.display.hide() + self.alertDisplay.hide() self.video.setFullScreen(True) self.video.setVisible(True) self.mediaObject.play() diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index da7b98bfc..6e3d6ad1d 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -493,6 +493,7 @@ class SlideController(QtGui.QWidget): """ Blank the screen. """ + print "onbl", blanked if self.serviceItem is not None: if self.serviceItem.is_command(): if blanked: @@ -550,7 +551,7 @@ class SlideController(QtGui.QWidget): def grabMainDisplay(self): rm = self.parent.RenderManager winid = QtGui.QApplication.desktop().winId() - rect = rm.screen_list[rm.current_display][u'size'] + rect = rm.screens.current[u'size'] winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height()) self.SlidePreview.setPixmap(winimg) @@ -666,7 +667,7 @@ class SlideController(QtGui.QWidget): def onMediaStop(self): if self.isLive: - Receiver.send_message(u'%s_stop'% self.serviceItem.name.lower()) + Receiver.send_message(u'%s_stop'% self.serviceItem.name.lower(), self.isLive) else: self.mediaObject.stop() self.video.hide() diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 28c6690e3..dc0a3bf82 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -232,13 +232,13 @@ class ImpressController(PresentationController): """ if self.document: if self.presentation: - self.presentation.end() - self.presentation = None - try: - self.document.dispose() - except: - #We tried! - pass + try: + self.presentation.end() + self.presentation = None + self.document.dispose() + except: + #We tried! + pass self.document = None def is_loaded(self): From ad40020169981149f3b76f354f17d9a86c709904 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 24 Jan 2010 13:58:39 +0000 Subject: [PATCH 2/5] Fix logging to single file Fix QMessage to displays on correct screen. --- openlp.pyw | 4 ++-- openlp/core/ui/maindisplay.py | 13 ++++++++----- openlp/core/ui/mainwindow.py | 6 +++--- openlp/core/ui/servicemanager.py | 4 ++-- openlp/core/ui/slidecontroller.py | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 968ee92d2..3b97a33d9 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -28,7 +28,7 @@ import os import sys import logging -from logging.handlers import RotatingFileHandler +from logging import FileHandler from optparse import OptionParser from PyQt4 import QtCore, QtGui @@ -154,7 +154,7 @@ def main(): help="Set the Qt4 style (passed directly to Qt4).") # Set up logging filename = u'openlp.log' - logfile = RotatingFileHandler(filename, maxBytes=200000, backupCount=5) + logfile = FileHandler(filename) logfile.setFormatter(logging.Formatter( u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s')) log.addHandler(logfile) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 35828e85f..7b73ab2ac 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -208,9 +208,11 @@ class MainDisplay(DisplayWidget): self.repaint() self.frame = frame[u'trans'] self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'main'])) + self.display_frame = frame[u'main'] self.repaint() else: self.display.setPixmap(QtGui.QPixmap.fromImage(frame)) + self.display_frame = frame if not self.isVisible(): self.setVisible(True) self.showFullScreen() @@ -221,11 +223,11 @@ class MainDisplay(DisplayWidget): self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) else: self.displayBlank = False - if self.frame: - self.frameView(self.frame) - if blanked != self.parent.LiveController.blankButton.isChecked(): - self.parent.LiveController.blankButton.setChecked(self.displayBlank) - self.parent.generalConfig.set_config(u'screen blank', self.displayBlank) + if self.display_frame: + self.frameView(self.display_frame) +# 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''): """ @@ -313,6 +315,7 @@ class MainDisplay(DisplayWidget): def onMediaStop(self): log.debug(u'Media stopped by user') self.mediaObject.stop() + self.onMediaFinish() def onMediaFinish(self): log.debug(u'Reached end of media playlist') diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 63744f62c..4090f9895 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -545,7 +545,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): if app_version != version: version_text = unicode(self.trUtf8('OpenLP version %s has been updated ' 'to version %s\n\nYou can obtain the latest version from http://openlp.org')) - QtGui.QMessageBox.question(None, + QtGui.QMessageBox.question(self, self.trUtf8('OpenLP Version Updated'), version_text % (app_version, version), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), @@ -576,7 +576,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.ServiceManagerContents.onLoadService(True) if str_to_bool(self.generalConfig.get_config(u'screen blank', False)) \ and str_to_bool(self.generalConfig.get_config(u'blank warning', False)): - QtGui.QMessageBox.question(None, + QtGui.QMessageBox.question(self, self.trUtf8('OpenLP Main Display Blanked'), self.trUtf8('The Main Display has been blanked out'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), @@ -620,7 +620,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): Hook to close the main window and display windows on exit """ if self.serviceNotSaved: - ret = QtGui.QMessageBox.question(None, + ret = QtGui.QMessageBox.question(self, self.trUtf8('Save Changes to Service?'), self.trUtf8('Your service has changed, do you want to save those changes?'), QtGui.QMessageBox.StandardButtons( diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 7e9fca933..44170e616 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -348,7 +348,7 @@ class ServiceManager(QtGui.QWidget): if self.parent.serviceNotSaved and \ str_to_bool(PluginConfig(u'General'). get_config(u'save prompt', u'False')): - ret = QtGui.QMessageBox.question(None, + ret = QtGui.QMessageBox.question(self, self.trUtf8('Save Changes to Service?'), self.trUtf8('Your service is unsaved, do you want to save those ' 'changes before creating a new one ?'), @@ -697,4 +697,4 @@ class ServiceManager(QtGui.QWidget): theme = unicode(self.sender().text()) item, count = self.findServiceItem() self.serviceItems[item][u'service_item'].theme = theme - self.regenerateServiceItems() \ No newline at end of file + self.regenerateServiceItems() diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 6e3d6ad1d..e42dbc7f5 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -493,7 +493,7 @@ class SlideController(QtGui.QWidget): """ Blank the screen. """ - print "onbl", blanked + print "Button Pressed", blanked if self.serviceItem is not None: if self.serviceItem.is_command(): if blanked: From e6e6eeb7c025682d1bfb0d32fba72c068b94bf91 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 24 Jan 2010 15:18:26 +0000 Subject: [PATCH 3/5] Media and Blank screen now play together nicely. --- openlp/core/ui/maindisplay.py | 2 ++ openlp/core/ui/slidecontroller.py | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 7b73ab2ac..a4ff53567 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -298,6 +298,7 @@ class MainDisplay(DisplayWidget): log.debug(u'Play the new media, Live ') if not self.mediaLoaded and not self.displayBlank: self.blankDisplay() + self.display_frame = self.blankFrame self.firstTime = True self.mediaLoaded = True self.display.hide() @@ -326,3 +327,4 @@ class MainDisplay(DisplayWidget): self.mediaLoaded = False self.video.setVisible(False) self.display.show() + self.blankDisplay(False) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index e42dbc7f5..97bd406d3 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -441,7 +441,6 @@ class SlideController(QtGui.QWidget): self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag), self.onSongBarHandler) item.setText(frame[u'text']) - #print {u'x':frame[u'text']} else: label = QtGui.QLabel() label.setMargin(4) @@ -493,7 +492,6 @@ class SlideController(QtGui.QWidget): """ Blank the screen. """ - print "Button Pressed", blanked if self.serviceItem is not None: if self.serviceItem.is_command(): if blanked: From d6912adbf8058c801b075a4e59cb812bfb888bdc Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 24 Jan 2010 16:28:18 +0000 Subject: [PATCH 4/5] Make display blanking work correctly --- openlp/core/ui/mainwindow.py | 2 +- openlp/core/ui/slidecontroller.py | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 4090f9895..8e93fbf12 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -576,12 +576,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.ServiceManagerContents.onLoadService(True) if str_to_bool(self.generalConfig.get_config(u'screen blank', False)) \ and str_to_bool(self.generalConfig.get_config(u'blank warning', False)): + self.LiveController.onBlankDisplay(True) QtGui.QMessageBox.question(self, self.trUtf8('OpenLP Main Display Blanked'), self.trUtf8('The Main Display has been blanked out'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), QtGui.QMessageBox.Ok) - self.LiveController.blankButton.setChecked(True) def onHelpAboutItemClicked(self): """ diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 97bd406d3..3131c2bfa 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -164,9 +164,9 @@ class SlideController(QtGui.QWidget): self.Toolbar.addToolbarSeparator(u'Close Separator') self.blankButton = self.Toolbar.addToolbarButton( u'Blank Screen', u':/slides/slide_close.png', - self.trUtf8('Blank Screen'), self.onBlankScreen, True) + self.trUtf8('Blank Screen'), self.onBlankDisplay, True) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'live_slide_blank'), self.onBlankDisplay) + QtCore.SIGNAL(u'live_slide_blank'), self.blankScreen) if not self.isLive: self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarButton( @@ -485,12 +485,19 @@ class SlideController(QtGui.QWidget): self.PreviewListWidget.selectRow(0) self.onSlideSelected() - def onBlankDisplay(self): - self.blankButton.setChecked(self.parent.mainDisplay.displayBlank) - - def onBlankScreen(self, blanked): + def onBlankDisplay(self, force=False): """ - Blank the screen. + Handle the blank screen button + """ + if force: + self.blankButton.setChecked(True) + self.blankScreen(self.blankButton.isChecked()) + self.parent.generalConfig.set_config(u'screen blank', + self.blankButton.isChecked()) + + def blankScreen(self, blanked=False): + """ + Blank the display screen. """ if self.serviceItem is not None: if self.serviceItem.is_command(): From dd18a4da769d174c164f34f8d3aa7f765f668be8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 24 Jan 2010 16:30:48 +0000 Subject: [PATCH 5/5] Fix spacing of media items --- openlp/plugins/media/lib/mediaitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index d946fb819..c2dbc5d93 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -61,7 +61,7 @@ class MediaMediaItem(MediaManagerItem): def retranslateUi(self): self.OnNewPrompt = self.trUtf8('Select Media') - self.OnNewFileMasks = self.trUtf8('Videos (*.avi *.mpeg *.mpg *.wmv' + self.OnNewFileMasks = self.trUtf8('Videos (*.avi *.mpeg *.mpg *.wmv ' '*.mov *.mp4 *.flv);;Audio (*.ogg *.mp3 *.wma *.wav *.flac)' ';;All files (*)')