forked from openlp/openlp
Live display for Images
This commit is contained in:
parent
996f779602
commit
0d7f81c020
@ -379,7 +379,7 @@ class ServiceItem(object):
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
return self.render_individual(row)
|
||||
else:
|
||||
return self._raw_frames[row][u'image']
|
||||
return self._raw_frames[row][u'image'], u''
|
||||
|
||||
def get_frame_title(self, row=0):
|
||||
"""
|
||||
|
@ -25,12 +25,11 @@
|
||||
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
|
||||
from PyQt4 import QtCore, QtGui, QtWebKit
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Receiver, resize_image, build_html, ServiceItem
|
||||
from openlp.core.lib import Receiver, resize_image, build_html, ServiceItem, image_to_byte
|
||||
from openlp.core.ui import HideMode
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -236,19 +235,7 @@ class WebViewer(DisplayWidget):
|
||||
self.setWindowTitle(u'OpenLP Display')
|
||||
self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
|
||||
QtCore.Qt.WindowStaysOnTopHint)
|
||||
self.currimage = False
|
||||
# self.byteArray = QtCore.QByteArray()
|
||||
# buffer = QtCore.QBuffer(self.byteArray) #// use buffer to store pixmap into byteArray
|
||||
# buffer.open(QtCore.QIODevice.WriteOnly)
|
||||
# pixmap = QtGui.QPixmap("/home/timali/Pictures/IMG_0726.jpg")
|
||||
# pixmap.save(buffer, "PNG")
|
||||
# self.byteArray2 = QtCore.QByteArray()
|
||||
# buffer = QtCore.QBuffer(self.byteArray) #// use buffer to store pixmap into byteArray
|
||||
# buffer.open(QtCore.QIODevice.WriteOnly)
|
||||
# pixmap = QtGui.QPixmap("file:///home/timali/Pictures/out.png")
|
||||
# pixmap.save(buffer, "PNG")
|
||||
# self.image1 = "file:///home/timali/Pictures/IMG_0726.jpg"
|
||||
# self.image2 = "file:///home/timali/Pictures/out.png"
|
||||
|
||||
self.currvideo = False
|
||||
self.video1 = "c:\\users\\jonathan\\Desktop\\Wildlife.wmv"
|
||||
self.video2 = "c:\\users\\jonathan\\Desktop\\movie.ogg"
|
||||
@ -274,15 +261,13 @@ class WebViewer(DisplayWidget):
|
||||
def alert(self):
|
||||
self.frame.findFirstElement('div#alert').setInnerXml(self.alerttext)
|
||||
|
||||
def image(self, byteImage):
|
||||
def image(self, image):
|
||||
self.frame.evaluateJavaScript(
|
||||
"document.getElementById('video').style.visibility = 'hidden'")
|
||||
self.frame.evaluateJavaScript(
|
||||
"document.getElementById('image').style.visibility = 'visible'")
|
||||
if self.currimage:
|
||||
self.frame.findFirstElement('img').setAttribute(
|
||||
'src', unicode('data:image/png;base64,%s' % byteImage.toBase64()))
|
||||
self.currimage = not self.currimage
|
||||
'src', unicode('data:image/png;base64,%s' % image_to_byte(image)))
|
||||
|
||||
def video(self, videoPath, noSound=False):
|
||||
if self.currimage:
|
||||
@ -333,8 +318,8 @@ class WebViewer(DisplayWidget):
|
||||
self.show()
|
||||
|
||||
def preview(self):
|
||||
# Wait for the screen to update before geting the preview.
|
||||
# Important otherwise first preview will miss the background
|
||||
# Wait for the webview to update before geting the preview.
|
||||
# Important otherwise first preview will miss the background !
|
||||
while not self.loaded:
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
preview = QtGui.QImage(self.screen[u'size'].width(),
|
||||
@ -349,11 +334,6 @@ class WebViewer(DisplayWidget):
|
||||
preview.save("temp.png", "png")
|
||||
return preview
|
||||
|
||||
def initialDisplay(self, image, video=False):
|
||||
if not video:
|
||||
html = build_html(self.parent.renderManager.themedata, self.screen, None, image)
|
||||
self.webView.setHtml(html)
|
||||
|
||||
def buildHtml(self, serviceItem):
|
||||
"""
|
||||
Store the serviceItem and build the new HTML from it. Add the
|
||||
|
@ -781,13 +781,11 @@ class SlideController(QtGui.QWidget):
|
||||
self.updatePreview()
|
||||
else:
|
||||
before = time.time()
|
||||
if self.serviceItem.just_rendered:
|
||||
self.serviceItem.just_rendered = False
|
||||
frame, raw_html = self.serviceItem.get_rendered_frame(row)
|
||||
if self.serviceItem.is_text():
|
||||
frame = self.display.text(raw_html)
|
||||
else:
|
||||
self.displayManager.displayImage(frame)
|
||||
self.display.image(frame)
|
||||
if isinstance(frame, QtGui.QImage):
|
||||
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user