diff --git a/ChangeLog b/ChangeLog index c6deba2da..1460a54f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-03-03 Alex Roitman + * src/GenericFilter.py (HasAttribute.apply): Fix the rule. + (HasFamilyAttribute.apply): Fix the rule. + * src/Marriage.py (on_update_attr_clicked,on_add_attr_clicked): + Pass the window to the attribute editor. + 2005-03-02 Don Allingham * src/ChooseParents.py: use integers instead of strings for relationship types diff --git a/src/GenericFilter.py b/src/GenericFilter.py index 6bbe3c787..13977c229 100644 --- a/src/GenericFilter.py +++ b/src/GenericFilter.py @@ -1238,14 +1238,16 @@ class HasAttribute(Rule): return 'Has the personal attribute' def apply(self,db,p_id): + if not self.list[0]: + return 0 p = db.get_person_from_handle(p_id) - for event in p.getAttributes(): - if self.list[0] and event.get_type() != self.list[0]: - return 0 - ev = event.get_value().upper() - if self.list[1] and ev.find(self.list[1].upper())==-1: - return 0 - return 1 + for attr in p.get_attribute_list(): + name_match = self.list[0] == attr.get_type() + value_match = self.list[1] and\ + attr.get_value().upper().find(self.list[1].upper()) != -1 + if name_match and value_match: + return 1 + return 0 #------------------------------------------------------------------------- # @@ -1261,17 +1263,16 @@ class HasFamilyAttribute(Rule): return 'Has the family attribute' def apply(self,db,p_id): + if not self.list[0]: + return 0 p = db.get_person_from_handle(p_id) for f_id in p.get_family_handle_list(): f = db.get_family_from_handle(f_id) - for event in f.getAttributes(): - val = 1 - if self.list[0] and event.get_type() != self.list[0]: - val = 0 - ev = event.get_value().upper() - if self.list[1] and ev.find(self.list[1].upper())==-1: - val = 0 - if val == 1: + for attr in f.get_attribute_list(): + name_match = self.list[0] == attr.get_type() + value_match = self.list[1] and\ + attr.get_value().upper().find(self.list[1].upper()) != -1 + if name_match and value_match: return 1 return 0 diff --git a/src/Marriage.py b/src/Marriage.py index 29aa0116b..48d02ae65 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modiy # it under the terms of the GNU General Public License as published by @@ -20,8 +20,13 @@ # $Id$ +#------------------------------------------------------------------------- +# +# Python modules +# +#------------------------------------------------------------------------- import pickle -import string +from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -51,7 +56,6 @@ import GrampsKeys import NameDisplay from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog -from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -778,7 +782,7 @@ class Marriage: name = NameDisplay.displayer.display(mother) AttrEdit.AttributeEditor( self, attr, name, const.familyAttributes, - self.attr_edit_callback, self.update_sources) + self.attr_edit_callback, self.window, self.update_sources) def on_delete_attr_clicked(self,obj): if Utils.delete_selected(obj,self.alist): @@ -801,7 +805,7 @@ class Marriage: name = NameDisplay.displayer.display(mother) AttrEdit.AttributeEditor( self, None, name, const.familyAttributes, - self.attr_edit_callback, self.update_sources) + self.attr_edit_callback, self.window, self.update_sources) def move_element(self,list,src,dest): if src == -1: @@ -832,7 +836,7 @@ class Marriage: def get_place(self,makenew,trans=None): field = self.lds_place.child - text = string.strip(unicode(field.get_text())) + text = unicode(field.get_text()).strip() if text: if self.pmap.has_key(text): return self.db.get_place_from_handle(self.pmap[text])