X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ca31b3da9988750539c28ab7bf07518832cab6a0..53663be8a5ea8e1c6f178839209b67e8228e4642:/wxPython/src/mac/misc.py?ds=sidebyside diff --git a/wxPython/src/mac/misc.py b/wxPython/src/mac/misc.py index d8acff0fb4..e1f06cc4f9 100644 --- a/wxPython/src/mac/misc.py +++ b/wxPython/src/mac/misc.py @@ -23,9 +23,12 @@ class wxSizePtr : def __init__(self,this): self.this = this self.thisown = 0 - def __del__(self,miscc=miscc): - if self.thisown == 1 : - miscc.delete_wxSize(self) + def __del__(self, delfunc=miscc.delete_wxSize): + if self.thisown == 1: + try: + delfunc(self) + except: + pass def Set(self, *_args, **_kwargs): val = apply(miscc.wxSize_Set,(self,) + _args, _kwargs) return val @@ -50,8 +53,11 @@ class wxSizePtr : def asTuple(self, *_args, **_kwargs): val = apply(miscc.wxSize_asTuple,(self,) + _args, _kwargs) return val - def __cmp__(self, *_args, **_kwargs): - val = apply(miscc.wxSize___cmp__,(self,) + _args, _kwargs) + def __eq__(self, *_args, **_kwargs): + val = apply(miscc.wxSize___eq__,(self,) + _args, _kwargs) + return val + def __ne__(self, *_args, **_kwargs): + val = apply(miscc.wxSize___ne__,(self,) + _args, _kwargs) return val def __setattr__(self,name,value): if name == "x" : @@ -81,13 +87,17 @@ class wxSizePtr : return "" % (self.this,) def __str__(self): return str(self.asTuple()) - def __repr__(self): return str(self.asTuple()) + def __repr__(self): return 'wxSize'+str(self.asTuple()) def __len__(self): return len(self.asTuple()) def __getitem__(self, index): return self.asTuple()[index] def __setitem__(self, index, val): if index == 0: self.width = val elif index == 1: self.height = val else: raise IndexError + def __nonzero__(self): return self.asTuple() != (0,0) + def __getinitargs__(self): return () + def __getstate__(self): return self.asTuple() + def __setstate__(self, state): self.Set(*state) class wxSize(wxSizePtr): def __init__(self,*_args,**_kwargs): @@ -101,9 +111,12 @@ class wxRealPointPtr : def __init__(self,this): self.this = this self.thisown = 0 - def __del__(self,miscc=miscc): - if self.thisown == 1 : - miscc.delete_wxRealPoint(self) + def __del__(self, delfunc=miscc.delete_wxRealPoint): + if self.thisown == 1: + try: + delfunc(self) + except: + pass def Set(self, *_args, **_kwargs): val = apply(miscc.wxRealPoint_Set,(self,) + _args, _kwargs) return val @@ -118,8 +131,11 @@ class wxRealPointPtr : val = apply(miscc.wxRealPoint___sub__,(self,) + _args, _kwargs) if val: val = wxRealPointPtr(val) ; val.thisown = 1 return val - def __cmp__(self, *_args, **_kwargs): - val = apply(miscc.wxRealPoint___cmp__,(self,) + _args, _kwargs) + def __eq__(self, *_args, **_kwargs): + val = apply(miscc.wxRealPoint___eq__,(self,) + _args, _kwargs) + return val + def __ne__(self, *_args, **_kwargs): + val = apply(miscc.wxRealPoint___ne__,(self,) + _args, _kwargs) return val def __setattr__(self,name,value): if name == "x" : @@ -139,13 +155,17 @@ class wxRealPointPtr : return "" % (self.this,) def __str__(self): return str(self.asTuple()) - def __repr__(self): return str(self.asTuple()) + def __repr__(self): return 'wxRealPoint'+str(self.asTuple()) def __len__(self): return len(self.asTuple()) def __getitem__(self, index): return self.asTuple()[index] def __setitem__(self, index, val): if index == 0: self.width = val elif index == 1: self.height = val else: raise IndexError + def __nonzero__(self): return self.asTuple() != (0.0, 0.0) + def __getinitargs__(self): return () + def __getstate__(self): return self.asTuple() + def __setstate__(self, state): self.Set(*state) class wxRealPoint(wxRealPointPtr): def __init__(self,*_args,**_kwargs): @@ -159,9 +179,12 @@ class wxPointPtr : def __init__(self,this): self.this = this self.thisown = 0 - def __del__(self,miscc=miscc): - if self.thisown == 1 : - miscc.delete_wxPoint(self) + def __del__(self, delfunc=miscc.delete_wxPoint): + if self.thisown == 1: + try: + delfunc(self) + except: + pass def Set(self, *_args, **_kwargs): val = apply(miscc.wxPoint_Set,(self,) + _args, _kwargs) return val @@ -176,8 +199,11 @@ class wxPointPtr : val = apply(miscc.wxPoint___sub__,(self,) + _args, _kwargs) if val: val = wxPointPtr(val) ; val.thisown = 1 return val - def __cmp__(self, *_args, **_kwargs): - val = apply(miscc.wxPoint___cmp__,(self,) + _args, _kwargs) + def __eq__(self, *_args, **_kwargs): + val = apply(miscc.wxPoint___eq__,(self,) + _args, _kwargs) + return val + def __ne__(self, *_args, **_kwargs): + val = apply(miscc.wxPoint___ne__,(self,) + _args, _kwargs) return val def __setattr__(self,name,value): if name == "x" : @@ -197,13 +223,17 @@ class wxPointPtr : return "" % (self.this,) def __str__(self): return str(self.asTuple()) - def __repr__(self): return str(self.asTuple()) + def __repr__(self): return 'wxPoint'+str(self.asTuple()) def __len__(self): return len(self.asTuple()) def __getitem__(self, index): return self.asTuple()[index] def __setitem__(self, index, val): if index == 0: self.x = val elif index == 1: self.y = val else: raise IndexError + def __nonzero__(self): return self.asTuple() != (0,0) + def __getinitargs__(self): return () + def __getstate__(self): return self.asTuple() + def __setstate__(self, state): self.Set(*state) class wxPoint(wxPointPtr): def __init__(self,*_args,**_kwargs): @@ -217,9 +247,12 @@ class wxRectPtr : def __init__(self,this): self.this = this self.thisown = 0 - def __del__(self,miscc=miscc): - if self.thisown == 1 : - miscc.delete_wxRect(self) + def __del__(self, delfunc=miscc.delete_wxRect): + if self.thisown == 1: + try: + delfunc(self) + except: + pass def GetX(self, *_args, **_kwargs): val = apply(miscc.wxRect_GetX,(self,) + _args, _kwargs) return val @@ -252,6 +285,12 @@ class wxRectPtr : val = apply(miscc.wxRect_GetSize,(self,) + _args, _kwargs) if val: val = wxSizePtr(val) ; val.thisown = 1 return val + def SetPosition(self, *_args, **_kwargs): + val = apply(miscc.wxRect_SetPosition,(self,) + _args, _kwargs) + return val + def SetSize(self, *_args, **_kwargs): + val = apply(miscc.wxRect_SetSize,(self,) + _args, _kwargs) + return val def GetLeft(self, *_args, **_kwargs): val = apply(miscc.wxRect_GetLeft,(self,) + _args, _kwargs) return val @@ -276,12 +315,30 @@ class wxRectPtr : def SetBottom(self, *_args, **_kwargs): val = apply(miscc.wxRect_SetBottom,(self,) + _args, _kwargs) return val + def Deflate(self, *_args, **_kwargs): + val = apply(miscc.wxRect_Deflate,(self,) + _args, _kwargs) + return val def Inflate(self, *_args, **_kwargs): val = apply(miscc.wxRect_Inflate,(self,) + _args, _kwargs) return val + def InsideXY(self, *_args, **_kwargs): + val = apply(miscc.wxRect_InsideXY,(self,) + _args, _kwargs) + return val def Inside(self, *_args, **_kwargs): val = apply(miscc.wxRect_Inside,(self,) + _args, _kwargs) return val + def Intersects(self, *_args, **_kwargs): + val = apply(miscc.wxRect_Intersects,(self,) + _args, _kwargs) + return val + def OffsetXY(self, *_args, **_kwargs): + val = apply(miscc.wxRect_OffsetXY,(self,) + _args, _kwargs) + return val + def Offset(self, *_args, **_kwargs): + val = apply(miscc.wxRect_Offset,(self,) + _args, _kwargs) + return val + def Set(self, *_args, **_kwargs): + val = apply(miscc.wxRect_Set,(self,) + _args, _kwargs) + return val def asTuple(self, *_args, **_kwargs): val = apply(miscc.wxRect_asTuple,(self,) + _args, _kwargs) return val @@ -289,8 +346,11 @@ class wxRectPtr : val = apply(miscc.wxRect___add__,(self,) + _args, _kwargs) if val: val = wxRectPtr(val) ; val.thisown = 1 return val - def __cmp__(self, *_args, **_kwargs): - val = apply(miscc.wxRect___cmp__,(self,) + _args, _kwargs) + def __eq__(self, *_args, **_kwargs): + val = apply(miscc.wxRect___eq__,(self,) + _args, _kwargs) + return val + def __ne__(self, *_args, **_kwargs): + val = apply(miscc.wxRect___ne__,(self,) + _args, _kwargs) return val def __setattr__(self,name,value): if name == "x" : @@ -320,7 +380,7 @@ class wxRectPtr : return "" % (self.this,) def __str__(self): return str(self.asTuple()) - def __repr__(self): return str(self.asTuple()) + def __repr__(self): return 'wxRect'+str(self.asTuple()) def __len__(self): return len(self.asTuple()) def __getitem__(self, index): return self.asTuple()[index] def __setitem__(self, index, val): @@ -329,6 +389,10 @@ class wxRectPtr : elif index == 2: self.width = val elif index == 3: self.height = val else: raise IndexError + def __nonzero__(self): return self.asTuple() != (0,0,0,0) + def __getinitargs__(self): return () + def __getstate__(self): return self.asTuple() + def __setstate__(self, state): self.Set(*state) # override the __getattr__ made by SWIG def __getattr__(self, name): @@ -375,6 +439,137 @@ class wxRect(wxRectPtr): +class wxPoint2DDoublePtr : + def __init__(self,this): + self.this = this + self.thisown = 0 + def GetFloor(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_GetFloor,(self,) + _args, _kwargs) + return val + def GetRounded(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_GetRounded,(self,) + _args, _kwargs) + return val + def GetVectorLength(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_GetVectorLength,(self,) + _args, _kwargs) + return val + def GetVectorAngle(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_GetVectorAngle,(self,) + _args, _kwargs) + return val + def SetVectorLength(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_SetVectorLength,(self,) + _args, _kwargs) + return val + def SetVectorAngle(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_SetVectorAngle,(self,) + _args, _kwargs) + return val + def GetDistance(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_GetDistance,(self,) + _args, _kwargs) + return val + def GetDistanceSquare(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_GetDistanceSquare,(self,) + _args, _kwargs) + return val + def GetDotProduct(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_GetDotProduct,(self,) + _args, _kwargs) + return val + def GetCrossProduct(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_GetCrossProduct,(self,) + _args, _kwargs) + return val + def Set(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_Set,(self,) + _args, _kwargs) + return val + def __neg__(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble___neg__,(self,) + _args, _kwargs) + if val: val = wxPoint2DDoublePtr(val) ; val.thisown = 1 + return val + def __iadd__(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble___iadd__,(self,) + _args, _kwargs) + if val: val = wxPoint2DDoublePtr(val) + return val + def __isub__(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble___isub__,(self,) + _args, _kwargs) + if val: val = wxPoint2DDoublePtr(val) + return val + def __imul__(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble___imul__,(self,) + _args, _kwargs) + if val: val = wxPoint2DDoublePtr(val) + return val + def __idiv__(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble___idiv__,(self,) + _args, _kwargs) + if val: val = wxPoint2DDoublePtr(val) + return val + def __eq__(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble___eq__,(self,) + _args, _kwargs) + return val + def __ne__(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble___ne__,(self,) + _args, _kwargs) + return val + def asTuple(self, *_args, **_kwargs): + val = apply(miscc.wxPoint2DDouble_asTuple,(self,) + _args, _kwargs) + return val + def __setattr__(self,name,value): + if name == "m_x" : + miscc.wxPoint2DDouble_m_x_set(self,value) + return + if name == "m_y" : + miscc.wxPoint2DDouble_m_y_set(self,value) + return + if name == "x" : + miscc.wxPoint2DDouble_x_set(self,value) + return + if name == "y" : + miscc.wxPoint2DDouble_y_set(self,value) + return + self.__dict__[name] = value + def __getattr__(self,name): + if name == "m_x" : + return miscc.wxPoint2DDouble_m_x_get(self) + if name == "m_y" : + return miscc.wxPoint2DDouble_m_y_get(self) + if name == "x" : + return miscc.wxPoint2DDouble_x_get(self) + if name == "y" : + return miscc.wxPoint2DDouble_y_get(self) + raise AttributeError,name + def __repr__(self): + return "" % (self.this,) + + def SetPolarCoordinates(self, angle, length): + self.SetVectorLength(length) + self.SetVectorAngle(angle) + def Normalize(self): + self.SetVectorLength(1.0) + + + def __str__(self): return str(self.asTuple()) + def __repr__(self): return 'wxPoint2DDouble'+str(self.asTuple()) + def __len__(self): return len(self.asTuple()) + def __getitem__(self, index): return self.asTuple()[index] + def __setitem__(self, index, val): + if index == 0: self.m_x = val + elif index == 1: self.m_yt = val + else: raise IndexError + def __nonzero__(self): return self.asTuple() != (0.0, 0.0) + def __getinitargs__(self): return () + def __getstate__(self): return self.asTuple() + def __setstate__(self, state): self.Set(*state) + +class wxPoint2DDouble(wxPoint2DDoublePtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(miscc.new_wxPoint2DDouble,_args,_kwargs) + self.thisown = 1 + + + +def wxPoint2DDoubleCopy(*_args,**_kwargs): + val = wxPoint2DDoublePtr(apply(miscc.new_wxPoint2DDoubleCopy,_args,_kwargs)) + val.thisown = 1 + return val + +def wxPoint2DDoubleFromPoint(*_args,**_kwargs): + val = wxPoint2DDoublePtr(apply(miscc.new_wxPoint2DDoubleFromPoint,_args,_kwargs)) + val.thisown = 1 + return val + + class wxIndividualLayoutConstraintPtr(wxObjectPtr): def __init__(self,this): self.this = this @@ -480,9 +675,12 @@ class wxAcceleratorEntryPtr : def __init__(self,this): self.this = this self.thisown = 0 - def __del__(self,miscc=miscc): - if self.thisown == 1 : - miscc.delete_wxAcceleratorEntry(self) + def __del__(self, delfunc=miscc.delete_wxAcceleratorEntry): + if self.thisown == 1: + try: + delfunc(self) + except: + pass def Set(self, *_args, **_kwargs): val = apply(miscc.wxAcceleratorEntry_Set,(self,) + _args, _kwargs) return val @@ -509,9 +707,12 @@ class wxAcceleratorTablePtr(wxObjectPtr): def __init__(self,this): self.this = this self.thisown = 0 - def __del__(self,miscc=miscc): - if self.thisown == 1 : - miscc.delete_wxAcceleratorTable(self) + def __del__(self, delfunc=miscc.delete_wxAcceleratorTable): + if self.thisown == 1: + try: + delfunc(self) + except: + pass def __repr__(self): return "" % (self.this,) class wxAcceleratorTable(wxAcceleratorTablePtr): @@ -526,9 +727,12 @@ class wxBusyInfoPtr(wxObjectPtr): def __init__(self,this): self.this = this self.thisown = 0 - def __del__(self,miscc=miscc): - if self.thisown == 1 : - miscc.delete_wxBusyInfo(self) + def __del__(self, delfunc=miscc.delete_wxBusyInfo): + if self.thisown == 1: + try: + delfunc(self) + except: + pass def __repr__(self): return "" % (self.this,) class wxBusyInfo(wxBusyInfoPtr): @@ -549,10 +753,6 @@ wxNewId = miscc.wxNewId wxRegisterId = miscc.wxRegisterId -NewId = miscc.NewId - -RegisterId = miscc.RegisterId - wxGetCurrentId = miscc.wxGetCurrentId wxBell = miscc.wxBell @@ -575,6 +775,8 @@ wxGetOsVersion = miscc.wxGetOsVersion wxGetOsDescription = miscc.wxGetOsDescription +wxShutdown = miscc.wxShutdown + wxSleep = miscc.wxSleep wxUsleep = miscc.wxUsleep @@ -585,8 +787,6 @@ wxYieldIfNeeded = miscc.wxYieldIfNeeded wxEnableTopLevelWindows = miscc.wxEnableTopLevelWindows -wxGetResource = miscc.wxGetResource - wxStripMenuCodes = miscc.wxStripMenuCodes wxGetEmailAddress = miscc.wxGetEmailAddress @@ -603,6 +803,8 @@ wxGetHomeDir = miscc.wxGetHomeDir wxGetUserHome = miscc.wxGetUserHome +wxGetProcessId = miscc.wxGetProcessId + def wxGetAccelFromString(*_args, **_kwargs): val = apply(miscc.wxGetAccelFromString,_args,_kwargs) if val: val = wxAcceleratorEntryPtr(val) @@ -612,6 +814,8 @@ def wxGetAccelFromString(*_args, **_kwargs): #-------------- VARIABLE WRAPPERS ------------------ +wxSHUTDOWN_POWEROFF = miscc.wxSHUTDOWN_POWEROFF +wxSHUTDOWN_REBOOT = miscc.wxSHUTDOWN_REBOOT wxLeft = miscc.wxLeft wxTop = miscc.wxTop wxRight = miscc.wxRight