diff --git a/wxPython/CHANGES.txt b/wxPython/CHANGES.txt index 1f94276ec2..a084f8763e 100644 --- a/wxPython/CHANGES.txt +++ b/wxPython/CHANGES.txt @@ -2,11 +2,19 @@ CHANGES.txt for wxPython ---------------------------------------------------------------------- -????? +2.4.0.8 ------- Added wxScrolledPanel from Wil Sadkin +Added SetShape method to top level windows (e.g. wxFrame.) + +Changed wxSWIG to not generate Python code using apply, (since it will +be deprecated in the future) wxSWIG will use spam(*args, **kw) syntax +instead. Also changed the generated __repr__ methods to be a bit more +informative. + + 2.4.0.7 diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index 9ad4a07ff4..40b307c43b 100644 --- a/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -732,7 +732,7 @@ def wxCallAfter(callable, *args, **kw): if _wxCallAfterId is None: _wxCallAfterId = wxNewEventType() app.Connect(-1, -1, _wxCallAfterId, - lambda event: apply(event.callable, event.args, event.kw) ) + lambda event: event.callable(*event.args, **event.kw) ) evt = wxPyEvent() evt.SetEventType(_wxCallAfterId) evt.callable = callable @@ -904,7 +904,7 @@ class wxPyWidgetTester(wxApp): return True def SetWidget(self, widgetClass, *args): - w = apply(widgetClass, (self.frame,) + args) + w = widgetClass(self.frame, *args) self.frame.Show(True) #---------------------------------------------------------------------------- diff --git a/wxPython/src/controls2.i b/wxPython/src/controls2.i index 323166e3a8..9ace2b41ff 100644 --- a/wxPython/src/controls2.i +++ b/wxPython/src/controls2.i @@ -454,7 +454,7 @@ public: } // The OOR typemaps don't know what to do with the %new, so fix it up. %pragma(python) addtoclass = " def GetColumn(self, *_args, **_kwargs): - val = apply(controls2c.wxListCtrl_GetColumn,(self,) + _args, _kwargs) + val = ontrols2c.wxListCtrl_GetColumn(self, *_args, **_kwargs) if val is not None: val.thisown = 1 return val " @@ -493,7 +493,7 @@ public: } // The OOR typemaps don't know what to do with the %new, so fix it up. %pragma(python) addtoclass = " def GetItem(self, *_args, **_kwargs): - val = apply(controls2c.wxListCtrl_GetItem,(self,) + _args, _kwargs) + val = controls2c.wxListCtrl_GetItem(self, *_args, **_kwargs) if val is not None: val.thisown = 1 return val " @@ -1355,17 +1355,17 @@ public: %pragma(python) addtoclass = " # Redefine some methods that SWIG gets a bit confused on... def GetFirstChild(self, *_args, **_kwargs): - val1,val2 = apply(controls2c.wxTreeCtrl_GetFirstChild,(self,) + _args, _kwargs) + val1,val2 = controls2c.wxTreeCtrl_GetFirstChild(self, *_args, **_kwargs) val1 = wxTreeItemIdPtr(val1) val1.thisown = 1 return (val1,val2) def GetNextChild(self, *_args, **_kwargs): - val1,val2 = apply(controls2c.wxTreeCtrl_GetNextChild,(self,) + _args, _kwargs) + val1,val2 = controls2c.wxTreeCtrl_GetNextChild(self, *_args, **_kwargs) val1 = wxTreeItemIdPtr(val1) val1.thisown = 1 return (val1,val2) def HitTest(self, *_args, **_kwargs): - val1, val2 = apply(controls2c.wxTreeCtrl_HitTest,(self,) + _args, _kwargs) + val1, val2 = controls2c.wxTreeCtrl_HitTest(self, *_args, **_kwargs) val1 = wxTreeItemIdPtr(val1) val1.thisown = 1 return (val1,val2) @@ -1458,6 +1458,9 @@ public: wxTreeCtrl* GetTreeCtrl() const; wxDirFilterListCtrl* GetFilterListCtrl() const; + // Collapse & expand the tree, thus re-creating it from scratch: + void ReCreateTree(); + // //// Helpers // void SetupSections(); // // Parse the filter into an array of filters and an array of descriptions diff --git a/wxPython/src/fonts.i b/wxPython/src/fonts.i index dffe3ed4d2..1270262182 100644 --- a/wxPython/src/fonts.i +++ b/wxPython/src/fonts.i @@ -739,9 +739,9 @@ public: %pragma(python) addtoclass = " def Init(self, *_args, **_kwargs): if type(_args[0]) in [type(''), type(u'')]: - val = apply(self.Init1, _args, _kwargs) + val = self.Init1(*_args, **_kwargs) else: - val = apply(self.Init2, _args, _kwargs) + val = self.Init2(*_args, **_kwargs) return val " diff --git a/wxPython/src/sizers.i b/wxPython/src/sizers.i index d456bd923d..763012cddf 100644 --- a/wxPython/src/sizers.i +++ b/wxPython/src/sizers.i @@ -173,41 +173,41 @@ public: %pragma(python) addtoclass = " def Add(self, *args, **kw): if type(args[0]) == type(1): - apply(self.AddSpacer, args, kw) + self.AddSpacer(*args, **kw) elif isinstance(args[0], wxSizerPtr): - apply(self.AddSizer, args, kw) + self.AddSizer(*args, **kw) elif isinstance(args[0], wxWindowPtr): - apply(self.AddWindow, args, kw) + self.AddWindow(*args, **kw) else: raise TypeError, 'Expected int, wxSizer or wxWindow parameter' def Insert(self, *args, **kw): if type(args[1]) == type(1): - apply(self.InsertSpacer, args, kw) + self.InsertSpacer(*args, **kw) elif isinstance(args[1], wxSizerPtr): - apply(self.InsertSizer, args, kw) + self.InsertSizer(*args, **kw) elif isinstance(args[1], wxWindowPtr): - apply(self.InsertWindow, args, kw) + self.InsertWindow(*args, **kw) else: raise TypeError, 'Expected int, wxSizer or wxWindow parameter' def Prepend(self, *args, **kw): if type(args[0]) == type(1): - apply(self.PrependSpacer, args, kw) + self.PrependSpacer(*args, **kw) elif isinstance(args[0], wxSizerPtr): - apply(self.PrependSizer, args, kw) + self.PrependSizer(*args, **kw) elif isinstance(args[0], wxWindowPtr): - apply(self.PrependWindow, args, kw) + self.PrependWindow(*args, **kw) else: raise TypeError, 'Expected int, wxSizer or wxWindow parameter' def Remove(self, *args, **kw): if type(args[0]) == type(1): - return apply(self.RemovePos, args, kw) + return self.RemovePos(*args, **kw) elif isinstance(args[0], wxSizerPtr): - return apply(self.RemoveSizer, args, kw) + return self.RemoveSizer(*args, **kw) elif isinstance(args[0], wxWindowPtr): - return apply(self.RemoveWindow, args, kw) + return self.RemoveWindow(*args, **kw) else: raise TypeError, 'Expected int, wxSizer or wxWindow parameter' @@ -215,7 +215,7 @@ public: for childinfo in widgets: if type(childinfo) != type(()): childinfo = (childinfo, ) - apply(self.Add, childinfo) + self.Add(*childinfo) " @@ -229,11 +229,11 @@ public: %pragma(python) addtoclass = " def SetItemMinSize(self, *args): if type(args[0]) == type(1): - apply(self.SetItemMinSizePos, args) + self.SetItemMinSizePos(*args) elif isinstance(args[0], wxSizerPtr): - apply(self.SetItemMinSizeSizer, args) + self.SetItemMinSizeSizer(*args) elif isinstance(args[0], wxWindowPtr): - apply(self.SetItemMinSizeWindow, args) + self.SetItemMinSizeWindow(*args) else: raise TypeError, 'Expected int, wxSizer or wxWindow parameter' " @@ -287,25 +287,25 @@ public: %pragma(python) addtoclass = " def Show(self, *args): if isinstance(args[0], wxSizerPtr): - apply(self.ShowSizer, args) + self.ShowSizer(*args) elif isinstance(args[0], wxWindowPtr): - apply(self.ShowWindow, args) + self.ShowWindow(*args) else: raise TypeError, 'Expected wxSizer or wxWindow parameter' def Hide(self, *args): if isinstance(args[0], wxSizerPtr): - apply(self.HideSizer, args) + self.HideSizer(*args) elif isinstance(args[0], wxWindowPtr): - apply(self.HideWindow, args) + self.HideWindow(*args) else: raise TypeError, 'Expected wxSizer or wxWindow parameter' def IsShown(self, *args): if isinstance(args[0], wxSizerPtr): - return apply(self.IsShownSizer, args) + return self.IsShownSizer(*args) elif isinstance(args[0], wxWindowPtr): - return apply(self.IsShownWindow, args) + return self.IsShownWindow(*args) else: raise TypeError, 'Expected wxSizer or wxWindow parameter' " diff --git a/wxPython/src/windows.i b/wxPython/src/windows.i index 5b6ccf56da..3ef5d30c54 100644 --- a/wxPython/src/windows.i +++ b/wxPython/src/windows.i @@ -431,7 +431,7 @@ public: %pragma(python) addtoclass = "# replaces broken shadow method def GetCaret(self, *_args, **_kwargs): from misc2 import wxCaretPtr - val = apply(windowsc.wxWindow_GetCaret,(self,) + _args, _kwargs) + val = windowsc.wxWindow_GetCaret(self, *_args, **_kwargs) if val: val = wxCaretPtr(val) return val " @@ -613,17 +613,17 @@ public: %pragma(python) addtoclass = " def CalcScrolledPosition(self, *args): if len(args) == 1: - return apply(self.CalcScrolledPosition1, args) + return self.CalcScrolledPosition1(*args) elif len(args) == 2: - return apply(self.CalcScrolledPosition2, args) + return self.CalcScrolledPosition2(*args) else: raise TypeError, 'Invalid parameters: only (x,y) or (point) allowed' def CalcUnscrolledPosition(self, *args): if len(args) == 1: - return apply(self.CalcUnscrolledPosition1, args) + return self.CalcUnscrolledPosition1(*args) elif len(args) == 2: - return apply(self.CalcUnscrolledPosition2, args) + return self.CalcUnscrolledPosition2(*args) else: raise TypeError, 'Invalid parameters: only (x,y) or (point) allowed' " diff --git a/wxPython/wxSWIG/Modules/pycpp.cxx b/wxPython/wxSWIG/Modules/pycpp.cxx index 89cd85ffd5..b4021d7256 100644 --- a/wxPython/wxSWIG/Modules/pycpp.cxx +++ b/wxPython/wxSWIG/Modules/pycpp.cxx @@ -146,7 +146,7 @@ void PYTHON::cpp_member_func(char *name, char *iname, DataType *t, ParmList *l) if (docstring && doc_entry) { *pyclass << tab8 << "\"\"\"" << add_docstring(doc_entry) << "\"\"\"\n"; } - *pyclass << tab8 << "val = apply(" << module << "." << name_member(realname,class_name) << ",(self,) + _args, _kwargs)\n"; + *pyclass << tab8 << "val = " << module << "." << name_member(realname,class_name) << "(self, *_args, **_kwargs)\n"; // Check to see if the return type is an object if ((hash.lookup(t->name)) && (t->is_pointer <= 1)) { @@ -216,7 +216,7 @@ void PYTHON::cpp_constructor(char *name, char *iname, ParmList *l) { if (docstring && doc_entry) *construct << tab8 << "\"\"\"" << add_docstring(doc_entry) << "\"\"\"\n"; - *construct << tab8 << "self.this = apply(" << module << "." << name_construct(realname) << ",_args,_kwargs)\n"; + *construct << tab8 << "self.this = " << module << "." << name_construct(realname) << "(*_args,**_kwargs)\n"; *construct << tab8 << "self.thisown = 1\n"; emitAddPragmas(*construct,"__init__",tab8); have_constructor = 1; @@ -226,8 +226,8 @@ void PYTHON::cpp_constructor(char *name, char *iname, ParmList *l) { // function for it. *additional << "def " << realname << "(*_args,**_kwargs):\n"; - *additional << tab4 << "val = " << class_name << "Ptr(apply(" - << module << "." << name_construct(realname) << ",_args,_kwargs))\n" + *additional << tab4 << "val = " << class_name << "Ptr(" + << module << "." << name_construct(realname) << "(*_args,**_kwargs))\n" << tab4 << "val.thisown = 1\n"; emitAddPragmas(*additional, realname, tab4); *additional << tab4 << "return val\n\n"; @@ -322,7 +322,7 @@ void PYTHON::cpp_close_class() { if (!have_repr) { // Supply a repr method for this class repr << tab4 << "def __repr__(self):\n" - << tab8 << "return \"\" % (self.this,)\n"; + << tab8 << "return \"<%s.%s instance; proxy of C++ " << class_name <<" instance at %s>\" % (self.__class__.__module__, self.__class__.__name__, self.this)\n"; classes << repr; emitAddPragmas(classes,"__class__",tab4); diff --git a/wxPython/wxSWIG/Modules/python.cxx b/wxPython/wxSWIG/Modules/python.cxx index 8d26c6f8f2..9abad191f2 100644 --- a/wxPython/wxSWIG/Modules/python.cxx +++ b/wxPython/wxSWIG/Modules/python.cxx @@ -1071,7 +1071,7 @@ void PYTHON::create_function(char *name, char *iname, DataType *d, ParmList *l) func << tab4 << "\"\"\"" << add_docstring(doc_entry) << "\"\"\"\n"; } - func << tab4 << "val = apply(" << module << "." << iname << ",_args,_kwargs)\n"; + func << tab4 << "val = " << module << "." << iname << "(*_args,**_kwargs)\n"; if (munge_return) { // If the output of this object has been remapped in any way, we're