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 * 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) { setImageSlides: function (slides) {
Display.clearSlides(); Display.clearSlides();
@ -435,7 +435,7 @@ var Display = {
section.setAttribute("id", index); section.setAttribute("id", index);
section.setAttribute("data-background", "#000"); section.setAttribute("data-background", "#000");
var img = document.createElement('img'); var img = document.createElement('img');
img.src = slide["filename"]; img.src = slide["path"];
img.setAttribute("style", "height: 100%; width: 100%;"); img.setAttribute("style", "height: 100%; width: 100%;");
section.appendChild(img); section.appendChild(img);
slidesDiv.appendChild(section); slidesDiv.appendChild(section);
@ -445,14 +445,14 @@ var Display = {
}, },
/** /**
* Set a video * 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) { setVideo: function (video) {
this.clearSlides(); this.clearSlides();
var section = document.createElement("section"); var section = document.createElement("section");
section.setAttribute("data-background", "#000"); section.setAttribute("data-background", "#000");
var videoElement = document.createElement("video"); var videoElement = document.createElement("video");
videoElement.src = video["filename"]; videoElement.src = video["path"];
videoElement.preload = "auto"; videoElement.preload = "auto";
videoElement.setAttribute("id", "video"); videoElement.setAttribute("id", "video");
videoElement.setAttribute("style", "height: 100%; width: 100%;"); videoElement.setAttribute("style", "height: 100%; width: 100%;");

View File

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