108 lines
3.0 KiB
Plaintext
108 lines
3.0 KiB
Plaintext
%%
|
|
headers
|
|
#include <Python.h>
|
|
#define NO_IMPORT_PYGOBJECT
|
|
#include "pygobject.h"
|
|
#include "pygtk/pygtk.h"
|
|
#include "mooterm/mooterm.h"
|
|
#include "mooterm/mootermwindow.h"
|
|
#include "mooterm/mooterm-text.h"
|
|
#include "mooutils/mooutils-python.h"
|
|
#include "moopython/moo-pygtk.h"
|
|
|
|
|
|
static GdkAtom
|
|
atom_from_pyobject(PyObject *object)
|
|
{
|
|
if (object == NULL)
|
|
return NULL;
|
|
if (PyString_Check(object))
|
|
return gdk_atom_intern(PyString_AsString(object), FALSE);
|
|
if (PyGdkAtom_Check(object))
|
|
return PyGdkAtom_Get(object);
|
|
PyErr_SetString(PyExc_TypeError, "unable to convert argument to GdkAtom");
|
|
return NULL;
|
|
}
|
|
|
|
|
|
%%
|
|
modulename _moo_term
|
|
%%
|
|
import gtk.Widget as PyGtkWidget_Type
|
|
import gtk.Adjustment as PyGtkAdjustment_Type
|
|
import gobject.GObject as PyGObject_Type
|
|
import _moo_utils.Window as PyMooWindow_Type
|
|
%%
|
|
ignore-glob
|
|
*_get_type
|
|
%%
|
|
override moo_term_new kwargs
|
|
static int
|
|
_wrap_moo_term_new (PyGObject *self, PyObject *args, PyObject *kwargs)
|
|
{
|
|
static char *kwlist[] = {NULL};
|
|
|
|
if (!PyArg_ParseTupleAndKeywords (args, kwargs, ":Term", kwlist))
|
|
return -1;
|
|
|
|
self->obj = g_object_new (MOO_TYPE_TERM, NULL);
|
|
pygobject_register_wrapper ((PyObject*)self);
|
|
|
|
return 0;
|
|
}
|
|
%%
|
|
override moo_term_fork_command_line kwargs
|
|
static PyObject *
|
|
_wrap_moo_term_fork_command_line (PyGObject *self, PyObject *args, PyObject *kwargs)
|
|
{
|
|
static char *kwlist[] = {(char*) "cmd", (char*) "working_dir", NULL};
|
|
const char *cmd = NULL;
|
|
const char *working_dir = NULL;
|
|
gboolean result;
|
|
|
|
if (!PyArg_ParseTupleAndKeywords (args, kwargs, (char*) "s|s:Term.fork_command",
|
|
kwlist, &cmd, &working_dir))
|
|
return NULL;
|
|
|
|
result = moo_term_fork_command_line (MOO_TERM (self->obj), cmd,
|
|
working_dir, NULL, NULL);
|
|
|
|
return_Bool (result);
|
|
}
|
|
%%
|
|
override moo_term_copy_clipboard kwargs
|
|
static PyObject *
|
|
_wrap_moo_term_copy_clipboard (PyGObject *self, PyObject *args, PyObject *kwargs)
|
|
{
|
|
static char *kwlist[] = { (char*) "selection", NULL };
|
|
PyObject *py_selection = NULL;
|
|
GdkAtom selection;
|
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char*) "O:MooTerm.copy_clipboard", kwlist, &py_selection))
|
|
return NULL;
|
|
selection = atom_from_pyobject(py_selection);
|
|
if (PyErr_Occurred())
|
|
return NULL;
|
|
moo_term_copy_clipboard(MOO_TERM(self->obj), selection);
|
|
Py_INCREF(Py_None);
|
|
return Py_None;
|
|
}
|
|
%%
|
|
override moo_term_paste_clipboard kwargs
|
|
static PyObject *
|
|
_wrap_moo_term_paste_clipboard(PyGObject *self, PyObject *args, PyObject *kwargs)
|
|
{
|
|
static char *kwlist[] = { (char*) "selection", NULL };
|
|
PyObject *py_selection = NULL;
|
|
GdkAtom selection;
|
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char*) "O:MooTerm.paste_clipboard", kwlist, &py_selection))
|
|
return NULL;
|
|
selection = atom_from_pyobject(py_selection);
|
|
if (PyErr_Occurred())
|
|
return NULL;
|
|
moo_term_paste_clipboard(MOO_TERM(self->obj), selection);
|
|
Py_INCREF(Py_None);
|
|
return Py_None;
|
|
}
|