Opened 11 years ago
Closed 11 years ago
#43423 closed enhancement (fixed)
Add gtk variant to py-graph-tool
Reported by: | count0 (Tiago de Paula Peixoto) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.2.1 |
Keywords: | maintainer | Cc: | mamoll (Mark Moll) |
Port: | py-graph-tool |
Description
It would be nice to have a variant which installs gtk+ 3 in case users want interactive visualization. The variant would be useful, since the library librsvg would also needed to be installed, which is not triggered simply by installing gtk, and is nonintuitive for most users.
Attachments (1)
Change History (10)
comment:1 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)
Keywords: | maintainer added |
---|
comment:2 Changed 11 years ago by mamoll (Mark Moll)
Is it just a matter of adding the gtk3 and librsvg ports as dependencies? Maybe those should be included by default, since some of the sample graph-tool code probably uses it. Users might be surprised if demo code doesn't work. I have librsvg installed (but not gtk3) and never realized it was needed for graph-tool.
comment:3 Changed 11 years ago by count0 (Tiago de Paula Peixoto)
I agree it would be a good idea to enable it by default, but making it a variant would give the user the option of installing without pulling in the whole X/GTK dependency tree, at the expense of not being able to do interactive drawing.
Without librsvg GTK+ cannot load SVG icons/images. I made use of some SVG icons in graph-tool, since I assumed GTK+ would always depend on librsvg...
comment:4 Changed 11 years ago by mamoll (Mark Moll)
I installed py-graph-tool with a gtk variant. I tried to run the demo shown here: https://graph-tool.skewed.de/static/doc/demos/animation.html. I get errors like the one shown here:
Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/graph_tool/draw/gtk_draw.py", line 424, in draw lr = self.pos_to_device((self.base.get_width(), AttributeError: 'cairo.Surface' object has no attribute 'get_width'
According to http://cairographics.org/documentation/pycairo/2/reference/surfaces.html#cairo.Surface this is correct. I should mention that I have the Quartz variant of gtk3 installed (a more OS X native backend than the default X11-based one). Is there another way to do this? If I remove the get_width() and get_height() calls, the demo appears to work, but obviously window resizing doesn't work (which, I guess, is still better than a fatal error).
comment:5 Changed 11 years ago by count0 (Tiago de Paula Peixoto)
It expects a XlibSurface, which has the necessary attributes:
http://cairographics.org/documentation/pycairo/3/reference/surfaces.html#class-xlibsurface-surface
I guess with Quartz Gtk returns a different surface. Could you see what object is returned by self.get_window()
in line 391 of gtk_draw.py
?
comment:6 Changed 11 years ago by count0 (Tiago de Paula Peixoto)
Well, nevermind the actual surface which is returned, there is a simpler fix for that... Pleas apply the patch attached, and see if any issues remain.
Changed 11 years ago by count0 (Tiago de Paula Peixoto)
Attachment: | surface-geometry.patch added |
---|
Tentative patch for issue with cairo surface geometry
comment:7 Changed 11 years ago by mamoll (Mark Moll)
That works for me. This warning is shown repeatedly (with or without patch), but that could be a bug in the quartz version of gtk3 and/or [py]cairo:
(foo.py:33533): Gdk-CRITICAL **: gdk_cairo_region: assertion 'region != NULL' failed
I'll commit the gtk3 variant and your patch.
comment:8 Changed 11 years ago by count0 (Tiago de Paula Peixoto)
Ok, I'll commit the patch to git, so it will not be necessary in the next release.
That warning is internal to GTK, so there is nothing to be done, except complain to them. Most of such warnings are inconsequential, in any case.
Thanks for the new Portfile!
comment:9 Changed 11 years ago by mamoll (Mark Moll)
Resolution: | → fixed |
---|---|
Status: | new → closed |
Committed in r119269.
Since you're the maintainer of the port, feel free to attach a patch to make this change, and we can review and commit it.