Commit 1570ae2f authored by Tiago Peixoto's avatar Tiago Peixoto

Fix problem with recent pycairo

parent 17802dd9
......@@ -19,3 +19,18 @@ libgraph_tool_draw_la_SOURCES = \
graph_tree_cts.cc
libgraph_tool_draw_la_include_HEADERS =
gt_pycairo_auxdir = $(MOD_DIR)/draw
gt_pycairo_aux_LTLIBRARIES = gt_pycairo_aux.la
gt_pycairo_aux_la_includedir = $(MOD_DIR)/include/draw
gt_pycairo_aux_la_LIBADD = $(MOD_LIBADD)
gt_pycairo_aux_la_LDFLAGS = $(MOD_LDFLAGS) $(CAIROMM_LIBS)
gt_pycairo_aux_la_SOURCES = \
pycairo_aux.cc
gt_pycairo_aux_la_include_HEADERS =
// graph-tool -- a general graph modification and manipulation thingy
//
// Copyright (C) 2006-2018 Tiago de Paula Peixoto <tiago@skewed.de>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "graph.hh"
#include PYCAIRO_HEADER
extern "C"
PyObject* gt_PycairoContext_FromContext(cairo_t *ctx, PyTypeObject *type,
PyObject *base)
{
return PycairoContext_FromContext(ctx, type, base);
}
......@@ -2173,9 +2173,9 @@ def get_bip_hierachy_pos(state, aspect=1., node_weight=None):
try:
import cairocffi
import ctypes
pycairo = ctypes.PyDLL(cairo._cairo.__file__)
pycairo.PycairoContext_FromContext.restype = ctypes.c_void_p
pycairo.PycairoContext_FromContext.argtypes = 3 * [ctypes.c_void_p]
pycairo_aux = ctypes.PyDLL(os.path.dirname(os.path.abspath(__file__)) + "/gt_pycairo_aux.so")
pycairo_aux.gt_PycairoContext_FromContext.restype = ctypes.c_void_p
pycairo_aux.gt_PycairoContext_FromContext.argtypes = 3 * [ctypes.c_void_p]
ctypes.pythonapi.PyList_Append.argtypes = 2 * [ctypes.c_void_p]
except ImportError:
pass
......@@ -2192,7 +2192,7 @@ def _UNSAFE_cairocffi_context_to_pycairo(cairocffi_context):
# gets the context’s integer address.
# On CPython id(cairo.Context) gives the address to the Context type,
# as expected by PycairoContext_FromContext.
address = pycairo.PycairoContext_FromContext(
address = pycairo_aux.gt_PycairoContext_FromContext(
int(cairocffi.ffi.cast('uintptr_t', cairocffi_context._pointer)),
id(cairo.Context),
None)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment