* src/plugins/WebPage.py: Clean up conversion to db.
Switch to using Sort function. * src/plugins/CountAncestors.py: Add file, convert to db. * src/plugins/count_anc.py: Remove file. * src/plugins/Summary.py: Convert to db. * src/Makefile.am: Ship Sort.py instead of sort.py. * src/plugins/Makefile.am: Ship CountAncestors.py instead of count_anc.py. svn: r3134
This commit is contained in:
parent
1e9a1fc2cc
commit
2e4f55908c
@ -1,3 +1,13 @@
|
||||
2004-05-05 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||
* src/plugins/WebPage.py: Clean up conversion to db.
|
||||
Switch to using Sort function.
|
||||
* src/plugins/CountAncestors.py: Add file, convert to db.
|
||||
* src/plugins/count_anc.py: Remove file.
|
||||
* src/plugins/Summary.py: Convert to db.
|
||||
* src/Makefile.am: Ship Sort.py instead of sort.py.
|
||||
* src/plugins/Makefile.am: Ship CountAncestors.py
|
||||
instead of count_anc.py.
|
||||
|
||||
2004-05-05 Don Allingham <donaldallingham@users.sourceforge.net>
|
||||
* src/plugins/ReadGedcom.py: commit after media object change
|
||||
* src/gramps.glade: file chooser for image selector
|
||||
|
@ -70,7 +70,7 @@ pkgpython_PYTHON = \
|
||||
Report.py\
|
||||
SelectChild.py\
|
||||
SelectObject.py\
|
||||
sort.py\
|
||||
Sort.py\
|
||||
soundex.py\
|
||||
Sources.py\
|
||||
SourceView.py\
|
||||
|
@ -2,6 +2,7 @@
|
||||
# count_anc.py - Ancestor counting plugin for gramps
|
||||
#
|
||||
# Copyright (C) 2001 Jesper Zedlitz
|
||||
# Copyright (C) 2004 Donald Allingham
|
||||
#
|
||||
# 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
|
||||
@ -18,6 +19,8 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
"View/Number of ancestors"
|
||||
|
||||
import os
|
||||
@ -47,16 +50,16 @@ class CountAncestors:
|
||||
})
|
||||
thisgen = []
|
||||
allgen = []
|
||||
thisgen.append(person)
|
||||
thisgen.append(person.get_id())
|
||||
title = _("Number of ancestors of \"%s\" by generation") % person.get_primary_name().get_name()
|
||||
text = text + title + ':\n'
|
||||
thisgensize=1
|
||||
gen=1
|
||||
while thisgensize>0:
|
||||
thisgensize=0
|
||||
if len(thisgen) >0:
|
||||
thisgensize=len(thisgen)
|
||||
gen= gen-1
|
||||
thisgensize = 1
|
||||
gen = 1
|
||||
while thisgensize > 0:
|
||||
thisgensize = 0
|
||||
if thisgen:
|
||||
thisgensize = len( thisgen )
|
||||
gen = gen - 1
|
||||
if thisgensize == 1 :
|
||||
text = text + _("Generation %d has 1 individual.\n") % (gen)
|
||||
else:
|
||||
@ -68,15 +71,15 @@ class CountAncestors:
|
||||
family_id = person.get_main_parents_family_id()
|
||||
if family_id:
|
||||
family = database.find_family_from_id(family_id)
|
||||
father = family.get_father_id()
|
||||
mother = family.get_mother_id()
|
||||
if father != None:
|
||||
thisgen.append(father)
|
||||
if mother != None:
|
||||
thisgen.append(mother)
|
||||
father_id = family.get_father_id()
|
||||
mother_id = family.get_mother_id()
|
||||
if father_id:
|
||||
thisgen.append(father_id)
|
||||
if mother_id:
|
||||
thisgen.append(mother_id)
|
||||
allgen = allgen + thisgen
|
||||
|
||||
text = text + _("Total ancestors in generations %d to -1 is %d .\n") % (gen, len(allgen))
|
||||
text = text + _("Total ancestors in generations %d to -1 is %d.\n") % (gen, len(allgen))
|
||||
|
||||
top = topDialog.get_widget("summary")
|
||||
textwindow = topDialog.get_widget("textwindow")
|
@ -10,7 +10,7 @@ pkgpython_PYTHON = \
|
||||
BookReport.py\
|
||||
ChangeTypes.py\
|
||||
Check.py\
|
||||
count_anc.py\
|
||||
CountAncestors.py\
|
||||
Desbrowser.py\
|
||||
DescendReport.py\
|
||||
DesGraph.py\
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2003 Donald N. Allingham
|
||||
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||
#
|
||||
# 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
|
||||
@ -18,6 +18,8 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
"View/Summary of the database"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -53,8 +55,8 @@ from gnome.ui import *
|
||||
#------------------------------------------------------------------------
|
||||
def build_report(database,person):
|
||||
|
||||
personList = database.get_person_id_map().values()
|
||||
familyList = database.get_family_id_map().values()
|
||||
personList = database.get_person_keys()
|
||||
familyList = database.get_family_keys()
|
||||
|
||||
with_photos = 0
|
||||
total_photos = 0
|
||||
@ -67,25 +69,32 @@ def build_report(database,person):
|
||||
namelist = []
|
||||
notfound = []
|
||||
|
||||
pobjects = len(database.get_object_map().values())
|
||||
for photo in database.get_object_map().values():
|
||||
pobjects = len(database.get_object_keys())
|
||||
for photo_id in database.get_object_keys():
|
||||
photo = database.find_object_from_id(photo_id)
|
||||
try:
|
||||
bytes = bytes + posixpath.getsize(photo.get_path())
|
||||
except:
|
||||
notfound.append(photo.get_path())
|
||||
|
||||
for person in personList:
|
||||
for person_id in personList:
|
||||
length = len(person.get_media_list())
|
||||
if length > 0:
|
||||
with_photos = with_photos + 1
|
||||
total_photos = total_photos + length
|
||||
|
||||
person = database.find_person_from_id(person_id)
|
||||
name = person.get_primary_name()
|
||||
if name.get_first_name() == "" or name.get_surname() == "":
|
||||
incomp_names = incomp_names + 1
|
||||
if person.get_main_parents_family_id() == None and len(person.get_family_id_list()) == 0:
|
||||
if (not person.get_main_parents_family_id()) and (not len(person.get_family_id_list())):
|
||||
disconnected = disconnected + 1
|
||||
if person.get_birth().get_date() == "":
|
||||
birth_id = person.get_birth_id()
|
||||
if birth_id:
|
||||
birth = database.find_event_from_id(birth_id)
|
||||
if not birth.get_date():
|
||||
missing_bday = missing_bday + 1
|
||||
else:
|
||||
missing_bday = missing_bday + 1
|
||||
if person.get_gender() == RelLib.Person.female:
|
||||
females = females + 1
|
||||
|
@ -53,7 +53,7 @@ import const
|
||||
import GrampsCfg
|
||||
import GenericFilter
|
||||
import Date
|
||||
import sort
|
||||
import Sort
|
||||
import Report
|
||||
import Errors
|
||||
from QuestionDialog import ErrorDialog
|
||||
@ -126,18 +126,13 @@ class IndividualPage:
|
||||
name = person.get_primary_name().get_regular_name()
|
||||
self.doc.set_title(_("Summary of %s") % name)
|
||||
self.doc.fix_title()
|
||||
self.sort = Sort.Sort(self.db)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def by_date(self,a_id,b_id):
|
||||
if not (a_id and b_id):
|
||||
return 0
|
||||
a = self.db.find_event_from_id(a_id)
|
||||
b = self.db.find_event_from_id(b_id)
|
||||
return Date.compare_dates(a.get_date_object(),b.get_date_object())
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -232,8 +227,8 @@ class IndividualPage:
|
||||
self.doc.start_paragraph("Data")
|
||||
if person_id:
|
||||
person = self.db.find_person_from_id(person_id)
|
||||
if self.list.has_key(person.get_id()):
|
||||
self.doc.start_link("%s.%s" % (person.get_id(),self.ext))
|
||||
if self.list.has_key(person_id):
|
||||
self.doc.start_link("%s.%s" % (person_id,self.ext))
|
||||
self.doc.write_text(person.get_primary_name().get_regular_name())
|
||||
self.doc.end_link()
|
||||
else:
|
||||
@ -323,7 +318,7 @@ class IndividualPage:
|
||||
if object.get_mime_type()[0:5] == "image":
|
||||
src = object.get_path()
|
||||
junk,ext = os.path.splitext(src)
|
||||
base = '%s%s' % (object.get_id(),ext)
|
||||
base = '%s%s' % (object_id,ext)
|
||||
|
||||
if os.path.isfile(src):
|
||||
self.doc.start_paragraph("Data")
|
||||
@ -405,33 +400,16 @@ class IndividualPage:
|
||||
as private, creating a thumbnail and copying the original
|
||||
image to the directory."""
|
||||
|
||||
# build a list of the images to add, but skip the first image,
|
||||
# since it has been used at the top of the page.
|
||||
|
||||
my_list = []
|
||||
for object_ref in self.person.get_media_list():
|
||||
object = self.db.find_object_from_id(object_ref.get_reference_id())
|
||||
if object.get_mime_type()[0:5] == "image":
|
||||
if object_ref.get_privacy() == 0:
|
||||
my_list.append(object)
|
||||
|
||||
# if no images were found, return
|
||||
|
||||
if len(my_list) == 0:
|
||||
return
|
||||
|
||||
self.doc.start_paragraph("Data")
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_paragraph("GalleryTitle")
|
||||
self.doc.write_text(_("Gallery"))
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table("gallery","IndTable")
|
||||
index = 0
|
||||
for obj_id in my_list:
|
||||
for object_ref in self.person.get_media_list():
|
||||
obj_id = object_ref.get_reference_id()
|
||||
obj = self.db.find_object_from_id(obj_id)
|
||||
if obj.get_mime_type()[0:5] != "image":
|
||||
continue
|
||||
if object_ref.get_privacy():
|
||||
continue
|
||||
|
||||
try:
|
||||
obj = self.db.find_object_from_id(obj_id)
|
||||
src = obj.get_path()
|
||||
junk,ext = os.path.splitext(src)
|
||||
base = '%s%s' % (obj.get_id(),ext)
|
||||
@ -454,6 +432,18 @@ class IndividualPage:
|
||||
if index == 0:
|
||||
index = 1
|
||||
continue
|
||||
elif index == 1:
|
||||
# If there's a second image then we need to start out
|
||||
# Gallery section and the table
|
||||
self.doc.start_paragraph("Data")
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_paragraph("GalleryTitle")
|
||||
self.doc.write_text(_("Gallery"))
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table("gallery","IndTable")
|
||||
index = 2
|
||||
|
||||
description = obj.get_description()
|
||||
|
||||
@ -470,19 +460,20 @@ class IndividualPage:
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell("NoteCell")
|
||||
if description != "":
|
||||
if description:
|
||||
self.doc.start_paragraph("PhotoDescription")
|
||||
self.doc.write_text(description)
|
||||
self.doc.end_paragraph()
|
||||
if obj.get_note() != "":
|
||||
if obj.get_note():
|
||||
self.doc.write_note(obj.get_note(),obj.get_note_format(),"PhotoNote")
|
||||
elif obj.get_reference().get_note() != "":
|
||||
self.doc.write_note(obj.get_reference().get_note(),obj.get_reference().get_note_format(),"PhotoNote")
|
||||
elif object_ref.get_note():
|
||||
self.doc.write_note(object_ref.get_note(),object_ref.get_note_format(),"PhotoNote")
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
except IOError:
|
||||
pass
|
||||
self.doc.end_table()
|
||||
if index == 2:
|
||||
self.doc.end_table()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -497,7 +488,7 @@ class IndividualPage:
|
||||
|
||||
event_id_list = [ self.person.get_birth_id(), self.person.get_death_id() ]
|
||||
event_id_list = event_id_list + self.person.get_event_list()
|
||||
event_id_list.sort(self.by_date)
|
||||
event_id_list.sort(self.sort.by_date)
|
||||
for event_id in event_id_list:
|
||||
if not event_id:
|
||||
continue
|
||||
@ -711,6 +702,7 @@ class WebReport(Report.Report):
|
||||
self.depth = depth
|
||||
self.birth_dates = birth_dates
|
||||
self.year_only = year_only
|
||||
self.sort = Sort.Sort(self.db)
|
||||
|
||||
def get_progressbar_data(self):
|
||||
return (_("Generate HTML reports - GRAMPS"), _("Creating Web Pages"))
|
||||
@ -814,7 +806,7 @@ class WebReport(Report.Report):
|
||||
doc.write_text(_("Family Tree Index"))
|
||||
doc.end_paragraph()
|
||||
|
||||
person_id_list.sort(self.db.sort_by_name)
|
||||
person_id_list.sort(self.sort.by_last_name)
|
||||
|
||||
a = {}
|
||||
for person_id in person_id_list:
|
||||
|
Loading…
Reference in New Issue
Block a user