fixed preview

This commit is contained in:
Andreas Preikschat 2013-03-04 20:14:36 +01:00
parent b7448518d2
commit 6d66e6b957
2 changed files with 9 additions and 10 deletions

View File

@ -171,7 +171,7 @@ sup {
return; return;
} }
text.style.opacity = '0'; text.style.opacity = '0';
timer = window.setTimeout(function(){_show_text(text, new_text)}, 500); timer = window.setTimeout(function(){_show_text(text, new_text)}, 400);
} }
function _show_text(text, new_text) { function _show_text(text, new_text) {
@ -180,11 +180,11 @@ sup {
*/ */
text.innerHTML = new_text; text.innerHTML = new_text;
text.style.opacity = '1'; text.style.opacity = '1';
window.setTimeout(function(){timer = null;}, 500);
} }
function show_text_complete(){ function show_text_complete(){
var text = document.getElementById('lyricsmain'); return (timer == null);
return getComputedStyle(text, '').opacity == 1;
} }
</script> </script>
</head> </head>
@ -323,25 +323,25 @@ def build_lyrics_css(item, webkit_ver):
z-index: 5; z-index: 5;
position: absolute; position: absolute;
display: table; display: table;
-webkit-transition: opacity 0.5s linear; -webkit-transition: opacity 0.5s ease;
%s %s
} }
.lyricscell { .lyricscell {
display: table-cell; display: table-cell;
word-wrap: break-word; word-wrap: break-word;
-webkit-transition: opacity 0.5s linear; -webkit-transition: opacity 0.5s ease;
%s %s
} }
.lyricsmain { .lyricsmain {
-webkit-transition: opacity 0.5s ease-in; -webkit-transition: opacity 0.5s ease;
%s %s
} }
.lyricsoutline { .lyricsoutline {
-webkit-transition: opacity 0.5s ease-in; -webkit-transition: opacity 0.5s ease;
%s %s
} }
.lyricsshadow { .lyricsshadow {
-webkit-transition: opacity 0.5s ease-in; -webkit-transition: opacity 0.5s ease;
%s %s
} }
""" """

View File

@ -354,8 +354,7 @@ class MainDisplay(Display):
# Wait for the fade to finish before geting the preview. # Wait for the fade to finish before geting the preview.
# Important otherwise preview will have incorrect text if at all! # Important otherwise preview will have incorrect text if at all!
if self.serviceItem.themedata and self.serviceItem.themedata.display_slide_transition: if self.serviceItem.themedata and self.serviceItem.themedata.display_slide_transition:
# FIXME: method does not work. while not self.frame.evaluateJavaScript(u'show_text_complete()'):
while self.frame.evaluateJavaScript(u'show_text_complete()') == u'false':
self.application.process_events() self.application.process_events()
# Wait for the webview to update before getting the preview. # Wait for the webview to update before getting the preview.
# Important otherwise first preview will miss the background ! # Important otherwise first preview will miss the background !