From 9bcef08ae6212926b0f8c04143e0c5ce4dae34b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Mon, 9 Mar 2009 21:01:50 +0100 Subject: Fix the index error on pkglist jump. --- portato/gui/windows/main.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 5b3bf7e..cbb5bf1 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1200,7 +1200,15 @@ class MainWindow (Window): model = self.pkgList.get_model() if name: - if model[pos][col] != name: # need to search :( + search = False + try: + row = model[pos] + except IndexError: # position not in model + search = True + else: + search = (row[col] != name) + + if search: debug("Pkg path does not match. Searching...") for cname, path in ((x[col], x.path) for x in model): if cname == name: @@ -1227,7 +1235,15 @@ class MainWindow (Window): else: sname = None - if sname is None and model[pos][col] != name: # need to search in normal list + search = False + try: + row = model[pos] + except IndexError: # position not in model + search = True + else: + search = (row[col] != name) + + if sname is None and search: # need to search in normal list debug("Cat path does not match. Searching...") for cname, path in ((x[col], x.path) for x in model): if cname == name: -- cgit v1.2.3