From 054c446aeddb100fb64126f09bc31edd79a605a4 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 18 May 2005 15:34:02 +0000 Subject: [PATCH] * src/plugins/FilterEditor.py: sort entries in Add Rule dialog svn: r4615 --- gramps2/ChangeLog | 3 +++ gramps2/src/plugins/FilterEditor.py | 28 +++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 67d948fd6..b1d738424 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,6 @@ +2005-05-18 Don Allingham + * src/plugins/FilterEditor.py: sort entries in Add Rule dialog + 2005-05-18 Martin Hawlisch * src/GrampsBSDDB.py, src/GrampsDbBase.py, src/GrampsInMemDB.py, src/RelLib.py: Catch invalid arguments instead of crashing. diff --git a/gramps2/src/plugins/FilterEditor.py b/gramps2/src/plugins/FilterEditor.py index ea52ebbac..cf138d967 100644 --- a/gramps2/src/plugins/FilterEditor.py +++ b/gramps2/src/plugins/FilterEditor.py @@ -722,18 +722,28 @@ class EditRule: self.sel_name = unicode(_(self.active_rule.name())) else: self.sel_name = "" - - for v in the_map.keys(): + + keys = the_map.keys() + keys.sort() + keys.reverse() + catlist = [] + for v in keys: the_filter = GenericFilter.tasks[v]([None]) category = the_filter.category() - if top_level.has_key(category): - top_level[category].append(v) - else: - top_level[category] = [v] - top_node[category] = self.store.insert_after(None,last_top) - last_top = top_node[category] - self.store.set(last_top,0,category) + if category not in catlist: + catlist.append(category) + catlist.sort() + for category in catlist: + top_node[category] = self.store.insert_after(None,last_top) + top_level[category] = [] + last_top = top_node[category] + self.store.set(last_top,0,category) + + for v in keys: + the_filter = GenericFilter.tasks[v]([None]) + category = the_filter.category() + top_level[category].append(v) node = self.store.insert_after(top_node[category],prev) self.store.set(node,0,v)