Re: [gedit-list] how to code shortcuts in plugins?



Hi John,

If you followed the howto on lgo, then you probably have something like
this in your code to create an action for your menu:

-- From lgo tutorial
self._action_group.add_actions([("ExamplePy", None, _("Clear document"),
                                 None, _("Clear the document"),
                                 self.on_clear_document_activate)])

The second None in this code snippet is the accelerator (shortcut key) 
by which the action can be activated. You can supply something like "<Control>h"
in there (see gtk_accelerator_parse).

To add something to the right-click menu, you can use the 'populate-popup' signal
of the gedit.Document. You need to connect to this signal for every document (mind, you
then also need to watch the window to correctly add/remove the signal when a tab goes
away).


Jesse

Op zaterdag 07-06-2008 om 15:04 uur [tijdzone -0700], schreef JJ:
> Hello.  I just wrote my first (small) plugin for
> gedit, and would like to know how to either add a
> keyboard shortcut for the menu item or even better,
> add a mouse right-click menu item for the plugin.  Can
> anyone offer some (simple) example code or
> suggestions?
> 
> I used the python plugin template when writing the
> code.
> John
> 
> 
> 
>       
> _______________________________________________
> gedit-list mailing list
> gedit-list gnome org
> http://mail.gnome.org/mailman/listinfo/gedit-list
> 
-- 
Jesse van den Kieboom

Personal: http://www.icecrew.nl
Professional: http://www.novowork.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]