[hamster-applet] tweaks
- From: Toms Baugis <tbaugis src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [hamster-applet] tweaks
- Date: Fri, 22 Jan 2010 10:19:30 +0000 (UTC)
commit 02e250efaf4f1326a980bf4a61fe755a5ecd8f1f
Author: Toms Bauģis <toms baugis gmail com>
Date: Fri Jan 22 10:19:16 2010 +0000
tweaks
hamster/widgets/facttree.py | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/hamster/widgets/facttree.py b/hamster/widgets/facttree.py
index bd1c51d..83d0fff 100644
--- a/hamster/widgets/facttree.py
+++ b/hamster/widgets/facttree.py
@@ -149,6 +149,8 @@ class FactTree(gtk.TreeView):
def get_row(self, path):
"""checks if the path is valid and if so, returns the model row"""
+ if path is None or path < 0: return None
+
try: # see if path is still valid
iter = self.store_model.get_iter(path)
return self.store_model[path]
@@ -218,15 +220,17 @@ class FactTree(gtk.TreeView):
elif prev[1] and prev[1] == new_prev_val and next[1] and next[1] == new_next_val:
# on update the ID changes so we find it by matching in between
path = cur[0]
- elif prev[1] == new_prev_val: # all that's left is delete.
- # if there is next record and the next record is a fact - select that
- # (if next is date we would like to go back to our parent)
+ elif prev[1] and prev[1] == new_prev_val: # all that's left is delete.
if new_cur_val:
path = cur[0]
else:
path = prev[0]
+ elif not new_prev_val and not new_next_val and new_cur_val:
+ # the only record in the tree (no next no previous, but there is current)
+ path = cur[0]
+
- if path:
+ if path is not None:
selection = self.get_selection()
selection.select_path(path)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]