forked from openlp/openlp
Refactor theme outlines
This commit is contained in:
parent
74b288aa6a
commit
b3ce7bf940
@ -506,7 +506,7 @@ class Renderer(object):
|
|||||||
self.mainFont.setPixelSize(self._theme.font_main_proportion)
|
self.mainFont.setPixelSize(self._theme.font_main_proportion)
|
||||||
|
|
||||||
def _get_extent_and_render(self, line, footer, tlcorner=(0, 0), draw=False,
|
def _get_extent_and_render(self, line, footer, tlcorner=(0, 0), draw=False,
|
||||||
color=None, outline_size=0, outline_color=None):
|
color=None, outline_size=None, outline_color=None):
|
||||||
"""
|
"""
|
||||||
Find bounding box of text - as render_single_line. If draw is set,
|
Find bounding box of text - as render_single_line. If draw is set,
|
||||||
actually draw the text to the current DC as well return width and
|
actually draw the text to the current DC as well return width and
|
||||||
@ -532,31 +532,37 @@ class Renderer(object):
|
|||||||
font = self.footerFont
|
font = self.footerFont
|
||||||
else:
|
else:
|
||||||
font = self.mainFont
|
font = self.mainFont
|
||||||
self.painter.setFont(font)
|
|
||||||
if color is None:
|
|
||||||
if footer:
|
|
||||||
self.painter.setPen(QtGui.QColor(self._theme.font_footer_color))
|
|
||||||
else:
|
|
||||||
self.painter.setPen(QtGui.QColor(self._theme.font_main_color))
|
|
||||||
else:
|
|
||||||
self.painter.setPen(QtGui.QColor(color))
|
|
||||||
x, y = tlcorner
|
|
||||||
metrics = QtGui.QFontMetrics(font)
|
metrics = QtGui.QFontMetrics(font)
|
||||||
w = metrics.width(line)
|
w = metrics.width(line)
|
||||||
h = metrics.height()
|
h = metrics.height()
|
||||||
if draw:
|
if draw:
|
||||||
self.painter.drawText(x, y + metrics.ascent(), line)
|
self.painter.setFont(font)
|
||||||
if self._theme.display_slideTransition:
|
|
||||||
# Print 2nd image with 70% weight
|
|
||||||
self.painter2.setFont(font)
|
|
||||||
if color is None:
|
if color is None:
|
||||||
if footer:
|
if footer:
|
||||||
self.painter2.setPen(QtGui.QColor(self._theme.font_footer_color))
|
pen = QtGui.QColor(self._theme.font_footer_color)
|
||||||
else:
|
else:
|
||||||
self.painter2.setPen(QtGui.QColor(self._theme.font_main_color))
|
pen = QtGui.QColor(self._theme.font_main_color)
|
||||||
else:
|
else:
|
||||||
self.painter2.setPen(QtGui.QColor(color))
|
pen = QtGui.QColor(color)
|
||||||
if draw:
|
x, y = tlcorner
|
||||||
|
if outline_size:
|
||||||
|
path = QtGui.QPainterPath()
|
||||||
|
path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line)
|
||||||
|
self.painter.setBrush(self.painter.pen().brush())
|
||||||
|
self.painter.setPen(QtGui.QPen(QtGui.QColor(outline_color), outline_size))
|
||||||
|
self.painter.drawPath(path)
|
||||||
|
self.painter.setPen(pen)
|
||||||
|
self.painter.drawText(x, y + metrics.ascent(), line)
|
||||||
|
if self._theme.display_slideTransition:
|
||||||
|
# Print 2nd image with 70% weight
|
||||||
|
if outline_size:
|
||||||
|
path = QtGui.QPainterPath()
|
||||||
|
path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line)
|
||||||
|
self.painter2.setBrush(self.painter2.pen().brush())
|
||||||
|
self.painter2.setPen(QtGui.QPen(QtGui.QColor(outline_color), outline_size))
|
||||||
|
self.painter2.drawPath(path)
|
||||||
|
self.painter2.setFont(font)
|
||||||
|
self.painter2.setPen(pen)
|
||||||
self.painter2.drawText(x, y + metrics.ascent(), line)
|
self.painter2.drawText(x, y + metrics.ascent(), line)
|
||||||
return (w, h)
|
return (w, h)
|
||||||
|
|
||||||
|
@ -470,7 +470,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.PreviewListWidget.setCellWidget(framenumber, 0, label)
|
self.PreviewListWidget.setCellWidget(framenumber, 0, label)
|
||||||
slide_height = width * self.parent.RenderManager.screen_ratio
|
slide_height = width * self.parent.RenderManager.screen_ratio
|
||||||
self.PreviewListWidget.setItem(framenumber, 0, item)
|
self.PreviewListWidget.setItem(framenumber, 0, item)
|
||||||
print row
|
|
||||||
if slide_height != 0:
|
if slide_height != 0:
|
||||||
self.PreviewListWidget.setRowHeight(framenumber, slide_height)
|
self.PreviewListWidget.setRowHeight(framenumber, slide_height)
|
||||||
if self.serviceItem.is_text():
|
if self.serviceItem.is_text():
|
||||||
|
Loading…
Reference in New Issue
Block a user