adding data_root

This commit is contained in:
Rolux 2010-09-17 16:58:46 +02:00
parent 6efa6efb90
commit 8b11bc3df4

View file

@ -3,10 +3,12 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division
import os
import Image
import ImageDraw
from ox.image import drawText, wrapText
data_root = os.path.join(os.path.dirname(__file__), 'data')
def render_list_icon(options):
icon_width = 256
@ -88,7 +90,7 @@ def render_oxdb_poster(options):
poster_ratio = poster_width / poster_height
poster_image = Image.new('RGB', (poster_width, poster_height))
draw = ImageDraw.Draw(poster_image)
font_file = 'data/DejaVuSansCondensedBold.ttf'
font_file = os.path.join(data_root, 'DejaVuSansCondensedBold.ttf')
font_size = {
'small': 28,
'large': 42,
@ -150,7 +152,7 @@ def render_oxdb_poster(options):
# logo
logo_height = 32
logo_image = Image.open('data/logo.poster.png')
logo_image = Image.open(os.path.join(data_root, 'logo.poster.png'))
logo_width = int(round(logo_height * logo_image.size[0] / logo_image.size[1]))
logo_image = logo_image.resize((logo_width, logo_height), Image.ANTIALIAS)
logo_left = text_width - text_margin - logo_width
@ -174,7 +176,7 @@ def render_padma_poster(options):
poster_ratio = poster_width / poster_height
poster_color = (255, 255, 0)
poster_image = Image.new('RGB', (poster_width, poster_height))
font_file = 'data/DejaVuSansCondensedBold.ttf'
font_file = os.path.join(data_root, 'DejaVuSansCondensedBold.ttf')
font_size = 48
# timeline