From a5443bf3088976aa82b22b33bb9e0200dc724688 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Thu, 6 Dec 2018 20:52:16 +0100 Subject: [PATCH 1/3] Quick fix for a traceback --- openlp/core/ui/servicemanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 3387cd780..d7720e549 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -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() From 22fc6f746fbfe687bb86eb1494a31f5882f8cb62 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Thu, 6 Dec 2018 21:26:35 +0100 Subject: [PATCH 2/3] Fix images --- openlp/core/display/html/display.js | 8 ++++---- openlp/core/display/window.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/core/display/html/display.js b/openlp/core/display/html/display.js index af7f08453..aafdf7cb3 100644 --- a/openlp/core/display/html/display.js +++ b/openlp/core/display/html/display.js @@ -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%;"); diff --git a/openlp/core/display/window.py b/openlp/core/display/window.py index 84ec7418e..e8545968d 100644 --- a/openlp/core/display/window.py +++ b/openlp/core/display/window.py @@ -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)) From 0f91ad72fd9046f954c225c2d477504d2ba9e2ee Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 7 Dec 2018 21:27:33 +0100 Subject: [PATCH 3/3] Make image preview respect slide-max-height setting --- openlp/core/widgets/views.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/openlp/core/widgets/views.py b/openlp/core/widgets/views.py index 80b3bf493..a247214bd 100644 --- a/openlp/core/widgets/views.py +++ b/openlp/core/widgets/views.py @@ -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))