This commit is contained in:
Raoul Snyman 2018-12-10 09:48:48 -07:00
commit 2f8ad08d1a
4 changed files with 18 additions and 14 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))

View File

@ -1259,7 +1259,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
"""
The theme may have changed in the settings dialog so make sure the theme combo box is in the correct state.
"""
visible = self.renderer.theme_level != ThemeLevel.Global
visible = True # self.renderer.theme_level != ThemeLevel.Global
self.toolbar.actions['theme_combo_box'].setVisible(visible)
self.toolbar.actions['theme_label'].setVisible(visible)
self.regenerate_service_items()

View File

@ -213,11 +213,15 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties):
layout.addWidget(label)
container.setLayout(layout)
slide_height = width // self.screen_ratio
max_slide_height = Settings().value('advanced/slide max height')
if slide_height < 0:
slide_height = max_slide_height
else:
slide_height = min(slide_height, max_slide_height)
max_img_row_height = Settings().value('advanced/slide max height')
if isinstance(max_img_row_height, int):
if max_img_row_height > 0 and slide_height > max_img_row_height:
slide_height = max_img_row_height
elif max_img_row_height < 0:
# If auto setting, show that number of slides, or if the resulting slides too small, 100px.
# E.g. If setting is -4, 4 slides will be visible, unless those slides are < 100px high.
self.auto_row_height = max(self.viewport().height() / (-1 * max_img_row_height), 100)
slide_height = min(slide_height, self.auto_row_height)
self.setCellWidget(slide_index, 0, container)
row += 1
text.append(str(row))