From: Thomas J. D. <to...@us...> - 2005-05-06 19:57:44
|
Update of /cvsroot/plplot/plplot/bindings/python/gcw In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16032 Modified Files: gcwmodule.c Log Message: Updated for consistency with revised GCW API. Index: gcwmodule.c =================================================================== RCS file: /cvsroot/plplot/plplot/bindings/python/gcw/gcwmodule.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- gcwmodule.c 4 May 2005 13:42:38 -0000 1.4 +++ gcwmodule.c 6 May 2005 19:57:35 -0000 1.5 @@ -46,7 +46,7 @@ if(!PyArg_UnpackTuple(args,"ref",1,1,&canvas_)) { PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_use_background_group: Cannot parse arguments."); + "_wrap_gcw_install_canvas: Cannot parse arguments."); return NULL; } @@ -61,41 +61,6 @@ /*-------------------------------------------------------------------------*/ -static PyObject * _wrap_gcw_set_canvas_zoom(PyObject *self, PyObject *args) -{ - /* Variables for parsing the args and converting the PyObjects */ - PyGObject *canvas_; - PyObject *zoom_; - GnomeCanvas* canvas; - PLFLT zoom; - - /* Parse the args */ - if(!PyArg_UnpackTuple(args,"ref",2,2,&canvas_,&zoom_)) - { - PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_set_canvas_zoom: Cannot parse arguments."); - return NULL; - } - - /* Convert the PyObjects */ - canvas=GNOME_CANVAS(canvas_->obj); - - if(!PyFloat_Check(zoom_)) - { - PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_set_canvas_zoom: PyFloat expected as arg 2."); - return NULL; - } - zoom=PyFloat_AsDouble(zoom_); - - /* Make the call */ - gcw_set_canvas_zoom(canvas,zoom); - - return Py_BuildValue(""); -} - -/*-------------------------------------------------------------------------*/ - static PyObject * _wrap_gcw_set_canvas_size(PyObject *self, PyObject *args) { /* Variables for parsing the args and converting the PyObjects */ @@ -118,7 +83,7 @@ if(!PyFloat_Check(width_)) { PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_set_canvas_width: PyFloat expected as arg 2."); + "_wrap_gcw_set_canvas_size: PyFloat expected as arg 2."); return NULL; } width=PyFloat_AsDouble(width_); @@ -126,7 +91,7 @@ if(!PyFloat_Check(height_)) { PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_set_canvas_height: PyFloat expected as arg 3."); + "_wrap_gcw_set_canvas_size: PyFloat expected as arg 3."); return NULL; } height=PyFloat_AsDouble(height_); @@ -139,70 +104,67 @@ /*-------------------------------------------------------------------------*/ -static PyObject * _wrap_gcw_use_text(PyObject *self, PyObject *args) +static PyObject * _wrap_gcw_set_canvas_zoom(PyObject *self, PyObject *args) { /* Variables for parsing the args and converting the PyObjects */ PyGObject *canvas_; - PyObject *use_text_; + PyObject *zoom_; GnomeCanvas* canvas; - gboolean use_text; + PLFLT zoom; /* Parse the args */ - if(!PyArg_UnpackTuple(args,"ref",2,2,&canvas_,&use_text_)) + if(!PyArg_UnpackTuple(args,"ref",2,2,&canvas_,&zoom_)) { PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_use_text: Cannot parse arguments."); + "_wrap_gcw_set_canvas_zoom: Cannot parse arguments."); return NULL; } /* Convert the PyObjects */ canvas=GNOME_CANVAS(canvas_->obj); - if(!PyInt_Check(use_text_)) + if(!PyFloat_Check(zoom_)) { PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_use_text: PyInt expected as arg 2."); + "_wrap_gcw_set_canvas_zoom: PyFloat expected as arg 2."); return NULL; } - use_text=(gboolean)PyInt_AsLong(use_text_); + zoom=PyFloat_AsDouble(zoom_); /* Make the call */ - gcw_use_text(canvas,use_text); + gcw_set_canvas_zoom(canvas,zoom); return Py_BuildValue(""); } /*-------------------------------------------------------------------------*/ -static PyObject * _wrap_gcw_use_fast_rendering(PyObject *self, PyObject *args) +static PyObject * _wrap_gcw_use_text(PyObject *self, PyObject *args) { /* Variables for parsing the args and converting the PyObjects */ - PyGObject *canvas_; - PyObject *use_fast_rendering_; - GnomeCanvas* canvas; - gboolean use_fast_rendering; + PyObject *use_text_; + gboolean use_text; /* Parse the args */ - if(!PyArg_UnpackTuple(args,"ref",2,2,&canvas_,&use_fast_rendering_)) + if(!PyArg_UnpackTuple(args,"ref",1,1,&use_text_)) { PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_use_fast_rendering: Cannot parse arguments."); + "_wrap_gcw_use_text: Cannot parse arguments."); return NULL; } /* Convert the PyObjects */ - canvas=GNOME_CANVAS(canvas_->obj); - if(!PyInt_Check(use_fast_rendering_)) + if(!PyInt_Check(use_text_)) { PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_use_fast_rendering: PyInt expected as arg 2."); + "_wrap_gcw_use_text: PyInt expected as arg 2."); return NULL; } - use_fast_rendering=(gboolean)PyInt_AsLong(use_fast_rendering_); + use_text=(gboolean)PyInt_AsLong(use_text_); /* Make the call */ - gcw_use_fast_rendering(canvas,use_fast_rendering); + gcw_use_text(use_text); return Py_BuildValue(""); } @@ -212,107 +174,61 @@ static PyObject * _wrap_gcw_use_pixmap(PyObject *self, PyObject *args) { /* Variables for parsing the args and converting the PyObjects */ - PyGObject *canvas_; PyObject *use_pixmap_; - GnomeCanvas* canvas; gboolean use_pixmap; /* Parse the args */ - if(!PyArg_UnpackTuple(args,"ref",2,2,&canvas_,&use_pixmap_)) + if(!PyArg_UnpackTuple(args,"ref",1,1,&use_pixmap_)) { PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_use_fast_rendering: Cannot parse arguments."); + "_wrap_gcw_use_pixmap: Cannot parse arguments."); return NULL; } /* Convert the PyObjects */ - canvas=GNOME_CANVAS(canvas_->obj); if(!PyInt_Check(use_pixmap_)) { PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_use_fast_rendering: PyInt expected as arg 2."); + "_wrap_gcw_use_pixmap: PyInt expected as arg 2."); return NULL; } use_pixmap=(gboolean)PyInt_AsLong(use_pixmap_); /* Make the call */ - gcw_use_pixmap(canvas,use_pixmap); - - return Py_BuildValue(""); -} - -/*-------------------------------------------------------------------------*/ - -static PyObject * _wrap_gcw_use_foreground_group(PyObject *self, PyObject *args) -{ - /* Variables for parsing the args and converting the PyObjects */ - PyGObject *canvas_; - GnomeCanvas* canvas; - - /* Parse the args */ - if(!PyArg_UnpackTuple(args,"ref",1,1,&canvas_)) - { - PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_use_foreground_group: Cannot parse arguments."); - return NULL; - } - - /* Convert the PyObjects */ - canvas=GNOME_CANVAS(canvas_->obj); - - /* Make the call */ - gcw_use_foreground_group(canvas); + gcw_use_pixmap(use_pixmap); return Py_BuildValue(""); } /*-------------------------------------------------------------------------*/ -static PyObject * _wrap_gcw_use_background_group(PyObject *self, PyObject *args) +static PyObject * _wrap_gcw_use_persistence(PyObject *self, PyObject *args) { /* Variables for parsing the args and converting the PyObjects */ - PyGObject *canvas_; - GnomeCanvas* canvas; + PyObject *use_persistence_; + gboolean use_persistence; /* Parse the args */ - if(!PyArg_UnpackTuple(args,"ref",1,1,&canvas_)) + if(!PyArg_UnpackTuple(args,"ref",1,1,&use_persistence_)) { PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_use_background_group: Cannot parse arguments."); + "_wrap_gcw_use_persistence: Cannot parse arguments."); return NULL; } /* Convert the PyObjects */ - canvas=GNOME_CANVAS(canvas_->obj); - - /* Make the call */ - gcw_use_background_group(canvas); - - return Py_BuildValue(""); -} - -/*-------------------------------------------------------------------------*/ - -static PyObject * _wrap_gcw_use_default_group(PyObject *self, PyObject *args) -{ - /* Variables for parsing the args and converting the PyObjects */ - PyGObject *canvas_; - GnomeCanvas* canvas; - /* Parse the args */ - if(!PyArg_UnpackTuple(args,"ref",1,1,&canvas_)) + if(!PyInt_Check(use_persistence_)) { PyErr_SetString(PyExc_TypeError, - "_wrap_gcw_use_default_group: Cannot parse arguments."); + "_wrap_gcw_use_persistence: PyInt expected as arg 2."); return NULL; } - - /* Convert the PyObjects */ - canvas=GNOME_CANVAS(canvas_->obj); + use_persistence=(gboolean)PyInt_AsLong(use_persistence_); /* Make the call */ - gcw_use_default_group(canvas); + gcw_use_persistence(use_persistence); return Py_BuildValue(""); } @@ -322,15 +238,11 @@ /* Method table mapping names to wrappers */ static PyMethodDef gcwmoduleMethods[]= { - { "install_canvas", _wrap_gcw_install_canvas, METH_VARARGS }, - { "set_canvas_zoom", _wrap_gcw_set_canvas_zoom, METH_VARARGS }, { "set_canvas_size", _wrap_gcw_set_canvas_size, METH_VARARGS }, + { "set_canvas_zoom", _wrap_gcw_set_canvas_zoom, METH_VARARGS }, { "use_text", _wrap_gcw_use_text, METH_VARARGS }, - { "use_fast_rendering", _wrap_gcw_use_fast_rendering, METH_VARARGS }, { "use_pixmap", _wrap_gcw_use_pixmap, METH_VARARGS }, - { "use_foreground_group", _wrap_gcw_use_foreground_group, METH_VARARGS }, - { "use_background_group", _wrap_gcw_use_background_group, METH_VARARGS }, - { "use_default_group", _wrap_gcw_use_default_group, METH_VARARGS }, + { "use_persistence", _wrap_gcw_use_persistence, METH_VARARGS }, { NULL, NULL } }; |