Fork me on GitHub

GeanyPy

Write plugins in Python!

GeanyPy is a set of Python C extensions which wrap Geany's regular C plugin API. It allows writing custom Geany plugins in the Python language and interact with Geany's exposed plugin API.

Here's the HelloWorld example plugin from Geany's Plugin HowTo using GeanyPy:

import gtk
import geany

class HelloWorld(geany.Plugin):

    __plugin_name__ = "HelloWorld"
    __plugin_version__ = "1.0"
    __plugin_description__ = "Just another tool to say hello world"
    __plugin_author__ = "John Doe (john.doe@example.org)"

    def __init__(self):
        self.menu_item = gtk.MenuItem("Hello World")
        self.menu_item.show()
        geany.main_widgets.tools_menu.append(self.menu_item)
        self.menu_item.connect("activate", self.on_hello_item_clicked)

    def cleanup(self):
        self.menu_item.destroy()

    def on_hello_item_clicked(widget, data):
        geany.dialogs.show_msgbox("Hello World")

For more information, see the README file.

Documentation

GeanyPy's documentation although incomplete, can be found here:
http://readthedocs.org/docs/geanypy/en/latest/

Geany's plugin API documentation is also very useful:
http://www.geany.org/manual/reference/

Dependencies

To build GeanyPy you need the following dependencies:

See Geany's manual for information on compiling it from the Subversion or Git repositories.

If you're using a Debian-based distro, you can probably use the following command to install the dependencies (except for Geany 0.21 currently):


$ apt-get install python python-dev python-gtk2 python-gtk2-dev


Download

You can download this project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://github.com/codebrainz/geanypy

Install

First you need to know where Geany is installed:

$ GEANY_PREFIX=`pkg-config --variable=prefix geany`
The you can install as normal:
$ ./autogen.sh
$ ./configure --prefix=$GEANY_PREFIX
$ make
# make install
You should be able to force a specific version of Python to be used, by using the PYTHON_VERSION environment variable, but I've only tested with 2.6.6 so far. I imagine 2.7 series will also work fine.

License

GPLv2

Authors

Matthew Brush (codebrainz [at] codebrainz [dot] ca)
Colomban Wendling (ban [at] herbesfolles [dot] org)

Contact

Matthew Brush (codebrainz [at] codebrainz [dot] ca)