dabo Commit
Revision 5950
Date: 2010-08-04 09:24:20 -0700 (Wed, 04 Aug 2010)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5950
Changed:
U trunk/dabo/ui/uiwx/dButton.py
U trunk/dabo/ui/uiwx/dReportProgress.py
Log:
I was having trouble with two cancel buttons on my FrmReport on Mac: the button
for cancelling the report from running was firing when the user pressed
escape, even when it wasn't visible on screen. This fixes it but I still need
to check the other platforms to make sure I didn't break anything.
Diff:
Modified: trunk/dabo/ui/uiwx/dButton.py
===================================================================
--- trunk/dabo/ui/uiwx/dButton.py 2010-08-03 14:06:26 UTC (rev 5949)
+++ trunk/dabo/ui/uiwx/dButton.py 2010-08-04 16:24:20 UTC (rev 5950)
@@ -37,10 +37,17 @@
self.Bind(wx.EVT_BUTTON, self._onWxHit)
- def __onCancelButton(self, evt):
+ def _onCancelButton(self, evt, recurse=True):
# This callback exists for when the user presses ESC and this
button
# is the cancel button. Raise dEvents.Hit.
- self.raiseEvent(dEvents.Hit)
+ if self.VisibleOnScreen:
+ self.raiseEvent(dEvents.Hit)
+ else:
+ # There may be another cancel button: give it a chance,
too:
+ if recurse:
+ otherCancelButton =
self.Form.FindWindowById(wx.ID_CANCEL)
+ if otherCancelButton:
+ otherCancelButton._onCancelButton(evt,
recurse=False)
# Property get/set/del methods follow. Scroll to bottom to see the
property
@@ -65,7 +72,7 @@
if self.Application.Platform in ("Mac"):
target = self.Form
if val:
- target.bindKey("esc", self.__onCancelButton)
+ target.bindKey("esc", self._onCancelButton)
self.SetId(wx.ID_CANCEL)
else:
target.unbindKey("esc")
@@ -73,7 +80,7 @@
else:
# In order to get the stock cancel button behavior from
the OS, we need
# to set the id here. So, getting the stock button
behavior must happen
- # in the constructor, but theoretically we can get the
excape behavior
+ # in the constructor, but theoretically we can get the
escape behavior
# anytime.
if val:
self._preInitProperties["id"] = wx.ID_CANCEL
Modified: trunk/dabo/ui/uiwx/dReportProgress.py
===================================================================
--- trunk/dabo/ui/uiwx/dReportProgress.py 2010-08-03 14:06:26 UTC (rev
5949)
+++ trunk/dabo/ui/uiwx/dReportProgress.py 2010-08-04 16:24:20 UTC (rev
5950)
@@ -14,7 +14,7 @@
ms = self.Sizer = dabo.ui.dBorderSizer(self, "v",
DefaultBorder=5)
self.gauge = dGauge(self, Size=(75,12))
lblTitle = dLabel(self, Caption="Processing report...",
FontBold=True)
- butCancel = dButton(self, CancelButton=True, Caption="Cancel",
OnHit=self.onCancel)
+ butCancel = dButton(self, NameBase="butCancelReportProgress",
CancelButton=True, Caption="Cancel", OnHit=self.onCancel)
ms.append(lblTitle)
ms.append(self.gauge, "expand")
ms.append(butCancel, alignment="right")
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]