From 7722248d7510121367c9d4db7af1156197c26e82 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 21 Nov 2003 07:39:05 +0000 Subject: [PATCH] Lots of bup fixes, API updates, etc git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24621 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/include/wx/wxPython/pyclasses.h | 58 ++++++ wxPython/include/wx/wxPython/pydrawxxx.h | 2 + wxPython/include/wx/wxPython/wxPython_int.h | 1 + wxPython/src/_calendar_reverse.txt | 3 + wxPython/src/_datetime.i | 5 +- wxPython/src/_dnd.i | 55 ----- wxPython/src/_statusbar.i | 10 +- wxPython/src/_timer.i | 5 +- wxPython/src/_window.i | 4 +- wxPython/src/drawlist.cpp | 40 ++-- wxPython/src/gdi.i | 5 + wxPython/src/grid.i | 4 +- wxPython/src/gtk/core.py | 4 +- wxPython/src/gtk/core_wrap.cpp | 16 +- wxPython/src/gtk/gdi_wrap.cpp | 4 + wxPython/src/gtk/grid.py | 2 +- wxPython/src/gtk/grid_wrap.cpp | 24 ++- wxPython/src/gtk/misc.py | 10 +- wxPython/src/gtk/misc_wrap.cpp | 195 ++++++++---------- wxPython/src/gtk/windows.py | 2 +- wxPython/src/gtk/windows_wrap.cpp | 26 +-- wxPython/wx/lib/colourchooser/canvas.py | 2 +- .../wx/lib/colourchooser/pycolourchooser.py | 22 +- .../wx/lib/colourchooser/pycolourslider.py | 4 +- wxPython/wx/lib/colourchooser/pypalette.py | 11 +- wxPython/wx/lib/colourdb.py | 5 +- wxPython/wx/lib/colourselect.py | 101 ++++++--- wxPython/wx/lib/editor/editor.py | 10 +- wxPython/wx/lib/floatcanvas.py | 40 ++-- wxPython/wx/lib/gridmovers.py | 20 +- wxPython/wx/lib/maskededit.py | 26 +-- wxPython/wx/lib/multisash.py | 24 +-- wxPython/wx/lib/popupctl.py | 36 ++-- wxPython/wxPython/calendar.py | 8 + .../wxPython/lib/colourchooser/__init__.py | 29 ++- wxPython/wxPython/lib/editor/__init__.py | 3 +- 36 files changed, 463 insertions(+), 353 deletions(-) create mode 100644 wxPython/src/_calendar_reverse.txt diff --git a/wxPython/include/wx/wxPython/pyclasses.h b/wxPython/include/wx/wxPython/pyclasses.h index f07a5de918..c74f8cacf9 100644 --- a/wxPython/include/wx/wxPython/pyclasses.h +++ b/wxPython/include/wx/wxPython/pyclasses.h @@ -121,6 +121,64 @@ public: }; +//--------------------------------------------------------------------------- + +class wxPyDropSource : public wxDropSource { +public: +#ifndef __WXGTK__ + wxPyDropSource(wxWindow *win = NULL, + const wxCursor © = wxNullCursor, + const wxCursor &move = wxNullCursor, + const wxCursor &none = wxNullCursor) + : wxDropSource(win, copy, move, none) {} +#else + wxPyDropSource(wxWindow *win = NULL, + const wxIcon& copy = wxNullIcon, + const wxIcon& move = wxNullIcon, + const wxIcon& none = wxNullIcon) + : wxDropSource(win, copy, move, none) {} +#endif + ~wxPyDropSource() { } + + DEC_PYCALLBACK_BOOL_DR(GiveFeedback); + PYPRIVATE; +}; + + +class wxPyDropTarget : public wxDropTarget { +public: + wxPyDropTarget(wxDataObject *dataObject = NULL) + : wxDropTarget(dataObject) {} + + // called when mouse leaves the window: might be used to remove the + // feedback which was given in OnEnter() + DEC_PYCALLBACK__(OnLeave); + + // called when the mouse enters the window (only once until OnLeave()) + DEC_PYCALLBACK_DR_2WXCDR(OnEnter); + + // called when the mouse moves in the window - shouldn't take long to + // execute or otherwise mouse movement would be too slow + DEC_PYCALLBACK_DR_2WXCDR(OnDragOver); + + // called after OnDrop() returns True: you will usually just call + // GetData() from here and, probably, also refresh something to update the + // new data and, finally, return the code indicating how did the operation + // complete (returning default value in case of success and wxDragError on + // failure is usually ok) + DEC_PYCALLBACK_DR_2WXCDR_pure(OnData); + + // this function is called when data is dropped at position (x, y) - if it + // returns True, OnData() will be called immediately afterwards which will + // allow to retrieve the data dropped. + DEC_PYCALLBACK_BOOL_INTINT(OnDrop); + + PYPRIVATE; +}; + + + + //--------------------------------------------------------------------------- class wxPyVScrolledWindow; diff --git a/wxPython/include/wx/wxPython/pydrawxxx.h b/wxPython/include/wx/wxPython/pydrawxxx.h index ccbf1353d9..c2fb136068 100644 --- a/wxPython/include/wx/wxPython/pydrawxxx.h +++ b/wxPython/include/wx/wxPython/pydrawxxx.h @@ -13,6 +13,8 @@ #ifndef __pydrawxxx_h__ #define __pydrawxxx_h__ +void wxPyDrawList_SetAPIPtr(); + typedef bool (*wxPyDrawListOp_t)(wxDC& dc, PyObject* coords); PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw, PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes); diff --git a/wxPython/include/wx/wxPython/wxPython_int.h b/wxPython/include/wx/wxPython/wxPython_int.h index caab3a9024..b4a7f84750 100644 --- a/wxPython/include/wx/wxPython/wxPython_int.h +++ b/wxPython/include/wx/wxPython/wxPython_int.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/wxPython/src/_calendar_reverse.txt b/wxPython/src/_calendar_reverse.txt new file mode 100644 index 0000000000..a8de5cfedc --- /dev/null +++ b/wxPython/src/_calendar_reverse.txt @@ -0,0 +1,3 @@ + + +EVT* diff --git a/wxPython/src/_datetime.i b/wxPython/src/_datetime.i index 1142cb30fb..6a2dfbd742 100644 --- a/wxPython/src/_datetime.i +++ b/wxPython/src/_datetime.i @@ -27,11 +27,12 @@ //--------------------------------------------------------------------------- -%typemap(in) wxDateTime::TimeZone& { +%typemap(in) wxDateTime::TimeZone& (bool temp=False) { $1 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong($input)); + temp = True; } %typemap(python,freearg) wxDateTime::TimeZone& { - if ($1) delete $1; + if (temp$argnum) delete $1; } diff --git a/wxPython/src/_dnd.i b/wxPython/src/_dnd.i index 4c99368754..8e2ce47ab7 100644 --- a/wxPython/src/_dnd.i +++ b/wxPython/src/_dnd.i @@ -16,7 +16,6 @@ //--------------------------------------------------------------------------- %{ -#include %} //--------------------------------------------------------------------------- @@ -55,29 +54,7 @@ bool wxIsDragResultOk(wxDragResult res); %{ -class wxPyDropSource : public wxDropSource { -public: -#ifndef __WXGTK__ - wxPyDropSource(wxWindow *win = NULL, - const wxCursor © = wxNullCursor, - const wxCursor &move = wxNullCursor, - const wxCursor &none = wxNullCursor) - : wxDropSource(win, copy, move, none) {} -#else - wxPyDropSource(wxWindow *win = NULL, - const wxIcon& copy = wxNullIcon, - const wxIcon& move = wxNullIcon, - const wxIcon& none = wxNullIcon) - : wxDropSource(win, copy, move, none) {} -#endif - ~wxPyDropSource() { } - - DEC_PYCALLBACK_BOOL_DR(GiveFeedback); - PYPRIVATE; -}; - IMP_PYCALLBACK_BOOL_DR(wxPyDropSource, wxDropSource, GiveFeedback); - %} @@ -133,43 +110,11 @@ public: %{ -class wxPyDropTarget : public wxDropTarget { -public: - wxPyDropTarget(wxDataObject *dataObject = NULL) - : wxDropTarget(dataObject) {} - - // called when mouse leaves the window: might be used to remove the - // feedback which was given in OnEnter() - DEC_PYCALLBACK__(OnLeave); - - // called when the mouse enters the window (only once until OnLeave()) - DEC_PYCALLBACK_DR_2WXCDR(OnEnter); - - // called when the mouse moves in the window - shouldn't take long to - // execute or otherwise mouse movement would be too slow - DEC_PYCALLBACK_DR_2WXCDR(OnDragOver); - - // called after OnDrop() returns True: you will usually just call - // GetData() from here and, probably, also refresh something to update the - // new data and, finally, return the code indicating how did the operation - // complete (returning default value in case of success and wxDragError on - // failure is usually ok) - DEC_PYCALLBACK_DR_2WXCDR_pure(OnData); - - // this function is called when data is dropped at position (x, y) - if it - // returns True, OnData() will be called immediately afterwards which will - // allow to retrieve the data dropped. - DEC_PYCALLBACK_BOOL_INTINT(OnDrop); - - PYPRIVATE; -}; - IMP_PYCALLBACK__(wxPyDropTarget, wxDropTarget, OnLeave); IMP_PYCALLBACK_DR_2WXCDR(wxPyDropTarget, wxDropTarget, OnEnter); IMP_PYCALLBACK_DR_2WXCDR(wxPyDropTarget, wxDropTarget, OnDragOver); IMP_PYCALLBACK_DR_2WXCDR_pure(wxPyDropTarget, wxDropTarget, OnData); IMP_PYCALLBACK_BOOL_INTINT(wxPyDropTarget, wxDropTarget, OnDrop); - %} diff --git a/wxPython/src/_statusbar.i b/wxPython/src/_statusbar.i index 360970e3fa..48ef90034f 100644 --- a/wxPython/src/_statusbar.i +++ b/wxPython/src/_statusbar.i @@ -59,8 +59,14 @@ public: virtual void SetStatusWidths(int widths, const int* widths_field); // uses typemap in _toplvl.i // Get the position and size of the field's internal bounding rectangle - virtual bool GetFieldRect(int i, wxRect& rect) const; - + %extend { + wxRect GetFieldRect(int i) { + wxRect r; + self->GetFieldRect(i, r); + return r; + } + } + // sets the minimal vertical size of the status bar virtual void SetMinHeight(int height); diff --git a/wxPython/src/_timer.i b/wxPython/src/_timer.i index baeb1f197a..6d669bc44f 100644 --- a/wxPython/src/_timer.i +++ b/wxPython/src/_timer.i @@ -40,6 +40,7 @@ IMP_PYCALLBACK__(wxPyTimer, wxTimer, Notify); %name(Timer) class wxPyTimer : public wxEvtHandler { public: + %addtofunc wxPyTimer "self._setCallbackInfo(self, Timer)" // if you don't call SetOwner() or provide an owner in the contstructor // then you must override Notify() inorder to receive the timer @@ -48,6 +49,8 @@ public: wxPyTimer(wxEvtHandler *owner=NULL, int id = -1); virtual ~wxPyTimer(); + void _setCallbackInfo(PyObject* self, PyObject* _class); + // Set the owner instance that will receive the EVT_TIMER events using the // given id. void SetOwner(wxEvtHandler *owner, int id = -1); @@ -65,7 +68,7 @@ public: // override this in your wxTimer-derived class if you want to process timer // messages in it, use non default ctor or SetOwner() otherwise - virtual void Notify(); + //virtual void Notify(); // return True if the timer is running virtual bool IsRunning() const; diff --git a/wxPython/src/_window.i b/wxPython/src/_window.i index e0f5229c7d..5c0cf3a0e1 100644 --- a/wxPython/src/_window.i +++ b/wxPython/src/_window.i @@ -682,8 +682,8 @@ public: // set/retrieve the drop target associated with this window (may be // NULL; it's owned by the window and will be deleted by it) %addtofunc SetDropTarget "args[1].thisown = 0" - virtual void SetDropTarget( wxDropTarget *dropTarget ); - virtual wxDropTarget *GetDropTarget() const; + virtual void SetDropTarget( wxPyDropTarget *dropTarget ); + virtual wxPyDropTarget *GetDropTarget() const; #ifdef __WXMSW__ // TODO: should I drop-kick this? void DragAcceptFiles(bool accept); diff --git a/wxPython/src/drawlist.cpp b/wxPython/src/drawlist.cpp index d2e926204d..0ec57b0ec5 100644 --- a/wxPython/src/drawlist.cpp +++ b/wxPython/src/drawlist.cpp @@ -17,18 +17,21 @@ #include "wx/wxPython/pydrawxxx.h" -//---------------------------------------------------------------------- +//--------------------------------------------------------------------------- +// Called from _gdiinit so we can do the API import while the GIL is held +void wxPyDrawList_SetAPIPtr() +{ + wxPyCoreAPI_IMPORT(); +} -PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw, - PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes) { +PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw, + PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes) +{ wxPyBeginBlockThreads(); - if ( !wxPyCoreAPIPtr) - wxPyCoreAPI_IMPORT(); - bool isFastSeq = PyList_Check(pyCoords) || PyTuple_Check(pyCoords); bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens); bool isFastBrushes = PyList_Check(pyBrushes) || PyTuple_Check(pyBrushes); @@ -141,7 +144,8 @@ PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw, -bool wxPyDrawXXXPoint(wxDC& dc, PyObject* coords) { +bool wxPyDrawXXXPoint(wxDC& dc, PyObject* coords) +{ int x, y; if (! wxPy2int_seq_helper(coords, &x, &y)) { @@ -152,7 +156,8 @@ bool wxPyDrawXXXPoint(wxDC& dc, PyObject* coords) { return True; } -bool wxPyDrawXXXLine(wxDC& dc, PyObject* coords) { +bool wxPyDrawXXXLine(wxDC& dc, PyObject* coords) +{ int x1, y1, x2, y2; if (! wxPy4int_seq_helper(coords, &x1, &y1, &x2, &y2)) { @@ -163,7 +168,8 @@ bool wxPyDrawXXXLine(wxDC& dc, PyObject* coords) { return True; } -bool wxPyDrawXXXRectangle(wxDC& dc, PyObject* coords) { +bool wxPyDrawXXXRectangle(wxDC& dc, PyObject* coords) +{ int x, y, w, h; if (! wxPy4int_seq_helper(coords, &x, &y, &w, &h)) { @@ -174,7 +180,8 @@ bool wxPyDrawXXXRectangle(wxDC& dc, PyObject* coords) { return True; } -bool wxPyDrawXXXEllipse(wxDC& dc, PyObject* coords) { +bool wxPyDrawXXXEllipse(wxDC& dc, PyObject* coords) +{ int x, y, w, h; if (! wxPy4int_seq_helper(coords, &x, &y, &w, &h)) { @@ -186,7 +193,8 @@ bool wxPyDrawXXXEllipse(wxDC& dc, PyObject* coords) { } -bool wxPyDrawXXXPolygon(wxDC& dc, PyObject* coords) { +bool wxPyDrawXXXPolygon(wxDC& dc, PyObject* coords) +{ wxPoint* points; int numPoints; @@ -200,16 +208,14 @@ bool wxPyDrawXXXPolygon(wxDC& dc, PyObject* coords) { } -//---------------------------------------------------------------------- +//--------------------------------------------------------------------------- -PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList) { +PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList) +{ wxPyBeginBlockThreads(); - if ( !wxPyCoreAPIPtr) - wxPyCoreAPI_IMPORT(); - bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints); bool isFastText = PyList_Check(textList) || PyTuple_Check(textList); bool isFastForeground = PyList_Check(foregroundList) || PyTuple_Check(foregroundList); @@ -353,4 +359,4 @@ PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints, PyO -//---------------------------------------------------------------------- +//--------------------------------------------------------------------------- diff --git a/wxPython/src/gdi.i b/wxPython/src/gdi.i index 75400d5a21..c622181a4f 100644 --- a/wxPython/src/gdi.i +++ b/wxPython/src/gdi.i @@ -51,4 +51,9 @@ //--------------------------------------------------------------------------- +%init %{ + // Work around a chicken/egg problem in drawlist.cpp + wxPyDrawList_SetAPIPtr(); +%} + //--------------------------------------------------------------------------- diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i index dd116ffd2f..a689b9af83 100644 --- a/wxPython/src/grid.i +++ b/wxPython/src/grid.i @@ -952,8 +952,8 @@ class wxGridCellChoiceEditor : public wxGridCellEditor { public: %addtofunc wxGridCellChoiceEditor "self._setOORInfo(self)" - wxGridCellChoiceEditor(int LCOUNT = 0, - const wxString* choices = NULL, + wxGridCellChoiceEditor(int choices = 0, + const wxString* choices_array = NULL, bool allowOthers = False); virtual wxString GetValue(); }; diff --git a/wxPython/src/gtk/core.py b/wxPython/src/gtk/core.py index 20a8174624..4c89e589a6 100644 --- a/wxPython/src/gtk/core.py +++ b/wxPython/src/gtk/core.py @@ -5728,13 +5728,13 @@ Get the width, height, decent and leading of the text using the current or speci return _core.Window_GetToolTip(*args, **kwargs) def SetDropTarget(*args, **kwargs): - """SetDropTarget(wxDropTarget dropTarget)""" + """SetDropTarget(wxPyDropTarget dropTarget)""" val = _core.Window_SetDropTarget(*args, **kwargs) args[1].thisown = 0 return val def GetDropTarget(*args, **kwargs): - """GetDropTarget() -> wxDropTarget""" + """GetDropTarget() -> wxPyDropTarget""" return _core.Window_GetDropTarget(*args, **kwargs) def SetConstraints(*args, **kwargs): diff --git a/wxPython/src/gtk/core_wrap.cpp b/wxPython/src/gtk/core_wrap.cpp index 1168c5ac95..6aee253f77 100644 --- a/wxPython/src/gtk/core_wrap.cpp +++ b/wxPython/src/gtk/core_wrap.cpp @@ -321,7 +321,7 @@ SWIGEXPORT(void) SWIG_Python_InstallConstants(PyObject *d, swig_con #define SWIGTYPE_p_wxPyApp swig_types[103] #define SWIGTYPE_p_wxCommandEvent swig_types[104] #define SWIGTYPE_p_wxPyCommandEvent swig_types[105] -#define SWIGTYPE_p_wxDropTarget swig_types[106] +#define SWIGTYPE_p_wxPyDropTarget swig_types[106] #define SWIGTYPE_p_wxChildFocusEvent swig_types[107] #define SWIGTYPE_p_wxFocusEvent swig_types[108] #define SWIGTYPE_p_wxDropFilesEvent swig_types[109] @@ -23640,7 +23640,7 @@ static PyObject *_wrap_Window_GetToolTip(PyObject *self, PyObject *args, PyObjec static PyObject *_wrap_Window_SetDropTarget(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxWindow *arg1 = (wxWindow *) 0 ; - wxDropTarget *arg2 = (wxDropTarget *) 0 ; + wxPyDropTarget *arg2 = (wxPyDropTarget *) 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { @@ -23649,7 +23649,7 @@ static PyObject *_wrap_Window_SetDropTarget(PyObject *self, PyObject *args, PyOb if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Window_SetDropTarget",kwnames,&obj0,&obj1)) goto fail; if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxWindow,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_wxDropTarget,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_wxPyDropTarget,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; { PyThreadState* __tstate = wxPyBeginAllowThreads(); (arg1)->SetDropTarget(arg2); @@ -23667,7 +23667,7 @@ static PyObject *_wrap_Window_SetDropTarget(PyObject *self, PyObject *args, PyOb static PyObject *_wrap_Window_GetDropTarget(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxWindow *arg1 = (wxWindow *) 0 ; - wxDropTarget *result; + wxPyDropTarget *result; PyObject * obj0 = 0 ; char *kwnames[] = { (char *) "self", NULL @@ -23677,12 +23677,12 @@ static PyObject *_wrap_Window_GetDropTarget(PyObject *self, PyObject *args, PyOb if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxWindow,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; { PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (wxDropTarget *)((wxWindow const *)arg1)->GetDropTarget(); + result = (wxPyDropTarget *)((wxWindow const *)arg1)->GetDropTarget(); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_wxDropTarget, 0); + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_wxPyDropTarget, 0); return resultobj; fail: return NULL; @@ -36740,7 +36740,7 @@ static swig_type_info _swigt__p_wxMouseEvent[] = {{"_p_wxMouseEvent", 0, "wxMous static swig_type_info _swigt__p_wxPyApp[] = {{"_p_wxPyApp", 0, "wxPyApp *", 0},{"_p_wxPyApp"},{0}}; static swig_type_info _swigt__p_wxCommandEvent[] = {{"_p_wxCommandEvent", 0, "wxCommandEvent *", 0},{"_p_wxChildFocusEvent", _p_wxChildFocusEventTo_p_wxCommandEvent},{"_p_wxScrollEvent", _p_wxScrollEventTo_p_wxCommandEvent},{"_p_wxWindowCreateEvent", _p_wxWindowCreateEventTo_p_wxCommandEvent},{"_p_wxUpdateUIEvent", _p_wxUpdateUIEventTo_p_wxCommandEvent},{"_p_wxWindowDestroyEvent", _p_wxWindowDestroyEventTo_p_wxCommandEvent},{"_p_wxContextMenuEvent", _p_wxContextMenuEventTo_p_wxCommandEvent},{"_p_wxCommandEvent"},{"_p_wxNotifyEvent", _p_wxNotifyEventTo_p_wxCommandEvent},{"_p_wxPyCommandEvent", _p_wxPyCommandEventTo_p_wxCommandEvent},{0}}; static swig_type_info _swigt__p_wxPyCommandEvent[] = {{"_p_wxPyCommandEvent", 0, "wxPyCommandEvent *", 0},{"_p_wxPyCommandEvent"},{0}}; -static swig_type_info _swigt__p_wxDropTarget[] = {{"_p_wxDropTarget", 0, "wxDropTarget *", 0},{"_p_wxDropTarget"},{0}}; +static swig_type_info _swigt__p_wxPyDropTarget[] = {{"_p_wxPyDropTarget", 0, "wxPyDropTarget *", 0},{"_p_wxPyDropTarget"},{0}}; static swig_type_info _swigt__p_wxChildFocusEvent[] = {{"_p_wxChildFocusEvent", 0, "wxChildFocusEvent *", 0},{"_p_wxChildFocusEvent"},{0}}; static swig_type_info _swigt__p_wxFocusEvent[] = {{"_p_wxFocusEvent", 0, "wxFocusEvent *", 0},{"_p_wxFocusEvent"},{0}}; static swig_type_info _swigt__p_wxDropFilesEvent[] = {{"_p_wxDropFilesEvent", 0, "wxDropFilesEvent *", 0},{"_p_wxDropFilesEvent"},{0}}; @@ -36856,7 +36856,7 @@ _swigt__p_wxMouseEvent, _swigt__p_wxPyApp, _swigt__p_wxCommandEvent, _swigt__p_wxPyCommandEvent, -_swigt__p_wxDropTarget, +_swigt__p_wxPyDropTarget, _swigt__p_wxChildFocusEvent, _swigt__p_wxFocusEvent, _swigt__p_wxDropFilesEvent, diff --git a/wxPython/src/gtk/gdi_wrap.cpp b/wxPython/src/gtk/gdi_wrap.cpp index 6919c62253..5d44052624 100644 --- a/wxPython/src/gtk/gdi_wrap.cpp +++ b/wxPython/src/gtk/gdi_wrap.cpp @@ -17189,5 +17189,9 @@ SWIGEXPORT(void) SWIG_init(void) { SWIG_addvarlink(SWIG_globals,(char*)"ThePenList",_wrap_ThePenList_get, _wrap_ThePenList_set); SWIG_addvarlink(SWIG_globals,(char*)"TheBrushList",_wrap_TheBrushList_get, _wrap_TheBrushList_set); SWIG_addvarlink(SWIG_globals,(char*)"TheColourDatabase",_wrap_TheColourDatabase_get, _wrap_TheColourDatabase_set); + + // Work around a chicken/egg problem in drawlist.cpp + wxPyDrawList_SetAPIPtr(); + } diff --git a/wxPython/src/gtk/grid.py b/wxPython/src/gtk/grid.py index 0044eaea6f..0cc50a9b02 100644 --- a/wxPython/src/gtk/grid.py +++ b/wxPython/src/gtk/grid.py @@ -506,7 +506,7 @@ class GridCellChoiceEditor(GridCellEditor): def __repr__(self): return "<%s.%s; proxy of C++ wxGridCellChoiceEditor instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): - """__init__(int LCOUNT=0, wxString choices=None, bool allowOthers=False) -> GridCellChoiceEditor""" + """__init__(int choices=0, wxString choices_array=None, bool allowOthers=False) -> GridCellChoiceEditor""" newobj = _grid.new_GridCellChoiceEditor(*args, **kwargs) self.this = newobj.this self.thisown = 1 diff --git a/wxPython/src/gtk/grid_wrap.cpp b/wxPython/src/gtk/grid_wrap.cpp index 5b4ded6275..91918b230e 100644 --- a/wxPython/src/gtk/grid_wrap.cpp +++ b/wxPython/src/gtk/grid_wrap.cpp @@ -3151,18 +3151,22 @@ static PyObject *_wrap_new_GridCellChoiceEditor(PyObject *self, PyObject *args, wxString *arg2 = (wxString *) NULL ; bool arg3 = (bool) False ; wxGridCellChoiceEditor *result; + PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; char *kwnames[] = { - (char *) "LCOUNT",(char *) "choices",(char *) "allowOthers", NULL + (char *) "choices",(char *) "allowOthers", NULL }; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|iOO:new_GridCellChoiceEditor",kwnames,&arg1,&obj1,&obj2)) goto fail; - if (obj1) { - if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_wxString,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:new_GridCellChoiceEditor",kwnames,&obj0,&obj1)) goto fail; + if (obj0) { + { + arg1 = PyList_Size(obj0); + arg2 = wxString_LIST_helper(obj0); + if (arg2 == NULL) SWIG_fail; + } } - if (obj2) { - arg3 = PyInt_AsLong(obj2) ? true : false; + if (obj1) { + arg3 = PyInt_AsLong(obj1) ? true : false; if (PyErr_Occurred()) SWIG_fail; } { @@ -3173,8 +3177,14 @@ static PyObject *_wrap_new_GridCellChoiceEditor(PyObject *self, PyObject *args, if (PyErr_Occurred()) SWIG_fail; } resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_wxGridCellChoiceEditor, 1); + { + if (arg2) delete [] arg2; + } return resultobj; fail: + { + if (arg2) delete [] arg2; + } return NULL; } diff --git a/wxPython/src/gtk/misc.py b/wxPython/src/gtk/misc.py index 4248ed8d01..07acb98b3b 100644 --- a/wxPython/src/gtk/misc.py +++ b/wxPython/src/gtk/misc.py @@ -935,12 +935,18 @@ class Timer(core.EvtHandler): self.this = newobj.this self.thisown = 1 del newobj.thisown + self._setCallbackInfo(self, Timer) + def __del__(self, destroy=_misc.delete_Timer): """__del__()""" try: if self.thisown: destroy(self) except: pass + def _setCallbackInfo(*args, **kwargs): + """_setCallbackInfo(PyObject self, PyObject _class)""" + return _misc.Timer__setCallbackInfo(*args, **kwargs) + def SetOwner(*args, **kwargs): """SetOwner(EvtHandler owner, int id=-1)""" return _misc.Timer_SetOwner(*args, **kwargs) @@ -953,10 +959,6 @@ class Timer(core.EvtHandler): """Stop()""" return _misc.Timer_Stop(*args, **kwargs) - def Notify(*args, **kwargs): - """Notify()""" - return _misc.Timer_Notify(*args, **kwargs) - def IsRunning(*args, **kwargs): """IsRunning() -> bool""" return _misc.Timer_IsRunning(*args, **kwargs) diff --git a/wxPython/src/gtk/misc_wrap.cpp b/wxPython/src/gtk/misc_wrap.cpp index accb86b78f..6233be06a9 100644 --- a/wxPython/src/gtk/misc_wrap.cpp +++ b/wxPython/src/gtk/misc_wrap.cpp @@ -1058,65 +1058,11 @@ public: }; -#include -class wxPyDropSource : public wxDropSource { -public: -#ifndef __WXGTK__ - wxPyDropSource(wxWindow *win = NULL, - const wxCursor © = wxNullCursor, - const wxCursor &move = wxNullCursor, - const wxCursor &none = wxNullCursor) - : wxDropSource(win, copy, move, none) {} -#else - wxPyDropSource(wxWindow *win = NULL, - const wxIcon& copy = wxNullIcon, - const wxIcon& move = wxNullIcon, - const wxIcon& none = wxNullIcon) - : wxDropSource(win, copy, move, none) {} -#endif - ~wxPyDropSource() { } - - DEC_PYCALLBACK_BOOL_DR(GiveFeedback); - PYPRIVATE; -}; - IMP_PYCALLBACK_BOOL_DR(wxPyDropSource, wxDropSource, GiveFeedback); - -class wxPyDropTarget : public wxDropTarget { -public: - wxPyDropTarget(wxDataObject *dataObject = NULL) - : wxDropTarget(dataObject) {} - - // called when mouse leaves the window: might be used to remove the - // feedback which was given in OnEnter() - DEC_PYCALLBACK__(OnLeave); - - // called when the mouse enters the window (only once until OnLeave()) - DEC_PYCALLBACK_DR_2WXCDR(OnEnter); - - // called when the mouse moves in the window - shouldn't take long to - // execute or otherwise mouse movement would be too slow - DEC_PYCALLBACK_DR_2WXCDR(OnDragOver); - - // called after OnDrop() returns True: you will usually just call - // GetData() from here and, probably, also refresh something to update the - // new data and, finally, return the code indicating how did the operation - // complete (returning default value in case of success and wxDragError on - // failure is usually ok) - DEC_PYCALLBACK_DR_2WXCDR_pure(OnData); - - // this function is called when data is dropped at position (x, y) - if it - // returns True, OnData() will be called immediately afterwards which will - // allow to retrieve the data dropped. - DEC_PYCALLBACK_BOOL_INTINT(OnDrop); - - PYPRIVATE; -}; - IMP_PYCALLBACK__(wxPyDropTarget, wxDropTarget, OnLeave); IMP_PYCALLBACK_DR_2WXCDR(wxPyDropTarget, wxDropTarget, OnEnter); IMP_PYCALLBACK_DR_2WXCDR(wxPyDropTarget, wxDropTarget, OnDragOver); @@ -1124,7 +1070,6 @@ IMP_PYCALLBACK_DR_2WXCDR_pure(wxPyDropTarget, wxDropTarget, OnData); IMP_PYCALLBACK_BOOL_INTINT(wxPyDropTarget, wxDropTarget, OnDrop); - class wxPyTextDropTarget : public wxTextDropTarget { public: wxPyTextDropTarget() {} @@ -5706,6 +5651,36 @@ static PyObject *_wrap_delete_Timer(PyObject *self, PyObject *args, PyObject *kw } +static PyObject *_wrap_Timer__setCallbackInfo(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + wxPyTimer *arg1 = (wxPyTimer *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + PyObject *arg3 = (PyObject *) 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char *kwnames[] = { + (char *) "self",(char *) "self",(char *) "_class", NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Timer__setCallbackInfo",kwnames,&obj0,&obj1,&obj2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxPyTimer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg2 = obj1; + arg3 = obj2; + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + (arg1)->_setCallbackInfo(arg2,arg3); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_Timer_SetOwner(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxPyTimer *arg1 = (wxPyTimer *) 0 ; @@ -5790,30 +5765,6 @@ static PyObject *_wrap_Timer_Stop(PyObject *self, PyObject *args, PyObject *kwar } -static PyObject *_wrap_Timer_Notify(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject *resultobj; - wxPyTimer *arg1 = (wxPyTimer *) 0 ; - PyObject * obj0 = 0 ; - char *kwnames[] = { - (char *) "self", NULL - }; - - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:Timer_Notify",kwnames,&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxPyTimer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - PyThreadState* __tstate = wxPyBeginAllowThreads(); - (arg1)->Notify(); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) SWIG_fail; - } - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; -} - - static PyObject *_wrap_Timer_IsRunning(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxPyTimer *arg1 = (wxPyTimer *) 0 ; @@ -16673,6 +16624,7 @@ static PyObject *_wrap_DateTime_ToTimezone(PyObject *self, PyObject *args, PyObj wxDateTime::TimeZone *arg2 = 0 ; bool arg3 = (bool) False ; wxDateTime result; + bool temp2 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -16684,6 +16636,7 @@ static PyObject *_wrap_DateTime_ToTimezone(PyObject *self, PyObject *args, PyObj if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxDateTime,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; { arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj1)); + temp2 = True; } if (obj2) { arg3 = PyInt_AsLong(obj2) ? true : false; @@ -16702,12 +16655,12 @@ static PyObject *_wrap_DateTime_ToTimezone(PyObject *self, PyObject *args, PyObj resultobj = SWIG_NewPointerObj((void *) resultptr, SWIGTYPE_p_wxDateTime, 1); } { - if (arg2) delete arg2; + if (temp2) delete arg2; } return resultobj; fail: { - if (arg2) delete arg2; + if (temp2) delete arg2; } return NULL; } @@ -16719,6 +16672,7 @@ static PyObject *_wrap_DateTime_MakeTimezone(PyObject *self, PyObject *args, PyO wxDateTime::TimeZone *arg2 = 0 ; bool arg3 = (bool) False ; wxDateTime *result; + bool temp2 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -16730,6 +16684,7 @@ static PyObject *_wrap_DateTime_MakeTimezone(PyObject *self, PyObject *args, PyO if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxDateTime,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; { arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj1)); + temp2 = True; } if (obj2) { arg3 = PyInt_AsLong(obj2) ? true : false; @@ -16747,12 +16702,12 @@ static PyObject *_wrap_DateTime_MakeTimezone(PyObject *self, PyObject *args, PyO } resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_wxDateTime, 0); { - if (arg2) delete arg2; + if (temp2) delete arg2; } return resultobj; fail: { - if (arg2) delete arg2; + if (temp2) delete arg2; } return NULL; } @@ -16909,6 +16864,7 @@ static PyObject *_wrap_DateTime_GetYear(PyObject *self, PyObject *args, PyObject wxDateTime::TimeZone const &arg2_defvalue = LOCAL_TZ ; wxDateTime::TimeZone *arg2 = (wxDateTime::TimeZone *) &arg2_defvalue ; int result; + bool temp2 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { @@ -16920,6 +16876,7 @@ static PyObject *_wrap_DateTime_GetYear(PyObject *self, PyObject *args, PyObject if (obj1) { { arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj1)); + temp2 = True; } } { @@ -16931,12 +16888,12 @@ static PyObject *_wrap_DateTime_GetYear(PyObject *self, PyObject *args, PyObject } resultobj = PyInt_FromLong((long)result); { - if (arg2) delete arg2; + if (temp2) delete arg2; } return resultobj; fail: { - if (arg2) delete arg2; + if (temp2) delete arg2; } return NULL; } @@ -16948,6 +16905,7 @@ static PyObject *_wrap_DateTime_GetMonth(PyObject *self, PyObject *args, PyObjec wxDateTime::TimeZone const &arg2_defvalue = LOCAL_TZ ; wxDateTime::TimeZone *arg2 = (wxDateTime::TimeZone *) &arg2_defvalue ; int result; + bool temp2 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { @@ -16959,6 +16917,7 @@ static PyObject *_wrap_DateTime_GetMonth(PyObject *self, PyObject *args, PyObjec if (obj1) { { arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj1)); + temp2 = True; } } { @@ -16970,12 +16929,12 @@ static PyObject *_wrap_DateTime_GetMonth(PyObject *self, PyObject *args, PyObjec } resultobj = PyInt_FromLong((long)result); { - if (arg2) delete arg2; + if (temp2) delete arg2; } return resultobj; fail: { - if (arg2) delete arg2; + if (temp2) delete arg2; } return NULL; } @@ -16987,6 +16946,7 @@ static PyObject *_wrap_DateTime_GetDay(PyObject *self, PyObject *args, PyObject wxDateTime::TimeZone const &arg2_defvalue = LOCAL_TZ ; wxDateTime::TimeZone *arg2 = (wxDateTime::TimeZone *) &arg2_defvalue ; int result; + bool temp2 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { @@ -16998,6 +16958,7 @@ static PyObject *_wrap_DateTime_GetDay(PyObject *self, PyObject *args, PyObject if (obj1) { { arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj1)); + temp2 = True; } } { @@ -17009,12 +16970,12 @@ static PyObject *_wrap_DateTime_GetDay(PyObject *self, PyObject *args, PyObject } resultobj = PyInt_FromLong((long)result); { - if (arg2) delete arg2; + if (temp2) delete arg2; } return resultobj; fail: { - if (arg2) delete arg2; + if (temp2) delete arg2; } return NULL; } @@ -17026,6 +16987,7 @@ static PyObject *_wrap_DateTime_GetWeekDay(PyObject *self, PyObject *args, PyObj wxDateTime::TimeZone const &arg2_defvalue = LOCAL_TZ ; wxDateTime::TimeZone *arg2 = (wxDateTime::TimeZone *) &arg2_defvalue ; int result; + bool temp2 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { @@ -17037,6 +16999,7 @@ static PyObject *_wrap_DateTime_GetWeekDay(PyObject *self, PyObject *args, PyObj if (obj1) { { arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj1)); + temp2 = True; } } { @@ -17048,12 +17011,12 @@ static PyObject *_wrap_DateTime_GetWeekDay(PyObject *self, PyObject *args, PyObj } resultobj = PyInt_FromLong((long)result); { - if (arg2) delete arg2; + if (temp2) delete arg2; } return resultobj; fail: { - if (arg2) delete arg2; + if (temp2) delete arg2; } return NULL; } @@ -17065,6 +17028,7 @@ static PyObject *_wrap_DateTime_GetHour(PyObject *self, PyObject *args, PyObject wxDateTime::TimeZone const &arg2_defvalue = LOCAL_TZ ; wxDateTime::TimeZone *arg2 = (wxDateTime::TimeZone *) &arg2_defvalue ; int result; + bool temp2 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { @@ -17076,6 +17040,7 @@ static PyObject *_wrap_DateTime_GetHour(PyObject *self, PyObject *args, PyObject if (obj1) { { arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj1)); + temp2 = True; } } { @@ -17087,12 +17052,12 @@ static PyObject *_wrap_DateTime_GetHour(PyObject *self, PyObject *args, PyObject } resultobj = PyInt_FromLong((long)result); { - if (arg2) delete arg2; + if (temp2) delete arg2; } return resultobj; fail: { - if (arg2) delete arg2; + if (temp2) delete arg2; } return NULL; } @@ -17104,6 +17069,7 @@ static PyObject *_wrap_DateTime_GetMinute(PyObject *self, PyObject *args, PyObje wxDateTime::TimeZone const &arg2_defvalue = LOCAL_TZ ; wxDateTime::TimeZone *arg2 = (wxDateTime::TimeZone *) &arg2_defvalue ; int result; + bool temp2 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { @@ -17115,6 +17081,7 @@ static PyObject *_wrap_DateTime_GetMinute(PyObject *self, PyObject *args, PyObje if (obj1) { { arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj1)); + temp2 = True; } } { @@ -17126,12 +17093,12 @@ static PyObject *_wrap_DateTime_GetMinute(PyObject *self, PyObject *args, PyObje } resultobj = PyInt_FromLong((long)result); { - if (arg2) delete arg2; + if (temp2) delete arg2; } return resultobj; fail: { - if (arg2) delete arg2; + if (temp2) delete arg2; } return NULL; } @@ -17143,6 +17110,7 @@ static PyObject *_wrap_DateTime_GetSecond(PyObject *self, PyObject *args, PyObje wxDateTime::TimeZone const &arg2_defvalue = LOCAL_TZ ; wxDateTime::TimeZone *arg2 = (wxDateTime::TimeZone *) &arg2_defvalue ; int result; + bool temp2 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { @@ -17154,6 +17122,7 @@ static PyObject *_wrap_DateTime_GetSecond(PyObject *self, PyObject *args, PyObje if (obj1) { { arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj1)); + temp2 = True; } } { @@ -17165,12 +17134,12 @@ static PyObject *_wrap_DateTime_GetSecond(PyObject *self, PyObject *args, PyObje } resultobj = PyInt_FromLong((long)result); { - if (arg2) delete arg2; + if (temp2) delete arg2; } return resultobj; fail: { - if (arg2) delete arg2; + if (temp2) delete arg2; } return NULL; } @@ -17182,6 +17151,7 @@ static PyObject *_wrap_DateTime_GetMillisecond(PyObject *self, PyObject *args, P wxDateTime::TimeZone const &arg2_defvalue = LOCAL_TZ ; wxDateTime::TimeZone *arg2 = (wxDateTime::TimeZone *) &arg2_defvalue ; int result; + bool temp2 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { @@ -17193,6 +17163,7 @@ static PyObject *_wrap_DateTime_GetMillisecond(PyObject *self, PyObject *args, P if (obj1) { { arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj1)); + temp2 = True; } } { @@ -17204,12 +17175,12 @@ static PyObject *_wrap_DateTime_GetMillisecond(PyObject *self, PyObject *args, P } resultobj = PyInt_FromLong((long)result); { - if (arg2) delete arg2; + if (temp2) delete arg2; } return resultobj; fail: { - if (arg2) delete arg2; + if (temp2) delete arg2; } return NULL; } @@ -17221,6 +17192,7 @@ static PyObject *_wrap_DateTime_GetDayOfYear(PyObject *self, PyObject *args, PyO wxDateTime::TimeZone const &arg2_defvalue = LOCAL_TZ ; wxDateTime::TimeZone *arg2 = (wxDateTime::TimeZone *) &arg2_defvalue ; int result; + bool temp2 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char *kwnames[] = { @@ -17232,6 +17204,7 @@ static PyObject *_wrap_DateTime_GetDayOfYear(PyObject *self, PyObject *args, PyO if (obj1) { { arg2 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj1)); + temp2 = True; } } { @@ -17243,12 +17216,12 @@ static PyObject *_wrap_DateTime_GetDayOfYear(PyObject *self, PyObject *args, PyO } resultobj = PyInt_FromLong((long)result); { - if (arg2) delete arg2; + if (temp2) delete arg2; } return resultobj; fail: { - if (arg2) delete arg2; + if (temp2) delete arg2; } return NULL; } @@ -17261,6 +17234,7 @@ static PyObject *_wrap_DateTime_GetWeekOfYear(PyObject *self, PyObject *args, Py wxDateTime::TimeZone const &arg3_defvalue = LOCAL_TZ ; wxDateTime::TimeZone *arg3 = (wxDateTime::TimeZone *) &arg3_defvalue ; int result; + bool temp3 = False ; PyObject * obj0 = 0 ; PyObject * obj2 = 0 ; char *kwnames[] = { @@ -17272,6 +17246,7 @@ static PyObject *_wrap_DateTime_GetWeekOfYear(PyObject *self, PyObject *args, Py if (obj2) { { arg3 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj2)); + temp3 = True; } } { @@ -17283,12 +17258,12 @@ static PyObject *_wrap_DateTime_GetWeekOfYear(PyObject *self, PyObject *args, Py } resultobj = PyInt_FromLong((long)result); { - if (arg3) delete arg3; + if (temp3) delete arg3; } return resultobj; fail: { - if (arg3) delete arg3; + if (temp3) delete arg3; } return NULL; } @@ -17301,6 +17276,7 @@ static PyObject *_wrap_DateTime_GetWeekOfMonth(PyObject *self, PyObject *args, P wxDateTime::TimeZone const &arg3_defvalue = LOCAL_TZ ; wxDateTime::TimeZone *arg3 = (wxDateTime::TimeZone *) &arg3_defvalue ; int result; + bool temp3 = False ; PyObject * obj0 = 0 ; PyObject * obj2 = 0 ; char *kwnames[] = { @@ -17312,6 +17288,7 @@ static PyObject *_wrap_DateTime_GetWeekOfMonth(PyObject *self, PyObject *args, P if (obj2) { { arg3 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj2)); + temp3 = True; } } { @@ -17323,12 +17300,12 @@ static PyObject *_wrap_DateTime_GetWeekOfMonth(PyObject *self, PyObject *args, P } resultobj = PyInt_FromLong((long)result); { - if (arg3) delete arg3; + if (temp3) delete arg3; } return resultobj; fail: { - if (arg3) delete arg3; + if (temp3) delete arg3; } return NULL; } @@ -18785,6 +18762,7 @@ static PyObject *_wrap_DateTime_Format(PyObject *self, PyObject *args, PyObject wxDateTime::TimeZone *arg3 = (wxDateTime::TimeZone *) &arg3_defvalue ; wxString result; bool temp2 = False ; + bool temp3 = False ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -18804,6 +18782,7 @@ static PyObject *_wrap_DateTime_Format(PyObject *self, PyObject *args, PyObject if (obj2) { { arg3 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong(obj2)); + temp3 = True; } } { @@ -18825,7 +18804,7 @@ static PyObject *_wrap_DateTime_Format(PyObject *self, PyObject *args, PyObject delete arg2; } { - if (arg3) delete arg3; + if (temp3) delete arg3; } return resultobj; fail: @@ -18834,7 +18813,7 @@ static PyObject *_wrap_DateTime_Format(PyObject *self, PyObject *args, PyObject delete arg2; } { - if (arg3) delete arg3; + if (temp3) delete arg3; } return NULL; } @@ -24475,10 +24454,10 @@ static PyMethodDef SwigMethods[] = { { (char *)"CreateFileTipProvider", (PyCFunction) _wrap_CreateFileTipProvider, METH_VARARGS | METH_KEYWORDS }, { (char *)"new_Timer", (PyCFunction) _wrap_new_Timer, METH_VARARGS | METH_KEYWORDS }, { (char *)"delete_Timer", (PyCFunction) _wrap_delete_Timer, METH_VARARGS | METH_KEYWORDS }, + { (char *)"Timer__setCallbackInfo", (PyCFunction) _wrap_Timer__setCallbackInfo, METH_VARARGS | METH_KEYWORDS }, { (char *)"Timer_SetOwner", (PyCFunction) _wrap_Timer_SetOwner, METH_VARARGS | METH_KEYWORDS }, { (char *)"Timer_Start", (PyCFunction) _wrap_Timer_Start, METH_VARARGS | METH_KEYWORDS }, { (char *)"Timer_Stop", (PyCFunction) _wrap_Timer_Stop, METH_VARARGS | METH_KEYWORDS }, - { (char *)"Timer_Notify", (PyCFunction) _wrap_Timer_Notify, METH_VARARGS | METH_KEYWORDS }, { (char *)"Timer_IsRunning", (PyCFunction) _wrap_Timer_IsRunning, METH_VARARGS | METH_KEYWORDS }, { (char *)"Timer_GetInterval", (PyCFunction) _wrap_Timer_GetInterval, METH_VARARGS | METH_KEYWORDS }, { (char *)"Timer_IsOneShot", (PyCFunction) _wrap_Timer_IsOneShot, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/gtk/windows.py b/wxPython/src/gtk/windows.py index 2237dbefc0..3688c79ea9 100644 --- a/wxPython/src/gtk/windows.py +++ b/wxPython/src/gtk/windows.py @@ -657,7 +657,7 @@ class StatusBar(core.Window): return _windows.StatusBar_SetStatusWidths(*args, **kwargs) def GetFieldRect(*args, **kwargs): - """GetFieldRect(int i, Rect rect) -> bool""" + """GetFieldRect(int i) -> Rect""" return _windows.StatusBar_GetFieldRect(*args, **kwargs) def SetMinHeight(*args, **kwargs): diff --git a/wxPython/src/gtk/windows_wrap.cpp b/wxPython/src/gtk/windows_wrap.cpp index 8d2dfbff11..b8f0ec3dd9 100644 --- a/wxPython/src/gtk/windows_wrap.cpp +++ b/wxPython/src/gtk/windows_wrap.cpp @@ -365,6 +365,11 @@ bool wxDialog_IsModalShowing(wxDialog *self){ } +wxRect wxStatusBar_GetFieldRect(wxStatusBar *self,int i){ + wxRect r; + self->GetFieldRect(i, r); + return r; + } static const wxChar* wxSplitterNameStr = wxT("splitter"); DECLARE_DEF_STRING(SplitterNameStr); @@ -4848,29 +4853,26 @@ static PyObject *_wrap_StatusBar_GetFieldRect(PyObject *self, PyObject *args, Py PyObject *resultobj; wxStatusBar *arg1 = (wxStatusBar *) 0 ; int arg2 ; - wxRect *arg3 = 0 ; - bool result; - wxRect temp3 ; + wxRect result; PyObject * obj0 = 0 ; - PyObject * obj2 = 0 ; char *kwnames[] = { - (char *) "self",(char *) "i",(char *) "rect", NULL + (char *) "self",(char *) "i", NULL }; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OiO:StatusBar_GetFieldRect",kwnames,&obj0,&arg2,&obj2)) goto fail; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"Oi:StatusBar_GetFieldRect",kwnames,&obj0,&arg2)) goto fail; if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxStatusBar,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - arg3 = &temp3; - if ( ! wxRect_helper(obj2, &arg3)) SWIG_fail; - } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - result = (bool)((wxStatusBar const *)arg1)->GetFieldRect(arg2,*arg3); + result = wxStatusBar_GetFieldRect(arg1,arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) SWIG_fail; } - resultobj = PyInt_FromLong((long)result); + { + wxRect * resultptr; + resultptr = new wxRect((wxRect &) result); + resultobj = SWIG_NewPointerObj((void *) resultptr, SWIGTYPE_p_wxRect, 1); + } return resultobj; fail: return NULL; diff --git a/wxPython/wx/lib/colourchooser/canvas.py b/wxPython/wx/lib/colourchooser/canvas.py index 730a6fb629..97712542a8 100644 --- a/wxPython/wx/lib/colourchooser/canvas.py +++ b/wxPython/wx/lib/colourchooser/canvas.py @@ -103,7 +103,7 @@ class Canvas(wxWindow): """Performs the blit of the buffer contents on-screen.""" width, height = self.buffer.GetSize() dc.BeginDrawing() - dc.Blit(0, 0, width, height, self.buffer, 0, 0) + dc.Blit((0, 0), (width, height), self.buffer, (0, 0)) dc.EndDrawing() def GetBoundingRect(self): diff --git a/wxPython/wx/lib/colourchooser/pycolourchooser.py b/wxPython/wx/lib/colourchooser/pycolourchooser.py index 28c691060f..21451c1308 100644 --- a/wxPython/wx/lib/colourchooser/pycolourchooser.py +++ b/wxPython/wx/lib/colourchooser/pycolourchooser.py @@ -134,15 +134,15 @@ class wxPyColourChooser(wxPanel): self.custom_boxs.append(custom) csizer = wxBoxSizer(wxVERTICAL) - csizer.Add(1, 25) + csizer.Add((1, 25)) csizer.Add(self.basic_label, 0, wxEXPAND) - csizer.Add(1, 5) + csizer.Add((1, 5)) csizer.Add(colour_grid, 0, wxEXPAND) - csizer.Add(1, 25) + csizer.Add((1, 25)) csizer.Add(self.custom_label, 0, wxEXPAND) - csizer.Add(1, 5) + csizer.Add((1, 5)) csizer.Add(custom_grid, 0, wxEXPAND) - csizer.Add(1, 5) + csizer.Add((1, 5)) csizer.Add(self.add_button, 0, wxEXPAND) self.palette = pypalette.PyPalette(self, -1) @@ -152,7 +152,7 @@ class wxPyColourChooser(wxPanel): EVT_COMMAND_SCROLL(self, self.idSCROLL, self.onScroll) psizer = wxBoxSizer(wxHORIZONTAL) psizer.Add(self.palette, 0, 0) - psizer.Add(10, 1) + psizer.Add((10, 1)) psizer.Add(self.colour_slider, 0, wxALIGN_CENTER_VERTICAL) psizer.Add(self.slider, 0, wxALIGN_CENTER_VERTICAL) @@ -166,7 +166,7 @@ class wxPyColourChooser(wxPanel): slabel = wxStaticText(self, -1, _("Solid Colour")) ssizer = wxBoxSizer(wxVERTICAL) ssizer.Add(self.solid, 0, 0) - ssizer.Add(1, 2) + ssizer.Add((1, 2)) ssizer.Add(slabel, 0, wxALIGN_CENTER_HORIZONTAL) hlabel = wxStaticText(self, -1, _("H:")) @@ -212,15 +212,15 @@ class wxPyColourChooser(wxPanel): hsizer.Add(gsizer, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL) vsizer = wxBoxSizer(wxVERTICAL) - vsizer.Add(1, 5) + vsizer.Add((1, 5)) vsizer.Add(psizer, 0, 0) - vsizer.Add(1, 15) + vsizer.Add((1, 15)) vsizer.Add(hsizer, 0, wxEXPAND) sizer = wxBoxSizer(wxHORIZONTAL) - sizer.Add(5, 1) + sizer.Add((5, 1)) sizer.Add(csizer, 0, wxEXPAND) - sizer.Add(10, 1) + sizer.Add((10, 1)) sizer.Add(vsizer, 0, wxEXPAND) self.SetAutoLayout(True) self.SetSizer(sizer) diff --git a/wxPython/wx/lib/colourchooser/pycolourslider.py b/wxPython/wx/lib/colourchooser/pycolourslider.py index 87a4442579..7e00a1d10a 100644 --- a/wxPython/wx/lib/colourchooser/pycolourslider.py +++ b/wxPython/wx/lib/colourchooser/pycolourslider.py @@ -58,7 +58,7 @@ class PyColourSlider(canvas.Canvas): """Returns the colour value for a position on the slider. The position must be within the valid height of the slider, or results can be unpredictable.""" - return self.buffer.GetPixel(0, pos) + return self.buffer.GetPixel((0, pos)) def DrawBuffer(self): """Actual implementation of the widget's drawing. We simply draw @@ -78,5 +78,5 @@ class PyColourSlider(canvas.Canvas): r,g,b = [c * 255.0 for c in colorsys.hsv_to_rgb(h,s,v)] colour = wxColour(int(r), int(g), int(b)) self.buffer.SetPen(wxPen(colour, 1, wxSOLID)) - self.buffer.DrawRectangle(0, y_pos, 15, 1) + self.buffer.DrawRectangle((0, y_pos), (15, 1)) v = v - vstep diff --git a/wxPython/wx/lib/colourchooser/pypalette.py b/wxPython/wx/lib/colourchooser/pypalette.py index 8b137d4e6d..321750c1b1 100644 --- a/wxPython/wx/lib/colourchooser/pypalette.py +++ b/wxPython/wx/lib/colourchooser/pypalette.py @@ -163,12 +163,12 @@ class PyPalette(canvas.Canvas): """Returns a colour value at a specific x, y coordinate pair. This is useful for determining the colour found a specific mouse click in an external event handler.""" - return self.buffer.GetPixel(x, y) + return self.buffer.GetPixel((x, y)) def DrawBuffer(self): """Draws the palette XPM into the memory buffer.""" #self.GeneratePaletteBMP ("foo.bmp") - self.buffer.DrawBitmap(self.palette, 0, 0, 0) + self.buffer.DrawBitmap(self.palette, (0, 0), 0) def HighlightPoint(self, x, y): """Highlights an area of the palette with a little circle around @@ -176,7 +176,7 @@ class PyPalette(canvas.Canvas): colour = wxColour(0, 0, 0) self.buffer.SetPen(wxPen(colour, 1, wxSOLID)) self.buffer.SetBrush(wxBrush(colour, wxTRANSPARENT)) - self.buffer.DrawCircle(x, y, 3) + self.buffer.DrawCircle((x, y), 3) self.Refresh() def GeneratePaletteBMP(self, file_name, granularity=1): @@ -204,9 +204,8 @@ class PyPalette(canvas.Canvas): colour = wxColour(int(r * 255.0), int(g * 255.0), int(b * 255.0)) self.buffer.SetPen(wxPen(colour, 1, wxSOLID)) self.buffer.SetBrush(wxBrush(colour, wxSOLID)) - self.buffer.DrawRectangle(x, y, - self.HORIZONTAL_STEP, - self.vertical_step) + self.buffer.DrawRectangle((x, y), + (self.HORIZONTAL_STEP, self.vertical_step)) # this code is now simpler (and works) bitmap = self.buffer.GetBitmap() diff --git a/wxPython/wx/lib/colourdb.py b/wxPython/wx/lib/colourdb.py index ec9ae457f2..8f14df111b 100644 --- a/wxPython/wx/lib/colourdb.py +++ b/wxPython/wx/lib/colourdb.py @@ -661,9 +661,10 @@ _haveUpdated = False def updateColourDB(): global _haveUpdated if not _haveUpdated: - from wxPython.wx import wxTheColourDatabase + import wx + assert wx.GetApp() is not None, "You must have a wx.App object before you can use the colour database." cl = getColourInfoList() for info in cl: - wxTheColourDatabase.Append(*info) + wx.TheColourDatabase.Append(*info) diff --git a/wxPython/wx/lib/colourselect.py b/wxPython/wx/lib/colourselect.py index fbf1999f37..1572ace9d8 100644 --- a/wxPython/wx/lib/colourselect.py +++ b/wxPython/wx/lib/colourselect.py @@ -32,42 +32,91 @@ from wxPython.wx import * EVT_COMMAND_COLOURSELECT = wxNewId() class ColourSelectEvent(wxPyCommandEvent): - def __init__(self, id, value): - wxPyCommandEvent.__init__(self, id = id) - self.SetEventType(EVT_COMMAND_COLOURSELECT) - self.value = value + def __init__(self, id, value): + wxPyCommandEvent.__init__(self, id = id) + self.SetEventType(EVT_COMMAND_COLOURSELECT) + self.value = value - def GetValue(self): - return self.value + def GetValue(self): + return self.value def EVT_COLOURSELECT(win, id, func): win.Connect(id, -1, EVT_COMMAND_COLOURSELECT, func) -class ColourSelect(wxButton): - def __init__(self, parent, id, label = "", bcolour=(0, 0, 0), - pos = wxDefaultPosition, size = wxDefaultSize, - callback = None): - wxButton.__init__(self, parent, id, label, pos=pos, size=size) - self.SetColour(bcolour) + + + +class ColourSelect(wxBitmapButton): + def __init__(self, parent, id, label="", colour=wxBLACK, + pos=wxDefaultPosition, size=wxDefaultSize, + callback=None, style=0): + if label: + w, h = parent.GetTextExtent(label) + w += 6 + h += 6 + else: + w, h = 20, 20 + wxBitmapButton.__init__(self, parent, id, wxEmptyBitmap(w,h), + pos=pos, size=size, style=style|wxBU_AUTODRAW) + if type(colour) == type( () ): + colour = wxColour(*colour) + self.colour = colour + self.SetLabel(label) self.callback = callback + bmp = self.MakeBitmap() + self.SetBitmap(bmp) EVT_BUTTON(parent, self.GetId(), self.OnClick) + def GetColour(self): - return self.set_colour + return self.colour - def GetValue(self): - return self.set_colour - def SetColour(self, bcolour): - self.set_colour_val = wxColor(bcolour[0], bcolour[1], bcolour[2]) - self.SetBackgroundColour(self.set_colour_val) - avg = reduce(lambda a, b: a + b, bcolour) / 3 - fcolour = avg > 128 and (0, 0, 0) or (255, 255, 255) - self.SetForegroundColour(apply(wxColour, fcolour)) - self.set_colour = bcolour + def GetValue(self): + return self.colour + + + def SetValue(self, colour): + self.SetColour(colour) + + + def SetColour(self, colour): + if type(colour) == type( () ): + colour = wxColour(*colour) + self.colour = colour + bmp = self.MakeBitmap() + self.SetBitmap(bmp) + + + def MakeBitmap(self): + bdr = 10 + sz = self.GetSize() + bmp = wxEmptyBitmap(sz.width-bdr, sz.height-bdr) + dc = wxMemoryDC() + dc.SelectObject(bmp) + label = self.GetLabel() + # Just make a little colored bitmap + dc.SetBackground(wxBrush(self.colour)) + dc.Clear() + if label: + # Add a label to it + avg = reduce(lambda a, b: a + b, self.colour.Get()) / 3 + fcolour = avg > 128 and wxBLACK or wxWHITE + dc.SetTextForeground(fcolour) + dc.DrawLabel(label, (0,0, sz.width-bdr, sz.height-bdr), + wxALIGN_CENTER) + + dc.SelectObject(wxNullBitmap) + return bmp + + + def SetBitmap(self, bmp): + self.SetBitmapLabel(bmp) + self.SetBitmapSelected(bmp) + self.SetBitmapDisabled(bmp) + self.SetBitmapFocus(bmp) + self.SetBitmapSelected(bmp) - def SetValue(self, bcolour): - self.SetColour(bcolour) def OnChange(self): wxPostEvent(self, ColourSelectEvent(self.GetId(), self.GetValue())) @@ -77,12 +126,12 @@ class ColourSelect(wxButton): def OnClick(self, event): data = wxColourData() data.SetChooseFull(True) - data.SetColour(self.set_colour_val) + data.SetColour(self.colour) dlg = wxColourDialog(self.GetParent(), data) changed = dlg.ShowModal() == wxID_OK if changed: data = dlg.GetColourData() - self.SetColour(data.GetColour().Get()) + self.SetColour(data.GetColour()) dlg.Destroy() if changed: diff --git a/wxPython/wx/lib/editor/editor.py b/wxPython/wx/lib/editor/editor.py index d3912e5894..57f1d77870 100644 --- a/wxPython/wx/lib/editor/editor.py +++ b/wxPython/wx/lib/editor/editor.py @@ -149,12 +149,12 @@ class wxEditor(wxScrolledWindow): else: self.sh = self.bh / self.fh if self.LinesInFile() >= self.sh: - self.bw = self.bw - wxSystemSettings_GetSystemMetric(wxSYS_VSCROLL_X) + self.bw = self.bw - wxSystemSettings_GetMetric(wxSYS_VSCROLL_X) self.sw = (self.bw / self.fw) - 1 self.sw = (self.bw / self.fw) - 1 if self.CalcMaxLineLen() >= self.sw: - self.bh = self.bh - wxSystemSettings_GetSystemMetric(wxSYS_HSCROLL_Y) + self.bh = self.bh - wxSystemSettings_GetMetric(wxSYS_HSCROLL_Y) self.sh = self.bh / self.fh @@ -197,7 +197,7 @@ class wxEditor(wxScrolledWindow): pass def DrawEditText(self, t, x, y, dc): - dc.DrawText(t, x * self.fw, y * self.fh) + dc.DrawText(t, (x * self.fw, y * self.fh)) def DrawLine(self, line, dc): if self.IsLine(line): @@ -245,7 +245,7 @@ class wxEditor(wxScrolledWindow): x = 0 y = (len(self.lines) - self.sy) * self.fh hasTransparency = 1 - dc.DrawBitmap(self.eofMarker, x, y, hasTransparency) + dc.DrawBitmap(self.eofMarker, (x, y), hasTransparency) ##------------------ cursor-related functions @@ -274,7 +274,7 @@ class wxEditor(wxScrolledWindow): szy = self.fh x = xp * szx y = yp * szy - dc.Blit(x,y,szx,szy,dc,x,y,wxSRC_INVERT) + dc.Blit((x,y), (szx,szy), dc, (x,y), wxSRC_INVERT) self.sco_x = xp self.sco_y = yp diff --git a/wxPython/wx/lib/floatcanvas.py b/wxPython/wx/lib/floatcanvas.py index 8f88ebbb31..1d1cdb5705 100644 --- a/wxPython/wx/lib/floatcanvas.py +++ b/wxPython/wx/lib/floatcanvas.py @@ -450,7 +450,7 @@ class PointSet(draw_object): dc.SetBrush(self.Brush) radius = int(round(self.Diameter/2)) for (x,y) in Points: - dc.DrawEllipse((x - radius), (y - radius), self.Diameter, self.Diameter) + dc.DrawEllipse(((x - radius), (y - radius)), (self.Diameter, self.Diameter)) @@ -486,7 +486,7 @@ class Dot(draw_object): dc.SetBrush(self.Brush) radius = int(round(self.Diameter/2)) (X,Y) = WorldToPixel((self.X,self.Y)) - dc.DrawEllipse((X - radius), (Y - radius), self.Diameter, self.Diameter) + dc.DrawEllipse(((X - radius), (Y - radius)), (self.Diameter, self.Diameter)) class Rectangle(draw_object): @@ -513,7 +513,7 @@ class Rectangle(draw_object): dc.SetPen(self.Pen) dc.SetBrush(self.Brush) - dc.DrawRectangle(X,Y,Width,Height) + dc.DrawRectangle((X,Y), (Width,Height)) class Ellipse(draw_object): def __init__(self,x,y,width,height,LineColor,LineStyle,LineWidth,FillColor,FillStyle,Foreground = 0): @@ -539,7 +539,7 @@ class Ellipse(draw_object): dc.SetPen(self.Pen) dc.SetBrush(self.Brush) - dc.DrawEllipse(X,Y,Width,Height) + dc.DrawEllipse((X,Y), (Width,Height)) class Circle(draw_object): def __init__(self,x,y,Diameter,LineColor,LineStyle,LineWidth,FillColor,FillStyle,Foreground = 0): @@ -564,7 +564,7 @@ class Circle(draw_object): dc.SetPen(self.Pen) dc.SetBrush(self.Brush) - dc.DrawEllipse(X-Diameter/2,Y-Diameter/2,Diameter,Diameter) + dc.DrawEllipse((X-Diameter/2,Y-Diameter/2), (Diameter,Diameter)) class Text(draw_object): """ @@ -647,7 +647,7 @@ class Text(draw_object): raise "Invalid value for Text Object Position Attribute" self.x_shift = x_shift self.y_shift = y_shift - dc.DrawText(self.String, X-self.x_shift, Y-self.y_shift) + dc.DrawText(self.String, (X-self.x_shift, Y-self.y_shift)) #--------------------------------------------------------------------------- @@ -808,13 +808,13 @@ class FloatCanvas(wxPanel): tb.SetToolBitmapSize((23,23)) - tb.AddTool(ID_ZOOM_IN_BUTTON, GetPlusBitmap(), isToggle=true,shortHelpString = "Zoom In") + tb.AddTool(ID_ZOOM_IN_BUTTON, GetPlusBitmap(), isToggle=True,shortHelpString = "Zoom In") EVT_TOOL(self, ID_ZOOM_IN_BUTTON, self.SetMode) - tb.AddTool(ID_ZOOM_OUT_BUTTON, GetMinusBitmap(), isToggle=true,shortHelpString = "Zoom Out") + tb.AddTool(ID_ZOOM_OUT_BUTTON, GetMinusBitmap(), isToggle=True,shortHelpString = "Zoom Out") EVT_TOOL(self, ID_ZOOM_OUT_BUTTON, self.SetMode) - tb.AddTool(ID_MOVE_MODE_BUTTON, GetHandBitmap(), isToggle=true,shortHelpString = "Move") + tb.AddTool(ID_MOVE_MODE_BUTTON, GetHandBitmap(), isToggle=True,shortHelpString = "Move") EVT_TOOL(self, ID_MOVE_MODE_BUTTON, self.SetMode) tb.AddSeparator() @@ -869,8 +869,8 @@ class FloatCanvas(wxPanel): dc.SetBrush(wxTRANSPARENT_BRUSH) dc.SetLogicalFunction(wxXOR) if self.PrevRBBox: - dc.DrawRectangle(*self.PrevRBBox) - dc.DrawRectangle(x_c-w/2,y_c-h/2,w,h) + dc.DrawRectangleXY(*self.PrevRBBox) + dc.DrawRectangleXY(x_c-w/2,y_c-h/2,w,h) self.PrevRBBox = (x_c-w/2,y_c-h/2,w,h) dc.EndDrawing() @@ -908,8 +908,8 @@ class FloatCanvas(wxPanel): dc.SetBrush(wxTRANSPARENT_BRUSH) dc.SetLogicalFunction(wxXOR) if self.PrevMoveBox: - dc.DrawRectangle(*self.PrevMoveBox) - dc.DrawRectangle(x_tl,y_tl,w,h) + dc.DrawRectangleXY(*self.PrevMoveBox) + dc.DrawRectangleXY(x_tl,y_tl,w,h) self.PrevMoveBox = (x_tl,y_tl,w,h) dc.EndDrawing() @@ -954,7 +954,7 @@ class FloatCanvas(wxPanel): def OnPaint(self, event): #dc = wxBufferedPaintDC(self.DrawPanel, self._Buffer) dc = wxPaintDC(self.DrawPanel) - dc.DrawBitmap(self._Buffer,0,0) + dc.DrawBitmap(self._Buffer, (0,0)) def Draw(self): """ @@ -990,7 +990,7 @@ class FloatCanvas(wxPanel): i+=1 Object._Draw(dc,self.WorldToPixel,self.ScaleFunction) if i % self.NumBetweenBlits == 0: - ScreenDC.Blit(0, 0, self.PanelSize[0],self.PanelSize[1], dc, 0, 0) + ScreenDC.Blit((0, 0), self.PanelSize, dc, (0, 0)) dc.EndDrawing() else: dc.Clear() @@ -1005,7 +1005,7 @@ class FloatCanvas(wxPanel): i+=1 Object._Draw(dc,self.WorldToPixel,self.ScaleFunction) if i % self.NumBetweenBlits == 0: - ScreenDC.Blit(0, 0, self.PanelSize[0],self.PanelSize[1], dc, 0, 0) + ScreenDC.Blit((0, 0), self.PanelSize, dc, (0, 0)) dc.EndDrawing() else: # not using a Background DC dc = wxMemoryDC() @@ -1021,25 +1021,25 @@ class FloatCanvas(wxPanel): i+=1 Object._Draw(dc,self.WorldToPixel,self.ScaleFunction) if i % self.NumBetweenBlits == 0: - ScreenDC.Blit(0, 0, self.PanelSize[0],self.PanelSize[1], dc, 0, 0) + ScreenDC.Blit((0, 0), self.PanelSize, dc, (0, 0)) dc.EndDrawing() else: dc.Clear() # now refresh the screen #ScreenDC.DrawBitmap(self._Buffer,0,0) #NOTE: uisng DrawBitmap didn't work right on MSW - ScreenDC.Blit(0, 0, self.PanelSize[0],self.PanelSize[1], dc, 0, 0) + ScreenDC.Blit((0, 0), self.PanelSize, dc, (0, 0)) # If the canvas is in the middle of a zoom or move, the Rubber Band box needs to be re-drawn if self.PrevRBBox: ScreenDC.SetPen(wxPen('WHITE', 2,wxSHORT_DASH)) ScreenDC.SetBrush(wxTRANSPARENT_BRUSH) ScreenDC.SetLogicalFunction(wxXOR) - ScreenDC.DrawRectangle(*self.PrevRBBox) + ScreenDC.DrawRectangleXY(*self.PrevRBBox) elif self.PrevMoveBox: ScreenDC.SetPen(wxPen('WHITE', 1,)) ScreenDC.SetBrush(wxTRANSPARENT_BRUSH) ScreenDC.SetLogicalFunction(wxXOR) - ScreenDC.DrawRectangle(*self.PrevMoveBox) + ScreenDC.DrawRectangleXY(*self.PrevMoveBox) if self.Debug: print "Drawing took %f seconds of CPU time"%(clock()-start) def BBCheck(self, BB1, BB2): diff --git a/wxPython/wx/lib/gridmovers.py b/wxPython/wx/lib/gridmovers.py index b3163e7edc..018e80fc15 100644 --- a/wxPython/wx/lib/gridmovers.py +++ b/wxPython/wx/lib/gridmovers.py @@ -92,7 +92,7 @@ wxGrid.RowToRect = _RowToRect class ColDragWindow(wxWindow): def __init__(self,parent,image,dragCol): - wxWindow.__init__(self,parent,wxSIMPLE_BORDER) + wxWindow.__init__(self,parent,-1, style=wxSIMPLE_BORDER) self.image = image self.SetSize((self.image.GetWidth(),self.image.GetHeight())) self.ux = parent.GetScrollPixelsPerUnit()[0] @@ -139,19 +139,19 @@ class ColDragWindow(wxWindow): def OnPaint(self,evt): dc = wxPaintDC(self) w,h = self.GetSize() - dc.DrawBitmap(self.image,0,0) + dc.DrawBitmap(self.image, (0,0)) dc.SetPen(wxPen(wxBLACK,1,wxSOLID)) dc.SetBrush(wxTRANSPARENT_BRUSH) - dc.DrawRectangle(0,0,w,h) + dc.DrawRectangle((0,0), (w,h)) iPos = self.GetInsertionPos() - dc.DrawLine(iPos,h - 10,iPos,h) + dc.DrawLine((iPos,h - 10), (iPos,h)) class RowDragWindow(wxWindow): def __init__(self,parent,image,dragRow): - wxWindow.__init__(self,parent,wxSIMPLE_BORDER) + wxWindow.__init__(self,parent,-1, style=wxSIMPLE_BORDER) self.image = image self.SetSize((self.image.GetWidth(),self.image.GetHeight())) self.uy = parent.GetScrollPixelsPerUnit()[1] @@ -198,12 +198,12 @@ class RowDragWindow(wxWindow): def OnPaint(self,evt): dc = wxPaintDC(self) w,h = self.GetSize() - dc.DrawBitmap(self.image,0,0) + dc.DrawBitmap(self.image, (0,0)) dc.SetPen(wxPen(wxBLACK,1,wxSOLID)) dc.SetBrush(wxTRANSPARENT_BRUSH) - dc.DrawRectangle(0,0,w,h) + dc.DrawRectangle((0,0), (w,h)) iPos = self.GetInsertionPos() - dc.DrawLine(w - 10,iPos,w,iPos) + dc.DrawLine((w - 10,iPos), (w,iPos)) #---------------------------------------------------------------------------- @@ -306,7 +306,7 @@ class wxGridColMover(wxEvtHandler): memdc = wxMemoryDC() memdc.SelectObject(bmp) dc = wxWindowDC(self.lwin) - memdc.Blit(0,0,rect.width,rect.height,dc,rect.x,rect.y) + memdc.Blit((0,0), rect.GetSize(), dc, rect.GetPosition()) memdc.SelectObject(wxNullBitmap) return bmp @@ -411,7 +411,7 @@ class wxGridRowMover(wxEvtHandler): memdc = wxMemoryDC() memdc.SelectObject(bmp) dc = wxWindowDC(self.lwin) - memdc.Blit(0,0,rect.width,rect.height,dc,rect.x,rect.y) + memdc.Blit((0,0), rect.GetSize(), dc, rect.GetPosition()) memdc.SelectObject(wxNullBitmap) return bmp diff --git a/wxPython/wx/lib/maskededit.py b/wxPython/wx/lib/maskededit.py index ec91ae53e1..00d3c9aaa9 100644 --- a/wxPython/wx/lib/maskededit.py +++ b/wxPython/wx/lib/maskededit.py @@ -1723,7 +1723,7 @@ class wxMaskedEditMixin: 'foregroundColour', 'signedForegroundColour'): if ctrl_kwargs.has_key(key): if type(ctrl_kwargs[key]) in (types.StringType, types.UnicodeType): - c = wxNamedColor(ctrl_kwargs[key]) + c = wxNamedColour(ctrl_kwargs[key]) if c.Get() == (-1, -1, -1): raise TypeError('%s not a legal color specification for %s' % (repr(ctrl_kwargs[key]), key)) else: @@ -2262,7 +2262,7 @@ class wxMaskedEditMixin: # if no fillchar change, but old value == old template, replace it: if newvalue == old_template: newvalue = self._template - reset_value = true + reset_value = True else: self._defaultValue = None @@ -2768,7 +2768,7 @@ class wxMaskedEditMixin: if newfield != field and newfield._selectOnFieldEntry: dbg('queuing selection: (%d, %d)' % (newfield._extent[0], newfield._extent[1])) wxCallAfter(self._SetSelection, newfield._extent[0], newfield._extent[1]) - keep_processing = false + keep_processing = False elif keep_processing: dbg('char not allowed') @@ -2985,7 +2985,7 @@ class wxMaskedEditMixin: def _OnCtrl_Z(self, event=None): """ Handles ctrl-Z keypress in control and Undo operation on context menu. - Should return false to skip other processing. """ + Should return False to skip other processing. """ dbg("wxMaskedEditMixin::_OnCtrl_Z", indent=1) self.Undo() dbg(indent=0) @@ -3415,7 +3415,7 @@ class wxMaskedEditMixin: dbg('cursor before 1st field; cannot change to a previous field') if not wxValidator_IsSilent(): wxBell() - return false + return False if event.ControlDown(): dbg('queuing select to beginning of field:', field_start, pos) @@ -4218,7 +4218,7 @@ class wxMaskedEditMixin: if self._isTemplateChar( pos ): ## if a template character, return empty - dbg('%d is a template character; returning false' % pos, indent=0) + dbg('%d is a template character; returning False' % pos, indent=0) return False if self._isMaskChar( pos ): @@ -4263,7 +4263,7 @@ class wxMaskedEditMixin: dbg(indent=0) return approved else: - dbg('%d is a !???! character; returning false', indent=0) + dbg('%d is a !???! character; returning False', indent=0) return False @@ -4846,7 +4846,7 @@ class wxMaskedEditMixin: else: text = candidate - valid = True # assume true + valid = True # assume True for i in [-1] + self._field_indices: # process global constraints first: field = self._fields[i] start, end = field._extent @@ -5840,12 +5840,12 @@ class wxMaskedTextCtrl( wxTextCtrl, wxMaskedEditMixin ): self._isNeg = False # (clear current assumptions) value = self._adjustInt(value) elif self._isDate and not self.IsValid(value) and self._4digityear: - value = self._adjustDate(value, fixcentury=true) + value = self._adjustDate(value, fixcentury=True) except ValueError: # If date, year might be 2 digits vs. 4; try adjusting it: if self._isDate and self._4digityear: dateparts = value.split(' ') - dateparts[0] = self._adjustDate(dateparts[0], fixcentury=true) + dateparts[0] = self._adjustDate(dateparts[0], fixcentury=True) value = string.join(dateparts, ' ') dbg('adjusted value: "%s"' % value) value = self._Paste(value, raise_on_invalid=True, just_return_value=True) @@ -6157,12 +6157,12 @@ class wxMaskedComboBox( wxComboBox, wxMaskedEditMixin ): self._isNeg = False # (clear current assumptions) value = self._adjustInt(value) elif self._isDate and not self.IsValid(value) and self._4digityear: - value = self._adjustDate(value, fixcentury=true) + value = self._adjustDate(value, fixcentury=True) except ValueError: # If date, year might be 2 digits vs. 4; try adjusting it: if self._isDate and self._4digityear: dateparts = value.split(' ') - dateparts[0] = self._adjustDate(dateparts[0], fixcentury=true) + dateparts[0] = self._adjustDate(dateparts[0], fixcentury=True) value = string.join(dateparts, ' ') dbg('adjusted value: "%s"' % value) value = self._Paste(value, raise_on_invalid=True, just_return_value=True) @@ -6547,7 +6547,7 @@ class wxIpAddrCtrl( wxMaskedTextCtrl ): dbg(indent=0) raise ValueError('%s must be a string', str(value)) - bValid = True # assume true + bValid = True # assume True parts = value.split('.') if len(parts) != 4: bValid = False diff --git a/wxPython/wx/lib/multisash.py b/wxPython/wx/lib/multisash.py index 9f5602e5a6..2c7d5a537b 100644 --- a/wxPython/wx/lib/multisash.py +++ b/wxPython/wx/lib/multisash.py @@ -592,10 +592,8 @@ class MultiCreator(wxWindow): dc.SetBackground(wxBrush(self.GetBackgroundColour(),wxSOLID)) dc.Clear() - highlight = wxPen(wxSystemSettings_GetSystemColour( - wxSYS_COLOUR_BTNHIGHLIGHT),1,wxSOLID) - shadow = wxPen(wxSystemSettings_GetSystemColour( - wxSYS_COLOUR_BTNSHADOW),1,wxSOLID) + highlight = wxPen(wxSystemSettings_GetColour(wxSYS_COLOUR_BTNHIGHLIGHT), 1, wxSOLID) + shadow = wxPen(wxSystemSettings_GetColour(wxSYS_COLOUR_BTNSHADOW), 1, wxSOLID) black = wxPen(wxBLACK,1,wxSOLID) w,h = self.GetSizeTuple() w -= 1 @@ -603,13 +601,13 @@ class MultiCreator(wxWindow): # Draw outline dc.SetPen(highlight) - dc.DrawLine(0,0,0,h) - dc.DrawLine(0,0,w,0) + dc.DrawLine((0,0), (0,h)) + dc.DrawLine((0,0), (w,0)) dc.SetPen(black) - dc.DrawLine(0,h,w+1,h) - dc.DrawLine(w,0,w,h) + dc.DrawLine((0,h), (w+1,h)) + dc.DrawLine((w,0), (w,h)) dc.SetPen(shadow) - dc.DrawLine(w-1,2,w-1,h) + dc.DrawLine((w-1,2), (w-1,h)) #---------------------------------------------------------------------- @@ -685,11 +683,11 @@ def DrawSash(win,x,y,direction): bmp = wxEmptyBitmap(8,8) bdc = wxMemoryDC() bdc.SelectObject(bmp) - bdc.DrawRectangle(-1,-1,10,10) + bdc.DrawRectangle((-1,-1), (10,10)) for i in range(8): for j in range(8): if ((i + j) & 1): - bdc.DrawPoint(i,j) + bdc.DrawPoint((i,j)) brush = wxBrush(wxColour(0,0,0)) brush.SetStipple(bmp) @@ -719,8 +717,8 @@ def DrawSash(win,x,y,direction): h = body_h if direction == MV_HOR: - dc.DrawRectangle(x,y-2,w,4) + dc.DrawRectangle((x,y-2), (w,4)) else: - dc.DrawRectangle(x-2,y,4,h) + dc.DrawRectangle((x-2,y), (4,h)) dc.EndDrawingOnTop() diff --git a/wxPython/wx/lib/popupctl.py b/wxPython/wx/lib/popupctl.py index 76dfc6de19..065379ccab 100644 --- a/wxPython/wx/lib/popupctl.py +++ b/wxPython/wx/lib/popupctl.py @@ -29,12 +29,12 @@ class PopButton(wxPyControl): EVT_PAINT(self, self.OnPaint) def InitColours(self): - faceClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNFACE) + faceClr = wxSystemSettings_GetColour(wxSYS_COLOUR_BTNFACE) self.faceDnClr = faceClr self.SetBackgroundColour(faceClr) - shadowClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNSHADOW) - highlightClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNHIGHLIGHT) + shadowClr = wxSystemSettings_GetColour(wxSYS_COLOUR_BTNSHADOW) + highlightClr = wxSystemSettings_GetColour(wxSYS_COLOUR_BTNHIGHLIGHT) self.shadowPen = wxPen(shadowClr, 1, wxSOLID) self.highlightPen = wxPen(highlightClr, 1, wxSOLID) self.blackPen = wxPen(wxBLACK, 1, wxSOLID) @@ -95,8 +95,8 @@ class PopButton(wxPyControl): else: dc.SetPen(self.shadowPen) for i in range(2): - dc.DrawLine(x1+i, y1, x1+i, y2-i) - dc.DrawLine(x1, y1+i, x2-i, y1+i) + dc.DrawLine((x1+i, y1), (x1+i, y2-i)) + dc.DrawLine((x1, y1+i), (x2-i, y1+i)) # draw the lower right sides if self.up: @@ -104,20 +104,20 @@ class PopButton(wxPyControl): else: dc.SetPen(self.highlightPen) for i in range(2): - dc.DrawLine(x1+i, y2-i, x2+1, y2-i) - dc.DrawLine(x2-i, y1+i, x2-i, y2) + dc.DrawLine((x1+i, y2-i), (x2+1, y2-i)) + dc.DrawLine((x2-i, y1+i), (x2-i, y2)) def DrawArrow(self,dc): size = self.GetSize() - mx = size.x / 2 - my = size.y / 2 + mx = size.width / 2 + my = size.height / 2 dc.SetPen(self.highlightPen) - dc.DrawLine(mx-5,my-5,mx+5,my-5) - dc.DrawLine(mx-5,my-5,mx,my+5) + dc.DrawLine((mx-5,my-5), (mx+5,my-5)) + dc.DrawLine((mx-5,my-5), (mx,my+5)) dc.SetPen(self.shadowPen) - dc.DrawLine(mx+4,my-5,mx,my+5) + dc.DrawLine((mx+4,my-5), (mx,my+5)) dc.SetPen(self.blackPen) - dc.DrawLine(mx+5,my-5,mx,my+5) + dc.DrawLine((mx+5,my-5), (mx,my+5)) def OnPaint(self, event): width, height = self.GetClientSizeTuple() @@ -161,15 +161,15 @@ class wxPopupDialog(wxDialog): selfSize = self.GetSize() tcSize = self.ctrl.GetSize() - pos.x -= (selfSize.x - tcSize.x) / 2 - if pos.x + selfSize.x > dSize.x: - pos.x = dSize.x - selfSize.x + pos.x -= (selfSize.width - tcSize.width) / 2 + if pos.x + selfSize.width > dSize.width: + pos.x = dSize.width - selfSize.width if pos.x < 0: pos.x = 0 pos.y += tcSize.height - if pos.y + selfSize.y > dSize.y: - pos.y = dSize.y - selfSize.y + if pos.y + selfSize.height > dSize.height: + pos.y = dSize.height - selfSize.height if pos.y < 0: pos.y = 0 diff --git a/wxPython/wxPython/calendar.py b/wxPython/wxPython/calendar.py index 2fbcf9dc00..e41c80d716 100644 --- a/wxPython/wxPython/calendar.py +++ b/wxPython/wxPython/calendar.py @@ -48,3 +48,11 @@ wxPreCalendarCtrl = wx.calendar.PreCalendarCtrl wxCalendarCtrl = wx.calendar.CalendarCtrl +d = globals() +for k, v in wx.calendar.__dict__.iteritems(): + if k.startswith('EVT'): + d[k] = v +del d, k, v + + + diff --git a/wxPython/wxPython/lib/colourchooser/__init__.py b/wxPython/wxPython/lib/colourchooser/__init__.py index 792d600548..904462b2aa 100644 --- a/wxPython/wxPython/lib/colourchooser/__init__.py +++ b/wxPython/wxPython/lib/colourchooser/__init__.py @@ -1 +1,28 @@ -# +""" +wxPyColourChooser +Copyright (C) 2002 Michael Gilfix + +This file is part of wxPyColourChooser. + +This version of wxPyColourChooser is open source; you can redistribute it +and/or modify it under the licensed terms. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +""" + +from pycolourchooser import * + +# For the American in you +wxPyColorChooser = wxPyColourChooser + +__all__ = [ + 'canvas', + 'pycolourbox', + 'pycolourchooser', + 'pycolourslider', + 'pypalette', +] + + diff --git a/wxPython/wxPython/lib/editor/__init__.py b/wxPython/wxPython/lib/editor/__init__.py index 792d600548..a5dab2cdd6 100644 --- a/wxPython/wxPython/lib/editor/__init__.py +++ b/wxPython/wxPython/lib/editor/__init__.py @@ -1 +1,2 @@ -# +from editor import wxEditor + -- 2.47.2