dabo Commit
Revision 6827
Date: 2011-09-08 11:50:22 -0700 (Thu, 08 Sep 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6827
Changed:
U trunk/dabo/ui/uiwx/dPageFrameMixin.py
Log:
Added hotkey support for pages in a pageframe.
Diff:
Modified: trunk/dabo/ui/uiwx/dPageFrameMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPageFrameMixin.py 2011-09-06 23:25:48 UTC (rev
6826)
+++ trunk/dabo/ui/uiwx/dPageFrameMixin.py 2011-09-08 18:50:22 UTC (rev
6827)
@@ -212,6 +212,11 @@
if not caption:
# Page could have its own default caption
caption = pg._caption
+ if caption.count("&") == 1:
+ hotkey = "alt+%s" % (caption[caption.index("&")+1],)
+ self.Form.bindKey(hotkey, self._onHK)
+ pg._rawCaption = caption
+ caption = caption.replace("&", "")
if imgKey:
idx = self._imageList[imgKey]
self.InsertPage(pos, pg, text=caption, imageId=idx)
@@ -320,6 +325,17 @@
return ret
+ def _onHK(self, evt):
+ char = chr(evt.EventData["keyCode"]).lower()
+ for page in self.Pages:
+ if "&%s" % char in getattr(page, "_rawCaption",
"").lower():
+ self.SelectedPage = page
+ page.setFocus()
+ return
+ # raise ValueError, "Caption for hotkey not found." ## unsure
if wise
+
+
+
# property get/set functions:
def _getPageClass(self):
try:
_______________________________________________
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]