From a4617e1219da5183166b9dcf690f33c34b18a3d2 Mon Sep 17 00:00:00 2001 From: epage Date: Sat, 16 May 2009 18:02:01 +0000 Subject: [PATCH] Making the search a bit more pythonic git-svn-id: file:///svnroot/quicknote/trunk@38 bb7704e3-badb-4cfa-9ab3-9374dc87eaa2 --- src/libkopfzeile.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/libkopfzeile.py b/src/libkopfzeile.py index 0b77f6f..6b0a7ba 100644 --- a/src/libkopfzeile.py +++ b/src/libkopfzeile.py @@ -87,15 +87,13 @@ class Kopfzeile(gtk.HBox): i = 0 active = -1 cats = [] - while i < n: - if (model[i][0] == category): - #self.categoryCombo.set_active(i) + for i, row in enumerate(model): + if row[0] == category: active = i - if (model[i][0]!= "%"): - cats.append(model[i][0]) - i += 1 + if row[0] != "%": + cats.append(row[0]) - if (active == -1) and (category!= "%"): + if active == -1 and category != "%": self.categoryCombo.append_text(category) sql = "INSERT INTO categories (id, liste) VALUES (0, ?)" self._db.speichereSQL(sql, (category, )) -- 1.7.9.5