[Geany-devel] Keybindings for GeanyPy

Lex Trotman elextr at xxxxx
Fri Aug 5 03:29:04 UTC 2011

On 5 August 2011 13:01, Matthew Brush <mbrush at codebrainz.ca> wrote:
> Hi,
> I'm seeking ideas/advice for how I can implement keybindings for Python
> plugins[1].  Since `geany_plugin` will be the same for all Python plugins, I
> don't think I could use the regular way.  I wouldn't want every Python
> plugin's keybindings showing up under the same 'GeanyPy' group.
> 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.

> I'm at the design state right now, so if anyone has any ideas for how I
> should implement this, using either Geany's plugin API, PyGTK directly, or
> something else I don't know about, I'd much appreciate hearing them.
> I'm kinda at a loss here.

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).

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).


More information about the Devel mailing list