[GRASS-SVN] r42478 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jun 3 15:51:29 EDT 2010


Author: martinl
Date: 2010-06-03 15:51:29 -0400 (Thu, 03 Jun 2010)
New Revision: 42478

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
Log:
wxGUI/modeler: show action id
(merge r42477 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-06-03 19:49:34 UTC (rev 42477)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-06-03 19:51:29 UTC (rev 42478)
@@ -155,8 +155,8 @@
                                      y = action['pos'][1],
                                      width = action['size'][0],
                                      height = action['size'][1],
-                                     task = action['task'])
-            actionItem.SetId(action['id'])
+                                     task = action['task'],
+                                     id = action['id'])
             if action['disabled']:
                 actionItem.Enable(False)
             
@@ -965,7 +965,8 @@
         
         # add action to canvas
         width, height = self.canvas.GetSize()
-        action = ModelAction(self, cmd = cmd, x = width/2, y = height/2)
+        action = ModelAction(self, cmd = cmd, x = width/2, y = height/2,
+                             id = len(self.model.GetActions()) + 1)
         overwrite = self.model.GetProperties().get('overwrite', None)
         if overwrite is not None:
             action.GetTask().set_flag('overwrite', overwrite)
@@ -1245,7 +1246,7 @@
         
 class ModelAction(ogl.RectangleShape):
     """!Action class (GRASS module)"""
-    def __init__(self, parent, x, y, cmd = None, task = None, width = None, height = None):
+    def __init__(self, parent, x, y, id = -1, cmd = None, task = None, width = None, height = None):
         self.parent  = parent
         self.task    = task
         if not width:
@@ -1263,7 +1264,7 @@
                 self.task = None
         
         self.propWin = None
-        self.id      = -1    # used for gxm file
+        self.id      = id
         
         self.data = list()   # list of connected data items
         
@@ -1280,12 +1281,8 @@
             self.SetPen(wx.BLACK_PEN)
             self._setPen()
             self._setBrush()
-            cmd = self.task.getCmd(ignoreErrors = True)
-            if cmd and len(cmd) > 0:
-                self.AddText(cmd[0])
-            else:
-                self.AddText('<<%s>>' % _("module"))
-        
+            self.SetId(id)
+            
     def _setBrush(self, running = False):
         """!Set brush"""
         if running:
@@ -1332,7 +1329,13 @@
     def SetId(self, id):
         """!Set id"""
         self.id = id
-    
+        cmd = self.task.getCmd(ignoreErrors = True)
+        if cmd and len(cmd) > 0:
+            self.ClearText()
+            self.AddText('(%d) %s' % (self.id, cmd[0]))
+        else:
+            self.AddText('(%d) <<%s>>' % (self.id, _("unknown")))
+
     def SetProperties(self, params, propwin):
         """!Record properties dialog"""
         self.task.params = params['params']



More information about the grass-commit mailing list