Bug 7258: Work around bug in Py2Cairo 1.8.10 and earlier on Linux
(cherry picked from commit 117fbe2810d8bf28919315ec978bd1cde366bd61)
This commit is contained in:
parent
f6be31eb39
commit
081675c4bc
@ -28,8 +28,6 @@
|
|||||||
# Python modules
|
# Python modules
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
|
||||||
_ = glocale.translation.gettext
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
@ -40,7 +38,9 @@ import sys
|
|||||||
import gramps.plugins.lib.libcairodoc as libcairodoc
|
import gramps.plugins.lib.libcairodoc as libcairodoc
|
||||||
from gramps.gen.plug.docgen import INDEX_TYPE_ALP, INDEX_TYPE_TOC
|
from gramps.gen.plug.docgen import INDEX_TYPE_ALP, INDEX_TYPE_TOC
|
||||||
from gramps.gen.errors import ReportError
|
from gramps.gen.errors import ReportError
|
||||||
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
|
_ = glocale.translation.gettext
|
||||||
|
from gramps.gen.constfunc import lin
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Set up logging
|
# Set up logging
|
||||||
@ -94,6 +94,10 @@ class CairoDocgen(libcairodoc.CairoDoc):
|
|||||||
|
|
||||||
# create cairo context and pango layout
|
# create cairo context and pango layout
|
||||||
filename = self._backend.filename
|
filename = self._backend.filename
|
||||||
|
# Work around a bug in pycairo 1.8.10 and earlier. OSX and
|
||||||
|
# Win32 AIOs use pycairo 1.10.0, in which the bug is fixed.
|
||||||
|
if (sys.version_info[0] < 3 and lin()):
|
||||||
|
filename = filename.encode(glocale.getfilesystemencoding())
|
||||||
try:
|
try:
|
||||||
surface = self.create_cairo_surface(filename, paper_width, paper_height)
|
surface = self.create_cairo_surface(filename, paper_width, paper_height)
|
||||||
except IOError as msg:
|
except IOError as msg:
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from __future__ import unicode_literals, division
|
from __future__ import unicode_literals, division
|
||||||
|
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
|
||||||
_ = glocale.translation.sgettext
|
|
||||||
from cgi import escape
|
from cgi import escape
|
||||||
import math
|
import math
|
||||||
import sys
|
import sys
|
||||||
@ -75,7 +73,9 @@ from gramps.gen.const import CUSTOM_FILTERS
|
|||||||
from gramps.gen.constfunc import is_quartz, win
|
from gramps.gen.constfunc import is_quartz, win
|
||||||
from gramps.gui.dialog import RunDatabaseRepair, ErrorDialog
|
from gramps.gui.dialog import RunDatabaseRepair, ErrorDialog
|
||||||
from gramps.gui.utils import color_graph_box, hex_to_rgb_float, is_right_click
|
from gramps.gui.utils import color_graph_box, hex_to_rgb_float, is_right_click
|
||||||
from gramps.gen.constfunc import STRTYPE
|
from gramps.gen.constfunc import STRTYPE, lin
|
||||||
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
|
_ = glocale.translation.sgettext
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -207,6 +207,10 @@ class PersonBoxWidgetCairo(_PersonWidgetBase):
|
|||||||
if image:
|
if image:
|
||||||
image_path = self.get_image(dbstate, person)
|
image_path = self.get_image(dbstate, person)
|
||||||
if image_path and os.path.exists(image_path):
|
if image_path and os.path.exists(image_path):
|
||||||
|
# Work around a bug in pycairo 1.8.10 and earlier. OSX and
|
||||||
|
# Win32 AIOs use pycairo 1.10.0, in which the bug is fixed.
|
||||||
|
if (sys.version_info[0] < 3 and lin()):
|
||||||
|
image_path = image_path.encode(glocale.getfilesystemencoding())
|
||||||
self.img_surf = cairo.ImageSurface.create_from_png(image_path)
|
self.img_surf = cairo.ImageSurface.create_from_png(image_path)
|
||||||
|
|
||||||
# enable mouse-over
|
# enable mouse-over
|
||||||
|
Loading…
x
Reference in New Issue
Block a user