More string module migrations

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18737 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-01-15 00:23:35 +00:00
parent 56d3350d72
commit 5c07db1928
6 changed files with 16 additions and 19 deletions

View File

@@ -14,7 +14,7 @@ wx.wxXmlNodePtr = wxXmlNodePtr
def _my_import(name): def _my_import(name):
mod = __import__(name) mod = __import__(name)
components = string.split(name, '.') components = name.split('.')
for comp in components[1:]: for comp in components[1:]:
mod = getattr(mod, comp) mod = getattr(mod, comp)
return mod return mod

View File

@@ -551,7 +551,7 @@ wx.wxXmlNodePtr = wxXmlNodePtr
def _my_import(name): def _my_import(name):
mod = __import__(name) mod = __import__(name)
components = string.split(name, '.') components = name.split('.')
for comp in components[1:]: for comp in components[1:]:
mod = getattr(mod, comp) mod = getattr(mod, comp)
return mod return mod

View File

@@ -33,7 +33,6 @@
%import streams.i %import streams.i
%pragma(python) code = "import wx" %pragma(python) code = "import wx"
%pragma(python) code = "import string"
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -30,7 +30,6 @@
%import controls.i %import controls.i
%pragma(python) code = "import wx" %pragma(python) code = "import wx"
%pragma(python) code = "import string"
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -175,7 +174,7 @@ public:
def Add(self, *args, **kw): def Add(self, *args, **kw):
if type(args[0]) == type(1): if type(args[0]) == type(1):
apply(self.AddSpacer, args, kw) apply(self.AddSpacer, args, kw)
elif string.find(args[0].this, 'Sizer') != -1: elif isinstance(args[0], wxSizerPtr):
apply(self.AddSizer, args, kw) apply(self.AddSizer, args, kw)
else: else:
apply(self.AddWindow, args, kw) apply(self.AddWindow, args, kw)
@@ -183,7 +182,7 @@ public:
def Insert(self, *args, **kw): def Insert(self, *args, **kw):
if type(args[1]) == type(1): if type(args[1]) == type(1):
apply(self.InsertSpacer, args, kw) apply(self.InsertSpacer, args, kw)
elif string.find(args[1].this, 'Sizer') != -1: elif isinstance(args[0], wxSizerPtr):
apply(self.InsertSizer, args, kw) apply(self.InsertSizer, args, kw)
else: else:
apply(self.InsertWindow, args, kw) apply(self.InsertWindow, args, kw)
@@ -191,7 +190,7 @@ public:
def Prepend(self, *args, **kw): def Prepend(self, *args, **kw):
if type(args[0]) == type(1): if type(args[0]) == type(1):
apply(self.PrependSpacer, args, kw) apply(self.PrependSpacer, args, kw)
elif string.find(args[0].this, 'Sizer') != -1: elif isinstance(args[0], wxSizerPtr):
apply(self.PrependSizer, args, kw) apply(self.PrependSizer, args, kw)
else: else:
apply(self.PrependWindow, args, kw) apply(self.PrependWindow, args, kw)
@@ -199,7 +198,7 @@ public:
def Remove(self, *args, **kw): def Remove(self, *args, **kw):
if type(args[0]) == type(1): if type(args[0]) == type(1):
return apply(self.RemovePos, args, kw) 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) return apply(self.RemoveSizer, args, kw)
else: else:
return apply(self.RemoveWindow, args, kw) return apply(self.RemoveWindow, args, kw)
@@ -223,7 +222,7 @@ public:
def SetItemMinSize(self, *args): def SetItemMinSize(self, *args):
if type(args[0]) == type(1): if type(args[0]) == type(1):
apply(self.SetItemMinSizePos, args) apply(self.SetItemMinSizePos, args)
elif string.find(args[0].this, 'Sizer') != -1: elif isinstance(args[0], wxSizerPtr):
apply(self.SetItemMinSizeSizer, args) apply(self.SetItemMinSizeSizer, args)
else: else:
apply(self.SetItemMinSizeWindow, args) apply(self.SetItemMinSizeWindow, args)
@@ -277,19 +276,19 @@ public:
%pragma(python) addtoclass = " %pragma(python) addtoclass = "
def Show(self, *args): def Show(self, *args):
if string.find(args[0].this, 'Sizer') != -1: if isinstance(args[0], wxSizerPtr):
apply(self.ShowSizer, args) apply(self.ShowSizer, args)
else: else:
apply(self.ShowWindow, args) apply(self.ShowWindow, args)
def Hide(self, *args): def Hide(self, *args):
if string.find(args[0].this, 'Sizer') != -1: if isinstance(args[0], wxSizerPtr):
apply(self.HideSizer, args) apply(self.HideSizer, args)
else: else:
apply(self.HideWindow, args) apply(self.HideWindow, args)
def IsShown(self, *args): def IsShown(self, *args):
if string.find(args[0].this, 'Sizer') != -1: if isinstance(args[0], wxSizerPtr):
return apply(self.IsShownSizer, args) return apply(self.IsShownSizer, args)
else: else:
return apply(self.IsShownWindow, args) return apply(self.IsShownWindow, args)

View File

@@ -28,7 +28,6 @@
%import _defs.i %import _defs.i
%pragma(python) code = "import wx" %pragma(python) code = "import wx"
%pragma(python) code = "import string"
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// typemaps for wxInputStream // typemaps for wxInputStream

View File

@@ -35,7 +35,7 @@
// Import some definitions of other classes, etc. // Import some definitions of other classes, etc.
%import _defs.i %import _defs.i
%pragma(python) code = "import string" %pragma(python) code = "import wx"
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -762,17 +762,17 @@ public:
%pragma(python) addtoclass = " %pragma(python) addtoclass = "
def __add__(self, other): def __add__(self, other):
if string.find(other.this, 'wxTimeSpan') != -1: if isinstance(other, wxTimeSpanPtr):
return self.__add__TS(other) return self.__add__TS(other)
if string.find(other.this, 'wxDateSpan') != -1: if isinstance(other, wxDateSpanPtr):
return self.__add__DS(other) return self.__add__DS(other)
raise TypeError, 'Invalid r.h.s. type for __add__' raise TypeError, 'Invalid r.h.s. type for __add__'
def __sub__(self, other): def __sub__(self, other):
if string.find(other.this, 'wxDateTime') != -1: if isinstance(other, wxDateTimePtr):
return self.__sub__DT(other) return self.__sub__DT(other)
if string.find(other.this, 'wxTimeSpan') != -1: if isinstance(other, wxTimeSpanPtr):
return self.__sub__TS(other) return self.__sub__TS(other)
if string.find(other.this, 'wxDateSpan') != -1: if isinstnace(other, wxDateSpanPtr):
return self.__sub__DS(other) return self.__sub__DS(other)
raise TypeError, 'Invalid r.h.s. type for __sub__' raise TypeError, 'Invalid r.h.s. type for __sub__'
" "