[Geany-Devel] Python question

Pavel Roschin roshin at xxxxx
Fri Apr 25 17:18:01 UTC 2014

> On 14-04-24 09:44 PM, Pavel Roschin wrote:
> > I'm played with GeanyPy plugin and faced with a problem.
> >
> > Here is the source code I created to get current document from sidebar:
> >
> > 	def press(self, widget, event, data=None):
> > 		if event.button != 2:
> > 			return
> > 		mod, it = widget.get_selection().get_selected()
> > 		doc = mod.get(it, 2)[0]
> >
> > According to sidebar.c, mod.get(it, 2) should return pointer to Document.
> >
> This isn't supported/recommended to do in either Geany plugin API or 
> GeanyPy, but see below.

But how can I do this in native way? I just want to implement simplest feature I
proposed in PR #172 which seems will take forever to accept.

> If you really want to, maybe try to call the C function 
> `Document_create_new_from_geany_document()` (in 
> src/geanypy-document.[ch]) which is used by GeanyPy internally, but 
> should be callable somehow from Python.

How can I call this function? I could try to use ctypes to load library but
I didn't find native way to get full path to geanypy library.

Currently I close file by path but it doesn't work for symlinks:


Best regards,
Pavel Roschin aka RPG

More information about the Devel mailing list