adding data_root
This commit is contained in:
parent
6efa6efb90
commit
8b11bc3df4
1 changed files with 5 additions and 3 deletions
|
@ -3,10 +3,12 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
|
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
import os
|
||||||
import Image
|
import Image
|
||||||
import ImageDraw
|
import ImageDraw
|
||||||
from ox.image import drawText, wrapText
|
from ox.image import drawText, wrapText
|
||||||
|
|
||||||
|
data_root = os.path.join(os.path.dirname(__file__), 'data')
|
||||||
|
|
||||||
def render_list_icon(options):
|
def render_list_icon(options):
|
||||||
icon_width = 256
|
icon_width = 256
|
||||||
|
@ -88,7 +90,7 @@ def render_oxdb_poster(options):
|
||||||
poster_ratio = poster_width / poster_height
|
poster_ratio = poster_width / poster_height
|
||||||
poster_image = Image.new('RGB', (poster_width, poster_height))
|
poster_image = Image.new('RGB', (poster_width, poster_height))
|
||||||
draw = ImageDraw.Draw(poster_image)
|
draw = ImageDraw.Draw(poster_image)
|
||||||
font_file = 'data/DejaVuSansCondensedBold.ttf'
|
font_file = os.path.join(data_root, 'DejaVuSansCondensedBold.ttf')
|
||||||
font_size = {
|
font_size = {
|
||||||
'small': 28,
|
'small': 28,
|
||||||
'large': 42,
|
'large': 42,
|
||||||
|
@ -150,7 +152,7 @@ def render_oxdb_poster(options):
|
||||||
|
|
||||||
# logo
|
# logo
|
||||||
logo_height = 32
|
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_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_image = logo_image.resize((logo_width, logo_height), Image.ANTIALIAS)
|
||||||
logo_left = text_width - text_margin - logo_width
|
logo_left = text_width - text_margin - logo_width
|
||||||
|
@ -174,7 +176,7 @@ def render_padma_poster(options):
|
||||||
poster_ratio = poster_width / poster_height
|
poster_ratio = poster_width / poster_height
|
||||||
poster_color = (255, 255, 0)
|
poster_color = (255, 255, 0)
|
||||||
poster_image = Image.new('RGB', (poster_width, poster_height))
|
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
|
font_size = 48
|
||||||
|
|
||||||
# timeline
|
# timeline
|
||||||
|
|
Loading…
Reference in a new issue