More Fixes for Presentations

Fix screen blanking so resets for Video
Fix screen blanking so it does not remember at start up if set by presentations and video.
Fix Pop ups so they display on correct monitor

bzr-revno: 696
This commit is contained in:
Tim Bentley 2010-01-24 17:35:08 +00:00
commit 8a42d3c7f2
8 changed files with 45 additions and 33 deletions

View File

@ -28,7 +28,7 @@ import os
import sys import sys
import logging import logging
from logging.handlers import RotatingFileHandler from logging import FileHandler
from optparse import OptionParser from optparse import OptionParser
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
@ -154,7 +154,7 @@ def main():
help="Set the Qt4 style (passed directly to Qt4).") help="Set the Qt4 style (passed directly to Qt4).")
# Set up logging # Set up logging
filename = u'openlp.log' filename = u'openlp.log'
logfile = RotatingFileHandler(filename, maxBytes=200000, backupCount=5) logfile = FileHandler(filename)
logfile.setFormatter(logging.Formatter( logfile.setFormatter(logging.Formatter(
u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s')) u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
log.addHandler(logfile) log.addHandler(logfile)

View File

@ -208,9 +208,11 @@ class MainDisplay(DisplayWidget):
self.repaint() self.repaint()
self.frame = frame[u'trans'] self.frame = frame[u'trans']
self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'main'])) self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'main']))
self.display_frame = frame[u'main']
self.repaint() self.repaint()
else: else:
self.display.setPixmap(QtGui.QPixmap.fromImage(frame)) self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
self.display_frame = frame
if not self.isVisible(): if not self.isVisible():
self.setVisible(True) self.setVisible(True)
self.showFullScreen() self.showFullScreen()
@ -221,11 +223,11 @@ class MainDisplay(DisplayWidget):
self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
else: else:
self.displayBlank = False self.displayBlank = False
if self.frame: if self.display_frame:
self.frameView(self.frame) self.frameView(self.display_frame)
if blanked != self.parent.LiveController.blankButton.isChecked(): # if blanked != self.parent.LiveController.blankButton.isChecked():
self.parent.LiveController.blankButton.setChecked(self.displayBlank) # self.parent.LiveController.blankButton.setChecked(self.displayBlank)
self.parent.generalConfig.set_config(u'screen blank', self.displayBlank) # self.parent.generalConfig.set_config(u'screen blank', self.displayBlank)
def displayAlert(self, text=u''): def displayAlert(self, text=u''):
""" """
@ -236,7 +238,7 @@ class MainDisplay(DisplayWidget):
""" """
log.debug(u'display alert called %s' % text) log.debug(u'display alert called %s' % text)
self.alertList.append(text) self.alertList.append(text)
if self.timer_id != 0: if self.timer_id != 0 or self.mediaLoaded:
return return
self.generateAlert() self.generateAlert()
@ -296,9 +298,11 @@ class MainDisplay(DisplayWidget):
log.debug(u'Play the new media, Live ') log.debug(u'Play the new media, Live ')
if not self.mediaLoaded and not self.displayBlank: if not self.mediaLoaded and not self.displayBlank:
self.blankDisplay() self.blankDisplay()
self.display_frame = self.blankFrame
self.firstTime = True self.firstTime = True
self.mediaLoaded = True self.mediaLoaded = True
self.display.hide() self.display.hide()
self.alertDisplay.hide()
self.video.setFullScreen(True) self.video.setFullScreen(True)
self.video.setVisible(True) self.video.setVisible(True)
self.mediaObject.play() self.mediaObject.play()
@ -312,6 +316,7 @@ class MainDisplay(DisplayWidget):
def onMediaStop(self): def onMediaStop(self):
log.debug(u'Media stopped by user') log.debug(u'Media stopped by user')
self.mediaObject.stop() self.mediaObject.stop()
self.onMediaFinish()
def onMediaFinish(self): def onMediaFinish(self):
log.debug(u'Reached end of media playlist') log.debug(u'Reached end of media playlist')
@ -322,3 +327,4 @@ class MainDisplay(DisplayWidget):
self.mediaLoaded = False self.mediaLoaded = False
self.video.setVisible(False) self.video.setVisible(False)
self.display.show() self.display.show()
self.blankDisplay(False)

View File

@ -545,7 +545,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if app_version != version: if app_version != version:
version_text = unicode(self.trUtf8('OpenLP version %s has been updated ' 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')) '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'), self.trUtf8('OpenLP Version Updated'),
version_text % (app_version, version), version_text % (app_version, version),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
@ -576,12 +576,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.ServiceManagerContents.onLoadService(True) self.ServiceManagerContents.onLoadService(True)
if str_to_bool(self.generalConfig.get_config(u'screen blank', False)) \ if str_to_bool(self.generalConfig.get_config(u'screen blank', False)) \
and str_to_bool(self.generalConfig.get_config(u'blank warning', False)): and str_to_bool(self.generalConfig.get_config(u'blank warning', False)):
QtGui.QMessageBox.question(None, self.LiveController.onBlankDisplay(True)
QtGui.QMessageBox.question(self,
self.trUtf8('OpenLP Main Display Blanked'), self.trUtf8('OpenLP Main Display Blanked'),
self.trUtf8('The Main Display has been blanked out'), self.trUtf8('The Main Display has been blanked out'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok) QtGui.QMessageBox.Ok)
self.LiveController.blankButton.setChecked(True)
def onHelpAboutItemClicked(self): def onHelpAboutItemClicked(self):
""" """
@ -620,7 +620,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Hook to close the main window and display windows on exit Hook to close the main window and display windows on exit
""" """
if self.serviceNotSaved: if self.serviceNotSaved:
ret = QtGui.QMessageBox.question(None, ret = QtGui.QMessageBox.question(self,
self.trUtf8('Save Changes to Service?'), self.trUtf8('Save Changes to Service?'),
self.trUtf8('Your service has changed, do you want to save those changes?'), self.trUtf8('Your service has changed, do you want to save those changes?'),
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(

View File

@ -348,7 +348,7 @@ class ServiceManager(QtGui.QWidget):
if self.parent.serviceNotSaved and \ if self.parent.serviceNotSaved and \
str_to_bool(PluginConfig(u'General'). str_to_bool(PluginConfig(u'General').
get_config(u'save prompt', u'False')): 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('Save Changes to Service?'),
self.trUtf8('Your service is unsaved, do you want to save those ' self.trUtf8('Your service is unsaved, do you want to save those '
'changes before creating a new one ?'), 'changes before creating a new one ?'),
@ -697,4 +697,4 @@ class ServiceManager(QtGui.QWidget):
theme = unicode(self.sender().text()) theme = unicode(self.sender().text())
item, count = self.findServiceItem() item, count = self.findServiceItem()
self.serviceItems[item][u'service_item'].theme = theme self.serviceItems[item][u'service_item'].theme = theme
self.regenerateServiceItems() self.regenerateServiceItems()

View File

@ -164,9 +164,9 @@ class SlideController(QtGui.QWidget):
self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarSeparator(u'Close Separator')
self.blankButton = self.Toolbar.addToolbarButton( self.blankButton = self.Toolbar.addToolbarButton(
u'Blank Screen', u':/slides/slide_close.png', 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.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: if not self.isLive:
self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarSeparator(u'Close Separator')
self.Toolbar.addToolbarButton( self.Toolbar.addToolbarButton(
@ -441,7 +441,6 @@ class SlideController(QtGui.QWidget):
self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag), self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag),
self.onSongBarHandler) self.onSongBarHandler)
item.setText(frame[u'text']) item.setText(frame[u'text'])
#print {u'x':frame[u'text']}
else: else:
label = QtGui.QLabel() label = QtGui.QLabel()
label.setMargin(4) label.setMargin(4)
@ -486,12 +485,19 @@ class SlideController(QtGui.QWidget):
self.PreviewListWidget.selectRow(0) self.PreviewListWidget.selectRow(0)
self.onSlideSelected() self.onSlideSelected()
def onBlankDisplay(self): def onBlankDisplay(self, force=False):
self.blankButton.setChecked(self.parent.mainDisplay.displayBlank)
def onBlankScreen(self, blanked):
""" """
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 not None:
if self.serviceItem.is_command(): if self.serviceItem.is_command():
@ -550,7 +556,7 @@ class SlideController(QtGui.QWidget):
def grabMainDisplay(self): def grabMainDisplay(self):
rm = self.parent.RenderManager rm = self.parent.RenderManager
winid = QtGui.QApplication.desktop().winId() 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(), winimg = QtGui.QPixmap.grabWindow(winid, rect.x(),
rect.y(), rect.width(), rect.height()) rect.y(), rect.width(), rect.height())
self.SlidePreview.setPixmap(winimg) self.SlidePreview.setPixmap(winimg)
@ -666,7 +672,7 @@ class SlideController(QtGui.QWidget):
def onMediaStop(self): def onMediaStop(self):
if self.isLive: 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: else:
self.mediaObject.stop() self.mediaObject.stop()
self.video.hide() self.video.hide()

View File

@ -61,7 +61,7 @@ class MediaMediaItem(MediaManagerItem):
def retranslateUi(self): def retranslateUi(self):
self.OnNewPrompt = self.trUtf8('Select Media') 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)' '*.mov *.mp4 *.flv);;Audio (*.ogg *.mp3 *.wma *.wav *.flac)'
';;All files (*)') ';;All files (*)')

View File

@ -232,13 +232,13 @@ class ImpressController(PresentationController):
""" """
if self.document: if self.document:
if self.presentation: if self.presentation:
self.presentation.end() try:
self.presentation = None self.presentation.end()
try: self.presentation = None
self.document.dispose() self.document.dispose()
except: except:
#We tried! #We tried!
pass pass
self.document = None self.document = None
def is_loaded(self): def is_loaded(self):

View File

@ -1 +1 @@
1.9.0-694 1.9.0-696