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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Nov 10 04:55:08 PST 2013


Author: martinl
Date: 2013-11-10 04:55:08 -0800 (Sun, 10 Nov 2013)
New Revision: 58186

Modified:
   grass/trunk/gui/wxpython/gmodeler/dialogs.py
Log:
wxGUI/gmodeler: fix moving item down, re-select origninaly selected items

Modified: grass/trunk/gui/wxpython/gmodeler/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/dialogs.py	2013-11-10 12:31:13 UTC (rev 58185)
+++ grass/trunk/gui/wxpython/gmodeler/dialogs.py	2013-11-10 12:55:08 UTC (rev 58186)
@@ -921,13 +921,21 @@
         modelActions = model.GetItems(objType=ModelAction)
         idxList = dict()
         for i in items:
-            idxList[model.GetItemIndex(modelActions[i])] =  model.GetItemIndex(modelActions[i-1])
+            if up:
+                idx = i-1
+            else:
+                idx = i+1
+            idxList[model.GetItemIndex(modelActions[i])] = model.GetItemIndex(modelActions[idx])
         
         # reorganize model items
         model.ReorderItems(idxList)
         model.Normalize()
         self.Populate(model.GetItems(objType=ModelAction))
         
+        # re-selected originaly selected item
+        for item in idxList.itervalues():
+            self.SetItemState(item,  wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED | wx.LIST_STATE_FOCUSED)
+
 class ItemCheckListCtrl(ItemListCtrl, listmix.CheckListCtrlMixin):
     def __init__(self, parent, shape, columns, frame, **kwargs):
         self.parent = parent



More information about the grass-commit mailing list