[GRASS-SVN] r39077 - in grass/trunk/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 7 15:09:00 EDT 2009


Author: martinl
Date: 2009-09-07 15:08:58 -0400 (Mon, 07 Sep 2009)
New Revision: 39077

Modified:
   grass/trunk/gui/wxpython/gui_modules/help.py
   grass/trunk/gui/wxpython/wxgui.py
Log:
fix wxGUI menu tree window (all items activated)


Modified: grass/trunk/gui/wxpython/gui_modules/help.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/help.py	2009-09-07 18:34:33 UTC (rev 39076)
+++ grass/trunk/gui/wxpython/gui_modules/help.py	2009-09-07 19:08:58 UTC (rev 39077)
@@ -165,11 +165,15 @@
             return # should not happen
         
         data = self.tree.GetPyData(self.tree.GetSelected())
-        if not data or not data.has_key('command'):
+        if not data:
             return
+
+        handler = 'self.parent.' + data['handler'].lstrip('self.')
+        if data['command']:
+            eval(handler)(event = None, cmd = data['command'].split())
+        else:
+            eval(handler)(None)
         
-        gcmd.RunCommand(data['command'])
-        
         if self.closeOnRun.IsChecked():
             self.OnCloseWindow(None)
         
@@ -197,8 +201,13 @@
         if not data or not data.has_key('command'):
             return
         
-        self.statusbar.SetStatusText(data['command'] + ' -- ' + data['help'], 0)
+        if data['command']:
+            label = data['command'] + ' -- ' + data['help']
+        else:
+            label = data['help']
         
+        self.statusbar.SetStatusText(label, 0)
+        
     def OnShowItem(self, event):
         """!Highlight first found item in menu tree"""
         if len(self.tree.itemsMarked) > 0:

Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2009-09-07 18:34:33 UTC (rev 39076)
+++ grass/trunk/gui/wxpython/wxgui.py	2009-09-07 19:08:58 UTC (rev 39077)
@@ -428,7 +428,8 @@
         Return command as a list"""
         layer = None
         
-        cmd = self.menucmd[event.GetId()]
+        if event:
+            cmd = self.menucmd[event.GetId()]
         
         try:
             cmdlist = cmd.split(' ')
@@ -460,9 +461,10 @@
         cmd = self.GetMenuCmd(event)
         self.goutput.RunCmd(cmd, switchPage=True)
 
-    def OnMenuCmd(self, event):
+    def OnMenuCmd(self, event, cmd = ''):
         """!Parse command selected from menu"""
-        cmd = self.GetMenuCmd(event)
+        if event:
+            cmd = self.GetMenuCmd(event)
         menuform.GUI().ParseCommand(cmd, parentframe=self)
 
     def OnNewVector(self, event):



More information about the grass-commit mailing list