forked from openlp/openlp
parent
8e8e76e708
commit
3e2e87bb2c
@ -229,6 +229,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
"""
|
||||
Detects Page changes and updates as approprate.
|
||||
"""
|
||||
if self.page(pageId) == self.areaPositionPage:
|
||||
self._generate_layout()
|
||||
if self.page(pageId) == self.previewPage:
|
||||
self.updateTheme()
|
||||
frame = self.thememanager.generateImage(self.theme)
|
||||
@ -236,6 +238,38 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
self.displayAspectRatio = float(frame.width()) / frame.height()
|
||||
self.resizeEvent()
|
||||
|
||||
def _generate_layout(self):
|
||||
width = self.thememanager.mainwindow.renderer.width
|
||||
height = self.thememanager.mainwindow.renderer.height
|
||||
footer_start = int(height * 0.90)
|
||||
pixmap = QtGui.QPixmap(width, height)
|
||||
pixmap.fill(QtCore.Qt.white)
|
||||
paint = QtGui.QPainter(pixmap)
|
||||
paint.setPen(QtCore.Qt.blue)
|
||||
if not self.theme.font_main_override:
|
||||
main_rect = QtCore.QRect(10, 0, width - 20, footer_start)
|
||||
else:
|
||||
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(QtCore.Qt.red)
|
||||
if not self.theme.font_footer_override:
|
||||
footer_rect = QtCore.QRect(10, footer_start, width - 20,
|
||||
height - footer_start)
|
||||
else:
|
||||
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)
|
||||
print footer_rect
|
||||
paint.drawRect(footer_rect)
|
||||
paint.end()
|
||||
pixmap = pixmap.scaled(100, 100 *
|
||||
self.thememanager.mainwindow.renderer.screen_ratio,
|
||||
QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
|
||||
self.themeLayoutLabel.setPixmap(pixmap)
|
||||
self.displayAspectRatio = float(pixmap.width()) / pixmap.height()
|
||||
self.resizeEvent()
|
||||
|
||||
def onOutlineCheckCheckBoxStateChanged(self, state):
|
||||
"""
|
||||
Change state as Outline check box changed
|
||||
|
@ -336,6 +336,21 @@ class Ui_ThemeWizard(object):
|
||||
self.footerPositionLayout.addRow(self.footerHeightLabel,
|
||||
self.footerHeightSpinBox)
|
||||
self.areaPositionLayout.addWidget(self.footerPositionGroupBox)
|
||||
self.layoutArea = QtGui.QWidget(self.areaPositionPage)
|
||||
self.layoutArea.setObjectName(u'LayoutArea')
|
||||
self.themeLayoutPreview = QtGui.QGridLayout(self.layoutArea)
|
||||
self.themeLayoutPreview.setMargin(0)
|
||||
self.themeLayoutPreview.setColumnStretch(0, 1)
|
||||
self.themeLayoutPreview.setRowStretch(0, 1)
|
||||
self.themeLayoutLabel = QtGui.QLabel(self.areaPositionPage)
|
||||
self.themeLayoutLabel.setObjectName(u'ThemeLayoutPreview')
|
||||
self.themeLayoutLabel.setObjectName(u'ThemeLayoutPreview')
|
||||
self.themeLayoutLabel = QtGui.QLabel(self.layoutArea)
|
||||
self.themeLayoutLabel.setFrameShape(QtGui.QFrame.Box)
|
||||
self.themeLayoutLabel.setScaledContents(True)
|
||||
self.themeLayoutLabel.setObjectName(u'ThemeLayoutLabel')
|
||||
self.areaPositionLayout.addWidget(self.themeLayoutLabel)
|
||||
self.areaPositionLayout.addWidget(self.layoutArea)
|
||||
themeWizard.addPage(self.areaPositionPage)
|
||||
# Preview Page
|
||||
self.previewPage = QtGui.QWizardPage()
|
||||
|
Loading…
Reference in New Issue
Block a user