[pitivi] clipproperties: Preserve selection on clicking Remove Effect
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [pitivi] clipproperties: Preserve selection on clicking Remove Effect
- Date: Sun, 23 Jul 2017 21:38:06 +0000 (UTC)
commit 212712dd86195c6eceb1961fe5f6f2e366914ce9
Author: suhas2go <suhas2go gmail com>
Date:   Thu May 11 04:18:46 2017 +0530
    clipproperties: Preserve selection on clicking Remove Effect
    
    Previously clicking on Remove Effect cleared the selection inside the effects
    treeview, this preserves selection at that position in the list.
    
    This fixes T7788.
    
    Differential Revision: https://phabricator.freedesktop.org/D1798
 pitivi/clipproperties.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 5d2c29a..7e22dc1 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -299,7 +299,15 @@ class EffectProperties(Gtk.Expander, Loggable):
             # Cannot remove nothing,
             return
         effect = self.storemodel.get_value(selected[1], COL_TRACK_EFFECT)
+        selection_path = self.storemodel.get_path(selected[1])
+        # Preserve selection in the tree view.
+        next_selection_index = selection_path.get_indices()[0]
+        effect_count = self.storemodel.iter_n_children()
+        if effect_count - 1 == next_selection_index:
+            next_selection_index -= 1
         self._removeEffect(effect)
+        if next_selection_index >= 0:
+            self.treeview_selection.select_path(next_selection_index)
 
     def _removeEffect(self, effect):
         pipeline = self._project.pipeline
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]