Fix images

This commit is contained in:
Tomas Groth 2018-12-06 21:26:35 +01:00
parent a5443bf308
commit 22fc6f746f
2 changed files with 8 additions and 8 deletions

View File

@ -425,7 +425,7 @@ var Display = {
},
/**
* Set image slides
* @param {Object[]} slides - A list of images to add as JS objects [{"filename": "url/to/file"}]
* @param {Object[]} slides - A list of images to add as JS objects [{"path": "url/to/file"}]
*/
setImageSlides: function (slides) {
Display.clearSlides();
@ -435,7 +435,7 @@ var Display = {
section.setAttribute("id", index);
section.setAttribute("data-background", "#000");
var img = document.createElement('img');
img.src = slide["filename"];
img.src = slide["path"];
img.setAttribute("style", "height: 100%; width: 100%;");
section.appendChild(img);
slidesDiv.appendChild(section);
@ -445,14 +445,14 @@ var Display = {
},
/**
* Set a video
* @param {Object} video - The video to show as a JS object: {"filename": "url/to/file"}
* @param {Object} video - The video to show as a JS object: {"path": "url/to/file"}
*/
setVideo: function (video) {
this.clearSlides();
var section = document.createElement("section");
section.setAttribute("data-background", "#000");
var videoElement = document.createElement("video");
videoElement.src = video["filename"];
videoElement.src = video["path"];
videoElement.preload = "auto";
videoElement.setAttribute("id", "video");
videoElement.setAttribute("style", "height: 100%; width: 100%;");

View File

@ -250,8 +250,8 @@ class DisplayWindow(QtWidgets.QWidget):
Set images in the display
"""
for image in images:
if not image['filename'].startswith('file://'):
image['filename'] = 'file://' + image['filename']
if not image['path'].startswith('file://'):
image['path'] = 'file://' + image['path']
json_images = json.dumps(images)
self.run_javascript('Display.setImageSlides({images});'.format(images=json_images))
@ -259,8 +259,8 @@ class DisplayWindow(QtWidgets.QWidget):
"""
Load video in the display
"""
if not video['filename'].startswith('file://'):
video['filename'] = 'file://' + video['filename']
if not video['path'].startswith('file://'):
video['path'] = 'file://' + video['path']
json_video = json.dumps(video)
self.run_javascript('Display.setVideo({video});'.format(video=json_video))