summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-02-03 23:31:27 +0100
committermathieui <mathieui@mathieui.net>2013-02-03 23:55:13 +0100
commit27d85a0961f7aad312538213f68862e2db09726b (patch)
tree2cc8a1cf8bf61d09d1d21b6a20e2ac2dab4931a0 /src/tabs.py
parenta76b016f953b9a3e670d7c186403fa059ecb1d0a (diff)
downloadpoezio-27d85a0961f7aad312538213f68862e2db09726b.tar.gz
poezio-27d85a0961f7aad312538213f68862e2db09726b.tar.bz2
poezio-27d85a0961f7aad312538213f68862e2db09726b.tar.xz
poezio-27d85a0961f7aad312538213f68862e2db09726b.zip
Fix the folding of contacts in multiple groups
(add a defaultdict to keep the folded state in each group)
Diffstat (limited to 'src/tabs.py')
-rw-r--r--src/tabs.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/tabs.py b/src/tabs.py
index 609c57c0..a74dcd69 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -2777,10 +2777,22 @@ class RosterInfoTab(Tab):
if isinstance(self.input, windows.Input):
return
selected_row = self.roster_win.get_selected_row()
- if isinstance(selected_row, RosterGroup) or\
- isinstance(selected_row, Contact):
+ if isinstance(selected_row, RosterGroup):
selected_row.toggle_folded()
return True
+ elif isinstance(selected_row, Contact):
+ group = "none"
+ found_group = False
+ pos = self.roster_win.pos
+ while not found_group and pos >= 0:
+ row = self.roster_win.roster_cache[pos]
+ pos -= 1
+ log.debug(row)
+ if isinstance(row, RosterGroup):
+ found_group = True
+ group = row.name
+ selected_row.toggle_folded(group)
+ return True
return False
def get_contact_version(self):