From 1fbf26be167a9188c45322ed9ece04af54708d2a Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 10 Sep 2004 21:42:34 +0000 Subject: [PATCH] reSWIGged git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29088 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/gtk/_controls.py | 4 +++ wxPython/src/gtk/_controls_wrap.cpp | 27 ++++++++++++++++ wxPython/src/gtk/_core.py | 2 +- wxPython/src/gtk/_core_wrap.cpp | 16 ++++++--- wxPython/src/gtk/calendar.py | 50 +++++++++++++++++++++++++++++ wxPython/src/msw/_controls.py | 4 +++ wxPython/src/msw/_controls_wrap.cpp | 27 ++++++++++++++++ wxPython/src/msw/_core.py | 2 +- wxPython/src/msw/_core_wrap.cpp | 16 ++++++--- wxPython/src/msw/calendar.py | 50 +++++++++++++++++++++++++++++ 10 files changed, 186 insertions(+), 12 deletions(-) diff --git a/wxPython/src/gtk/_controls.py b/wxPython/src/gtk/_controls.py index 69514ff5ec..961b0d9868 100644 --- a/wxPython/src/gtk/_controls.py +++ b/wxPython/src/gtk/_controls.py @@ -3138,6 +3138,10 @@ class Listbook(BookCtrl): """IsVertical(self) -> bool""" return _controls_.Listbook_IsVertical(*args, **kwargs) + def GetListView(*args, **kwargs): + """GetListView(self) -> ListView""" + return _controls_.Listbook_GetListView(*args, **kwargs) + class ListbookPtr(Listbook): def __init__(self, this): diff --git a/wxPython/src/gtk/_controls_wrap.cpp b/wxPython/src/gtk/_controls_wrap.cpp index 39fe6258d6..6c92f57d8b 100644 --- a/wxPython/src/gtk/_controls_wrap.cpp +++ b/wxPython/src/gtk/_controls_wrap.cpp @@ -15768,6 +15768,32 @@ static PyObject *_wrap_Listbook_IsVertical(PyObject *, PyObject *args, PyObject } +static PyObject *_wrap_Listbook_GetListView(PyObject *, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + wxListbook *arg1 = (wxListbook *) 0 ; + wxListView *result; + PyObject * obj0 = 0 ; + char *kwnames[] = { + (char *) "self", NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:Listbook_GetListView",kwnames,&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxListbook, + SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = (wxListView *)(arg1)->GetListView(); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = SWIG_NewPointerObj((void*)(result), SWIGTYPE_p_wxListView, 0); + return resultobj; + fail: + return NULL; +} + + static PyObject * Listbook_swigregister(PyObject *, PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; @@ -31711,6 +31737,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"new_PreListbook", (PyCFunction) _wrap_new_PreListbook, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Listbook_Create", (PyCFunction) _wrap_Listbook_Create, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Listbook_IsVertical", (PyCFunction) _wrap_Listbook_IsVertical, METH_VARARGS | METH_KEYWORDS, NULL }, + { (char *)"Listbook_GetListView", (PyCFunction) _wrap_Listbook_GetListView, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Listbook_swigregister", Listbook_swigregister, METH_VARARGS, NULL }, { (char *)"new_ListbookEvent", (PyCFunction) _wrap_new_ListbookEvent, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"ListbookEvent_swigregister", ListbookEvent_swigregister, METH_VARARGS, NULL }, diff --git a/wxPython/src/gtk/_core.py b/wxPython/src/gtk/_core.py index 76190484cf..7e40ca8240 100644 --- a/wxPython/src/gtk/_core.py +++ b/wxPython/src/gtk/_core.py @@ -2304,7 +2304,7 @@ class Image(Object): GetImageExtWildcard = staticmethod(GetImageExtWildcard) def ConvertToBitmap(*args, **kwargs): - """ConvertToBitmap(self) -> Bitmap""" + """ConvertToBitmap(self, int depth=-1) -> Bitmap""" return _core_.Image_ConvertToBitmap(*args, **kwargs) def ConvertToMonoBitmap(*args, **kwargs): diff --git a/wxPython/src/gtk/_core_wrap.cpp b/wxPython/src/gtk/_core_wrap.cpp index b8fef9f305..81d329267c 100644 --- a/wxPython/src/gtk/_core_wrap.cpp +++ b/wxPython/src/gtk/_core_wrap.cpp @@ -1367,8 +1367,8 @@ SWIG_Check_unsigned_SS_long(PyObject* obj) return SWIG_AsVal_unsigned_SS_long(obj, (unsigned long*)0); } -wxBitmap wxImage_ConvertToBitmap(wxImage *self){ - wxBitmap bitmap(*self); +wxBitmap wxImage_ConvertToBitmap(wxImage *self,int depth){ + wxBitmap bitmap(*self, depth); return bitmap; } wxBitmap wxImage_ConvertToMonoBitmap(wxImage *self,unsigned char red,unsigned char green,unsigned char blue){ @@ -11487,19 +11487,25 @@ static PyObject *_wrap_Image_GetImageExtWildcard(PyObject *, PyObject *args, PyO static PyObject *_wrap_Image_ConvertToBitmap(PyObject *, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxImage *arg1 = (wxImage *) 0 ; + int arg2 = (int) -1 ; wxBitmap result; PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; char *kwnames[] = { - (char *) "self", NULL + (char *) "self",(char *) "depth", NULL }; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:Image_ConvertToBitmap",kwnames,&obj0)) goto fail; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:Image_ConvertToBitmap",kwnames,&obj0,&obj1)) goto fail; if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxImage, SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; + if (obj1) { + arg2 = (int)SWIG_As_int(obj1); + if (PyErr_Occurred()) SWIG_fail; + } { if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = wxImage_ConvertToBitmap(arg1); + result = wxImage_ConvertToBitmap(arg1,arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; diff --git a/wxPython/src/gtk/calendar.py b/wxPython/src/gtk/calendar.py index 8680354bb4..64a43d13f8 100644 --- a/wxPython/src/gtk/calendar.py +++ b/wxPython/src/gtk/calendar.py @@ -147,6 +147,14 @@ class CalendarEvent(_core.CommandEvent): """GetWeekDay(self) -> int""" return _calendar.CalendarEvent_GetWeekDay(*args, **kwargs) + def PySetDate(self, date): + """takes datetime.datetime or datetime.date object""" + self.SetDate(_py2wx(date)) + + def PyGetDate(self): + """returns datetime.date object""" + return _wx2py(self.GetDate()) + class CalendarEventPtr(CalendarEvent): def __init__(self, this): @@ -466,6 +474,35 @@ class CalendarCtrl(_core.Control): return _calendar.CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs) GetClassDefaultAttributes = staticmethod(GetClassDefaultAttributes) + def PySetDate(self, date): + """takes datetime.datetime or datetime.date object""" + self.SetDate(_py2wx(date)) + + def PyGetDate(self): + """returns datetime.date object""" + return _wx2py(self.GetDate()) + + def PySetLowerDateLimit(self, date): + """takes datetime.datetime or datetime.date object""" + self.SetLowerDateLimit(_py2wx(date)) + + def PySetUpperDateLimit(self, date): + """takes datetime.datetime or datetime.date object""" + self.SetUpperDateLimit(_py2wx(date)) + + def PySetDateRange(self, lowerdate, upperdate): + """takes datetime.datetime or datetime.date objects""" + self.PySetLowerDateLimit(lowerdate) + self.PySetUpperDateLimit(upperdate) + + def PyGetLowerDateLimit(self): + """returns datetime.date object""" + return _wx2py(self.GetLowerDateLimit()) + + def PyGetUpperDateLimit(self): + """returns datetime.date object""" + return _wx2py(self.GetUpperDateLimit()) + class CalendarCtrlPtr(CalendarCtrl): def __init__(self, this): @@ -503,4 +540,17 @@ def CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs): """ return _calendar.CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs) +def _py2wx(date): + import datetime + assert isinstance(date, (datetime.datetime, datetime.date)) + tt = date.timetuple() + dmy = (tt[2], tt[1]-1, tt[0]) + return wx.DateTimeFromDMY(*dmy) + +def _wx2py(date): + import datetime + assert isinstance(date, wx.DateTime) + ymd = map(int, date.FormatISODate().split('-')) + return datetime.date(*ymd) + diff --git a/wxPython/src/msw/_controls.py b/wxPython/src/msw/_controls.py index 2f9bba1b8c..7aed3d7d7b 100644 --- a/wxPython/src/msw/_controls.py +++ b/wxPython/src/msw/_controls.py @@ -3150,6 +3150,10 @@ class Listbook(BookCtrl): """IsVertical(self) -> bool""" return _controls_.Listbook_IsVertical(*args, **kwargs) + def GetListView(*args, **kwargs): + """GetListView(self) -> ListView""" + return _controls_.Listbook_GetListView(*args, **kwargs) + class ListbookPtr(Listbook): def __init__(self, this): diff --git a/wxPython/src/msw/_controls_wrap.cpp b/wxPython/src/msw/_controls_wrap.cpp index a06f7a3426..91b8aa4d9e 100644 --- a/wxPython/src/msw/_controls_wrap.cpp +++ b/wxPython/src/msw/_controls_wrap.cpp @@ -15863,6 +15863,32 @@ static PyObject *_wrap_Listbook_IsVertical(PyObject *, PyObject *args, PyObject } +static PyObject *_wrap_Listbook_GetListView(PyObject *, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + wxListbook *arg1 = (wxListbook *) 0 ; + wxListView *result; + PyObject * obj0 = 0 ; + char *kwnames[] = { + (char *) "self", NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:Listbook_GetListView",kwnames,&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxListbook, + SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = (wxListView *)(arg1)->GetListView(); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = SWIG_NewPointerObj((void*)(result), SWIGTYPE_p_wxListView, 0); + return resultobj; + fail: + return NULL; +} + + static PyObject * Listbook_swigregister(PyObject *, PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; @@ -31990,6 +32016,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"new_PreListbook", (PyCFunction) _wrap_new_PreListbook, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Listbook_Create", (PyCFunction) _wrap_Listbook_Create, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Listbook_IsVertical", (PyCFunction) _wrap_Listbook_IsVertical, METH_VARARGS | METH_KEYWORDS, NULL }, + { (char *)"Listbook_GetListView", (PyCFunction) _wrap_Listbook_GetListView, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"Listbook_swigregister", Listbook_swigregister, METH_VARARGS, NULL }, { (char *)"new_ListbookEvent", (PyCFunction) _wrap_new_ListbookEvent, METH_VARARGS | METH_KEYWORDS, NULL }, { (char *)"ListbookEvent_swigregister", ListbookEvent_swigregister, METH_VARARGS, NULL }, diff --git a/wxPython/src/msw/_core.py b/wxPython/src/msw/_core.py index cb05e66b3c..ccf6b4608d 100644 --- a/wxPython/src/msw/_core.py +++ b/wxPython/src/msw/_core.py @@ -2304,7 +2304,7 @@ class Image(Object): GetImageExtWildcard = staticmethod(GetImageExtWildcard) def ConvertToBitmap(*args, **kwargs): - """ConvertToBitmap(self) -> Bitmap""" + """ConvertToBitmap(self, int depth=-1) -> Bitmap""" return _core_.Image_ConvertToBitmap(*args, **kwargs) def ConvertToMonoBitmap(*args, **kwargs): diff --git a/wxPython/src/msw/_core_wrap.cpp b/wxPython/src/msw/_core_wrap.cpp index 45ec873828..aa1fa209ce 100644 --- a/wxPython/src/msw/_core_wrap.cpp +++ b/wxPython/src/msw/_core_wrap.cpp @@ -1367,8 +1367,8 @@ SWIG_Check_unsigned_SS_long(PyObject* obj) return SWIG_AsVal_unsigned_SS_long(obj, (unsigned long*)0); } -wxBitmap wxImage_ConvertToBitmap(wxImage *self){ - wxBitmap bitmap(*self); +wxBitmap wxImage_ConvertToBitmap(wxImage *self,int depth){ + wxBitmap bitmap(*self, depth); return bitmap; } wxBitmap wxImage_ConvertToMonoBitmap(wxImage *self,unsigned char red,unsigned char green,unsigned char blue){ @@ -11485,19 +11485,25 @@ static PyObject *_wrap_Image_GetImageExtWildcard(PyObject *, PyObject *args, PyO static PyObject *_wrap_Image_ConvertToBitmap(PyObject *, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxImage *arg1 = (wxImage *) 0 ; + int arg2 = (int) -1 ; wxBitmap result; PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; char *kwnames[] = { - (char *) "self", NULL + (char *) "self",(char *) "depth", NULL }; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:Image_ConvertToBitmap",kwnames,&obj0)) goto fail; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:Image_ConvertToBitmap",kwnames,&obj0,&obj1)) goto fail; if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxImage, SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; + if (obj1) { + arg2 = (int)SWIG_As_int(obj1); + if (PyErr_Occurred()) SWIG_fail; + } { if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = wxImage_ConvertToBitmap(arg1); + result = wxImage_ConvertToBitmap(arg1,arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; diff --git a/wxPython/src/msw/calendar.py b/wxPython/src/msw/calendar.py index 8680354bb4..64a43d13f8 100644 --- a/wxPython/src/msw/calendar.py +++ b/wxPython/src/msw/calendar.py @@ -147,6 +147,14 @@ class CalendarEvent(_core.CommandEvent): """GetWeekDay(self) -> int""" return _calendar.CalendarEvent_GetWeekDay(*args, **kwargs) + def PySetDate(self, date): + """takes datetime.datetime or datetime.date object""" + self.SetDate(_py2wx(date)) + + def PyGetDate(self): + """returns datetime.date object""" + return _wx2py(self.GetDate()) + class CalendarEventPtr(CalendarEvent): def __init__(self, this): @@ -466,6 +474,35 @@ class CalendarCtrl(_core.Control): return _calendar.CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs) GetClassDefaultAttributes = staticmethod(GetClassDefaultAttributes) + def PySetDate(self, date): + """takes datetime.datetime or datetime.date object""" + self.SetDate(_py2wx(date)) + + def PyGetDate(self): + """returns datetime.date object""" + return _wx2py(self.GetDate()) + + def PySetLowerDateLimit(self, date): + """takes datetime.datetime or datetime.date object""" + self.SetLowerDateLimit(_py2wx(date)) + + def PySetUpperDateLimit(self, date): + """takes datetime.datetime or datetime.date object""" + self.SetUpperDateLimit(_py2wx(date)) + + def PySetDateRange(self, lowerdate, upperdate): + """takes datetime.datetime or datetime.date objects""" + self.PySetLowerDateLimit(lowerdate) + self.PySetUpperDateLimit(upperdate) + + def PyGetLowerDateLimit(self): + """returns datetime.date object""" + return _wx2py(self.GetLowerDateLimit()) + + def PyGetUpperDateLimit(self): + """returns datetime.date object""" + return _wx2py(self.GetUpperDateLimit()) + class CalendarCtrlPtr(CalendarCtrl): def __init__(self, this): @@ -503,4 +540,17 @@ def CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs): """ return _calendar.CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs) +def _py2wx(date): + import datetime + assert isinstance(date, (datetime.datetime, datetime.date)) + tt = date.timetuple() + dmy = (tt[2], tt[1]-1, tt[0]) + return wx.DateTimeFromDMY(*dmy) + +def _wx2py(date): + import datetime + assert isinstance(date, wx.DateTime) + ymd = map(int, date.FormatISODate().split('-')) + return datetime.date(*ymd) +