Theme cleanups

This commit is contained in:
Tim Bentley 2010-08-05 20:01:24 +01:00
parent ab37fdbcf8
commit 9722b4e382
6 changed files with 36 additions and 31 deletions

View File

@ -56,7 +56,7 @@ HTMLSRC = u"""
break;
case 'black':
black = 'inline';
break;
break;
}
document.getElementById('black').style.display = black;
document.getElementById('lyricsmain').style.display = lyrics;
@ -203,7 +203,7 @@ def build_video(width, height):
"""
video = """
#video { position: absolute; left: 0px; top: 0px;
width: %spx; height: %spx; z-index:1; }
width: %spx; height: %spx; z-index:2; }
"""
return video % (width, height)
@ -235,7 +235,7 @@ def build_image(width, height):
"""
image = """
#image { position: absolute; left: 0px; top: 0px;
width: %spx; height: %spx; z-index:2;
width: %spx; height: %spx; z-index:1;
}
"""
return image % (width, height)
@ -382,5 +382,4 @@ def build_alert(width, height, alertTab):
(alertTab.font_face, alertTab.font_size, alertTab.font_color,
alertTab.bg_color)
alert_html = style % (alerttable, alertcell, alert)
print alert_html
return alert_html

View File

@ -66,6 +66,7 @@ class RenderManager(object):
self.theme_level = u''
self.override_background = None
self.themedata = None
self.alertTab = None
# TODO make external and configurable
self.html_expands = {
@ -180,12 +181,12 @@ class RenderManager(object):
The theme to generated a preview for.
"""
log.debug(u'generate preview')
#set the default image size for previews
# set the default image size for previews
self.calculate_default(self.screens.preview[u'size'])
self.renderer.set_theme(themedata)
self.build_text_rectangle(themedata)
self.renderer.set_frame_dest(self.width, self.height, True)
#Reset the real screen size for subsequent render requests
# Reset the real screen size for subsequent render requests
self.calculate_default(self.screens.current[u'size'])
verse = u'Amazing Grace!\n'\
'How sweet the sound\n'\
@ -200,11 +201,7 @@ class RenderManager(object):
serviceItem = ServiceItem()
serviceItem.add_from_text(u'', verse, footer)
serviceItem.render_manager = self
# serviceItem gets the theme data so switch it.
temp_themedata = self.themedata
self.themedata = themedata
serviceItem.render()
self.themedata = temp_themedata
serviceItem.raw_footer = footer
self.display.buildHtml(serviceItem)
frame, raw_html = serviceItem.get_rendered_frame(0)

View File

@ -152,7 +152,7 @@ class ServiceItem(object):
self.main, self.footer = \
self.render_manager.set_override_theme(theme)
self.bg_frame = self.render_manager.renderer.bg_frame
self.themedata = self.render_manager.themedata
self.themedata = self.render_manager.renderer._theme
for slide in self._raw_frames:
before = time.time()
formated = self.render_manager \

View File

@ -186,8 +186,8 @@ class MainDisplay(DisplayWidget):
self.screen[u'size'].height())
self.frame.evaluateJavaScript(
"document.getElementById('video').style.visibility = 'hidden'")
self.frame.evaluateJavaScript(
"document.getElementById('image').style.visibility = 'visible'")
# self.frame.evaluateJavaScript(
# "document.getElementById('image').style.visibility = 'visible'")
self.frame.findFirstElement(u'img').setAttribute(
u'src', unicode(u'data:image/png;base64,%s' % image_to_byte(image)))
@ -206,7 +206,8 @@ class MainDisplay(DisplayWidget):
Used after Video plugin has changed the background
"""
log.debug(u'resetVideo')
self.frame.findFirstElement('img').setAttribute(u'src',u'display: none;' )
self.frame.evaluateJavaScript(
"document.getElementById('video').style.visibility = 'hidden'")
def videoPlay(self):
"""
@ -230,8 +231,8 @@ class MainDisplay(DisplayWidget):
self.frame.evaluateJavaScript("document.getElementById('video').pause()")
self.frame.evaluateJavaScript(
"document.getElementById('video').style.visibility = 'hidden'")
self.frame.evaluateJavaScript(
"document.getElementById('image').style.visibility = 'visible'")
# self.frame.evaluateJavaScript(
# "document.getElementById('image').style.visibility = 'visible'")
def videoVolume(self, volume):
"""
@ -250,10 +251,11 @@ class MainDisplay(DisplayWidget):
self.frame.findFirstElement('video').setAttribute('src', videoPath)
self.frame.evaluateJavaScript(
"document.getElementById('video').style.visibility = 'visible'")
self.frame.evaluateJavaScript(
"document.getElementById('image').style.visibility = 'hidden'")
# self.frame.evaluateJavaScript(
# "document.getElementById('image').style.visibility = 'hidden'")
self.videoPlay()
self.videoVolume(volume)
return self.preview()
def loaded(self):
"""

View File

@ -162,11 +162,11 @@ class SlideController(QtGui.QWidget):
sizeToolbarPolicy.setHeightForWidth(
self.Toolbar.sizePolicy().hasHeightForWidth())
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
if self.isLive:
self.Toolbar.addToolbarButton(
u'First Slide', u':/slides/slide_first.png',
translate('OpenLP.SlideController', 'Move to first'),
self.onSlideSelectedFirst)
# if self.isLive:
# self.Toolbar.addToolbarButton(
# u'First Slide', u':/slides/slide_first.png',
# translate('OpenLP.SlideController', 'Move to first'),
# self.onSlideSelectedFirst)
self.Toolbar.addToolbarButton(
u'Previous Slide', u':/slides/slide_previous.png',
translate('OpenLP.SlideController', 'Move to previous'),
@ -175,11 +175,11 @@ class SlideController(QtGui.QWidget):
u'Next Slide', u':/slides/slide_next.png',
translate('OpenLP.SlideController', 'Move to next'),
self.onSlideSelectedNext)
if self.isLive:
self.Toolbar.addToolbarButton(
u'Last Slide', u':/slides/slide_last.png',
translate('OpenLP.SlideController', 'Move to last'),
self.onSlideSelectedLast)
# if self.isLive:
# self.Toolbar.addToolbarButton(
# u'Last Slide', u':/slides/slide_last.png',
# translate('OpenLP.SlideController', 'Move to last'),
# self.onSlideSelectedLast)
if self.isLive:
self.Toolbar.addToolbarSeparator(u'Close Separator')
self.HideMenu = QtGui.QToolButton(self.Toolbar)
@ -694,7 +694,8 @@ class SlideController(QtGui.QWidget):
self.HideMenu.setDefaultAction(self.BlankScreen)
self.BlankScreen.setChecked(checked)
self.ThemeScreen.setChecked(False)
#self.DesktopScreen.setChecked(False)
if self.screens.display_count > 1:
self.DesktopScreen.setChecked(False)
QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(checked))
@ -712,7 +713,8 @@ class SlideController(QtGui.QWidget):
self.HideMenu.setDefaultAction(self.ThemeScreen)
self.BlankScreen.setChecked(False)
self.ThemeScreen.setChecked(checked)
#self.DesktopScreen.setChecked(False)
if self.screens.display_count > 1:
self.DesktopScreen.setChecked(False)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
else:
@ -727,7 +729,8 @@ class SlideController(QtGui.QWidget):
self.HideMenu.setDefaultAction(self.DesktopScreen)
self.BlankScreen.setChecked(False)
self.ThemeScreen.setChecked(False)
#self.DesktopScreen.setChecked(checked)
if self.screens.display_count > 1:
self.DesktopScreen.setChecked(checked)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
else:

View File

@ -756,3 +756,7 @@ class ThemeManager(QtGui.QWidget):
#theme.theme_mode
theme.theme_name = theme.theme_name.strip()
#theme.theme_version
# Remove the Transparent settings as they are not relevent
if theme.background_mode == u'transparent':
theme.background_type = u'solid'
theme.background_startColor = u'#000000'