[accerciser] Better handle removed cursor row



commit d91e2688190ae8bf6770dd3d987fb11cf58a94c4
Author: Jan-Marek Glogowski <glogow fbihome de>
Date:   Tue May 28 22:40:28 2019 +0200

    Better handle removed cursor row
    
    When processing child remove events and the cursor row is to be
    removed, try to move it to a previous or parent row instead of
    a later one.

 src/lib/accerciser/accessible_treeview.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/lib/accerciser/accessible_treeview.py b/src/lib/accerciser/accessible_treeview.py
index 722cb00..ebb7f23 100644
--- a/src/lib/accerciser/accessible_treeview.py
+++ b/src/lib/accerciser/accessible_treeview.py
@@ -812,14 +812,22 @@ class AccessibleTreeView(gtk.TreeView, ToolsAccessor):
       iter = self.model.iter_children(parent_iter)
     else:
       iter = self.model.get_iter_first()
+
     while iter:
       if self.model[iter][COL_ACC] not in parent:
+        cursor_path = self.get_cursor()[0]
+        if cursor_path != None:
+          iter_path = self.model.get_path(iter)
+          if iter_path.is_ancestor(cursor_path):
+            cursor_path = iter_path
+          if 0 == iter_path.compare(cursor_path):
+            if iter_path.prev() or iter_path.up():
+              self.set_cursor(iter_path, None, False)
         if not self.model.remove(iter):
           break
       else:
         iter = self.model.iter_next(iter)
 
-
   def _refreshChildren(self, iter):
     '''
     Remove all of a given node's children from the model.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]