forked from openlp/openlp
Tidy up image background workflow and make it work
This commit is contained in:
parent
50aea9128d
commit
c5e8a4cdab
@ -262,6 +262,8 @@ class WebViewer(DisplayWidget):
|
||||
self.frame.findFirstElement('div#alert').setInnerXml(self.alerttext)
|
||||
|
||||
def image(self, image):
|
||||
image = resize_image(image, self.screen[u'size'].width(),
|
||||
self.screen[u'size'].height())
|
||||
self.frame.evaluateJavaScript(
|
||||
"document.getElementById('video').style.visibility = 'hidden'")
|
||||
self.frame.evaluateJavaScript(
|
||||
@ -269,6 +271,10 @@ class WebViewer(DisplayWidget):
|
||||
self.frame.findFirstElement('img').setAttribute(
|
||||
'src', unicode('data:image/png;base64,%s' % image_to_byte(image)))
|
||||
|
||||
def reset(self):
|
||||
self.frame.findFirstElement('img').setAttribute(
|
||||
'src', unicode('data:image/png;base64,%s' % image_to_byte(self.serviceItem.bg_frame)))
|
||||
|
||||
def video(self, videoPath, noSound=False):
|
||||
if self.currimage:
|
||||
self.frame.findFirstElement('video').setAttribute('src', videoPath)
|
||||
@ -312,9 +318,9 @@ class WebViewer(DisplayWidget):
|
||||
(self.screens.current[u'size'].width() - splash_image.width()) / 2,
|
||||
(self.screens.current[u'size'].height() - splash_image.height()) / 2,
|
||||
splash_image)
|
||||
item = ServiceItem()
|
||||
item.bg_frame = initialFrame
|
||||
self.webView.setHtml(build_html(item, self.screen, None))
|
||||
self.serviceItem = ServiceItem()
|
||||
self.serviceItem.bg_frame = initialFrame
|
||||
self.webView.setHtml(build_html(self.serviceItem, self.screen, None))
|
||||
self.show()
|
||||
|
||||
def preview(self):
|
||||
|
@ -108,8 +108,13 @@ class ImageMediaItem(MediaManagerItem):
|
||||
u'Replace Background', u':/slides/slide_blank.png',
|
||||
translate('ImagePlugin.MediaItem', 'Replace Live Background'),
|
||||
self.onReplaceClick, False)
|
||||
self.resetButton = self.toolbar.addToolbarButton(
|
||||
u'Reset Background', u':/system/system_close.png',
|
||||
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
|
||||
self.onResetClick, False)
|
||||
# Add the song widget to the page layout
|
||||
self.pageLayout.addWidget(self.ImageWidget)
|
||||
self.resetButton.setVisible(False)
|
||||
|
||||
def onDeleteClick(self):
|
||||
"""
|
||||
@ -167,6 +172,10 @@ class ImageMediaItem(MediaManagerItem):
|
||||
else:
|
||||
return False
|
||||
|
||||
def onResetClick(self):
|
||||
self.resetButton.setVisible(False)
|
||||
self.parent.liveController.display.reset()
|
||||
|
||||
def onReplaceClick(self):
|
||||
if check_item_selected(self.listView,
|
||||
translate('ImagePlugin.MediaItem',
|
||||
@ -176,7 +185,8 @@ class ImageMediaItem(MediaManagerItem):
|
||||
bitem = self.listView.item(item.row())
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
frame = QtGui.QImage(unicode(filename))
|
||||
self.parent.displayManager.displayImageWithText(frame)
|
||||
self.parent.liveController.display.image(frame)
|
||||
self.resetButton.setVisible(True)
|
||||
|
||||
def onPreviewClick(self):
|
||||
MediaManagerItem.onPreviewClick(self)
|
||||
|
@ -95,17 +95,26 @@ class MediaMediaItem(MediaManagerItem):
|
||||
u'Replace Background', u':/slides/slide_blank.png',
|
||||
translate('MediaPlugin.MediaItem', 'Replace Live Background'),
|
||||
self.onReplaceClick, False)
|
||||
self.resetButton = self.toolbar.addToolbarButton(
|
||||
u'Reset Background', u':/system/system_close.png',
|
||||
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
|
||||
self.onResetClick, False)
|
||||
# Add the song widget to the page layout
|
||||
self.pageLayout.addWidget(self.ImageWidget)
|
||||
self.resetButton.setVisible(False)
|
||||
|
||||
def onResetClick(self):
|
||||
self.resetButton.setVisible(False)
|
||||
self.parent.liveController.display.reset()
|
||||
|
||||
def onReplaceClick(self):
|
||||
|
||||
if check_item_selected(self.listView,
|
||||
translate('ImagePlugin.MediaItem',
|
||||
'You must select an item to process.')):
|
||||
item = self.listView.currentItem()
|
||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
self.parent.displayManager.displayVideo(filename)
|
||||
self.resetButton.setVisible(True)
|
||||
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
if item is None:
|
||||
|
Loading…
Reference in New Issue
Block a user