Fix theme image appearing between media images. Try and do same for ppt, but not yet. Broken the blank button... (it'll get worse before it gets better!)

This commit is contained in:
Jonathan Corwin 2011-04-10 23:10:23 +01:00
parent 78a9c89025
commit 1ce94d1c20
3 changed files with 64 additions and 27 deletions

View File

@ -307,7 +307,7 @@ sup {
</head> </head>
<body> <body>
<img id="bgimage" class="size" %s /> <img id="bgimage" class="size" %s />
<img id="image" class="size" style="display:none" /> <img id="image" class="size" %s />
<video id="video1" class="size" style="visibility:hidden" autobuffer preload> <video id="video1" class="size" style="visibility:hidden" autobuffer preload>
</video> </video>
<video id="video2" class="size" style="visibility:hidden" autobuffer preload> <video id="video2" class="size" style="visibility:hidden" autobuffer preload>
@ -320,7 +320,7 @@ sup {
</html> </html>
""" """
def build_html(item, screen, alert, islive, background): def build_html(item, screen, alert, islive, background, image=None):
""" """
Build the full web paged structure for display Build the full web paged structure for display
@ -332,6 +332,10 @@ def build_html(item, screen, alert, islive, background):
Alert display display information Alert display display information
`islive` `islive`
Item is going live, rather than preview/theme building Item is going live, rather than preview/theme building
`background`
Theme background image - bytes
`image`
Image media item - bytes
""" """
width = screen[u'size'].width() width = screen[u'size'].width()
height = screen[u'size'].height() height = screen[u'size'].height()
@ -339,11 +343,15 @@ def build_html(item, screen, alert, islive, background):
webkitvers = webkit_version() webkitvers = webkit_version()
# Image generated and poked in # Image generated and poked in
if background: if background:
image = u'src="data:image/png;base64,%s"' % background bgimage = u'src="data:image/png;base64,%s"' % background
elif item.bg_image_bytes: elif item.bg_image_bytes:
image = u'src="data:image/png;base64,%s"' % item.bg_image_bytes bgimage = u'src="data:image/png;base64,%s"' % item.bg_image_bytes
else: else:
image = u'style="display:none;"' bgimage = u'style="display:none;"'
if image:
image_src = u'src="data:image/png;base64,%s"' % image
else:
image_src = u'style="display:none;"'
html = HTMLSRC % (build_background_css(item, width, height), html = HTMLSRC % (build_background_css(item, width, height),
width, height, width, height,
build_alert_css(alert, width), build_alert_css(alert, width),
@ -351,7 +359,7 @@ def build_html(item, screen, alert, islive, background):
build_lyrics_css(item, webkitvers), build_lyrics_css(item, webkitvers),
u'true' if theme and theme.display_slide_transition and islive \ u'true' if theme and theme.display_slide_transition and islive \
else u'false', else u'false',
image, bgimage, image_src,
build_lyrics_html(item, webkitvers)) build_lyrics_html(item, webkitvers))
return html return html

View File

@ -453,7 +453,7 @@ class MainDisplay(DisplayWidget):
painter.end() painter.end()
return preview return preview
def buildHtml(self, serviceItem): def buildHtml(self, serviceItem, image=None):
""" """
Store the serviceItem and build the new HTML from it. Add the Store the serviceItem and build the new HTML from it. Add the
HTML to the display HTML to the display
@ -480,8 +480,12 @@ class MainDisplay(DisplayWidget):
if self.serviceItem.themedata.background_filename: if self.serviceItem.themedata.background_filename:
self.serviceItem.bg_image_bytes = self.imageManager. \ self.serviceItem.bg_image_bytes = self.imageManager. \
get_image_bytes(self.serviceItem.themedata.theme_name) get_image_bytes(self.serviceItem.themedata.theme_name)
if image:
image_bytes = self.imageManager.get_image_bytes(image)
else:
image_bytes = None
html = build_html(self.serviceItem, self.screen, self.alertTab, html = build_html(self.serviceItem, self.screen, self.alertTab,
self.isLive, background) self.isLive, background, image_bytes)
log.debug(u'buildHtml - pre setHtml') log.debug(u'buildHtml - pre setHtml')
self.webView.setHtml(html) self.webView.setHtml(html)
log.debug(u'buildHtml - post setHtml') log.debug(u'buildHtml - post setHtml')

View File

@ -567,20 +567,12 @@ class SlideController(QtGui.QWidget):
""" """
log.debug(u'processManagerItem live = %s' % self.isLive) log.debug(u'processManagerItem live = %s' % self.isLive)
self.onStopLoop() self.onStopLoop()
# If old item was a command tell it to stop old_item = self.serviceItem
if self.serviceItem: if old_item and self.isLive and old_item.is_capable(
oldItem = self.serviceItem ItemCapabilities.ProvidesOwnDisplay):
self.serviceItem = None self._resetBlank()
if oldItem.is_command():
Receiver.send_message(u'%s_stop' %
oldItem.name.lower(), [oldItem, self.isLive])
if oldItem.is_media():
self.onMediaClose()
if self.isLive and oldItem.is_capable(
ItemCapabilities.ProvidesOwnDisplay):
self._resetBlank()
Receiver.send_message(u'%s_start' % serviceItem.name.lower(), Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
[serviceItem, self.isLive, self.display.hideMode, slideno]) [serviceItem, self.isLive, self.hideMode(), slideno])
self.slideList = {} self.slideList = {}
width = self.parent.controlSplitter.sizes()[self.split] width = self.parent.controlSplitter.sizes()[self.split]
self.serviceItem = serviceItem self.serviceItem = serviceItem
@ -642,12 +634,25 @@ class SlideController(QtGui.QWidget):
self.previewListWidget.viewport().size().width()) self.previewListWidget.viewport().size().width())
self.__updatePreviewSelection(slideno) self.__updatePreviewSelection(slideno)
self.enableToolBar(serviceItem) self.enableToolBar(serviceItem)
# Pass to display for viewing # Pass to display for viewing.
self.display.buildHtml(self.serviceItem) # Postpone image build, we need to do this later to avoid theme
# flashing on the screen
if not self.serviceItem.is_image():
self.display.buildHtml(self.serviceItem)
if serviceItem.is_media(): if serviceItem.is_media():
self.onMediaStart(serviceItem) self.onMediaStart(serviceItem)
self.onSlideSelected(True) self.onSlideSelected(True)
self.previewListWidget.setFocus() self.previewListWidget.setFocus()
if old_item:
# Close the old item after the new one is opened
# This avoids the service theme/desktop flashing on screen
# However opening a new item of the same type will automatically
# close the previous, so make sure we don't close the new one.
if old_item.is_command() and not serviceItem.is_command():
Receiver.send_message(u'%s_stop' %
old_item.name.lower(), [old_item, self.isLive])
if old_item.is_media() and not serviceItem.is_media():
self.onMediaClose()
Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix, Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix,
[serviceItem]) [serviceItem])
@ -852,7 +857,11 @@ class SlideController(QtGui.QWidget):
if self.serviceItem.is_text(): if self.serviceItem.is_text():
frame = self.display.text(toDisplay) frame = self.display.text(toDisplay)
else: else:
frame = self.display.image(toDisplay) if start:
self.display.buildHtml(self.serviceItem, toDisplay)
frame = self.display.preview()
else:
frame = self.display.image(toDisplay)
# reset the store used to display first image # reset the store used to display first image
self.serviceItem.bg_image_bytes = None self.serviceItem.bg_image_bytes = None
self.slidePreview.setPixmap(QtGui.QPixmap.fromImage(frame)) self.slidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
@ -1099,9 +1108,25 @@ class SlideController(QtGui.QWidget):
Used by command items which provide their own displays to reset the Used by command items which provide their own displays to reset the
screen hide attributes screen hide attributes
""" """
if self.blankScreen.isChecked(): hide_mode = self.hideMode()
if hide_mode == HideMode.Blank:
self.onBlankDisplay(True) self.onBlankDisplay(True)
elif self.themeScreen.isChecked(): elif hide_mode == HideMode.Theme:
self.onThemeDisplay(True) self.onThemeDisplay(True)
elif self.desktopScreen.isChecked(): elif hide_mode == HideMode.Screen:
self.onHideDisplay(True) self.onHideDisplay(True)
def hideMode(self):
"""
Determine what the hide mode should be according to the blank button
"""
if not self.isLive:
return None
elif self.blankScreen.isChecked():
return HideMode.Blank
elif self.themeScreen.isChecked():
return HideMode.Theme
elif self.desktopScreen.isChecked():
return HideMode.Screen
else:
return None