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:
|
if self.service_item_type == ServiceItemType.Text:
|
||||||
return self.render_individual(row)
|
return self.render_individual(row)
|
||||||
else:
|
else:
|
||||||
return self._raw_frames[row][u'image']
|
return self._raw_frames[row][u'image'], u''
|
||||||
|
|
||||||
def get_frame_title(self, row=0):
|
def get_frame_title(self, row=0):
|
||||||
"""
|
"""
|
||||||
|
@ -25,12 +25,11 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import time
|
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui, QtWebKit
|
from PyQt4 import QtCore, QtGui, QtWebKit
|
||||||
from PyQt4.phonon import Phonon
|
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
|
from openlp.core.ui import HideMode
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -236,19 +235,7 @@ class WebViewer(DisplayWidget):
|
|||||||
self.setWindowTitle(u'OpenLP Display')
|
self.setWindowTitle(u'OpenLP Display')
|
||||||
self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
|
self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
|
||||||
QtCore.Qt.WindowStaysOnTopHint)
|
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.currvideo = False
|
||||||
self.video1 = "c:\\users\\jonathan\\Desktop\\Wildlife.wmv"
|
self.video1 = "c:\\users\\jonathan\\Desktop\\Wildlife.wmv"
|
||||||
self.video2 = "c:\\users\\jonathan\\Desktop\\movie.ogg"
|
self.video2 = "c:\\users\\jonathan\\Desktop\\movie.ogg"
|
||||||
@ -274,15 +261,13 @@ class WebViewer(DisplayWidget):
|
|||||||
def alert(self):
|
def alert(self):
|
||||||
self.frame.findFirstElement('div#alert').setInnerXml(self.alerttext)
|
self.frame.findFirstElement('div#alert').setInnerXml(self.alerttext)
|
||||||
|
|
||||||
def image(self, byteImage):
|
def image(self, image):
|
||||||
self.frame.evaluateJavaScript(
|
self.frame.evaluateJavaScript(
|
||||||
"document.getElementById('video').style.visibility = 'hidden'")
|
"document.getElementById('video').style.visibility = 'hidden'")
|
||||||
self.frame.evaluateJavaScript(
|
self.frame.evaluateJavaScript(
|
||||||
"document.getElementById('image').style.visibility = 'visible'")
|
"document.getElementById('image').style.visibility = 'visible'")
|
||||||
if self.currimage:
|
self.frame.findFirstElement('img').setAttribute(
|
||||||
self.frame.findFirstElement('img').setAttribute(
|
'src', unicode('data:image/png;base64,%s' % image_to_byte(image)))
|
||||||
'src', unicode('data:image/png;base64,%s' % byteImage.toBase64()))
|
|
||||||
self.currimage = not self.currimage
|
|
||||||
|
|
||||||
def video(self, videoPath, noSound=False):
|
def video(self, videoPath, noSound=False):
|
||||||
if self.currimage:
|
if self.currimage:
|
||||||
@ -333,8 +318,8 @@ class WebViewer(DisplayWidget):
|
|||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def preview(self):
|
def preview(self):
|
||||||
# Wait for the screen to update before geting the preview.
|
# Wait for the webview to update before geting the preview.
|
||||||
# Important otherwise first preview will miss the background
|
# Important otherwise first preview will miss the background !
|
||||||
while not self.loaded:
|
while not self.loaded:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
preview = QtGui.QImage(self.screen[u'size'].width(),
|
preview = QtGui.QImage(self.screen[u'size'].width(),
|
||||||
@ -349,11 +334,6 @@ class WebViewer(DisplayWidget):
|
|||||||
preview.save("temp.png", "png")
|
preview.save("temp.png", "png")
|
||||||
return preview
|
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):
|
def buildHtml(self, serviceItem):
|
||||||
"""
|
"""
|
||||||
Store the serviceItem and build the new HTML from it. Add the
|
Store the serviceItem and build the new HTML from it. Add the
|
||||||
|
@ -781,13 +781,11 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.updatePreview()
|
self.updatePreview()
|
||||||
else:
|
else:
|
||||||
before = time.time()
|
before = time.time()
|
||||||
if self.serviceItem.just_rendered:
|
|
||||||
self.serviceItem.just_rendered = False
|
|
||||||
frame, raw_html = self.serviceItem.get_rendered_frame(row)
|
frame, raw_html = self.serviceItem.get_rendered_frame(row)
|
||||||
if self.serviceItem.is_text():
|
if self.serviceItem.is_text():
|
||||||
frame = self.display.text(raw_html)
|
frame = self.display.text(raw_html)
|
||||||
else:
|
else:
|
||||||
self.displayManager.displayImage(frame)
|
self.display.image(frame)
|
||||||
if isinstance(frame, QtGui.QImage):
|
if isinstance(frame, QtGui.QImage):
|
||||||
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user