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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Nov 3 13:40:56 PST 2013


Author: martinl
Date: 2013-11-03 13:40:56 -0800 (Sun, 03 Nov 2013)
New Revision: 58145

Modified:
   grass/trunk/gui/wxpython/gmodeler/model.py
Log:
wxGUI/modeler: fix reposition when ordering items

Modified: grass/trunk/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/model.py	2013-11-03 19:16:23 UTC (rev 58144)
+++ grass/trunk/gui/wxpython/gmodeler/model.py	2013-11-03 21:40:56 UTC (rev 58145)
@@ -111,10 +111,24 @@
         return len(self.GetItems())
 
     def ReorderItems(self, idxList):
+        items = list()
         for oldIdx, newIdx in idxList.iteritems():
             item = self.items.pop(oldIdx)
+            items.append(item)
             self.items.insert(newIdx, item)
+            nextItem = self.items[newIdx+1]
+            items.append(nextItem)
+            x = item.GetX()
+            y = item.GetY()
+            item.SetX(nextItem.GetX())
+            item.SetY(nextItem.GetY())
+            nextItem.SetX(x)
+            nextItem.SetY(y)
 
+        dc = wx.ClientDC(self.canvas)
+        for item in items:
+            item.MoveLinks(dc)
+            
     def Normalize(self):
         iId = 1
         for item in self.items:



More information about the grass-commit mailing list