change GuiFamilyOption precedence to match GuiPersonOption

(that is, use any "overridden" value, then any "active"
family, then any family of the "active" person, and only
then fall back on others, such as a saved-away family option
value, or any family of the user's "default" person)


svn: r22089
This commit is contained in:
Paul Franklin 2013-04-23 18:06:48 +00:00
parent b30869c6a4
commit da36417690

View File

@ -7,7 +7,7 @@
# Copyright (C) 2009 Nick Hall # Copyright (C) 2009 Nick Hall
# Copyright (C) 2010 Jakim Friant # Copyright (C) 2010 Jakim Friant
# Copyright (C) 2011 Adam Stein <adam@csh.rit.edu> # Copyright (C) 2011 Adam Stein <adam@csh.rit.edu>
# Copyright (C) 2011-2012 Paul Franklin # Copyright (C) 2011-2013 Paul Franklin
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -752,23 +752,22 @@ class GuiFamilyOption(Gtk.HBox):
def __initialize_family(self, override): def __initialize_family(self, override):
""" """
Find a family to initialize the option with. If there is no saved Find a family to initialize the option with. If there is no specified
family option, use the active family. If there is no active
family, try to find a family that the user is likely interested in. family, try to find a family that the user is likely interested in.
""" """
family_list = [] family_list = []
fid = self.__option.get_value() fid = self.__option.get_value()
fid_family = self.__db.get_family_from_gramps_id(fid)
active_family = self.__uistate.get_active('Family')
# Use the active family if one is selected if override and fid_family:
family = self.__uistate.get_active('Family') # Use the stored option value if there is one
if family and not override: family_list = [fid_family.get_handle()]
family_list = [family]
else: if active_family and not family_list:
# Use the stored option value # Use the active family if one is selected
family = self.__db.get_family_from_gramps_id(fid) family_list = [active_family]
if family:
family_list = [family.get_handle()]
if not family_list: if not family_list:
# Next try the family of the active person # Next try the family of the active person
@ -777,6 +776,10 @@ class GuiFamilyOption(Gtk.HBox):
if person: if person:
family_list = person.get_family_handle_list() family_list = person.get_family_handle_list()
if fid_family and not family_list:
# Next try the stored option value if there is one
family_list = [fid_family.get_handle()]
if not family_list: if not family_list:
# Next try the family of the default person in the database. # Next try the family of the default person in the database.
person = self.__db.get_default_person() person = self.__db.get_default_person()