Browse Source

wxGUI/modeler: fix focus when moving items up/down

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58591 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 years ago
parent
commit
3bda13bf35
1 changed files with 3 additions and 1 deletions
  1. 3 1
      gui/wxpython/gmodeler/dialogs.py

+ 3 - 1
gui/wxpython/gmodeler/dialogs.py

@@ -953,11 +953,13 @@ class ItemListCtrl(ModelListCtrl):
         model = self.frame.GetModel()        
         modelActions = model.GetItems(objType=ModelAction)
         idxList = dict()
+        itemsToSelect = list()
         for i in items:
             if up:
                 idx = i-1
             else:
                 idx = i+1
+            itemsToSelect.append(idx)
             idxList[model.GetItemIndex(modelActions[i])] = model.GetItemIndex(modelActions[idx])
         
         # reorganize model items
@@ -966,7 +968,7 @@ class ItemListCtrl(ModelListCtrl):
         self.Populate(model.GetItems(objType=ModelAction))
         
         # re-selected originaly selected item
-        for item in idxList.itervalues():
+        for item in itemsToSelect:
             self.SetItemState(item,  wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED | wx.LIST_STATE_FOCUSED)
 
 class ItemCheckListCtrl(ItemListCtrl, listmix.CheckListCtrlMixin):