From ce7192c03492fcbf6fa6e2ae878ca4c658bf9e97 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Fri, 11 Jan 2013 14:51:28 +0000 Subject: [PATCH] 6290: No Text report with output format PDF is created 6292: No Text report, with output format Print... , is created. svn: r21064 --- README | 1 + gramps/grampsapp.py | 8 ++++---- gramps/plugins/docgen/pdfdoc.py | 4 +++- gramps/plugins/lib/libcairodoc.py | 9 ++++++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README b/README index 966fb956b..0876aff27 100644 --- a/README +++ b/README @@ -8,6 +8,7 @@ The following packages *MUST* be installed in order for Gramps to work: Python 2.7 or greater, Python 3.2 or greater (python version cannot be mixed) GTK 3.0 or greater pygobject 3.3.2 or greater + cairo, pango, pangocairo with instrospection bindings (the gi packages) librsvg2 (svg icon view) xdg-utils diff --git a/gramps/grampsapp.py b/gramps/grampsapp.py index ac91e6122..179168979 100644 --- a/gramps/grampsapp.py +++ b/gramps/grampsapp.py @@ -239,12 +239,12 @@ def show_settings(): try: from gi.repository import GObject try: - gobjectver_str = '%d.%d.%d' % GObject.pygobject_version + pygobjectver_str = '%d.%d.%d' % GObject.pygobject_version except :# any failure to 'get' the version - gobjectver_str = 'unknown version' + pygobjectver_str = 'unknown version' except ImportError: - gobjectver_str = 'not found' + pygobjectver_str = 'not found' try: from gi.repository import Pango @@ -350,7 +350,7 @@ def show_settings(): print (' python : %s' % py_str) print (' gramps : %s' % gramps_str) print (' gtk++ : %s' % gtkver_str) - print (' gobject : %s' % gobjectver_str) + print (' pygobject : %s' % pygobjectver_str) print (' pango : %s' % pangover_str) if usebsddb3: print (' Using bsddb3') diff --git a/gramps/plugins/docgen/pdfdoc.py b/gramps/plugins/docgen/pdfdoc.py index 4d06579a4..748c2fbda 100644 --- a/gramps/plugins/docgen/pdfdoc.py +++ b/gramps/plugins/docgen/pdfdoc.py @@ -86,7 +86,9 @@ class PdfDoc(libcairodoc.CairoDoc): top_margin = self.paper.get_top_margin() * DPI / 2.54 # create cairo context and pango layout - filename = self._backend.filename.encode(sys.getfilesystemencoding()) + filename = self._backend.filename + if sys.version_info[0] < 3: + filename = filename.encode(sys.getfilesystemencoding()) try: surface = cairo.PDFSurface(filename, paper_width, paper_height) except IOError as msg: diff --git a/gramps/plugins/lib/libcairodoc.py b/gramps/plugins/lib/libcairodoc.py index d8f118f54..92f9bb168 100644 --- a/gramps/plugins/lib/libcairodoc.py +++ b/gramps/plugins/lib/libcairodoc.py @@ -30,13 +30,12 @@ """Report output generator based on Cairo. """ -from __future__ import division +from __future__ import division, print_function #------------------------------------------------------------------------ # # Python modules # #------------------------------------------------------------------------ -from __future__ import print_function from gramps.gen.ggettext import gettext as _ from math import radians @@ -47,6 +46,7 @@ import re # Gramps modules # #------------------------------------------------------------------------ +from gramps.gen.constfunc import conv_to_unicode, UNITYPE from gramps.gen.plug.docgen import (BaseDoc, TextDoc, DrawDoc, ParagraphStyle, TableCellStyle, SOLID, FONT_SANS_SERIF, FONT_SERIF, FONT_MONOSPACE, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT) @@ -502,7 +502,10 @@ class GtkDocParagraph(GtkDocBaseElement): """ Internal method to allow for splitting of paragraphs """ - self._plaintext = plaintext + if not isinstance(plaintext, UNITYPE): + self._plaintext = conv_to_unicode(plaintext, 'utf-8') + else: + self._plaintext = plaintext def __set_attrlist(self, attrlist): """