2005-06-22 11:20:32 -07:00
|
|
|
%%
|
|
|
|
headers
|
|
|
|
#include <Python.h>
|
|
|
|
#define NO_IMPORT_PYGOBJECT
|
|
|
|
#include "pygobject.h"
|
2005-11-05 07:32:04 -08:00
|
|
|
#include "mooedit/mooeditor.h"
|
|
|
|
#include "mooedit/mooeditsearch.h"
|
|
|
|
#include "mooedit/mootextbuffer.h"
|
|
|
|
#include "mooedit/moocmdview.h"
|
2005-11-05 20:49:00 -08:00
|
|
|
#include "mooedit/mootextiter.h"
|
|
|
|
#include "moopython/mooplugin-python.h"
|
|
|
|
#include "mooutils/mooutils-python.h"
|
2005-11-06 19:19:25 -08:00
|
|
|
#include "moopython/moo-pygtk.h"
|
|
|
|
|
2005-07-30 23:20:59 -07:00
|
|
|
|
2005-06-22 11:20:32 -07:00
|
|
|
%%
|
2005-11-06 19:19:25 -08:00
|
|
|
modulename _moo_edit
|
2005-06-22 11:20:32 -07:00
|
|
|
%%
|
|
|
|
import gtk.Widget as PyGtkWidget_Type
|
|
|
|
import gtk.TextView as PyGtkTextView_Type
|
|
|
|
import gtk.TextBuffer as PyGtkTextBuffer_Type
|
|
|
|
import gtk.TextTagTable as PyGtkTextTagTable_Type
|
2005-10-13 07:08:18 -07:00
|
|
|
import gtk.TextTag as PyGtkTextTag_Type
|
2005-06-22 11:20:32 -07:00
|
|
|
import gtk.gdk.Pixbuf as PyGdkPixbuf_Type
|
|
|
|
import gobject.GObject as PyGObject_Type
|
2005-11-06 19:19:25 -08:00
|
|
|
import _moo_utils.Window as PyMooWindow_Type
|
|
|
|
import _moo_utils.UIXML as PyMooUIXML_Type
|
2005-06-22 11:20:32 -07:00
|
|
|
%%
|
|
|
|
ignore-glob
|
|
|
|
*_get_type
|
|
|
|
%%
|
2005-11-05 20:49:00 -08:00
|
|
|
override moo_python_plugin_hook varargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_moo_python_plugin_hook (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|
|
|
{
|
|
|
|
PyObject *event, *callback;
|
|
|
|
PyObject *data = NULL;
|
|
|
|
PyObject *result;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
len = PyTuple_GET_SIZE (args);
|
|
|
|
|
|
|
|
if (len < 2)
|
|
|
|
return_TypeErr ("at least two arguments required");
|
|
|
|
|
|
|
|
event = PyTuple_GET_ITEM (args, 0);
|
|
|
|
|
|
|
|
if (!PyString_Check (event))
|
|
|
|
return_TypeErr ("event must be a string");
|
|
|
|
|
|
|
|
callback = PyTuple_GET_ITEM (args, 1);
|
|
|
|
|
|
|
|
if (!PyCallable_Check (callback))
|
|
|
|
return_TypeErr ("callback must be a callable");
|
|
|
|
|
|
|
|
if (len > 2)
|
|
|
|
data = PyTuple_GetSlice (args, 2, len);
|
|
|
|
|
|
|
|
result = _moo_python_plugin_hook (PyString_AS_STRING (event),
|
|
|
|
callback, data);
|
|
|
|
Py_XDECREF (data);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2005-11-06 04:26:19 -08:00
|
|
|
%%
|
|
|
|
override moo_python_plugin_register varargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_moo_python_plugin_register (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|
|
|
{
|
|
|
|
PyObject *plugin_type, *win_plugin_type = NULL, *doc_plugin_type = NULL;
|
|
|
|
|
2005-11-06 19:19:25 -08:00
|
|
|
if (!PyArg_ParseTuple (args, (char*) "O|OO:plugin_register", &plugin_type,
|
|
|
|
&win_plugin_type, &doc_plugin_type))
|
2005-11-06 04:26:19 -08:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (!PyType_Check (plugin_type))
|
|
|
|
return_TypeErr ("argument must be a type");
|
|
|
|
|
|
|
|
if (win_plugin_type && !PyType_Check (win_plugin_type))
|
|
|
|
return_TypeErr ("argument must be a type");
|
|
|
|
|
|
|
|
if (doc_plugin_type && !PyType_Check (doc_plugin_type))
|
|
|
|
return_TypeErr ("argument must be a type");
|
|
|
|
|
2005-11-06 19:19:25 -08:00
|
|
|
return _moo_python_plugin_register (plugin_type, win_plugin_type, doc_plugin_type);
|
2005-11-06 04:26:19 -08:00
|
|
|
}
|