[hamster-applet] on insert select newly created fact (if can be found). on delete be smarted and go to next record if



commit 2b2aa5d4602a895e1f4d50edfdf9ac108b172e80
Author: Toms Bauģis <toms baugis gmail com>
Date:   Fri Jan 22 01:22:52 2010 +0000

    on insert select newly created fact (if can be found). on delete be smarted and go to next record if only it is a fact. otherwise select previous.

 hamster/overview_activities.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/hamster/overview_activities.py b/hamster/overview_activities.py
index 0948b48..b3f4b46 100644
--- a/hamster/overview_activities.py
+++ b/hamster/overview_activities.py
@@ -106,7 +106,13 @@ class OverviewBox(gtk.VBox):
 
         selection = self.fact_tree.get_selection()
         (model, iter) = selection.get_selected()
-        self.fact_tree.select_next()
+        path = model.get_path(iter)[0]
+
+        # if next is fact, select that. otherwise select parent
+        if self.fact_tree.id_or_label(path+1) and model[path+1][0]:
+            selection.select_path(path + 1)
+        elif self.fact_tree.id_or_label(path-1):
+            selection.select_path(path - 1)
 
         model.remove(iter)
         runtime.storage.remove_fact(fact['id'])
@@ -196,6 +202,7 @@ class OverviewBox(gtk.VBox):
                                           end_time,
                                           fact.category_name,
                                           fact.description)
+        self.fact_tree.select_fact(new_id)
 
 if __name__ == "__main__":
     gtk.window_set_default_icon_name("hamster-applet")



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