Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
graph-tool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiago Peixoto
graph-tool
Commits
1570ae2f
Commit
1570ae2f
authored
Apr 20, 2018
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem with recent pycairo
parent
17802dd9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
4 deletions
+46
-4
Makefile.am
src/graph/draw/Makefile.am
+15
-0
pycairo_aux.cc
src/graph/draw/pycairo_aux.cc
+27
-0
cairo_draw.py
src/graph_tool/draw/cairo_draw.py
+4
-4
No files found.
src/graph/draw/Makefile.am
View file @
1570ae2f
...
...
@@ -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
=
src/graph/draw/pycairo_aux.cc
0 → 100644
View file @
1570ae2f
// 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
);
}
src/graph_tool/draw/cairo_draw.py
View file @
1570ae2f
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment