X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/89d1e2eeab15869685246c20dc260432ea548ea6..88f67c2242209b8a752b515fdec30fd6ef858a18:/wxPython/src/msw/_core.py diff --git a/wxPython/src/msw/_core.py b/wxPython/src/msw/_core.py index 9f0ead8bce..2756e8b96b 100644 --- a/wxPython/src/msw/_core.py +++ b/wxPython/src/msw/_core.py @@ -3847,6 +3847,15 @@ class PyEventBinder(object): success += target.Disconnect(id1, id2, et) return success != 0 + def _getEvtType(self): + """ + Make it easy to get to the default wxEventType typeID for this + event binder. + """ + return self.evtType[0] + + typeId = property(_getEvtType) + def __call__(self, *args): """ @@ -3891,6 +3900,7 @@ EVENT_PROPAGATE_MAX = _core_.EVENT_PROPAGATE_MAX def NewEventType(*args): """NewEventType() -> EventType""" return _core_.NewEventType(*args) +wxEVT_ANY = _core_.wxEVT_ANY wxEVT_NULL = _core_.wxEVT_NULL wxEVT_FIRST = _core_.wxEVT_FIRST wxEVT_USER_FIRST = _core_.wxEVT_USER_FIRST @@ -5042,6 +5052,16 @@ class MouseEvent(Event): """ return _core_.MouseEvent_GetWheelDelta(*args, **kwargs) + def GetWheelAxis(*args, **kwargs): + """ + GetWheelAxis(self) -> int + + Gets the axis the wheel operation concerns, 0 being the y axis as on + most mouse wheels, 1 is the x axis for things like MightyMouse scrolls + or horizontal trackpad scrolling. + """ + return _core_.MouseEvent_GetWheelAxis(*args, **kwargs) + def GetLinesPerAction(*args, **kwargs): """ GetLinesPerAction(self) -> int @@ -6985,6 +7005,25 @@ _core_.DateEvent_swigregister(DateEvent) wxEVT_DATE_CHANGED = _core_.wxEVT_DATE_CHANGED EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 ) +class EventBlocker(EvtHandler): + """Helper class to temporarily disable event handling for a window.""" + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): + """ + __init__(self, Window win, EventType type=wxEVT_ANY) -> EventBlocker + + Helper class to temporarily disable event handling for a window. + """ + _core_.EventBlocker_swiginit(self,_core_.new_EventBlocker(*args, **kwargs)) + __swig_destroy__ = _core_.delete_EventBlocker + __del__ = lambda self : None; + def Block(*args, **kwargs): + """Block(self, EventType type)""" + return _core_.EventBlocker_Block(*args, **kwargs) + +_core_.EventBlocker_swigregister(EventBlocker) + #--------------------------------------------------------------------------- PYAPP_ASSERT_SUPPRESS = _core_.PYAPP_ASSERT_SUPPRESS @@ -10350,9 +10389,15 @@ class Window(EvtHandler): self.thisown = pre.thisown pre.thisown = 0 if hasattr(self, '_setOORInfo'): - self._setOORInfo(self) + try: + self._setOORInfo(self) + except TypeError: + pass if hasattr(self, '_setCallbackInfo'): - self._setCallbackInfo(self, pre.__class__) + try: + self._setCallbackInfo(self, pre.__class__) + except TypeError: + pass def SendSizeEvent(self): self.GetEventHandler().ProcessEvent(wx.SizeEvent((-1,-1))) @@ -10732,9 +10777,15 @@ class Menu(EvtHandler): """Remove(self, int id) -> MenuItem""" return _core_.Menu_Remove(*args, **kwargs) - def RemoveItem(*args, **kwargs): + def RemoveItem(self, item): """RemoveItem(self, MenuItem item) -> MenuItem""" - return _core_.Menu_RemoveItem(*args, **kwargs) + #// The return object is always the parameter, so return that + #// proxy instead of the new one + val = _core_.Menu_RemoveItem(self, item) + item.this.own(val.this.own()) + val.this.disown() + return item + def Delete(*args, **kwargs): """Delete(self, int id) -> bool""" @@ -13323,6 +13374,16 @@ class GridBagSizer(FlexGridSizer): """ return _core_.GridBagSizer_FindItem(*args) + def GetItem(self, item): + gbsi = None + si = wx.FlexGridSizer.GetItem(self, item) + if not si: + return None + if type(item) is not int: + gbsi = self.FindItem(item) + if gbsi: return gbsi + return si + def FindItemAtPosition(*args, **kwargs): """ FindItemAtPosition(self, GBPosition pos) -> GBSizerItem