Explorar o código

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 %!s(int64=11) %!d(string=hai) anos
pai
achega
3bda13bf35
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  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):