Update Render.py to handle footers to slides if required.

Values will eventually come from Theme.
This commit is contained in:
Tim Bentley 2009-03-29 17:51:42 +01:00
parent 4ac2ed4fd6
commit 95409076d0
1 changed files with 16 additions and 8 deletions

View File

@ -373,7 +373,7 @@ class Renderer:
return brcorner return brcorner
# xxx this is what to override for an SDL version # xxx this is what to override for an SDL version
def _get_extent_and_render(self, line, tlcorner=(0,0), dodraw=False, color=None): def _get_extent_and_render(self, line, tlcorner=(0,0), dodraw=False, color=None, footer = False):
"""Find bounding box of text - as render_single_line. """Find bounding box of text - as render_single_line.
If dodraw is set, actually draw the text to the current DC as well If dodraw is set, actually draw the text to the current DC as well
@ -384,17 +384,25 @@ class Renderer:
p.begin(self._paint) p.begin(self._paint)
# 'twould be more efficient to set this once when theme changes # 'twould be more efficient to set this once when theme changes
# or p changes # or p changes
font=QtGui.QFont(self._theme.FontName, if footer :
self._theme.FontProportion, # size font=QtGui.QFont(self._theme.FontName,
QtGui.QFont.Normal, # weight 12, # size
0)# italic QtGui.QFont.Normal, # weight
0)# italic
else:
font=QtGui.QFont(self._theme.FontName,
self._theme.FontProportion, # size
QtGui.QFont.Normal, # weight
0)# italic
# to make the unit tests monitor independent, we have to be able to # to make the unit tests monitor independent, we have to be able to
# specify whether a font proportion is in pixels or points # specify whether a font proportion is in pixels or points
if self._theme.FontUnits.lower() == "pixels": if self._theme.FontUnits.lower() == "pixels":
log.debug(u"pixels") log.debug(u"pixels")
font.setPixelSize(self._theme.FontProportion) if footer:
log.debug(self._theme.FontName, self._theme.FontProportion) font.setPixelSize(12)
log.debug(font.family(), font.pointSize()) else:
font.setPixelSize(self._theme.FontProportion)
log.debug(u'Font details %s %s %s %s', self._theme.FontName, self._theme.FontProportion, font.family(), font.pointSize())
p.setFont(font) p.setFont(font)
if color == None: if color == None:
p.setPen(self._theme.FontColor) p.setPen(self._theme.FontColor)