]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/gtk/grid_wrap.cpp
undid one of the last SWIG tweaks
[wxWidgets.git] / wxPython / src / gtk / grid_wrap.cpp
index d2c0dc7ad5b0a858fc3307f4939e099bd7be891c..d76412fb92fc29caf6aa68a7102d5f94d3b7fe8f 100644 (file)
@@ -814,7 +814,15 @@ SWIG_CheckLongInRange(long value, const char* type,
 SWIGSTATICINLINE(long)
 SWIG_AsLong(PyObject * obj)
 {
-  return PyInt_Check(obj) ? PyInt_AsLong(obj) : PyLong_AsLong(obj);
+    if (PyNumber_Check(obj))
+        return PyInt_AsLong(obj);
+    else {
+        PyObject* errmsg = PyString_FromFormat("Expected number, got %s",
+                                               obj->ob_type->tp_name);
+        PyErr_SetObject(PyExc_TypeError, errmsg);
+        Py_DECREF(errmsg);
+        return 0;
+    }
 }
 
 
@@ -1127,9 +1135,9 @@ SWIG_AsUnsignedLong(PyObject * obj)
   if (PyLong_Check(obj)) {
     return PyLong_AsUnsignedLong(obj);
   } else {
-    long i = PyInt_AsLong(obj);
+    long i = SWIG_AsLong(obj);
     if ( !PyErr_Occurred() && (i < 0)) {
-      PyErr_SetString(PyExc_TypeError, "negative value for unsigned type");
+      PyErr_SetString(PyExc_TypeError, "negative value received for unsigned type");
     }
     return i;
   }
@@ -1182,17 +1190,15 @@ SWIG_CheckLong(PyObject* obj)
 SWIGSTATICINLINE(double)
 SWIG_AsDouble(PyObject *obj)
 {
-  double val = (PyFloat_Check(obj)) ? PyFloat_AsDouble(obj) :
-#if HAVE_LONG_LONG
-    ((PyInt_Check(obj)) ? PyInt_AsLong(obj) : PyLong_AsLongLong(obj));
-#else
-    ((PyInt_Check(obj)) ? PyInt_AsLong(obj) : PyLong_AsLong(obj));
-#endif
-  if (PyErr_Occurred()) {
-    PyErr_Clear();
-    PyErr_SetString(PyExc_TypeError, "a double is expected");
-  }
-  return val;
+    if (PyNumber_Check(obj))
+        return PyFloat_AsDouble(obj);
+    else {
+        PyObject* errmsg = PyString_FromFormat("Expected number, got %s",
+                                               obj->ob_type->tp_name);
+        PyErr_SetObject(PyExc_TypeError, errmsg);
+        Py_DECREF(errmsg);
+        return 0;
+    }
 }
 
 
@@ -3410,15 +3416,27 @@ static PyObject * GridCellNumberEditor_swigregister(PyObject *self, PyObject *ar
 }
 static PyObject *_wrap_new_GridCellFloatEditor(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject *resultobj;
+    int arg1 = (int) -1 ;
+    int arg2 = (int) -1 ;
     wxGridCellFloatEditor *result;
+    PyObject * obj0 = 0 ;
+    PyObject * obj1 = 0 ;
     char *kwnames[] = {
-        NULL 
+        (char *) "width",(char *) "precision", NULL 
     };
     
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)":new_GridCellFloatEditor",kwnames)) goto fail;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:new_GridCellFloatEditor",kwnames,&obj0,&obj1)) goto fail;
+    if (obj0) {
+        arg1 = (int) SWIG_AsInt(obj0); 
+        if (PyErr_Occurred()) SWIG_fail;
+    }
+    if (obj1) {
+        arg2 = (int) SWIG_AsInt(obj1); 
+        if (PyErr_Occurred()) SWIG_fail;
+    }
     {
         PyThreadState* __tstate = wxPyBeginAllowThreads();
-        result = (wxGridCellFloatEditor *)new wxGridCellFloatEditor();
+        result = (wxGridCellFloatEditor *)new wxGridCellFloatEditor(arg1,arg2);
         
         wxPyEndAllowThreads(__tstate);
         if (PyErr_Occurred()) SWIG_fail;
@@ -8776,6 +8794,7 @@ static PyObject *_wrap_Grid_GetTextBoxSize(PyObject *self, PyObject *args, PyObj
 #else
             PyObject* str  = PyObject_Str(item);
 #endif
+            if (PyErr_Occurred())  SWIG_fail;
             arg3->Add(Py2wxString(str));
             Py_DECREF(item);
             Py_DECREF(str);