forked from openlp/openlp
Fixed the theme layout preview and made preview widget scaling use HTML scaling.
This commit is contained in:
parent
bb9aa4a561
commit
66ce7db46f
@ -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) {
|
||||
|
@ -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))
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user