Subtract shadow from width, not add it

This commit is contained in:
Jonathan Corwin 2010-09-04 15:23:20 +01:00
parent 704502b05d
commit 5dd5e15060
2 changed files with 24 additions and 8 deletions

View File

@ -286,6 +286,10 @@ def build_html(item, screen, alert, islive):
return html
def webkit_version():
"""
Return the Webkit version in use.
Note method added relatively recently, so return 0 if prior to this
"""
try:
webkitvers = float(QtWebKit.qWebKitVersion())
log.debug(u'Webkit version = %s' % webkitvers)
@ -402,6 +406,16 @@ def build_lyrics_css(item, webkitvers):
return lyrics_css
def build_lyrics_outline_css(theme, is_shadow=False):
"""
Build the css which controls the theme outline
Also used by renderer for splitting verses
`theme`
Object containing theme information
`is_shadow`
If true, use the shadow colors instead
"""
if theme.display_outline:
size = float(theme.display_outline_size) / 16
if is_shadow:
@ -420,11 +434,14 @@ def build_lyrics_format_css(theme, width, height):
Build the css which controls the theme format
Also used by renderer for splitting verses
`item`
Service Item containing theme and location information
`theme`
Object containing theme information
`webkitvers`
The version of qtwebkit we're using
`width`
Width of the lyrics block
`height`
Height of the lyrics block
"""
if theme.display_horizontalAlign == 2:

View File

@ -143,15 +143,14 @@ class Renderer(object):
for verse in verses_text:
lines = verse.split(u'\n')
for line in lines:
text.append(line)
text.append(line)
web = QtWebKit.QWebView()
web.resize(self._rect.width(), self._rect.height())
web.setVisible(False)
frame = web.page().mainFrame()
# Adjust width and height to account for shadow. outline done in css
width = self._rect.width() + int(self._theme.display_shadow_size)
height = self._rect.height() + int(self._theme.display_shadow_size)
width = self._rect.width() - int(self._theme.display_shadow_size)
height = self._rect.height() - int(self._theme.display_shadow_size)
shell = u'<html><head><style>#main {%s %s}</style><body>' \
u'<div id="main">' % \
(build_lyrics_format_css(self._theme, width, height),