GNOME Bugzilla – Bug 146454
[feature request] python scripting for the plugin API
Last modified: 2019-03-23 20:32:46 UTC
I realize a request like thsi carries more weight when a patch is included, but I figured I'd put it out there anyways.
Could you please try to explain this RFE in a more detailed way?
From looking at the source there seems to be a specific API for creating plugins for gEdit (defined in gedit-plugin.h I believe, and perhaps gedit-menus.h), I think it would be beneficial to provide Python bindings for this API so that plugins could be written entirely in Python.
I would like to see scripting as simple as it is in emacs. With emacs, you can write a function in your .emacs and call it with 'alt-x function-name'. Perhaps the gedit plugin api is that simple to use. I wouldn't know, because I didn't find much good documentation on the subject. If it requires programming in c, it probably isn't going to be the easiest thing to use. I would be comfortable with scheme/lisp or perl, but not c.
Note that given recent discussions on desktop-devel it looks like Python is going to make it into GNOME 2.10 which would make this feature much more appealing. I'm swamped for the next two months but I might try my hand at this after that if nobody else takes up the cause.
Patch coming in the next hours
Created attachment 52024 [details] [review] gedit-python.diff First patch for python support in new_mdi
Created attachment 52025 [details] [review] gedit-python.diff Cleanup unwanted modification
Created attachment 52026 [details] gedit-python.tar.gz The added files
Is the patch for CVS HEAD? I'm getting some failures when trying to apply. (Thanks much for doing this work btw)
No it is against the new_mdi branch. http://live.gnome.org/Gedit_2fNewMdi for more info.
And there is some cruft in the tarball too, please remove the m4/intltool.m4 and gedit/pygedit/gedit.c files
Created attachment 52034 [details] [review] gedit-python.diff Fixes list return types, and the get_search_text method. Use boxed types for GeditEncoding
Created attachment 52035 [details] gedit-python.tar.gz Updated and cleaned tarball
Created attachment 52049 [details] console.gedit-plugin The plugin file for console extension
Created attachment 52050 [details] console.py The actual python extension, put the two above files in ~/.gnome2/gedit/plugins and watch the magic happen
Created attachment 52051 [details] [review] gedit-python.diff Updated with more goodness inside. Update configure check for g-p-e instead of gnome-python (gtksourceview is needed) Sparkle some ifdefs to not compile in python support when disabled Update boxed type to use release-func/copy-func
Created attachment 52052 [details] gedit-python.tar.gz Updated, see above
Created attachment 52058 [details] [review] gedit-python.diff Cleanup C-style Pass the python module path to the loader
I'd prefer to see the pygedit files in another directory. I think we should create a "bindings" sub-directory in the root directory and then put the pygedit file in the "bindings/python" directory. Rapheal: if you think your patch is ready for being committed, I will make a detailed review as soon as you will attach the patch with the required changes.
So it would look like gedit/ bindings/ python/ gedit.defs & co gedit/ gedit-python-*.[ch] Is that right ? I'll do that tomorrow i suppose we can confirm this on IRC
If with gedit-python-*.[ch] you mean the python loader, it is right.
Created attachment 52174 [details] [review] gedit-python.diff Updated patch, with the new directory structure, nothing else changed
Created attachment 52175 [details] gedit-python.tar.gz The new tarball with new structure
Created attachment 52682 [details] [review] gedit-python.diff Final version of the patch, as included in CVS.
2.13.0 is out with all its python goodness. Go wild writing plugins!