X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..419c299ae50da93b157c707cb983520611f9d31e:/wxPython/src/gtk/misc.py diff --git a/wxPython/src/gtk/misc.py b/wxPython/src/gtk/misc.py index eb6de20f06..3610a28fe1 100644 --- a/wxPython/src/gtk/misc.py +++ b/wxPython/src/gtk/misc.py @@ -57,8 +57,16 @@ class wxSizePtr : raise AttributeError,name def __repr__(self): return "" % (self.this,) - def __str__(self): return str(self.asTuple()) - def __repr__(self): return str(self.asTuple()) + + def __str__(self): return str(self.asTuple()) + def __repr__(self): return 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 + class wxSize(wxSizePtr): def __init__(self,*_args,**_kwargs): self.this = apply(miscc.new_wxSize,_args,_kwargs) @@ -80,6 +88,17 @@ class wxRealPointPtr : def asTuple(self, *_args, **_kwargs): val = apply(miscc.wxRealPoint_asTuple,(self,) + _args, _kwargs) return val + def __add__(self, *_args, **_kwargs): + val = apply(miscc.wxRealPoint___add__,(self,) + _args, _kwargs) + if val: val = wxRealPointPtr(val) ; val.thisown = 1 + return val + def __sub__(self, *_args, **_kwargs): + 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) + return val def __setattr__(self,name,value): if name == "x" : miscc.wxRealPoint_x_set(self,value) @@ -96,8 +115,16 @@ class wxRealPointPtr : raise AttributeError,name def __repr__(self): return "" % (self.this,) - def __str__(self): return str(self.asTuple()) - def __repr__(self): return str(self.asTuple()) + + def __str__(self): return str(self.asTuple()) + def __repr__(self): return 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 + class wxRealPoint(wxRealPointPtr): def __init__(self,*_args,**_kwargs): self.this = apply(miscc.new_wxRealPoint,_args,_kwargs) @@ -119,6 +146,17 @@ class wxPointPtr : def asTuple(self, *_args, **_kwargs): val = apply(miscc.wxPoint_asTuple,(self,) + _args, _kwargs) return val + def __add__(self, *_args, **_kwargs): + val = apply(miscc.wxPoint___add__,(self,) + _args, _kwargs) + if val: val = wxPointPtr(val) ; val.thisown = 1 + return val + def __sub__(self, *_args, **_kwargs): + 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) + return val def __setattr__(self,name,value): if name == "x" : miscc.wxPoint_x_set(self,value) @@ -135,8 +173,16 @@ class wxPointPtr : raise AttributeError,name def __repr__(self): return "" % (self.this,) - def __str__(self): return str(self.asTuple()) - def __repr__(self): return str(self.asTuple()) + + def __str__(self): return str(self.asTuple()) + def __repr__(self): return 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 + class wxPoint(wxPointPtr): def __init__(self,*_args,**_kwargs): self.this = apply(miscc.new_wxPoint,_args,_kwargs) @@ -250,9 +296,18 @@ class wxRectPtr : raise AttributeError,name def __repr__(self): return "" % (self.this,) - def __str__(self): return str(self.asTuple()) - def __repr__(self): return str(self.asTuple()) + def __str__(self): return str(self.asTuple()) + def __repr__(self): return 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 + elif index == 2: self.width = val + elif index == 3: self.height = val + else: raise IndexError + # override the __getattr__ made by SWIG def __getattr__(self, name): d = { @@ -599,14 +654,12 @@ NewId = miscc.NewId RegisterId = miscc.RegisterId -wxBell = miscc.wxBell +wxGetCurrentId = miscc.wxGetCurrentId -wxDisplaySize = miscc.wxDisplaySize +wxBell = miscc.wxBell wxEndBusyCursor = miscc.wxEndBusyCursor -wxExecute = miscc.wxExecute - wxGetElapsedTime = miscc.wxGetElapsedTime wxGetMousePosition = miscc.wxGetMousePosition @@ -621,11 +674,15 @@ wxStartTimer = miscc.wxStartTimer wxGetOsVersion = miscc.wxGetOsVersion +wxGetOsDescription = miscc.wxGetOsDescription + wxSleep = miscc.wxSleep +wxUsleep = miscc.wxUsleep + wxYield = miscc.wxYield -wxSafeYield = miscc.wxSafeYield +wxYieldIfNeeded = miscc.wxYieldIfNeeded wxEnableTopLevelWindows = miscc.wxEnableTopLevelWindows @@ -633,6 +690,23 @@ wxGetResource = miscc.wxGetResource wxStripMenuCodes = miscc.wxStripMenuCodes +wxGetEmailAddress = miscc.wxGetEmailAddress + +wxGetHostName = miscc.wxGetHostName + +wxGetFullHostName = miscc.wxGetFullHostName + +wxGetUserId = miscc.wxGetUserId + +wxGetUserName = miscc.wxGetUserName + +wxGetHomeDir = miscc.wxGetHomeDir + +def wxGetAccelFromString(*_args, **_kwargs): + val = apply(miscc.wxGetAccelFromString,_args,_kwargs) + if val: val = wxAcceleratorEntryPtr(val) + return val + #-------------- VARIABLE WRAPPERS ------------------