5032: Report selection logic

svn: r17835
This commit is contained in:
Jérôme Rapinat 2011-06-27 07:17:20 +00:00
parent dff684cad0
commit dfd17224ad

View File

@ -606,13 +606,13 @@ class GuiPersonOption(gtk.HBox):
gid = self.__option.get_value() gid = self.__option.get_value()
if len(gid): # Pick up the active person
person_handle = self.__uistate.get_active('Person')
person = self.__dbstate.db.get_person_from_handle(person_handle)
if not person:
# Pick up the stored option value if there is one # Pick up the stored option value if there is one
person = self.__db.get_person_from_gramps_id(gid) person = self.__db.get_person_from_gramps_id(gid)
else:
# Pick up the active person
person_handle = self.__uistate.get_active('Person')
person = self.__dbstate.db.get_person_from_handle(person_handle)
if not person: if not person:
person = self.__db.get_default_person() person = self.__db.get_default_person()
@ -745,16 +745,15 @@ class GuiFamilyOption(gtk.HBox):
fid = self.__option.get_value() fid = self.__option.get_value()
if len(fid): # Use the active family if one is selected
family = self.__uistate.get_active('Family')
if family:
family_list = [family]
else:
# Use the stored option value # Use the stored option value
family = self.__db.get_family_from_gramps_id(fid) family = self.__db.get_family_from_gramps_id(fid)
if family: if family:
family_list = [family.get_handle()] family_list = [family.get_handle()]
else:
# Use the active family if one is selected
family = self.__uistate.get_active('Family')
if family:
family_list = [family]
if not family_list: if not family_list:
# Next try the family of the active person # Next try the family of the active person
@ -801,13 +800,15 @@ class GuiFamilyOption(gtk.HBox):
rfilter.add_rule(Rules.Family.HasIdOf([gid])) rfilter.add_rule(Rules.Family.HasIdOf([gid]))
# Add the families of the selected person if one exists. # Add the families of the selected person if one exists.
active_person = self.__db.get_default_person() # Same code as above one ! See bug #5032 feature request #5038
if active_person: ### active_person = self.__uistate.get_active('Person') ###
family_list = active_person.get_family_handle_list() #active_person = self.__db.get_default_person()
for family_handle in family_list: #if active_person:
family = self.__db.get_family_from_handle(family_handle) #family_list = active_person.get_family_handle_list()
gid = family.get_gramps_id() #for family_handle in family_list:
rfilter.add_rule(Rules.Family.HasIdOf([gid])) #family = self.__db.get_family_from_handle(family_handle)
#gid = family.get_gramps_id()
#rfilter.add_rule(Rules.Family.HasIdOf([gid]))
select_class = SelectorFactory('Family') select_class = SelectorFactory('Family')
sel = select_class(self.__dbstate, self.__uistate, self.__track, sel = select_class(self.__dbstate, self.__uistate, self.__track,