Nate Lowrie wrote:
> On Tue, Jul 8, 2008 at 2:34 PM, Nate Lowrie <[EMAIL PROTECTED]> wrote:
>> +       def onUseSpaces(self, evt):
>> +               useTabs = not evt.EventObject.Checked
>> +               self.editor.UseTabs = useTabs
>> +               for child in self._tabMenu.Children:
>> +                       child.Enabled = useTabs
> 
> I thought I would point out that I originally did
> self._tabMenu.Enabled instead of using the children and I got this
> traceback:
> 
> Traceback (most recent call last):
>   File 
> "c:\Python25\lib\site-packages\dabo-full\trunk\dabo\ui\uiwx\dMenuItem.py"
> , line 55, in __onWxHit
>     self.raiseEvent(dEvents.Hit, evt)
>   File 
> "C:\Python25\lib\site-packages\dabo-full\trunk\dabo\ui\uiwx\dPemMixin.py"
> , line 922, in raiseEvent
>     super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args, 
> **kwargs)
>   File 
> "C:\Python25\lib\site-packages\dabo-full\trunk\dabo\lib\eventMixin.py", l
> ine 92, in raiseEvent
>     bindingFunction(event)
>   File 
> "c:\Python25\Lib\site-packages\dabo-full\trunk\ide\ClassDesignerEditor.py
> ", line 253, in onUseSpaces
>     self._tabMenu.Enabled = self.editor.UseTabs = not evt.EventObject.Checked
>   File "C:\Python25\lib\site-packages\dabo-full\trunk\dabo\ui\uiwx\dMenu.py", 
> li
> ne 494, in _setEnabled
>     self.Enable(bool(val))
>   File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 
> 1111
> 5, in Enable
>     return _core_.Menu_Enable(*args, **kwargs)
> TypeError: Menu_Enable() takes exactly 3 arguments (2 given)
> 
> I tracked it down to _core.py in the wx module and found that Enable
> takes an id as the first arg and a bool enable as the second arg.  Is
> this new in 2.8.8?  isEnabled takes 2 args to.  Thoughts?

It also exists in 2.8.7.1, and probably all along. wx Menus are 
confusing because they become menu items at runtime, and only menu items 
can be disabled/enabled by their containing menu or menubar. Try this 
patch and let me know how/if it works:

Index: dMenu.py
===================================================================
--- dMenu.py    (revision 4253)
+++ dMenu.py    (working copy)
@@ -408,6 +408,8 @@
                 """
                 ## MenuOpen and MenuClose don't appear to be working on 
Linux. Need
                 ## to test on Mac and Win.
+               self._wxMenuItemId = id_
+
                 if self.Application is not None:
                         # Set up a mechanism to catch menu events and 
re-raise Dabo events.
                         # If Application is None, however, this won't 
work because of wx
@@ -491,7 +493,7 @@

         def _setEnabled(self, val):
                 if self._constructed():
-                       self.Enable(bool(val))
+                       self.Parent.Enable(self._wxMenuItemId, bool(val))
                 else:
                         self._properties["Enabled"] = val

Paul


_______________________________________________
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]

Reply via email to