forked from openlp/openlp
Add Theme and Hide buttons to slide controller
This commit is contained in:
parent
463847c61c
commit
e4db12423a
@ -23,6 +23,7 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from slidecontroller import DisplayHideMode
|
||||
from servicenoteform import ServiceNoteForm
|
||||
from serviceitemeditform import ServiceItemEditForm
|
||||
from screen import ScreenList
|
||||
|
@ -30,6 +30,7 @@ from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Receiver, resize_image
|
||||
from openlp.core.ui import DisplayHideMode
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -253,11 +254,17 @@ class MainDisplay(DisplayWidget):
|
||||
self.waitingFrame = frame
|
||||
self.waitingFrameTrans = transition
|
||||
|
||||
def blankDisplay(self, blanked=True):
|
||||
def blankDisplay(self, blankType=DisplayHideMode.Blank, blanked=True):
|
||||
log.debug(u'Blank main Display %d' % blanked)
|
||||
if blanked:
|
||||
self.displayBlank = True
|
||||
self.display_text.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
|
||||
if blankType == DisplayHideMode.Blank:
|
||||
self.display_text.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
|
||||
elif blankType == DisplayHideMode.Theme:
|
||||
theme = self.parent.RenderManager.renderer.bg_frame
|
||||
if not theme:
|
||||
theme = self.blankFrame
|
||||
self.display_text.setPixmap(QtGui.QPixmap.fromImage(theme))
|
||||
self.waitingFrame = None
|
||||
self.waitingFrameTrans = False
|
||||
else:
|
||||
@ -313,4 +320,4 @@ class MainDisplay(DisplayWidget):
|
||||
self.video.setVisible(False)
|
||||
self.display_text.show()
|
||||
self.display_image.show()
|
||||
self.blankDisplay(False)
|
||||
self.blankDisplay(False, False)
|
||||
|
@ -30,6 +30,15 @@ import os
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
class DisplayHideMode(object):
|
||||
"""
|
||||
This is basically an enumeration class which specifies the mode of a Bible.
|
||||
Mode refers to whether or not a Bible in OpenLP is a full Bible or needs to
|
||||
be downloaded from the Internet on an as-needed basis.
|
||||
"""
|
||||
Blank = 1
|
||||
Theme = 2
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, Receiver, str_to_bool, \
|
||||
PluginConfig, resize_image
|
||||
|
||||
@ -180,10 +189,10 @@ class SlideController(QtGui.QWidget):
|
||||
self.trUtf8('Blank Screen'), self.onBlankDisplay, True)
|
||||
self.themeButton = self.Toolbar.addToolbarButton(
|
||||
u'Display Theme', u':/slides/slide_theme.png',
|
||||
self.trUtf8('Blank Screen'), self.onBlankDisplay, True)
|
||||
self.trUtf8('Theme Screen'), self.onThemeDisplay, True)
|
||||
self.hideButton = self.Toolbar.addToolbarButton(
|
||||
u'Hide screen', u':/slides/slide_desktop.png',
|
||||
self.trUtf8('Blank Screen'), self.onBlankDisplay, True)
|
||||
self.trUtf8('Hide Screen'), self.onHideDisplay, True)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'live_slide_blank'), self.blankScreen)
|
||||
if not self.isLive:
|
||||
@ -551,11 +560,32 @@ class SlideController(QtGui.QWidget):
|
||||
log.debug(u'onBlankDisplay %d' % force)
|
||||
if force:
|
||||
self.blankButton.setChecked(True)
|
||||
self.blankScreen(self.blankButton.isChecked())
|
||||
self.blankScreen(DisplayHideMode.Blank, self.blankButton.isChecked())
|
||||
self.parent.generalConfig.set_config(u'screen blank',
|
||||
self.blankButton.isChecked())
|
||||
|
||||
def blankScreen(self, blanked=False):
|
||||
def onThemeDisplay(self, force=False):
|
||||
"""
|
||||
Handle the Theme screen button
|
||||
"""
|
||||
log.debug(u'onThemeDisplay %d' % force)
|
||||
if force:
|
||||
self.themeButton.setChecked(True)
|
||||
self.blankScreen(DisplayHideMode.Theme, self.themeButton.isChecked())
|
||||
|
||||
def onHideDisplay(self, force=False):
|
||||
"""
|
||||
Handle the Hide screen button
|
||||
"""
|
||||
log.debug(u'onHideDisplay %d' % force)
|
||||
if force:
|
||||
self.themeButton.setChecked(True)
|
||||
if self.hideButton.isChecked():
|
||||
self.parent.mainDisplay.hide1Display()
|
||||
else:
|
||||
self.parent.mainDisplay.showDisplay()
|
||||
|
||||
def blankScreen(self, blankType, blanked=False):
|
||||
"""
|
||||
Blank the display screen.
|
||||
"""
|
||||
@ -566,9 +596,9 @@ class SlideController(QtGui.QWidget):
|
||||
else:
|
||||
Receiver.send_message(u'%s_unblank'% self.serviceItem.name.lower())
|
||||
else:
|
||||
self.parent.mainDisplay.blankDisplay(blanked)
|
||||
self.parent.mainDisplay.blankDisplay(blankType, blanked)
|
||||
else:
|
||||
self.parent.mainDisplay.blankDisplay(blanked)
|
||||
self.parent.mainDisplay.blankDisplay(blankType, blanked)
|
||||
|
||||
def onSlideSelected(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user