This commit is contained in:
Roberto Alsina 2024-05-31 17:16:31 -03:00
commit c4caed4368
23 changed files with 6803 additions and 0 deletions

128
Pyxform/Modules/bitmaps.c Normal file
View File

@ -0,0 +1,128 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char bmp_create__doc__[] =
"Creates a bitmap"
;
static PyObject *
bmp_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t, x, y, w, h;
char *l;
FL_OBJECT *o;
if (!PyArg_ParseTuple(args, "iiiiis", &t, &x, &y, &w, &h, &l))
return NULL;
o = fl_create_bitmap(t, x, y, w, h, l);
return Py_BuildValue("l", (long) o);
}
static char bmp_set_data__doc__[] =
"Sets the bitmap's data"
;
static PyObject *
bmp_set_data(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int w, h;
char *b;
if (!PyArg_ParseTuple(args, "liis", &o, &w, &h, &b))
return NULL;
fl_set_bitmap_data((FL_OBJECT *) o, w, h, b);
Py_INCREF(Py_None);
return Py_None;
}
static char bmp_set_file__doc__[] =
"Loads a file into a bitmap"
;
static PyObject *
bmp_set_file(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *f;
if (!PyArg_ParseTuple(args, "ls", &o, &f))
return NULL;
fl_set_bitmap_file((FL_OBJECT *) o, f);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef bmp_methods[] =
{
{"create", bmp_create, 1, bmp_create__doc__},
{"set_data", bmp_set_data, 1, bmp_set_data__doc__},
{"set_file", bmp_set_file, 1, bmp_set_file__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initbitmap) */
static char bitmaps_module_documentation[] =
""
;
void initbitmaps()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("bitmaps", bmp_methods,
bitmaps_module_documentation,
(PyObject *) NULL, PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("bitmaps.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module bitmaps");
}

86
Pyxform/Modules/box.c Normal file
View File

@ -0,0 +1,86 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char box_create__doc__[] =
"Creates a Box"
;
static PyObject *
box_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_box(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
/* List of methods defined in the module */
static struct PyMethodDef box_methods[] = {
{"create", box_create, 1, box_create__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initbox) */
static char box_module_documentation[] =
""
;
void
initbox()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("box", box_methods,
box_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("box.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module box");
}

484
Pyxform/Modules/browser.c Normal file
View File

@ -0,0 +1,484 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char browser_create__doc__[] =
"Creates a Browser"
;
static PyObject *
browser_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_browser(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char browser_add_line__doc__[] =
"Adds a line to a browser"
;
static PyObject *
browser_add_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *l;
if (!PyArg_ParseTuple(args, "ls",&o,&l))
return NULL;
fl_add_browser_line ((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_addto__doc__[] =
"Adds a line to a browser, and shifts it there"
;
static PyObject *
browser_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *l;
if (!PyArg_ParseTuple(args, "ls",&o,&l))
return NULL;
fl_addto_browser ((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_insert_line__doc__[] =
""
;
static PyObject *
browser_insert_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
char *l;
if (!PyArg_ParseTuple(args, "lis",&o,&n,&l))
return NULL;
fl_insert_browser_line ((FL_OBJECT *)o,n,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_delete_line__doc__[] =
"Deletes a line from a browser"
;
static PyObject *
browser_delete_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_delete_browser_line ((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_replace_line__doc__[] =
"Replaces a line of abrowser"
;
static PyObject *
browser_replace_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
char *l;
if (!PyArg_ParseTuple(args, "lis",&o,&n,&l))
return NULL;
fl_replace_browser_line ((FL_OBJECT *)o,n,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_get_line__doc__[] =
"Gets a browser's line"
;
static PyObject *
browser_get_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
char s[1024];
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
strcpy(s,fl_get_browser_line ((FL_OBJECT *)o,n));
return Py_BuildValue ("s",s);
}
static char browser_load__doc__[] =
"Loads a file into a browser"
;
static PyObject *
browser_load(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
int r;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
r=fl_load_browser((FL_OBJECT *)o,s);
return Py_BuildValue ("i",r);
}
static char browser_select_line__doc__[] =
"Selects a browser line"
;
static PyObject *
browser_select_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_select_browser_line ((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_deselect_line__doc__[] =
"Deselects a browser's line"
;
static PyObject *
browser_deselect_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_deselect_browser_line ((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_deselect__doc__[] =
"Deselects all lines in a browser"
;
static PyObject *
browser_deselect(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_deselect_browser ((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_isselected_line__doc__[] =
"Is that line selected in the browser?"
;
static PyObject *
browser_isselected_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n,r;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
r=fl_isselected_browser_line((FL_OBJECT *)o,n);
return Py_BuildValue ("i",r);
}
static char browser_get_topline__doc__[] =
"The number of the 1st visible line in the browser"
;
static PyObject *
browser_get_topline(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser_topline((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char browser_get__doc__[] =
"You better read the xforms manual on fl_get_browser for this one..."
;
static PyObject *
browser_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char browser_get_maxline__doc__[] =
"Returns the number of lines in the browser"
;
static PyObject *
browser_get_maxline(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser_maxline((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char browser_get_screenlines__doc__[] =
"Returns the number of visible lines in the browser"
;
static PyObject *
browser_get_screenlines(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser_screenlines((FL_OBJECT *)o);
return Py_BuildValue ("i",r);
}
static char browser_set_topline__doc__[] =
"Sets the browser's first visible line"
;
static PyObject *
browser_set_topline(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_set_browser_topline((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_set_fontsize__doc__[] =
"Set the browser's font size"
;
static PyObject *
browser_set_fontsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int s;
if (!PyArg_ParseTuple(args, "li",&o,&s))
return NULL;
fl_set_browser_fontsize((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_set_fontstyle__doc__[] =
"Set the browser's font style"
;
static PyObject *
browser_set_fontstyle(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int s;
if (!PyArg_ParseTuple(args, "li",&o,&s))
return NULL;
fl_set_browser_fontstyle((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_set_specialkey__doc__[] =
"Set the character used to change text formatting in the browser"
;
static PyObject *
browser_set_specialkey(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int s;
if (!PyArg_ParseTuple(args, "li",&o,&s))
return NULL;
fl_set_browser_specialkey((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
// static char browser_set_leftslider__doc__[] =
// "Set the browser's slider to the left"
// ;
//
// static PyObject *
// browser_set_leftslider(self, args)
// PyObject *self; /* Not used */
// PyObject *args;
// {
// long o;
// int s;
//
// if (!PyArg_ParseTuple(args, "li",&o,&s))
// return NULL;
// fl_set_browser_leftslider((FL_OBJECT *)o,s);
// Py_INCREF(Py_None);
// return Py_None;
// }
/* List of methods defined in the module */
static struct PyMethodDef browser_methods[] = {
{"create", browser_create, 1, browser_create__doc__},
{"add_line", browser_add_line, 1, browser_add_line__doc__},
{"addto", browser_addto, 1, browser_addto__doc__},
{"insert_line", browser_insert_line, 1, browser_insert_line__doc__},
{"delete_line", browser_delete_line, 1, browser_delete_line__doc__},
{"replace_line", browser_replace_line, 1, browser_replace_line__doc__},
{"get_line", browser_get_line, 1, browser_get_line__doc__},
{"load", browser_load, 1, browser_load__doc__},
{"select_line", browser_select_line, 1, browser_select_line__doc__},
{"deselect_line", browser_deselect_line, 1, browser_deselect_line__doc__},
{"deselect", browser_deselect, 1, browser_deselect__doc__},
{"isselected_line", browser_isselected_line, 1, browser_isselected_line__doc__},
{"get_topline", browser_get_topline, 1, browser_get_topline__doc__},
{"get", browser_get, 1, browser_get__doc__},
{"get_maxline", browser_get_maxline, 1, browser_get_maxline__doc__},
{"get_screenlines", browser_get_screenlines, 1, browser_get_screenlines__doc__},
{"set_topline", browser_set_topline, 1, browser_set_topline__doc__},
{"set_fontsize", browser_set_fontsize, 1, browser_set_fontsize__doc__},
{"set_fontstyle", browser_set_fontstyle, 1, browser_set_fontstyle__doc__},
{"set_specialkey", browser_set_specialkey, 1, browser_set_specialkey__doc__},
// {"set_leftslider", browser_set_leftslider, 1, browser_set_leftslider__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initbrowser) */
static char browser_module_documentation[] =
""
;
void
initbrowser()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("browser", browser_methods,
browser_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("browser.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module browser");
}

368
Pyxform/Modules/button.c Normal file
View File

@ -0,0 +1,368 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char button_create__doc__[] =
"Creates a normal button"
;
static PyObject *
button_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_button(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_round__doc__[] =
"Creates a round button"
;
static PyObject *
button_create_round(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_roundbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_light__doc__[] =
"Creates a light button"
;
static PyObject *
button_create_light(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_lightbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_check__doc__[] =
"Creates a check button"
;
static PyObject *
button_create_check(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_checkbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_bitmap__doc__[] =
"Creates a bitmap button"
;
static PyObject *
button_create_bitmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_bitmapbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_pixmap__doc__[] =
"Creates a pixmap button"
;
static PyObject *
button_create_pixmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_pixmapbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_set_bitmap_data__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_bitmap_data(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_bitmap_file__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_bitmap_file(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_pixmap_data__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_pixmap_data(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_pixmap_file__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_pixmap_file(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_pixmap_pixmap__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_pixmap_pixmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_get_pixmap_pixmap__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_get_pixmap_pixmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_get__doc__[] =
"Gets the button's value"
;
static PyObject *
button_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_button((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char button_set__doc__[] =
"Sets the button's value"
;
static PyObject *
button_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int v;
if (!PyArg_ParseTuple(args, "li",&o,&v))
return NULL;
fl_set_button((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char button_get_numb__doc__[] =
"Get's the number of the mouse button last pressed on the button object"
;
static PyObject *
button_get_numb(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
n=fl_get_button_numb((FL_OBJECT *)o);
return Py_BuildValue ("i",n);
}
static char button_create_generic__doc__[] =
"Creates a generic button (useful mainly for extensions)"
;
static PyObject *
button_create_generic(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int c,t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiiis",&c,&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_generic_button (c,t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
/* List of methods defined in the module */
static struct PyMethodDef button_methods[] = {
{"create", button_create, 1, button_create__doc__},
{"create_round", button_create_round, 1, button_create_round__doc__},
{"create_light", button_create_light, 1, button_create_light__doc__},
{"create_check", button_create_check, 1, button_create_check__doc__},
{"create_bitmap", button_create_bitmap, 1, button_create_bitmap__doc__},
{"create_pixmap", button_create_pixmap, 1, button_create_pixmap__doc__},
{"set_bitmap_data", button_set_bitmap_data, 1, button_set_bitmap_data__doc__},
{"set_bitmap_file", button_set_bitmap_file, 1, button_set_bitmap_file__doc__},
{"set_pixmap_data", button_set_pixmap_data, 1, button_set_pixmap_data__doc__},
{"set_pixmap_file", button_set_pixmap_file, 1, button_set_pixmap_file__doc__},
{"set_pixmap_pixmap", button_set_pixmap_pixmap, 1, button_set_pixmap_pixmap__doc__},
{"get_pixmap_pixmap", button_get_pixmap_pixmap, 1, button_get_pixmap_pixmap__doc__},
{"get", button_get, 1, button_get__doc__},
{"set", button_set, 1, button_set__doc__},
{"get_numb", button_get_numb, 1, button_get_numb__doc__},
{"create_generic", button_create_generic, 1, button_create_generic__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initbutton) */
static char button_module_documentation[] =
""
;
void
initbutton()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("button", button_methods,
button_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("button.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module button");
}

343
Pyxform/Modules/choice.c Normal file
View File

@ -0,0 +1,343 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char choice_create__doc__[] =
"Creates a choice object"
;
static PyObject *
choice_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_choice(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char choice_clear__doc__[] =
"Clears the list of choices"
;
static PyObject *
choice_clear(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_clear_choice((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_addto__doc__[] =
"Adds a line to a choice object"
;
static PyObject *
choice_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *t;
if (!PyArg_ParseTuple(args, "ls",&o,&t))
return NULL;
fl_addto_choice((FL_OBJECT *)o,t);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_replace__doc__[] =
"Replaces a line in a choice"
;
static PyObject *
choice_replace(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int l;
char *t;
if (!PyArg_ParseTuple(args, "lis",&o,&l,&t))
return NULL;
fl_replace_choice((FL_OBJECT *)o,l,t);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_delete__doc__[] =
"Deletes a line in a choice"
;
static PyObject *
choice_delete(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int l;
if (!PyArg_ParseTuple(args, "li",&o,&l))
return NULL;
fl_delete_choice((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set__doc__[] =
"Sets the choice"
;
static PyObject *
choice_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int l;
if (!PyArg_ParseTuple(args, "li",&o,&l))
return NULL;
fl_set_choice ((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_text__doc__[] =
"Sets the choice at the item with the given text"
;
static PyObject *
choice_set_text(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *t;
if (!PyArg_ParseTuple(args, "ls",&o,&t))
return NULL;
fl_set_choice_text((FL_OBJECT *)o,t);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_get__doc__[] =
"Gets the choice's selected option number"
;
static PyObject *
choice_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_choice((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char choice_get_maxitems__doc__[] =
"Gets the total number of items in the choice"
;
static PyObject *
choice_get_maxitems(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_choice_maxitems((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char choice_get_text__doc__[] =
"Gets the text of the current choice"
;
static PyObject *
choice_get_text(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char t[2048];
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
strcpy (t,fl_get_choice_text((FL_OBJECT *)o));
return Py_BuildValue("s",t);
}
static char choice_set_fontsize__doc__[] =
"Sets the choice's fontsize"
;
static PyObject *
choice_set_fontsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_choice_fontsize((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_align__doc__[] =
"Sets the alignment of the choice"
;
static PyObject *
choice_set_align(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_choice_align((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_item_mode__doc__[] =
"Sets an item's mode ?"
;
static PyObject *
choice_set_item_mode(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
unsigned m;
if (!PyArg_ParseTuple(args, "lil",&o,&n,&m))
return NULL;
fl_set_choice_item_mode((FL_OBJECT *)o,n,m);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_item_shortcut__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
choice_set_item_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef choice_methods[] = {
{"create", choice_create, 1, choice_create__doc__},
{"clear", choice_clear, 1, choice_clear__doc__},
{"addto", choice_addto, 1, choice_addto__doc__},
{"replace", choice_replace, 1, choice_replace__doc__},
{"delete", choice_delete, 1, choice_delete__doc__},
{"set", choice_set, 1, choice_set__doc__},
{"set_text", choice_set_text, 1, choice_set_text__doc__},
{"get", choice_get, 1, choice_get__doc__},
{"get_maxitems", choice_get_maxitems, 1, choice_get_maxitems__doc__},
{"get_text", choice_get_text, 1, choice_get_text__doc__},
{"set_fontsize", choice_set_fontsize, 1, choice_set_fontsize__doc__},
{"set_align", choice_set_align, 1, choice_set_align__doc__},
{"set_item_mode", choice_set_item_mode, 1, choice_set_item_mode__doc__},
{"set_item_shortcut", choice_set_item_shortcut, 1, choice_set_item_shortcut__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initchoice) */
static char choice_module_documentation[] =
""
;
void
initchoice()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("choice", choice_methods,
choice_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("choice.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module choice");
}

104
Pyxform/Modules/clock.c Normal file
View File

@ -0,0 +1,104 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char clock_create__doc__[] =
"Creates a clock"
;
static PyObject *
clock_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_clock(t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char clock_get__doc__[] =
"Gets the current time"
;
static PyObject *
clock_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int h,m,s;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_clock ((FL_OBJECT *)o,&h,&m,&s);
return Py_BuildValue ("iii",h,m,s);
}
/* List of methods defined in the module */
static struct PyMethodDef clock_methods[] = {
{"create", clock_create, 1, clock_create__doc__},
{"get", clock_get, 1, clock_get__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initclock) */
static char clock_module_documentation[] =
""
;
void
initclock()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("clock", clock_methods,
clock_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("clock.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module clock");
}

204
Pyxform/Modules/counter.c Normal file
View File

@ -0,0 +1,204 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char counter_create__doc__[] =
"Creates a counter"
;
static PyObject *
counter_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_counter(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char counter_set_value__doc__[] =
"Sets the value of the counter (Use only on visible counters!)"
;
static PyObject *
counter_set_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_counter_value((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_set_bounds__doc__[] =
"Sets the counter's max & min"
;
static PyObject *
counter_set_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_counter_bounds((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_set_step__doc__[] =
"Set the counter's step size (small & large)"
;
static PyObject *
counter_set_step(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s,l;
if (!PyArg_ParseTuple(args, "ldd",&o,&s,&l))
return NULL;
fl_set_counter_step((FL_OBJECT *)o,s,l);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_set_precision__doc__[] =
"Sets the counter's precision"
;
static PyObject *
counter_set_precision(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int p;
if (!PyArg_ParseTuple(args, "li",&o,&p))
return NULL;
fl_set_counter_precision ((FL_OBJECT *)o,p);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_get_value__doc__[] =
"Returns the counter's value"
;
static PyObject *
counter_get_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_counter_value((FL_OBJECT *)o);
return Py_BuildValue ("d",r);
}
static char counter_set_return__doc__[] =
"Makes the counter return always or when released"
;
static PyObject *
counter_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_counter_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef counter_methods[] = {
{"create", counter_create, 1, counter_create__doc__},
{"set_value", counter_set_value, 1, counter_set_value__doc__},
{"set_bounds", counter_set_bounds, 1, counter_set_bounds__doc__},
{"set_step", counter_set_step, 1, counter_set_step__doc__},
{"set_precision", counter_set_precision, 1, counter_set_precision__doc__},
{"get_value", counter_get_value, 1, counter_get_value__doc__},
{"set_return", counter_set_return, 1, counter_set_return__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initcounter) */
static char counter_module_documentation[] =
""
;
void
initcounter()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("counter", counter_methods,
counter_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("counter.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module counter");
}

203
Pyxform/Modules/dial.c Normal file
View File

@ -0,0 +1,203 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char dial_create__doc__[] =
"Creates a dial"
;
static PyObject *
dial_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_dial(t,x,y,w,h,l);
return Py_BuildValue ("l",o);;
}
static char dial_set_value__doc__[] =
"Sets the dial value"
;
static PyObject *
dial_set_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_dial_value ((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char dial_get_value__doc__[] =
"Gets the dial's value"
;
static PyObject *
dial_get_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_dial_value((FL_OBJECT *)o);
return Py_BuildValue("d",r);
}
static char dial_set_bounds__doc__[] =
"Sets the dial bounds"
;
static PyObject *
dial_set_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_dial_bounds((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char dial_get_bounds__doc__[] =
"Gets the dial bounds"
;
static PyObject *
dial_get_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_dial_bounds((FL_OBJECT *)o,&min,&max);
return Py_BuildValue("dd",min,max);
}
static char dial_set_step__doc__[] =
"Sets the dial step"
;
static PyObject *
dial_set_step(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_dial_step ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char dial_set_return__doc__[] =
"Makes a dial return always or when released"
;
static PyObject *
dial_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_dial_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef dial_methods[] = {
{"create", dial_create, 1, dial_create__doc__},
{"set_value", dial_set_value, 1, dial_set_value__doc__},
{"get_value", dial_get_value, 1, dial_get_value__doc__},
{"set_bounds", dial_set_bounds, 1, dial_set_bounds__doc__},
{"get_bounds", dial_get_bounds, 1, dial_get_bounds__doc__},
{"set_step", dial_set_step, 1, dial_set_step__doc__},
{"set_return", dial_set_return, 1, dial_set_return__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initdial) */
static char dial_module_documentation[] =
""
;
void
initdial()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("dial", dial_methods,
dial_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("dial.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module dial");
}

690
Pyxform/Modules/forms.c Normal file
View File

@ -0,0 +1,690 @@
#include <Python.h>
#include <forms.h>
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char forms_create__doc__[] =
"Creates a form"
;
static PyObject *
forms_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int box,w,h;
FL_FORM *ret;
if (!PyArg_ParseTuple(args, "iii",&box,&w,&h))
return NULL;
ret=fl_bgn_form (FL_NO_BOX,w,h);
fl_end_form ();
return Py_BuildValue("l",(long)ret);
}
static char forms_freeze__doc__[] =
"Freezes a form"
;
static PyObject *
forms_freeze(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_freeze_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_unfreeze__doc__[] =
"Unfreezes a form"
;
static PyObject *
forms_unfreeze(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_unfreeze_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_deactivate__doc__[] =
"Deactivates a form"
;
static PyObject *
forms_deactivate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_deactivate_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_activate__doc__[] =
"Activates a form"
;
static PyObject *
forms_activate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_activate_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_activate_all__doc__[] =
"Activates all forms"
;
static PyObject *
forms_activate_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_activate_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_deactivate_all__doc__[] =
"Deactivates all forms"
;
static PyObject *
forms_deactivate_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_deactivate_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_freeze_all__doc__[] =
"Freezes all forms"
;
static PyObject *
forms_freeze_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_freeze_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_unfreeze_all__doc__[] =
"Unfreezes all forms"
;
static PyObject *
forms_unfreeze_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_unfreeze_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_scale__doc__[] =
"Scales a form x and y times"
;
static PyObject *
forms_scale(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
double x,y;
if (!PyArg_ParseTuple(args, "ldd",&form,&x,&y))
return NULL;
fl_scale_form ((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_position__doc__[] =
"Sets the form position"
;
static PyObject *
forms_set_position(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_set_form_position((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_property__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_property(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_unset_property__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_unset_property(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_callback__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_callback(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_size__doc__[] =
"Sets the form's size"
;
static PyObject *
forms_set_size(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, "lii",&form,&x,&y))
return NULL;
fl_set_form_size((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_hotspot__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_hotspot(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_hotobject__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_hotobject(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_minsize__doc__[] =
"Sets the form minimum size"
;
static PyObject *
forms_set_minsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, "lii",&form,&x,&y))
return NULL;
fl_set_form_minsize ((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_maxsize__doc__[] =
"Sets the form maximum size"
;
static PyObject *
forms_set_maxsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, "lii",&form,&x,&y))
return NULL;
fl_set_form_maxsize ((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_event_cmask__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_event_cmask(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_event_cmask__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_get_event_cmask(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_geometry__doc__[] =
"Set the form's geometry"
;
static PyObject *
forms_set_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "liiii",&form,&x,&y,&w,&h))
return NULL;
fl_set_form_geometry ((FL_FORM *)form,x,y,w,h);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_geometry__doc__[] =
"Get the form's geometry"
;
static PyObject *
forms_get_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
x=((FL_FORM *)form)->x;
y=((FL_FORM *)form)->y;
w=((FL_FORM *)form)->w;
h=((FL_FORM *)form)->h;
return Py_BuildValue ("iiii",x,y,w,h);
}
static char forms_show__doc__[] =
"Shows the form"
;
static PyObject *
forms_show(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form,ret;
int a,b;
char *c;
if (!PyArg_ParseTuple(args, "liis",&form,&a,&b,&c))
return NULL;
ret=fl_show_form ((FL_FORM *)form,a,b,c);
return Py_BuildValue("l",ret);
}
static char forms_hide__doc__[] =
"Hides a form"
;
static PyObject *
forms_hide(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_hide_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_free__doc__[] =
"Releases a form's memory"
;
static PyObject *
forms_free(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_free_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_redraw__doc__[] =
"Redraws a form"
;
static PyObject *
forms_redraw(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_redraw_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_dblbuffer__doc__[] =
"Sets the form as doublebuffered or not"
;
static PyObject *
forms_set_dblbuffer(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int choice;
if (!PyArg_ParseTuple(args, "li",&form,&choice))
return NULL;
fl_set_form_dblbuffer ((FL_FORM *)form,choice);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_prepare_window__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_prepare_window(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_show_window__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_show_window(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_add_object__doc__[] =
"Adds an object to the form"
;
static PyObject *
forms_add_object(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long f,o;
if (!PyArg_ParseTuple(args, "ll",&f,&o))
return NULL;
fl_add_object((FL_FORM *)f,(FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_attr__doc__[] =
"Gets a bunch of attributes from the form"
;
static PyObject *forms_get_attr(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
return Py_BuildValue ("iiiiiil",
((FL_FORM *)o)->vmode,
((FL_FORM *)o)->deactivated,
((FL_FORM *)o)->use_pixmap,
((FL_FORM *)o)->frozen,
((FL_FORM *)o)->visible,
((FL_FORM *)o)->wm_border,
(long)((FL_FORM *)o)->prop);
}
static char forms_set_title__doc__[] =
"Sets the form's title"
;
static PyObject *
forms_set_title(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
char *title;
if (!PyArg_ParseTuple(args, "ls",&form,&title))
return NULL;
fl_set_form_title ((FL_FORM *)form,title);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_title__doc__[] =
"Gets the form's title (Undocumented on XForms, but...)"
;
static PyObject *
forms_get_title(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
char title[2048];
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
strcpy (title,((FL_FORM *)form)->label);
return Py_BuildValue ("s",title);
}
/* List of methods defined in the module */
static struct PyMethodDef forms_methods[] = {
{ "create", forms_create, 1, forms_create__doc__ },
{ "freeze", forms_freeze, 1, forms_freeze__doc__ },
{ "unfreeze", forms_unfreeze, 1, forms_unfreeze__doc__ },
{ "deactivate", forms_deactivate, 1, forms_deactivate__doc__ },
{ "activate", forms_activate, 1, forms_activate__doc__ },
{ "activate_all", forms_activate_all, 1, forms_activate_all__doc__ },
{ "deactivate_all", forms_deactivate_all, 1, forms_deactivate_all__doc__ },
{ "freeze_all", forms_freeze_all, 1, forms_freeze_all__doc__ },
{ "unfreeze_all", forms_unfreeze_all, 1, forms_unfreeze_all__doc__ },
{ "scale", forms_scale, 1, forms_scale__doc__ },
{ "set_position", forms_set_position, 1, forms_set_position__doc__ },
{ "set_property", forms_set_property, 1, forms_set_property__doc__ },
{ "unset_property", forms_unset_property, 1, forms_unset_property__doc__ },
{ "set_callback", forms_set_callback, 1, forms_set_callback__doc__ },
{ "set_size", forms_set_size, 1, forms_set_size__doc__ },
{ "set_hotspot", forms_set_hotspot, 1, forms_set_hotspot__doc__ },
{ "set_hotobject", forms_set_hotobject, 1, forms_set_hotobject__doc__ },
{ "set_minsize", forms_set_minsize, 1, forms_set_minsize__doc__ },
{ "set_maxsize", forms_set_maxsize, 1, forms_set_maxsize__doc__ },
{ "set_event_cmask", forms_set_event_cmask, 1, forms_set_event_cmask__doc__ },
{ "get_event_cmask", forms_get_event_cmask, 1, forms_get_event_cmask__doc__ },
{ "set_geometry", forms_set_geometry, 1, forms_set_geometry__doc__ },
{ "get_geometry", forms_get_geometry, 1, forms_get_geometry__doc__ },
{ "show", forms_show, 1, forms_show__doc__ },
{ "hide", forms_hide, 1, forms_hide__doc__ },
{ "free", forms_free, 1, forms_free__doc__ },
{ "redraw", forms_redraw, 1, forms_redraw__doc__ },
{ "set_dblbuffer", forms_set_dblbuffer, 1, forms_set_dblbuffer__doc__ },
{ "prepare_window", forms_prepare_window, 1, forms_prepare_window__doc__ },
{ "show_window", forms_show_window, 1, forms_show_window__doc__ },
{ "add_object", forms_add_object, 1, forms_add_object__doc__ },
{ "get_attr", forms_get_attr, 1, forms_get_attr__doc__ },
{ "set_title", forms_set_title, 1, forms_set_title__doc__ },
{ "get_title", forms_get_title, 1, forms_get_title__doc__ },
{ NULL, NULL } /* sentinel */
};
/* Initialization function for the module (*must* be called initforms) */
static char forms_module_documentation[] =
""
;
void
initforms()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("forms", forms_methods,
forms_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("forms.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module forms");
}

85
Pyxform/Modules/frame.c Normal file
View File

@ -0,0 +1,85 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char frame_create__doc__[] =
"Creates a frame"
;
static PyObject *
frame_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_frame (t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
/* List of methods defined in the module */
static struct PyMethodDef frame_methods[] = {
{"create", frame_create, 1, frame_create__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initframe) */
static char frame_module_documentation[] =
""
;
void
initframe()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("frame", frame_methods,
frame_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("frame.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module frame");
}

498
Pyxform/Modules/goodies.c Normal file
View File

@ -0,0 +1,498 @@
#include <Python.h>
#include <forms.h>
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char goodies_set_font__doc__[] =
"Sets the goodies font XXXXXXBroken?"
;
static PyObject *
goodies_set_font(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,j;
if (!PyArg_ParseTuple(args, "ii"),&i,&j)
return NULL;
fl_set_goodies_font (i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_message__doc__[] =
"Shows a message (3 lines)"
;
static PyObject *
goodies_show_message(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3;
if (!PyArg_ParseTuple(args, "sss",&s1,&s2,&s3))
return NULL;
fl_show_message (s1,s2,s3);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_alert__doc__[] =
"Shows an alert message"
;
static PyObject *
goodies_show_alert(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3;
int i;
if (!PyArg_ParseTuple(args, "sssi",&s1,&s2,&s3,&i))
return NULL;
fl_show_alert (s1,s2,s3,i);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_question__doc__[] =
"Shows a question"
;
static PyObject *
goodies_show_question(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1;
int v,r;
if (!PyArg_ParseTuple(args, "ss",&s1,&v))
return NULL;
r=fl_show_question (s1,v);
return Py_BuildValue ("i",r);
}
static char goodies_show_input__doc__[] =
"Asks a line of text"
;
static PyObject *
goodies_show_input(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,r[2048];
if (!PyArg_ParseTuple(args, "ss",&s1,&s2))
return NULL;
strcpy (r,fl_show_input(s1,s2));
return Py_BuildValue ("s",r);
}
static char goodies_show_colormap__doc__[] =
"Shows a colormap"
;
static PyObject *
goodies_show_colormap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,r;
if (!PyArg_ParseTuple(args, "i",&i))
return NULL;
r=fl_show_colormap (i);
return Py_BuildValue ("i",r);
}
static char goodies_show_choice__doc__[] =
"Shows a choice"
;
static PyObject *
goodies_show_choice(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3,*s4,*s5,*s6;
int i1,i2,r;
if (!PyArg_ParseTuple(args, "sssisssi",&s1,&s2,&s3,&i1,&s4,&s5,&s6,&i2))
return NULL;
r=fl_show_choice (s1,s2,s3,i1,s4,s5,s6,i2);
return Py_BuildValue("i",r);
}
static char goodies_set_choices_shortcut__doc__[] =
"Sets the choice's shortcuts"
;
static PyObject *
goodies_set_choices_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3;
if (!PyArg_ParseTuple(args, "sss",&s1,&s2,&s3))
return NULL;
fl_set_choices_shortcut (s1,s2,s3);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_oneliner__doc__[] =
"Shows a one-liner"
;
static PyObject *
goodies_show_oneliner(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1;
int i,j;
if (!PyArg_ParseTuple(args, "sii",&s1,&i,&j))
return NULL;
fl_show_oneliner (s1,i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_hide_oneliner__doc__[] =
"Hides a oneliner"
;
static PyObject *
goodies_hide_oneliner(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_hide_oneliner();
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_set_oneliner_font__doc__[] =
"Sets the oneliner font"
;
static PyObject *
goodies_set_oneliner_font(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,j;
if (!PyArg_ParseTuple(args, "ii",&i,&j))
return NULL;
fl_set_oneliner_font(i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_set_oneliner_color__doc__[] =
"Sets the oneliner color"
;
static PyObject *
goodies_set_oneliner_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,j;
if (!PyArg_ParseTuple(args, "ii",&i,&j))
return NULL;
fl_set_oneliner_color (i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_use_fselector__doc__[] =
"??"
;
static PyObject *
goodies_use_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i;
if (!PyArg_ParseTuple(args, "i",&i))
return NULL;
fl_use_fselector (i);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_fselector__doc__[] =
"Shows a fselector"
;
static PyObject *
goodies_show_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3,*s4,r[2048];
if (!PyArg_ParseTuple(args, "ssss",&s1,&s2,&s3,&s4))
return NULL;
strcpy (r,fl_show_fselector (s1,s2,s3,s4));
return Py_BuildValue ("s",r);
}
static char goodies_set_fselector_placement__doc__[] =
""
;
static PyObject *
goodies_set_fselector_placement(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i;
if (!PyArg_ParseTuple(args, "i",&i))
return NULL;
fl_set_fselector_placement(i);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_set_fselector_callback__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_set_fselector_callback(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_get_directory__doc__[] =
""
;
static PyObject *
goodies_get_directory(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char r[2048];
if (!PyArg_ParseTuple(args, ""))
return NULL;
strcpy (r,fl_get_directory());
return Py_BuildValue ("s",r);
}
static char goodies_get_pattern__doc__[] =
""
;
static PyObject *
goodies_get_pattern(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char r[2048];
if (!PyArg_ParseTuple(args, ""))
return NULL;
strcpy (r,fl_get_pattern());
return Py_BuildValue ("s",r);
}
static char goodies_get_filename__doc__[] =
""
;
static PyObject *
goodies_get_filename(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char r[2048];
if (!PyArg_ParseTuple(args, ""))
return NULL;
strcpy (r,fl_get_filename());
return Py_BuildValue ("s",r);
}
static char goodies_refresh_fselector__doc__[] =
""
;
static PyObject *
goodies_refresh_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_refresh_fselector();
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_add_fselector_appbutton__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_add_fselector_appbutton(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_disable_fselector_cache__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_disable_fselector_cache(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_invalidate_fselector_cache__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_invalidate_fselector_cache(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_get_fselector_form__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_get_fselector_form(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_hide_fselector__doc__[] =
"Hides a fselector"
;
static PyObject *
goodies_hide_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_hide_fselector();
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef goodies_methods[] = {
{"set_font", goodies_set_font, 1, goodies_set_font__doc__},
{"show_message", goodies_show_message, 1, goodies_show_message__doc__},
{"show_alert", goodies_show_alert, 1, goodies_show_alert__doc__},
{"show_question", goodies_show_question, 1, goodies_show_question__doc__},
{"show_input", goodies_show_input, 1, goodies_show_input__doc__},
{"show_colormap", goodies_show_colormap, 1, goodies_show_colormap__doc__},
{"show_choice", goodies_show_choice, 1, goodies_show_choice__doc__},
{"set_choices_shortcut", goodies_set_choices_shortcut, 1, goodies_set_choices_shortcut__doc__},
{"show_oneliner", goodies_show_oneliner, 1, goodies_show_oneliner__doc__},
{"hide_oneliner", goodies_hide_oneliner, 1, goodies_hide_oneliner__doc__},
{"set_oneliner_font", goodies_set_oneliner_font, 1, goodies_set_oneliner_font__doc__},
{"set_oneliner_color", goodies_set_oneliner_color, 1, goodies_set_oneliner_color__doc__},
{"use_fselector", goodies_use_fselector, 1, goodies_use_fselector__doc__},
{"show_fselector", goodies_show_fselector, 1, goodies_show_fselector__doc__},
{"set_fselector_placement", goodies_set_fselector_placement, 1, goodies_set_fselector_placement__doc__},
{"set_fselector_callback", goodies_set_fselector_callback, 1, goodies_set_fselector_callback__doc__},
{"get_directory", goodies_get_directory, 1, goodies_get_directory__doc__},
{"get_pattern", goodies_get_pattern, 1, goodies_get_pattern__doc__},
{"get_filename", goodies_get_filename, 1, goodies_get_filename__doc__},
{"refresh_fselector", goodies_refresh_fselector, 1, goodies_refresh_fselector__doc__},
{"add_fselector_appbutton", goodies_add_fselector_appbutton, 1, goodies_add_fselector_appbutton__doc__},
{"disable_fselector_cache", goodies_disable_fselector_cache, 1, goodies_disable_fselector_cache__doc__},
{"invalidate_fselector_cache", goodies_invalidate_fselector_cache, 1, goodies_invalidate_fselector_cache__doc__},
{"get_fselector_form", goodies_get_fselector_form, 1, goodies_get_fselector_form__doc__},
{"hide_fselector", goodies_hide_fselector, 1, goodies_hide_fselector__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initgoodies) */
static char goodies_module_documentation[] =
""
;
void
initgoodies()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("goodies", goodies_methods,
goodies_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("goodies.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module goodies");
}

244
Pyxform/Modules/input.c Normal file
View File

@ -0,0 +1,244 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char input_create__doc__[] =
"Creates an Input object"
;
static PyObject *
input_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_input (t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char input_set__doc__[] =
"Sets the contents of an input object"
;
static PyObject *
input_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_set_input((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_color__doc__[] =
"Sets the color of the input object's text"
;
static PyObject *
input_set_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int c1,c2;
if (!PyArg_ParseTuple(args, "lii",&o,&c1,&c2))
return NULL;
fl_set_input_color ((FL_OBJECT *)o,c1,c2);
Py_INCREF(Py_None);
return Py_None;
}
static char input_get__doc__[] =
"Gets the input's value"
;
static PyObject *
input_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char r[2048];
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
strcpy (r,fl_get_input((FL_OBJECT *)o));
return Py_BuildValue ("s",r);
}
static char input_set_return__doc__[] =
"Makes the input return always or when released"
;
static PyObject *
input_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_input_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_scroll__doc__[] =
"Makes the input scrollable"
;
static PyObject *
input_set_scroll(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_input_scroll((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_cursorpos__doc__[] =
"Sets the input's cursor position"
;
static PyObject *
input_set_cursorpos(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i,j;
if (!PyArg_ParseTuple(args, "lii",&o,&i,&j))
return NULL;
fl_set_input_cursorpos ((FL_OBJECT *)o,i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_selected__doc__[] =
"Sets the input as selected"
;
static PyObject *
input_set_selected(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_input_selected((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_selected_range__doc__[] =
"Sets a range of the input object as selected"
;
static PyObject *
input_set_selected_range(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i,j;
if (!PyArg_ParseTuple(args, "lii",&o,&i,&j))
return NULL;
fl_set_input_selected_range((FL_OBJECT *)o,i,j);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef input_methods[] = {
{"create", input_create, 1, input_create__doc__},
{"set", input_set, 1, input_set__doc__},
{"set_color", input_set_color, 1, input_set_color__doc__},
{"get", input_get, 1, input_get__doc__},
{"set_return", input_set_return, 1, input_set_return__doc__},
{"set_scroll", input_set_scroll, 1, input_set_scroll__doc__},
{"set_cursorpos", input_set_cursorpos, 1, input_set_cursorpos__doc__},
{"set_selected", input_set_selected, 1, input_set_selected__doc__},
{"set_selected_range", input_set_selected_range, 1, input_set_selected_range__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initinput) */
static char input_module_documentation[] =
""
;
void
initinput()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("input", input_methods,
input_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("input.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module input");
}

304
Pyxform/Modules/menu.c Normal file
View File

@ -0,0 +1,304 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char menu_create__doc__[] =
"Creates a menu"
;
static PyObject *
menu_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_menu(t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char menu_clear__doc__[] =
"Removes all the menu's options"
;
static PyObject *
menu_clear(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_clear_menu ((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_set__doc__[] =
"Sets the menu contents"
;
static PyObject *
menu_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_set_menu ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_addto__doc__[] =
"Adds an option to an existing menu"
;
static PyObject *
menu_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_addto_menu ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_replace_item__doc__[] =
"Replaces an item from the menu"
;
static PyObject *
menu_replace_item(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
char *s;
if (!PyArg_ParseTuple(args, "lis",&o,&i,&s))
return NULL;
fl_replace_menu_item((FL_OBJECT *)o,i,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_delete_item__doc__[] =
"Deletes an option from a menu"
;
static PyObject *
menu_delete_item(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_delete_menu_item((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_set_item_shortcut__doc__[] =
"Sets a menu item's shortcut"
;
static PyObject *
menu_set_item_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
char *s;
if (!PyArg_ParseTuple(args, "lis",&o,&i,&s))
return NULL;
fl_set_menu_item_shortcut((FL_OBJECT *)o,i,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_set_item_mode__doc__[] =
"Sets the item mode (unselectable, etc)"
;
static PyObject *
menu_set_item_mode(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
unsigned long m;
if (!PyArg_ParseTuple(args, "lil",&o,&i,&m))
return NULL;
fl_set_menu_item_mode((FL_OBJECT *)o,i,m);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_show_symbol__doc__[] =
"Shows a simbol menu with the label"
;
static PyObject *
menu_show_symbol(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_show_menu_symbol ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_get__doc__[] =
"Gets the last selected item's number"
;
static PyObject *
menu_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_menu((FL_OBJECT *)o);
return Py_BuildValue ("i",r);
}
static char menu_get_maxitems__doc__[] =
"returns the number of items in a menu"
;
static PyObject *
menu_get_maxitems(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_menu_maxitems((FL_OBJECT *)o);
return Py_BuildValue ("i",r);
}
static char menu_get_text__doc__[] =
"Returns the text of the menu last selected choice"
;
static PyObject *
menu_get_text(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char s[2048];
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
strcpy (s,fl_get_menu_text((FL_OBJECT *)o));
return Py_BuildValue ("s",s);
}
/* List of methods defined in the module */
static struct PyMethodDef menu_methods[] = {
{"create", menu_create, 1, menu_create__doc__},
{"clear", menu_clear, 1, menu_clear__doc__},
{"set", menu_set, 1, menu_set__doc__},
{"addto", menu_addto, 1, menu_addto__doc__},
{"replace_item", menu_replace_item, 1, menu_replace_item__doc__},
{"delete_item", menu_delete_item, 1, menu_delete_item__doc__},
{"set_item_shortcut", menu_set_item_shortcut, 1, menu_set_item_shortcut__doc__},
{"set_item_mode", menu_set_item_mode, 1, menu_set_item_mode__doc__},
{"show_symbol", menu_show_symbol, 1, menu_show_symbol__doc__},
{"get", menu_get, 1, menu_get__doc__},
{"get_maxitems", menu_get_maxitems, 1, menu_get_maxitems__doc__},
{"get_text", menu_get_text, 1, menu_get_text__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initmenu) */
static char menu_module_documentation[] =
""
;
void
initmenu()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("menu", menu_methods,
menu_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("menu.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module menu");
}

530
Pyxform/Modules/objects.c Normal file
View File

@ -0,0 +1,530 @@
#include <Python.h>
#include <forms.h>
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char obj_set_boxtype__doc__[] =
"Sets the objects Boxtype"
;
static PyObject *
obj_set_boxtype(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int type;
if (!PyArg_ParseTuple(args, "li",&object,&type))
return NULL;
fl_set_object_boxtype ((FL_OBJECT *)object,type);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_bw__doc__[] =
"Sets the object's Border Width"
;
static PyObject *
obj_set_bw(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int bw;
if (!PyArg_ParseTuple(args, "li",&object,&bw))
return NULL;
fl_set_object_bw ((FL_OBJECT *)object,bw);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_resize__doc__[] =
"Sets the objects \"Resize policy\""
;
static PyObject *
obj_set_resize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
unsigned a;
if (!PyArg_ParseTuple(args, "ll",&object,&a))
return NULL;
fl_set_object_resize ((FL_OBJECT *)object,a);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_gravity__doc__[] =
"Sets the objects gravity"
;
static PyObject *
obj_set_gravity(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
unsigned a,b,c;
if (!PyArg_ParseTuple(args, "lll",&object,&a,&b))
return NULL;
fl_set_object_gravity ((FL_OBJECT *)object,a,b);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lsize__doc__[] =
"Sets the object's label size"
;
static PyObject *
obj_set_lsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int size;
if (!PyArg_ParseTuple(args, "li",&object,&size))
return NULL;
fl_set_object_lsize((FL_OBJECT *)object,size);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lstyle__doc__[] =
"Sets the object's label style"
;
static PyObject *
obj_set_lstyle(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int style;
if (!PyArg_ParseTuple(args, "li",&object,&style))
return NULL;
fl_set_object_lstyle((FL_OBJECT *)object,style);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lcol__doc__[] =
"Sets the object's label color"
;
static PyObject *
obj_set_lcol(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int c;
if (!PyArg_ParseTuple(args, "li",&o,&c))
return NULL;
fl_set_object_lcol((FL_OBJECT *)o,c);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_dragndrop__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
obj_set_dragndrop(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_focus__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
obj_set_focus(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char obj_redraw__doc__[] =
"Redraws the object"
;
static PyObject *
obj_redraw(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_redraw_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lalign__doc__[] =
"Sets the label alignment"
;
static PyObject *
obj_set_lalign(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int a;
if (!PyArg_ParseTuple(args, "li",&o,&a))
return NULL;
fl_set_object_lalign((FL_OBJECT *)o,a);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_scale__doc__[] =
"Scales the object"
;
static PyObject *
obj_scale(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double x,y;
if (!PyArg_ParseTuple(args, "ldd",&o,&x,&y))
return NULL;
fl_scale_object((FL_OBJECT *)o,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_callback__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
obj_set_callback(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char obj_show__doc__[] =
"Shows the object"
;
static PyObject *
obj_show(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_show_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_hide__doc__[] =
"Hides the object"
;
static PyObject *
obj_hide(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_hide_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_free__doc__[] =
"Releases the object's memory"
;
static PyObject *
obj_free(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_free_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_delete__doc__[] =
"Deletes the object from it's form"
;
static PyObject *
obj_delete(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_delete_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_color__doc__[] =
"Sets the object color"
;
static PyObject *
obj_set_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
float a,b;
if (!PyArg_ParseTuple(args, "lff",&o,&a,&b))
return NULL;
fl_set_object_color((FL_OBJECT *)o,(int)a,(int)b);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_label__doc__[] =
"Sets the label"
;
static PyObject *
obj_set_label(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_set_object_label((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_activate__doc__[] =
"Activates the object"
;
static PyObject *
obj_activate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_activate_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_deactivate__doc__[] =
"Activates the object"
;
static PyObject *
obj_deactivate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_deactivate_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_shortcut__doc__[] =
"Sets the shortcut to the object"
;
static PyObject *
obj_set_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
int i;
if (!PyArg_ParseTuple(args, "lsi",&o,&s,&i))
return NULL;
fl_set_object_shortcut ((FL_OBJECT *)o,s,i);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_dblbuffer__doc__[] =
"Sets the object as double buffered"
;
static PyObject *
obj_set_dblbuffer(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int c;
if (!PyArg_ParseTuple(args, "li",&o,&c))
return NULL;
fl_set_object_dblbuffer((FL_OBJECT *)o,c);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_geometry__doc__[] =
"Sets the object's geometry"
;
static PyObject *
obj_set_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "liiii",&o,&x,&y,&w,&h))
return NULL;
fl_set_object_geometry ((FL_OBJECT *)o,x,y,w,h);
fl_redraw_object ((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_get_geometry__doc__[] =
"Sets the object's geometry"
;
static PyObject *
obj_get_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
x=((FL_OBJECT *)o)->x;
y=((FL_OBJECT *)o)->y;
w=((FL_OBJECT *)o)->w;
h=((FL_OBJECT *)o)->h;
fl_redraw_object ((FL_OBJECT *)o);
return Py_BuildValue ("iiii",x,y,w,h);
}
/* List of methods defined in the module */
static struct PyMethodDef obj_methods[] = {
{"set_boxtype", obj_set_boxtype, 1, obj_set_boxtype__doc__},
{"set_bw", obj_set_bw, 1, obj_set_bw__doc__},
{"set_resize", obj_set_resize, 1, obj_set_resize__doc__},
{"set_gravity", obj_set_gravity, 1, obj_set_gravity__doc__},
{"set_lsize", obj_set_lsize, 1, obj_set_lsize__doc__},
{"set_lstyle", obj_set_lstyle, 1, obj_set_lstyle__doc__},
{"set_lcol", obj_set_lcol, 1, obj_set_lcol__doc__},
{"set_dragndrop", obj_set_dragndrop, 1, obj_set_dragndrop__doc__},
{"set_focus", obj_set_focus, 1, obj_set_focus__doc__},
{"redraw", obj_redraw, 1, obj_redraw__doc__},
{"set_lalign", obj_set_lalign, 1, obj_set_lalign__doc__},
{"scale", obj_scale, 1, obj_scale__doc__},
{"set_callback", obj_set_callback, 1, obj_set_callback__doc__},
{"show", obj_show, 1, obj_show__doc__},
{"hide", obj_hide, 1, obj_hide__doc__},
{"free", obj_free, 1, obj_free__doc__},
{"delete", obj_delete, 1, obj_delete__doc__},
{"set_color", obj_set_color, 1, obj_set_color__doc__},
{"set_label", obj_set_label, 1, obj_set_label__doc__},
{"activate", obj_activate, 1, obj_activate__doc__},
{"deactivate", obj_deactivate, 1, obj_deactivate__doc__},
{"set_shortcut", obj_set_shortcut, 1, obj_set_shortcut__doc__},
{"set_dblbuffer", obj_set_dblbuffer, 1, obj_set_dblbuffer__doc__},
{"set_geometry", obj_set_geometry, 1, obj_set_geometry__doc__},
{"get_geometry", obj_get_geometry, 1, obj_get_geometry__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initobjects) */
static char objects_module_documentation[] =
""
;
void
initobjects()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("objects", obj_methods,
objects_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("objects.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module objects");
}

128
Pyxform/Modules/pixmaps.c Normal file
View File

@ -0,0 +1,128 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char pmp_create__doc__[] =
"Creates a pixmap"
;
static PyObject *
pmp_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
FL_OBJECT *o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=fl_create_pixmap(t,x,y,w,h,l);
return Py_BuildValue ("l",(long)o);
}
static char pmp_set_data__doc__[] =
"Sets the pixmap's data"
;
static PyObject *
pmp_set_data(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
long b;
if (!PyArg_ParseTuple(args, "ll",&o,&b))
return NULL;
fl_set_pixmap_data((FL_OBJECT *)o,(char **)b);
Py_INCREF(Py_None);
return Py_None;
}
static char pmp_set_file__doc__[] =
"Loads a file into a pixmap"
;
static PyObject *
pmp_set_file(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *f;
if (!PyArg_ParseTuple(args, "ls",&o,&f))
return NULL;
fl_set_pixmap_file((FL_OBJECT *)o,f);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef pmp_methods[] = {
{"create", pmp_create, 1, pmp_create__doc__},
{"set_data", pmp_set_data, 1, pmp_set_data__doc__},
{"set_file", pmp_set_file, 1, pmp_set_file__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initpixmap) */
static char pixmaps_module_documentation[] =
""
;
void
initpixmaps()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("pixmaps", pmp_methods,
pixmaps_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("pixmaps.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module pixmaps");
}

372
Pyxform/Modules/popups.c Normal file
View File

@ -0,0 +1,372 @@
/***********************************************************
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
The Netherlands.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char pup_new__doc__[] =
""
;
static PyObject *
pup_new(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_def__doc__[] =
""
;
static PyObject *
pup_def(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_addto__doc__[] =
""
;
static PyObject *
pup_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set__doc__[] =
""
;
static PyObject *
pup_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_free__doc__[] =
""
;
static PyObject *
pup_free(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_do__doc__[] =
""
;
static PyObject *
pup_do(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_shortcut__doc__[] =
""
;
static PyObject *
pup_set_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_position__doc__[] =
""
;
static PyObject *
pup_set_position(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_selection__doc__[] =
""
;
static PyObject *
pup_set_selection(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_fontsize__doc__[] =
""
;
static PyObject *
pup_set_fontsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_fontstyle__doc__[] =
""
;
static PyObject *
pup_set_fontstyle(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_shadow__doc__[] =
""
;
static PyObject *
pup_set_shadow(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_softedge__doc__[] =
""
;
static PyObject *
pup_set_softedge(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_color__doc__[] =
""
;
static PyObject *
pup_set_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_title__doc__[] =
""
;
static PyObject *
pup_set_title(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_itemcb__doc__[] =
""
;
static PyObject *
pup_set_itemcb(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_menucb__doc__[] =
""
;
static PyObject *
pup_set_menucb(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_submenu__doc__[] =
""
;
static PyObject *
pup_set_submenu(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef pup_methods[] = {
{"new", pup_new, 1, pup_new__doc__},
{"def", pup_def, 1, pup_def__doc__},
{"addto", pup_addto, 1, pup_addto__doc__},
{"set", pup_set, 1, pup_set__doc__},
{"free", pup_free, 1, pup_free__doc__},
{"do", pup_do, 1, pup_do__doc__},
{"set_shortcut", pup_set_shortcut, 1, pup_set_shortcut__doc__},
{"set_position", pup_set_position, 1, pup_set_position__doc__},
{"set_selection", pup_set_selection, 1, pup_set_selection__doc__},
{"set_fontsize", pup_set_fontsize, 1, pup_set_fontsize__doc__},
{"set_fontstyle", pup_set_fontstyle, 1, pup_set_fontstyle__doc__},
{"set_shadow", pup_set_shadow, 1, pup_set_shadow__doc__},
{"set_softedge", pup_set_softedge, 1, pup_set_softedge__doc__},
{"set_color", pup_set_color, 1, pup_set_color__doc__},
{"set_title", pup_set_title, 1, pup_set_title__doc__},
{"set_itemcb", pup_set_itemcb, 1, pup_set_itemcb__doc__},
{"set_menucb", pup_set_menucb, 1, pup_set_menucb__doc__},
{"set_submenu", pup_set_submenu, 1, pup_set_submenu__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initpopups) */
static char popups_module_documentation[] =
""
;
void
initpopups()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("popups", pup_methods,
popups_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("popups.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module popups");
}

View File

@ -0,0 +1,304 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char posit_create__doc__[] =
"Creates a positioner"
;
static PyObject *
posit_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_positioner(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char posit_set_xvalue__doc__[] =
"Sets the x-value of the positioner"
;
static PyObject *
posit_set_xvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_positioner_xvalue((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_xvalue__doc__[] =
"Gets the x-value of the positioner"
;
static PyObject *
posit_get_xvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_positioner_xvalue((FL_OBJECT *)o);
return Py_BuildValue ("d",r);
}
static char posit_set_xbounds__doc__[] =
"Sets the positioner's x min/max"
;
static PyObject *
posit_set_xbounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_positioner_xbounds ((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_xbounds__doc__[] =
"Gets the positioner's x min/max"
;
static PyObject *
posit_get_xbounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_positioner_xbounds ((FL_OBJECT *)o,&min,&max);
return Py_BuildValue ("dd",min,max);
}
static char posit_set_yvalue__doc__[] =
"Sets the y-value of the positioner"
;
static PyObject *
posit_set_yvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_positioner_yvalue((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_yvalue__doc__[] =
"Gets the y-value of the positioner"
;
static PyObject *
posit_get_yvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_positioner_yvalue((FL_OBJECT *)o);
return Py_BuildValue ("d",r);
}
static char posit_set_ybounds__doc__[] =
"Sets the positioner's y min/max"
;
static PyObject *
posit_set_ybounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_positioner_ybounds ((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_ybounds__doc__[] =
"Gets the positioner's y min/max"
;
static PyObject *
posit_get_ybounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_positioner_ybounds ((FL_OBJECT *)o,&min,&max);
return Py_BuildValue ("dd",min,max);
}
static char posit_set_xstep__doc__[] =
"Sets the positioner x-step"
;
static PyObject *
posit_set_xstep(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_positioner_xstep ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_set_ystep__doc__[] =
"Sets the positioner y-step"
;
static PyObject *
posit_set_ystep(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_positioner_ystep ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_set_return__doc__[] =
"Makes the positioner return always or when released"
;
static PyObject *
posit_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_positioner_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef posit_methods[] = {
{"create", posit_create, 1, posit_create__doc__},
{"set_xvalue", posit_set_xvalue, 1, posit_set_xvalue__doc__},
{"get_xvalue", posit_get_xvalue, 1, posit_get_xvalue__doc__},
{"set_xbounds", posit_set_xbounds, 1, posit_set_xbounds__doc__},
{"get_xbounds", posit_get_xbounds, 1, posit_get_xbounds__doc__},
{"set_yvalue", posit_set_yvalue, 1, posit_set_yvalue__doc__},
{"get_yvalue", posit_get_yvalue, 1, posit_get_yvalue__doc__},
{"set_ybounds", posit_set_ybounds, 1, posit_set_ybounds__doc__},
{"get_ybounds", posit_get_ybounds, 1, posit_get_ybounds__doc__},
{"set_xstep", posit_set_xstep, 1, posit_set_xstep__doc__},
{"set_ystep", posit_set_ystep, 1, posit_set_ystep__doc__},
{"set_return", posit_set_return, 1, posit_set_return__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initpositioner) */
static char positioner_module_documentation[] =
""
;
void
initpositioner()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("positioner", posit_methods,
positioner_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("positioner.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module positioner");
}

265
Pyxform/Modules/slider.c Normal file
View File

@ -0,0 +1,265 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char slider_create__doc__[] =
""
;
static PyObject *
slider_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_slider(t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char slider_create_val__doc__[] =
"Creates a val_slider"
;
static PyObject *
slider_create_val(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_valslider(t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char slider_set_value__doc__[] =
"Sets the slider's value"
;
static PyObject *
slider_set_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_slider_value ((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_get_value__doc__[] =
"Gets the slider value"
;
static PyObject *
slider_get_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
v=fl_get_slider_value ((FL_OBJECT *)o);
return Py_BuildValue ("d",v);
}
static char slider_set_bounds__doc__[] =
"Sets the slider's min/max"
;
static PyObject *
slider_set_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_slider_bounds((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_get_bounds__doc__[] =
""
;
static PyObject *
slider_get_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_slider_bounds((FL_OBJECT *)o,&min,&max);
return Py_BuildValue ("dd",min,max);
}
static char slider_set_return__doc__[] =
"Makes the slider return always or when released"
;
static PyObject *
slider_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_slider_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_set_step__doc__[] =
"Sets the slider's step"
;
static PyObject *
slider_set_step(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_slider_step ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_set_size__doc__[] =
"Sets the slider's thingy size"
;
static PyObject *
slider_set_size(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_slider_size ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_set_precision__doc__[] =
"Sets the valslider's precision"
;
static PyObject *
slider_set_precision(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_slider_precision ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef slider_methods[] = {
{"create", slider_create, 1, slider_create__doc__},
{"create_val", slider_create_val, 1, slider_create_val__doc__},
{"set_value", slider_set_value, 1, slider_set_value__doc__},
{"get_value", slider_get_value, 1, slider_get_value__doc__},
{"set_bounds", slider_set_bounds, 1, slider_set_bounds__doc__},
{"get_bounds", slider_get_bounds, 1, slider_get_bounds__doc__},
{"set_return", slider_set_return, 1, slider_set_return__doc__},
{"set_step", slider_set_step, 1, slider_set_step__doc__},
{"set_size", slider_set_size, 1, slider_set_size__doc__},
{"set_precision", slider_set_precision, 1, slider_set_precision__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initslider) */
static char slider_module_documentation[] =
""
;
void
initslider()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("slider", slider_methods,
slider_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("slider.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module slider");
}

83
Pyxform/Modules/text.c Normal file
View File

@ -0,0 +1,83 @@
/***********************************************************
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
The Netherlands.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char text_create__doc__[] =
""
;
static PyObject *
text_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef text_methods[] = {
{"create", text_create, 1, text_create__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called inittext) */
static char text_module_documentation[] =
""
;
void
inittext()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("text", text_methods,
text_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("text.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module text");
}

124
Pyxform/Modules/timer.c Normal file
View File

@ -0,0 +1,124 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char timer_create__doc__[] =
"Creates a timer"
;
static PyObject *
fl_timer_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_timer(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char timer_set__doc__[] =
"Set the time remaining in a timer object"
;
static PyObject *
timer_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_timer((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char timer_get__doc__[] =
"Get the time remaining in a timer object"
;
static PyObject *
timer_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
v=fl_get_timer((FL_OBJECT *)o);
return Py_BuildValue ("d",v);
}
/* List of methods defined in the module */
static struct PyMethodDef timer_methods[] = {
{"create", fl_timer_create, 1, timer_create__doc__},
{"set", timer_set, 1, timer_set__doc__},
{"get", timer_get, 1, timer_get__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called inittimer) */
static char timer_module_documentation[] =
""
;
void
inittimer()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("timer", timer_methods,
timer_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("timer.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module timer");
}

76
Pyxform/Modules/xforms.c Normal file
View File

@ -0,0 +1,76 @@
/*************************************************************
**************************************************************
**************************************************************
XForms -specific functions
**************************************************************
**************************************************************
*************************************************************/
#include <Python.h>
#include <forms.h>
/******************************************************
Method to initialize the xforms library.
Args:
appname: The name of the application
appclass: The Class of the application
argvo: argv[0] (Needs Work)
Returns:
NULL if error
******************************************************/
static PyObject *
pyxforms_init(self,args)
PyObject *self;
PyObject *args;
{
int sts;
char *appname;
char *appclass;
char *argv0;
sts=1;
if (!PyArg_ParseTuple (args,"sss",&appname,&appclass,&argv0))
return NULL;
fl_initialize (&sts,&argv0,appname,0,0);
return Py_BuildValue("");
}
/**************************************************************
Function to let the library run the forms at will
Args: None
Returns: NULL on error
pointer to any object that returned, if succesful
don't know what it does when you close the windows...
**************************************************************/
static PyObject *
pyxforms_do_forms(self,args)
PyObject *self;
PyObject *args;
{
FL_OBJECT *obj;
obj=fl_do_only_forms (); /* XXXXX not do_forms, until EVENTS get done */
return Py_BuildValue("l",(long)obj);
}
static PyMethodDef xformsMethods [] ={
/* XForms specifics */
{"init",pyxforms_init,1},
{"do_forms",pyxforms_do_forms,1},
/* FENCE */
{NULL,NULL}
};
void initxforms()
{
(void) Py_InitModule("xforms",xformsMethods);
}

441
Pyxform/Modules/xyplot.c Normal file
View File

@ -0,0 +1,441 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char xyplot_set_return__doc__[] =
"Makes the XyPlot return always or when released"
;
static PyObject *
xyplot_set_return (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple (args, "li", &o, &i))
return NULL;
fl_set_xyplot_return ((FL_OBJECT *) o, i);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_xtics__doc__[] =
"Changes the number of xtics (major and minor) in a xyplot"
;
static PyObject *
xyplot_set_xtics (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i, j;
if (!PyArg_ParseTuple (args, "lii", &o, &i, &j))
return NULL;
fl_set_xyplot_xtics ((FL_OBJECT *) o, i, j);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_ytics__doc__[] =
"Changes the number of ytics (major and minor) in a xyplot"
;
static PyObject *
xyplot_set_ytics (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i, j;
if (!PyArg_ParseTuple (args, "lii", &o, &i, &j))
return NULL;
fl_set_xyplot_ytics ((FL_OBJECT *) o, i, j);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_xbounds__doc__[] =
"Sets the xmin and xmax in a xyplot"
;
static PyObject *
xyplot_set_xbounds (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double u, v;
if (!PyArg_ParseTuple (args, "ldd", &o, &u, &v))
return NULL;
fl_set_xyplot_xbounds ((FL_OBJECT *) o, u, v);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_ybounds__doc__[] =
"Sets the xmin and xmax in a xyplot"
;
static PyObject *
xyplot_set_ybounds (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double u, v;
if (!PyArg_ParseTuple (args, "ldd", &o, &u, &v))
return NULL;
fl_set_xyplot_ybounds ((FL_OBJECT *) o, u, v);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_get__doc__[] =
"Gets the current value of the point that changed"
;
static PyObject *
xyplot_get (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
float x, y;
int i;
if (!PyArg_ParseTuple (args, "l", &o))
return NULL;
fl_get_xyplot ((FL_OBJECT *) o, &x, &y, &i);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_get_data__doc__[] =
""
;
static PyObject *
xyplot_get_data (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_create__doc__[] =
""
;
static PyObject *
xyplot_create (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_data__doc__[] =
""
;
static PyObject *
xyplot_set_data (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_file__doc__[] =
""
;
static PyObject *
xyplot_set_file (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_add_text__doc__[] =
""
;
static PyObject *
xyplot_add_text (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_delete_text__doc__[] =
""
;
static PyObject *
xyplot_delete_text (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_add_overlay__doc__[] =
""
;
static PyObject *
xyplot_add_overlay (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_overlay_type__doc__[] =
""
;
static PyObject *
xyplot_set_overlay_type (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_delete_overlay__doc__[] =
""
;
static PyObject *
xyplot_delete_overlay (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_interpolate__doc__[] =
""
;
static PyObject *
xyplot_set_interpolate (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_fontsize__doc__[] =
""
;
static PyObject *
xyplot_set_fontsize (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_fontstyle__doc__[] =
""
;
static PyObject *
xyplot_set_fontstyle (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_inspect__doc__[] =
""
;
static PyObject *
xyplot_set_inspect (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_symbolsize__doc__[] =
""
;
static PyObject *
xyplot_set_symbolsize (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_replace_point__doc__[] =
""
;
static PyObject *
xyplot_replace_point (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef xyplot_methods[] =
{
{"set_return", xyplot_set_return, 1, xyplot_set_return__doc__},
{"set_xtics", xyplot_set_xtics, 1, xyplot_set_xtics__doc__},
{"set_ytics", xyplot_set_ytics, 1, xyplot_set_ytics__doc__},
{"set_xbounds", xyplot_set_xbounds, 1, xyplot_set_xbounds__doc__},
{"set_ybounds", xyplot_set_ybounds, 1, xyplot_set_ybounds__doc__},
{"get", xyplot_get, 1, xyplot_get__doc__},
{"get_data", xyplot_get_data, 1, xyplot_get_data__doc__},
{"create", xyplot_create, 1, xyplot_create__doc__},
{"set_data", xyplot_set_data, 1, xyplot_set_data__doc__},
{"set_file", xyplot_set_file, 1, xyplot_set_file__doc__},
{"add_text", xyplot_add_text, 1, xyplot_add_text__doc__},
{"delete_text", xyplot_delete_text, 1, xyplot_delete_text__doc__},
{"add_overlay", xyplot_add_overlay, 1, xyplot_add_overlay__doc__},
{"set_overlay_type", xyplot_set_overlay_type, 1, xyplot_set_overlay_type__doc__},
{"delete_overlay", xyplot_delete_overlay, 1, xyplot_delete_overlay__doc__},
{"set_interpolate", xyplot_set_interpolate, 1, xyplot_set_interpolate__doc__},
{"set_fontsize", xyplot_set_fontsize, 1, xyplot_set_fontsize__doc__},
{"set_fontstyle", xyplot_set_fontstyle, 1, xyplot_set_fontstyle__doc__},
{"set_inspect", xyplot_set_inspect, 1, xyplot_set_inspect__doc__},
{"set_symbolsize", xyplot_set_symbolsize, 1, xyplot_set_symbolsize__doc__},
{"replace_point", xyplot_replace_point, 1, xyplot_replace_point__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initxyplot) */
static char xyplot_module_documentation[] =
""
;
void
initxyplot ()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4 ("xyplot", xyplot_methods,
xyplot_module_documentation,
(PyObject *) NULL, PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict (m);
ErrorObject = PyString_FromString ("xyplot.error");
PyDict_SetItemString (d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred ())
Py_FatalError ("can't initialize module xyplot");
}

739
Pyxform/__init__.py Normal file
View File

@ -0,0 +1,739 @@
##########################################################
# This is the Python interface to the pyxforms C module
#
import sys
import xforms
import forms
import objects
import bitmaps
import pixmaps
import box
import browser
import button
import choice
import clock
import counter
import dial
import frame
import input
import menu
import positioner
import slider
import timer
###############################################################################
# These are function needed to run the XForms library
# Needs a LOT of work
def xfinit (appname,appclass,argv0):
xforms.init (appname,appclass,argv0)
###############################################################################
# This is the synthetic event-loop to use under python:
_objects={}
def runforms():
while 1:
ob=_objects[str(xforms.do_forms())]
ob.cb (ob.args)
###############################################################################
# This is the default callback function:
def _nocb(args):
print "This object has no Callback!"
##############################################################################
#This is the Form class
class Form:
def __init__(self,t=6,w=200,h=200):
self.id=forms.create (0,w,h)
self.__box=Box(t,0,0,w,h,"")
self.Add (self.__box)
self.__box.c1=11
self.__box.c2=15
self.__minx=1 # Reasonable defaults for things that
self.__miny=1 # I can't get from XForms
self.__maxx=10000 # Notice that if the C code changes them
self.__maxy=10000 # They get out of sync!
self.__title=sys.argv[0] #the "preferred" form title
self.__placement=16388
self.__decoration=1
self.objs=() # A place to store the obj list. Useful?
def Show (self):
self.winid=forms.show (self.id,self.__placement,self.__decoration,self.title)
def Hide (self):
forms.hide (self.id)
def Freeze (self):
forms.freeze (self.id)
def Unfreeze (self):
forms.unfreeze (self.id)
def Activate (self):
forms.activate (self.id)
def Deactivate (self):
forms.deactivate (self.id)
def Scale (self,x,y):
forms.scale (self.id,x,y)
def Redraw (self):
forms.redraw (self.id)
def Add (self,object):
forms.add_object (self.id,object.id)
object.parent=self
def Setminsize (self,x,y):
forms.set_minsize (self.id,x,y)
self.__minx=x # The __ is needed to avoid endless looping
self.__miny=y # on min[xy], which are non-gettable from XForms
def Setmaxsize (self,x,y):
forms.set_maxsize (self.id,x,y)
self.__maxx=x
self.__maxy=y
def Settitle (self,title):
forms.set_title (self.id,title)
self.__title=title
def Gettitle (self):
if self.visible:
return forms.get_title(self.id)
else:
return self.__title
def Setcolor (c1,c2):
self.__box.Setcolor (c1,c2)
def __setattr__(self,name,value):
if name=="x":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,value,ty,tw,th)
elif name=="y":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,tx,value,tw,th)
elif name=="w":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,tx,ty,value,th)
elif name=="h":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,tx,ty,tw,value)
elif name=="dblbuffer":
forms.set_dblbuffer(self.id,value)
elif name=="frozen":
if value:
self.Freeze()
else:
self.Unfreeze()
elif name=="active":
if value:
self.Activate()
else:
self.Deactivate()
elif name=="visible":
if value:
self.Show()
else:
self.Hide()
elif name=="minx":
self.Setminsize (value,self.__miny)
elif name=="miny":
self.Setminsize (self.__minx,value)
elif name=="maxx":
self.Setminsize (value,self.__maxy)
elif name=="maxy":
self.Setminsize (self.__maxx,value)
elif name=="title":
self.Settitle (value)
elif name=="c1":
self.__box.c1=value
elif name=="c2":
self.__box.c2=value
else:
self.__dict__ [name]=value
def __getattr__(self,name):
if name=="x":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return tx
elif name=="y":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return ty
elif name=="w":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return tw
elif name=="h":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return th
elif name=="minx":
return self.__minx
elif name=="miny":
return self.__miny
elif name=="maxx":
return self.__maxx
elif name=="maxy":
return self.__maxy
elif name=="vmode":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return vmode
elif name=="active":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return active
elif name=="dblbuffer":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return dblbuffer
elif name=="frozen":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return frozen
elif name=="visible":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return visible
elif name=="border":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return border
elif name=="other":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return other
elif name=="title":
return self.Gettitle ()
elif name=="c1":
return self.__box.c1
elif name=="c2":
return self.__box.c2
def __del__(self):
pass
#I'm not sure if this is a nice thing to do
# forms.free (self.id)
###############################################################################
#This is the XFObject class, for generic XForms objects
class XFObject:
def __init__ (self):
self.id=0
self.__c1=11
self.__c2=15
def Setgravity (self,a,b):
objects.set_gravity (self.id,a,b)
def Redraw (self):
objects.redraw (self.id)
def Scale (self,x,y):
objects.scale (self.id,x,y)
def Show (self):
objects.show (self.id)
self.Setcolor (self.__c1,self.__c2)
def Hide (self):
objects.hide (self.id)
def Delete(self):
objects.delete (self.id)
def Setcolor (self,c1,c2):
self.__c1=c1
self.__c2=c2
objects.set_color (self.id,c1,c2)
def Activate (self):
objects.activate (self.id)
def Deactivate (self):
objects.deactivate (self.id)
def __setattr__ (self,name,value):
if name=="boxtype":
objects.set_boxtype (self.id,value)
elif name=="bw":
objects.set_bw (self.id,value)
elif name=="labelsize":
objects.set_ls (self.id,value)
elif name=="labelstyle":
objects.set_lstyle (self.id,value)
elif name=="labelcolor":
objects.set_lcol (self.id,value)
elif name=="labelalign":
objects.set_lalign (self.id,value)
elif name=="label":
objects.set_label (self.id,value)
elif name=="shortcut":
objects.set_shortcut (self.id,value,1)
elif name=="dblbuffer":
objects.set_dblbuffer(self.id,value)
elif name=="x":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,value,ty,tw,th)
elif name=="y":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,tx,value,tw,th)
elif name=="w":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,tx,ty,value,th)
elif name=="h":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,tx,ty,tw,value)
elif name=="resize":
objects.set_resize (self.id,value)
elif name=="c1":
self.Setcolor (value,self.__c2)
elif name=="c2":
self.Setcolor (self.__c1,value)
else:
self.__dict__ [name]=value
def __getattr__(self,name):
if name=="c1":
return self.__c1
elif name=="c2":
return self.__c2
def __del__ (self):
#probably a BAD idea
objects.free(self.id)
###############################################################################
# The Bitmap Class
class Bitmap(XFObject):
def __init__(self,t=0,x=10,y=10,w=100,h=100,l="Bitmap"):
XFObject.__init__ (self)
self.id=bitmaps.create(t,x,y,w,h,l)
def Load (self,file):
bitmaps.set_file (self.id,file)
def __setattr__ (self,name,value):
if name=="background":
objects.set_color(self.id,value,0)
elif name=="foreground":
objects.set_lcol(self.id,value)
else:
XFObject.__setattr__(self,name,value)
###############################################################################
# The Pixmap Class
class Pixmap(XFObject):
def __init__(self,t=0,x=10,y=10,w=100,h=100,l="Pixmap"):
XFObject.__init__ (self)
self.id=pixmaps.create(t,x,y,w,h,l)
def Load (self,file):
pixmaps.set_file (self.id,file)
def __setattr__ (self,name,value):
if name=="background":
objects.set_color(self.id,value,0)
elif name=="foreground":
objects.set_lcol(self.id,value)
else:
XFObject.__setattr__(self,name,value)
###############################################################################
# The Box Class
class Box(XFObject):
def __init__(self,t=6,x=10,y=10,w=90,h=90,l="Box"):
XFObject.__init__ (self)
self.id=box.create(t,x,y,w,h,l)
###############################################################################
# The Browser class
#
# I want the Browser class to act just like what it is: a list
# only with a "few" more methods and stuff
class Browser (XFObject):
def __init__(self,t=1,x=10,y=10,w=90,h=120,l="Browser"):
XFObject.__init__ (self)
self.id=browser.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Add(self,line):
browser.add_line (self.id,line)
def Addto(self,line):
browser.addto (self.id,line)
def Insert(self,n,line):
browser.insert_line(self.id,n,line)
def Delete(self,n):
browser.delete_line(self.id,n)
def Replace(self,n,line):
browser.replace_line(self.id,n,line)
def Getline(self,n):
return browser.get_line (self.id,n)
def Load(self,path):
return browser.load (self.id,path)
def Select(self,n):
browser.select_line (self.id,n)
def Deselect(self,n):
browser.deselect_line (self.id,n)
def Deselectall(self):
browser.deselect(self.id)
def Isselected(self,n):
return browser.isselected_line(self.id,n)
def Gettopline(self):
return browser.get_topline(self.id)
def Get(self):
return browser.get(self.id)
def Getmaxline(self):
return browser.get_maxline(self.id)
def Screenlines(self):
return browser.get_screenlines(self.id)
def Settopline(self,n):
browser.set_topline(self.id,n)
def Setfontsize(self,n):
browser.set_fontsize(self.id,n)
def Setfontstyle(self,n):
browser.set_fontstyle(self.id,n)
def Setspecialkey(self,c):
browser.set_specialkey(self.id,c)
def Setleftslider(self,l):
browser.set_leftslider(self.id,l)
def __setattr__ (self,name,value):
if name=="leftslider":
self.Setleftslider(value)
elif name=="specialkey":
self.Setspecialkey(value)
elif name=="fontstyle":
self.Setfontstyle(value)
elif name=="fontsize":
self.Setfontsize(value)
elif name=="topline":
self.Settopline(value)
else:
XFObject.__setattr__(self,name,value)
###############################################################################
#This is the Button class.
class Button(XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Button"):
XFObject.__init__ (self)
self.id=button.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def __call__(self,v=-1):
# I think this is nice: if you have a button called b,
# b() returns the button's value
# b(1) or b(0) SETS the button value.
# You can also set/get it with b.value, though
if v==-1:
return button.get(self.id)
else:
button.set (self.id,v)
def __setattr__ (self,name,value):
if name=="value":
self(value)
else:
XFObject.__setattr__(self,name,value)
def __getattr__ (self,name):
if name=="value":
return self()
elif name=="numb":
return button.get_numb (self.id)
pass
else:
return XFObject.__getattr__(self,name)
###############################################################################
# This is the Roundbutton class
class Roundbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Roundbutton"):
XFObject.__init__ (self)
self.id=button.create_round(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Lightbutton class
class Lightbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Lightbutton"):
XFObject.__init__ (self)
self.id=button.create_light(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Checkbutton class
class Checkbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Checkbutton"):
XFObject.__init__ (self)
self.id=button.create_check(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Bitmapbutton class
class Bitmapbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Bitmapbutton"):
XFObject.__init__ (self)
self.id=button.create_bitmap(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Pixmapbutton class
class Pixmapbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Pixmapbutton"):
XFObject.__init__ (self)
self.id=button.create_pixmap(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Choice Class
#This one needs a getattr, setattr pair
class Choice (XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Choice"):
XFObject.__init__ (self)
self.id=choice.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Clear (self):
choice.clear(self.id)
def Addto (self,s):
choice.addto(self.id,s)
def Replace (self,n,s):
choice.replace(self.id,n,s)
def Delete (self,n):
choice.delete(self.id,n)
def Set (self,n):
choice.set(self.id,n)
def Settext (self,s):
choice.set_text (self.id,s)
def Get (self):
return choice.get (self.id)
def Getmaxitems (self):
return choice.get_maxitems (self.id)
def Gettext (self):
return choice.get_text (self.id)
def Setfontsize (self,n):
choice.set_fontsize(self.id,n)
def Setalign (self,n):
choice.set_align (self.id,n)
def Setmode (self,n,m):
choice.set_item_mode (self.id,n,m)
##############################################################################
# This is the clock class
class Clock (XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=90,l="Clock"):
XFObject.__init__ (self)
self.id=clock.create(t,x,y,w,h,l)
def Get (self):
return clock.get (self.id)
##############################################################################
# This is the counter class
class Counter (XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Counter"):
XFObject.__init__ (self)
self.id=counter.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,v):
counter.set_value (self.id,v)
def Setbounds (self,min,max):
counter.set_bounds (self.id,min,max)
def Setstep (self,s1,s2):
counter.set_step (self.id,s1,s2)
def Setprecision (self,p):
counter.set_precision (self.id,p)
def Get (self):
return counter.get_value (self.id)
def Setreturn (self,v):
counter.set_return (self.id,v)
##############################################################################
# This is the Dial class
class Dial (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=60,l="Dial"):
XFObject.__init__ (self)
self.id=dial.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,v):
dial.set_value(self.id,v)
def Get (self):
return dial.get_value (self.id)
def Setbounds (self,min,max):
dial.set_bounds (self.id,min,max)
def Getbounds (self):
return dial.get_bounds (self.id)
def Setstep (self,v):
dial.set_step (self.id,v)
def Setreturn (self,v):
dial.set_return (self.id,v)
###############################################################################
# This is the Frame class
class Frame (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=60,l="Frame"):
XFObject.__init__ (self)
self.id=frame.create(t,x,y,w,h,l)
###############################################################################
# This is the Input class
class Input (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Input"):
XFObject.__init__ (self)
self.id=input.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,s):
input.set (self.id,s)
def Setcolor (self,c1,c2):
input.set_color (self.id,c1,c2)
def Get (self):
return input.get(self.id)
def Setreturn (self,v):
input.set_return (self.id,v)
def Setscroll (self,v):
input.set_scroll (self.id,v)
def Setcursorpos (self,x,y=1):
input.set_cursorpos (self.id,x,y)
def Setselected (self,v):
input.set_selected (self.id,v)
def Setselectedrange (self,x1,x2):
input.set_selected_range (self.id,x1,x2)
def __setattr__ (self,name,value):
if name=="value":
self.Set(value)
else:
XFObject.__setattr__(self,name,value)
def __getattr__ (self,name):
if name=="value":
return self.Get()
else:
return XFObject.__getattr__(self,name)
###############################################################################
# This is the Menu class
class Menu (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Menu"):
XFObject.__init__ (self)
self.id=menu.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Clear (self):
menu.clear (self.id)
def Set (self,s):
menu.set (self.id,s)
def Addto (self,s):
menu.addto(self.id,s)
def Replace (self,n,s):
menu.replace_item (self.id,n,s)
def Delete (self,n):
menu.delete_item (self.id,n)
def Setshortcut (self,n,s):
menu.set_item_shortcut (self.id,n,s)
def Setmode (self,n,m):
menu.set_item_mode (self.id,n,m)
def Showsymbol (self,n):
menu.show_symbol (self.id,n)
def Get (self):
return menu.get (self.id)
def Getmaxitems (self):
return menu.get_maxitems (self.id)
def Gettext (self):
return menu.get_text (self.id)
###############################################################################
# This is the Positioner class
class Positioner (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=60,l="Positioner"):
XFObject.__init__ (self)
self.id=positioner.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Setx (self,v):
positioner.set_xvalue (self.id,v)
def Sety (self,v):
positioner.set_yvalue (self.id,v)
def Setxbounds (self,x1,x2):
positioner.set_xbounds (self.id,x1,x2)
def Setybounds (self,y1,y2):
positioner.set_ybounds (self.id,y1,y2)
def Setxstep (self,v):
positioner.set_xstep (self.id,v)
def Setystep (self,v):
positioner.set_ystep (self.id,v)
def Getx (self):
return positioner.get_xvalue (self.id)
def Gety (self):
return positioner.get_yvalue (self.id)
def Getxbounds (self):
positioner.get_xbounds (self.id)
def Getybounds (self):
positioner.get_ybounds (self.id)
def Setreturn (self,v):
positioner.set_return (self.id,v)
###############################################################################
# This is the Slider class
class Slider (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Slider"):
XFObject.__init__ (self)
self.id=slider.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Get (self):
return slider.get_value (self.id)
def Set (self,v):
slider.set_value(self.id,v)
def Getbounds (self):
return slider.get_bounds (self.id)
def Setbounds (self,v1,v2):
slider.set_bounds(self.id,v1,v2)
def Setreturn (self,v):
slider.set_return (self.id,v)
def Setstep (self,v):
slider.set_step (self.id,v)
def Setsize (self,v):
slider.set_size (self.id,v)
###############################################################################
# This is the Valslider class
class Valslider (Slider):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Valslider"):
XFObject.__init__ (self)
self.id=slider.create_val(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Setprecision (self,v):
slider.set_precision (self.id,v)
##############################################################################
# This is the Timer class
class Timer (XFObject):
def __init__(self,t=1,x=10,y=10,w=60,h=30,l="Timer"):
XFObject.__init__ (self)
self.id=timer.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,v):
timer.set(self.id,v)
def Get (self):
return timer.get (self.id)