Changeset 1854
- Timestamp:
- 01/24/2006 03:00:48 PM (3 years ago)
- Files:
-
- trunk/dabo/dApp.py (modified) (1 diff)
- trunk/dabo/dEvents.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/uiApp.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dabo/dApp.py
r1804 r1854 107 107 self.setup() 108 108 self._afterInit() 109 self.autoBindEvents() 109 110 110 111 trunk/dabo/dEvents.py
r1844 r1854 159 159 class KeyEvent(Event): 160 160 def appliesToClass(eventClass, objectClass): 161 return issubclass(objectClass, dabo.ui.dPemMixin)161 return issubclass(objectClass, (dabo.ui.dPemMixin, dabo.dApp)) 162 162 appliesToClass = classmethod(appliesToClass) 163 163 trunk/dabo/ui/uiwx/uiApp.py
r1839 r1854 13 13 wx.App.__init__(self, 0, args) 14 14 dObject.__init__(self) 15 self.Bind(wx.EVT_ACTIVATE_APP, self._onWxActivate)16 15 17 16 self.Name = _("uiApp") … … 37 36 38 37 def setup(self, dApp): 38 self.dApp = dApp 39 39 40 # wx has properties for appName and vendorName, so Dabo should update 40 41 # these. Among other possible uses, I know that on Win32 wx will use … … 44 45 self.SetVendorName(dApp.getAppInfo("vendorName")) 45 46 47 self.Bind(wx.EVT_ACTIVATE_APP, self._onWxActivate) 48 self.Bind(wx.EVT_KEY_DOWN, self._onWxKeyDown) 49 self.Bind(wx.EVT_KEY_UP, self._onWxKeyUp) 50 self.Bind(wx.EVT_CHAR, self._onWxKeyChar) 51 46 52 self.charset = "unicode" 47 53 if not self.charset in wx.PlatformInfo: … … 62 68 wx.InitAllImageHandlers() 63 69 64 self.dApp = dApp65 66 70 frm = dApp.MainForm 67 71 if frm is None: … … 104 108 return self._platform 105 109 110 106 111 def _onWxActivate(self, evt): 107 112 """ Raise the Dabo Activate or Deactivate appropriately.""" 108 113 if bool(evt.GetActive()): 109 self. raiseEvent(dEvents.Activate, evt)114 self.dApp.raiseEvent(dEvents.Activate, evt) 110 115 else: 111 self. raiseEvent(dEvents.Deactivate, evt)116 self.dApp.raiseEvent(dEvents.Deactivate, evt) 112 117 evt.Skip() 113 114 118 119 def _onWxKeyChar(self, evt): 120 self.dApp.raiseEvent(dEvents.KeyChar, evt) 121 evt.Skip() 122 123 def _onWxKeyDown(self, evt): 124 self.dApp.raiseEvent(dEvents.KeyDown, evt) 125 evt.Skip() 126 127 def _onWxKeyUp(self, evt): 128 self.dApp.raiseEvent(dEvents.KeyUp, evt) 129 evt.Skip() 130 131 115 132 def onWinClose(self, evt): 116 133 """Close the topmost window, if any."""
