[Geany-devel] Keybindings for GeanyPy

Matthew Brush mbrush at xxxxx
Sat Aug 6 06:09:17 UTC 2011

On 08/05/11 23:01, Lex Trotman wrote:
> On 6 August 2011 15:05, Matthew Brush<mbrush at codebrainz.ca>  wrote:
>> On 08/05/11 21:32, Lex Trotman wrote:
>>> BTW what are the restrictions on what Python can be used when Geany
>>> calls a Python callback, I guess everything has to be a function that
>>> runs to completion.  Can it be a closure, can it use yield, can it use
>>> threads, can it do async I/O so as not to block Geany?
>> More or less anything Python itself supports, including Global Interpreter
>> Lock [1].  GeanyPy pretty much only the Python X.X interpreter, and
>> pre-loades the Geany Python package (written in C) which glues Geany's C API
>> to Python's C API.
> Ok, so my Python plugin can start an I/O bound thread in its
> plugin_init routine and have that thread call a Geany function like
> updating the status bar when the I/O completes?
> Be very careful, both answers are wrong ;-)

In as much as Python and PyGTK/PyGObject can do this (ie. using GIO and 
friends, like Geany itself, or the threading module from Python). 
Geany's GMainLoop is the main loop for Python as well as well, and 
there's no extra restrictions, AFAIK, on what can be done, beyond those 
of Python/PyGTK.

> And from your next post:
>> I forgot to mention, for callbacks, I was thinking of using PyGTK/Gobject-introspection on the GeanyObject which has all the signals on it (IIR).  So plugins would do:
>>    geany.object.connect('document-open', on_document_open_handler)
> Does that allow on_document_open_handler() to be a bound member function?

Using PyGTK, it will be a GCallback from GLib/GObject plus some extra 
Python cruft.

Matthew Brush

More information about the Devel mailing list