From 806e81ed7a21d1dd02da310705eb03d45c4edc7b Mon Sep 17 00:00:00 2001 From: Simon D Fink Date: Thu, 18 Jul 2024 15:57:28 +0200 Subject: [PATCH] bugfixes --- .bumpversion.cfg | 2 +- src/ogdf_python/matplotlib/util.py | 7 ++++++- src/ogdf_python/matplotlib/widget.py | 2 +- src/ogdf_python/pythonize/render.py | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index e0ff384..7e4cec4 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -9,7 +9,7 @@ serialize = [bumpversion:file:pyproject.toml] -[bumpversion:file:docs/conf.py] +# [bumpversion:file:docs/conf.py] [bumpversion:file:src/ogdf_python/__init__.py] diff --git a/src/ogdf_python/matplotlib/util.py b/src/ogdf_python/matplotlib/util.py index 482834b..5d0f795 100644 --- a/src/ogdf_python/matplotlib/util.py +++ b/src/ogdf_python/matplotlib/util.py @@ -20,7 +20,10 @@ def color(c): - return str(c.toString()) + if c.alpha() == 255: + return str(c.toString()) + else: + return str(c.toString()), c.alpha() / 255 def fillPattern(fp): @@ -72,6 +75,8 @@ def strokeType(st): return "dashdot", elif st == ogdf.StrokeType.Dashdotdot: return (0, (3, 5, 1, 5, 1, 5)), + elif st == getattr(ogdf.StrokeType, "None"): + return (0, (0, 10)), else: warnings.warn(f"Unknown StrokeType {st!r}") return "" diff --git a/src/ogdf_python/matplotlib/widget.py b/src/ogdf_python/matplotlib/widget.py index 9c98376..65a283e 100644 --- a/src/ogdf_python/matplotlib/widget.py +++ b/src/ogdf_python/matplotlib/widget.py @@ -374,7 +374,7 @@ def remove_edge(self, e): coll = self.style_edges[style] assert coll.elems[idx] == e chgd = coll.remove_elem(idx) - if chgd: + if chgd is not None: self.edge_styles[chgd] = (style, idx) assert coll.elems[idx] == chgd elif not coll.paths: diff --git a/src/ogdf_python/pythonize/render.py b/src/ogdf_python/pythonize/render.py index b08e327..e085956 100644 --- a/src/ogdf_python/pythonize/render.py +++ b/src/ogdf_python/pythonize/render.py @@ -70,10 +70,10 @@ def wrapper(*args, **kwargs): def renderGraph(G): - cppyy.include("ogdf/planarity/PlanarizationGridLayout.h") + cppyy.include("ogdf/planarity/PlanarizationLayout.h") ogdf = cppyy.gbl.ogdf GA = ogdf.GraphAttributes(G, ogdf.GraphAttributes.all) - ogdf.PlanarizationGridLayout().call(GA) + ogdf.PlanarizationLayout().call(GA) for n in G.nodes: GA.label[n] = str(n.index()) return GA