]> git.saurik.com Git - wxWidgets.git/commitdiff
Some more tweaks
authorRobin Dunn <robin@alldunn.com>
Sun, 20 May 2001 02:00:31 +0000 (02:00 +0000)
committerRobin Dunn <robin@alldunn.com>
Sun, 20 May 2001 02:00:31 +0000 (02:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/demo/wxJoystick.py
wxPython/src/gtk/misc2.cpp
wxPython/src/gtk/misc2.py
wxPython/src/gtk/wx.py

index df61d1db1a914543c6f3c377cacacbb949871709..7bdf8391fe4969839363620ef823cf4ca3db6940 100644 (file)
@@ -13,9 +13,13 @@ class JoystickTestPanel(wxPanel):
 
         MakeJoystickTestPanel( self, true )
 
-        self.stick = wxJoystick()
-        self.stick.SetCapture(self)
-        EVT_JOYSTICK_EVENTS(self, self.OnJoystick)
+        try:
+            self.stick = wxJoystick()
+            self.stick.SetCapture(self)
+            EVT_JOYSTICK_EVENTS(self, self.OnJoystick)
+            self.UpdateFields()
+        except NotImplementedError, v:
+            wxMessageBox(str(v), "Exception Message")
 
 
     def UpdateFields(self):
index 489ce566d0e3ac330de93915158a6a61630e3877..9c81a605cb0a12c1d545494d48e6800649ed9879 100644 (file)
@@ -5671,6 +5671,33 @@ static PyObject *_wrap_new_wxJoystick(PyObject *self, PyObject *args, PyObject *
     return _resultobj;
 }
 
+#define delete_wxJoystick(_swigobj) (delete _swigobj)
+static PyObject *_wrap_delete_wxJoystick(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxJoystick * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxJoystick",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxJoystick_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxJoystick. Expected _wxJoystick_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        delete_wxJoystick(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
 #define wxJoystick_GetPosition(_swigobj)  (_swigobj->GetPosition())
 static PyObject *_wrap_wxJoystick_GetPosition(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -7017,6 +7044,7 @@ static PyMethodDef misc2cMethods[] = {
         { "wxJoystick_GetButtonState", (PyCFunction) _wrap_wxJoystick_GetButtonState, METH_VARARGS | METH_KEYWORDS },
         { "wxJoystick_GetZPosition", (PyCFunction) _wrap_wxJoystick_GetZPosition, METH_VARARGS | METH_KEYWORDS },
         { "wxJoystick_GetPosition", (PyCFunction) _wrap_wxJoystick_GetPosition, METH_VARARGS | METH_KEYWORDS },
+        { "delete_wxJoystick", (PyCFunction) _wrap_delete_wxJoystick, METH_VARARGS | METH_KEYWORDS },
         { "new_wxJoystick", (PyCFunction) _wrap_new_wxJoystick, METH_VARARGS | METH_KEYWORDS },
         { "wxProcess_CloseOutput", (PyCFunction) _wrap_wxProcess_CloseOutput, METH_VARARGS | METH_KEYWORDS },
         { "wxProcess_GetOutputStream", (PyCFunction) _wrap_wxProcess_GetOutputStream, METH_VARARGS | METH_KEYWORDS },
index 8bbd003ec34835501f12f306522c3a9b21c8c99a..dc6ed2431a57593dfd17c8fc1f58011843c7db78 100644 (file)
@@ -492,6 +492,9 @@ class wxJoystickPtr(wxObjectPtr):
     def __init__(self,this):
         self.this = this
         self.thisown = 0
+    def __del__(self,misc2c=misc2c):
+        if self.thisown == 1 :
+            misc2c.delete_wxJoystick(self)
     def GetPosition(self, *_args, **_kwargs):
         val = apply(misc2c.wxJoystick_GetPosition,(self,) + _args, _kwargs)
         if val: val = wxPointPtr(val) ; val.thisown = 1
index d010ba41d337b7fe714ac5e3cdb78881b5fda7b0..d0cfbd24f2b2f9fc6f9e092db1612c5ea22a9006 100644 (file)
@@ -1456,10 +1456,10 @@ def EVT_END_PROCESS(eh, id, func):
 
 # wxJoyStick
 def EVT_JOY_DOWN(win, func):
-    win.Connect(-1, -1, wxEVT_JOY_DOWN, func)
+    win.Connect(-1, -1, wxEVT_JOY_BUTTON_DOWN, func)
 
 def EVT_JOY_UP(win, func):
-    win.Connect(-1, -1, wxEVT_JOY_UP, func)
+    win.Connect(-1, -1, wxEVT_JOY_BUTTON_UP, func)
 
 def EVT_JOY_MOVE(win, func):
     win.Connect(-1, -1, wxEVT_JOY_MOVE, func)
@@ -1468,8 +1468,8 @@ def EVT_JOY_ZMOVE(win, func):
     win.Connect(-1, -1, wxEVT_JOY_ZMOVE, func)
 
 def EVT_JOYSTICK_EVENTS(win, func):
-    win.Connect(-1, -1, wxEVT_JOY_DOWN, func)
-    win.Connect(-1, -1, wxEVT_JOY_UP, func)
+    win.Connect(-1, -1, wxEVT_JOY_BUTTON_DOWN, func)
+    win.Connect(-1, -1, wxEVT_JOY_BUTTON_UP, func)
     win.Connect(-1, -1, wxEVT_JOY_MOVE, func)
     win.Connect(-1, -1, wxEVT_JOY_ZMOVE, func)