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 t = null;
var transition = %s; 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){ function displayAlert(alerttext){
var text1 = document.getElementById('alertmain'); var text1 = document.getElementById('alertmain');
text1.innerHTML = alerttext; text1.innerHTML = alerttext;
@ -142,7 +160,7 @@ HTMLSRC = u"""
</table> </table>
<div id="footer" class="footer"></div> <div id="footer" class="footer"></div>
<video id="video"></video> <video id="video"></video>
<blank id="blank"></blank> <div id="black"></div>
%s %s
</body> </body>
</html> </html>
@ -168,7 +186,7 @@ def build_html(item, screen, alert):
build_footer(item), build_footer(item),
build_alert(width, height, alert), build_alert(width, height, alert),
build_image(width, height), build_image(width, height),
build_blank(width, height), build_black(width, height),
"true" if theme and "true" if theme and
theme.display_slideTransition else "false", theme.display_slideTransition else "false",
build_image_src(item.bg_frame)) build_image_src(item.bg_frame))
@ -189,21 +207,22 @@ def build_video(width, height):
""" """
return 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` `width`
Screen width Screen width
`height` `height`
Screen height Screen height
""" """
blank = """ black = """
#blank { position: absolute; left: 0px; top: 0px; #black { position: absolute; left: 0px; top: 0px;
width: %spx; height: %spx; z-index:10; 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): def build_image(width, height):
""" """

View File

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

View File

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