Changeset 4265

Show
Ignore:
Timestamp:
07/10/2008 12:29:57 PM (2 months ago)
Author:
nate
Message:

Tracked down and found the errors associated with the dMenu problems I was having. The main problem was that in the mnxml files, a Caption and Hotkey would be specified separately, but they would be combined into the Caption property by createMenuBar and that would cause a slew of problems. In addition, if you had a Caption w/ a hotkey in it and then specified the hotkey property, wx would have a conniption fit. I added a check to the Caption property to raise an error if the Caption has a HotKey? in it.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/ui/uiwx/__init__.py

    r4234 r4265  
    11651165                pic = itmatts["Picture"] 
    11661166                special = itmatts.get("special", None) 
    1167                 if hk: 
    1168                     cap += "\t%s" % hk 
    1169                 txt = cap 
    11701167                binding = previewFunc 
    11711168                fnc = "" 
     
    11801177                help = itmatts["HelpText"] 
    11811178                menuItem = menu.append(cap, OnHit=binding, help=help, 
    1182                         picture=pic, special=special
     1179                        picture=pic, special=special, HotKey=hk
    11831180 
    11841181    try: 
  • trunk/dabo/ui/uiwx/dMenuItem.py

    r4115 r4265  
    8383 
    8484    def _getCaption(self): 
    85         return self._caption 
     85        return self._caption[:] 
    8686 
    8787    def _setCaption(self, val): 
    8888        if self._constructed(): 
    89             self._caption = val 
     89            if len(val.split("\t")) == 1: 
     90                self._caption = val 
     91            else: 
     92                raise ValueError, "Please put HotKey combination in HotKey property." 
    9093            self._redefine() 
    9194        else: