From 4b9873e84d0fdbab128ce974edcf4cf2169e9b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 8 Jun 2008 01:33:35 +0200 Subject: Make selection work with the other cat layout --- portato/gui/windows/main.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'portato') diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 5444f81..1cda7bd 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1036,7 +1036,25 @@ class MainWindow (Window): for cname, path in ((x[col], x.path) for x in list.get_model()): if cname == name: pos = path + break + + if pos == "0" and isinstance(list.get_model(), gtk.TreeStore): # try the new split up + try: + pre, post = name.split("-", 1) + except ValueError: # nothing to split + pass + else: + for row in list.get_model(): + if row[col] == pre: # found first part + pos = row.path + list.expand_row(pos, False) + for cname, path in ((x[col], x.path) for x in row.iterchildren()): + if cname == post: # found second + pos = ":".join(map(str,path)) + break + break + debug("Selecting path '%s'.", pos) list.get_selection().select_path(pos) list.scroll_to_cell(pos) -- cgit v1.2.3