diff --git a/openlp/core/display/html/display.js b/openlp/core/display/html/display.js index 3751eb97a..848de2312 100644 --- a/openlp/core/display/html/display.js +++ b/openlp/core/display/html/display.js @@ -682,6 +682,12 @@ var Display = { videoTypes.push(['video/webm', '*.webm']); } return videoTypes; + }, + /** + * Sets the scale of the page - used to make preview widgets scale + */ + setScale: function(scale) { + document.body.style.zoom = scale+"%"; } }; new QWebChannel(qt.webChannelTransport, function (channel) { diff --git a/openlp/core/display/window.py b/openlp/core/display/window.py index cddde2833..39e5de7dd 100644 --- a/openlp/core/display/window.py +++ b/openlp/core/display/window.py @@ -310,3 +310,9 @@ class DisplayWindow(QtWidgets.QWidget): Show the display """ self.run_javascript('Display.show();') + + def set_scale(self, scale): + """ + Set the HTML scale + """ + self.run_javascript('Display.setScale({scale});'.format(scale=scale*100)) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 602588f36..234acd88f 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -945,8 +945,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties): ratio = 0.25 else: ratio = float(size.width()) / display_with - # TODO: Find a different scale solution, setZoomFactor only supports 0.25-5.0. Maybe HTML scale? - self.preview_display.webview.setZoomFactor(ratio) + self.preview_display.set_scale(ratio) def main_display_set_background(self): """ diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index b920ce6ac..34413ff8f 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -219,15 +219,19 @@ class ThemeForm(QtWidgets.QWizard, Ui_ThemeWizard, RegistryProperties): Generate layout preview and display the form. """ self.update_theme() - width = self.renderer.width - height = self.renderer.height + width = self.renderer.width() + height = self.renderer.height() pixmap = QtGui.QPixmap(width, height) pixmap.fill(QtCore.Qt.white) paint = QtGui.QPainter(pixmap) paint.setPen(QtGui.QPen(QtCore.Qt.blue, 2)) - paint.drawRect(self.renderer.get_main_rectangle(self.theme)) + main_rect = QtCore.QRect(self.theme.font_main_x, self.theme.font_main_y, + self.theme.font_main_width - 1, self.theme.font_main_height - 1) + paint.drawRect(main_rect) paint.setPen(QtGui.QPen(QtCore.Qt.red, 2)) - paint.drawRect(self.renderer.get_footer_rectangle(self.theme)) + footer_rect = QtCore.QRect(self.theme.font_footer_x, self.theme.font_footer_y, + self.theme.font_footer_width - 1, self.theme.font_footer_height - 1) + paint.drawRect(footer_rect) paint.end() self.theme_layout_form.exec(pixmap) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 4c14f4ad0..1e8e7a467 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -295,7 +295,7 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R for plugin in self.plugin_manager.plugins: if plugin.uses_theme(old_theme_name): plugin.rename_theme(old_theme_name, new_theme_name) - self.renderer.update_theme(new_theme_name, old_theme_name) + #self.renderer.update_theme(new_theme_name, old_theme_name) self.load_themes() def on_copy_theme(self, field=None): @@ -347,7 +347,7 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R self.theme_form.theme = theme self.theme_form.exec(True) self.old_background_image_path = None - self.renderer.update_theme(theme.theme_name) + #self.renderer.update_theme(theme.theme_name) self.load_themes() def on_delete_theme(self, field=None): @@ -363,7 +363,7 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R row = self.theme_list_widget.row(item) self.theme_list_widget.takeItem(row) self.delete_theme(theme) - self.renderer.update_theme(theme, only_delete=True) + #self.renderer.update_theme(theme, only_delete=True) # As we do not reload the themes, push out the change. Reload the # list as the internal lists and events need to be triggered. self._push_themes()