Fix up blanks screen issues and cleanups

This commit is contained in:
Tim Bentley 2010-06-13 20:34:25 +01:00
parent 078f7952ca
commit 732ce9555e
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.setScaledContents(True)
self.primary = True
self.displayBlank = False
self.blankFrame = None
self.frame = None
QtCore.QObject.connect(Receiver.get_receiver(),
@ -280,15 +279,15 @@ class MainDisplay(DisplayWidget):
self.display_alert.setPixmap(frame)
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
if the alert is in progress the alert is added on top
``frame``
Image frame to be rendered
"""
log.debug(u'frameView %d' % (self.displayBlank))
if not self.displayBlank:
log.debug(u'frameView %d' % (display))
if display:
if transition:
if self.frame is not None:
self.display_text.setPixmap(
@ -314,8 +313,7 @@ class MainDisplay(DisplayWidget):
self.setVisible(True)
self.showFullScreen()
else:
self.waitingFrame = frame
self.waitingFrameTrans = transition
self.storeText = QtGui.QPixmap.fromImage(frame[u'main'])
class VideoDisplay(Phonon.VideoWidget):
"""

View File

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

View File

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