Theme blanking works

This commit is contained in:
Tim Bentley 2010-08-05 06:37:26 +01:00
parent 6d352df382
commit 003d0552eb
3 changed files with 36 additions and 22 deletions

View File

@ -47,6 +47,24 @@ HTMLSRC = u"""
var t = null;
var transition = %s;
function blankState(state){
var black = 'none';
var lyrics = '';
switch(state){
case 'theme':
lyrics = 'none';
break;
case 'black':
black = 'inline';
break;
}
document.getElementById('black').style.display = black;
document.getElementById('lyricsmain').style.display = lyrics;
document.getElementById('lyricsoutline').style.display = lyrics;
document.getElementById('lyricsshadow').style.display = lyrics;
document.getElementById('footer').style.display = lyrics;
}
function displayAlert(alerttext){
var text1 = document.getElementById('alertmain');
text1.innerHTML = alerttext;
@ -142,7 +160,7 @@ HTMLSRC = u"""
</table>
<div id="footer" class="footer"></div>
<video id="video"></video>
<blank id="blank"></blank>
<div id="black"></div>
%s
</body>
</html>
@ -168,7 +186,7 @@ def build_html(item, screen, alert):
build_footer(item),
build_alert(width, height, alert),
build_image(width, height),
build_blank(width, height),
build_black(width, height),
"true" if theme and
theme.display_slideTransition else "false",
build_image_src(item.bg_frame))
@ -189,21 +207,22 @@ def build_video(width, height):
"""
return video % (width, height)
def build_blank(width, height):
def build_black(width, height):
"""
Build the blank display div
Build the black display div
`width`
Screen width
`height`
Screen height
"""
blank = """
#blank { position: absolute; left: 0px; top: 0px;
black = """
#black { position: absolute; left: 0px; top: 0px;
width: %spx; height: %spx; z-index:10;
background-color: black; display: none;
}
"""
return blank % (width, height)
return black % (width, height)
def build_image(width, height):
"""

View File

@ -311,17 +311,13 @@ class MainDisplay(DisplayWidget):
if mode == HideMode.Screen:
self.setVisible(False)
elif mode == HideMode.Blank:
self.frame.findFirstElement('img').setAttribute(
'src', unicode('data:image/png;base64,%s' \
% image_to_byte(self.black)))
self.frame.evaluateJavaScript('blankState("black");')
else:
if self.serviceItem:
self.displayBlank.setPixmap(QtGui.QPixmap.fromImage(
self.parent.renderManager.renderer.bg_frame))
else:
self.frame.findFirstElement('img').setAttribute(
'src', unicode('data:image/png;base64,%s' \
% image_to_byte(self.black)))
#if self.serviceItem:
# self.displayBlank.setPixmap(QtGui.QPixmap.fromImage(
# self.parent.renderManager.renderer.bg_frame))
#else:
self.frame.evaluateJavaScript('blankState("theme");')
if mode != HideMode.Screen and self.isHidden():
self.setVisible(True)
@ -332,8 +328,7 @@ class MainDisplay(DisplayWidget):
Make the stored images None to release memory.
"""
log.debug(u'showDisplay')
self.frame.evaluateJavaScript(
"document.getElementById('blank').style.visibility = 'hidden'")
self.frame.evaluateJavaScript('blankState("show");')
if self.isHidden():
self.setVisible(True)
# Trigger actions when display is active again

View File

@ -694,7 +694,7 @@ class SlideController(QtGui.QWidget):
self.HideMenu.setDefaultAction(self.BlankScreen)
self.BlankScreen.setChecked(checked)
self.ThemeScreen.setChecked(False)
self.DesktopScreen.setChecked(False)
#self.DesktopScreen.setChecked(False)
QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(checked))
@ -712,7 +712,7 @@ class SlideController(QtGui.QWidget):
self.HideMenu.setDefaultAction(self.ThemeScreen)
self.BlankScreen.setChecked(False)
self.ThemeScreen.setChecked(checked)
self.DesktopScreen.setChecked(False)
#self.DesktopScreen.setChecked(False)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
else:
@ -727,7 +727,7 @@ class SlideController(QtGui.QWidget):
self.HideMenu.setDefaultAction(self.DesktopScreen)
self.BlankScreen.setChecked(False)
self.ThemeScreen.setChecked(False)
self.DesktopScreen.setChecked(checked)
#self.DesktopScreen.setChecked(checked)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
else: