* src/plugins/FamilyGroup.py: use family_id instead of spouse_id

svn: r7166
This commit is contained in:
Brian Matherly 2006-08-13 03:32:59 +00:00
parent 4f94f6a639
commit c9e5ae4692
2 changed files with 27 additions and 30 deletions

View File

@ -1,3 +1,6 @@
2006-08-12 Brian Matherly <brian@gramps-project.org>
* src/plugins/FamilyGroup.py: use family_id instead of spouse_id
2006-08-12 Don Allingham <don@gramps-project.org> 2006-08-12 Don Allingham <don@gramps-project.org>
* src/Merge/_MergePerson.py: properly merge notes * src/Merge/_MergePerson.py: properly merge notes

View File

@ -70,18 +70,13 @@ class FamilyGroup(Report):
self.family_handle = None self.family_handle = None
spouse_id = options_class.handler.options_dict['spouse_id'] family_id = options_class.handler.options_dict['family_id']
if spouse_id: if family_id:
family_list = person.get_family_handle_list() family_list = person.get_family_handle_list()
for family_handle in family_list: for family_handle in family_list:
family = database.get_family_from_handle(family_handle) family = database.get_family_from_handle(family_handle)
if person.get_handle() == family.get_father_handle(): this_family_id = family.get_gramps_id()
this_spouse_handle = family.get_mother_handle() if this_family_id == family_id:
else:
this_spouse_handle = family.get_father_handle()
this_spouse = database.get_person_from_handle(this_spouse_handle)
this_spouse_id = this_spouse.get_gramps_id()
if spouse_id == this_spouse_id:
self.family_handle = family_handle self.family_handle = family_handle
break break
@ -680,7 +675,7 @@ class FamilyGroupOptions(ReportOptions):
def set_new_options(self): def set_new_options(self):
# Options specific for this report # Options specific for this report
self.options_dict = { self.options_dict = {
'spouse_id' : '', 'family_id' : '',
'recursive' : 0, 'recursive' : 0,
'missinginfo' : 1, 'missinginfo' : 1,
'generations' : 1, 'generations' : 1,
@ -694,10 +689,8 @@ class FamilyGroupOptions(ReportOptions):
} }
self.options_help = { self.options_help = {
'spouse_id' : ("=ID","Gramps ID of the person's spouse.", 'family_id' : ("=ID","Gramps ID of the person's family.",
"Use show=id to get ID list.", "Use show=id to get ID list.",
#[item[0] for item in self.get_spouses(None,None)],
#False
), ),
'recursive' : ("=0/1","Create reports for all decendants of this family.", 'recursive' : ("=0/1","Create reports for all decendants of this family.",
["Do not create reports for decendants","Create reports for decendants"], ["Do not create reports for decendants","Create reports for decendants"],
@ -740,18 +733,19 @@ class FamilyGroupOptions(ReportOptions):
True), True),
} }
def get_spouses(self,database,person): def get_families(self,database,person):
""" """
Create a mapping of all spouse names:families to be put Create a mapping of all spouse names:families to be put
into the 'extra' option menu in the report options box. If into the 'extra' option menu in the report options box. If
the selected person has never been married then this routine the selected person has never been married then this routine
will return a placebo label and disable the OK button. will return a placebo label and disable the OK button.
""" """
spouses = [] families = []
spouse_id = None family_id = None
family_list = person.get_family_handle_list() family_list = person.get_family_handle_list()
for family_handle in family_list: for family_handle in family_list:
family = database.get_family_from_handle(family_handle) family = database.get_family_from_handle(family_handle)
family_id = family.get_gramps_id()
if person.get_handle() == family.get_father_handle(): if person.get_handle() == family.get_father_handle():
spouse_handle = family.get_mother_handle() spouse_handle = family.get_mother_handle()
else: else:
@ -759,11 +753,11 @@ class FamilyGroupOptions(ReportOptions):
if spouse_handle: if spouse_handle:
spouse = database.get_person_from_handle(spouse_handle) spouse = database.get_person_from_handle(spouse_handle)
name = spouse.get_primary_name().get_name() name = spouse.get_primary_name().get_name()
spouse_id = spouse.get_gramps_id()
else: else:
name = _("unknown") name = _("unknown")
spouses.append((spouse_id,name)) name = "%s (%s)" % (name,family_id)
return spouses families.append((family_id,name))
return families
def add_user_options(self,dialog): def add_user_options(self,dialog):
""" """
@ -771,18 +765,18 @@ class FamilyGroupOptions(ReportOptions):
the user to select the sort method. the user to select the sort method.
""" """
spouses = self.get_spouses(dialog.db,dialog.person) families = self.get_families(dialog.db,dialog.person)
spouse_id = self.options_dict['spouse_id'] family_id = self.options_dict['family_id']
self.spouse_menu = gtk.combo_box_new_text() self.spouse_menu = gtk.combo_box_new_text()
index = 0 index = 0
spouse_index = 0 family_index = 0
for item in spouses: for item in families:
self.spouse_menu.append_text(item[1]) self.spouse_menu.append_text(item[1])
if item[0] == spouse_id: if item[0] == family_id:
spouse_index = index family_index = index
index = index + 1 index = index + 1
self.spouse_menu.set_active(spouse_index) self.spouse_menu.set_active(family_index)
# Recursive # Recursive
self.recursive_option = gtk.CheckButton() self.recursive_option = gtk.CheckButton()
@ -840,10 +834,10 @@ class FamilyGroupOptions(ReportOptions):
""" """
Parses the custom options that we have added. Parses the custom options that we have added.
""" """
spouses = self.get_spouses(dialog.db,dialog.person) families = self.get_families(dialog.db,dialog.person)
spouse_index = self.spouse_menu.get_active() family_index = self.spouse_menu.get_active()
if spouses: if families:
self.options_dict['spouse_id'] = spouses[spouse_index][0] self.options_dict['family_id'] = families[family_index][0]
self.options_dict['recursive'] = int(self.recursive_option.get_active()) self.options_dict['recursive'] = int(self.recursive_option.get_active())
self.options_dict['missinginfo'] = int(self.missing_info_option.get_active()) self.options_dict['missinginfo'] = int(self.missing_info_option.get_active())