[Geany-devel] Keybindings for GeanyPy
mbrush at xxxxx
Sat Aug 6 02:50:17 UTC 2011
On 08/04/11 20:29, Lex Trotman wrote:
> On 5 August 2011 13:01, Matthew Brush<mbrush at codebrainz.ca> wrote:
>> I tried with a gtk.AccelGroup() on the geany.main_widgets.window from
>> Python/PyGTK, but Geany seems to block most keybindings doing it that way.
>> I really don't know much about this either.
> Since Geany catches all keyevents you probably have to use Geany
> facilities since there is no way of attaching to the signal before
> Geany does.
Well, no *proper* way :)
> That would be because Geany doesn't have any way of handling
> sub-plugins so you can't do what you want to do.
> What might be better would be for Geany to allow new plugins to be
> registered at runtime and without loading another module. Then your
> python wrapper can possibly register the python scripts as plugins but
> with itself as the callback point. So the scripts would look like
> plugins and could use normal keybinding support.
> This would need extension of plugins.h/c and of course Someone Has To
> Do It (tm).
Yep, pretty much, and this is getting deep into LibPeas territory.
> Otherwise the only method would be to load a new copy of your wrapper
> and the python interpretor for each script you wanted to use. (Yuk,
> but might be the only way at the moment).
In *theory* it might not be so bad, since there's a function
Py_IsInitialized() that could check to make sure if a Python interpreter
has been started, rather than starting a new one. Since it's all in
Geany's (the same) process, this *should* work - without having seperate
instances of the Python interperter and the geany python modules for
each sub-plugin. But still, each script would needs it's own
(boiler-plate) loader C file/.so/.dll in order to be detected by Geany,
which does feel a little wrong.
More information about the Devel