Python stuff for MooTerm
parent
fae94b5226
commit
51c94529d3
|
@ -14,24 +14,29 @@ subdirs =
|
||||||
noinst_LTLIBRARIES = libmoo.la
|
noinst_LTLIBRARIES = libmoo.la
|
||||||
libmoo_la_LIBADD =
|
libmoo_la_LIBADD =
|
||||||
libmoo_la_SOURCES = dummy.c
|
libmoo_la_SOURCES = dummy.c
|
||||||
|
moo_pygtk_flags =
|
||||||
|
|
||||||
if BUILD_MOOUTILS
|
if BUILD_MOOUTILS
|
||||||
subdirs += mooutils
|
subdirs += mooutils
|
||||||
libmoo_la_LIBADD += mooutils/libmooutils.la
|
libmoo_la_LIBADD += mooutils/libmooutils.la
|
||||||
|
moo_pygtk_flags += -DBUILD_MOOUTILS
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_MOOUI
|
if BUILD_MOOUI
|
||||||
subdirs += mooui
|
subdirs += mooui
|
||||||
|
moo_pygtk_flags += -DBUILD_MOOUI
|
||||||
libmoo_la_LIBADD += mooui/libmooui.la
|
libmoo_la_LIBADD += mooui/libmooui.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_MOOEDIT
|
if BUILD_MOOEDIT
|
||||||
subdirs += mooedit
|
subdirs += mooedit
|
||||||
|
moo_pygtk_flags += -DBUILD_MOOEDIT
|
||||||
libmoo_la_LIBADD += mooedit/libmooedit.la
|
libmoo_la_LIBADD += mooedit/libmooedit.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_MOOTERM
|
if BUILD_MOOTERM
|
||||||
subdirs += mooterm
|
subdirs += mooterm
|
||||||
|
moo_pygtk_flags += -DBUILD_MOOTERM
|
||||||
if !CYGWIN_BUILD
|
if !CYGWIN_BUILD
|
||||||
libmoo_la_LIBADD += mooterm/libmooterm.la
|
libmoo_la_LIBADD += mooterm/libmooterm.la
|
||||||
endif !CYGWIN_BUILD
|
endif !CYGWIN_BUILD
|
||||||
|
@ -39,6 +44,7 @@ endif
|
||||||
|
|
||||||
if BUILD_MOOAPP
|
if BUILD_MOOAPP
|
||||||
subdirs += mooapp
|
subdirs += mooapp
|
||||||
|
moo_pygtk_flags += -DBUILD_MOOAPP
|
||||||
if !CYGWIN_BUILD
|
if !CYGWIN_BUILD
|
||||||
libmoo_la_LIBADD += mooapp/libmooapp.la
|
libmoo_la_LIBADD += mooapp/libmooapp.la
|
||||||
endif !CYGWIN_BUILD
|
endif !CYGWIN_BUILD
|
||||||
|
@ -57,7 +63,8 @@ AM_CFLAGS = \
|
||||||
-DMOO_VERSION=\"$(MOO_VERSION)\" \
|
-DMOO_VERSION=\"$(MOO_VERSION)\" \
|
||||||
-DMOO_VERSION_MAJOR=$(MOO_VERSION_MAJOR)\
|
-DMOO_VERSION_MAJOR=$(MOO_VERSION_MAJOR)\
|
||||||
-DMOO_VERSION_MINOR=$(MOO_VERSION_MINOR)\
|
-DMOO_VERSION_MINOR=$(MOO_VERSION_MINOR)\
|
||||||
-DMOO_VERSION_MICRO=$(MOO_VERSION_MICRO)
|
-DMOO_VERSION_MICRO=$(MOO_VERSION_MICRO)\
|
||||||
|
$(moo_pygtk_flags)
|
||||||
|
|
||||||
EXTRA_DIST = moo-pygtk.c
|
EXTRA_DIST = moo-pygtk.c
|
||||||
|
|
||||||
|
@ -75,7 +82,7 @@ if BUILD_PYMOO
|
||||||
|
|
||||||
pyexec_LTLIBRARIES = moo.la
|
pyexec_LTLIBRARIES = moo.la
|
||||||
|
|
||||||
moo_la_SOURCES = dummy.c moo-pygtk.c
|
moo_la_SOURCES = moo-pygtk.c
|
||||||
|
|
||||||
if MINGW_BUILD
|
if MINGW_BUILD
|
||||||
mingw_flags = -no-undefined
|
mingw_flags = -no-undefined
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
// empty file to make automake happy
|
/* empty file to make automake happy */
|
||||||
|
|
|
@ -86,8 +86,19 @@ void initmoo (void)
|
||||||
PyModule_AddObject (moo_module, (char*)"version", moo_version());
|
PyModule_AddObject (moo_module, (char*)"version", moo_version());
|
||||||
PyModule_AddObject (moo_module, (char*)"detailed_version", moo_detailed_version());
|
PyModule_AddObject (moo_module, (char*)"detailed_version", moo_detailed_version());
|
||||||
|
|
||||||
|
#ifdef BUILD_MOOUTILS
|
||||||
mod_init (moo_utils);
|
mod_init (moo_utils);
|
||||||
|
#endif
|
||||||
|
#ifdef BUILD_MOOUI
|
||||||
mod_init (moo_ui);
|
mod_init (moo_ui);
|
||||||
|
#endif
|
||||||
|
#ifdef BUILD_MOOEDIT
|
||||||
mod_init (moo_edit);
|
mod_init (moo_edit);
|
||||||
|
#endif
|
||||||
|
#ifdef BUILD_MOOTERM
|
||||||
|
mod_init (moo_term);
|
||||||
|
#endif
|
||||||
|
#ifdef BUILD_MOOAPP
|
||||||
mod_init (moo_app);
|
mod_init (moo_app);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,33 +54,47 @@ EXTRA_DIST = \
|
||||||
$(widget_unix_sources) \
|
$(widget_unix_sources) \
|
||||||
$(widget_win32_sources)
|
$(widget_win32_sources)
|
||||||
|
|
||||||
|
|
||||||
############################################################################
|
|
||||||
# UNIX
|
|
||||||
#
|
|
||||||
if UNIX_BUILD
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libmooterm.la
|
noinst_LTLIBRARIES = libmooterm.la
|
||||||
|
libmooterm_la_SOURCES =
|
||||||
|
BUILT_SOURCES =
|
||||||
|
|
||||||
libmooterm_la_SOURCES = $(widget_sources) $(widget_unix_sources)
|
|
||||||
BUILT_SOURCES = mootermparser-yacc.c mootermparser-yacc.h
|
|
||||||
|
|
||||||
|
if UNIX_BUILD
|
||||||
|
libmooterm_la_SOURCES += $(widget_sources) $(widget_unix_sources)
|
||||||
|
BUILT_SOURCES += mootermparser-yacc.c mootermparser-yacc.h
|
||||||
endif UNIX_BUILD
|
endif UNIX_BUILD
|
||||||
|
|
||||||
|
|
||||||
############################################################################
|
|
||||||
# MINGW
|
|
||||||
#
|
|
||||||
if MINGW_BUILD
|
if MINGW_BUILD
|
||||||
|
libmooterm_la_SOURCES += $(widget_sources) $(widget_win32_sources)
|
||||||
noinst_LTLIBRARIES = libmooterm.la
|
BUILT_SOURCES += mootermparser-yacc.c mootermparser-yacc.h
|
||||||
|
|
||||||
libmooterm_la_SOURCES = $(widget_sources) $(widget_win32_sources)
|
|
||||||
BUILT_SOURCES = mootermparser-yacc.c mootermparser-yacc.h
|
|
||||||
|
|
||||||
endif MINGW_BUILD
|
endif MINGW_BUILD
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# Pygtk stuff
|
||||||
|
#
|
||||||
|
|
||||||
|
EXTRA_DIST += mooterm-mod.c mooterm-pygtk.defs mooterm-pygtk.override
|
||||||
|
|
||||||
|
if USE_PYGTK
|
||||||
|
libmooterm_la_SOURCES += mooterm-mod.c
|
||||||
|
|
||||||
|
nodist_libmooterm_la_SOURCES = mooterm-pygtk.c
|
||||||
|
BUILT_SOURCES += mooterm-pygtk.c
|
||||||
|
CLEANFILES = mooterm-pygtk.c
|
||||||
|
|
||||||
|
mooterm-pygtk.c: $(srcdir)/mooterm-pygtk.defs $(srcdir)/mooterm-pygtk.override
|
||||||
|
pygtk-codegen-2.0 --prefix moo_term \
|
||||||
|
--register $(PYGTK_DEFS_DIR)/gtk-types.defs \
|
||||||
|
--register $(PYGTK_DEFS_DIR)/gdk-types.defs \
|
||||||
|
--register $(srcdir)/../mooui/mooui-pygtk.defs \
|
||||||
|
--override $(srcdir)/mooterm-pygtk.override \
|
||||||
|
$(srcdir)/mooterm-pygtk.defs > mooterm-pygtk.c
|
||||||
|
|
||||||
|
endif USE_PYGTK
|
||||||
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
# CYGWIN
|
# CYGWIN
|
||||||
#
|
#
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* mooterm/mooterm-mod.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* See COPYING file that comes with this distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Python.h>
|
||||||
|
#define NO_IMPORT_PYGOBJECT
|
||||||
|
#include <pygobject.h>
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
|
||||||
|
void moo_term_mod_init (PyObject *moo_mod);
|
||||||
|
void moo_term_register_classes (PyObject *dict);
|
||||||
|
void moo_term_add_constants (PyObject *module,
|
||||||
|
const gchar *strip_prefix);
|
||||||
|
|
||||||
|
|
||||||
|
extern PyMethodDef moo_term_functions[];
|
||||||
|
|
||||||
|
static char *moo_term_module_doc = (char*)"moo.term module.";
|
||||||
|
|
||||||
|
|
||||||
|
void moo_term_mod_init (PyObject *moo_mod)
|
||||||
|
{
|
||||||
|
PyObject *mod;
|
||||||
|
|
||||||
|
mod = Py_InitModule3 ("moo.term", moo_term_functions, moo_term_module_doc);
|
||||||
|
g_return_if_fail (mod != NULL);
|
||||||
|
Py_INCREF (mod);
|
||||||
|
PyModule_AddObject (moo_mod, "term", mod);
|
||||||
|
// moo_term_add_constants (mod, "MOO_");
|
||||||
|
|
||||||
|
moo_term_register_classes (PyModule_GetDict (moo_mod));
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
;;
|
||||||
|
;; mooterm/mooterm-pygtk.defs
|
||||||
|
;;
|
||||||
|
|
||||||
|
; object definitions ...
|
||||||
|
|
||||||
|
(define-object Term
|
||||||
|
(in-module "Moo")
|
||||||
|
(parent "GtkWidget")
|
||||||
|
(c-name "MooTerm")
|
||||||
|
(gtype-id "MOO_TYPE_TERM")
|
||||||
|
)
|
||||||
|
|
||||||
|
;; Enumerations and flags ...
|
||||||
|
|
||||||
|
(define-function moo_term_new
|
||||||
|
(c-name "moo_term_new")
|
||||||
|
(is-constructor-of "MooTerm")
|
||||||
|
(return-type "MooTerm*")
|
||||||
|
(parameters
|
||||||
|
'("guint" "width")
|
||||||
|
'("guint" "height")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(define-method feed
|
||||||
|
(of-object "MooTerm")
|
||||||
|
(c-name "moo_term_feed")
|
||||||
|
(return-type "none")
|
||||||
|
(parameters
|
||||||
|
'("const-gchar*" "data")
|
||||||
|
'("int" "len" (default "-1"))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(define-method feed_child
|
||||||
|
(of-object "MooTerm")
|
||||||
|
(c-name "moo_term_feed_child")
|
||||||
|
(return-type "none")
|
||||||
|
(parameters
|
||||||
|
'("const-gchar*" "data")
|
||||||
|
'("int" "len" (default "-1"))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(define-method fork_command
|
||||||
|
(of-object "MooTerm")
|
||||||
|
(c-name "moo_term_fork_command")
|
||||||
|
(return-type "gboolean")
|
||||||
|
(parameters
|
||||||
|
'("const-gchar*" "cmd")
|
||||||
|
'("const-gchar*" "working_dir" (null-ok) (default "NULL"))
|
||||||
|
'("char**" "envp" (null-ok) (default "NULL"))
|
||||||
|
)
|
||||||
|
)
|
|
@ -0,0 +1,47 @@
|
||||||
|
%%
|
||||||
|
headers
|
||||||
|
#include <Python.h>
|
||||||
|
#define NO_IMPORT_PYGOBJECT
|
||||||
|
#include "pygobject.h"
|
||||||
|
#include "mooterm/mooterm.h"
|
||||||
|
%%
|
||||||
|
modulename moo
|
||||||
|
%%
|
||||||
|
import gtk.Widget as PyGtkWidget_Type
|
||||||
|
import gobject.GObject as PyGObject_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 (self);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
%%
|
||||||
|
override moo_term_fork_command kwargs
|
||||||
|
static PyObject *
|
||||||
|
_wrap_moo_term_fork_command (PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||||
|
{
|
||||||
|
static char *kwlist[] = {"cmd", "working_dir", NULL};
|
||||||
|
const char *cmd = NULL;
|
||||||
|
const char *working_dir = NULL;
|
||||||
|
|
||||||
|
if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s|s:Term.fork_command",
|
||||||
|
kwlist, &cmd, &working_dir))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
moo_term_fork_command (MOO_TERM (self->obj), cmd, working_dir, NULL);
|
||||||
|
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
return Py_None;
|
||||||
|
}
|
|
@ -24,7 +24,7 @@
|
||||||
</ignoreparts>
|
</ignoreparts>
|
||||||
<projectdirectory>.</projectdirectory>
|
<projectdirectory>.</projectdirectory>
|
||||||
<absoluteprojectpath>false</absoluteprojectpath>
|
<absoluteprojectpath>false</absoluteprojectpath>
|
||||||
<description/>
|
<description></description>
|
||||||
<secondaryLanguages>
|
<secondaryLanguages>
|
||||||
<language>C</language>
|
<language>C</language>
|
||||||
</secondaryLanguages>
|
</secondaryLanguages>
|
||||||
|
@ -39,28 +39,28 @@
|
||||||
<mainprogram>tests/mterm</mainprogram>
|
<mainprogram>tests/mterm</mainprogram>
|
||||||
<directoryradio>executable</directoryradio>
|
<directoryradio>executable</directoryradio>
|
||||||
<customdirectory>/</customdirectory>
|
<customdirectory>/</customdirectory>
|
||||||
<programargs/>
|
<programargs> --dump-trace</programargs>
|
||||||
<terminal>false</terminal>
|
<terminal>false</terminal>
|
||||||
<autocompile>true</autocompile>
|
<autocompile>true</autocompile>
|
||||||
<envvars/>
|
<envvars/>
|
||||||
</run>
|
</run>
|
||||||
<configurations>
|
<configurations>
|
||||||
<debug>
|
<debug>
|
||||||
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --without-mooedit --without-mooapp --without-python</configargs>
|
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --without-mooedit --without-mooapp</configargs>
|
||||||
<builddir>build/mooterm-debug</builddir>
|
<builddir>build/mooterm-debug</builddir>
|
||||||
<ccompiler>kdevgccoptions</ccompiler>
|
<ccompiler>kdevgccoptions</ccompiler>
|
||||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||||
<f77compiler>kdevpgf77options</f77compiler>
|
<f77compiler>kdevg77options</f77compiler>
|
||||||
<cflags>-O0 -g3 -pg</cflags>
|
<cflags>-O0 -g3 -pg</cflags>
|
||||||
<cxxflags>-O0 -g3 -pg</cxxflags>
|
<cxxflags>-O0 -g3 -pg</cxxflags>
|
||||||
<envvars/>
|
<envvars/>
|
||||||
<topsourcedir/>
|
<topsourcedir></topsourcedir>
|
||||||
<cppflags/>
|
<cppflags></cppflags>
|
||||||
<ldflags/>
|
<ldflags></ldflags>
|
||||||
<ccompilerbinary/>
|
<ccompilerbinary></ccompilerbinary>
|
||||||
<cxxcompilerbinary/>
|
<cxxcompilerbinary></cxxcompilerbinary>
|
||||||
<f77compilerbinary/>
|
<f77compilerbinary></f77compilerbinary>
|
||||||
<f77flags/>
|
<f77flags></f77flags>
|
||||||
</debug>
|
</debug>
|
||||||
<gcc-4.0>
|
<gcc-4.0>
|
||||||
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --without-mooedit --without-mooapp --without-python</configargs>
|
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --without-mooedit --without-mooapp --without-python</configargs>
|
||||||
|
@ -167,11 +167,11 @@
|
||||||
<kdevdebugger>
|
<kdevdebugger>
|
||||||
<general>
|
<general>
|
||||||
<dbgshell>libtool</dbgshell>
|
<dbgshell>libtool</dbgshell>
|
||||||
<programargs>--g-fatal-warnings --debug bash</programargs>
|
<programargs>--set-breakpoint bash</programargs>
|
||||||
<gdbpath/>
|
<gdbpath></gdbpath>
|
||||||
<configGdbScript/>
|
<configGdbScript></configGdbScript>
|
||||||
<runShellScript/>
|
<runShellScript></runShellScript>
|
||||||
<runGdbScript/>
|
<runGdbScript></runGdbScript>
|
||||||
<breakonloadinglibs>true</breakonloadinglibs>
|
<breakonloadinglibs>true</breakonloadinglibs>
|
||||||
<separatetty>false</separatetty>
|
<separatetty>false</separatetty>
|
||||||
<floatingtoolbar>true</floatingtoolbar>
|
<floatingtoolbar>true</floatingtoolbar>
|
||||||
|
@ -272,7 +272,7 @@
|
||||||
</codecompletion>
|
</codecompletion>
|
||||||
<references/>
|
<references/>
|
||||||
<creategettersetter>
|
<creategettersetter>
|
||||||
<prefixGet/>
|
<prefixGet></prefixGet>
|
||||||
<prefixSet>set</prefixSet>
|
<prefixSet>set</prefixSet>
|
||||||
<prefixVariable>m_,_</prefixVariable>
|
<prefixVariable>m_,_</prefixVariable>
|
||||||
<parameterName>theValue</parameterName>
|
<parameterName>theValue</parameterName>
|
||||||
|
|
Loading…
Reference in New Issue