[GRASS-SVN] r58606 - grass/trunk/gui/wxpython/gmodeler

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 4 09:09:28 PST 2014


Author: martinl
Date: 2014-01-04 09:09:27 -0800 (Sat, 04 Jan 2014)
New Revision: 58606

Modified:
   grass/trunk/gui/wxpython/gmodeler/model.py
Log:
wxGUI/modeler: fix moving item in the loop

Modified: grass/trunk/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/model.py	2014-01-04 16:45:22 UTC (rev 58605)
+++ grass/trunk/gui/wxpython/gmodeler/model.py	2014-01-04 17:09:27 UTC (rev 58606)
@@ -840,10 +840,16 @@
         """!Get id"""
         return self.id
 
-    def SetId(self, id):
+    def SetId(self, newId):
         """!Set id"""
-        self.id = id
+        if self.inBlock:
+            for loop in self.inBlock:
+                # update block item
+                loop.UpdateItem(self.id, newId)
+        
+        self.id = newId
 
+
     def AddRelation(self, rel):
         """!Record new relation
         """
@@ -1546,6 +1552,12 @@
         """!Set items (id)"""
         self.itemIds = items
 
+    def UpdateItem(self, oldId, newId):
+        """!Update item in the list"""
+        idx = self.itemIds.index(oldId)
+        if idx != -1:
+            self.itemIds[idx] = newId
+        
     def OnDraw(self, dc):
         """!Draw loop in canvas"""
         self._setBrush()



More information about the grass-commit mailing list