Fix problems with screen blanking

bzr-revno: 843
This commit is contained in:
Tim Bentley 2010-06-13 20:52:52 +01:00
commit b8293a247c
3 changed files with 25 additions and 19 deletions

View File

@ -133,7 +133,6 @@ class MainDisplay(DisplayWidget):
self.display_alert = QtGui.QLabel(self) self.display_alert = QtGui.QLabel(self)
self.display_alert.setScaledContents(True) self.display_alert.setScaledContents(True)
self.primary = True self.primary = True
self.displayBlank = False
self.blankFrame = None self.blankFrame = None
self.frame = None self.frame = None
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -280,15 +279,15 @@ class MainDisplay(DisplayWidget):
self.display_alert.setPixmap(frame) self.display_alert.setPixmap(frame)
self.moveToTop() self.moveToTop()
def frameView(self, frame, transition=False): def frameView(self, frame, transition=False, display=True):
""" """
Called from a slide controller to display a frame Called from a slide controller to display a frame
if the alert is in progress the alert is added on top if the alert is in progress the alert is added on top
``frame`` ``frame``
Image frame to be rendered Image frame to be rendered
""" """
log.debug(u'frameView %d' % (self.displayBlank)) log.debug(u'frameView %d' % (display))
if not self.displayBlank: if display:
if transition: if transition:
if self.frame is not None: if self.frame is not None:
self.display_text.setPixmap( self.display_text.setPixmap(
@ -314,8 +313,7 @@ class MainDisplay(DisplayWidget):
self.setVisible(True) self.setVisible(True)
self.showFullScreen() self.showFullScreen()
else: else:
self.waitingFrame = frame self.storeText = QtGui.QPixmap.fromImage(frame[u'main'])
self.waitingFrameTrans = transition
class VideoDisplay(Phonon.VideoWidget): class VideoDisplay(Phonon.VideoWidget):
""" """

View File

@ -356,7 +356,7 @@ class Ui_MainWindow(object):
""" """
MainWindow.mainTitle = translate(u'MainWindow', u'OpenLP 2.0') MainWindow.mainTitle = translate(u'MainWindow', u'OpenLP 2.0')
MainWindow.language = translate(u'MainWindow', u'English') MainWindow.language = translate(u'MainWindow', u'English')
MainWindow.defaultThemeText = translate(u'MainWindow', MainWindow.defaultThemeText = translate(u'MainWindow',
u'Default Theme: ') u'Default Theme: ')
MainWindow.setWindowTitle(MainWindow.mainTitle) MainWindow.setWindowTitle(MainWindow.mainTitle)
self.FileMenu.setTitle(translate(u'MainWindow', u'&File')) self.FileMenu.setTitle(translate(u'MainWindow', u'&File'))
@ -456,7 +456,7 @@ class Ui_MainWindow(object):
u'Set the interface language to %1').arg(item.objectName())) u'Set the interface language to %1').arg(item.objectName()))
self.ToolsAddToolItem.setText(translate(u'MainWindow', u'Add &Tool...')) self.ToolsAddToolItem.setText(translate(u'MainWindow', u'Add &Tool...'))
self.ToolsAddToolItem.setStatusTip( self.ToolsAddToolItem.setStatusTip(
translate(u'MainWindow', translate(u'MainWindow',
u'Add an application to the list of tools')) u'Add an application to the list of tools'))
self.action_Preview_Panel.setText( self.action_Preview_Panel.setText(
translate(u'MainWindow', u'&Preview Pane')) translate(u'MainWindow', u'&Preview Pane'))
@ -652,15 +652,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
settings = QtCore.QSettings() settings = QtCore.QSettings()
settings.beginGroup(self.generalSettingsSection) settings.beginGroup(self.generalSettingsSection)
if settings.value(u'screen blank', QtCore.QVariant(False)).toBool() \ if settings.value(u'screen blank', QtCore.QVariant(False)).toBool():
and settings.value(u'blank warning', QtCore.QVariant(False)).toBool(): self.LiveController.mainDisplaySetBackground()
self.LiveController.onBlankDisplay(True) if settings.value(u'blank warning', QtCore.QVariant(False)).toBool():
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self,
translate(u'MainWindow', u'OpenLP Main Display Blanked'), translate(u'MainWindow', u'OpenLP Main Display Blanked'),
translate(u'MainWindow', translate(u'MainWindow',
u'The Main Display has been blanked out'), u'The Main Display has been blanked out'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
settings.endGroup() settings.endGroup()
def versionThread(self): def versionThread(self):

View File

@ -120,6 +120,7 @@ class SlideController(QtGui.QWidget):
self.serviceItem = None self.serviceItem = None
self.Panel = QtGui.QWidget(parent.ControlSplitter) self.Panel = QtGui.QWidget(parent.ControlSplitter)
self.slideList = {} self.slideList = {}
self.canDisplay = True
# Layout for holding panel # Layout for holding panel
self.PanelLayout = QtGui.QVBoxLayout(self.Panel) self.PanelLayout = QtGui.QVBoxLayout(self.Panel)
self.PanelLayout.setSpacing(0) self.PanelLayout.setSpacing(0)
@ -651,6 +652,12 @@ class SlideController(QtGui.QWidget):
self.PreviewListWidget.selectRow(index) self.PreviewListWidget.selectRow(index)
self.onSlideSelected() self.onSlideSelected()
def mainDisplaySetBackground(self):
"""
Allow the main display to blank the main display at startup time
"""
self.blankButton.setChecked(True)
def onSlideBlank(self): def onSlideBlank(self):
""" """
Handle the slidecontroller blank event Handle the slidecontroller blank event
@ -670,6 +677,7 @@ class SlideController(QtGui.QWidget):
log.debug(u'onBlankDisplay %d' % checked) log.debug(u'onBlankDisplay %d' % checked)
self.hideButton.setChecked(False) self.hideButton.setChecked(False)
self.themeButton.setChecked(False) self.themeButton.setChecked(False)
self.canDisplay = not checked
QtCore.QSettings().setValue( QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank', self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(checked)) QtCore.QVariant(checked))
@ -687,6 +695,7 @@ class SlideController(QtGui.QWidget):
log.debug(u'onThemeDisplay %d' % checked) log.debug(u'onThemeDisplay %d' % checked)
self.blankButton.setChecked(False) self.blankButton.setChecked(False)
self.hideButton.setChecked(False) self.hideButton.setChecked(False)
self.canDisplay = False
if checked: if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Theme) Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
self.blankPlugin(True) self.blankPlugin(True)
@ -701,6 +710,7 @@ class SlideController(QtGui.QWidget):
log.debug(u'onHideDisplay %d' % checked) log.debug(u'onHideDisplay %d' % checked)
self.blankButton.setChecked(False) self.blankButton.setChecked(False)
self.themeButton.setChecked(False) self.themeButton.setChecked(False)
self.canDisplay = False
if checked: if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen) Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
self.hidePlugin(True) self.hidePlugin(True)
@ -710,7 +720,7 @@ class SlideController(QtGui.QWidget):
def blankPlugin(self, blank): def blankPlugin(self, blank):
""" """
Blank the display screen. Blank the display screen within a plugin if required.
""" """
if self.serviceItem is not None: if self.serviceItem is not None:
if blank: if blank:
@ -770,7 +780,7 @@ class SlideController(QtGui.QWidget):
log.log( log.log(
15, u'Slide Rendering took %4s' % (time.time() - before)) 15, u'Slide Rendering took %4s' % (time.time() - before))
if self.isLive: if self.isLive:
self.mainDisplay.frameView(frame, True) self.mainDisplay.frameView(frame, True, self.canDisplay)
self.selectedRow = row self.selectedRow = row
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
row) row)