From f087ee7b337fd1ebc71193947504f65443259452 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 16 Aug 2006 04:45:45 +0000 Subject: [PATCH] * src/FilterEditor/_EditFilter.py (on_edit_clicked,on_add_clicked): Pass filter name to the rule editor. * src/FilterEditor/_EditRule.py (EditRule.__init__): Pass filter name to MyFilters. (MyFilters.__init__): Exclude filter being edited from the matching filter. svn: r7187 --- gramps2/ChangeLog | 6 ++++++ gramps2/src/FilterEditor/_EditFilter.py | 6 ++++-- gramps2/src/FilterEditor/_EditRule.py | 11 +++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 528605667..4a5a8bc8a 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -4,6 +4,12 @@ * src/GrampsDb/_GedTokens.py: support for AGE and AGENCY 2006-08-15 Alex Roitman + * src/FilterEditor/_EditFilter.py (on_edit_clicked,on_add_clicked): + Pass filter name to the rule editor. + * src/FilterEditor/_EditRule.py (EditRule.__init__): Pass filter + name to MyFilters. + (MyFilters.__init__): Exclude filter being edited from the + matching filter. * example/gramps/data.gramps: Add Age and Cause event attributes. * example/gramps/example.gramps: Add Age and Cause event attributes. * src/GrampsDb/_ReadXML.py (start_attribute): Support attributes diff --git a/gramps2/src/FilterEditor/_EditFilter.py b/gramps2/src/FilterEditor/_EditFilter.py index 6099bd603..8d1b542e1 100644 --- a/gramps2/src/FilterEditor/_EditFilter.py +++ b/gramps2/src/FilterEditor/_EditFilter.py @@ -171,7 +171,8 @@ class EditFilter(ManagedWindow.ManagedWindow): try: EditRule(self.space, self.dbstate, self.uistate, self.track, - self.filterdb, None, _('Add Rule'), self.update_rule) + self.filterdb, None, _('Add Rule'), self.update_rule, + self.filter.get_name()) except Errors.WindowActiveError: pass @@ -184,7 +185,8 @@ class EditFilter(ManagedWindow.ManagedWindow): try: EditRule(self.space, self.dbstate, self.uistate, self.track, - self.filterdb, d, _('Edit Rule'), self.update_rule) + self.filterdb, d, _('Edit Rule'), self.update_rule, + self.filter.get_name()) except Errors.WindowActiveError: pass diff --git a/gramps2/src/FilterEditor/_EditRule.py b/gramps2/src/FilterEditor/_EditRule.py index 64ba4aa49..c0e322fc0 100644 --- a/gramps2/src/FilterEditor/_EditRule.py +++ b/gramps2/src/FilterEditor/_EditRule.py @@ -138,7 +138,7 @@ class MyInteger(gtk.SpinButton): #------------------------------------------------------------------------- class MyFilters(gtk.ComboBox): - def __init__(self,filters): + def __init__(self,filters,filter_name): gtk.ComboBox.__init__(self) store = gtk.ListStore(str) self.set_model(store) @@ -149,7 +149,8 @@ class MyFilters(gtk.ComboBox): self.flist.sort() for fname in self.flist: - store.append(row=[fname]) + if filter_name.strip() and (fname != filter_name): + store.append(row=[fname]) self.set_active(0) self.show() @@ -341,7 +342,7 @@ class MyEntry(gtk.Entry): #------------------------------------------------------------------------- class EditRule(ManagedWindow.ManagedWindow): def __init__(self, space, dbstate, uistate, track, filterdb, val, - label, update): + label, update, filter_name): ManagedWindow.ManagedWindow.__init__(self, uistate, track, EditRule) @@ -350,6 +351,7 @@ class EditRule(ManagedWindow.ManagedWindow): self.db = dbstate.db self.filterdb = filterdb self.update_rule = update + self.filter_name = filter_name self.active_rule = val self.define_glade('rule_editor', const.rule_glade) @@ -421,7 +423,8 @@ class EditRule(ManagedWindow.ManagedWindow): elif v == _('Source ID:'): t = MySource(self.db) elif v == _('Filter name:'): - t = MyFilters(self.filterdb.get_filters(self.space)) + t = MyFilters(self.filterdb.get_filters(self.space), + self.filter_name) elif _name2typeclass.has_key(v): t = MySelect(_name2typeclass[v]) elif v == _('Inclusive:'):