dabo Commit
Revision 6144
Date: 2010-10-24 07:43:09 -0700 (Sun, 24 Oct 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6144

Changed:
U   trunk/dabo/ui/uiwx/uiApp.py

Log:
Improved the handling of active window context for the calls to show the 
Command Window, and toggle the Debug window.

The check on the Debug menu command is still flaky the first time the window is 
shown, but behaves well after that.


Diff:
Modified: trunk/dabo/ui/uiwx/uiApp.py
===================================================================
--- trunk/dabo/ui/uiwx/uiApp.py 2010-10-24 14:41:01 UTC (rev 6143)
+++ trunk/dabo/ui/uiwx/uiApp.py 2010-10-24 14:43:09 UTC (rev 6144)
@@ -500,11 +500,11 @@
 
 
        def onCmdWin(self, evt):
-               self.showCommandWindow()
+               self.showCommandWindow(self.ActiveForm)
 
 
        def onDebugWin(self, evt):
-               self.toggleDebugWindow()
+               self.toggleDebugWindow(self.ActiveForm)
 
 
        def showCommandWindow(self, context=None):
@@ -517,6 +517,8 @@
 
        def toggleDebugWindow(self, context=None):
                """Display a debug output window."""
+               if context is None:
+                       context = self.ActiveForm
                class DebugWindow(dabo.ui.dToolForm):
                        def afterInit(self):
                                self.Caption = _("Debug Output")
@@ -527,22 +529,25 @@
                                self.out.Value = ""
 
                if not self.debugWindow:
-                       if context is None:
-                               context = self.ActiveForm
                        self.debugWindow = DebugWindow(context)
                        # Set the handler action
                        self._debugHandler.target = self.debugWindow.out
                if self.debugWindow.Visible:
+                       checked = False
                        self.debugWindow.hide()
                else:
+                       checked = True
                        self._debugHandler.updateTarget()
                        self.debugWindow.show()
-#              # Having issues with the check mark on the menu being out of 
sync.
-#              try:
-#                      context.MenuBar.debugMenuItem.Checked = 
self.debugWindow.Visible
-#              except AttributeError:
-#                      # No such item
-#                      pass
+               # Having issues with the check mark on the menu being out of 
sync.
+               try:
+                       mb = context.MenuBar
+                       mb.debugMenuItem.Checked = checked
+                       mb.Refresh()
+               except AttributeError:
+                       #Either no such item, or not a valid reference
+                       pass
+               
 
 
        def onWinClose(self, evt):



_______________________________________________
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