Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2013-03-14 18:27:51 (GMT)
committer Walter Bender <walter.bender@gmail.com>2013-03-14 18:27:51 (GMT)
commitf7d019df089cac36a275c7b237d14523f6334e71 (patch)
tree352c6aeb4d652377d31ab5b1272d5d40b9a2d1c7
parentd294502f536ffb957327c8f3df9745ce8d151bff (diff)
more backport from GTK3 version
-rw-r--r--exportpdf.py18
-rw-r--r--utils.py1
2 files changed, 10 insertions, 9 deletions
diff --git a/exportpdf.py b/exportpdf.py
index 75b8eb3..3be40eb 100644
--- a/exportpdf.py
+++ b/exportpdf.py
@@ -26,8 +26,6 @@ from gettext import gettext as _
from utils import get_pixbuf_from_journal, parse_comments
-HEAD = 32
-BODY = 12
PAGE_WIDTH = 504
PAGE_HEIGHT = 648
LEFT_MARGIN = 10
@@ -47,22 +45,24 @@ def save_pdf(activity, nick, description=None):
cr = cairo.Context(pdf_surface)
cr.set_source_rgb(0, 0, 0)
- show_text(cr, fd, nick, HEAD, LEFT_MARGIN, TOP_MARGIN)
+ show_text(cr, fd, nick, activity.title_size, LEFT_MARGIN, TOP_MARGIN)
show_text(cr, fd, time.strftime('%x', time.localtime()),
- BODY, LEFT_MARGIN, TOP_MARGIN + 3 * HEAD)
+ activity.desc_size, LEFT_MARGIN,
+ TOP_MARGIN + 3 * activity.title_size)
if description is not None:
show_text(cr, fd, description,
- BODY, LEFT_MARGIN, TOP_MARGIN + 4 * HEAD)
+ activity.desc_size, LEFT_MARGIN,
+ TOP_MARGIN + 5 * activity.title_size)
cr.show_page()
for i, dsobj in enumerate(activity.dsobjects):
if dsobj.metadata['keep'] == '0':
continue
if 'title' in dsobj.metadata:
- show_text(cr, fd, dsobj.metadata['title'], HEAD, LEFT_MARGIN,
- TOP_MARGIN)
+ show_text(cr, fd, dsobj.metadata['title'], activity.title_size,
+ LEFT_MARGIN, TOP_MARGIN)
else:
- show_text(cr, fd, _('untitled'), HEAD, LEFT_MARGIN,
+ show_text(cr, fd, _('untitled'), activity.title_size, LEFT_MARGIN,
TOP_MARGIN)
try:
@@ -94,7 +94,7 @@ def save_pdf(activity, nick, description=None):
if 'comments' in dsobj.metadata:
text += '\n'
text += parse_comments(json.loads(dsobj.metadata['comments']))
- show_text(cr, fd, text, BODY, LEFT_MARGIN, h + 175)
+ show_text(cr, fd, text, activity.desc_size, LEFT_MARGIN, h + 175)
cr.show_page()
return tmp_file
diff --git a/utils.py b/utils.py
index ecbbf7a..1141987 100644
--- a/utils.py
+++ b/utils.py
@@ -20,6 +20,7 @@ from gettext import gettext as _
XO1 = 'xo1'
XO15 = 'xo1.5'
XO175 = 'xo1.75'
+XO4 = 'xo4'
UNKNOWN = 'unknown'