diff --git a/wxPython/contrib/xrc/_xrcextras.py b/wxPython/contrib/xrc/_xrcextras.py index c4f42b0cba..9562aea2eb 100644 --- a/wxPython/contrib/xrc/_xrcextras.py +++ b/wxPython/contrib/xrc/_xrcextras.py @@ -14,7 +14,7 @@ wx.wxXmlNodePtr = wxXmlNodePtr def _my_import(name): mod = __import__(name) - components = string.split(name, '.') + components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) return mod diff --git a/wxPython/contrib/xrc/xrc.py b/wxPython/contrib/xrc/xrc.py index 78e100476c..11f9e49b44 100644 --- a/wxPython/contrib/xrc/xrc.py +++ b/wxPython/contrib/xrc/xrc.py @@ -551,7 +551,7 @@ wx.wxXmlNodePtr = wxXmlNodePtr def _my_import(name): mod = __import__(name) - components = string.split(name, '.') + components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) return mod diff --git a/wxPython/src/filesys.i b/wxPython/src/filesys.i index a2732f058f..69d782e325 100644 --- a/wxPython/src/filesys.i +++ b/wxPython/src/filesys.i @@ -33,7 +33,6 @@ %import streams.i %pragma(python) code = "import wx" -%pragma(python) code = "import string" //--------------------------------------------------------------------------- diff --git a/wxPython/src/sizers.i b/wxPython/src/sizers.i index 7351d910d2..094a534be5 100644 --- a/wxPython/src/sizers.i +++ b/wxPython/src/sizers.i @@ -30,7 +30,6 @@ %import controls.i %pragma(python) code = "import wx" -%pragma(python) code = "import string" //--------------------------------------------------------------------------- @@ -175,7 +174,7 @@ public: def Add(self, *args, **kw): if type(args[0]) == type(1): apply(self.AddSpacer, args, kw) - elif string.find(args[0].this, 'Sizer') != -1: + elif isinstance(args[0], wxSizerPtr): apply(self.AddSizer, args, kw) else: apply(self.AddWindow, args, kw) @@ -183,7 +182,7 @@ public: def Insert(self, *args, **kw): if type(args[1]) == type(1): apply(self.InsertSpacer, args, kw) - elif string.find(args[1].this, 'Sizer') != -1: + elif isinstance(args[0], wxSizerPtr): apply(self.InsertSizer, args, kw) else: apply(self.InsertWindow, args, kw) @@ -191,7 +190,7 @@ public: def Prepend(self, *args, **kw): if type(args[0]) == type(1): apply(self.PrependSpacer, args, kw) - elif string.find(args[0].this, 'Sizer') != -1: + elif isinstance(args[0], wxSizerPtr): apply(self.PrependSizer, args, kw) else: apply(self.PrependWindow, args, kw) @@ -199,7 +198,7 @@ public: def Remove(self, *args, **kw): if type(args[0]) == type(1): return apply(self.RemovePos, args, kw) - elif string.find(args[0].this, 'Sizer') != -1: + elif isinstance(args[0], wxSizerPtr): return apply(self.RemoveSizer, args, kw) else: return apply(self.RemoveWindow, args, kw) @@ -223,7 +222,7 @@ public: def SetItemMinSize(self, *args): if type(args[0]) == type(1): apply(self.SetItemMinSizePos, args) - elif string.find(args[0].this, 'Sizer') != -1: + elif isinstance(args[0], wxSizerPtr): apply(self.SetItemMinSizeSizer, args) else: apply(self.SetItemMinSizeWindow, args) @@ -277,19 +276,19 @@ public: %pragma(python) addtoclass = " def Show(self, *args): - if string.find(args[0].this, 'Sizer') != -1: + if isinstance(args[0], wxSizerPtr): apply(self.ShowSizer, args) else: apply(self.ShowWindow, args) def Hide(self, *args): - if string.find(args[0].this, 'Sizer') != -1: + if isinstance(args[0], wxSizerPtr): apply(self.HideSizer, args) else: apply(self.HideWindow, args) def IsShown(self, *args): - if string.find(args[0].this, 'Sizer') != -1: + if isinstance(args[0], wxSizerPtr): return apply(self.IsShownSizer, args) else: return apply(self.IsShownWindow, args) diff --git a/wxPython/src/streams.i b/wxPython/src/streams.i index a0776cdf64..8bf7f2156d 100644 --- a/wxPython/src/streams.i +++ b/wxPython/src/streams.i @@ -28,7 +28,6 @@ %import _defs.i %pragma(python) code = "import wx" -%pragma(python) code = "import string" //---------------------------------------------------------------------- // typemaps for wxInputStream diff --git a/wxPython/src/utils.i b/wxPython/src/utils.i index 07aa916f60..9b19149c5f 100644 --- a/wxPython/src/utils.i +++ b/wxPython/src/utils.i @@ -35,7 +35,7 @@ // Import some definitions of other classes, etc. %import _defs.i -%pragma(python) code = "import string" +%pragma(python) code = "import wx" //--------------------------------------------------------------------------- @@ -762,17 +762,17 @@ public: %pragma(python) addtoclass = " def __add__(self, other): - if string.find(other.this, 'wxTimeSpan') != -1: + if isinstance(other, wxTimeSpanPtr): return self.__add__TS(other) - if string.find(other.this, 'wxDateSpan') != -1: + if isinstance(other, wxDateSpanPtr): return self.__add__DS(other) raise TypeError, 'Invalid r.h.s. type for __add__' def __sub__(self, other): - if string.find(other.this, 'wxDateTime') != -1: + if isinstance(other, wxDateTimePtr): return self.__sub__DT(other) - if string.find(other.this, 'wxTimeSpan') != -1: + if isinstance(other, wxTimeSpanPtr): return self.__sub__TS(other) - if string.find(other.this, 'wxDateSpan') != -1: + if isinstnace(other, wxDateSpanPtr): return self.__sub__DS(other) raise TypeError, 'Invalid r.h.s. type for __sub__' "