svn: r9074

This commit is contained in:
Don Allingham 2007-10-03 23:33:56 +00:00
parent cd67c7b13d
commit 126ddc2e9a
5 changed files with 51 additions and 131 deletions

View File

@ -19,7 +19,6 @@ pkgdata_PYTHON = \
_GrampsDbWriteXML.py \ _GrampsDbWriteXML.py \
_GrampsGEDDB.py\ _GrampsGEDDB.py\
_GrampsInMemDB.py\ _GrampsInMemDB.py\
_HelperFunctions.py\
__init__.py\ __init__.py\
_LongOpStatus.py\ _LongOpStatus.py\
_ProgressMonitor.py _ProgressMonitor.py

View File

@ -1,127 +0,0 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2007 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import RelLib
def children_of_person(db, person):
"""
Returns a list of Person instances which represents children of
the specified person.
"""
families = [ db.get_family_from_handle(h) \
for h in person.get_family_handle_list() ]
chandles = []
for family in families:
chandles += [ ref.ref for ref in family.get_child_ref_list() ]
return [ db.get_person_from_handle(h) for h in chandles ]
def parents_of_person(db, person):
"""
Returns a list of Person instances which represents the parents of
the specified person. Each element in the list is a tuple consisting
of the (father, mother)
"""
families = [ db.get_family_from_handle(h) \
for h in person.get_parent_family_handle_list() ]
parents = []
for family in families:
fhandle = family.get_father_handle()
mhandle = family.get_mother_handle()
if fhandle:
father = db.get_person_from_handle(fhandle)
else:
father = None
if mhandle:
mother = db.get_person_from_handle(mhandle)
else:
mother = None
parents.append((father,mother))
return parents
def children_of_family(db, family):
"""
Returns a list of Person instances associated with the family.
"""
return [ db.get_person_from_handle(ref.ref) \
for ref in family.get_child_ref_list() ]
def parents_of_family(db, family):
"""
Returns a tuple of Person instances representing a father, mother pair.
"""
fhandle = family.get_father_handle()
mhandle = family.get_mother_handle()
if fhandle:
father = db.get_person_from_handle(fhandle)
else:
father = None
if mhandle:
mother = db.get_person_from_handle(mhandle)
else:
mother = None
return (father,mother)
def primary_parents_of(db, person):
handle = person.get_main_parents_family_handle()
if not handle:
return (None, None)
family = db.get_family_from_handle(handle)
mhandle = family.get_mother_handle()
fhandle = family.get_father_handle()
if mhandle:
mother = db.get_person_from_handle(mhandle)
else:
mother = None
if fhandle:
father = db.get_person_from_handle(fhandle)
else:
father = None
return (father, mother)
def primary_parent_family_of(db, person):
handle = person.get_main_parents_family_handle()
if not handle:
return db.get_family_from_handle(handle)
else:
return None
#def events_of_person(db, person):
# pass
#def events_of_family(db, family):
# pass
def notes_of(db, obj):
return [ db.get_note_from_handle(h) for h in obj.get_note_handle_list() ]
def sources_of(db, obj):
return [ db.get_source_from_handle(h) for h in obj.get_source_handle_list() ]
def sources_of_event(db, event):
pass
def sources_of_person(db, person):
pass
def sources_of_note(db, note):
pass

View File

@ -57,6 +57,3 @@ from _GrampsDbWriteXML import GrampsDbXmlWriter, \
from _LongOpStatus import LongOpStatus from _LongOpStatus import LongOpStatus
from _ProgressMonitor import ProgressMonitor from _ProgressMonitor import ProgressMonitor
from _HelperFunctions import *
from _DbBase import DbBase

24
src/gen/Makefile.am Normal file
View File

@ -0,0 +1,24 @@
# This is the src/RelLib level Makefile for Gramps
# We could use GNU make's ':=' syntax for nice wildcard use,
# but that is not necessarily portable.
# If not using GNU make, then list all .py files individually
SUBDIRS = proxy
pkgdatadir = $(datadir)/@PACKAGE@/gen
pkgdata_PYTHON = \
__init__.py
pkgpyexecdir = @pkgpyexecdir@/gen
pkgpythondir = @pkgpythondir@/gen
# Clean up all the byte-compiled files
MOSTLYCLEANFILES = *pyc *pyo
GRAMPS_PY_MODPATH = "../"
pycheck:
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
pychecker $(pkgdata_PYTHON));

27
src/gen/proxy/Makefile.am Normal file
View File

@ -0,0 +1,27 @@
# This is the src/RelLib level Makefile for Gramps
# We could use GNU make's ':=' syntax for nice wildcard use,
# but that is not necessarily portable.
# If not using GNU make, then list all .py files individually
pkgdatadir = $(datadir)/@PACKAGE@/proxy
pkgdata_PYTHON = \
__init__.py \
dbbase.py \
filter.py \
living.py \
private.py \
proxybase.py
pkgpyexecdir = @pkgpyexecdir@/gen
pkgpythondir = @pkgpythondir@/gen
# Clean up all the byte-compiled files
MOSTLYCLEANFILES = *pyc *pyo
GRAMPS_PY_MODPATH = "../../"
pycheck:
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
pychecker $(pkgdata_PYTHON));