dabo Commit
Revision 4272
Date: 2008-07-11 00:27:05 -0700 (Fri, 11 Jul 2008)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/4272
Changed:
U trunk/dabo/ui/uiwx/dMenuItem.py
Log:
Removed the raising of the ValueError if you set a menu item Caption in the
form of "Open\tCtrl+O".
Instead, simply override any existing HotKey with the hotkey provided in
the string, and only set the caption part to the Caption property.
The only potential problem with this is in this example:
item.Caption = "Open\tCtrl+O"
...
item.Caption = "Close"
In this case, the item will still have the Ctrl+O hotkey, and if you
didn't want a hotkey, you'd have to then set it explicitly with:
item.HotKey = None
I think allowing the shortcut \t format doesn't harm anything, so why not
leave it in. If there's serious disagreement to this, let's give a
DeprecationWarning instead of the ValueError, as the \t method was the
only way to set the hotkeys until relatively recently and I know all my
apps use it still - I'm sure there are other apps out there as well.
Paul
Diff:
Modified: trunk/dabo/ui/uiwx/dMenuItem.py
===================================================================
--- trunk/dabo/ui/uiwx/dMenuItem.py 2008-07-11 02:50:31 UTC (rev 4271)
+++ trunk/dabo/ui/uiwx/dMenuItem.py 2008-07-11 07:27:05 UTC (rev 4272)
@@ -86,11 +86,12 @@
def _setCaption(self, val):
if self._constructed():
- if val.count("\t"):
+ tabsplit = val.split("\t")
+ if len(tabsplit) > 1:
# They're using the technique of caption + tab
+ hotkey
- raise ValueError, _("Please put HotKey
combination in HotKey property.")
- else:
- self._caption = val
+ # Override any prior setting of self.HotKey
with the new one.
+ self._hotKey = tabsplit[1]
+ self._caption = tabsplit[0]
self._redefine()
else:
self._properties["Caption"] = val
_______________________________________________
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]