diff --git a/ChangeLog b/ChangeLog index ecde858f6..5b95a67a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2004-07-27 Don Allingham + * src/RelLib.py, etc.: convert get_id to get_handle + 2004-07-26 Alex Roitman * src/data/Makefile.am: Use HUP instead of default SIGTERM. diff --git a/Makefile.in b/Makefile.in index 5fef1bb88..fbbcbfd49 100644 --- a/Makefile.in +++ b/Makefile.in @@ -85,6 +85,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/aclocal.m4 b/aclocal.m4 index 128e760ca..17d1a012f 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -11,6 +11,49 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +dnl AM_GCONF_SOURCE_2 +dnl Defines GCONF_SCHEMA_CONFIG_SOURCE which is where you should install schemas +dnl (i.e. pass to gconftool-2 +dnl Defines GCONF_SCHEMA_FILE_DIR which is a filesystem directory where +dnl you should install foo.schemas files +dnl + +AC_DEFUN(AM_GCONF_SOURCE_2, +[ + if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then + GCONF_SCHEMA_CONFIG_SOURCE=`gconftool-2 --get-default-source` + else + GCONF_SCHEMA_CONFIG_SOURCE=$GCONF_SCHEMA_INSTALL_SOURCE + fi + + AC_ARG_WITH(gconf-source, + [ --with-gconf-source=sourceaddress Config database for installing schema files.],GCONF_SCHEMA_CONFIG_SOURCE="$withval",) + + AC_SUBST(GCONF_SCHEMA_CONFIG_SOURCE) + AC_MSG_RESULT([Using config source $GCONF_SCHEMA_CONFIG_SOURCE for schema installation]) + + if test "x$GCONF_SCHEMA_FILE_DIR" = "x"; then + GCONF_SCHEMA_FILE_DIR='$(sysconfdir)/gconf/schemas/' + else + GCONF_SCHEMA_FILE_DIR=$GCONF_SCHEMA_FILE_DIR + fi + + AC_ARG_WITH(gconf-schema-file-dir, + [ --with-gconf-schema-file-dir=dir Directory for installing schema files.],GCONF_SCHEMA_FILE_DIR="$withval",) + + AC_SUBST(GCONF_SCHEMA_FILE_DIR) + AC_MSG_RESULT([Using $GCONF_SCHEMA_FILE_DIR as install directory for schema files]) + + AC_ARG_ENABLE(schemas-install, + [ --disable-schemas-install Disable the schemas installation], + [case "${enableval}" in + yes) schemas_install=true ;; + no) schemas_install=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-schemas-install) ;; + esac],[schemas_install=true]) + AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, test x$schemas_install = xtrue) +]) + dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page @@ -164,6 +207,49 @@ AC_PREREQ([2.50])dnl am_aux_dir=`cd $ac_aux_dir && pwd` ]) +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc. + +# 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, 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. + +# serial 6 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]) +fi])]) + # Do all the work for Automake. -*- Autoconf -*- # This macro actually does too much some checks are only needed if diff --git a/configure b/configure index cae30c4b4..f1da38f38 100755 --- a/configure +++ b/configure @@ -274,7 +274,7 @@ PACKAGE_STRING='gramps 1.1.1' PACKAGE_BUGREPORT='gramps-bugs@lists.sourceforge.net' ac_unique_file="src/gramps.py" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot RELEASE VERSIONSTRING MSGFMT MSGCONV ICONV LANGUAGES POFILES MOFILES PYTHON PYTHON_VERSION PYTHON_PREFIX PYTHON_EXEC_PREFIX PYTHON_PLATFORM pythondir pkgpythondir pyexecdir pkgpyexecdir BINSH PKG_CONFIG PYGTK_CFLAGS PYGTK_LIBS SK_CONFIG SCROLLKEEPER_BUILD_REQUIRED GNOMEHELP GPREFIX LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot GCONF_SCHEMA_CONFIG_SOURCE GCONF_SCHEMA_FILE_DIR GCONF_SCHEMAS_INSTALL_TRUE GCONF_SCHEMAS_INSTALL_FALSE RELEASE VERSIONSTRING MSGFMT MSGCONV ICONV LANGUAGES POFILES MOFILES PYTHON PYTHON_VERSION PYTHON_PREFIX PYTHON_EXEC_PREFIX PYTHON_PLATFORM pythondir pkgpythondir pyexecdir pkgpyexecdir BINSH PKG_CONFIG PYGTK_CFLAGS PYGTK_LIBS SK_CONFIG SCROLLKEEPER_BUILD_REQUIRED GNOMEHELP GPREFIX LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -789,6 +789,17 @@ if test -n "$ac_init_help"; then esac cat <<\_ACEOF +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-schemas-install Disable the schemas installation + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gconf-source=sourceaddress Config database for installing schema files. + --with-gconf-schema-file-dir=dir Directory for installing schema files. + Report bugs to . _ACEOF fi @@ -1670,6 +1681,65 @@ then fi + if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then + GCONF_SCHEMA_CONFIG_SOURCE=`gconftool-2 --get-default-source` + else + GCONF_SCHEMA_CONFIG_SOURCE=$GCONF_SCHEMA_INSTALL_SOURCE + fi + + +# Check whether --with-gconf-source or --without-gconf-source was given. +if test "${with_gconf_source+set}" = set; then + withval="$with_gconf_source" + GCONF_SCHEMA_CONFIG_SOURCE="$withval" +fi; + + + echo "$as_me:$LINENO: result: Using config source $GCONF_SCHEMA_CONFIG_SOURCE for schema installation" >&5 +echo "${ECHO_T}Using config source $GCONF_SCHEMA_CONFIG_SOURCE for schema installation" >&6 + + if test "x$GCONF_SCHEMA_FILE_DIR" = "x"; then + GCONF_SCHEMA_FILE_DIR='$(sysconfdir)/gconf/schemas/' + else + GCONF_SCHEMA_FILE_DIR=$GCONF_SCHEMA_FILE_DIR + fi + + +# Check whether --with-gconf-schema-file-dir or --without-gconf-schema-file-dir was given. +if test "${with_gconf_schema_file_dir+set}" = set; then + withval="$with_gconf_schema_file_dir" + GCONF_SCHEMA_FILE_DIR="$withval" +fi; + + + echo "$as_me:$LINENO: result: Using $GCONF_SCHEMA_FILE_DIR as install directory for schema files" >&5 +echo "${ECHO_T}Using $GCONF_SCHEMA_FILE_DIR as install directory for schema files" >&6 + + # Check whether --enable-schemas-install or --disable-schemas-install was given. +if test "${enable_schemas_install+set}" = set; then + enableval="$enable_schemas_install" + case "${enableval}" in + yes) schemas_install=true ;; + no) schemas_install=false ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --disable-schemas-install" >&5 +echo "$as_me: error: bad value ${enableval} for --disable-schemas-install" >&2;} + { (exit 1); exit 1; }; } ;; + esac +else + schemas_install=true +fi; + + +if test x$schemas_install = xtrue; then + GCONF_SCHEMAS_INSTALL_TRUE= + GCONF_SCHEMAS_INSTALL_FALSE='#' +else + GCONF_SCHEMAS_INSTALL_TRUE='#' + GCONF_SCHEMAS_INSTALL_FALSE= +fi + + + # Extract the first word of "msgfmt", so it can be a program name with args. @@ -2465,6 +2535,13 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +if test -z "${GCONF_SCHEMAS_INSTALL_TRUE}" && test -z "${GCONF_SCHEMAS_INSTALL_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"GCONF_SCHEMAS_INSTALL\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"GCONF_SCHEMAS_INSTALL\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files @@ -3016,6 +3093,10 @@ s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t +s,@GCONF_SCHEMA_CONFIG_SOURCE@,$GCONF_SCHEMA_CONFIG_SOURCE,;t t +s,@GCONF_SCHEMA_FILE_DIR@,$GCONF_SCHEMA_FILE_DIR,;t t +s,@GCONF_SCHEMAS_INSTALL_TRUE@,$GCONF_SCHEMAS_INSTALL_TRUE,;t t +s,@GCONF_SCHEMAS_INSTALL_FALSE@,$GCONF_SCHEMAS_INSTALL_FALSE,;t t s,@RELEASE@,$RELEASE,;t t s,@VERSIONSTRING@,$VERSIONSTRING,;t t s,@MSGFMT@,$MSGFMT,;t t diff --git a/doc/Makefile.in b/doc/Makefile.in index 9dc3ed614..95f90794c 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -71,6 +71,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/doc/gramps-manual/C/Makefile.in b/doc/gramps-manual/C/Makefile.in index 725e10c60..9aea690c7 100644 --- a/doc/gramps-manual/C/Makefile.in +++ b/doc/gramps-manual/C/Makefile.in @@ -119,6 +119,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/doc/gramps-manual/Makefile.in b/doc/gramps-manual/Makefile.in index 599bc33c7..855c7878f 100644 --- a/doc/gramps-manual/Makefile.in +++ b/doc/gramps-manual/Makefile.in @@ -67,6 +67,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/doc/gramps-manual/fr/Makefile.in b/doc/gramps-manual/fr/Makefile.in index be11771fe..baa7ef2cd 100644 --- a/doc/gramps-manual/fr/Makefile.in +++ b/doc/gramps-manual/fr/Makefile.in @@ -119,6 +119,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/doc/gramps-manual/ru/Makefile.in b/doc/gramps-manual/ru/Makefile.in index c25a75d42..2fc03bf25 100644 --- a/doc/gramps-manual/ru/Makefile.in +++ b/doc/gramps-manual/ru/Makefile.in @@ -119,6 +119,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/example/Makefile.in b/example/Makefile.in index ef86d5562..58988851d 100644 --- a/example/Makefile.in +++ b/example/Makefile.in @@ -65,6 +65,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/example/gramps/Makefile.in b/example/gramps/Makefile.in index 1953094d5..3056ec860 100644 --- a/example/gramps/Makefile.in +++ b/example/gramps/Makefile.in @@ -60,6 +60,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/gramps-mdk.spec b/gramps-mdk.spec index b11722618..2a4160a2e 100644 --- a/gramps-mdk.spec +++ b/gramps-mdk.spec @@ -1,5 +1,5 @@ %define ver 1.1.1 -%define rel 0.CVS20040624 +%define rel 0.CVS20040719 %define prefix /usr %define localstatedir /var/lib # Ensure that internal RPM macros for configure & makeinstall diff --git a/gramps.spec b/gramps.spec index 4be0e2be2..6e85a0eba 100644 --- a/gramps.spec +++ b/gramps.spec @@ -1,5 +1,5 @@ %define ver 1.1.1 -%define rel 0.CVS20040624 +%define rel 0.CVS20040719 %define prefix /usr %define localstatedir /var/lib # Ensure that internal RPM macros for configure & makeinstall diff --git a/src/AddSpouse.py b/src/AddSpouse.py index 7ce4a6562..2b5e95a49 100644 --- a/src/AddSpouse.py +++ b/src/AddSpouse.py @@ -90,18 +90,18 @@ class AddSpouse: # the potential spouse list. If Partners is selected, use # the same gender as the current person. - birth_id = self.person.get_birth_id() - death_id = self.person.get_death_id() + birth_handle = self.person.get_birth_handle() + death_handle = self.person.get_death_handle() - self.bday = self.db.find_event_from_id(birth_id) - self.dday = self.db.find_event_from_id(death_id) - if birth_id: - self.bday = self.db.find_event_from_id(birth_id).get_date_object() + self.bday = self.db.find_event_from_handle(birth_handle) + self.dday = self.db.find_event_from_handle(death_handle) + if birth_handle: + self.bday = self.db.find_event_from_handle(birth_handle).get_date_object() else: self.bday = Date.Date() - if death_id: - self.dday = self.db.find_event_from_id(death_id).get_date_object() + if death_handle: + self.dday = self.db.find_event_from_handle(death_handle).get_date_object() else: self.dday = Date.Date() @@ -215,13 +215,13 @@ class AddSpouse: """ person = epo.person trans = self.db.start_transaction() - id = person.get_id() + id = person.get_handle() if id == "": id = self.db.add_person(person,trans) else: self.db.add_person_no_map(person,id,trans) - person = self.db.try_to_find_person_from_id(id) + person = self.db.try_to_find_person_from_handle(id) n = person.get_primary_name().get_name() self.db.add_transaction(trans,_('Add Person (%s)' % n)) self.addperson(person) @@ -231,7 +231,7 @@ class AddSpouse: self.slist.rebuild_data() self.spouse_list.set_model(self.slist) - path = self.slist.on_get_path(person.get_id()) + path = self.slist.on_get_path(person.get_handle()) top_path = self.slist.on_get_path(person.get_primary_name().get_surname()) self.spouse_list.expand_row(top_path,0) self.selection.select_path(path) @@ -249,12 +249,12 @@ class AddSpouse: return spouse = self.db.get_person(idlist[0]) - spouse_id = spouse.get_id() + spouse_id = spouse.get_handle() # don't do anything if the marriage already exists - for f in self.person.get_family_id_list(): - fam = self.db.find_family_from_id(f) - if spouse_id == fam.get_mother_id() or spouse_id == fam.get_father_id(): + for f in self.person.get_family_handle_list(): + fam = self.db.find_family_from_handle(f) + if spouse_id == fam.get_mother_handle() or spouse_id == fam.get_father_handle(): Utils.destroy_passed_object(obj) return @@ -262,18 +262,18 @@ class AddSpouse: if not self.active_family: self.active_family = self.db.new_family(trans) - self.person.add_family_id(self.active_family.get_id()) + self.person.add_family_handle(self.active_family.get_handle()) self.db.commit_person(self.person,trans) - spouse.add_family_id(self.active_family.get_id()) + spouse.add_family_handle(self.active_family.get_handle()) self.db.commit_person(spouse,trans) if self.person.get_gender() == RelLib.Person.male: - self.active_family.set_mother_id(spouse.get_id()) - self.active_family.set_father_id(self.person.get_id()) + self.active_family.set_mother_handle(spouse.get_handle()) + self.active_family.set_father_handle(self.person.get_handle()) else: - self.active_family.set_father_id(spouse.get_id()) - self.active_family.set_mother_id(self.person.get_id()) + self.active_family.set_father_handle(spouse.get_handle()) + self.active_family.set_mother_handle(self.person.get_handle()) rtype = const.save_frel(unicode(self.relation_type.get_text())) self.active_family.set_relationship(rtype) @@ -297,16 +297,16 @@ class AddSpouse: if person.get_gender() == self.sgender: return 0 - pd_id = person.get_death_id() - pb_id = person.get_birth_id() + pd_id = person.get_death_handle() + pb_id = person.get_birth_handle() if pd_id: - pdday = self.db.find_event_from_id(pd_id).get_date_object() + pdday = self.db.find_event_from_handle(pd_id).get_date_object() else: pdday = Date.Date() if pb_id: - pbday = self.db.find_event_from_id(pb_id).get_date_object() + pbday = self.db.find_event_from_handle(pb_id).get_date_object() else: pbday = Date.Date() diff --git a/src/ArgHandler.py b/src/ArgHandler.py index 97d82c127..0c221d5d8 100644 --- a/src/ArgHandler.py +++ b/src/ArgHandler.py @@ -34,6 +34,7 @@ Module responsible for handling the command line arguments for GRAMPS. # #------------------------------------------------------------------------- import os +import os.path import getopt #------------------------------------------------------------------------- @@ -178,6 +179,11 @@ class ArgHandler: continue self.actions.append(action) + def auto_save_load(self,filename): + filename = os.path.normpath(os.path.abspath(filename)) + self.parent.active_person = None + return self.parent.read_file(filename) + #------------------------------------------------------------------------- # # Overall argument handler: @@ -197,7 +203,7 @@ class ArgHandler: filetype = GrampsMime.get_type(filename) if filetype == "application/x-gramps": print "Type: GRAMPS database" - if self.parent.auto_save_load(filename): + if self.auto_save_load(filename): print "Opened successfully!" else: print "Cannot open %s. Exiting..." @@ -284,7 +290,7 @@ class ArgHandler: if self.imports: self.parent.import_tool_callback() elif GrampsCfg.get_lastfile() and GrampsCfg.get_autoload(): - if self.parent.auto_save_load(GrampsCfg.get_lastfile()) == 0: + if self.auto_save_load(GrampsCfg.get_lastfile()) == 0: DbPrompter.DbPrompter(self.parent,0) else: DbPrompter.DbPrompter(self.parent,0) @@ -408,7 +414,7 @@ class ArgHandler: # Write media files first, since the database may be modified # during the process (i.e. when removing object) for m_id in self.parent.db.get_object_keys(): - mobject = self.parent.db.try_to_find_object_from_id(m_id) + mobject = self.parent.db.try_to_find_object_from_handle(m_id) oldfile = mobject.get_path() base = os.path.basename(oldfile) if os.path.isfile(oldfile): diff --git a/src/Bookmarks.py b/src/Bookmarks.py index 71b3b7b15..d5c01679d 100644 --- a/src/Bookmarks.py +++ b/src/Bookmarks.py @@ -66,27 +66,27 @@ class Bookmarks : """Create the pulldown menu""" if len(self.bookmarks) > 0: self.myMenu = gtk.Menu() - for person_id in self.bookmarks: - self.add_to_menu(person_id) + for person_handle in self.bookmarks: + self.add_to_menu(person_handle) self.menu.set_submenu(self.myMenu) self.menu.set_sensitive(1) else: self.menu.remove_submenu() self.menu.set_sensitive(0) - def add(self,person_id): + def add(self,person_handle): """appends the person to the bottom of the bookmarks""" - if person_id not in self.bookmarks: - self.bookmarks.append(person_id) + if person_handle not in self.bookmarks: + self.bookmarks.append(person_handle) self.redraw() - def add_to_menu(self,person_id): + def add_to_menu(self,person_handle): """adds a person's name to the drop down menu""" - data = self.db.person_map.get(str(person_id)) + data = self.db.person_map.get(str(person_handle)) if data: name = data[3].get_name() item = gtk.MenuItem(name) - item.connect("activate", self.callback, person_id) + item.connect("activate", self.callback, person_handle) item.show() self.myMenu.append(item) @@ -142,11 +142,11 @@ class Bookmarks : """ self.draw_window() index = 0 - for person_id in self.bookmarks: - data = self.db.person_map.get(str(person_id)) + for person_handle in self.bookmarks: + data = self.db.person_map.get(str(person_handle)) name = data[3].get_name() self.namelist.append([name]) - self.namelist.set_row_data(index,person_id) + self.namelist.set_row_data(index,person_handle) index = index + 1 self.response = self.top.run() @@ -178,9 +178,9 @@ class Bookmarks : """Saves the current bookmarks from the list""" del self.bookmarks[0:] for index in range(0,self.namelist.rows): - person_id = self.namelist.get_row_data(index) - if person_id: - self.bookmarks.append(person_id) + person_handle = self.namelist.get_row_data(index) + if person_handle: + self.bookmarks.append(person_handle) self.redraw() def help_clicked(self): diff --git a/src/ChooseParents.py b/src/ChooseParents.py index 03399ed00..fbad271b9 100644 --- a/src/ChooseParents.py +++ b/src/ChooseParents.py @@ -80,9 +80,9 @@ class ChooseParents: self.parent = parent self.db = db self.child_windows = {} - self.person = self.db.try_to_find_person_from_id(person.get_id()) + self.person = self.db.try_to_find_person_from_handle(person.get_handle()) if family: - self.family = self.db.find_family_from_id(family.get_id()) + self.family = self.db.find_family_from_handle(family.get_handle()) else: self.family = None self.family_update = family_update @@ -96,21 +96,21 @@ class ChooseParents: self.father_filter = self.likely_father_filter self.mother_filter = self.likely_mother_filter - birth_event = self.db.find_event_from_id(self.person.get_birth_id()) + birth_event = self.db.find_event_from_handle(self.person.get_birth_handle()) if birth_event: self.bday = birth_event.get_date_object() else: self.bday = None - death_event = self.db.find_event_from_id(self.person.get_death_id()) + death_event = self.db.find_event_from_handle(self.person.get_death_handle()) if death_event: self.dday = death_event.get_date_object() else: self.dday = None if self.family: - self.father = self.family.get_father_id() - self.mother = self.family.get_mother_id() + self.father = self.family.get_father_handle() + self.mother = self.family.get_mother_handle() else: self.mother = None self.father = None @@ -139,7 +139,7 @@ class ChooseParents: self.build_father_list() self.build_mother_list() - for (f,mr,fr) in self.person.get_parent_family_id_list(): + for (f,mr,fr) in self.person.get_parent_family_handle_list(): if f == self.family: self.mother_rel.set_text(_(mr)) self.father_rel.set_text(_(fr)) @@ -250,27 +250,27 @@ class ChooseParents: def likely_father_filter(self,person): if person.get_gender() != RelLib.Person.male: return 0 - if self.exclude.has_key(person.get_id()): + if self.exclude.has_key(person.get_handle()): return 0 return self.likely_filter(person) def likely_mother_filter(self,person): if person.get_gender() != RelLib.Person.female: return 0 - if self.exclude.has_key(person.get_id()): + if self.exclude.has_key(person.get_handle()): return 0 return self.likely_filter(person) def likely_filter(self,person): - if person.get_id() == self.person.get_id(): + if person.get_handle() == self.person.get_handle(): return 0 - birth_event = self.db.find_event_from_id(person.get_birth_id()) + birth_event = self.db.find_event_from_handle(person.get_birth_handle()) if birth_event: pbday = birth_event.get_date_object() else: pbday = None - death_event = self.db.find_event_from_id(person.get_death_id()) + death_event = self.db.find_event_from_handle(person.get_death_handle()) if death_event: pdday = death_event.get_date_object() else: @@ -304,13 +304,13 @@ class ChooseParents: return 1 def build_exclude_list(self): - self.exclude = { self.person.get_id() : 1 } - for family_id in self.person.get_family_id_list(): - fam = self.db.find_family_from_id(family_id) - for id in [fam.get_father_id(), fam.get_mother_id()] + \ - fam.get_child_id_list(): + self.exclude = { self.person.get_handle() : 1 } + for family_handle in self.person.get_family_handle_list(): + fam = self.db.find_family_from_handle(family_handle) + for handle in [fam.get_father_handle(), fam.get_mother_handle()] + \ + fam.get_child_handle_list(): if id: - self.exclude[id] = 1 + self.exclude[handle] = 1 def redrawf(self): """Redraws the potential father list""" @@ -320,7 +320,7 @@ class ChooseParents: self.build_exclude_list() for pid in self.db.get_person_keys(): - person = self.db.try_to_find_person_from_id(pid) + person = self.db.try_to_find_person_from_handle(pid) visible = self.father_filter(person) if visible: self.father_nsort.set_visible(pid,visible) @@ -343,7 +343,7 @@ class ChooseParents: self.build_exclude_list() for pid in self.db.get_person_keys(): - person = self.db.try_to_find_person_from_id(pid) + person = self.db.try_to_find_person_from_handle(pid) visible = self.mother_filter(person) if visible: self.mother_nsort.set_visible(pid,visible) @@ -380,37 +380,37 @@ class ChooseParents: self.mother_filter = self.likely_mother_filter self.redrawm() - def find_family(self,father_id,mother_id,trans): + def find_family(self,father_handle,mother_handle,trans): """ Finds the family associated with the father and mother. If one does not exist, it is created. """ - if not father_id and not mother_id: + if not father_handle and not mother_handle: return None - for family_id in self.db.get_family_keys(): - family = self.db.find_family_from_id(family_id) - if family.get_father_id() == father_id and family.get_mother_id() == mother_id: - family.add_child_id(self.person.get_id()) + for family_handle in self.db.get_family_keys(): + family = self.db.find_family_from_handle(family_handle) + if family.get_father_handle() == father_handle and family.get_mother_handle() == mother_handle: + family.add_child_handle(self.person.get_handle()) self.db.commit_family(family,trans) return family - elif family.get_father_id() == mother_id and family.get_mother_id() == father_id: - family.add_child_id(self.person.get_id()) + elif family.get_father_handle() == mother_handle and family.get_mother_handle() == father_handle: + family.add_child_handle(self.person.get_handle()) self.db.commit_family(family,trans) return family family = self.db.new_family(trans) - family.set_father_id(father_id) - family.set_mother_id(mother_id) - family.add_child_id(self.person.get_id()) + family.set_father_handle(father_handle) + family.set_mother_handle(mother_handle) + family.add_child_handle(self.person.get_handle()) - if father_id: - self.father = self.db.try_to_find_person_from_id(father_id) - self.father.add_family_id(family.get_id()) + if father_handle: + self.father = self.db.try_to_find_person_from_handle(father_handle) + self.father.add_family_handle(family.get_handle()) self.db.commit_person(self.father,trans) - if mother_id: - self.mother = self.db.try_to_find_person_from_id(mother_id) - self.mother.add_family_id(family.get_id()) + if mother_handle: + self.mother = self.db.try_to_find_person_from_handle(mother_handle) + self.mother.add_family_handle(family.get_handle()) self.db.commit_person(self.mother,trans) self.db.commit_family(family,trans) @@ -420,7 +420,7 @@ class ChooseParents: """Called when a row is selected in the mother list. Sets the active mother based off the id associated with the row.""" - idlist = self.get_selected_mother_ids() + idlist = self.get_selected_mother_handles() if idlist and idlist[0]: self.mother = self.db.get_person(idlist[0]) else: @@ -428,11 +428,11 @@ class ChooseParents: if not self.parent_selected and self.mother: self.parent_selected = 1 - family_id_list = self.mother.get_family_id_list() - if len(family_id_list) >= 1: - family = self.db.find_family_from_id(family_id_list[0]) - father_id = family.get_father_id() - self.father_selection.select(father_id) + family_handle_list = self.mother.get_family_handle_list() + if len(family_handle_list) >= 1: + family = self.db.find_family_from_handle(family_handle_list[0]) + father_handle = family.get_father_handle() + self.father_selection.select(father_handle) #self.father_model.center_selected() def father_select_function(self,store,path,iter,id_list): @@ -445,12 +445,12 @@ class ChooseParents: val = self.mother_model.get_value(iter,PeopleModel.COLUMN_INT_ID) id_list.append(val) - def get_selected_father_ids(self): + def get_selected_father_handles(self): mlist = [] self.father_selection.selected_foreach(self.father_select_function,mlist) return mlist - def get_selected_mother_ids(self): + def get_selected_mother_handles(self): mlist = [] self.mother_selection.selected_foreach(self.mother_select_function,mlist) return mlist @@ -459,7 +459,7 @@ class ChooseParents: """Called when a row is selected in the father list. Sets the active father based off the id associated with the row.""" - idlist = self.get_selected_father_ids() + idlist = self.get_selected_father_handles() if idlist and idlist[0]: self.father = self.db.get_person(idlist[0]) else: @@ -467,15 +467,15 @@ class ChooseParents: if not self.parent_selected and self.father: self.parent_selected = 1 - family_id_list = self.father.get_family_id_list() - if len(family_id_list) >= 1: - family = self.db.find_family_from_id(family_id_list[0]) - mother_id = family.get_mother_id() - mother = self.db.try_to_find_person_from_id(mother_id) + family_handle_list = self.father.get_family_handle_list() + if len(family_handle_list) >= 1: + family = self.db.find_family_from_handle(family_handle_list[0]) + mother_handle = family.get_mother_handle() + mother = self.db.try_to_find_person_from_handle(mother_handle) sname = mother.get_primary_name().get_surname() tpath = self.mother_nsort.on_get_path(sname) self.mother_list.expand_row(tpath,0) - path = self.mother_nsort.on_get_path(mother_id) + path = self.mother_nsort.on_get_path(mother_handle) self.mother_selection.select_path(path) self.mother_list.scroll_to_cell(path,None,1,0.5,0) @@ -483,7 +483,7 @@ class ChooseParents: """Called when a row is selected in the father list. Sets the active father based off the id associated with the row.""" - idlist = self.get_selected_mother_ids() + idlist = self.get_selected_mother_handles() if idlist and idlist[0]: self.mother = self.db.get_person(idlist[0]) else: @@ -491,15 +491,15 @@ class ChooseParents: if not self.parent_selected and self.mother: self.parent_selected = 1 - family_id_list = self.mother.get_family_id_list() - if len(family_id_list) >= 1: - family = self.db.find_family_from_id(family_id_list[0]) - father_id = family.get_mother_id() - father = self.db.try_to_find_person_from_id(father_id) + family_handle_list = self.mother.get_family_handle_list() + if len(family_handle_list) >= 1: + family = self.db.find_family_from_handle(family_handle_list[0]) + father_handle = family.get_mother_handle() + father = self.db.try_to_find_person_from_handle(father_handle) sname = father.get_primary_name().get_surname() tpath = self.father_nsort.on_get_path(sname) self.father_list.expand_row(tpath,0) - path = self.father_nsort.on_get_path(father_id) + path = self.father_nsort.on_get_path(father_handle) self.father_selection.select_path(path) self.father_list.scroll_to_cell(path,None,1,0.5,0) @@ -523,43 +523,43 @@ class ChooseParents: if self.mother and not self.father: if self.mother.get_gender() == RelLib.Person.male: self.father = self.mother - father_id = self.father.get_id() + father_handle = self.father.get_handle() self.mother = None - mother_id = None + mother_handle = None else: - mother_id = self.mother.get_id() - father_id = None + mother_handle = self.mother.get_handle() + father_handle = None elif self.father and not self.mother: if self.father.get_gender() == RelLib.Person.female: self.mother = self.father self.father = None - mother_id = self.mother.get_id() - father_id = None + mother_handle = self.mother.get_handle() + father_handle = None else: - father_id = self.father.get_id() - mother_id = None + father_handle = self.father.get_handle() + mother_handle = None elif self.mother.get_gender() != self.father.get_gender(): if self.type == "Partners": self.type = "Unknown" if self.father.get_gender() == RelLib.Person.female: self.father, self.mother = self.mother, self.father - father_id = self.father.get_id() - mother_id = self.mother.get_id() + father_handle = self.father.get_handle() + mother_handle = self.mother.get_handle() else: self.type = "Partners" - father_id = self.father.get_id() - mother_id = self.mother.get_id() - self.family = self.find_family(father_id,mother_id,trans) + father_handle = self.father.get_handle() + mother_handle = self.mother.get_handle() + self.family = self.find_family(father_handle,mother_handle,trans) else: self.family = None if self.family: - if self.person.get_id() in (father_id,mother_id): + if self.person.get_handle() in (father_handle,mother_handle): ErrorDialog(_("Error selecting a child"), _("A person cannot be linked as his/her own parent"), self.top) return - self.family.add_child_id(self.person.get_id()) + self.family.add_child_handle(self.person.get_handle()) self.family.set_relationship(self.type) self.change_family_type(self.family,mother_rel,father_rel) self.db.commit_family(self.family,trans) @@ -572,7 +572,8 @@ class ChooseParents: depending on the gender of the person.""" person = epo.person - id = person.get_id() + id = person.get_handle() + name = person.get_primary_name().get_surname() if id == "": id = self.db.add_person(person,trans) @@ -585,15 +586,15 @@ class ChooseParents: self.parent_relation_changed(self.prel) elif person.get_gender() == RelLib.Person.male: self.redrawf() - path = self.father_model.on_get_path(id) - top_path = self.father_model.on_get_path(person.get_primary_name().get_surname()) + path = self.father_nsort.on_get_path(id) + top_path = self.father_nsort.on_get_path(name) self.father_list.expand_row(top_path,0) self.father_selection.select_path(path) self.father_list.scroll_to_cell(path,None,1,0.5,0) else: self.redrawm() - path = self.mother_model.on_get_path(id) - top_path = self.mother_model.on_get_path(person.get_primary_name().get_surname()) + path = self.mother_nsort.on_get_path(id) + top_path = self.mother_nsort.on_get_path(name) self.mother_list.expand_row(top_path,0) self.mother_selection.select_path(path) self.mother_list.scroll_to_cell(path,None,1,0.5,0) @@ -618,19 +619,19 @@ class ChooseParents: Changes the family type of the specified family. If the family is None, the the relationship type shoud be deleted. """ - family_id = family.get_id() - if self.person.get_id() not in family.get_child_id_list(): - family.add_child_id(self.person.get_id()) - for fam in self.person.get_parent_family_id_list(): - if family_id == fam[0]: + family_handle = family.get_handle() + if self.person.get_handle() not in family.get_child_handle_list(): + family.add_child_handle(self.person.get_handle()) + for fam in self.person.get_parent_family_handle_list(): + if family_handle == fam[0]: if mother_rel == fam[1] and father_rel == fam[2]: return if mother_rel != fam[1] or father_rel != fam[2]: - self.person.remove_parent_family_id(family.get_id()) - self.person.add_parent_family_id(family.get_id(),mother_rel,father_rel) + self.person.remove_parent_family_handle(family.get_handle()) + self.person.add_parent_family_handle(family.get_handle(),mother_rel,father_rel) break else: - self.person.add_parent_family_id(family.get_id(),mother_rel,father_rel) + self.person.add_parent_family_handle(family.get_handle(),mother_rel,father_rel) trans = self.db.start_transaction() self.db.commit_person(self.person,trans) @@ -642,7 +643,7 @@ class ChooseParents: self.db.add_transaction(trans,_("Choose Parents")) class ModifyParents: - def __init__(self,db,person,family_id,family_update,full_update,parent_window=None): + def __init__(self,db,person,family_handle,family_update,full_update,parent_window=None): """ Creates a ChoosePerson dialog box. @@ -654,12 +655,12 @@ class ModifyParents: """ self.db = db self.person = person - self.family = self.db.find_family_from_id(family_id) + self.family = self.db.find_family_from_handle(family_handle) self.family_update = family_update self.full_update = full_update - self.father = self.db.try_to_find_person_from_id(self.family.get_father_id()) - self.mother = self.db.try_to_find_person_from_id(self.family.get_mother_id()) + self.father = self.db.try_to_find_person_from_handle(self.family.get_father_handle()) + self.mother = self.db.try_to_find_person_from_handle(self.family.get_mother_handle()) self.glade = gtk.glade.XML(const.gladeFile,"modparents","gramps") self.top = self.glade.get_widget("modparents") @@ -675,8 +676,8 @@ class ModifyParents: self.orig_mrel = _("Birth") self.orig_frel = _("Birth") - for (f,mr,fr) in self.person.get_parent_family_id_list(): - if f == self.family.get_id(): + for (f,mr,fr) in self.person.get_parent_family_handle_list(): + if f == self.family.get_handle(): self.orig_mrel = _(mr) self.orig_frel = _(fr) @@ -710,10 +711,10 @@ class ModifyParents: self.mother_rel.set_sensitive(0) self.pref = self.glade.get_widget('preferred') - if len(self.person.get_parent_family_id_list()) > 1: + if len(self.person.get_parent_family_handle_list()) > 1: self.glade.get_widget('pref_label').show() self.pref.show() - if self.family == self.person.get_parent_family_id_list()[0]: + if self.family == self.person.get_parent_family_handle_list()[0]: self.pref.set_active(1) else: self.pref.set_active(0) @@ -741,21 +742,21 @@ class ModifyParents: mod = 0 if mother_rel != self.orig_mrel or father_rel != self.orig_frel: - self.person.remove_parent_family_id(self.family.get_id()) - self.person.add_parent_family_id(self.family.get_id(),mother_rel,father_rel) + self.person.remove_parent_family_handle(self.family.get_handle()) + self.person.add_parent_family_handle(self.family.get_handle(),mother_rel,father_rel) mod = 1 - if len(self.person.get_parent_family_id_list()): + if len(self.person.get_parent_family_handle_list()): make_pref = self.pref.get_active() - plist = self.person.get_parent_family_id_list() + plist = self.person.get_parent_family_handle_list() if make_pref: if self.family != plist[0]: - self.person.set_main_parent_family_id(self.family.get_id()) + self.person.set_main_parent_family_handle(self.family.get_handle()) mod = 1 else: if self.family == plist[0]: - self.person.set_main_parent_family_id(plist[0]) + self.person.set_main_parent_family_handle(plist[0]) mod = 1 if mod: diff --git a/src/DisplayModels.py b/src/DisplayModels.py index dc7c21753..223366cbe 100644 --- a/src/DisplayModels.py +++ b/src/DisplayModels.py @@ -52,9 +52,9 @@ class BaseModel(gtk.GenericTreeModel): val = 0 keys = self.sort_keys() - for place_id in keys: - self.iter2path[place_id] = (val,) - self.path2iter[(val,)] = place_id + for place_handle in keys: + self.iter2path[place_handle] = (val,) + self.path2iter[(val,)] = place_handle val += 1 def on_row_inserted(self,obj,path,iter): diff --git a/src/EditPerson.py b/src/EditPerson.py index 3ab63e9e8..d1b1f2656 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -85,7 +85,7 @@ class EditPerson: self.parent = parent self.orig_id = self.person.get_gramps_id() if self.parent.child_windows.has_key(self.orig_id): - self.parent.child_windows[self.person.get_id()].present(None) + self.parent.child_windows[self.person.get_handle()].present(None) return self.db = db self.callback = callback @@ -102,7 +102,7 @@ class EditPerson: person.get_gender () == RelLib.Person.unknown) - for key in db.get_place_id_keys(): + for key in db.get_place_handle_keys(): p = db.get_place_display(key) self.pdmap[p[0]] = key @@ -201,8 +201,8 @@ class EditPerson: self.gallery_label = self.get_widget("gallery_label") self.lds_tab = self.get_widget("lds_tab") - self.orig_birth = self.db.find_event_from_id(person.get_birth_id()) - self.orig_death = self.db.find_event_from_id(person.get_death_id()) + self.orig_birth = self.db.find_event_from_handle(person.get_birth_handle()) + self.orig_death = self.db.find_event_from_handle(person.get_death_handle()) self.death = RelLib.Event(self.orig_death) self.birth = RelLib.Event(self.orig_birth) self.pname = RelLib.Name(person.get_primary_name()) @@ -498,8 +498,8 @@ class EditPerson: combo.entry.set_text("") build_dropdown(place,self.place_list) - if ord and ord.get_place_id(): - ord_place = self.db.try_to_find_place_from_id(ord.get_place_id()) + if ord and ord.get_place_handle(): + ord_place = self.db.try_to_find_place_from_handle(ord.get_place_handle()) place.set_text(ord_place.get_title()) return stat @@ -536,7 +536,7 @@ class EditPerson: self.ldsseal_date, self.ldssealplace) if self.lds_sealing: - self.ldsfam = self.lds_sealing.get_family_id() + self.ldsfam = self.lds_sealing.get_family_handle() else: self.ldsfam = None @@ -549,18 +549,18 @@ class EditPerson: index = 0 hist = 0 - flist = [self.person.get_main_parents_family_id()] - for (fam,mrel,frel) in self.person.get_parent_family_id_list(): + flist = [self.person.get_main_parents_family_handle()] + for (fam,mrel,frel) in self.person.get_parent_family_handle_list(): if fam not in flist: flist.append(fam) for fam_id in flist: - fam = self.db.find_family_from_id(fam_id) + fam = self.db.find_family_from_handle(fam_id) if fam == None: continue - f_id = fam.get_father_id() - m_id = fam.get_mother_id() - f = self.db.try_to_find_person_from_id(f_id) - m = self.db.try_to_find_person_from_id(m_id) + f_id = fam.get_father_handle() + m_id = fam.get_mother_handle() + f = self.db.try_to_find_person_from_handle(f_id) + m = self.db.try_to_find_person_from_handle(m_id) if f and m: name = _("%(father)s and %(mother)s") % { 'father' : GrampsCfg.get_nameof()(f), @@ -644,17 +644,17 @@ class EditPerson: exec 'person = "%s"' % data[1] if mytype != 'pevent': return - elif person == self.person.get_id(): + elif person == self.person.get_handle(): self.move_element(self.elist,self.etree.get_selected_row(),row) else: foo = pickle.loads(data[2]); for src in foo.get_source_references(): - base_id = src.get_base_id() - newbase = self.db.try_to_find_source_from_id(base_id) - src.set_base_id(newbase) - place = foo.get_place_id() + base_handle = src.get_base_handle() + newbase = self.db.try_to_find_source_from_handle(base_handle) + src.set_base_handle(newbase) + place = foo.get_place_handle() if place: - foo.set_place_id(place.get_id()) + foo.set_place_handle(place.get_handle()) self.elist.insert(row,foo) self.lists_changed = 1 @@ -672,7 +672,7 @@ class EditPerson: bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('pevent',self.person.get_id(),pickled)); + data = str(('pevent',self.person.get_handle(),pickled)); sel_data.set(sel_data.target, bits_per, data) def ev_drag_begin(self, context, a): @@ -693,7 +693,7 @@ class EditPerson: exec 'person = "%s"' % data[1] if mytype != "url": return - elif person == self.person.get_id(): + elif person == self.person.get_handle(): self.move_element(self.ulist,self.wtree.get_selected_row(),row) else: foo = pickle.loads(data[2]); @@ -710,7 +710,7 @@ class EditPerson: if len(ev): bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('url',self.person.get_id(),pickled)); + data = str(('url',self.person.get_handle(),pickled)); sel_data.set(sel_data.target, bits_per, data) def at_drag_data_received(self,widget,context,x,y,sel_data,info,time): @@ -722,14 +722,14 @@ class EditPerson: exec 'person = "%s"' % data[1] if mytype != 'pattr': return - elif person == self.person.get_id(): + elif person == self.person.get_handle(): self.move_element(self.alist,self.atree.get_selected_row(),row) else: foo = pickle.loads(data[2]); for src in foo.get_source_references(): - base_id = src.get_base_id() - newbase = self.db.try_to_find_source_from_id(base_id) - src.set_base_id(newbase) + base_handle = src.get_base_handle() + newbase = self.db.try_to_find_source_from_handle(base_handle) + src.set_base_handle(newbase) self.alist.append(foo) self.lists_changed = 1 self.redraw_attr_list() @@ -743,7 +743,7 @@ class EditPerson: if len(ev): bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('pattr',self.person.get_id(),pickled)); + data = str(('pattr',self.person.get_handle(),pickled)); sel_data.set(sel_data.target, bits_per, data) def ad_drag_data_received(self,widget,context,x,y,sel_data,info,time): @@ -755,14 +755,14 @@ class EditPerson: exec 'person = "%s"' % data[1] if mytype != 'paddr': return - elif person == self.person.get_id(): + elif person == self.person.get_handle(): self.move_element(self.plist,self.ptree.get_selected_row(),row) else: foo = pickle.loads(data[2]); for src in foo.get_source_references(): - base_id = src.get_base_id() - newbase = self.db.try_to_find_source_from_id(base_id) - src.set_base_id(newbase) + base_handle = src.get_base_handle() + newbase = self.db.try_to_find_source_from_handle(base_handle) + src.set_base_handle(newbase) self.plist.insert(row,foo) self.lists_changed = 1 @@ -774,7 +774,7 @@ class EditPerson: if len(ev): bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('paddr',self.person.get_id(),pickled)); + data = str(('paddr',self.person.get_handle(),pickled)); sel_data.set(sel_data.target, bits_per, data) def ad_drag_begin(self, context, a): @@ -881,8 +881,8 @@ class EditPerson: self.etree.clear() self.emap = {} - for event_id in self.elist: - event = self.db.find_event_from_id(event_id) + for event_handle in self.elist: + event = self.db.find_event_from_handle(event_handle) pname = place_title(self.db,event) iter = self.etree.add([const.display_pevent(event.get_name()),event.get_description(), event.get_quote_date(),pname],event) @@ -970,7 +970,7 @@ class EditPerson: p = self.get_place(self.bplace) if p: - event.set_place_id(p) + event.set_place_handle(p) EventEdit.EventEditor(self,pname,const.personalEvents, const.save_event,event,def_placename,1, self.event_edit_callback) @@ -988,7 +988,7 @@ class EditPerson: p = self.get_place(self.dplace) if p: - event.set_place_id(p) + event.set_place_handle(p) EventEdit.EventEditor(self,pname,const.personalEvents, const.save_event,event,def_placename,1, self.event_edit_callback) @@ -1119,20 +1119,20 @@ class EditPerson: dplace = unicode(string.strip(self.dplace.get_text())) if self.pdmap.has_key(bplace): - self.birth.set_place_id(self.pdmap[bplace]) + self.birth.set_place_handle(self.pdmap[bplace]) else: p1 = None if bplace != "": changed = 1 - self.birth.set_place_id('') + self.birth.set_place_handle('') if self.pdmap.has_key(dplace): - self.death.set_place_id(self.pdmap[dplace]) + self.death.set_place_handle(self.pdmap[dplace]) else: p1 = None if dplace != "": changed = 1 - self.death.set_place_id('') + self.death.set_place_handle('') if not self.birth.are_equal(self.orig_birth): changed = 1 @@ -1168,7 +1168,7 @@ class EditPerson: self.lds_baptism.set_temple(const.lds_temple_codes[temple]) else: self.lds_baptism.set_temple("") - self.lds_baptism.set_place_id(self.get_place(self.ldsbapplace,1)) + self.lds_baptism.set_place_handle(self.get_place(self.ldsbapplace,1)) self.lds_endowment.set_date(unicode(self.ldsend_date.get_text())) temple = unicode(self.ldsend_temple.entry.get_text()) @@ -1176,7 +1176,7 @@ class EditPerson: self.lds_endowment.set_temple(const.lds_temple_codes[temple]) else: self.lds_endowment.set_temple("") - self.lds_endowment.set_place_id(self.get_place(self.ldsendowplace,1)) + self.lds_endowment.set_place_handle(self.get_place(self.ldsendowplace,1)) self.lds_sealing.set_date(unicode(self.ldsseal_date.get_text())) temple = unicode(self.ldsseal_temple.entry.get_text()) @@ -1184,8 +1184,8 @@ class EditPerson: self.lds_sealing.set_temple(const.lds_temple_codes[temple]) else: self.lds_sealing.set_temple("") - self.lds_sealing.set_family_id(self.ldsfam) - self.lds_sealing.set_place_id(self.get_place(self.ldssealplace,1)) + self.lds_sealing.set_family_handle(self.ldsfam) + self.lds_sealing.set_place_handle(self.get_place(self.ldssealplace,1)) def on_event_delete_clicked(self,obj): """Delete the selected event""" @@ -1244,7 +1244,7 @@ class EditPerson: store,iter = obj.get_selected() if iter: row = store.get_path(iter) - event = self.db.find_event_from_id(self.elist[row[0]]) + event = self.db.find_event_from_handle(self.elist[row[0]]) self.event_date_field.set_text(event.get_date()) self.event_place_field.set_text(place_title(self.db,event)) self.event_name_field.set_text(const.display_pevent(event.get_name())) @@ -1252,8 +1252,8 @@ class EditPerson: self.event_descr_field.set_text(short(event.get_description())) if len(event.get_source_references()) > 0: psrc_ref = event.get_source_references()[0] - psrc_id = psrc_ref.get_base_id() - psrc = self.db.try_to_find_source_from_id(psrc_id) + psrc_id = psrc_ref.get_base_handle() + psrc = self.db.try_to_find_source_from_handle(psrc_id) self.event_src_field.set_text(short(psrc.get_title())) self.event_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()]) else: @@ -1285,8 +1285,8 @@ class EditPerson: self.addr_phone.set_text(addr.get_phone()) if len(addr.get_source_references()) > 0: psrc_ref = addr.get_source_references()[0] - psrc_id = psrc_ref.get_base_id() - psrc = self.db.try_to_find_source_from_id(psrc_id) + psrc_id = psrc_ref.get_base_handle() + psrc = self.db.try_to_find_source_from_handle(psrc_id) self.addr_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()]) self.addr_src_field.set_text(short(psrc.get_title())) else: @@ -1319,8 +1319,8 @@ class EditPerson: self.name_type_field.set_text(const.NameTypesMap.find_value(name.get_type())) if len(name.get_source_references()) > 0: psrc_ref = name.get_source_references()[0] - psrc_id = psrc_ref.get_base_id() - psrc = self.db.try_to_find_source_from_id(psrc_id) + psrc_id = psrc_ref.get_base_handle() + psrc = self.db.try_to_find_source_from_handle(psrc_id) self.name_src_field.set_text(short(psrc.get_title())) self.name_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()]) else: @@ -1366,8 +1366,8 @@ class EditPerson: self.attr_value.set_text(short(attr.get_value())) if len(attr.get_source_references()) > 0: psrc_ref = attr.get_source_references()[0] - psrc_id = psrc_ref.get_base_id() - psrc = self.db.try_to_find_source_from_id(psrc_id) + psrc_id = psrc_ref.get_base_handle() + psrc = self.db.try_to_find_source_from_handle(psrc_id) self.attr_src_field.set_text(short(psrc.get_title())) self.attr_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()]) else: @@ -1428,8 +1428,8 @@ class EditPerson: self.person.set_url_list(self.ulist) self.person.set_attribute_list(self.alist) self.person.set_address_list(self.plist) - self.person.set_birth_id(self.birth.get_id()) - self.person.set_death_id(self.death.get_id()) + self.person.set_birth_handle(self.birth.get_handle()) + self.person.set_death_handle(self.death.get_handle()) def on_apply_person_clicked(self,obj): @@ -1447,7 +1447,7 @@ class EditPerson: name = self.pname self.birth.set_date(unicode(self.bdate.get_text())) - self.birth.set_place_id(self.get_place(self.bplace,1)) + self.birth.set_place_handle(self.get_place(self.bplace,1)) if idval != self.person.get_gramps_id(): person = self.db.try_to_find_person_from_gramps_id(idval) @@ -1494,34 +1494,34 @@ class EditPerson: self.person.set_nick_name(nick) self.pdmap.clear() - for key in self.db.get_place_id_keys(): + for key in self.db.get_place_handle_keys(): p = self.db.get_place_display(key) self.pdmap[p[0]] = key if self.orig_birth == None: self.db.add_event(self.birth,trans) - self.person.set_birth_id(self.birth.get_id()) + self.person.set_birth_handle(self.birth.get_handle()) elif not self.orig_birth.are_equal(self.birth): self.db.commit_event(self.birth,trans) # Update each of the families child lists to reflect any # change in ordering due to the new birth date - family = self.person.get_main_parents_family_id() + family = self.person.get_main_parents_family_handle() if (family): f = self.db.find_family_no_map(family,trans) - new_order = self.reorder_child_list(self.person,f.get_child_id_list()) - f.set_child_id_list(new_order) - for (family, rel1, rel2) in self.person.get_parent_family_id_list(): + new_order = self.reorder_child_list(self.person,f.get_child_handle_list()) + f.set_child_handle_list(new_order) + for (family, rel1, rel2) in self.person.get_parent_family_handle_list(): f = self.db.find_family_no_map(family,trans) - new_order = self.reorder_child_list(self.person,f.get_child_id_list()) - f.set_child_id_list(new_order) + new_order = self.reorder_child_list(self.person,f.get_child_handle_list()) + f.set_child_handle_list(new_order) self.death.set_date(unicode(self.ddate.get_text())) - self.death.set_place_id(self.get_place(self.dplace,1)) + self.death.set_place_handle(self.get_place(self.dplace,1)) if self.orig_death == None: self.db.add_event(self.death,trans) - self.person.set_death_id(self.death.get_id()) + self.person.set_death_handle(self.death.get_handle()) elif not self.orig_death.are_equal(self.death): self.db.commit_event(self.death,trans) @@ -1531,37 +1531,37 @@ class EditPerson: error = 0 if male and self.person.get_gender() != RelLib.Person.male: self.person.set_gender(RelLib.Person.male) - for temp_family in self.person.get_family_id_list(): - if self.person == temp_family.get_mother_id(): - if temp_family.get_father_id() != None: + for temp_family in self.person.get_family_handle_list(): + if self.person == temp_family.get_mother_handle(): + if temp_family.get_father_handle() != None: error = 1 else: - temp_family.set_mother_id(None) - temp_family.set_father_id(self.person) + temp_family.set_mother_handle(None) + temp_family.set_father_handle(self.person) elif female and self.person.get_gender() != RelLib.Person.female: self.person.set_gender(RelLib.Person.female) - for temp_family in self.person.get_family_id_list(): - if self.person == temp_family.get_father_id(): - if temp_family.get_mother_id() != None: + for temp_family in self.person.get_family_handle_list(): + if self.person == temp_family.get_father_handle(): + if temp_family.get_mother_handle() != None: error = 1 else: - temp_family.set_father_id(None) - temp_family.set_mother_id(self.person) + temp_family.set_father_handle(None) + temp_family.set_mother_handle(self.person) elif unknown and self.person.get_gender() != RelLib.Person.unknown: self.person.set_gender(RelLib.Person.unknown) - for temp_family in self.person.get_family_id_list(): - if self.person == temp_family.get_father_id(): - if temp_family.get_mother_id() != None: + for temp_family in self.person.get_family_handle_list(): + if self.person == temp_family.get_father_handle(): + if temp_family.get_mother_handle() != None: error = 1 else: - temp_family.set_father_id(None) - temp_family.set_mother_id(self.person) - if self.person == temp_family.get_mother_id(): - if temp_family.get_father_id() != None: + temp_family.set_father_handle(None) + temp_family.set_mother_handle(self.person) + if self.person == temp_family.get_mother_handle(): + if temp_family.get_father_handle() != None: error = 1 else: - temp_family.set_mother_id(None) - temp_family.set_father_id(self.person) + temp_family.set_mother_handle(None) + temp_family.set_father_handle(self.person) if error == 1: msg2 = _("Problem changing the gender") @@ -1620,9 +1620,9 @@ class EditPerson: trans = self.db.start_transaction() self.db.add_place(place,trans) self.db.add_transaction(trans,_('Add Place (%s)' % text)) - self.pdmap[text] = place.get_id() + self.pdmap[text] = place.get_handle() self.add_places.append(place) - return place.get_id() + return place.get_handle() else: return '' else: @@ -1680,8 +1680,8 @@ class EditPerson: media_list = self.person.get_media_list() if media_list: ph = media_list[0] - object_id = ph.get_reference_id() - object = self.db.try_to_find_object_from_id(object_id) + object_handle = ph.get_reference_handle() + object = self.db.try_to_find_object_from_handle(object_handle) if self.load_obj != object.get_path(): if object.get_mime_type()[0:5] == "image": self.load_photo(object.get_path()) @@ -1756,10 +1756,10 @@ class EditPerson: inorder = 1 prev_date = "00000000" for i in range(len(list)): - child_id = list[i] - child = self.db.try_to_find_person_from_id(child_id) - if child.get_birth_id(): - event = self.db.find_event_from_id(child.get_birth_id()) + child_handle = list[i] + child = self.db.try_to_find_person_from_handle(child_handle) + if child.get_birth_handle(): + event = self.db.find_event_from_handle(child.get_birth_handle()) bday = event.get_date_object() child_date = Sort.build_sort_date(bday) else: @@ -1779,22 +1779,22 @@ class EditPerson: return(list) # Build the person's date string once - event_id = person.get_birth_id() - if event_id: - event = self.db.find_event_from_id(event_id) + event_handle = person.get_birth_handle() + if event_handle: + event = self.db.find_event_from_handle(event_handle) person_bday = Sort.build_sort_date(event.get_date_object()) else: person_bday = "99999999" # First, see if the person needs to be moved forward in the list - index = list.index(person.get_id()) + index = list.index(person.get_handle()) target = index for i in range(index-1, -1, -1): - other = self.db.try_to_find_person_from_id(list[i]) - event_id = other.get_birth_id() - if event_id: - event = self.db.find_event_from_id(event_id) + other = self.db.try_to_find_person_from_handle(list[i]) + event_handle = other.get_birth_handle() + if event_handle: + event = self.db.find_event_from_handle(event_handle) other_bday = Sort.build_sort_date(event.get_date_object()) if (other_bday == "99999999"): continue; @@ -1806,10 +1806,10 @@ class EditPerson: # Now try moving to a later position in the list if (target == index): for i in range(index, len(list)): - other = self.db.try_to_find_person_from_id(list[i]) - event_id = other.get_birth_id() - if event_id: - event = self.db.find_event_from_id(event_id) + other = self.db.try_to_find_person_from_handle(list[i]) + event_handle = other.get_birth_handle() + if event_handle: + event = self.db.find_event_from_handle(event_handle) other_bday = Sort.build_sort_date(event.get_date_object()) if (other_bday == "99999999"): continue; @@ -1820,8 +1820,8 @@ class EditPerson: # Actually need to move? Do it now. if (target != index): - list.remove(person.get_id()) - list.insert(target,person.get_id()) + list.remove(person.get_handle()) + list.insert(target,person.get_handle()) return list @@ -1832,9 +1832,9 @@ def short(val,size=60): return val def place_title(db,event): - pid = event.get_place_id() + pid = event.get_place_handle() if pid: - return db.try_to_find_place_from_id(pid).get_title() + return db.try_to_find_place_from_handle(pid).get_title() else: return u'' diff --git a/src/EditPlace.py b/src/EditPlace.py index 273b409af..0ea905f07 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -66,12 +66,12 @@ class EditPlace: def __init__(self,parent,place,func=None,parent_window=None): self.parent = parent - if place.get_id(): - if self.parent.child_windows.has_key(place.get_id()): - self.parent.child_windows[place.get_id()].present(None) + if place.get_handle(): + if self.parent.child_windows.has_key(place.get_handle()): + self.parent.child_windows[place.get_handle()].present(None) return else: - self.win_key = place.get_id() + self.win_key = place.get_handle() else: self.win_key = self self.place = place @@ -202,7 +202,7 @@ class EditPlace: self.top_window.get_widget('edit_src'), self.top_window.get_widget('del_src')) - if self.place.get_id() == "": + if self.place.get_handle() == "": self.top_window.get_widget("add_photo").set_sensitive(0) self.top_window.get_widget("delete_photo").set_sensitive(0) @@ -285,7 +285,7 @@ class EditPlace: exec 'data = %s' % sel_data.data exec 'mytype = "%s"' % data[0] exec 'place = "%s"' % data[1] - if place == self.place.get_id() or mytype != 'url': + if place == self.place.get_handle() or mytype != 'url': return foo = pickle.loads(data[2]); self.ulist.append(foo) @@ -297,7 +297,7 @@ class EditPlace: ev = self.web_model.get_selected_objects()[0] bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev); - data = str(('url',self.place.get_id(),pickled)); + data = str(('url',self.place.get_handle(),pickled)); sel_data.set(sel_data.target, bits_per, data) def update_lists(self): @@ -481,15 +481,15 @@ class EditPlace: msg = "" for key in self.db.get_person_keys(): p = self.db.get_person(key) - for event_id in [p.get_birth_id(), p.get_death_id()] + p.get_event_list(): - event = self.db.find_event_from_id(event_id) - if event and event.get_place_id() == self.place: + for event_handle in [p.get_birth_handle(), p.get_death_handle()] + p.get_event_list(): + event = self.db.find_event_from_handle(event_handle) + if event and event.get_place_handle() == self.place: pevent.append((p,event)) - for family_id in self.db.get_family_keys(): - f = self.db.find_family_from_id(family_id) - for event_id in f.get_event_list(): - event = self.db.find_event_from_id(event_id) - if event and event.get_place_id() == self.place: + for family_handle in self.db.get_family_keys(): + f = self.db.find_family_from_handle(family_handle) + for event_handle in f.get_event_list(): + event = self.db.find_event_from_handle(event_handle) + if event and event.get_place_handle() == self.place: fevent.append((f,event)) any = 0 @@ -500,7 +500,7 @@ class EditPlace: t = _("%s [%s]: event %s\n") for e in pevent: - msg = msg + ( t % (GrampsCfg.get_nameof()(e[0]),e[0].get_id(),_(e[1].get_name()))) + msg = msg + ( t % (GrampsCfg.get_nameof()(e[0]),e[0].get_handle(),_(e[1].get_name()))) if len(fevent) > 0: any = 1 @@ -509,8 +509,8 @@ class EditPlace: t = _("%s [%s]: event %s\n") for e in fevent: - father = e[0].get_father_id() - mother = e[0].get_mother_id() + father = e[0].get_father_handle() + mother = e[0].get_mother_handle() if father and mother: fname = _("%(father)s and %(mother)s") % { "father" : GrampsCfg.get_nameof()(father), @@ -520,7 +520,7 @@ class EditPlace: else: fname = "%s" % GrampsCfg.get_nameof()(mother) - msg = msg + ( t % (fname,e[0].get_id(),_(e[1].get_name()))) + msg = msg + ( t % (fname,e[0].get_handle(),_(e[1].get_name()))) self.refinfo.get_buffer().set_text(msg) if any: @@ -559,22 +559,22 @@ class DeletePlaceQuery: def query_response(self): trans = self.db.start_transaction() - self.db.remove_place(self.place.get_id(),trans) + self.db.remove_place(self.place.get_handle(),trans) for key in self.db.get_person_keys(): p = self.db.get_person(key) - for event_id in [p.get_birth_id(), p.get_death_id()] + p.get_event_list(): - event = self.db.find_event_from_id(event_id) - if event and event.get_place_id() == self.place.get_id(): - event.set_place_id(None) + for event_handle in [p.get_birth_handle(), p.get_death_handle()] + p.get_event_list(): + event = self.db.find_event_from_handle(event_handle) + if event and event.get_place_handle() == self.place.get_handle(): + event.set_place_handle(None) self.db.commit_event(event,trans) for fid in self.db.get_family_keys(): - f = self.db.find_family_from_id(fid) - for event_id in f.get_event_list(): - event = self.db.find_event_from_id(event_id) - if event and event.get_place_id() == self.place.get_id(): - event.set_place_id(None) + f = self.db.find_family_from_handle(fid) + for event_handle in f.get_event_list(): + event = self.db.find_event_from_handle(event_handle) + if event and event.get_place_handle() == self.place.get_handle(): + event.set_place_handle(None) self.db.commit_event(event,trans) self.db.add_transaction(trans,_("Delete Place (%s)") % self.place.get_title()) diff --git a/src/EditSource.py b/src/EditSource.py index 6a2a13c8c..dc2b1c8c1 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -54,11 +54,11 @@ class EditSource: self.db = db self.parent = parent if source: - if self.parent.child_windows.has_key(source.get_id()): - self.parent.child_windows[source.get_id()].present(None) + if self.parent.child_windows.has_key(source.get_handle()): + self.parent.child_windows[source.get_handle()].present(None) return else: - self.win_key = source.get_id() + self.win_key = source.get_handle() else: self.win_key = self self.child_windows = {} @@ -121,7 +121,7 @@ class EditSource: "on_sourceEditor_delete_event" : self.on_delete_event, }) - if self.source.get_id() == "": + if self.source.get_handle() == "": self.top_window.get_widget("edit_photo").set_sensitive(0) self.top_window.get_widget("delete_photo").set_sensitive(0) @@ -190,47 +190,47 @@ class EditSource: f_event_list = [] f_attr_list = [] p_list = [] - for key in self.db.get_place_id_keys(): - p = self.db.get_place_id(key) + for key in self.db.get_place_handle_keys(): + p = self.db.get_place_handle(key) name = p.get_title() for sref in p.get_source_references(): - if sref.get_base_id() == self.source.get_id(): + if sref.get_base_handle() == self.source.get_handle(): p_list.append(name) for key in self.db.get_person_keys(): p = self.db.get_person(key) name = GrampsCfg.get_nameof()(p) - for event_id in p.get_event_list() + [p.get_birth_id(), p.get_death_id()]: - if event_id: - event = self.db.find_event_from_id(event_id) + for event_handle in p.get_event_list() + [p.get_birth_handle(), p.get_death_handle()]: + if event_handle: + event = self.db.find_event_from_handle(event_handle) for sref in event.get_source_references(): - if sref.get_base_id() == self.source.get_id(): + if sref.get_base_handle() == self.source.get_handle(): p_event_list.append((name,event.get_name())) for v in p.get_attribute_list(): for sref in v.get_source_references(): - if sref.get_base_id() == self.source.get_id(): + if sref.get_base_handle() == self.source.get_handle(): p_attr_list.append((name,v.get_type())) for v in p.get_alternate_names() + [p.get_primary_name()]: for sref in v.get_source_references(): - if sref.get_base_id() == self.source.get_id(): + if sref.get_base_handle() == self.source.get_handle(): p_name_list.append((name,v.get_name())) for v in p.get_address_list(): for sref in v.get_source_references(): - if sref.get_base_id() == self.source.get_id(): + if sref.get_base_handle() == self.source.get_handle(): p_addr_list.append((name,v.get_street())) - for object_id in self.db.get_object_keys(): - object = self.db.try_to_find_object_from_id(object_id) + for object_handle in self.db.get_object_keys(): + object = self.db.try_to_find_object_from_handle(object_handle) name = object.get_description() for sref in object.get_source_references(): - if sref.get_base_id() == self.source.get_id(): + if sref.get_base_handle() == self.source.get_handle(): m_list.append(name) - for family_id in self.db.get_family_keys(): - family = self.db.find_family_from_id(family_id) - f_id = family.get_father_id() - m_id = family.get_mother_id() + for family_handle in self.db.get_family_keys(): + family = self.db.find_family_from_handle(family_handle) + f_id = family.get_father_handle() + m_id = family.get_mother_handle() if f_id: - f = self.db.try_to_find_person_from_id(f_id) + f = self.db.try_to_find_person_from_handle(f_id) if m_id: - m = self.db.try_to_find_person_from_id(m_id) + m = self.db.try_to_find_person_from_handle(m_id) if f_id and m_id: name = _("%(father)s and %(mother)s") % { "father" : GrampsCfg.get_nameof()(f), @@ -240,15 +240,15 @@ class EditSource: else: name = GrampsCfg.get_nameof()(m) for v_id in p.get_event_list(): - v = self.db.find_event_from_id(v_id) + v = self.db.find_event_from_handle(v_id) if not v: continue for sref in v.get_source_references(): - if sref.get_base_id() == self.source.get_id(): + if sref.get_base_handle() == self.source.get_handle(): f_event_list.append((name,v.get_name())) for v in p.get_attribute_list(): for sref in v.get_source_references(): - if sref.get_base_id() == self.source.get_id(): + if sref.get_base_handle() == self.source.get_handle(): f_attr_list.append((name,v.get_type())) slist = self.top_window.get_widget('slist') @@ -360,7 +360,7 @@ class DelSrcQuery: m = 0 l = [] for sref in object.get_source_references(): - if sref.get_base_id() != self.source.get_id(): + if sref.get_base_handle() != self.source.get_handle(): l.append(sref) else: m = 1 @@ -374,8 +374,8 @@ class DelSrcQuery: for key in self.db.get_person_keys(): commit = 0 p = self.db.get_person(key) - for v_id in p.get_event_list() + [p.get_birth_id(), p.get_death_id()]: - v = self.db.find_event_from_id(v_id) + for v_id in p.get_event_list() + [p.get_birth_handle(), p.get_death_handle()]: + v = self.db.find_event_from_handle(v_id) if v: commit += self.delete_source(v) @@ -392,9 +392,9 @@ class DelSrcQuery: for p_id in self.db.get_family_keys(): commit = 0 - p = self.db.find_family_from_id(p_id) + p = self.db.find_family_from_handle(p_id) for v_id in p.get_event_list(): - v = self.db.find_event_from_id(v_id) + v = self.db.find_event_from_handle(v_id) if v: commit += self.delete_source(v) @@ -404,15 +404,15 @@ class DelSrcQuery: self.db.commit_family(p,trans) for p_id in self.db.get_object_keys(): - p = self.db.try_to_find_object_from_id(p_id,trans) + p = self.db.try_to_find_object_from_handle(p_id,trans) if self.delete_source(p): self.db.commit_media_object(p,trans) - for key in self.db.get_place_id_keys(): - p = self.db.try_to_find_place_from_id(key) - if self.delete_source(self.db.try_to_find_place_from_id(key)): + for key in self.db.get_place_handle_keys(): + p = self.db.try_to_find_place_from_handle(key) + if self.delete_source(self.db.try_to_find_place_from_handle(key)): self.db.commit_place(p,trans) - self.db.remove_source_id(self.source.get_id(),trans) + self.db.remove_source_handle(self.source.get_handle(),trans) self.db.add_transaction(trans,_("Delete Source (%s)") % self.source.get_title()) self.update() diff --git a/src/EventEdit.py b/src/EventEdit.py index 5f8a3452a..0c55174e7 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -63,11 +63,11 @@ class EventEditor: self.parent = parent self.db = self.parent.db if event: - if self.parent.child_windows.has_key(event.get_id()): - self.parent.child_windows[event.get_id()].present(None) + if self.parent.child_windows.has_key(event.get_handle()): + self.parent.child_windows[event.get_handle()].present(None) return else: - self.win_key = event.get_id() + self.win_key = event.get_handle() else: self.win_key = self self.event = event @@ -87,7 +87,7 @@ class EventEditor: self.elist = values.keys() self.elist.sort() - for key in self.parent.db.get_place_id_keys(): + for key in self.parent.db.get_place_handle_keys(): p = self.parent.db.get_place_display(key) self.pmap[p[0]] = key @@ -170,11 +170,11 @@ class EventEditor: if (def_placename): self.place_field.set_text(def_placename) else: - place_id = event.get_place_id() - if not place_id: + place_handle = event.get_place_handle() + if not place_handle: place_name = u"" else: - place_name = self.db.try_to_find_place_from_id(place_id).get_title() + place_name = self.db.try_to_find_place_from_handle(place_handle).get_title() self.place_field.set_text(place_name) self.date_field.set_text(self.date.get_date()) @@ -295,7 +295,7 @@ class EventEditor: text = strip(unicode(field.get_text())) if text: if self.pmap.has_key(text): - return self.parent.db.find_event_from_id(self.pmap[text]) + return self.parent.db.find_event_from_handle(self.pmap[text]) else: return None else: @@ -328,7 +328,7 @@ class EventEditor: self.db.add_event(self.event,trans) self.event.set_source_reference_list(self.srcreflist) self.event.set_witness_list(self.witnesslist) - self.parent.elist.append(self.event.get_id()) + self.parent.elist.append(self.event.get_handle()) self.update_event(ename,self.date,eplace_obj,edesc,enote,eformat, epriv,ecause,trans) @@ -339,12 +339,12 @@ class EventEditor: def update_event(self,name,date,place,desc,note,format,priv,cause,trans): if place: - if self.event.get_place_id() != place.get_id(): - self.event.set_place_id(place.get_id()) + if self.event.get_place_handle() != place.get_handle(): + self.event.set_place_handle(place.get_handle()) self.parent.lists_changed = 1 else: - if self.event.get_place_id(): - self.event.set_place_id("") + if self.event.get_place_handle(): + self.event.set_place_handle("") self.parent.lists_changed = 1 if self.event.get_name() != self.trans(name): diff --git a/src/FamilyView.py b/src/FamilyView.py index 0a4266483..a51849603 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -505,7 +505,7 @@ class FamilyView: self.display_marriage(None) else: row = model.get_path(iter) - id = self.person.get_family_id_list()[row[0]] + id = self.person.get_family_handle_list()[row[0]] def build_spouse_menu(self,event): @@ -549,7 +549,7 @@ class FamilyView: def set_preferred_spouse(self,obj): if self.selected_spouse: - self.person.set_preferred_family_id(self.family) + self.person.set_preferred_family_handle(self.family) trans = self.parent.db.start_transaction() self.parent.db.commit_person(self.person,trans) n = self.person.get_primary_name().get_regular_name() @@ -631,26 +631,26 @@ class FamilyView: def new_spouse_after_edit(self,epo,trans): - if epo.person.get_id() == "": + if epo.person.get_handle() == "": self.parent.db.add_person(epo.person,trans) else: - self.parent.db.add_person_no_map(epo.person,epo.person.get_id(),trans) + self.parent.db.add_person_no_map(epo.person,epo.person.get_handle(),trans) self.family = self.parent.db.new_family(trans) self.parent.people_view.add_to_person_list(epo.person,0) - self.person.add_family_id(self.family.get_id()) - epo.person.add_family_id(self.family.get_id()) + self.person.add_family_handle(self.family.get_handle()) + epo.person.add_family_handle(self.family.get_handle()) self.parent.db.commit_person(epo.person,trans) self.parent.db.commit_person(self.person,trans) if self.person.get_gender() == RelLib.Person.male: - self.family.set_mother_id(epo.person.get_id()) - self.family.set_father_id(self.person.get_id()) + self.family.set_mother_handle(epo.person.get_handle()) + self.family.set_father_handle(self.person.get_handle()) else: - self.family.set_father_id(epo.person.get_id()) - self.family.set_mother_id(self.person.get_id()) + self.family.set_father_handle(epo.person.get_handle()) + self.family.set_mother_handle(self.person.get_handle()) self.parent.db.commit_family(self.family,trans) self.load_family(self.family) @@ -687,36 +687,36 @@ class FamilyView: def update_person_list(self,person): if not self.family: self.family = self.parent.db.new_family() - person.add_family_id(self.family.get_id()) + person.add_family_handle(self.family.get_handle()) if person.get_gender() == RelLib.Person.male: - self.family.set_father_id(person) + self.family.set_father_handle(person) else: - self.family.set_mother_id(person) + self.family.set_mother_handle(person) - self.family.add_child_id(person) - person.add_parent_family_id(self.family.get_id(),"Birth","Birth") + self.family.add_child_handle(person) + person.add_parent_family_handle(self.family.get_handle(),"Birth","Birth") self.parent.update_person_list(person) self.load_family(self.family) def new_child_after_edit(self,epo,trans): - if epo.person.get_id() == "": + if epo.person.get_handle() == "": self.parent.db.add_person(epo.person,trans) else: - self.parent.db.add_person_no_map(epo.person,epo.person.get_id(),trans) + self.parent.db.add_person_no_map(epo.person,epo.person.get_handle(),trans) self.parent.people_view.add_to_person_list(epo.person,0) if not self.family: self.family = self.parent.db.new_family() - self.person.add_family_id(self.family.get_id()) + self.person.add_family_handle(self.family.get_handle()) if self.person.get_gender() == RelLib.Person.male: - self.family.set_father_id(self.person.get_id()) + self.family.set_father_handle(self.person.get_handle()) else: - self.family.set_mother_id(self.person.get_id()) + self.family.set_mother_handle(self.person.get_handle()) - self.family.add_child_id(epo.person.get_id()) - epo.person.add_parent_family_id(self.family.get_id(),"Birth","Birth") + self.family.add_child_handle(epo.person.get_handle()) + epo.person.add_parent_family_handle(self.family.get_handle(),"Birth","Birth") self.parent.db.commit_person(epo.person,trans) self.parent.db.commit_family(self.family,trans) self.display_marriage(self.family) @@ -744,14 +744,14 @@ class FamilyView: trans = self.parent.db.start_transaction() - self.family.remove_child_id(child.get_id()) - child.remove_parent_family_id(self.family.get_id()) + self.family.remove_child_handle(child.get_handle()) + child.remove_parent_family_handle(self.family.get_handle()) - if len(self.family.get_child_id_list()) == 0: - if self.family.get_father_id() == None: - self.delete_family_from(self.family.get_mother_id()) - elif self.family.get_mother_id() == None: - self.delete_family_from(self.family.get_father_id()) + if len(self.family.get_child_handle_list()) == 0: + if self.family.get_father_handle() == None: + self.delete_family_from(self.family.get_mother_handle()) + elif self.family.get_mother_handle() == None: + self.delete_family_from(self.family.get_father_handle()) self.parent.db.commit_person(child,trans) self.parent.db.commit_family(self.family,trans) @@ -770,7 +770,7 @@ class FamilyView: 'remove the spouse from the database'), _('_Remove Spouse'), self.really_remove_spouse) - elif self.family and not self.family.get_child_id_list(): + elif self.family and not self.family.get_child_handle_list(): self.really_remove_spouse() def really_remove_spouse(self): @@ -778,26 +778,26 @@ class FamilyView: if self.person == None: return - if self.selected_spouse.get_id() == self.family.get_father_id(): - self.family.set_father_id(None) + if self.selected_spouse.get_handle() == self.family.get_father_handle(): + self.family.set_father_handle(None) else: - self.family.set_mother_id(None) + self.family.set_mother_handle(None) trans = self.parent.db.start_transaction() if self.selected_spouse: - self.selected_spouse.remove_family_id(self.family.get_id()) + self.selected_spouse.remove_family_handle(self.family.get_handle()) self.parent.db.commit_person(self.selected_spouse,trans) self.parent.db.commit_family(self.family,trans) - if len(self.family.get_child_id_list()) == 0: - self.person.remove_family_id(self.family.get_id()) + if len(self.family.get_child_handle_list()) == 0: + self.person.remove_family_handle(self.family.get_handle()) self.parent.db.commit_person(self.person,trans) - self.parent.db.delete_family(self.family.get_id(),trans) - if len(self.person.get_family_id_list()) > 0: - family_id = self.person.get_family_id_list()[0] - self.load_family(self.parent.db.find_family_from_id(family_id)) + self.parent.db.delete_family(self.family.get_handle(),trans) + if len(self.person.get_family_handle_list()) > 0: + family_handle = self.person.get_family_handle_list()[0] + self.load_family(self.parent.db.find_family_from_handle(family_handle)) else: self.load_family(self.family) else: @@ -805,7 +805,7 @@ class FamilyView: n = self.person.get_primary_name().get_regular_name() self.parent.db.add_transaction(trans,_("Remove Spouse (%s)") % n) - if len(self.person.get_family_id_list()) <= 1: + if len(self.person.get_family_handle_list()) <= 1: self.spouse_selection.set_mode(gtk.SELECTION_NONE) def spouse_swap(self,obj): @@ -822,23 +822,23 @@ class FamilyView: def change_families(self,person): if not person: return - plist = person.get_parent_family_id_list() + plist = person.get_parent_family_handle_list() if len(plist) == 0: return if len(plist) == 1: - family_id,m,r = plist[0] + family_handle,m,r = plist[0] else: model, iter = self.ap_selection.get_selected() path = model.get_path(iter) - family_id,m,r = plist[path[0]] - family = self.parent.db.find_family_from_id(family_id) + family_handle,m,r = plist[path[0]] + family = self.parent.db.find_family_from_handle(family_handle) - if family.get_father_id(): - person_id = family.get_father_id() + if family.get_father_handle(): + person_handle = family.get_father_handle() else: - person_id = family.get_mother_id() - person = self.parent.db.try_to_find_person_from_id(person_id) + person_handle = family.get_mother_handle() + person = self.parent.db.try_to_find_person_from_handle(person_handle) self.parent.change_active_person(person) n = person.get_primary_name().get_name() @@ -857,15 +857,15 @@ class FamilyView: def load_family(self,family=None): if self.parent.active_person: - id = self.parent.active_person.get_id() - self.person = self.parent.db.try_to_find_person_from_id(id) + id = self.parent.active_person.get_handle() + self.person = self.parent.db.try_to_find_person_from_handle(id) else: self.person = None self.clear() return - bd = self.parent.db.find_event_from_id(self.person.get_birth_id()) - dd = self.parent.db.find_event_from_id(self.person.get_death_id()) + bd = self.parent.db.find_event_from_handle(self.person.get_birth_handle()) + dd = self.parent.db.find_event_from_handle(self.person.get_death_handle()) if bd and dd: n = "%s [%s]\n\t%s %s\n\t%s %s " % (GrampsCfg.get_nameof()(self.person), @@ -894,7 +894,7 @@ class FamilyView: self.child_model.clear() self.sp_parents_model.clear() - splist = self.person.get_family_id_list() + splist = self.person.get_family_handle_list() if len(splist) > 1: self.spouse_selection.set_mode(gtk.SELECTION_SINGLE) @@ -908,16 +908,16 @@ class FamilyView: continue fm = self.parent.db.find_family_no_map(f,None) - if fm.get_father_id() == self.person.get_id(): - sp_id = fm.get_mother_id() + if fm.get_father_handle() == self.person.get_handle(): + sp_id = fm.get_mother_handle() else: - sp_id = fm.get_father_id() + sp_id = fm.get_father_handle() iter = self.spouse_model.append() flist[f] = iter if sp_id: - sp = self.parent.db.try_to_find_person_from_id(sp_id) + sp = self.parent.db.try_to_find_person_from_handle(sp_id) event = self.find_marriage(fm) if event: mdate = " - %s" % event.get_date() @@ -931,13 +931,13 @@ class FamilyView: else: self.spouse_model.set(iter,0,"%s\n" % _("")) - if family and family.get_id() in flist: + if family and family.get_handle() in flist: self.display_marriage(family) - iter = flist[family.get_id()] + iter = flist[family.get_handle()] self.spouse_selection.select_iter(iter) elif len(flist) > 0: fid = splist[0] - fam = self.parent.db.find_family_from_id(fid) + fam = self.parent.db.find_family_from_handle(fid) self.display_marriage(fam) iter = flist[fid] self.spouse_selection.select_iter(iter) @@ -947,9 +947,9 @@ class FamilyView: self.update_list(self.ap_parents_model,self.ap_parents,self.person) def find_marriage(self,family): - for event_id in family.get_event_list(): - if event_id: - event = self.parent.db.find_event_from_id(event_id) + for event_handle in family.get_event_list(): + if event_handle: + event = self.parent.db.find_event_from_handle(event_handle) if event.get_name() == "Marriage": return event return None @@ -958,14 +958,14 @@ class FamilyView: model.clear() sel = None selection = tree.get_selection() - list = person.get_parent_family_id_list() + list = person.get_parent_family_handle_list() for (f,mrel,frel) in list: - fam = self.parent.db.find_family_from_id(f) - father_id = fam.get_father_id() - mother_id = fam.get_mother_id() - f = self.parent.db.try_to_find_person_from_id(father_id) - m = self.parent.db.try_to_find_person_from_id(mother_id) + fam = self.parent.db.find_family_from_handle(f) + father_handle = fam.get_father_handle() + mother_handle = fam.get_mother_handle() + f = self.parent.db.try_to_find_person_from_handle(father_handle) + m = self.parent.db.try_to_find_person_from_handle(mother_handle) father = self.nameof(_("Father"),f,frel) mother = self.nameof(_("Mother"),m,mrel) @@ -990,9 +990,9 @@ class FamilyView: def delete_family_from(self,person): trans = self.parent.db.start_transaction() - person.remove_family_id(self.family.get_id(),trans) - self.parent.db.delete_family(self.family.get_id(),trans) - flist = self.person.get_family_id_list() + person.remove_family_handle(self.family.get_handle(),trans) + self.parent.db.delete_family(self.family.get_handle(),trans) + flist = self.person.get_family_handle_list() if len(flist) > 0: self.family = flist[0] else: @@ -1006,18 +1006,18 @@ class FamilyView: if not family: self.family = None return - self.family = self.parent.db.find_family_from_id(family.get_id()) + self.family = self.parent.db.find_family_from_handle(family.get_handle()) - if self.family.get_father_id() == self.person.get_id(): - sp_id = self.family.get_mother_id() + if self.family.get_father_handle() == self.person.get_handle(): + sp_id = self.family.get_mother_handle() if sp_id: - self.selected_spouse = self.parent.db.try_to_find_person_from_id(sp_id) + self.selected_spouse = self.parent.db.try_to_find_person_from_handle(sp_id) else: self.selected_spouse = None else: - sp_id = self.family.get_father_id() + sp_id = self.family.get_father_handle() if sp_id: - self.selected_spouse = self.parent.db.try_to_find_person_from_id(sp_id) + self.selected_spouse = self.parent.db.try_to_find_person_from_handle(sp_id) else: self.selected_spouse = None @@ -1027,36 +1027,36 @@ class FamilyView: i = 0 fiter = None - child_list = list(self.family.get_child_id_list()) + child_list = list(self.family.get_child_handle_list()) self.child_map = {} - for child_id in child_list: + for child_handle in child_list: status = _("Unknown") - child = self.parent.db.try_to_find_person_from_id(child_id) - for fam in child.get_parent_family_id_list(): - if fam[0] == self.family.get_id(): - if self.person == self.family.get_father_id(): + child = self.parent.db.try_to_find_person_from_handle(child_handle) + for fam in child.get_parent_family_handle_list(): + if fam[0] == self.family.get_handle(): + if self.person == self.family.get_father_handle(): status = "%s/%s" % (_(fam[2]),_(fam[1])) else: status = "%s/%s" % (_(fam[1]),_(fam[2])) iter = self.child_model.append() - self.child_map[iter] = child.get_id() + self.child_map[iter] = child.get_handle() if fiter == None: fiter = self.child_model.get_path(iter) - val = self.parent.db.get_person_display(child.get_id()) + val = self.parent.db.get_person_display(child.get_handle()) i += 1 - event = self.parent.db.find_event_from_id(val[3]) + event = self.parent.db.find_event_from_handle(val[3]) if event: dval = event.get_date() else: dval = u'' self.child_model.set(iter,0,i,1,val[0],2,val[1],3,val[2], - 4,dval,5,status,6,val[6],7,child.get_id()) + 4,dval,5,status,6,val[6],7,child.get_handle()) def build_parents_menu(self,family,event): """Builds the menu that allows editing operations on the child list""" @@ -1146,7 +1146,7 @@ class FamilyView: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.parent_editor(self.person,self.ap_selection) elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: - plist = self.person.get_parent_family_id_list() + plist = self.person.get_parent_family_handle_list() if len(plist) == 0: self.build_parents_nosel_menu(event) @@ -1167,7 +1167,7 @@ class FamilyView: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.parent_editor(self.selected_spouse,self.sp_selection) elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: - plist = self.selected_spouse.get_parent_family_id_list() + plist = self.selected_spouse.get_parent_family_handle_list() if len(plist) == 0: self.build_sp_parents_nosel_menu(event) return @@ -1187,7 +1187,7 @@ class FamilyView: self.parent_add(self.selected_spouse) def del_parents_clicked(self,obj): - if len(self.person.get_parent_family_id_list()) == 0: + if len(self.person.get_parent_family_handle_list()) == 0: return n = GrampsCfg.get_nameof()(self.person) QuestionDialog(_('Remove Parents of %s') % n, @@ -1202,7 +1202,7 @@ class FamilyView: self.parent_deleter(self.person,self.ap_selection) def del_sp_parents(self,obj): - if not self.selected_spouse or len(self.selected_spouse.get_parent_family_id_list()) == 0: + if not self.selected_spouse or len(self.selected_spouse.get_parent_family_handle_list()) == 0: return n = GrampsCfg.get_nameof()(self.selected_spouse) QuestionDialog(_('Remove Parents of %s') % n, @@ -1225,9 +1225,9 @@ class FamilyView: self.parent.change_active_person(child) self.load_family() else: - list = self.family.get_child_id_list() + list = self.family.get_child_handle_list() if len(list) == 1: - p = self.parent.db.try_to_find_person_from_id(list[0]) + p = self.parent.db.try_to_find_person_from_handle(list[0]) self.parent.change_active_person(p) self.load_family() @@ -1235,7 +1235,7 @@ class FamilyView: if not person: return - plist = person.get_parent_family_id_list() + plist = person.get_parent_family_handle_list() if len(plist) == 0: return @@ -1275,33 +1275,33 @@ class FamilyView: return trans = self.parent.db.start_transaction() - plist = person.get_parent_family_id_list() + plist = person.get_parent_family_handle_list() if len(plist) == 0: return if len(plist) == 1: - person.clear_parent_family_id_list() + person.clear_parent_family_handle_list() else: model, iter = selection.get_selected() if not iter: return row = model.get_path(iter) - family_id = person.get_parent_family_id_list()[row[0]][0] - person.remove_parent_family_id(family_id) - fam = self.parent.db.try_to_find_family_from_id(family_id) + family_handle = person.get_parent_family_handle_list()[row[0]][0] + person.remove_parent_family_handle(family_handle) + fam = self.parent.db.try_to_find_family_from_handle(family_handle) - if len(fam.get_child_id_list()) == 0: - father_id = fam.get_father_id() - mother_id = fam.get_mother_id() - if father_id == None and mother_id: - mother = self.parent.db.find_person_from_id(mother_id) - mother.remove_family_id(fam) + if len(fam.get_child_handle_list()) == 0: + father_handle = fam.get_father_handle() + mother_handle = fam.get_mother_handle() + if father_handle == None and mother_handle: + mother = self.parent.db.find_person_from_handle(mother_handle) + mother.remove_family_handle(fam) self.parent.db.commit_person(mother,trans) self.parent.db.delete_family(fam,trans) - elif mother_id == None and father_id: - father = self.parent.db.find_person_from_id(father_id) - father.remove_family_id(fam,trans) + elif mother_handle == None and father_handle: + father = self.parent.db.find_person_from_handle(father_handle) + father.remove_family_handle(fam,trans) self.parent.db.commit_person(father,trans) self.parent.db.delete_family(fam,trans) @@ -1314,7 +1314,7 @@ class FamilyView: def drag_data_received(self,widget,context,x,y,sel_data,info,time): path = self.child_list.get_path_at_pos(x,y) if path == None: - row = len(self.family.get_child_id_list()) + row = len(self.family.get_child_handle_list()) else: row = path[0][0] -1 @@ -1332,7 +1332,7 @@ class FamilyView: spath = s.get_path(i) src = spath[0] - list = self.family.get_child_id_list() + list = self.family.get_child_handle_list() obj = list[src] list.remove(obj) @@ -1342,7 +1342,7 @@ class FamilyView: WarningDialog(_("Attempt to Reorder Children Failed"), _("Children must be ordered by their birth dates.")) return - self.family.set_child_id_list(list) + self.family.set_child_handle_list(list) trans = self.parent.db.start_transaction() self.parent.db.commit_family(self.family,trans) self.parent.db.add_transaction(trans,_('Reorder children')) @@ -1362,8 +1362,8 @@ class FamilyView: pname = self.person.get_primary_name() return (pname.get_surname_prefix(),pname.get_surname()) elif self.family: - fid = self.family.get_father_id() - f = self.parent.db.get_family_from_id(fid) + fid = self.family.get_father_handle() + f = self.parent.db.get_family_from_handle(fid) if f: pname = f.get_primary_name() return (pname.get_surname_prefix(),pname.get_surname()) @@ -1374,8 +1374,8 @@ class FamilyView: def latin_american(self,val): if self.family: - father = self.family.get_father_id() - mother = self.family.get_mother_id() + father = self.family.get_father_handle() + mother = self.family.get_mother_handle() if not father or not mother: return ("","") fsn = father.get_primary_name().get_surname() @@ -1394,7 +1394,7 @@ class FamilyView: if self.person.get_gender() == RelLib.Person.male: fname = self.person.get_primary_name().get_first_name() elif self.family: - f = self.family.get_father_id() + f = self.family.get_father_handle() if f: fname = f.get_primary_name().get_first_name() if fname: @@ -1412,10 +1412,10 @@ class FamilyView: inorder = 1 prev_date = "00000000" for i in range(len(list)): - child_id = list[i] - child = self.parent.db.try_to_find_person_from_id(child_id) - birth_id = child.get_birth_id() - birth = self.parent.db.find_event_from_id(birth_id) + child_handle = list[i] + child = self.parent.db.try_to_find_person_from_handle(child_handle) + birth_handle = child.get_birth_handle() + birth = self.parent.db.find_event_from_handle(birth_handle) if not birth: continue bday = birth.get_date_object() diff --git a/src/Find.py b/src/Find.py index f176e523b..4b4b5258d 100644 --- a/src/Find.py +++ b/src/Find.py @@ -214,6 +214,6 @@ class FindMedia(FindBase): FindBase.__init__(self,task,_("Find Media Object"),db) self.list = [] for n in self.db.get_object_map().values(): - self.list.append((n.get_description(),n.get_id())) + self.list.append((n.get_description(),n.get_handle())) self.list.sort() diff --git a/src/GenericFilter.py b/src/GenericFilter.py index 696bef18c..e4c04f66e 100644 --- a/src/GenericFilter.py +++ b/src/GenericFilter.py @@ -167,24 +167,24 @@ class RelationshipPathBetween(Rule): if not first: map[p_id] = 1 - p = self.db.try_to_find_person_from_id(p_id) - for fam_id in p.get_family_id_list(): + p = self.db.try_to_find_person_from_handle(p_id) + for fam_id in p.get_family_handle_list(): if fam_id: - fam = self.db.find_family_from_id(fam_id) - for child_id in fam.get_child_id_list(): - if child_id: - self.desc_list(child_id,map,0) + fam = self.db.find_family_from_handle(fam_id) + for child_handle in fam.get_child_handle_list(): + if child_handle: + self.desc_list(child_handle,map,0) def apply_filter(self,rank,person,plist,pmap): if person == None: return plist.append(person) - pmap[person.get_id()] = rank + pmap[person.get_handle()] = rank - family = person.get_main_parents_family_id() + family = person.get_main_parents_family_handle() if family != None: - self.apply_filter(rank+1,family.get_father_id(),plist,pmap) - self.apply_filter(rank+1,family.get_mother_id(),plist,pmap) + self.apply_filter(rank+1,family.get_father_handle(),plist,pmap) + self.apply_filter(rank+1,family.get_mother_handle(),plist,pmap) def apply(self,db,p_id): self.db = db @@ -207,21 +207,21 @@ class RelationshipPathBetween(Rule): self.apply_filter(0,p1_id,firstList,firstMap) self.apply_filter(0,p2_id,secondList,secondMap) - for person_id in firstList: - if person_id in secondList: - new_rank = firstMap[person_id] + for person_handle in firstList: + if person_handle in secondList: + new_rank = firstMap[person_handle] if new_rank < rank: rank = new_rank - common = [ person_id ] + common = [ person_handle ] elif new_rank == rank: - common.append(person_id) + common.append(person_handle) path1 = { p1_id : 1} path2 = { p2_id : 1} - for person_id in common: + for person_handle in common: new_map = {} - self.desc_list(person_id,new_map,1) + self.desc_list(person_handle,new_map,1) self.get_intersection(path1,firstMap,new_map) self.get_intersection(path2,secondMap,new_map) @@ -279,7 +279,7 @@ class HasCompleteRecord(Rule): return _('Matches all people whose records are complete') def apply(self,db,p_id): - return db.try_to_find_person_from_id(p_id).get_complete() == 1 + return db.try_to_find_person_from_handle(p_id).get_complete() == 1 #------------------------------------------------------------------------- # @@ -301,7 +301,7 @@ class IsFemale(Rule): return _('Matches all females') def apply(self,db,p_id): - return db.try_to_find_person_from_id(p_id).get_gender() == RelLib.Person.female + return db.try_to_find_person_from_handle(p_id).get_gender() == RelLib.Person.female #------------------------------------------------------------------------- # @@ -349,12 +349,12 @@ class IsDescendantOf(Rule): if not first: self.map[p_id] = 1 - p = self.db.try_to_find_person_from_id(p_id) - for fam_id in p.get_family_id_list(): + p = self.db.try_to_find_person_from_handle(p_id) + for fam_id in p.get_family_handle_list(): if fam_id: - fam = self.db.find_family_from_id(fam_id) - for child_id in fam.get_child_id_list(): - self.init_list(child_id,0) + fam = self.db.find_family_from_handle(fam_id) + for child_handle in fam.get_child_handle_list(): + self.init_list(child_handle,0) #------------------------------------------------------------------------- # @@ -393,9 +393,9 @@ class IsDescendantOfFilterMatch(IsDescendantOf): if not self.init: self.init = 1 filter = MatchesFilter(self.list) - for person_id in db.get_person_keys(): - if filter.apply (db, person_id): - self.init_list (person_id, first) + for person_handle in db.get_person_keys(): + if filter.apply (db, person_handle): + self.init_list (person_handle, first) return self.map.has_key(p_id) #------------------------------------------------------------------------- @@ -440,11 +440,11 @@ class IsLessThanNthGenerationDescendantOf(Rule): if gen >= int(self.list[1]): return - p = self.db.try_to_find_person_from_id(p_id) - for fam_id in p.get_family_id_list(): - fam = self.db.find_family_from_id(fam_id) - for child_id in fam.get_child_id_list(): - self.init_list(child_id,gen+1) + p = self.db.try_to_find_person_from_handle(p_id) + for fam_id in p.get_family_handle_list(): + fam = self.db.find_family_from_handle(fam_id) + for child_handle in fam.get_child_handle_list(): + self.init_list(child_handle,gen+1) #------------------------------------------------------------------------- # @@ -486,11 +486,11 @@ class IsMoreThanNthGenerationDescendantOf(Rule): if gen >= int(self.list[1]): self.map[p_id] = 1 - p = self.db.try_to_find_person_from_id(p_id) - for fam_id in p.get_family_id_list(): - fam = self.db.find_family_from_id(fam_id) - for child_id in fam.get_child_id_list(): - self.init_list(child_id,gen+1) + p = self.db.try_to_find_person_from_handle(p_id) + for fam_id in p.get_family_handle_list(): + fam = self.db.find_family_from_handle(fam_id) + for child_handle in fam.get_child_handle_list(): + self.init_list(child_handle,gen+1) #------------------------------------------------------------------------- # @@ -524,17 +524,17 @@ class IsChildOfFilterMatch(Rule): if not self.init: self.init = 1 filter = MatchesFilter(self.list) - for person_id in db.get_person_keys(): - if filter.apply (db, person_id): - self.init_list (person_id) + for person_handle in db.get_person_keys(): + if filter.apply (db, person_handle): + self.init_list (person_handle) return self.map.has_key(p_id) def init_list(self,p_id): - p = self.db.try_to_find_person_from_id(p_id) - for fam_id in p.get_family_id_list(): - fam = self.db.find_family_from_id(fam_id) - for child_id in fam.get_child_id_list(): - self.map[child_id] = 1 + p = self.db.try_to_find_person_from_handle(p_id) + for fam_id in p.get_family_handle_list(): + fam = self.db.find_family_from_handle(fam_id) + for child_handle in fam.get_child_handle_list(): + self.map[child_handle] = 1 #------------------------------------------------------------------------- # @@ -568,20 +568,20 @@ class IsDescendantFamilyOf(Rule): self.map[p_id] = 1 return 1 - p = self.db.try_to_find_person_from_id(p_id) - for (f,r1,r2) in p.get_parent_family_id_list(): - family = self.db.find_family_from_id(f) - for person_id in [family.get_mother_id(),family.get_father_id()]: - if person_id: - if self.search(person_id,0): + p = self.db.try_to_find_person_from_handle(p_id) + for (f,r1,r2) in p.get_parent_family_handle_list(): + family = self.db.find_family_from_handle(f) + for person_handle in [family.get_mother_handle(),family.get_father_handle()]: + if person_handle: + if self.search(person_handle,0): return 1 if val: - for family_id in p.get_family_id_list(): - family = self.db.find_family_from_id(family_id) - if p_id == family.get_father_id(): - spouse_id = family.get_mother_id() + for family_handle in p.get_family_handle_list(): + family = self.db.find_family_from_handle(family_handle) + if p_id == family.get_father_handle(): + spouse_id = family.get_mother_handle() else: - spouse_id = family.get_father_id() + spouse_id = family.get_father_handle() if spouse_id: if self.search(spouse_id,0): return 1 @@ -633,12 +633,12 @@ class IsAncestorOf(Rule): if not first: self.map[p_id] = 1 - p = self.db.try_to_find_person_from_id(p_id) - fam_id = p.get_main_parents_family_id() + p = self.db.try_to_find_person_from_handle(p_id) + fam_id = p.get_main_parents_family_handle() if fam_id: - fam = self.db.find_family_from_id(fam_id) - f_id = fam.get_father_id() - m_id = fam.get_mother_id() + fam = self.db.find_family_from_handle(fam_id) + f_id = fam.get_father_handle() + m_id = fam.get_mother_handle() if f_id: self.init_ancestor_list(f_id,0) @@ -682,9 +682,9 @@ class IsAncestorOfFilterMatch(IsAncestorOf): if not self.init: self.init = 1 filter = MatchesFilter(self.list[0]) - for person_id in db.get_person_keys(): - if filter.apply (db, person_id): - self.init_ancestor_list (person_id,first) + for person_handle in db.get_person_keys(): + if filter.apply (db, person_handle): + self.init_ancestor_list (person_handle,first) return self.map.has_key(p_id) #------------------------------------------------------------------------- @@ -723,19 +723,19 @@ class IsLessThanNthGenerationAncestorOf(Rule): return self.map.has_key(p_id) def init_ancestor_list(self,p_id,gen): -# if self.map.has_key(p.get_id()) == 1: +# if self.map.has_key(p.get_handle()) == 1: # loop_error(self.orig,p) if gen: self.map[p_id] = 1 if gen >= int(self.list[1]): return - p = self.db.try_to_find_person_from_id(p_id) - fam_id = p.get_main_parents_family_id() + p = self.db.try_to_find_person_from_handle(p_id) + fam_id = p.get_main_parents_family_handle() if fam_id: - fam = self.db.find_family_from_id(fam_id) - f_id = fam.get_father_id() - m_id = fam.get_mother_id() + fam = self.db.find_family_from_handle(fam_id) + f_id = fam.get_father_handle() + m_id = fam.get_mother_handle() if f_id: self.init_ancestor_list(f_id,gen+1) @@ -778,17 +778,17 @@ class IsMoreThanNthGenerationAncestorOf(Rule): return self.map.has_key(p_id) def init_ancestor_list(self,p_id,gen): -# if self.map.has_key(p.get_id()) == 1: +# if self.map.has_key(p.get_handle()) == 1: # loop_error(self.orig,p) if gen >= int(self.list[1]): self.map[p_id] = 1 - p = self.db.try_to_find_person_from_id(p_id) - fam_id = p.get_main_parents_family_id() + p = self.db.try_to_find_person_from_handle(p_id) + fam_id = p.get_main_parents_family_handle() if fam_id: - fam = self.db.find_family_from_id(fam_id) - f_id = fam.get_father_id() - m_id = fam.get_mother_id() + fam = self.db.find_family_from_handle(fam_id) + f_id = fam.get_father_handle() + m_id = fam.get_mother_handle() if f_id: self.init_ancestor_list(f_id,gen+1) @@ -827,16 +827,16 @@ class IsParentOfFilterMatch(Rule): if not self.init: self.init = 1 filter = MatchesFilter(self.list) - for person_id in db.get_person_keys(): - if filter.apply (db, person_id): - self.init_list (person_id) + for person_handle in db.get_person_keys(): + if filter.apply (db, person_handle): + self.init_list (person_handle) return self.map.has_key(p_id) def init_list(self,p_id): - p = self.db.try_to_find_person_from_id(p_id) - for fam_id in p.get_main_parents_family_id(): - fam = self.db.find_family_from_id(fam_id) - for parent_id in [fam.get_father_id (), fam.get_mother_id ()]: + p = self.db.try_to_find_person_from_handle(p_id) + for fam_id in p.get_main_parents_family_handle(): + fam = self.db.find_family_from_handle(fam_id) + for parent_id in [fam.get_father_handle (), fam.get_mother_handle ()]: if parent_id: self.map[parent_id] = 1 @@ -937,7 +937,7 @@ class IsMale(Rule): return _('Matches all males') def apply(self,db,p_id): - return db.try_to_find_person_from_id(p_id).get_gender() == RelLib.Person.male + return db.try_to_find_person_from_handle(p_id).get_gender() == RelLib.Person.male #------------------------------------------------------------------------- # @@ -967,11 +967,11 @@ class HasEvent(Rule): return _('Event filters') def apply(self,db,p_id): - p = db.try_to_find_person_from_id(p_id) - for event_id in p.get_event_list(): - if not event_id: + p = db.try_to_find_person_from_handle(p_id) + for event_handle in p.get_event_list(): + if not event_handle: continue - event = db.find_event_from_id(event_id) + event = db.find_event_from_handle(event_handle) val = 1 if self.list[0] and event.get_name() != self.list[0]: val = 0 @@ -982,9 +982,9 @@ class HasEvent(Rule): if date_cmp(self.date,event.get_date_object()): val = 0 if self.list[2]: - pl_id = event.get_place_id() + pl_id = event.get_place_handle() if pl_id: - pl = db.try_to_find_place_from_id(pl_id) + pl = db.try_to_find_place_from_handle(pl_id) pn = pl.get_title() if string.find(pn.upper(),self.list[2].upper()) == -1: val = 0 @@ -1021,13 +1021,13 @@ class HasFamilyEvent(Rule): return _('Event filters') def apply(self,db,p_id): - p = db.try_to_find_person_from_id(p_id) - for f_id in p.get_family_id_list(): - f = db.find_family_from_id(f_id) - for event_id in f.get_event_list(): - if not event_id: + p = db.try_to_find_person_from_handle(p_id) + for f_id in p.get_family_handle_list(): + f = db.find_family_from_handle(f_id) + for event_handle in f.get_event_list(): + if not event_handle: continue - event = db.find_event_from_id(event_id) + event = db.find_event_from_handle(event_handle) val = 1 if self.list[0] and event.get_name() != self.list[0]: val = 0 @@ -1037,9 +1037,9 @@ class HasFamilyEvent(Rule): if self.date: if date_cmp(self.date,event.get_date_object()): val = 0 - pl_id = event.get_place_id() + pl_id = event.get_place_handle() if pl_id: - pl = db.try_to_find_place_from_id(pl_id) + pl = db.try_to_find_place_from_handle(pl_id) pn = pl.get_title() if self.list[2] and string.find(pn,self.list[2].upper()) == -1: val = 0 @@ -1071,13 +1071,13 @@ class HasRelationship(Rule): def apply(self,db,p_id): rel_type = 0 cnt = 0 - p = db.try_to_find_person_from_id(p_id) - num_rel = len(p.get_family_id_list()) + p = db.try_to_find_person_from_handle(p_id) + num_rel = len(p.get_family_handle_list()) # count children and look for a relationship type match - for f_id in p.get_family_id_list(): - f = db.find_family_from_id(f_id) - cnt = cnt + len(f.get_child_id_list()) + for f_id in p.get_family_handle_list(): + f = db.find_family_from_handle(f_id) + cnt = cnt + len(f.get_child_handle_list()) if self.list[1] and f.get_relationship() == self.list[1]: rel_type = 1 @@ -1133,20 +1133,20 @@ class HasBirth(Rule): return _('Event filters') def apply(self,db,p_id): - p = db.try_to_find_person_from_id(p_id) - event_id = p.get_birth_id() - if not event_id: + p = db.try_to_find_person_from_handle(p_id) + event_handle = p.get_birth_handle() + if not event_handle: return 0 - event = db.find_event_from_id(event_id) + event = db.find_event_from_handle(event_handle) ed = event.get_description().upper() if len(self.list) > 2 and string.find(ed,self.list[2].upper())==-1: return 0 if self.date: if date_cmp(self.date,event.get_date_object()) == 0: return 0 - pl_id = event.get_place_id() + pl_id = event.get_place_handle() if pl_id: - pl = db.try_to_find_place_from_id(pl_id) + pl = db.try_to_find_place_from_handle(pl_id) pn = pl.get_title() if len(self.list) > 1 and string.find(pn,self.list[1].upper()) == -1: return 0 @@ -1180,20 +1180,20 @@ class HasDeath(Rule): return _('Event filters') def apply(self,db,p_id): - p = db.try_to_find_person_from_id(p_id) - event_id = p.get_death_id() - if not event_id: + p = db.try_to_find_person_from_handle(p_id) + event_handle = p.get_death_handle() + if not event_handle: return 0 - event = db.find_event_from_id(event_id) + event = db.find_event_from_handle(event_handle) ed = event.get_description().upper() if self.list[2] and string.find(ed,self.list[2].upper())==-1: return 0 if self.date: if date_cmp(self.date,event.get_date_object()) == 0: return 0 - pl_id = event.get_place_id() + pl_id = event.get_place_handle() if pl_id: - pl = db.try_to_find_place_from_id(pl_id) + pl = db.try_to_find_place_from_handle(pl_id) pn = pl.get_title() if self.list[1] and string.find(pn,self.list[1].upper()) == -1: return 0 @@ -1213,7 +1213,7 @@ class HasAttribute(Rule): return 'Has the personal attribute' def apply(self,db,p_id): - p = db.try_to_find_person_from_id(p_id) + p = db.try_to_find_person_from_handle(p_id) for event in p.getAttributes(): if self.list[0] and event.get_type() != self.list[0]: return 0 @@ -1236,9 +1236,9 @@ class HasFamilyAttribute(Rule): return 'Has the family attribute' def apply(self,db,p_id): - p = db.try_to_find_person_from_id(p_id) - for f_id in p.get_family_id_list(): - f = db.find_family_from_id(f_id) + p = db.try_to_find_person_from_handle(p_id) + for f_id in p.get_family_handle_list(): + f = db.find_family_from_handle(f_id) for event in f.getAttributes(): val = 1 if self.list[0] and event.get_type() != self.list[0]: @@ -1274,7 +1274,7 @@ class HasNameOf(Rule): self.l = self.list[1] self.s = self.list[2] self.t = self.list[3] - p = db.try_to_find_person_from_id(p_id) + p = db.try_to_find_person_from_handle(p_id) for name in [p.get_primary_name()] + p.get_alternate_names(): val = 1 if self.f and string.find(name.get_first_name().upper(),self.f.upper()) == -1: @@ -1310,7 +1310,7 @@ class SearchName(Rule): def apply(self,db,p_id): self.f = self.list[0] - p = db.try_to_find_person_from_id(p_id) + p = db.try_to_find_person_from_handle(p_id) return self.f and string.find(p.get_primary_name().get_name().upper(),self.f.upper()) != -1 #------------------------------------------------------------------------- @@ -1357,10 +1357,10 @@ class IsSpouseOfFilterMatch(Rule): def apply(self,db,p_id): filter = MatchesFilter (self.list) - p = db.try_to_find_person_from_id(p_id) - for family_id in p.get_family_id_list (): - family = db.find_family_from_id(family_id) - for spouse_id in [family.get_father_id (), family.get_mother_id ()]: + p = db.try_to_find_person_from_handle(p_id) + for family_handle in p.get_family_handle_list (): + family = db.find_family_from_handle(family_handle) + for spouse_id in [family.get_father_handle (), family.get_mother_handle ()]: if not spouse_id: continue if spouse_id == p_id: diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index 29e24ba56..1a19ad486 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -220,11 +220,8 @@ def get_betawarn(): def save_betawarn(val): set_bool("/apps/gramps/behavior/betawarn",val) -def get_id_edit(): - return get_bool("/apps/gramps/behavior/id-edit") - -def save_id_edit(val): - set_bool("/apps/gramps/behavior/id-edit",val) +def get_index_visible(): + return client.get_bool("/apps/gramps/index-visible") def get_media_reference(): return get_bool("/apps/gramps/behavior/make-reference") @@ -708,6 +705,7 @@ class GrampsPreferences: def build(self): auto = self.top.get_widget("autoload") + index_vis = self.top.get_widget("show_child_id") auto.set_active(get_autoload()) auto.connect('toggled',lambda obj: save_autoload(obj.get_active())) @@ -733,6 +731,7 @@ class GrampsPreferences: cal = self.top.get_widget("calendar") cal.set_active(get_calendar()) + cal.connect('toggled',lambda obj: save_calendar(obj.get_active())) idedit = self.top.get_widget("gid_edit") diff --git a/src/GraphLayout.py b/src/GraphLayout.py index d8c6c7ae4..2fa5989de 100644 --- a/src/GraphLayout.py +++ b/src/GraphLayout.py @@ -22,10 +22,10 @@ class GraphLayout: - def __init__(self,database,plist,person_id): + def __init__(self,database,plist,person_handle): self.database = database self.plist = plist - self.person_id = person_id + self.person_handle = person_handle self.v = [] self.e = [] self.maxx = 0 @@ -41,37 +41,37 @@ class DescendLine(GraphLayout): def layout(self): self.elist = [(0,0)] - self.space_for(self.person_id) + self.space_for(self.person_handle) return (self.v,self.e[1:]) - def space_for(self,person_id,level=1.0,pos=1.0): + def space_for(self,person_handle,level=1.0,pos=1.0): last = self.elist[-1] self.elist.append((level,pos)) self.e.append((last[0],last[1],level,pos)) - self.v.append((person_id,level,pos)) + self.v.append((person_handle,level,pos)) if level > self.maxx: self.maxx = level if pos > self.maxy: self.maxy = pos - person = self.database.try_to_find_person_from_id(person_id) - for family_id in person.get_family_id_list(): - family = self.database.find_family_from_id(family_id) - for child_id in family.get_child_id_list(): - self.space_for(child_id,level+1.0,pos) - pos = pos + max(self.depth(child_id),1) + person = self.database.try_to_find_person_from_handle(person_handle) + for family_handle in person.get_family_handle_list(): + family = self.database.find_family_from_handle(family_handle) + for child_handle in family.get_child_handle_list(): + self.space_for(child_handle,level+1.0,pos) + pos = pos + max(self.depth(child_handle),1) if pos > self.maxy: self.maxy = pos self.elist.pop() - def depth(self,person_id,val=0): - person = self.database.try_to_find_person_from_id(person_id) - for family_id in person.get_family_id_list(): - family = self.database.find_family_from_id(family_id) - clist = family.get_child_id_list() + def depth(self,person_handle,val=0): + person = self.database.try_to_find_person_from_handle(person_handle) + for family_handle in person.get_family_handle_list(): + family = self.database.find_family_from_handle(family_handle) + clist = family.get_child_handle_list() val = val + len(clist) - for child_id in clist: - d = self.depth(child_id) + for child_handle in clist: + d = self.depth(child_handle) if d > 0: val = val + d - 1 #first child is always on the same return val #row as the parent, so subtract 1 diff --git a/src/ImageSelect.py b/src/ImageSelect.py index 981d8e92c..d671611a8 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -170,7 +170,7 @@ class ImageSelect: trans = self.db.start_transaction() for o_id in self.db.get_object_keys(): - o = self.db.try_to_find_object_from_id(o_id) + o = self.db.try_to_find_object_from_handle(o_id) if o.get_path() == filename: already_imported = o break @@ -180,7 +180,7 @@ class ImageSelect: if (already_imported): oref = RelLib.MediaRef() - oref.set_reference_id(already_imported.get_id()) + oref.set_reference_handle(already_imported.get_handle()) self.dataobj.add_media_reference(oref) self.add_thumbnail(oref) else: @@ -276,8 +276,8 @@ class Gallery(ImageSelect): def on_drag_begin(self,obj,context): if const.dnd_images: - id = self.sel_obj.get_reference_id() - obj = self.db.try_to_find_object_from_id(id) + id = self.sel_obj.get_reference_handle() + obj = self.db.try_to_find_object_from_handle(id) mtype = obj.get_mime_type() name = Utils.thumb_path(self.db.get_save_path(),obj) pix = gtk.gdk.pixbuf_new_from_file(name) @@ -365,13 +365,13 @@ class Gallery(ImageSelect): """Save the photo in the dataobj object. (Required function)""" self.db.add_object(photo,None) oref = RelLib.MediaRef() - oref.set_reference_id(photo.get_id()) + oref.set_reference_handle(photo.get_handle()) self.dataobj.add_media_reference(oref) def add_thumbnail(self, photo): """Scale the image and add it to the IconList.""" - oid = photo.get_reference_id() - object = self.db.try_to_find_object_from_id(oid) + oid = photo.get_reference_handle() + object = self.db.try_to_find_object_from_handle(oid) if self.canvas_list.has_key(oid): (grp,item,text,x,y) = self.canvas_list[oid] if x != self.cx or y != self.cy: @@ -481,7 +481,7 @@ class Gallery(ImageSelect): photo.set_description(root) self.savephoto(photo) if GrampsCfg.get_media_reference() == 0: - name = RelImage.import_media_object(name,self.path,photo.get_id()) + name = RelImage.import_media_object(name,self.path,photo.get_handle()) photo.set_path(name) self.parent.lists_changed = 1 if GrampsCfg.get_media_global(): @@ -503,10 +503,10 @@ class Gallery(ImageSelect): photo.set_path(tfile) self.db.add_object(photo,None) oref = RelLib.MediaRef() - oref.set_reference_id(photo.get_id()) + oref.set_reference_handle(photo.get_handle()) self.dataobj.add_media_reference(oref) try: - id = photo.get_id() + id = photo.get_handle() name = RelImage.import_media_object(tfile,self.path,id) photo.set_path(name) except: @@ -518,11 +518,11 @@ class Gallery(ImageSelect): GlobalMediaProperties(self.db,photo,None, self,self.parent_window) else: - if self.db.has_object_id(data.data): + if self.db.has_object_handle(data.data): icon_index = self.get_index(w,x,y) index = 0 for p in self.dataobj.get_media_list(): - if data.data == p.get_reference_id(): + if data.data == p.get_reference_handle(): if index == icon_index or icon_index == -1: return else: @@ -540,7 +540,7 @@ class Gallery(ImageSelect): return index = index + 1 oref = RelLib.MediaRef() - oref.set_reference_id(data.data) + oref.set_reference_handle(data.data) self.dataobj.add_media_reference(oref) self.add_thumbnail(oref) self.parent.lists_changed = 1 @@ -568,7 +568,7 @@ class Gallery(ImageSelect): if not object: return oref = RelLib.MediaRef() - oref.set_reference_id(object.get_id()) + oref.set_reference_handle(object.get_handle()) self.dataobj.add_media_reference(oref) self.add_thumbnail(oref) @@ -581,7 +581,7 @@ class Gallery(ImageSelect): if self.sel: (i,t,b,photo,oid) = self.p_map[self.sel] - val = self.canvas_list[photo.get_reference_id()] + val = self.canvas_list[photo.get_reference_handle()] val[0].hide() val[1].hide() val[2].hide() @@ -606,7 +606,7 @@ class Gallery(ImageSelect): menu = gtk.Menu() menu.set_title(_("Media Object")) - object = self.db.try_to_find_object_from_id(photo.get_reference_id()) + object = self.db.try_to_find_object_from_handle(photo.get_reference_handle()) mtype = object.get_mime_type() progname = GrampsMime.get_application(mtype) @@ -623,22 +623,22 @@ class Gallery(ImageSelect): def popup_view_photo(self, obj): """Open this picture in a picture viewer""" photo = obj.get_data('o') - Utils.view_photo(self.db.try_to_find_object_from_id(photo.get_reference_id())) + Utils.view_photo(self.db.try_to_find_object_from_handle(photo.get_reference_handle())) def popup_edit_photo(self, obj): """Open this picture in a picture editor""" photo = obj.get_data('o') if os.fork() == 0: - obj = self.db.try_to_find_object_from_id(photo.get_reference_id()) + obj = self.db.try_to_find_object_from_handle(photo.get_reference_handle()) os.execvp(const.editor,[const.editor, obj.get_path()]) def popup_convert_to_private(self, obj): """Copy this picture into gramps private database instead of leaving it as an external data object.""" photo = obj.get_data('o') - object = self.db.try_to_find_object_from_id(photo.get_reference_id()) + object = self.db.try_to_find_object_from_handle(photo.get_reference_handle()) name = RelImage.import_media_object(object.get_path(),self.path, - object.get_id()) + object.get_handle()) object.set_path(name) def popup_change_description(self, obj): @@ -667,7 +667,7 @@ class LocalMediaProperties: self.child_windows = {} self.photo = photo self.db = parent.db - self.object = self.db.try_to_find_object_from_id(photo.get_reference_id()) + self.object = self.db.try_to_find_object_from_handle(photo.get_reference_handle()) self.alist = photo.get_attribute_list()[:] self.lists_changed = 0 @@ -720,7 +720,7 @@ class LocalMediaProperties: self.pixmap.set_from_pixbuf(self.pix) self.change_dialog.get_widget("private").set_active(photo.get_privacy()) - self.change_dialog.get_widget("gid").set_text(self.object.get_id()) + self.change_dialog.get_widget("gid").set_text(self.object.get_handle()) self.change_dialog.get_widget("path").set_text(fname) @@ -885,11 +885,11 @@ class GlobalMediaProperties: def __init__(self,db,object,update,parent,parent_window=None): self.parent = parent if object: - if self.parent.parent.child_windows.has_key(object.get_id()): - self.parent.parent.child_windows[object.get_id()].present(None) + if self.parent.parent.child_windows.has_key(object.get_handle()): + self.parent.parent.child_windows[object.get_handle()].present(None) return else: - self.win_key = object.get_id() + self.win_key = object.get_handle() else: self.win_key = self self.child_windows = {} @@ -949,7 +949,7 @@ class GlobalMediaProperties: pb = gtk.gdk.pixbuf_new_from_file(Utils.thumb_path(self.path,self.object)) self.pixmap.set_from_pixbuf(pb) - self.change_dialog.get_widget("gid").set_text(self.object.get_id()) + self.change_dialog.get_widget("gid").set_text(self.object.get_handle()) self.makelocal = self.change_dialog.get_widget("makelocal") self.update_info() @@ -1067,26 +1067,26 @@ class GlobalMediaProperties: for key in self.db.get_person_keys(): p = self.db.get_person(key) for o in p.get_media_list(): - if o.get_reference_id() == self.object.get_id(): - self.refmodel.add([_("Person"),p.get_id(),GrampsCfg.get_nameof()(p)]) + if o.get_reference_handle() == self.object.get_handle(): + self.refmodel.add([_("Person"),p.get_handle(),GrampsCfg.get_nameof()(p)]) any = 1 for key in self.db.get_family_keys(): - p = self.db.find_family_from_id(key) + p = self.db.find_family_from_handle(key) for o in p.get_media_list(): - if o.get_reference_id() == self.object.get_id(): - self.refmodel.add([_("Family"),p.get_id(),Utils.family_name(p,self.db)]) + if o.get_reference_handle() == self.object.get_handle(): + self.refmodel.add([_("Family"),p.get_handle(),Utils.family_name(p,self.db)]) any = 1 for key in self.db.get_source_keys(): - p = self.db.try_to_find_source_from_id(key) + p = self.db.try_to_find_source_from_handle(key) for o in p.get_media_list(): - if o.get_reference_id() == self.object.get_id(): - self.refmodel.add([_("Source"),p.get_id(),p.get_title()]) + if o.get_reference_handle() == self.object.get_handle(): + self.refmodel.add([_("Source"),p.get_handle(),p.get_title()]) any = 1 - for key in self.db.get_place_id_keys(): - p = self.db.try_to_find_place_from_id(key) + for key in self.db.get_place_handle_keys(): + p = self.db.try_to_find_place_from_handle(key) for o in p.get_media_list(): - if o.get_reference_id() == self.object.get_id(): - self.refmodel.add([_("Place"),p.get_id(),p.get_title()]) + if o.get_reference_handle() == self.object.get_handle(): + self.refmodel.add([_("Place"),p.get_handle(),p.get_title()]) any = 1 if any: Utils.bold_label(self.refs_label) @@ -1182,7 +1182,7 @@ class DeleteMediaQuery: nl = [] change = 0 for photo in p.get_media_list(): - if photo.get_reference_id() != self.media.get_id(): + if photo.get_reference_handle() != self.media.get_handle(): nl.append(photo) else: change = 1 @@ -1191,11 +1191,11 @@ class DeleteMediaQuery: self.db.commit_person(p,trans) for fid in self.db.get_family_keys(): - p = self.db.find_family_from_id(fid) + p = self.db.find_family_from_handle(fid) nl = [] change = 0 for photo in p.get_media_list(): - if photo.get_reference_id() != self.media.get_id(): + if photo.get_reference_handle() != self.media.get_handle(): nl.append(photo) else: change = 1 @@ -1204,11 +1204,11 @@ class DeleteMediaQuery: self.db.commit_family(p,trans) for key in self.db.get_source_keys(): - sid = self.db.try_to_find_source_from_id(key) + sid = self.db.try_to_find_source_from_handle(key) nl = [] change = 0 for photo in p.get_media_list(): - if photo.get_reference_id() != self.media.get_id(): + if photo.get_reference_handle() != self.media.get_handle(): nl.append(photo) else: change = 1 @@ -1216,12 +1216,12 @@ class DeleteMediaQuery: p.set_media_list(nl) self.db.commit_source(p,trans) - for key in self.db.get_place_id_keys(): - p = self.db.try_to_find_place_from_id(key) + for key in self.db.get_place_handle_keys(): + p = self.db.try_to_find_place_from_handle(key) nl = [] change = 0 for photo in p.get_media_list(): - if photo.get_reference_id() != self.media.get_id(): + if photo.get_reference_handle() != self.media.get_handle(): nl.append(photo) else: change = 1 @@ -1229,7 +1229,7 @@ class DeleteMediaQuery: p.set_media_list(nl) self.db.commit_place(p,trans) - self.db.remove_object(self.media.get_id(),trans) + self.db.remove_object(self.media.get_handle(),trans) self.db.add_transaction(trans,_("Remove Media Object")) if self.update: self.update() diff --git a/src/Makefile.in b/src/Makefile.in index 36ec42754..155485bc7 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -73,6 +73,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ @@ -229,7 +233,8 @@ gdir_PYTHON = \ Witness.py\ WriteXML.py\ SelectPerson.py\ - ArgHandler.py + ArgHandler.py\ + Exporter.py # Could use GNU make's ':=' syntax for nice wildcard use. diff --git a/src/Marriage.py b/src/Marriage.py index 4e363433e..e41d58829 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -73,8 +73,8 @@ class Marriage: """Initializes the Marriage class, and displays the window""" self.family = family self.parent = parent - if self.parent.child_windows.has_key(family.get_id()): - self.parent.child_windows[family.get_id()].present(None) + if self.parent.child_windows.has_key(family.get_handle()): + self.parent.child_windows[family.get_handle()].present(None) return self.child_windows = {} self.db = db @@ -88,7 +88,7 @@ class Marriage: else: self.srcreflist = [] - for key in db.get_place_id_keys(): + for key in db.get_place_handle_keys(): p = db.get_place_display(key) self.pmap[p[0]] = key @@ -128,16 +128,16 @@ class Marriage: }) - fid = family.get_father_id() - mid = family.get_mother_id() + fid = family.get_father_handle() + mid = family.get_mother_handle() if fid: - father = self.db.try_to_find_person_from_id(family.get_father_id()) + father = self.db.try_to_find_person_from_handle(family.get_father_handle()) else: father = None if mid: - mother = self.db.try_to_find_person_from_id(family.get_mother_id()) + mother = self.db.try_to_find_person_from_handle(family.get_mother_handle()) else: mother = None @@ -201,8 +201,8 @@ class Marriage: self.type_field.set_popdown_strings(const.familyRelations) frel = const.display_frel(family.get_relationship()) self.type_field.entry.set_text(frel) - self.gid.set_text(family.get_id()) - self.gid.set_editable(GrampsCfg.get_id_edit()) + self.gid.set_text(family.get_handle()) + self.gid.set_editable(1) self.lds_temple.set_popdown_strings(_temple_names) @@ -212,8 +212,8 @@ class Marriage: ord = self.family.get_lds_sealing() if ord: - if ord.get_place_id(): - self.lds_place.entry.set_text(ord.get_place_id().get_title()) + if ord.get_place_handle(): + self.lds_place.entry.set_text(ord.get_place_handle().get_title()) self.lds_date.set_text(ord.get_date()) if ord.get_temple() != "": name = const.lds_temple_to_abrev[ord.get_temple()] @@ -281,7 +281,7 @@ class Marriage: self.window.destroy() def add_itself_to_winsmenu(self): - self.parent.child_windows[self.family.get_id()] = self + self.parent.child_windows[self.family.get_handle()] = self win_menu_label = self.title if not win_menu_label.strip(): win_menu_label = _("New Relationship") @@ -296,7 +296,7 @@ class Marriage: self.winsmenu.append(self.menu_item) def remove_itself_from_winsmenu(self): - del self.parent.child_windows[self.family.get_id()] + del self.parent.child_windows[self.family.get_handle()] self.menu_item.destroy() self.winsmenu.destroy() self.win_menu_item.destroy() @@ -387,17 +387,17 @@ class Marriage: exec 'family = "%s"' % data[1] if mytype != 'fevent': return - elif family == self.family.get_id(): + elif family == self.family.get_handle(): self.move_element(self.elist,self.etree.get_selected_row(),row) else: foo = pickle.loads(data[2]); for src in foo.get_source_references(): - base_id = src.get_base_id() - newbase = self.db.try_to_find_source_from_id(base_id) - src.set_base_id(newbase) - place = foo.get_place_id() + base_handle = src.get_base_handle() + newbase = self.db.try_to_find_source_from_handle(base_handle) + src.set_base_handle(newbase) + place = foo.get_place_handle() if place: - foo.set_place_id(self.db.try_to_find_place_from_id(place.get_id())) + foo.set_place_handle(self.db.try_to_find_place_from_handle(place.get_handle())) self.elist.insert(row,foo) self.lists_changed = 1 @@ -408,7 +408,7 @@ class Marriage: bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('fevent',self.family.get_id(),pickled)); + data = str(('fevent',self.family.get_handle(),pickled)); selection_data.set(selection_data.target, bits_per, data) def at_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time): @@ -419,14 +419,14 @@ class Marriage: exec 'family = "%s"' % data[1] if mytype != 'fevent': return - elif family == self.family.get_id(): + elif family == self.family.get_handle(): self.move_element(self.elist,self.etree.get_selected_row(),row) else: foo = pickle.loads(data[2]); for src in foo.get_source_references(): - base_id = src.get_base_id() - newbase = self.db.try_to_find_source_from_id(base_id) - src.set_base_id(newbase) + base_handle = src.get_base_handle() + newbase = self.db.try_to_find_source_from_handle(base_handle) + src.set_base_handle(newbase) self.alist.insert(row,foo) self.lists_changed = 1 @@ -437,7 +437,7 @@ class Marriage: bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('fattr',self.family.get_id(),pickled)); + data = str(('fattr',self.family.get_handle(),pickled)); selection_data.set(selection_data.target, bits_per, data) def update_lists(self): @@ -464,14 +464,14 @@ class Marriage: def redraw_event_list(self): self.etree.clear() self.emap = {} - for event_id in self.elist: - event = self.db.find_event_from_id(event_id) + for event_handle in self.elist: + event = self.db.find_event_from_handle(event_handle) if not event: continue - place_id = event.get_place_id() + place_handle = event.get_place_handle() - if place_id: - place_name = self.db.try_to_find_place_from_id(place_id).get_title() + if place_handle: + place_name = self.db.try_to_find_place_from_handle(place_handle).get_title() else: place_name = "" iter = self.etree.add([const.display_fevent(event.get_name()), @@ -508,7 +508,7 @@ class Marriage: changed = 1 idval = unicode(self.gid.get_text()) - if self.family.get_id() != idval: + if self.family.get_handle() != idval: changed = 1 date = unicode(self.lds_date.get_text()) @@ -529,7 +529,7 @@ class Marriage: d.set(date) if Date.compare_dates(d,ord.get_date_object()) != 0 or \ ord.get_temple() != temple or \ - (place and ord.get_place_id() != place.get_id()) or \ + (place and ord.get_place_handle() != place.get_handle()) or \ ord.get_status() != self.seal_stat: changed = 1 @@ -560,19 +560,19 @@ class Marriage: idval = unicode(self.gid.get_text()) family = self.family - if idval != family.get_id(): - if not self.db.has_family_id(idval): - if self.db.has_family_id(family.get_id()): - self.db.remove_family_id(family.get_id(),trans) - family.set_id(idval) + if idval != family.get_handle(): + if not self.db.has_family_handle(idval): + if self.db.has_family_handle(family.get_handle()): + self.db.remove_family_handle(family.get_handle(),trans) + family.set_handle(idval) else: WarningDialog(_("GRAMPS ID value was not changed."), _('The GRAMPS ID that you chose for this ' 'relationship is already being used.')) relation = unicode(self.type_field.entry.get_text()) - father = self.family.get_father_id() - mother = self.family.get_mother_id() + father = self.family.get_father_handle() + mother = self.family.get_mother_handle() if father and mother: if const.save_frel(relation) != self.family.get_relationship(): if father.get_gender() == mother.get_gender(): @@ -583,8 +583,8 @@ class Marriage: val = "Unknown" if father.get_gender() == RelLib.Person.female or \ mother.get_gender() == RelLib.Person.male: - self.family.set_father_id(mother) - self.family.set_mother_id(father) + self.family.set_father_handle(mother) + self.family.set_mother_handle(father) self.family.set_relationship(val) text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), @@ -614,7 +614,7 @@ class Marriage: ord.set_date(date) ord.set_temple(temple) ord.set_status(self.seal_stat) - ord.set_place_id(place) + ord.set_place_handle(place) self.family.set_lds_sealing(ord) else: d = Date.Date() @@ -625,8 +625,8 @@ class Marriage: ord.set_temple(temple) if ord.get_status() != self.seal_stat: ord.set_status(self.seal_stat) - if ord.get_place_id() != place.get_id(): - ord.set_place_id(place.get_id()) + if ord.get_place_handle() != place.get_handle(): + ord.set_place_handle(place.get_handle()) if self.lists_changed: self.family.set_source_reference_list(self.srcreflist) @@ -676,9 +676,9 @@ class Marriage: event = self.etree.get_object(iter) self.date_field.set_text(event.get_date()) - place_id = event.get_place_id() - if place_id: - place_name = self.db.try_to_find_place_from_id(place_id).get_title() + place_handle = event.get_place_handle() + if place_handle: + place_name = self.db.try_to_find_place_from_handle(place_handle).get_title() else: place_name = u"" self.place_field.set_text(place_name) @@ -686,8 +686,8 @@ class Marriage: self.name_field.set_label(const.display_fevent(event.get_name())) if len(event.get_source_references()) > 0: psrc_ref = event.get_source_references()[0] - psrc_id = psrc_ref.get_base_id() - psrc = self.db.try_to_find_source_from_id(psrc_id) + psrc_id = psrc_ref.get_base_handle() + psrc = self.db.try_to_find_source_from_handle(psrc_id) self.event_src_field.set_text(psrc.get_title()) self.event_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()]) else: @@ -705,8 +705,8 @@ class Marriage: self.attr_value.set_text(attr.get_value()) if len(attr.get_source_references()) > 0: psrc_ref = attr.get_source_references()[0] - psrc_id = psrc_ref.get_base_id() - psrc = self.db.try_to_find_source_from_id(psrc_id) + psrc_id = psrc_ref.get_base_handle() + psrc = self.db.try_to_find_source_from_handle(psrc_id) self.attr_src_field.set_text(psrc.get_title()) self.attr_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()]) else: @@ -721,10 +721,10 @@ class Marriage: attr = self.atree.get_object(iter) - father_id = self.family.get_father_id() - mother_id = self.family.get_mother_id() - father = self.db.try_to_find_person_from_id(father_id) - mother = self.db.try_to_find_person_from_id(mother_id) + father_handle = self.family.get_father_handle() + mother_handle = self.family.get_mother_handle() + father = self.db.try_to_find_person_from_handle(father_handle) + mother = self.db.try_to_find_person_from_handle(mother_handle) if father and mother: name = _("%s and %s") % (father.get_primary_name().get_name(), mother.get_primary_name().get_name()) @@ -742,10 +742,10 @@ class Marriage: def on_add_attr_clicked(self,obj): import AttrEdit - father_id = self.family.get_father_id() - mother_id = self.family.get_mother_id() - father = self.db.try_to_find_person_from_id(father_id) - mother = self.db.try_to_find_person_from_id(mother_id) + father_handle = self.family.get_father_handle() + mother_handle = self.family.get_mother_handle() + father = self.db.try_to_find_person_from_handle(father_handle) + mother = self.db.try_to_find_person_from_handle(mother_handle) if father and mother: name = _("%s and %s") % (father.get_primary_name().get_name(), mother.get_primary_name().get_name()) @@ -788,12 +788,12 @@ class Marriage: text = string.strip(unicode(field.get_text())) if text: if self.pmap.has_key(text): - return self.db.try_to_find_place_from_id(self.pmap[text]) + return self.db.try_to_find_place_from_handle(self.pmap[text]) elif makenew: place = RelLib.Place() place.set_title(text) self.db.add_place(place,trans) - self.pmap[text] = place.get_id() + self.pmap[text] = place.get_handle() return place else: return None diff --git a/src/MediaView.py b/src/MediaView.py index a2e26f890..16166e0e0 100644 --- a/src/MediaView.py +++ b/src/MediaView.py @@ -178,7 +178,7 @@ class MediaView: id = store.get_value(iter,1) - mobj = self.db.try_to_find_object_from_id(id) + mobj = self.db.try_to_find_object_from_handle(id) type = mobj.get_mime_type() type_name = Utils.get_mime_description(type) path = mobj.get_path() @@ -192,7 +192,7 @@ class MediaView: if not pexists: fexists = 0 - self.mid.set_text(mobj.get_id()) + self.mid.set_text(mobj.get_handle()) self.mtype.set_text(type_name) self.mdesc.set_text(mobj.get_description()) if len(path) == 0 or fexists == 0: @@ -226,7 +226,7 @@ class MediaView: store,iter = self.selection.get_selected() if iter: id = store.get_value(iter,1) - object = self.db.try_to_find_object_from_id(id) + object = self.db.try_to_find_object_from_handle(id) self.obj = object mime_type = object.get_mime_type() @@ -267,7 +267,7 @@ class MediaView: def popup_convert_to_private(self, obj): path = self.db.get_save_path() - id = self.obj.get_id() + id = self.obj.get_handle() name = RelImage.import_media_object(self.obj.get_path(),path,id) if name: self.obj.set_path(name) @@ -292,7 +292,7 @@ class MediaView: list_store, iter = self.selection.get_selected() if iter: id = list_store.get_value(iter,1) - object = self.db.try_to_find_object_from_id(id) + object = self.db.try_to_find_object_from_handle(id) ImageSelect.GlobalMediaProperties(self.db,object,self.load_media, self,self.topWindow) @@ -302,7 +302,7 @@ class MediaView: return id = store.get_value(iter,1) - mobj = self.db.try_to_find_object_from_id(id) + mobj = self.db.try_to_find_object_from_handle(id) if self.is_object_used(mobj): ans = ImageSelect.DeleteMediaQuery(mobj,self.db,self.build_tree) QuestionDialog(_('Delete Media Object?'), @@ -314,30 +314,30 @@ class MediaView: ans.query_response) else: trans = self.db.start_transaction() - self.db.remove_object(mobj.get_id(),trans) + self.db.remove_object(mobj.get_handle(),trans) self.db.add_transaction(trans,_("Remove Media Object")) self.build_tree() def is_object_used(self,mobj): - for family_id in self.db.get_family_keys(): - p = self.db.find_family_from_id(family_id) + for family_handle in self.db.get_family_keys(): + p = self.db.find_family_from_handle(family_handle) for o in p.get_media_list(): - if o.get_reference_id() == mobj.get_id(): + if o.get_reference_handle() == mobj.get_handle(): return 1 for key in self.db.get_person_keys(): p = self.db.get_person(key) for o in p.get_media_list(): - if o.get_reference_id() == mobj.get_id(): + if o.get_reference_handle() == mobj.get_handle(): return 1 for key in self.db.get_source_keys(): p = self.db.get_source(key) for o in p.get_media_list(): - if o.get_reference_id() == mobj.get_id(): + if o.get_reference_handle() == mobj.get_handle(): return 1 - for key in self.db.get_place_id_keys(): - p = self.db.get_place_id(key) + for key in self.db.get_place_handle_keys(): + p = self.db.get_place_handle(key) for o in p.get_media_list(): - if o.get_reference_id() == mobj.get_id(): + if o.get_reference_handle() == mobj.get_handle(): return 1 return 0 @@ -346,7 +346,7 @@ class MediaView: if not iter: return if (const.dnd_images): - object = self.db.try_to_find_object_from_id(store.get_value(iter,1)) + object = self.db.try_to_find_object_from_handle(store.get_value(iter,1)) mtype = object.get_mime_type() name = Utils.thumb_path(self.db.get_save_path(),object) pix = gtk.gdk.pixbuf_new_from_file(name) @@ -382,7 +382,7 @@ class MediaView: if GrampsCfg.get_media_reference() == 0: name = RelImage.import_media_object(name, self.db.get_save_path(), - photo.get_id()) + photo.get_handle()) if name: photo.set_path(name) @@ -408,9 +408,9 @@ class MediaView: trans = self.db.start_transaction() self.db.add_object(photo,trans) oref = RelLib.MediaRef() - oref.set_reference_id(photo.get_id()) + oref.set_reference_handle(photo.get_handle()) try: - id = photo.get_id() + id = photo.get_handle() path = self.db.get_save_path() name = RelImage.import_media_object(tfile,path,id) if name: diff --git a/src/MergeData.py b/src/MergeData.py index 054b018c0..d741e1677 100644 --- a/src/MergeData.py +++ b/src/MergeData.py @@ -84,8 +84,8 @@ class MergePeople: _("Merge %s and %s") % (fname,mname), _("Merge people")) - f1 = person1.get_main_parents_family_id() - f2 = person2.get_main_parents_family_id() + f1 = person1.get_main_parents_family_handle() + f2 = person2.get_main_parents_family_handle() name1 = GrampsCfg.get_nameof()(person1) death1 = person1.get_death().get_date() @@ -105,21 +105,21 @@ class MergePeople: self.glade.get_widget("bfather1").set_active(1) if f1: - father1 = name_of(f1.get_father_id()) - mother1 = name_of(f1.get_mother_id()) + father1 = name_of(f1.get_father_handle()) + mother1 = name_of(f1.get_mother_handle()) else: father1 = "" mother1 = "" if f2: - father2 = name_of(f2.get_father_id()) - mother2 = name_of(f2.get_mother_id()) + father2 = name_of(f2.get_father_handle()) + mother2 = name_of(f2.get_mother_handle()) else: father2 = "" mother2 = "" - self.set_field(self.glade.get_widget("id1_text"),person1.get_id()) - self.set_field(self.glade.get_widget("id2_text"),person2.get_id()) + self.set_field(self.glade.get_widget("id1_text"),person1.get_handle()) + self.set_field(self.glade.get_widget("id2_text"),person2.get_handle()) self.set_field(self.glade.get_widget("name1_text"),name1) self.set_field(self.glade.get_widget("name2_text"),name2) @@ -184,17 +184,17 @@ class MergePeople: def build_spouse_list(self,person,widget): widget.clear() - for fam in person.get_family_id_list(): + for fam in person.get_family_handle_list(): if person.get_gender() == RelLib.Person.male: - spouse = fam.get_mother_id() + spouse = fam.get_mother_handle() else: - spouse = fam.get_father_id() + spouse = fam.get_father_handle() if spouse == None: name = "unknown" else: sname = GrampsCfg.get_nameof()(spouse) - name = "%s [%s]" % (sname,spouse.get_id()) + name = "%s [%s]" % (sname,spouse.get_handle()) widget.add([name]) def set_field(self,widget,value): @@ -202,9 +202,9 @@ class MergePeople: widget.set_text(value) def place_name(self,event): - place = event.get_place_id() + place = event.get_place_handle() if place: - return "%s (%s)" % (place.get_title(),place.get_id()) + return "%s (%s)" % (place.get_title(),place.get_handle()) else: return "" @@ -271,9 +271,9 @@ class MergePeople: self.p1.add_url(xdata) self.id2 = self.glade.get_widget("id2") - old_id = self.p1.get_id() + old_id = self.p1.get_handle() if self.id2.get_active(): - self.p1.set_id(self.p2.get_id()) + self.p1.set_handle(self.p2.get_handle()) if self.bname1.get_active(): if self.altname.get_active(): @@ -310,26 +310,26 @@ class MergePeople: self.p1.add_event(event) if self.glade.get_widget("bfather2").get_active(): - orig_family = self.p1.get_main_parents_family_id() + orig_family = self.p1.get_main_parents_family_handle() if orig_family: - orig_family.remove_child_id(self.p1) - self.p1.remove_parent_family_id(orig_family) + orig_family.remove_child_handle(self.p1) + self.p1.remove_parent_family_handle(orig_family) - (source_family,mrel,frel) = self.p2.get_main_parents_family_idRel() - self.p1.set_main_parent_family_id(source_family) + (source_family,mrel,frel) = self.p2.get_main_parents_family_handleRel() + self.p1.set_main_parent_family_handle(source_family) if source_family: - if self.p2 in source_family.get_child_id_list(): - source_family.remove_child_id(self.p2) - self.p2.remove_parent_family_id(source_family) - if self.p1 not in source_family.get_child_id_list(): - source_family.add_child_id(self.p1) - self.p1.add_parent_family_id(source_family.get_id(),mrel,frel) + if self.p2 in source_family.get_child_handle_list(): + source_family.remove_child_handle(self.p2) + self.p2.remove_parent_family_handle(source_family) + if self.p1 not in source_family.get_child_handle_list(): + source_family.add_child_handle(self.p1) + self.p1.add_parent_family_handle(source_family.get_handle(),mrel,frel) else: - source_family = self.p2.get_main_parents_family_id() + source_family = self.p2.get_main_parents_family_handle() if source_family: - source_family.remove_child_id(self.p2) - self.p2.set_main_parent_family_id(None) + source_family.remove_child_handle(self.p2) + self.p2.set_main_parent_family_handle(None) self.merge_families() @@ -346,8 +346,8 @@ class MergePeople: self.p1.set_note(old_note + self.p2.get_note()) try: - self.db.remove_person_id(self.p2.get_id()) - self.db.personMap[self.p1.get_id()] = self.p1 + self.db.remove_person_handle(self.p2.get_handle()) + self.db.personMap[self.p1.get_handle()] = self.p1 except: print "%s is not in the person map!" % (GrampsCfg.get_nameof()(self.p2)) self.update(self.p1,self.p2,old_id) @@ -355,29 +355,29 @@ class MergePeople: def find_family(self,family): if self.p1.get_gender() == RelLib.Person.male: - mother = family.get_mother_id() - father = self.p1.get_id() + mother = family.get_mother_handle() + father = self.p1.get_handle() else: - father = family.get_father_id() - mother = self.p1.get_id() + father = family.get_father_handle() + mother = self.p1.get_handle() - for myfamily_id in self.db.get_family_keys(): - myfamily = self.db.find_family_from_id(myfamily_id) - if myfamily.get_father_id() == father and myfamily.get_mother_id() == mother: + for myfamily_handle in self.db.get_family_keys(): + myfamily = self.db.find_family_from_handle(myfamily_handle) + if myfamily.get_father_handle() == father and myfamily.get_mother_handle() == mother: return myfamily return None def merge_families(self): family_num = 0 - mylist = self.p2.get_family_id_list()[:] + mylist = self.p2.get_family_handle_list()[:] for src_family in mylist: family_num = family_num + 1 - if not self.db.get_family_id_map().has_key(src_family.get_id()): + if not self.db.get_family_handle_map().has_key(src_family.get_handle()): continue - if src_family in self.p1.get_family_id_list(): + if src_family in self.p1.get_family_handle_list(): continue tgt_family = self.find_family(src_family) @@ -389,22 +389,22 @@ class MergePeople: # family (with the pre-merge identity of the p1) from # both the parents # - if tgt_family in self.p1.get_family_id_list(): - if tgt_family.get_father_id() != None and \ - src_family in tgt_father.get_family_id_list(): - tgt_family.get_father_id().remove_family_id(src_family) - if tgt_family.get_mother_id() != None and \ - src_family in tgt_family.get_mother_id().get_family_id_list(): - tgt_family.get_mother_id().remove_family_id(src_family) + if tgt_family in self.p1.get_family_handle_list(): + if tgt_family.get_father_handle() != None and \ + src_family in tgt_father.get_family_handle_list(): + tgt_family.get_father_handle().remove_family_handle(src_family) + if tgt_family.get_mother_handle() != None and \ + src_family in tgt_family.get_mother_handle().get_family_handle_list(): + tgt_family.get_mother_handle().remove_family_handle(src_family) # copy children from source to target - for child in src_family.get_child_id_list(): - if child not in tgt_family.get_child_id_list(): - parents = child.get_parent_family_id_list() - tgt_family.add_child_id(child) - if child.get_main_parents_family_id() == src_family: - child.set_main_parent_family_id(tgt_family) + for child in src_family.get_child_handle_list(): + if child not in tgt_family.get_child_handle_list(): + parents = child.get_parent_family_handle_list() + tgt_family.add_child_handle(child) + if child.get_main_parents_family_handle() == src_family: + child.set_main_parent_family_handle(tgt_family) i = 0 for fam in parents[:]: if fam[0] == src_family: @@ -412,7 +412,7 @@ class MergePeople: i = i + 1 # delete the old source family - del self.db.get_family_id_map()[src_family.get_id()] + del self.db.get_family_handle_map()[src_family.get_handle()] continue @@ -428,12 +428,12 @@ class MergePeople: # transfer child to new family, alter children to # point to the correct family - for child in src_family.get_child_id_list(): - if child not in tgt_family.get_child_id_list(): - parents = child.get_parent_family_id_list() - tgt_family.add_child_id(child) - if child.get_main_parents_family_id() == src_family: - child.set_main_parent_family_id(tgt_family) + for child in src_family.get_child_handle_list(): + if child not in tgt_family.get_child_handle_list(): + parents = child.get_parent_family_handle_list() + tgt_family.add_child_handle(child) + if child.get_main_parents_family_handle() == src_family: + child.set_main_parent_family_handle(tgt_family) i = 0 for fam in parents[:]: if fam[0] == src_family: @@ -447,50 +447,50 @@ class MergePeople: # change parents of the family to point to the new # family - if src_family.get_father_id(): - src_family.get_father_id().remove_family_id(src_family.get_id()) - src_family.get_father_id().add_family_id(tgt_family.get_id()) + if src_family.get_father_handle(): + src_family.get_father_handle().remove_family_handle(src_family.get_handle()) + src_family.get_father_handle().add_family_handle(tgt_family.get_handle()) - if src_family.get_mother_id(): - src_family.get_mother_id().remove_family_id(src_family.get_id()) - src_family.get_mother_id().add_family_id(tgt_family.get_id()) + if src_family.get_mother_handle(): + src_family.get_mother_handle().remove_family_handle(src_family.get_handle()) + src_family.get_mother_handle().add_family_handle(tgt_family.get_handle()) - del self.db.get_family_id_map()[src_family.get_id()] + del self.db.get_family_handle_map()[src_family.get_handle()] else: - if src_family not in self.p1.get_family_id_list(): - self.p1.add_family_id(src_family) + if src_family not in self.p1.get_family_handle_list(): + self.p1.add_family_handle(src_family) if self.p1.get_gender() == RelLib.Person.male: - src_family.set_father_id(self.p1) + src_family.set_father_handle(self.p1) else: - src_family.set_mother_id(self.p1) + src_family.set_mother_handle(self.p1) self.remove_marriage(src_family,self.p2) # a little debugging here - for fam in self.db.get_family_id_map().values(): - if self.p2 in fam.get_child_id_list(): - fam.remove_child_id(self.p2) - fam.add_child_id(self.p1) - if self.p2 == fam.get_father_id(): - fam.set_father_id(self.p1) - if self.p2 == fam.get_mother_id(): - fam.set_mother_id(self.p1) - if fam.get_father_id() == None and fam.get_mother_id() == None: + for fam in self.db.get_family_handle_map().values(): + if self.p2 in fam.get_child_handle_list(): + fam.remove_child_handle(self.p2) + fam.add_child_handle(self.p1) + if self.p2 == fam.get_father_handle(): + fam.set_father_handle(self.p1) + if self.p2 == fam.get_mother_handle(): + fam.set_mother_handle(self.p1) + if fam.get_father_handle() == None and fam.get_mother_handle() == None: self.delete_empty_family(fam) def remove_marriage(self,family,person): if person: - person.remove_family_id(family) - if family.get_father_id() == None and family.get_mother_id() == None: + person.remove_family_handle(family) + if family.get_father_handle() == None and family.get_mother_handle() == None: self.delete_empty_family(family) - def delete_empty_family(self,family_id): - for child in family.get_child_id_list(): - if child.get_main_parents_family_id() == family_id: - child.set_main_parent_family_id(None) + def delete_empty_family(self,family_handle): + for child in family.get_child_handle_list(): + if child.get_main_parents_family_handle() == family_handle: + child.set_main_parent_family_handle(None) else: - child.remove_parent_family_id(family_id) - self.db.delete_family(family_id) + child.remove_parent_family_handle(family_handle) + self.db.delete_family(family_handle) def compare_people(p1,p2): @@ -516,12 +516,12 @@ def compare_people(p1,p2): return -1.0 chance = chance + value - value = place_match(birth1.get_place_id(),birth2.get_place_id()) + value = place_match(birth1.get_place_handle(),birth2.get_place_handle()) if value == -1.0 : return -1.0 chance = chance + value - value = place_match(death1.get_place_id(),death2.get_place_id()) + value = place_match(death1.get_place_handle(),death2.get_place_handle()) if value == -1.0 : return -1.0 chance = chance + value @@ -536,16 +536,16 @@ def compare_people(p1,p2): if p1 in ancestors: return -1.0 - f1 = p1.get_main_parents_family_id() - f2 = p2.get_main_parents_family_id() + f1 = p1.get_main_parents_family_handle() + f2 = p2.get_main_parents_family_handle() - if f1 and f1.get_father_id(): - dad1 = f1.get_father_id().get_primary_name() + if f1 and f1.get_father_handle(): + dad1 = f1.get_father_handle().get_primary_name() else: dad1 = None - if f2 and f2.get_father_id(): - dad2 = f2.get_father_id().get_primary_name() + if f2 and f2.get_father_handle(): + dad2 = f2.get_father_handle().get_primary_name() else: dad2 = None @@ -556,13 +556,13 @@ def compare_people(p1,p2): chance = chance + value - if f1 and f1.get_mother_id(): - mom1 = f1.get_mother_id().get_primary_name() + if f1 and f1.get_mother_handle(): + mom1 = f1.get_mother_handle().get_primary_name() else: mom1 = None - if f2 and f2.get_mother_id(): - mom2 = f2.get_mother_id().get_primary_name() + if f2 and f2.get_mother_handle(): + mom2 = f2.get_mother_handle().get_primary_name() else: mom2 = None @@ -572,11 +572,11 @@ def compare_people(p1,p2): chance = chance + value - for f1 in p1.get_family_id_list(): - for f2 in p2.get_family_id_list(): + for f1 in p1.get_family_handle_list(): + for f2 in p2.get_family_handle_list(): if p1.get_gender() == RelLib.Person.female: - father1 = f1.get_father_id() - father2 = f2.get_father_id() + father1 = f1.get_father_handle() + father2 = f2.get_father_handle() if father1 and father2: if father1 == father2: chance = chance + 1.0 @@ -587,8 +587,8 @@ def compare_people(p1,p2): if value != -1.0: chance = chance + value else: - mother1 = f1.get_mother_id() - mother2 = f2.get_mother_id() + mother1 = f1.get_mother_handle() + mother2 = f2.get_mother_handle() if mother1 and mother2: if mother1 == mother2: chance = chance + 1.0 @@ -788,10 +788,10 @@ def ancestors_of(p1,list): if p1 == None: return list.append(p1) - f1 = p1.get_main_parents_family_id() + f1 = p1.get_main_parents_family_handle() if f1 != None: - ancestors_of(f1.get_father_id(),list) - ancestors_of(f1.get_mother_id(),list) + ancestors_of(f1.get_father_handle(),list) + ancestors_of(f1.get_mother_handle(),list) #--------------------------------------------------------------------- # @@ -801,7 +801,7 @@ def ancestors_of(p1,list): def name_of(p): if not p: return "" - return "%s (%s)" % (GrampsCfg.get_nameof()(p),p.get_id()) + return "%s (%s)" % (GrampsCfg.get_nameof()(p),p.get_handle()) #------------------------------------------------------------------------- # @@ -838,7 +838,7 @@ class MergePlaces: """ t2active = self.glade.get_widget("title2").get_active() - old_id = self.p1.get_id() + old_id = self.p1.get_handle() if t2active: self.p1.set_title(self.p2.get_title()) @@ -889,18 +889,18 @@ class MergePlaces: for key in self.db.get_person_keys(): p = self.db.get_person(key) for event in [p.get_birth(), p.get_death()] + p.get_event_list(): - if event.get_place_id() == self.p2: - event.set_place_id(self.p1) + if event.get_place_handle() == self.p2: + event.set_place_handle(self.p1) # loop through families, changing event references to P2 to P1 - for f in self.db.get_family_id_map().values(): + for f in self.db.get_family_handle_map().values(): for event in f.get_event_list(): - if event.get_place_id() == self.p2: - event.set_place_id(self.p1) + if event.get_place_handle() == self.p2: + event.set_place_handle(self.p1) - self.db.remove_place(self.p2.get_id()) - self.db.build_place_display(self.p1.get_id(),old_id) + self.db.remove_place(self.p2.get_handle()) + self.db.build_place_display(self.p1.get_handle(),old_id) - self.update(self.p1.get_id()) + self.update(self.p1.get_handle()) Utils.destroy_passed_object(obj) diff --git a/src/PedView.py b/src/PedView.py index 553df3bf7..945b7dfa8 100644 --- a/src/PedView.py +++ b/src/PedView.py @@ -71,15 +71,15 @@ class DispBox: self.root = root self.name = GrampsCfg.get_nameof()(person) - birth_id = self.person.get_birth_id() - death_id = self.person.get_death_id() - if birth_id: - bd = db.find_event_from_id(birth_id).get_date() + birth_handle = self.person.get_birth_handle() + death_handle = self.person.get_death_handle() + if birth_handle: + bd = db.find_event_from_handle(birth_handle).get_date() else: bd = "" - if death_id: - dd = db.find_event_from_id(death_id).get_date() + if death_handle: + dd = db.find_event_from_handle(death_handle).get_date() else: dd = "" @@ -119,7 +119,7 @@ class DispBox: fill_color_gdk=style.text[gtk.STATE_NORMAL], font=font, anchor=gtk.ANCHOR_WEST) self.group.connect('event',self.group_event) - self.group.set_data(_PERSON,person.get_id()) + self.group.set_data(_PERSON,person.get_handle()) def cleanup(self): self.shadow.destroy() @@ -219,14 +219,14 @@ class PedigreeView: for t in list: if t: - birth_id = t[0].get_birth_id() - death_id = t[0].get_death_id() - if birth_id: - birth = self.parent.db.find_event_from_id(birth_id).get_date() + birth_handle = t[0].get_birth_handle() + death_handle = t[0].get_death_handle() + if birth_handle: + birth = self.parent.db.find_event_from_handle(birth_handle).get_date() else: birth = u"" - if death_id: - death = self.parent.db.find_event_from_id(death_id).get_date() + if death_handle: + death = self.parent.db.find_event_from_handle(death_handle).get_date() else: death = u"" @@ -267,9 +267,9 @@ class PedigreeView: anchor=gtk.ANCHOR_WEST) self.canvas_items.append(self.anchor_txt) - for family_id in self.active_person.get_family_id_list(): - family = self.parent.db.find_family_from_id(family_id) - if len(family.get_child_id_list()) > 0: + for family_handle in self.active_person.get_family_handle_list(): + family = self.parent.db.find_family_from_handle(family_handle) + if len(family.get_child_handle_list()) > 0: button,arrow = self.make_arrow_button(gtk.ARROW_LEFT, self.on_show_child_menu) item = self.root.add(gnome.canvas.CanvasWidget, widget=button, @@ -373,13 +373,13 @@ class PedigreeView: childlist = find_children(self.parent.db,self.active_person) if len(childlist) == 1: - child = self.parent.db.try_to_find_person_from_id(childlist[0]) + child = self.parent.db.try_to_find_person_from_handle(childlist[0]) if child: self.load_canvas(child) elif len(childlist) > 1: myMenu = gtk.Menu() - for child_id in childlist: - child = self.parent.db.try_to_find_person_from_id(child_id) + for child_handle in childlist: + child = self.parent.db.try_to_find_person_from_handle(child_handle) cname = GrampsCfg.get_nameof()(child) menuitem = gtk.MenuItem(None) if find_children(self.parent.db,child): @@ -391,7 +391,7 @@ class PedigreeView: label.set_alignment(0,0) menuitem.add(label) myMenu.append(menuitem) - menuitem.set_data(_PERSON,child_id) + menuitem.set_data(_PERSON,child_handle) menuitem.connect("activate",self.on_childmenu_changed) menuitem.show() myMenu.popup(None,None,None,0,0) @@ -401,8 +401,8 @@ class PedigreeView: """Callback for the pulldown menu selection, changing to the person attached with menu item.""" - person_id = obj.get_data(_PERSON) - person = self.parent.db.try_to_find_person_from_id(person_id) + person_handle = obj.get_data(_PERSON) + person = self.parent.db.try_to_find_person_from_handle(person_handle) if person: self.load_canvas(person) return 1 @@ -413,7 +413,7 @@ class PedigreeView: to the button.""" button,arrow = self.make_arrow_button(gtk.ARROW_RIGHT,self.change_to_parent) - button.set_data(_PERSON,parent.get_id()) + button.set_data(_PERSON,parent.get_handle()) item = self.root.add(gnome.canvas.CanvasWidget, widget=button, x=x, y=y+(h/2), height=h, width=h, size_pixels=1, @@ -426,8 +426,8 @@ class PedigreeView: """Callback to right pointing arrow button. Gets the person attached to the button and change the root person to that person, redrawing the view.""" - person_id = obj.get_data(_PERSON) - person = self.parent.db.try_to_find_person_from_id(person_id) + person_handle = obj.get_data(_PERSON) + person = self.parent.db.try_to_find_person_from_handle(person_handle) if self.active_person: self.active_person = person self.load_canvas(person) @@ -441,7 +441,7 @@ class PedigreeView: item = self.root.add(gnome.canvas.CanvasLine, width_pixels=2, points=pts, line_style=ls, fill_color_gdk=style.fg[gtk.STATE_NORMAL]) - item.set_data(_PERSON,data.get_id()) + item.set_data(_PERSON,data.get_handle()) item.connect("event",self.line_event) self.canvas_items.append(item) @@ -462,8 +462,8 @@ class PedigreeView: def line_event(self,obj,event): """Catch X events over a line and respond to the ones we care about""" - person_id = obj.get_data(_PERSON) - person = self.parent.db.try_to_find_person_from_id(person_id) + person_handle = obj.get_data(_PERSON) + person = self.parent.db.try_to_find_person_from_handle(person_handle) style = self.canvas.get_style() if event.type == gtk.gdk._2BUTTON_PRESS: @@ -485,21 +485,21 @@ class PedigreeView: if depth > 5 or person == None: return - (family_id,m,f) = person.get_main_parents_family_idRel() - if family_id: + (family_handle,m,f) = person.get_main_parents_family_handleRel() + if family_handle: mrel = (m != "Birth") frel = (f != "Birth") - family = self.parent.db.find_family_from_id(family_id) + family = self.parent.db.find_family_from_handle(family_handle) list[index] = (person,val) if family != None: - father_id = family.get_father_id() - if father_id != None: - father = self.parent.db.try_to_find_person_from_id(father_id) + father_handle = family.get_father_handle() + if father_handle != None: + father = self.parent.db.try_to_find_person_from_handle(father_handle) self.find_tree(father,(2*index)+1,depth+1,list,frel) - mother_id = family.get_mother_id() - if mother_id != None: - mother = self.parent.db.try_to_find_person_from_id(mother_id) + mother_handle = family.get_mother_handle() + if mother_handle != None: + mother = self.parent.db.try_to_find_person_from_handle(mother_handle) self.find_tree(mother,(2*index)+2,depth+1,list,mrel) def on_canvas1_event(self,obj,event): @@ -570,15 +570,15 @@ class PedigreeView: # Go over spouses and build their menu item = gtk.MenuItem(_("Spouses")) - fam_list = person.get_family_id_list() + fam_list = person.get_family_handle_list() no_spouses = 1 for fam_id in fam_list: - family = self.parent.db.find_family_from_id(fam_id) - if family.get_father_id() == person.get_id(): - sp_id = family.get_mother_id() + family = self.parent.db.find_family_from_handle(fam_id) + if family.get_father_handle() == person.get_handle(): + sp_id = family.get_mother_handle() else: - sp_id = family.get_father_id() - spouse = self.parent.db.try_to_find_person_from_id(sp_id) + sp_id = family.get_father_handle() + spouse = self.parent.db.try_to_find_person_from_handle(sp_id) if not spouse: continue @@ -601,15 +601,15 @@ class PedigreeView: # Go over siblings and build their menu item = gtk.MenuItem(_("Siblings")) - pfam_list = person.get_parent_family_id_list() + pfam_list = person.get_parent_family_handle_list() no_siblings = 1 for (f,mrel,frel) in pfam_list: - fam = self.parent.db.find_family_from_id(f) - sib_list = fam.get_child_id_list() + fam = self.parent.db.find_family_from_handle(f) + sib_list = fam.get_child_handle_list() for sib_id in sib_list: - if sib_id == person.get_id(): + if sib_id == person.get_handle(): continue - sib = self.parent.db.try_to_find_person_from_id(sib_id) + sib = self.parent.db.try_to_find_person_from_handle(sib_id) if not sib: continue @@ -633,8 +633,8 @@ class PedigreeView: item = gtk.MenuItem(_("Children")) no_children = 1 childlist = find_children(self.parent.db,person) - for child_id in childlist: - child = self.parent.db.try_to_find_person_from_id(child_id) + for child_handle in childlist: + child = self.parent.db.try_to_find_person_from_handle(child_handle) if not child: continue @@ -653,7 +653,7 @@ class PedigreeView: label.show() label.set_alignment(0,0) child_item.add(label) - child_item.set_data(_PERSON,child_id) + child_item.set_data(_PERSON,child_handle) child_item.connect("activate",self.on_childmenu_changed) child_item.show() child_menu.append(child_item) @@ -668,7 +668,7 @@ class PedigreeView: no_parents = 1 par_list = find_parents(self.parent.db,person) for par_id in par_list: - par = self.parent.db.try_to_find_person_from_id(par_id) + par = self.parent.db.try_to_find_person_from_handle(par_id) if not par: continue @@ -741,14 +741,14 @@ def get_distance(db,orig_person,other_person): except RuntimeError,msg: return None - for person_id in firstList: - if person_id in secondList: - new_rank = firstMap[person_id] + for person_handle in firstList: + if person_handle in secondList: + new_rank = firstMap[person_handle] if new_rank < rank: rank = new_rank - common = [ person_id ] + common = [ person_handle ] elif new_rank == rank: - common.append(person_id) + common.append(person_handle) if not common: return None @@ -756,9 +756,9 @@ def get_distance(db,orig_person,other_person): firstRel = None secondRel = None - person_id = common[0] - secondRel = secondMap[person_id] - firstRel = firstMap[person_id] + person_handle = common[0] + secondRel = secondMap[person_handle] + firstRel = firstMap[person_handle] if firstRel == None or secondRel == None: return None return firstRel-secondRel @@ -773,10 +773,10 @@ def find_children(db,p): Returns the list of all children's IDs for a person. """ childlist = [] - for family_id in p.get_family_id_list(): - family = db.find_family_from_id(family_id) - for child_id in family.get_child_id_list(): - childlist.append(child_id) + for family_handle in p.get_family_handle_list(): + family = db.find_family_from_handle(family_handle) + for child_handle in family.get_child_handle_list(): + childlist.append(child_handle) return childlist #------------------------------------------------------------------------- @@ -789,12 +789,12 @@ def find_parents(db,p): Returns the unique list of all parents' IDs for a person. """ parentlist = [] - for (f,mrel,frel) in p.get_parent_family_id_list(): - family = db.find_family_from_id(f) - father_id = family.get_father_id() - mother_id = family.get_mother_id() - if father_id not in parentlist: - parentlist.append(father_id) - if mother_id not in parentlist: - parentlist.append(mother_id) + for (f,mrel,frel) in p.get_parent_family_handle_list(): + family = db.find_family_from_handle(f) + father_handle = family.get_father_handle() + mother_handle = family.get_mother_handle() + if father_handle not in parentlist: + parentlist.append(father_handle) + if mother_handle not in parentlist: + parentlist.append(mother_handle) return parentlist diff --git a/src/PeopleModel.py b/src/PeopleModel.py index 3ed274e6d..9f08a5497 100644 --- a/src/PeopleModel.py +++ b/src/PeopleModel.py @@ -117,10 +117,10 @@ class PeopleModel(gtk.GenericTreeModel): val = 0 entries = self.sname_sub[surname] entries.sort(self.byname) - for person_id in entries: + for person_handle in entries: tpl = (surname,val) - self.iter2path[person_id] = tpl - self.path2iter[tpl] = person_id + self.iter2path[person_handle] = tpl + self.path2iter[tpl] = person_handle val += 1 return 0 @@ -136,15 +136,15 @@ class PeopleModel(gtk.GenericTreeModel): if not self.db.is_open(): return - for person_id in self.db.get_person_keys(): + for person_handle in self.db.get_person_keys(): - person = self.db.try_to_find_person_from_id(person_id) + person = self.db.try_to_find_person_from_handle(person_handle) surname = unicode(person.get_primary_name().get_surname()) if self.sname_sub.has_key(surname): - self.sname_sub[surname].append(person_id) + self.sname_sub[surname].append(person_handle) else: - self.sname_sub[surname] = [person_id] + self.sname_sub[surname] = [person_handle] sval = 0 name_list = self.db.get_surnames() @@ -155,10 +155,10 @@ class PeopleModel(gtk.GenericTreeModel): val = 0 entries = self.sname_sub[name] entries.sort(self.byname) - for person_id in entries: + for person_handle in entries: tpl = (name,val) - self.iter2path[person_id] = tpl - self.path2iter[tpl] = person_id + self.iter2path[person_handle] = tpl + self.path2iter[tpl] = person_handle val += 1 sval += 1 self.db.set_people_view_maps(self.get_maps()) @@ -171,7 +171,7 @@ class PeopleModel(gtk.GenericTreeModel): self.sname_sub) def add_person(self,person): - pid = person.get_id() + pid = person.get_handle() need = 0 surname = person.get_primary_name().get_surname() if self.sname_sub.has_key(surname): @@ -195,11 +195,11 @@ class PeopleModel(gtk.GenericTreeModel): val = 0 entries = self.sname_sub[surname] entries.sort(self.byname) - for person_id in entries: + for person_handle in entries: tpl = (surname,val) - self.iter2path[person_id] = tpl - self.path2iter[tpl] = person_id - if person_id == pid: + self.iter2path[person_handle] = tpl + self.path2iter[tpl] = person_handle + if person_handle == pid: column = val val += 1 @@ -361,32 +361,32 @@ class PeopleModel(gtk.GenericTreeModel): def column_birth_day(self,data): if data[_BIRTH_COL]: - return self.db.find_event_from_id(data[_BIRTH_COL]).get_date() + return self.db.find_event_from_handle(data[_BIRTH_COL]).get_date() else: return u"" def column_death_day(self,data): if data[_DEATH_COL]: - return self.db.find_event_from_id(data[_DEATH_COL]).get_date() + return self.db.find_event_from_handle(data[_DEATH_COL]).get_date() else: return u"" def column_birth_place(self,data): if data[_BIRTH_COL]: - event = self.db.find_event_from_id(data[_BIRTH_COL]) + event = self.db.find_event_from_handle(data[_BIRTH_COL]) if event: - place_id = event.get_place_id() - if place_id: - return self.db.try_to_find_place_from_id(place_id).get_title() + place_handle = event.get_place_handle() + if place_handle: + return self.db.try_to_find_place_from_handle(place_handle).get_title() return u"" def column_death_place(self,data): if data[_DEATH_COL]: - event = self.db.find_event_from_id(data[_DEATH_COL]) + event = self.db.find_event_from_handle(data[_DEATH_COL]) if event: - place_id = event.get_place_id() - if place_id: - return self.db.try_to_find_place_from_id(place_id).get_title() + place_handle = event.get_place_handle() + if place_handle: + return self.db.try_to_find_place_from_handle(place_handle).get_title() return u"" _GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ] diff --git a/src/PeopleView.py b/src/PeopleView.py index d7463547c..530a4dcdb 100644 --- a/src/PeopleView.py +++ b/src/PeopleView.py @@ -160,16 +160,16 @@ class PeopleView: def remove_from_person_list(self,person): """Remove the selected person from the list. A person object is expected, not an ID""" - path = self.person_model.on_get_path(person.get_id()) + path = self.person_model.on_get_path(person.get_handle()) self.person_model.row_deleted(path) - def remove_from_history(self,person_id,old_id=None): + def remove_from_history(self,person_handle,old_id=None): """Removes a person from the history list""" if old_id: del_id = old_id else: - del_id = person_id + del_id = person_handle hc = self.parent.history.count(del_id) for c in range(hc): @@ -197,7 +197,7 @@ class PeopleView: if not self.parent.active_person: return p = self.parent.active_person - path = self.person_model.on_get_path(p.get_id()) + path = self.person_model.on_get_path(p.get_handle()) top_path = self.person_model.on_get_path(p.get_primary_name().get_surname()) self.person_tree.expand_row(top_path,0) self.person_selection.select_path(path) @@ -212,8 +212,8 @@ class PeopleView: keys = self.DataFilter.apply(self.parent.db, self.parent.db.get_person_keys()) self.person_model.reset_visible() - for person_id in keys: - self.person_model.set_visible(person_id,1) + for person_handle in keys: + self.person_model.set_visible(person_handle,1) self.sort_model.refilter() self.parent.modify_statusbar() diff --git a/src/PlaceView.py b/src/PlaceView.py index 52c3e4525..bfb32615b 100644 --- a/src/PlaceView.py +++ b/src/PlaceView.py @@ -190,10 +190,10 @@ class PlaceView: for place in mlist: used = 0 for key in self.db.get_person_keys(): - p = self.db.try_to_find_person_from_id(key) + p = self.db.try_to_find_person_from_handle(key) event_list = [] - for e in [p.get_birth_id(),p.get_death_id()] + p.get_event_list(): - event = self.db.find_event_from_id(e) + for e in [p.get_birth_handle(),p.get_death_handle()] + p.get_event_list(): + event = self.db.find_event_from_handle(e) if event: event_list.append(event) if p.get_lds_baptism(): @@ -203,20 +203,20 @@ class PlaceView: if p.get_lds_sealing(): event_list.append(p.get_lds_sealing()) for event in event_list: - if event.get_place_id() == place.get_id(): + if event.get_place_handle() == place.get_handle(): used = 1 for fid in self.db.get_family_keys(): - f = self.db.find_family_from_id(fid) + f = self.db.find_family_from_handle(fid) event_list = [] for e in f.get_event_list(): - event = self.db.find_event_from_id(e) + event = self.db.find_event_from_handle(e) if event: event_list.append(event) if f.get_lds_sealing(): event_list.append(f.get_lds_sealing()) for event in event_list: - if event.get_place_id() == place.get_id(): + if event.get_place_handle() == place.get_handle(): used = 1 if used == 1: @@ -230,7 +230,7 @@ class PlaceView: ans.query_response) else: trans = self.db.start_transaction() - self.db.remove_place(place.get_id(),trans) + self.db.remove_place(place.get_handle(),trans) self.db.add_transaction(trans,_("Delete Place (%s)") % place.title()) self.build_tree() @@ -243,7 +243,7 @@ class PlaceView: EditPlace.EditPlace(self.parent, place, self.update_display) def blist(self,store,path,iter,list): - id = self.db.get_place_id(store.get_value(iter,1)) + id = self.db.get_place_handle(store.get_value(iter,1)) list.append(id) def merge(self): diff --git a/src/ReadXML.py b/src/ReadXML.py index d8cc68094..a2f965e1f 100644 --- a/src/ReadXML.py +++ b/src/ReadXML.py @@ -148,7 +148,7 @@ def importData(database, filename, callback=None,cl=0): first = not os.path.exists(img_dir) for m_id in database.get_object_keys(): - mobject = database.try_to_find_object_from_id(m_id) + mobject = database.try_to_find_object_from_handle(m_id) oldfile = mobject.get_path() if oldfile[0] != '/': if first: @@ -170,30 +170,30 @@ def importData(database, filename, callback=None,cl=0): #------------------------------------------------------------------------- # def remove_clicked(): # # File is lost => remove all references and the object itself -# mobj = database.find_object_from_id(NewMediaID) +# mobj = database.find_object_from_handle(NewMediaID) # for fid in database.get_family_keys(): -# p = database.find_family_from_id(fid) +# p = database.find_family_from_handle(fid) # nl = p.get_media_list() # for o in nl: # if o.get_reference() == mobj: # nl.remove(o) # p.set_media_list(nl) # for key in database.get_person_keys(): -# p = database.find_person_from_id(key) +# p = database.find_person_from_handle(key) # nl = p.get_media_list() # for o in nl: -# if o.get_reference_id() == mobj.get_id(): +# if o.get_reference_handle() == mobj.get_handle(): # nl.remove(o) # p.set_media_list(nl) # for key in database.get_source_keys(): -# p = database.find_source_from_id(key) +# p = database.find_source_from_handle(key) # nl = p.get_media_list() # for o in nl: -# if o.get_reference_id() == mobj.get_id(): +# if o.get_reference_handle() == mobj.get_handle(): # nl.remove(o) # p.set_media_list(nl) -# for key in database.get_place_id_keys(): -# p = database.find_place_from_id(key) +# for key in database.get_place_handle_keys(): +# p = database.find_place_from_handle(key) # nl = p.get_media_list() # for o in nl: # if o.get_reference() == mobj: @@ -415,7 +415,7 @@ class GrampsParser: person.unserialize(self.db.person_map.get(intid)) else: intid = Utils.create_id() - person.set_id(intid) + person.set_handle(intid) person.set_gramps_id(gramps_id) self.db.add_person_as(person,self.trans) self.gid2id[gramps_id] = intid @@ -426,7 +426,7 @@ class GrampsParser: return self.idswap[id] else: if self.db.idtrans.get(str(id)): - self.idswap[id] = self.db.find_next_gid() + self.idswap[id] = self.db.find_next_gramps_id() else: self.idswap[id] = id return self.idswap[id] @@ -444,7 +444,7 @@ class GrampsParser: id = self.tempDefault person = self.db.find_person_from_gramps_id(id,self.trans) if person: - self.db.set_default_person_id(person.get_id()) + self.db.set_default_person_handle(person.get_handle()) for key in self.func_map.keys(): del self.func_map[key] @@ -475,7 +475,7 @@ class GrampsParser: def start_sealed_to(self,attrs): id = self.map_gid(attrs['ref']) - self.ord.set_family_id(self.db.find_family_no_map(id,self.trans)) + self.ord.set_family_handle(self.db.find_family_no_map(id,self.trans)) def start_place(self,attrs): self.placeobj = self.db.find_place_no_conflicts(attrs['ref'], @@ -578,7 +578,7 @@ class GrampsParser: def start_bmark(self,attrs): person = self.find_person_by_gramps_id(self.map_gid(attrs["ref"])) - self.db.bookmarks.append(person.get_id()) + self.db.bookmarks.append(person.get_handle()) def start_person(self,attrs): if self.callback != None and self.count % self.increment == 0: @@ -598,15 +598,15 @@ class GrampsParser: def start_father(self,attrs): person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans) - self.family.set_father_id(person.get_id()) + self.family.set_father_handle(person.get_handle()) def start_mother(self,attrs): person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans) - self.family.set_mother_id(person.get_id()) + self.family.set_mother_handle(person.get_handle()) def start_child(self,attrs): person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans) - self.family.add_child_id(person.get_id()) + self.family.add_child_handle(person.get_handle()) def start_url(self,attrs): if not attrs.has_key("href"): @@ -653,10 +653,10 @@ class GrampsParser: frel = attrs["frel"] else: frel = "Birth" - self.person.add_parent_family_id(family.get_id(),mrel,frel) + self.person.add_parent_family_handle(family.get_handle(),mrel,frel) def start_parentin(self,attrs): - self.person.add_family_id(attrs["ref"]) + self.person.add_family_handle(attrs["ref"]) def start_name(self,attrs): if not self.in_witness: @@ -688,7 +688,7 @@ class GrampsParser: self.source_ref.confidence = int(attrs["conf"]) else: self.source_ref.confidence = self.conf - self.source_ref.set_base_id(source.get_id()) + self.source_ref.set_base_handle(source.get_handle()) if self.photo: self.photo.add_source_reference(self.source_ref) elif self.ord: @@ -719,8 +719,8 @@ class GrampsParser: def start_objref(self,attrs): self.objref = RelLib.MediaRef() id = self.db.find_object_no_conflicts(attrs['ref'], - self.media_file_map,self.trans).get_id() - self.objref.set_reference_id(id) + self.media_file_map,self.trans).get_handle() + self.objref.set_reference_handle(id) if attrs.has_key('priv'): self.objref.set_privacy(int(attrs['priv'])) if self.event: @@ -757,7 +757,7 @@ class GrampsParser: def start_photo(self,attrs): self.photo = RelLib.MediaObject() self.pref = RelLib.MediaRef() - self.pref.set_reference_id(self.photo.get_id()) + self.pref.set_reference_handle(self.photo.get_handle()) for key in attrs.keys(): if key == "descrip" or key == "description": @@ -905,14 +905,14 @@ class GrampsParser: self.event.name = self.event_type if self.family: - self.family.add_event_id(self.event.get_id()) + self.family.add_event_handle(self.event.get_handle()) else: if self.event_type == "Birth": - self.person.set_birth_id(self.event.get_id()) + self.person.set_birth_handle(self.event.get_handle()) elif self.event_type == "Death": - self.person.set_death_id(self.event.get_id()) + self.person.set_death_handle(self.event.get_handle()) else: - self.person.add_event_id(self.event.get_id()) + self.person.add_event_handle(self.event.get_handle()) self.db.commit_event(self.event,self.trans) self.event = None @@ -937,9 +937,9 @@ class GrampsParser: self.placeobj = RelLib.Place() self.placeobj.set_title(tag) if self.ord: - self.ord.set_place_id(self.placeobj.get_id()) + self.ord.set_place_handle(self.placeobj.get_handle()) else: - self.event.set_place_id(self.placeobj.get_id()) + self.event.set_place_handle(self.placeobj.get_handle()) self.db.commit_place(self.placeobj,self.trans) self.placeobj = None diff --git a/src/RelLib.py b/src/RelLib.py index c313f2375..787abd32c 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -59,14 +59,14 @@ CONF_NORMAL = 2 CONF_LOW = 1 CONF_VERY_LOW = 0 -PERSON_KEY = 0 -FAMILY_KEY = 1 -SOURCE_KEY = 2 -EVENT_KEY = 3 -MEDIA_KEY = 4 -PLACE_KEY = 5 +_PERSON_KEY = 0 +_FAMILY_KEY = 1 +_SOURCE_KEY = 2 +_EVENT_KEY = 3 +_MEDIA_KEY = 4 +_PLACE_KEY = 5 -UNDO_SIZE = 1000 +_UNDO_SIZE = 1000 #------------------------------------------------------------------------- # @@ -89,9 +89,8 @@ class SourceNote: self.source_list = [] if source: - if len(source.source_list) > 0: - for sref in source.source_list: - self.source_list.append(SourceRef(sref)) + for sref in source.source_list: + self.source_list.append(SourceRef(sref)) if source.note: self.note = Note(source.note.get()) else: @@ -99,9 +98,9 @@ class SourceNote: else: self.note = None - def add_source_reference(self,gid) : + def add_source_reference(self,handle) : """Set the source reference""" - self.source_list.append(gid) + self.source_list.append(handle) def get_source_references(self) : """Return the source reference""" @@ -178,19 +177,19 @@ class LdsOrd(SourceNote): else: return "" - def set_place_id(self,place): + def set_place_handle(self,place): """sets the Place instance of the Event""" self.place = place - def get_place_id(self): + def get_place_handle(self): """returns the Place instance of the Event""" return self.place - def set_family_id(self,family): + def set_family_handle(self,family): """Sets the family associated with the LDS ordinance""" self.famc = family - def get_family_id(self): + def get_family_handle(self): """Gets the family associated with the LDS ordinance""" return self.famc @@ -246,10 +245,7 @@ class LdsOrd(SourceNote): def are_equal(self,other): """returns 1 if the specified ordinance is the same as the instance""" if other == None: - if self.is_empty(): - return 1 - else: - return 0 + return self.is_empty() if (self.famc != other.famc or self.place != other.place or self.status != other.status or @@ -315,7 +311,7 @@ class Place(SourceNote): self.alt_loc = [] for loc in source.alt_loc: self.alt_loc = Location(loc) - self.id = source.id + self.handle = source.handle self.urls = [] for u in source.urls: self.urls.append(Url(u)) @@ -328,16 +324,16 @@ class Place(SourceNote): self.title = "" self.main_loc = None self.alt_loc = [] - self.id = "" + self.handle = "" self.urls = [] self.media_list = [] def serialize(self): - return (self.id, self.title, self.long, self.lat, self.main_loc, + return (self.handle, self.title, self.long, self.lat, self.main_loc, self.alt_loc, self.urls, self.media_list, self.source_list, self.note) def unserialize(self,data): - (self.id, self.title, self.long, self.lat, self.main_loc, + (self.handle, self.title, self.long, self.lat, self.main_loc, self.alt_loc, self.urls, self.media_list, self.source_list, self.note) = data @@ -353,13 +349,13 @@ class Place(SourceNote): """Add a URL to the URL list""" self.urls.append(url) - def set_id(self,gid): - """Sets the gramps ID for the place object""" - self.id = gid + def set_handle(self,handle): + """Sets the database handle for the place object""" + self.handle = handle - def get_id(self): - """Returns the gramps ID for the place object""" - return self.id + def get_handle(self): + """Returns the database handle for the place object""" + return self.handle def set_title(self,name): """Sets the title of the place object""" @@ -429,13 +425,13 @@ class Place(SourceNote): case city, upper case county, upper case state, upper case country""" if self.main_loc: - return [self.title,self.id,self.main_loc.parish,self.main_loc.city, + return [self.title,self.handle,self.main_loc.parish,self.main_loc.city, self.main_loc.county,self.main_loc.state,self.main_loc.country, self.title.upper(), self.main_loc.parish.upper(), self.main_loc.city.upper(), self.main_loc.county.upper(), self.main_loc.state.upper(), self.main_loc.country.upper()] else: - return [self.title,self.id,'','','','','',self.title.upper(), '','','','',''] + return [self.title,self.handle,'','','','','',self.title.upper(), '','','','',''] #------------------------------------------------------------------------- # @@ -643,36 +639,36 @@ class MediaObject(SourceNote): self.path = source.path self.mime = source.mime self.desc = source.desc - self.id = source.id + self.handle = source.handle self.thumb = source.thumb for attr in source.attrlist: self.attrlist.append(Attribute(attr)) else: - self.id = "" + self.handle = "" self.path = "" self.mime = "" self.desc = "" self.thumb = None def serialize(self): - return (self.id, self.path, self.mime, self.desc, self.attrlist, + return (self.handle, self.path, self.mime, self.desc, self.attrlist, self.source_list, self.note) def unserialize(self,data): try: - (self.id, self.path, self.mime, self.desc, self.attrlist, + (self.handle, self.path, self.mime, self.desc, self.attrlist, self.source_list, self.note) = data except: - (self.id, junk, self.path, self.mime, self.desc, self.attrlist, + (self.handle, junk, self.path, self.mime, self.desc, self.attrlist, self.source_list, self.note) = data - def set_id(self,gid): - """Sets the gramps ID for the place object""" - self.id = gid + def set_handle(self,handle): + """Sets the database handle for the place object""" + self.handle = handle - def get_id(self): - """Returns the gramps ID for the place object""" - return self.id + def get_handle(self): + """Returns the database handle for the place object""" + return self.handle def set_mime_type(self,type): self.mime = type @@ -740,10 +736,10 @@ class MediaRef(SourceNote): """Returns the privacy level of the data""" return self.private - def set_reference_id(self,obj_id): + def set_reference_handle(self,obj_id): self.ref = obj_id - def get_reference_id(self): + def get_reference_handle(self): return self.ref def add_attribute(self,attr): @@ -1142,11 +1138,11 @@ class Person(SourceNote): male = 1 female = 0 - def __init__(self,gid=""): + def __init__(self,handle=""): """creates a new Person instance""" SourceNote.__init__(self) - self.id = gid - self.gid = "" + self.handle = handle + self.gramps_id = "" self.primary_name = Name() self.event_list = [] self.family_list = [] @@ -1155,8 +1151,8 @@ class Person(SourceNote): self.nickname = "" self.alternate_names = [] self.gender = 2 - self.death_id = None - self.birth_id = None + self.death_handle = None + self.birth_handle = None self.address_list = [] self.attribute_list = [] self.urls = [] @@ -1172,9 +1168,9 @@ class Person(SourceNote): self.db = None def serialize(self): - return (self.id, self.gid, self.gender, + return (self.handle, self.gramps_id, self.gender, self.primary_name, self.alternate_names, self.nickname, - self.death_id, self.birth_id, self.event_list, + self.death_handle, self.birth_handle, self.event_list, self.family_list, self.parent_family_list, self.media_list, self.address_list, @@ -1186,19 +1182,16 @@ class Person(SourceNote): self.note) def unserialize(self,data): - try: - (self.id, self.gid, self.gender, - self.primary_name, self.alternate_names, self.nickname, - self.death_id, self.birth_id, self.event_list, - self.family_list, self.parent_family_list, - self.media_list, - self.address_list, - self.attribute_list, - self.urls, - self.lds_bapt, self.lds_endow, self.lds_seal, - self.complete, self.source_list, self.note) = data - except: - print data + (self.handle, self.gramps_id, self.gender, + self.primary_name, self.alternate_names, self.nickname, + self.death_handle, self.birth_handle, self.event_list, + self.family_list, self.parent_family_list, + self.media_list, + self.address_list, + self.attribute_list, + self.urls, + self.lds_bapt, self.lds_endow, self.lds_seal, + self.complete, self.source_list, self.note) = data def set_complete(self,val): self.complete = val @@ -1213,10 +1206,10 @@ class Person(SourceNote): gender = const.female else: gender = const.unknown - bday = self.birth_id - dday = self.death_id + bday = self.birth_handle + dday = self.death_handle return [ GrampsCfg.get_display_name()(self), - self.gid, + self.gramps_id, gender, bday, dday, @@ -1266,21 +1259,21 @@ class Person(SourceNote): """adds a URL instance to the list""" self.urls.append(url) - def set_gramps_id(self,gid): - """sets the gramps ID for the Person""" - self.gid = str(gid) + def set_gramps_id(self,gramps_id): + """sets the GRAMPS ID for the Person""" + self.gramps_id = gramps_id def get_gramps_id(self): - """returns the gramps ID for the Person""" - return self.gid + """returns the GRAMPS ID for the Person""" + return self.gramps_id - def set_id(self,gid): - """sets the gramps ID for the Person""" - self.id = str(gid) + def set_handle(self,handle): + """sets the database handle for the Person""" + self.handle = handle - def get_id(self): - """returns the gramps ID for the Person""" - return self.id + def get_handle(self): + """returns the database handle for the Person""" + return self.handle def set_nick_name(self,name): """sets the nickname for the Person""" @@ -1305,21 +1298,21 @@ class Person(SourceNote): """returns the gender of the Person""" return self.gender - def set_birth_id(self,event_id) : + def set_birth_handle(self,event_handle) : """sets the birth event to the passed event""" - self.birth_id = event_id + self.birth_handle = event_handle - def set_death_id(self,event_id) : + def set_death_handle(self,event_handle) : """sets the death event to the passed event""" - self.death_id = event_id + self.death_handle = event_handle - def get_birth_id(self) : + def get_birth_handle(self) : """returns the birth event""" - return self.birth_id + return self.birth_handle - def get_death_id(self) : + def get_death_handle(self) : """returns the death event""" - return self.death_id + return self.death_handle # def get_valid_death(self): # e = self.death @@ -1353,9 +1346,9 @@ class Person(SourceNote): """Sets the list of MediaObject objects""" self.media_list = list - def add_event_id(self,event_id): + def add_event_handle(self,event_handle): """adds an Event to the event list""" - self.event_list.append(event_id) + self.event_list.append(event_handle) def get_event_list(self): """returns the list of Event instances""" @@ -1365,30 +1358,29 @@ class Person(SourceNote): """sets the event list to the passed list""" self.event_list = elist - def add_family_id(self,family_id): + def add_family_handle(self,family_handle): """adds the specified Family instance to the list of families/marriages/partnerships in which the person is a parent or spouse""" - self.family_list.append(family_id) + self.family_list.append(family_handle) - def set_preferred_family_id(self,family): + def set_preferred_family_handle(self,family): if family in self.family_list: self.family_list.remove(family) self.family_list = [family] + self.family_list - def get_family_id_list(self) : + def get_family_handle_list(self) : """returns the list of Family instances in which the person is a parent or spouse""" return self.family_list - def clear_family_id_list(self) : + def clear_family_handle_list(self) : self.family_list = [] - def remove_family_id(self,family): + def remove_family_handle(self,family): """removes the specified Family instance from the list of marriages/partnerships""" - assert(type(family) == types.StringType or type(family) == types.UnicodeType) if family in self.family_list: self.family_list.remove(family) @@ -1426,58 +1418,51 @@ class Person(SourceNote): """sets the attribute list to the specified list""" self.attribute_list = list - def get_parent_family_id_list(self): + def get_parent_family_handle_list(self): """returns the list of alternate Family instances, in which the Person is a child of the family, but not a natural child of both parents""" return self.parent_family_list - def add_parent_family_id(self,family,mrel,frel): + def add_parent_family_handle(self,family,mrel,frel): """adds a Family to the alternate family list, indicating the relationship to the mother (mrel) and the father (frel)""" - assert(type(family) == types.StringType or type(family) == types.UnicodeType) self.parent_family_list.append((family,mrel,frel)) - def clear_parent_family_id_list(self): + def clear_parent_family_handle_list(self): self.parent_family_list = [] - def remove_parent_family_id(self,family): + def remove_parent_family_handle(self,family): """removes a Family instance from the alternate family list""" - assert(type(family) == types.StringType or type(family) == types.UnicodeType) for f in self.parent_family_list[:]: - assert(type(f[0]) == types.StringType or type(f[0]) == types.UnicodeType) if f[0] == family: self.parent_family_list.remove(f) return f else: return None - def change_parent_family_id(self,family,mrel,frel): + def change_parent_family_handle(self,family,mrel,frel): """removes a Family instance from the alternate family list""" index = 0 - assert(type(family) == types.StringType or type(family) == types.UnicodeType) for f in self.parent_family_list[:]: if f[0] == family: self.parent_family_list[index] = (family,mrel,frel) index += 1 def has_family(self,family): - assert(type(family) == types.StringType or type(family) == types.UnicodeType) for f in self.parent_family_list: - assert(type(f[0]) == types.StringType or type(f[0]) == types.UnicodeType) if f[0] == family: return f else: return None - def set_main_parent_family_id(self,family): + def set_main_parent_family_handle(self,family): """sets the main Family of the Person, the Family in which the Person is a natural born child""" - assert(type(family) == types.StringType or type(family) == types.UnicodeType) - f = self.remove_parent_family_id(family) + f = self.remove_parent_family_handle(family) if f: self.parent_family_list = [f] + self.parent_family_list - def get_main_parents_family_id(self): + def get_main_parents_family_handle(self): """returns the main Family of the Person, the Family in which the Person is a natural born child""" if len(self.parent_family_list) == 0: @@ -1485,7 +1470,7 @@ class Person(SourceNote): else: return self.parent_family_list[0][0] - def get_main_parents_family_idRel(self): + def get_main_parents_family_handleRel(self): """returns the main Family of the Person, the Family in which the Person is a natural born child""" if len(self.parent_family_list) == 0: @@ -1503,7 +1488,7 @@ class Person(SourceNote): # # This will happen when cousins marry. # if not family.Father.get_ancestor(): # family.Father.set_ancestor(value) -# if family.get_mother_id(): +# if family.get_mother_handle(): # if not family.Mother.get_ancestor(): # family.Mother.set_ancestor(value) @@ -1530,10 +1515,10 @@ class Person(SourceNote): def probably_alive(self,db): """Returns true if the person may be alive.""" - if self.death_id: + if self.death_handle: return 0 - if self.birth_id: - birth = db.find_event_from_id(self.birth_id) + if self.birth_handle: + birth = db.find_event_from_handle(self.birth_handle) if birth.get_date() != "": return not_too_old(birth.get_date_object().get_start_date()) @@ -1544,24 +1529,24 @@ class Person(SourceNote): max_generation = 60 max_age_difference = 60 def descendants_too_old (person, years): - for family_id in person.get_family_id_list(): - family = db.find_family_from_id(family_id) - for child_id in family.get_child_id_list(): - child = db.find_person_from_id(child_id) - if child.birth_id: - child_birth = db.find_event_from_id(child.birth_id) - if child_birth.get_date () != "": - d = SingleDate (child_birth.get_date_object (). - get_start_date ()) - d.set_year (d.get_year () - years) + for family_handle in person.get_family_handle_list(): + family = db.find_family_from_handle(family_handle) + for child_handle in family.get_child_handle_list(): + child = db.find_person_from_handle(child_handle) + if child.birth_handle: + child_birth = db.find_event_from_handle(child.birth_handle) + if child_birth.get_date() != "": + d = SingleDate (child_birth.get_date_object(). + get_start_date()) + d.set_year (d.get_year() - years) if not not_too_old (d): return 1 - if child.death_id: - child_death = db.find_event_from_id(child.death_id) - if child_death.get_date () != "": - d = SingleDate (child_death.get_date_object (). - get_start_date ()) + if child.death_handle: + child_death = db.find_event_from_handle(child.death_handle) + if child_death.get_date() != "": + d = SingleDate (child_death.get_date_object(). + get_start_date()) if not not_too_old (d): return 1 @@ -1573,30 +1558,30 @@ class Person(SourceNote): # What about their parents? def parents_too_old (person, age_difference): - family_id = person.get_main_parents_family_id () - if family_id: - family = db.find_family_from_id(family_id) - for parent_id in [family.get_father_id (), family.get_mother_id ()]: + family_handle = person.get_main_parents_family_handle() + if family_handle: + family = db.find_family_from_handle(family_handle) + for parent_id in [family.get_father_handle(), family.get_mother_handle()]: if not parent_id: continue - parent = db.find_person_from_id(parent_id) - if parent.birth_id: - parent_birth = db.find_event_from_id(parent.birth_id) - if parent_birth.get_date (): - d = SingleDate (parent_birth.get_date_object (). - get_start_date ()) - d.set_year (d.get_year () + max_generation + + parent = db.find_person_from_handle(parent_id) + if parent.birth_handle: + parent_birth = db.find_event_from_handle(parent.birth_handle) + if parent_birth.get_date(): + d = SingleDate (parent_birth.get_date_object(). + get_start_date()) + d.set_year (d.get_year() + max_generation + age_difference) if not not_too_old (d): return 1 - if parent.death_id: - parent_death = db.find_event_from_id(parent.death_id) - if parent_death.get_date () != "": - d = SingleDate (parent_death.get_date_object (). - get_start_date ()) - d.set_year (d.get_year () + age_difference) + if parent.death_handle: + parent_death = db.find_event_from_handle(parent.death_handle) + if parent_death.get_date() != "": + d = SingleDate (parent_death.get_date_object(). + get_start_date()) + d.set_year (d.get_year() + age_difference) if not not_too_old (d): return 1 @@ -1605,29 +1590,29 @@ class Person(SourceNote): # As a last resort, trying seeing if their spouse's age gives # any clue. - for family_id in self.get_family_id_list (): - family = db.find_family_from_id(family_id) - for spouse_id in [family.get_father_id (), family.get_mother_id ()]: + for family_handle in self.get_family_handle_list(): + family = db.find_family_from_handle(family_handle) + for spouse_id in [family.get_father_handle(), family.get_mother_handle()]: if not spouse_id: continue - if spouse_id == self.id: + if spouse_id == self.handle: continue - spouse = db.find_person_from_id(spouse_id) - if spouse.birth_id: - spouse_birth = db.find_event_from_id(spouse.birth_id) - if spouse_birth.get_date () != "": + spouse = db.find_person_from_handle(spouse_id) + if spouse.birth_handle: + spouse_birth = db.find_event_from_handle(spouse.birth_handle) + if spouse_birth.get_date() != "": d = SingleDate (spouse_birth.get_date_object(). - get_start_date ()) - d.set_year (d.get_year () + max_age_difference) + get_start_date()) + d.set_year (d.get_year() + max_age_difference) if not not_too_old (d): return 0 - if spouse.death_id: - spouse_death = db.find_event_from_id(spouse.death_id) - if spouse_death.get_date () != "": + if spouse.death_handle: + spouse_death = db.find_event_from_handle(spouse.death_handle) + if spouse_death.get_date() != "": d = SingleDate (spouse_birth.get_date_object(). - get_start_date ()) - d.set_year (d.get_year () - min_generation) + get_start_date()) + d.set_year (d.get_year() - min_generation) if not not_too_old (d): return 0 @@ -1659,7 +1644,7 @@ class Event(DataObj): self.description = source.description self.name = source.name self.cause = source.cause - self.id = source.id + self.handle = source.handle self.media_list = [MediaRef(media_id) for media_id in source.media_list] try: if source.witness: @@ -1675,7 +1660,7 @@ class Event(DataObj): self.name = "" self.cause = "" self.witness = None - self.id = None + self.handle = None self.media_list = [] def clone(self,source): @@ -1684,7 +1669,7 @@ class Event(DataObj): self.description = source.description self.name = source.name self.cause = source.cause - self.id = source.id + self.handle = source.handle self.private = source.private self.source_list = source.source_list[:] self.note = source.note @@ -1698,12 +1683,12 @@ class Event(DataObj): self.witness = None def serialize(self): - return (self.id, self.name, self.date, self.description, + return (self.handle, self.name, self.date, self.description, self.place, self.cause, self.private, self.source_list, self.note, self.witness, self.media_list) def unserialize(self,data): - (self.id, self.name, self.date, self.description, + (self.handle, self.name, self.date, self.description, self.place, self.cause, self.private, self.source_list, self.note, self.witness, self.media_list) = data @@ -1719,13 +1704,13 @@ class Event(DataObj): """Sets the list of Photo objects""" self.media_list = mlist - def set_id(self,gid): - """Sets the gramps ID for the place object""" - self.id = gid + def set_handle(self,handle): + """Sets the database handle for the place object""" + self.handle = handle - def get_id(self): - """Returns the gramps ID for the place object""" - return self.id + def get_handle(self): + """Returns the database handle for the place object""" + return self.handle def get_witness_list(self): return self.witness @@ -1744,7 +1729,7 @@ class Event(DataObj): def is_empty(self): date = self.get_date_object() - place = self.get_place_id() + place = self.get_place_handle() description = self.description cause = self.cause name = self.name @@ -1803,11 +1788,11 @@ class Event(DataObj): """returns the name of the Event""" return self.name - def set_place_id(self,place): + def set_place_handle(self,place): """sets the Place instance of the Event""" self.place = place - def get_place_id(self): + def get_place_handle(self): """returns the Place instance of the Event""" return self.place @@ -1902,12 +1887,12 @@ class Family(SourceNote): def __init__(self): """creates a new Family instance""" SourceNote.__init__(self) - self.father_id = None - self.mother_id = None + self.father_handle = None + self.mother_handle = None self.child_list = [] self.type = "Married" self.event_list = [] - self.id = "" + self.handle = "" self.media_list = [] self.attribute_list = [] self.lds_seal = None @@ -1915,7 +1900,7 @@ class Family(SourceNote): def serialize(self): - return (self.id, self.father_id, self.mother_id, + return (self.handle, self.father_handle, self.mother_handle, self.child_list, self.type, self.event_list, self.media_list, self.attribute_list, self.lds_seal, self.complete, @@ -1923,7 +1908,7 @@ class Family(SourceNote): self.note) def unserialize(self, data): - (self.id, self.father_id, self.mother_id, + (self.handle, self.father_handle, self.mother_handle, self.child_list, self.type, self.event_list, self.media_list, self.attribute_list, self.lds_seal, self.complete, @@ -1959,13 +1944,13 @@ class Family(SourceNote): """sets the attribute list to the specified list""" self.attribute_list = list - def set_id(self,gid) : - """sets the gramps ID for the Family""" - self.id = str(gid) + def set_handle(self,handle) : + """sets the database handle for the Family""" + self.handle = str(handle) - def get_id(self) : - """returns the gramps ID for the Family""" - return unicode(self.id) + def get_handle(self) : + """returns the database handle for the Family""" + return unicode(self.handle) def set_relationship(self,type): """assigns a string indicating the relationship between the @@ -1977,62 +1962,58 @@ class Family(SourceNote): father and the mother""" return self.type - def set_father_id(self,person_id): + def set_father_handle(self,person_handle): """sets the father of the Family to the specfied Person""" # update = self.some_child_is_ancestor() -# if update and father_id: -# father_id.set_ancestor(0) - self.father_id = person_id -# if update and father_id: -# father_id.set_ancestor(1) +# if update and father_handle: +# father_handle.set_ancestor(0) + self.father_handle = person_handle +# if update and father_handle: +# father_handle.set_ancestor(1) - def get_father_id(self): + def get_father_handle(self): """returns the father of the Family""" - return self.father_id + return self.father_handle - def set_mother_id(self,person): + def set_mother_handle(self,person): """sets the mother of the Family to the specfied Person""" # update = self.some_child_is_ancestor() -# if self.mother_id and update: -# self.mother_id.set_ancestor(0) - self.mother_id = person -# if update and self.mother_id: -# self.mother_id.set_ancestor(1) +# if self.mother_handle and update: +# self.mother_handle.set_ancestor(0) + self.mother_handle = person +# if update and self.mother_handle: +# self.mother_handle.set_ancestor(1) - def get_mother_id(self): + def get_mother_handle(self): """returns the mother of the Family""" - return self.mother_id + return self.mother_handle - def add_child_id(self,person): + def add_child_handle(self,person): """adds the specfied Person as a child of the Family, adding it to the child list""" - assert(type(person) == types.StringType or type(person) == types.UnicodeType) - if person not in self.child_list: self.child_list.append(person) # if person.get_ancestor(): -# if father_id: -# father_id.set_ancestor(1) -# if self.mother_id: -# self.mother_id.set_ancestor(1) +# if father_handle: +# father_handle.set_ancestor(1) +# if self.mother_handle: +# self.mother_handle.set_ancestor(1) - def remove_child_id(self,person): + def remove_child_handle(self,person): """removes the specified Person from the child list""" - assert(type(person) == types.StringType or type(person) == types.UnicodeType) - if person in self.child_list: self.child_list.remove(person) # if person.get_ancestor(): -# if father_id: -# father_id.set_ancestor(0) -# if self.mother_id: -# self.mother_id.set_ancestor(0) +# if father_handle: +# father_handle.set_ancestor(0) +# if self.mother_handle: +# self.mother_handle.set_ancestor(0) - def get_child_id_list(self): + def get_child_handle_list(self): """returns the list of children""" return self.child_list - def set_child_id_list(self, list): + def set_child_handle_list(self, list): """sets the list of children""" self.child_list = list[:] @@ -2050,10 +2031,9 @@ class Family(SourceNote): return e return None - def add_event_id(self,event_id): + def add_event_handle(self,event_handle): """adds an Event to the event list""" - assert(event_id != None) - self.event_list.append(event_id) + self.event_list.append(event_handle) def get_event_list(self) : """returns the list of Event instances""" @@ -2096,27 +2076,28 @@ class Source: self.pubinfo = "" self.note = Note() self.media_list = [] - self.id = "" + self.handle = "" self.abbrev = "" def serialize(self): - return (self.id,self.title,self.author,self.pubinfo,self.note,self.media_list,self.abbrev) + return (self.handle,self.title,self.author,self.pubinfo, + self.note,self.media_list,self.abbrev) def unserialize(self,data): - (self.id,self.title,self.author,self.pubinfo,self.note,self.media_list,self.abbrev) = data + (self.handle,self.title,self.author,self.pubinfo, + self.note,self.media_list,self.abbrev) = data def get_display_info(self): - return [self.title,self.id,self.author,self.title.upper(),self.author.upper()] + return [self.title,self.handle,self.author,self.title.upper(),self.author.upper()] - def set_id(self,newId): + def set_handle(self,handle): """sets the gramps' ID for the Source instance""" - self.id = str(newId) + self.handle = str(handle) - def get_id(self): + def get_handle(self): """returns the gramps' ID of the Source instance""" - return self.id + return self.handle - #EARNEY, this should eventually be a list of ids not objects, right? def add_media_reference(self,media_id): """Adds a MediaObject object to the Source instance's image list""" self.media_list.append(media_id) @@ -2197,7 +2178,6 @@ class SourceRef: """creates a new SourceRef, copying from the source if present""" if source: self.confidence = source.confidence - assert(type(source.ref) == types.StringType or type(source.ref) == types.UnicodeType) self.ref = source.ref self.page = source.page self.date = Date(source.date) @@ -2219,12 +2199,11 @@ class SourceRef: """Returns the confidence level""" return self.confidence - def set_base_id(self,ref): + def set_base_handle(self,ref): """sets the Source instance to which the SourceRef refers""" - assert(type(ref) == types.StringType or type(ref) == types.UnicodeType) self.ref = ref - def get_base_id(self): + def get_base_handle(self): """returns the Source instance to which the SourceRef refers""" return self.ref @@ -2297,7 +2276,7 @@ class GenderStats: self.stats = {} def _get_key (self, person): - name = person.get_primary_name ().get_first_name () + name = person.get_primary_name().get_first_name() return self._get_key_from_name (name) def _get_key_from_name (self, name): @@ -2316,7 +2295,7 @@ class GenderStats: if not name: return - gender = person.get_gender () + gender = person.get_gender() (male, female, unknown) = self.name_stats (name) if not undo: increment = 1 @@ -2392,7 +2371,7 @@ class GrampsDB: self.open = 0 self.new() self.added_files = [] - self.genderStats = GenderStats () + self.genderStats = GenderStats() self.env = None self.person_map = None @@ -2440,15 +2419,15 @@ class GrampsDB: self.surnames.set_flags(db.DB_DUP) self.surnames.open(name, "surnames", db.DB_HASH, flags=db.DB_CREATE) - self.idtrans = db.DB(self.env) - self.idtrans.set_flags(db.DB_DUP) - self.idtrans.open(name, "idtrans", db.DB_HASH, flags=db.DB_CREATE) + self.id_trans = db.DB(self.env) + self.id_trans.set_flags(db.DB_DUP) + self.id_trans.open(name, "idtrans", db.DB_HASH, flags=db.DB_CREATE) self.eventnames = db.DB(self.env) self.eventnames.set_flags(db.DB_DUP) self.eventnames.open(name, "eventnames", db.DB_HASH, flags=db.DB_CREATE) self.person_map.associate(self.surnames, find_surname, db.DB_CREATE) - self.person_map.associate(self.idtrans, find_idmap, db.DB_CREATE) + self.person_map.associate(self.id_trans, find_idmap, db.DB_CREATE) self.event_map.associate(self.eventnames, find_eventname, db.DB_CREATE) self.undodb = db.DB() @@ -2459,9 +2438,9 @@ class GrampsDB: self.bookmarks = [] return 1 - def find_next_gid(self): + def find_next_gramps_id(self): index = self.iprefix % self.pmap_index - while self.idtrans.get(str(index)): + while self.id_trans.get(str(index)): self.pmap_index += 1 index = self.iprefix % self.pmap_index self.pmap_index += 1 @@ -2496,7 +2475,7 @@ class GrampsDB: self.metadata.close() self.surnames.close() self.eventnames.close() - self.idtrans.close() + self.id_trans.close() self.env.close() self.undodb.close() @@ -2524,12 +2503,6 @@ class GrampsDB: def clear_added_media_objects(self): self.added_files = [] - def get_type(self): - return 'GrampsDB' - - def get_base(self): - return "" - def get_number_of_people(self): return len(self.person_map) @@ -2546,8 +2519,8 @@ class GrampsDB: return [] def sort_by_name(self,f,s): - n1 = self.person_map.get(str(f))[2].sname - n2 = self.person_map.get(str(s))[2].sname + n1 = self.person_map.get(f)[2].sname + n2 = self.person_map.get(s)[2].sname return cmp(n1,n2) def sort_person_keys(self): @@ -2559,7 +2532,7 @@ class GrampsDB: return [] def get_person_display(self,key): - data = self.person_map.get(str(key)) + data = self.person_map.get(key) if data[2] == Person.male: gender = const.male @@ -2579,46 +2552,46 @@ class GrampsDB: GrampsCfg.get_display_surname()(data[3])] def commit_person(self,person,transaction): - gid = str(person.get_id()) + handle = person.get_handle() if transaction != None: - old_data = self.person_map.get(gid) - transaction.add(PERSON_KEY,gid,old_data) - self.person_map.put(gid,person.serialize()) + old_data = self.person_map.get(handle) + transaction.add(_PERSON_KEY,handle,old_data) + self.person_map.put(handle,person.serialize()) def commit_media_object(self,object,transaction): - gid = str(object.get_id()) + handle = str(object.get_handle()) if transaction != None: - old_data = self.media_map.get(gid) - transaction.add(MEDIA_KEY,gid,old_data) - self.media_map.put(str(object.get_id()),object.serialize()) + old_data = self.media_map.get(handle) + transaction.add(_MEDIA_KEY,handle,old_data) + self.media_map.put(str(object.get_handle()),object.serialize()) def commit_source(self,source,transaction): - gid = str(source.get_id()) + handle = str(source.get_handle()) if transaction != None: - old_data = self.source_map.get(gid) - transaction.add(SOURCE_KEY,gid,old_data) - self.source_map.put(str(source.get_id()),source.serialize()) + old_data = self.source_map.get(handle) + transaction.add(_SOURCE_KEY,handle,old_data) + self.source_map.put(str(source.get_handle()),source.serialize()) def commit_place(self,place,transaction): - gid = str(place.get_id()) + handle = str(place.get_handle()) if transaction != None: - old_data = self.place_map.get(gid) - transaction.add(PLACE_KEY,gid,old_data) - self.place_map.put(str(place.get_id()),place.serialize()) + old_data = self.place_map.get(handle) + transaction.add(_PLACE_KEY,handle,old_data) + self.place_map.put(str(place.get_handle()),place.serialize()) def commit_event(self,event,transaction): - gid = str(event.get_id()) + handle = str(event.get_handle()) if transaction != None: - old_data = self.event_map.get(gid) - transaction.add(EVENT_KEY,gid,old_data) - self.event_map.put(str(event.get_id()),event.serialize()) + old_data = self.event_map.get(handle) + transaction.add(_EVENT_KEY,handle,old_data) + self.event_map.put(str(event.get_handle()),event.serialize()) def commit_family(self,family,transaction): - gid = str(family.get_id()) + handle = str(family.get_handle()) if transaction != None: - old_data = self.family_map.get(gid) - transaction.add(FAMILY_KEY,gid,old_data) - self.family_map.put(str(family.get_id()),family.serialize()) + old_data = self.family_map.get(handle) + transaction.add(_FAMILY_KEY,handle,old_data) + self.family_map.put(str(family.get_handle()),family.serialize()) def set_iprefix(self,val): if val: @@ -2678,7 +2651,7 @@ class GrampsDB: """initializes the GrampsDB to empty values""" self.undoindex = -1 - self.translist = [None] * UNDO_SIZE + self.translist = [None] * _UNDO_SIZE self.smap_index = 0 self.emap_index = 0 self.pmap_index = 0 @@ -2690,7 +2663,7 @@ class GrampsDB: self.bookmarks = [] self.path = "" self.place2title = {} - self.genderStats = GenderStats () + self.genderStats = GenderStats() def start_transaction(self,msg=""): return Transaction(msg,self.undodb) @@ -2700,7 +2673,7 @@ class GrampsDB: return transaction.set_description(msg) self.undoindex += 1 - if self.undoindex == UNDO_SIZE: + if self.undoindex == _UNDO_SIZE: self.translist = transaction[0:-1] + [ transaction ] else: self.translist[self.undoindex] = transaction @@ -2720,37 +2693,37 @@ class GrampsDB: subitems = transaction.get_recnos() subitems.reverse() for record_id in subitems: - (key, gid, data) = transaction.get_record(record_id) - if key == PERSON_KEY: + (key, handle, data) = transaction.get_record(record_id) + if key == _PERSON_KEY: if data == None: - del self.person_map[gid] + del self.person_map[handle] else: - self.person_map.put(gid,data) - elif key == FAMILY_KEY: + self.person_map.put(handle,data) + elif key == _FAMILY_KEY: if data == None: - del self.family_map[gid] + del self.family_map[handle] else: - self.family_map.put(gid,data) - elif key == SOURCE_KEY: + self.family_map.put(handle,data) + elif key == _SOURCE_KEY: if data == None: - del self.source_map[gid] + del self.source_map[handle] else: - self.source_map.put(gid,data) - elif key == EVENT_KEY: + self.source_map.put(handle,data) + elif key == _EVENT_KEY: if data == None: - del self.event_map[gid] + del self.event_map[handle] else: - self.event_map.put(gid,data) - elif key == PLACE_KEY: + self.event_map.put(handle,data) + elif key == _PLACE_KEY: if data == None: - del self.place_map[gid] + del self.place_map[handle] else: - self.place_map.put(gid,data) - elif key == MEDIA_KEY: + self.place_map.put(handle,data) + elif key == _MEDIA_KEY: if data == None: - del self.media_map[gid] + del self.media_map[handle] else: - self.media_map.put(gid,data) + self.media_map.put(handle,data) if self.undolabel: label = self.undolabel.get_children()[0] @@ -2788,14 +2761,14 @@ class GrampsDB: def clean_bookmarks(self): """cleans up the bookmark list, removing empty slots""" new_bookmarks = [] - for person_id in self.bookmarks: - new_bookmarks.append(person_id) + for person_handle in self.bookmarks: + new_bookmarks.append(person_handle) self.bookmarks = new_bookmarks def set_researcher(self,owner): """sets the information about the owner of the database""" - self.owner.set(owner.get_name(),owner.get_address(),owner.get_city(),\ - owner.get_state(),owner.get_country(),\ + self.owner.set(owner.get_name(),owner.get_address(),owner.get_city(), + owner.get_state(),owner.get_country(), owner.get_postal_code(),owner.get_phone(),owner.get_email()) def get_researcher(self): @@ -2807,43 +2780,42 @@ class GrampsDB: """sets the default Person to the passed instance""" # if (self.default): # self.default.set_ancestor(0) - self.metadata['default'] = str(person.get_id()) + self.metadata['default'] = person.get_handle() # if person: # self.default.set_ancestor(1) - def set_default_person_id(self,gid): + def set_default_person_handle(self,handle): """sets the default Person to the passed instance""" - assert(type(gid) == types.StringType or type(gid) == types.UnicodeType) - self.metadata['default'] = gid + self.metadata['default'] = handle def get_default_person(self): """returns the default Person of the database""" if self.metadata and self.metadata.has_key('default'): person = Person() - gid = self.metadata['default'] - data = self.person_map.get(str(gid)) + handle = self.metadata['default'] + data = self.person_map.get(handle) person.unserialize(data) return person return None - def get_person(self,gid): + def get_person(self,handle): """returns a Person from a GRAMPS's ID""" p = Person() - data = self.person_map.get(str(gid)) + data = self.person_map.get(handle) p.unserialize(data) return p - def get_place_id_map(self): + def get_place_handle_map(self): """returns a map of gramps's IDs to Place instances""" return self.place_map - def set_place_id_map(self,map): + def set_place_handle_map(self,map): """sets the map of gramps's IDs to Place instances""" self.place_map = map - def get_family_id(self,gid): + def get_family_handle(self,handle): """returns a map of gramps's IDs to Family instances""" - return self.family_map.get(str(gid)) + return self.family_map.get(str(handle)) def get_save_path(self): """returns the save path of the file, or "" if one does not exist""" @@ -2856,130 +2828,84 @@ class GrampsDB: def get_person_event_types(self): """returns a list of all Event types assocated with Person instances in the database""" - map = {} -# for person in self.person_map.values(): -# for event_id in person.get_event_list(): -# event = self.event_map[event_id] -# map[event.get_name()] = 1 - return map.keys() + return [] def get_person_attribute_types(self): """returns a list of all Attribute types assocated with Person instances in the database""" - map = {} -# for key in self.person_map.keys(): -# person = self.person_map[key] -# for attr in person.get_attribute_list(): -# map[attr.get_type()] = 1 - return map.keys() + return [] def get_family_attribute_types(self): """returns a list of all Attribute types assocated with Family instances in the database""" - map = {} -# for family in self.family_map.values(): -# for attr in family.get_attribute_list(): -# map[attr.get_type()] = 1 - return map.keys() + return [] def get_family_event_types(self): """returns a list of all Event types assocated with Family instances in the database""" - map = {} -# for family in self.family_map.values(): -# for event_id in family.get_event_list(): -# event = self.event_map[event_id] -# map[event.get_name()] = 1 - return map.keys() + return [] def get_media_attribute_types(self): """returns a list of all Attribute types assocated with Media instances in the database""" - map = {} -# for media_id in self.media_map.keys(): -# mobject = self.find_object_from_id(media_id) -# for attr in mobject.get_attribute_list(): -# map[attr.get_type()] = 1 - return map.keys() + return [] - def get_place_ids(self): + def get_place_handles(self): """returns a list of Place instances""" return self.place_map.keys() def get_family_relation_types(self): """returns a list of all relationship types assocated with Family instances in the database""" - map = {} -# for family in self.family_map.values(): -# map[family.get_relationship()] = 1 - return map.keys() + return [] - def remove_person_id(self,gid,transaction): -# self.genderStats.uncount_person (self.person_map[gid]) + def remove_person_handle(self,handle,transaction): +# self.genderStats.uncount_person (self.person_map[handle]) if transaction != None: - old_data = self.person_map.get(str(gid)) - transaction.add(PERSON_KEY,gid,old_data) - self.person_map.delete(str(gid)) + old_data = self.person_map.get(handle) + transaction.add(_PERSON_KEY,handle,old_data) + self.person_map.delete(handle) - def remove_source_id(self,gid,transaction): + def remove_source_handle(self,handle,transaction): if transaction != None: - old_data = self.source_map.get(str(gid)) - transaction.add(SOURCE_KEY,gid,old_data) - self.source_map.delete(str(gid)) + old_data = self.source_map.get(str(handle)) + transaction.add(_SOURCE_KEY,handle,old_data) + self.source_map.delete(str(handle)) - def remove_event_id(self,gid,transaction): + def remove_event_handle(self,handle,transaction): if transaction != None: - old_data = self.event_map.get(str(gid)) - transaction.add(EVENT_KEY,gid,old_data) - self.event_map.delete(str(gid)) + old_data = self.event_map.get(str(handle)) + transaction.add(_EVENT_KEY,handle,old_data) + self.event_map.delete(str(handle)) def add_person_as(self,person,trans): if trans != None: - trans.add(PERSON_KEY, person.get_id(),None) - self.person_map.put(str(person.get_id()),person.serialize()) + trans.add(_PERSON_KEY, person.get_handle(),None) + self.person_map.put(person.get_handle(),person.serialize()) # self.genderStats.count_person (person, self) - return person.get_id() + return person.get_handle() def add_person(self,person,trans): """adds a Person to the database, assigning a gramps' ID""" - person.set_gramps_id(self.find_next_gid()) - person.set_id(Utils.create_id()) + person.set_gramps_id(self.find_next_gramps_id()) + person.set_handle(Utils.create_id()) if trans != None: - trans.add(PERSON_KEY, person.get_id(),None) - self.person_map.put(str(person.get_id()),person.serialize()) + trans.add(_PERSON_KEY, person.get_handle(),None) + self.person_map.put(person.get_handle(),person.serialize()) self.genderStats.count_person (person, self) - return person.get_id() + return person.get_handle() - def find_person(self,gid,map,trans): - """finds a Person in the database using the gid and map - variables to translate between the external ID and gramps' - internal ID. If no such Person exists, a new Person instance - is created. + def has_person_handle(self,val): + return self.person_map.get(val) - gid - external ID number - map - map build by findPerson of external to gramp's IDs""" - - gid = str(gid) - person = Person() - if map.has_key(gid): - person.unserialize(self.person_map.get(str(map[gid]))) - else: - person = Person() - map[gid] = self.add_person(person,trans) - self.genderStats.count_person (person, self) - return person - - def has_person_id(self,val): - return self.person_map.get(str(val)) - - def has_family_id(self,val): + def has_family_handle(self,val): return self.family_map.get(str(val)) - def try_to_find_person_from_id(self,val): + def try_to_find_person_from_handle(self,val): """finds a Person in the database from the passed gramps' ID. If no such Person exists, a new Person is added to the database.""" - data = self.person_map.get(str(val)) + data = self.person_map.get(val) if data: person = Person() person.unserialize(data) @@ -2991,7 +2917,7 @@ class GrampsDB: """finds a Person in the database from the passed gramps' ID. If no such Person exists, a new Person is added to the database.""" - data = self.idtrans.get(str(val)) + data = self.id_trans.get(str(val)) if data: person = Person() person.unserialize(cPickle.loads(data)) @@ -3004,42 +2930,41 @@ class GrampsDB: If no such Person exists, a new Person is added to the database.""" person = Person() - data = self.idtrans.get(str(val)) + data = self.id_trans.get(str(val)) if data: person.unserialize(cPickle.loads(data)) else: intid = Utils.create_id() - person.set_id(intid) + person.set_handle(intid) person.set_gramps_id(val) self.add_person_as(person,trans) return person - def find_person_from_id(self,val,trans): + def find_person_from_handle(self,val,trans): """finds a Person in the database from the passed gramps' ID. If no such Person exists, a new Person is added to the database.""" person = Person() - data = self.person_map.get(str(val)) + data = self.person_map.get(val) if data: person.unserialize(data) else: - person.set_id(val) + person.set_handle(val) if trans != None: - trans.add(PERSON_KEY, val, None) - self.person_map.put(str(val), person.serialize()) + trans.add(_PERSON_KEY, val, None) + self.person_map.put(val, person.serialize()) # self.genderStats.count_person (person, self) return person - def add_person_no_map(self,person,gid,trans): + def add_person_no_map(self,person,handle,trans): """adds a Person to the database if the gramps' ID is known""" - gid = str(gid) - person.set_id(gid) + person.set_handle(handle) if trans != None: - trans.add(PERSON_KEY, gid, None) - self.person_map.set(str(gid),person.serialize()) + trans.add(_PERSON_KEY, handle, None) + self.person_map.set(handle,person.serialize()) # self.genderStats.count_person (person, self) - return gid + return handle def add_source(self,source,trans): """adds a Source instance to the database, assigning it a gramps' @@ -3049,9 +2974,9 @@ class GrampsDB: while self.source_map.get(str(index)): self.smap_index = self.smap_index + 1 index = self.sprefix % self.smap_index - source.set_id(index) + source.set_handle(index) if trans != None: - trans.add(SOURCE_KEY,index,None) + trans.add(_SOURCE_KEY,index,None) self.source_map.put(str(index),source.serialize()) self.smap_index = self.smap_index + 1 return index @@ -3063,67 +2988,67 @@ class GrampsDB: while self.event_map.get(str(index)): self.emap_index += 1 index = self.eprefix % self.emap_index - event.set_id(index) + event.set_handle(index) if trans != None: - trans.add(EVENT_KEY,index,None) + trans.add(_EVENT_KEY,index,None) self.event_map.put(str(index),event.serialize()) self.emap_index += 1 return index def add_source_no_map(self,source,index,trans): """adds a Source to the database if the gramps' ID is known""" - source.set_id(index) + source.set_handle(index) if trans != None: - trans.add(SOURCE_KEY,index,None) + trans.add(_SOURCE_KEY,index,None) self.source_map.put(str(index),source.serialize()) self.smap_index = self.smap_index + 1 return index def add_event_no_map(self,event,index,trans): """adds a Source to the database if the gramps' ID is known""" - event.set_id(index) + event.set_handle(index) if trans != None: - trans.add(EVENT_KEY,index,None) + trans.add(_EVENT_KEY,index,None) self.event_map.put(str(index),event.serialize()) self.emap_index += 1 return index - def find_source(self,gid,map,trans): - """finds a Source in the database using the gid and map + def find_source(self,handle,map,trans): + """finds a Source in the database using the handle and map variables to translate between the external ID and gramps' internal ID. If no such Source exists, a new Source instance is created. - gid - external ID number + handle - external ID number map - map build by find_source of external to gramp's IDs""" - if map.has_key(gid): - data = self.source_map.get(str(map[gid])) + if map.has_key(handle): + data = self.source_map.get(str(map[handle])) source = Source() source.unserialize(data) else: source = Source() - map[gid] = self.add_source(source,trans) + map[handle] = self.add_source(source,trans) return source - def find_event(self,gid,map,trans): - """finds a Event in the database using the gid and map + def find_event(self,handle,map,trans): + """finds a Event in the database using the handle and map variables to translate between the external ID and gramps' internal ID. If no such Event exists, a new Event instance is created. - gid - external ID number + handle - external ID number map - map build by find_source of external to gramp's IDs""" event = Event() - if map.has_key(gid): - data = self.event_map.get(str(map[gid])) - event.serialize(data) + if map.has_key(handle): + data = self.event_map.get(str(map[handle])) + event.unserialize(data) else: - map[gid] = self.add_event(event,trans) + map[handle] = self.add_event(event,trans) return event - def try_to_find_source_from_id(self,val): + def try_to_find_source_from_handle(self,val): """finds a Source in the database from the passed gramps' ID. If no such Source exists, None is returned.""" @@ -3135,7 +3060,7 @@ class GrampsDB: else: return None - def find_source_from_id(self,val,trans): + def find_source_from_handle(self,val,trans): """finds a Source in the database from the passed gramps' ID. If no such Source exists, a new Source is added to the database.""" @@ -3146,7 +3071,7 @@ class GrampsDB: self.add_source_no_map(source,val,trans) return source - def find_event_from_id(self,val): + def find_event_from_handle(self,val): """finds a Family in the database from the passed gramps' ID. If no such Family exists, a new Family is added to the database.""" data = self.event_map.get(str(val)) @@ -3165,69 +3090,51 @@ class GrampsDB: while self.media_map.get(str(index)): self.omap_index = self.omap_index + 1 index = self.oprefix % self.omap_index - object.set_id(index) + object.set_handle(index) if trans != None: - trans.add(MEDIA_KEY,index,None) + trans.add(_MEDIA_KEY,index,None) self.media_map.put(str(index),object.serialize()) self.omap_index = self.omap_index + 1 self.added_files.append(object) return index - def find_object(self,gid,map,trans): - """finds an Object in the database using the gid and map + def find_object_no_conflicts(self,handle,map,trans): + """finds an Object in the database using the handle and map variables to translate between the external ID and gramps' internal ID. If no such Object exists, a new Object instance is created. - gid - external ID number + handle - external ID number map - map build by find_object of external to gramp's IDs""" - gid = str(gid) - + handle = str(handle) object = MediaObject() - if map.has_key(gid): - object.unserialize(self.media_map.get(str(map[gid]))) + if map.has_key(handle): + object.unserialize(self.media_map.get(str(map[handle]))) else: - map[gid] = self.add_object(object,trans) - return object - - def find_object_no_conflicts(self,gid,map,trans): - """finds an Object in the database using the gid and map - variables to translate between the external ID and gramps' - internal ID. If no such Object exists, a new Object instance - is created. - - gid - external ID number - map - map build by find_object of external to gramp's IDs""" - - gid = str(gid) - object = MediaObject() - if map.has_key(gid): - object.unserialize(self.media_map.get(str(map[gid]))) - else: - if self.media_map.get(str(gid)): - map[gid] = self.add_object(object,trans) + if self.media_map.get(str(handle)): + map[handle] = self.add_object(object,trans) else: - map[gid] = self.add_object_no_map(object,gid,trans) + map[handle] = self.add_object_no_map(object,handle,trans) return object def add_object_no_map(self,object,index,trans): """adds an Object to the database if the gramps' ID is known""" index = str(index) - object.set_id(index) + object.set_handle(index) if trans != None: - trans.add(MEDIA_KEY,index,None) + trans.add(_MEDIA_KEY,index,None) self.media_map.put(str(index),object.serialize()) self.omap_index = self.omap_index + 1 self.added_files.append(object) return index - def try_to_find_object_from_id(self,gid): + def try_to_find_object_from_handle(self,handle): """finds an Object in the database from the passed gramps' ID. If no such Object exists, None is returned.""" - data = self.media_map.get(str(gid)) + data = self.media_map.get(str(handle)) if data: mobject = MediaObject() mobject.unserialize(data) @@ -3235,22 +3142,22 @@ class GrampsDB: else: return None - def find_object_from_id(self,gid,trans): + def find_object_from_handle(self,handle,trans): """finds an Object in the database from the passed gramps' ID. If no such Object exists, a new Object is added to the database.""" object = MediaObject() - if self.media_map.get(str(gid)): - object.unserialize(self.media_map.get(str(gid))) + if self.media_map.get(str(handle)): + object.unserialize(self.media_map.get(str(handle))) else: - self.add_object_no_map(object,gid,trans) + self.add_object_no_map(object,handle,trans) return object - def has_object_id(self,gid): + def has_object_handle(self,handle): """finds an Object in the database from the passed gramps' ID. If no such Source exists, a new Source is added to the database.""" - return self.media_map.get(str(gid)) != None + return self.media_map.get(str(handle)) != None def add_place(self,place,trans): """adds a Place instance to the database, assigning it a gramps' @@ -3260,86 +3167,86 @@ class GrampsDB: while self.place_map.get(str(index)): self.lmap_index = self.lmap_index + 1 index = self.pprefix % self.lmap_index - place.set_id(index) + place.set_handle(index) if trans != None: - trans.add(PLACE_KEY,index,None) + trans.add(_PLACE_KEY,index,None) self.place_map.put(str(index),place.serialize()) self.lmap_index = self.lmap_index + 1 return index - def remove_object(self,gid,transaction): + def remove_object(self,handle,transaction): if transaction != None: - old_data = self.media_map.get(str(gid)) - transaction.add(MEDIA_KEY,gid,old_data) - self.media_map.delete(str(gid)) + old_data = self.media_map.get(str(handle)) + transaction.add(_MEDIA_KEY,handle,old_data) + self.media_map.delete(str(handle)) - def remove_place(self,gid,transaction): + def remove_place(self,handle,transaction): if transaction != None: - old_data = self.place_map.get(str(gid)) - transaction.add(PLACE_KEY,gid,old_data) - self.place_map.delete(str(gid)) + old_data = self.place_map.get(str(handle)) + transaction.add(_PLACE_KEY,handle,old_data) + self.place_map.delete(str(handle)) def add_place_as(self,place,trans): if trans != None: - trans.add(PLACE_KEY,place.get_id(),None) - self.place_map.put(str(place.get_id()),place.serialize()) - return place.get_id() + trans.add(_PLACE_KEY,place.get_handle(),None) + self.place_map.put(str(place.get_handle()),place.serialize()) + return place.get_handle() - def find_place_no_conflicts(self,gid,map,trans): - """finds a Place in the database using the gid and map + def find_place_no_conflicts(self,handle,map,trans): + """finds a Place in the database using the handle and map variables to translate between the external ID and gramps' internal ID. If no such Place exists, a new Place instance is created. - gid - external ID number + handle - external ID number map - map build by findPlace of external to gramp's IDs""" - if map.has_key(str(gid)): + if map.has_key(str(handle)): place = Place() - data = self.place_map[str(map[gid])] + data = self.place_map[str(map[handle])] place.unserialize(data) else: place = Place() - if self.place_map.has_key(str(gid)): - map[gid] = self.add_place(place,trans) + if self.place_map.has_key(str(handle)): + map[handle] = self.add_place(place,trans) else: - place.set_id(str(gid)) - map[str(gid)] = self.add_place_as(place,trans) - self.place_map.put(str(gid),place.serialize()) + place.set_handle(str(handle)) + map[str(handle)] = self.add_place_as(place,trans) + self.place_map.put(str(handle),place.serialize()) return place def add_place_no_map(self,place,index,trans): """adds a Place to the database if the gramps' ID is known""" index = str(index) - place.set_id(index) + place.set_handle(index) if trans != None: - trans.add(PLACE_KEY,index,None) + trans.add(_PLACE_KEY,index,None) self.place_map.put(str(index), place.serialize()) self.lmap_index = self.lmap_index + 1 return index - def find_place_from_id(self,gid,trans): + def find_place_from_handle(self,handle,trans): """finds a Place in the database from the passed gramps' ID. If no such Place exists, a new Place is added to the database.""" - data = self.place_map.get(str(gid)) + data = self.place_map.get(str(handle)) place = Place() if not data: - place.id = gid + place.handle = handle if trans != None: - trans.add(PLACE_KEY,gid,None) - self.place_map.put(str(gid),place.serialize()) + trans.add(_PLACE_KEY,handle,None) + self.place_map.put(str(handle),place.serialize()) self.lmap_index = self.lmap_index + 1 else: place.unserialize(data) return place - def try_to_find_place_from_id(self,gid): + def try_to_find_place_from_handle(self,handle): """finds a Place in the database from the passed gramps' ID. If no such Place exists, None is returned.""" - data = self.place_map.get(str(gid)) + data = self.place_map.get(str(handle)) if data: place = Place() @@ -3388,13 +3295,13 @@ class GrampsDB: else: return [] - def get_place_id_keys(self): + def get_place_handle_keys(self): if self.place_map: return self.place_map.keys() else: return [] - def get_place_id(self,key): + def get_place_handle(self,key): place = Place() place.unserialize(self.place_map.get(str(key))) return place @@ -3453,40 +3360,40 @@ class GrampsDB: index = self.fprefix % self.fmap_index self.fmap_index = self.fmap_index + 1 family = Family() - family.set_id(unicode(index)) + family.set_handle(unicode(index)) if trans != None: - trans.add(FAMILY_KEY, index, None) + trans.add(_FAMILY_KEY, index, None) self.family_map.put(str(index),family.serialize()) return family - def new_family_no_map(self,gid,trans): + def new_family_no_map(self,handle,trans): """finds a Family in the database from the passed gramps' ID. If no such Family exists, a new Family is added to the database.""" family = Family() - family.set_id(gid) + family.set_handle(handle) if trans != None: - trans.add(FAMILY_KEY, gid, None) - self.family_map.put(str(gid),family.serialize()) + trans.add(_FAMILY_KEY, handle, None) + self.family_map.put(str(handle),family.serialize()) self.fmap_index = self.fmap_index + 1 return family - def find_family_with_map(self,gid,map,trans): - """finds a Family in the database using the gid and map + def find_family_with_map(self,handle,map,trans): + """finds a Family in the database using the handle and map variables to translate between the external ID and gramps' internal ID. If no such Family exists, a new Family instance is created. - gid - external ID number + handle - external ID number map - map build by find_family_with_map of external to gramp's IDs""" - if map.has_key(gid): + if map.has_key(handle): family = Family() - data = self.family_map.get(str(map[gid])) + data = self.family_map.get(str(map[handle])) family.unserialize(data) else: family = self.new_family(trans) - map[gid] = family.get_id() + map[handle] = family.get_handle() return family def find_family_no_map(self,val,trans): @@ -3498,14 +3405,14 @@ class GrampsDB: if data: family.unserialize(data) else: - family.id = val + family.handle = val if trans: - trans.add(FAMILY_KEY,val,None) + trans.add(_FAMILY_KEY,val,None) self.family_map.put(str(val),family.serialize()) self.fmap_index = self.fmap_index + 1 return family - def find_family_from_id(self,val): + def find_family_from_handle(self,val): """finds a Family in the database from the passed gramps' ID. If no such Family exists, a new Family is added to the database.""" data = self.family_map.get(str(val)) @@ -3516,51 +3423,51 @@ class GrampsDB: else: return None - def delete_family(self,family_id,trans): + def delete_family(self,family_handle,trans): """deletes the Family instance from the database""" - if self.family_map.get(str(family_id)): + if self.family_map.get(str(family_handle)): if trans != None: - old_data = self.family_map.get(str(family_id)) - trans.add(FAMILY_KEY,family_id,old_data) - self.family_map.delete(str(family_id)) + old_data = self.family_map.get(str(family_handle)) + trans.add(_FAMILY_KEY,family_handle,old_data) + self.family_map.delete(str(family_handle)) - def find_family_no_conflicts(self,gid,map,trans): - """finds a Family in the database using the gid and map + def find_family_no_conflicts(self,handle,map,trans): + """finds a Family in the database using the handle and map variables to translate between the external ID and gramps' internal ID. If no such Family exists, a new Family instance is created. - gid - external ID number + handle - external ID number map - map build by findFamily of external to gramp's IDs""" - if map.has_key(str(gid)): + if map.has_key(str(handle)): family = Family() - family.unserialize(self.family_map.get(str(map[str(gid)]))) + family.unserialize(self.family_map.get(str(map[str(handle)]))) else: - if self.family_map.has_key(str(gid)): + if self.family_map.has_key(str(handle)): family = self.new_family(trans) else: - family = self.new_family_no_map(str(gid),trans) - map[gid] = family.get_id() + family = self.new_family_no_map(str(handle),trans) + map[handle] = family.get_handle() return family - def find_source_no_conflicts(self,gid,map,trans): - """finds a Source in the database using the gid and map + def find_source_no_conflicts(self,handle,map,trans): + """finds a Source in the database using the handle and map variables to translate between the external ID and gramps' internal ID. If no such Source exists, a new Source instance is created. - gid - external ID number + handle - external ID number map - map build by findSource of external to gramp's IDs""" source = Source() - if map.has_key(gid): - source.unserialize(self.source_map.get(str(map[gid]))) + if map.has_key(handle): + source.unserialize(self.source_map.get(str(map[handle]))) else: - if self.source_map.get(str(gid)): - map[gid] = self.add_source(source,trans) + if self.source_map.get(str(handle)): + map[handle] = self.add_source(source,trans) else: - map[gid] = self.add_source(source,trans) + map[handle] = self.add_source(source,trans) return source def set_column_order(self,list): @@ -3640,8 +3547,8 @@ class Transaction: def set_description(self,msg): self.msg = msg - def add(self, type, gid, data): - self.last = self.db.append(cPickle.dumps((type,gid,data),1)) + def add(self, type, handle, data): + self.last = self.db.append(cPickle.dumps((type,handle,data),1)) if self.first == None: self.first = self.last @@ -3658,35 +3565,35 @@ class Transaction: def display(self): for record in self.get_recnos(): - (key,gid,val) = self.get_record(record) - if key == PERSON_KEY: + (key,handle,val) = self.get_record(record) + if key == _PERSON_KEY: if val: - print "PERSON %s change" % gid + print "PERSON %s change" % handle else: - print "PERSON %s remove" % gid - elif key == FAMILY_KEY: + print "PERSON %s remove" % handle + elif key == _FAMILY_KEY: if val: - print "FAMILY %s change" % gid + print "FAMILY %s change" % handle else: - print "FAMILY %s remove" % gid - elif key == EVENT_KEY: + print "FAMILY %s remove" % handle + elif key == _EVENT_KEY: if val: - print "EVENT %s change" % gid + print "EVENT %s change" % handle else: - print "EVENT %s remove" % gid - elif key == SOURCE_KEY: + print "EVENT %s remove" % handle + elif key == _SOURCE_KEY: if val: - print "SOURCE %s change" % gid + print "SOURCE %s change" % handle else: - print "SOURCE %s remove" % gid - elif key == MEDIA_KEY: + print "SOURCE %s remove" % handle + elif key == _MEDIA_KEY: if val: - print "MEDIA %s change" % gid + print "MEDIA %s change" % handle else: - print "MEDIA %s remove" % gid - elif key == PLACE_KEY: + print "MEDIA %s remove" % handle + elif key == _PLACE_KEY: if val: - print "PLACE %s change" % gid + print "PLACE %s change" % handle else: - print "PLACE %s remove" % gid + print "PLACE %s remove" % handle diff --git a/src/Relationship.py b/src/Relationship.py index 5d2114cb5..bff9444cc 100644 --- a/src/Relationship.py +++ b/src/Relationship.py @@ -166,14 +166,14 @@ class RelationshipCalculator: def apply_filter(self,person,index,plist,pmap): if person == None: return - plist.append(person.get_id()) - pmap[person.get_id()] = index + plist.append(person.get_handle()) + pmap[person.get_handle()] = index - family_id = person.get_main_parents_family_id() - family = self.db.find_family_from_id(family_id) + family_handle = person.get_main_parents_family_handle() + family = self.db.find_family_from_handle(family_handle) if family != None: - father = self.db.try_to_find_person_from_id(family.get_father_id()) - mother = self.db.try_to_find_person_from_id(family.get_mother_id()) + father = self.db.try_to_find_person_from_handle(family.get_father_handle()) + mother = self.db.try_to_find_person_from_handle(family.get_mother_handle()) self.apply_filter(father,index+1,plist,pmap) self.apply_filter(mother,index+1,plist,pmap) @@ -238,10 +238,10 @@ class RelationshipCalculator: return _niece_level[level] def is_spouse(self,orig,other): - for f in orig.get_family_id_list(): - family = self.db.find_family_from_id(f) + for f in orig.get_family_handle_list(): + family = self.db.find_family_from_handle(f) if family: - if other == family.get_father_id() or other == family.get_mother_id(): + if other == family.get_father_handle() or other == family.get_mother_handle(): return 1 else: return 0 @@ -276,19 +276,19 @@ class RelationshipCalculator: except RuntimeError,msg: return (firstRel,secondRel,_("Relationship loop detected")) - for person_id in firstList: - if person_id in secondList: - new_rank = firstMap[person_id] + for person_handle in firstList: + if person_handle in secondList: + new_rank = firstMap[person_handle] if new_rank < rank: rank = new_rank - common = [ person_id ] + common = [ person_handle ] elif new_rank == rank: - common.append(person_id) + common.append(person_handle) if common: - person_id = common[0] - secondRel = firstMap[person_id] - firstRel = secondMap[person_id] + person_handle = common[0] + secondRel = firstMap[person_handle] + firstRel = secondMap[person_handle] return (firstRel,secondRel,common) @@ -312,7 +312,7 @@ class RelationshipCalculator: if type(common) == types.StringType or type(common) == types.UnicodeType: return (common,[]) elif common: - person_id = common[0] + person_handle = common[0] else: return ("",[]) @@ -361,7 +361,7 @@ class RelationshipCalculator: if type(common) == types.StringType or type(common) == types.UnicodeType: return (common,[]) elif common: - person_id = common[0] + person_handle = common[0] else: return ("",[]) diff --git a/src/SelectChild.py b/src/SelectChild.py index 1e1d8ac0b..814c19fb9 100644 --- a/src/SelectChild.py +++ b/src/SelectChild.py @@ -87,8 +87,8 @@ class SelectChild: self.add_child = self.xml.get_widget("childlist") if (self.family): - father = self.db.try_to_find_person_from_id(self.family.get_father_id()) - mother = self.db.try_to_find_person_from_id(self.family.get_mother_id()) + father = self.db.try_to_find_person_from_handle(self.family.get_father_handle()) + mother = self.db.try_to_find_person_from_handle(self.family.get_mother_handle()) if father != None: fname = father.get_primary_name().get_name() @@ -172,8 +172,8 @@ class SelectChild: def redraw_child_list(self,filter): return - birth = self.db.find_event_from_id(self.person.get_birth_id()) - death = self.db.find_event_from_id(self.person.get_death_id()) + birth = self.db.find_event_from_handle(self.person.get_birth_handle()) + death = self.db.find_event_from_handle(self.person.get_death_handle()) if birth: bday = birth.get_date_object() else: @@ -184,30 +184,30 @@ class SelectChild: dday = None slist = {} - for f in self.person.get_parent_family_id_list(): + for f in self.person.get_parent_family_handle_list(): if f: family = self.db.find_family_no_map(f[0]) - if family.get_father_id(): - slist[family.get_father_id()] = 1 - elif family.get_mother_id(): - slist[family.get_mother_id()] = 1 - for c in family.get_child_id_list(): + if family.get_father_handle(): + slist[family.get_father_handle()] = 1 + elif family.get_mother_handle(): + slist[family.get_mother_handle()] = 1 + for c in family.get_child_handle_list(): slist[c] = 1 person_list = [] for key in self.db.sort_person_keys(): person = self.db.get_person(key) if filter: - if slist.has_key(key) or person.get_main_parents_family_id(): + if slist.has_key(key) or person.get_main_parents_family_handle(): continue - birth_event = self.db.find_event_from_id(person.get_birth_id()) + birth_event = self.db.find_event_from_handle(person.get_birth_handle()) if birth_event: pbday = birth_event.get_date_object() else: pbday = None - death_event = self.db.find_event_from_id(person.get_death_id()) + death_event = self.db.find_event_from_handle(person.get_death_handle()) if death_event: pdday = death_event.get_date_object() else: @@ -239,7 +239,7 @@ class SelectChild: if pdday.getLowYear() > dday.getHighYear() + 150: continue - person_list.append(person.get_id()) + person_list.append(person.get_handle()) iter = None for idval in person_list: @@ -277,7 +277,7 @@ class SelectChild: id = idlist[0] select_child = self.db.get_person(id) - if self.person.get_id() == id: + if self.person.get_handle() == id: ErrorDialog(_("Error selecting a child"), _("A person cannot be linked as his/her own child"), self.top) @@ -285,33 +285,33 @@ class SelectChild: if self.family == None: self.family = self.db.new_family() - self.person.add_family_id(self.family.get_id()) + self.person.add_family_handle(self.family.get_handle()) if self.person.get_gender() == RelLib.Person.male: - self.family.set_father_id(self.person) + self.family.set_father_handle(self.person) else: - self.family.set_mother_id(self.person) + self.family.set_mother_handle(self.person) - if id in (self.family.get_father_id(),self.family.get_mother_id()): + if id in (self.family.get_father_handle(),self.family.get_mother_handle()): ErrorDialog(_("Error selecting a child"), _("A person cannot be linked as his/her own child"), self.top) return - self.family.add_child_id(select_child.get_id()) + self.family.add_child_handle(select_child.get_handle()) mrel = const.child_relations.find_value(self.mrel.get_text()) - mother = self.db.try_to_find_person_from_id(self.family.get_mother_id()) + mother = self.db.try_to_find_person_from_handle(self.family.get_mother_handle()) if mother and mother.get_gender() != RelLib.Person.female: if mrel == "Birth": mrel = "Unknown" frel = const.child_relations.find_value(self.frel.get_text()) - father = self.db.try_to_find_person_from_id(self.family.get_father_id()) + father = self.db.try_to_find_person_from_handle(self.family.get_father_handle()) if father and father.get_gender() !=RelLib. Person.male: if frel == "Birth": frel = "Unknown" - select_child.add_parent_family_id(self.family.get_id(),mrel,frel) + select_child.add_parent_family_handle(self.family.get_handle(),mrel,frel) trans = self.db.start_transaction() self.db.commit_person(select_child,trans) @@ -329,7 +329,7 @@ class SelectChild: if self.person.get_gender() == Person.male: return self.person.get_primary_name().get_surname() elif self.family: - f = self.family.get_father_id() + f = self.family.get_father_handle() if f: pname = f.get_primary_name() return (pname.get_surname_prefix(),pname.get_surname()) @@ -340,8 +340,8 @@ class SelectChild: def latin_american(self,val): if self.family: - father = self.family.get_father_id() - mother = self.family.get_mother_id() + father = self.family.get_father_handle() + mother = self.family.get_mother_handle() if not father or not mother: return ("","") fsn = father.get_primary_name().get_surname() @@ -360,7 +360,7 @@ class SelectChild: if self.person.get_gender() == Person.male: fname = self.person.get_primary_name().get_first_name() elif self.family: - f = self.family.get_father_id() + f = self.family.get_father_handle() if f: fname = f.get_primary_name().get_first_name() if fname: @@ -393,8 +393,8 @@ class EditRel: Utils.set_titles(self.top,self.xml.get_widget('title'), _('Relationships of %s') % name) - father = self.db.try_to_find_person_from_id(self.family.get_father_id()) - mother = self.db.try_to_find_person_from_id(self.family.get_mother_id()) + father = self.db.try_to_find_person_from_handle(self.family.get_father_handle()) + mother = self.db.try_to_find_person_from_handle(self.family.get_mother_handle()) if father: fname = father.get_primary_name().get_name() @@ -423,7 +423,7 @@ class EditRel: "destroy_passed_object" : self.close }) - f = self.child.has_family(self.family.get_id()) + f = self.child.has_family(self.family.get_handle()) if f: self.fentry.set_text(_(f[2])) self.mentry.set_text(_(f[1])) @@ -437,18 +437,18 @@ class EditRel: def on_ok_clicked(self,obj): mrel = const.child_relations.find_value(self.mentry.get_text()) - mother = self.db.try_to_find_person_from_id(self.family.get_mother_id()) + mother = self.db.try_to_find_person_from_handle(self.family.get_mother_handle()) if mother and mother.get_gender() != RelLib.Person.female: if mrel == "Birth": mrel = "Unknown" frel = const.child_relations.find_value(self.fentry.get_text()) - father = self.db.try_to_find_person_from_id(self.family.get_father_id()) + father = self.db.try_to_find_person_from_handle(self.family.get_father_handle()) if father and father.get_gender() !=RelLib. Person.male: if frel == "Birth": frel = "Unknown" - self.child.change_parent_family_id(self.family.get_id(),mrel,frel) + self.child.change_parent_family_handle(self.family.get_handle(),mrel,frel) trans = self.db.start_transaction() self.db.commit_person(self.child,trans) n = self.child.get_primary_name().get_regular_name() diff --git a/src/SelectObject.py b/src/SelectObject.py index f90f9038f..e66da9770 100644 --- a/src/SelectObject.py +++ b/src/SelectObject.py @@ -74,7 +74,7 @@ class SelectObject: self.top = self.glade.get_widget('select_object') title_label = self.glade.get_widget('object_title') self.object_tree = self.glade.get_widget('object_tree') - self.object_id = self.glade.get_widget('object_id') + self.object_handle = self.glade.get_widget('object_handle') self.object_type = self.glade.get_widget('object_type') self.object_desc = self.glade.get_widget('object_desc') self.object_path = self.glade.get_widget('object_path') @@ -99,9 +99,9 @@ class SelectObject: self.object_model.new_model() for key in self.db.get_object_keys(): - object = self.db.try_to_find_object_from_id(key) + object = self.db.try_to_find_object_from_handle(key) title = object.get_description() - the_id = object.get_id() + the_id = object.get_handle() the_type = Utils.get_mime_description(object.get_mime_type()) path = object.get_path() self.object_model.add([title,the_id,the_type,path],key) @@ -116,7 +116,7 @@ class SelectObject: return data = self.object_model.get_data(iter,range(self.ncols)) the_id = data[4] - object = self.db.try_to_find_object_from_id(the_id) + object = self.db.try_to_find_object_from_handle(the_id) the_type = Utils.get_mime_description(object.get_mime_type()) path = object.get_path() @@ -130,7 +130,7 @@ class SelectObject: if not pexists: fexists = 0 - self.object_id.set_text(object.get_id()) + self.object_handle.set_text(object.get_handle()) self.object_type.set_text(the_type) self.object_desc.set_text(object.get_description()) if len(path) == 0 or fexists == 0: @@ -149,7 +149,7 @@ class SelectObject: if iter: data = self.object_model.get_data(iter,range(self.ncols)) the_id = data[4] - return_value = self.db.try_to_find_object_from_id(the_id) + return_value = self.db.try_to_find_object_from_handle(the_id) else: return_value = None self.top.destroy() diff --git a/src/Sort.py b/src/Sort.py index 3bf5fdab5..38558f941 100644 --- a/src/Sort.py +++ b/src/Sort.py @@ -79,8 +79,8 @@ class Sort: def by_last_name(self,first_id,second_id): """Sort routine for comparing two last names. If last names are equal, uses the given name and suffix""" - first = self.database.try_to_find_person_from_id(first_id) - second = self.database.try_to_find_person_from_id(second_id) + first = self.database.try_to_find_person_from_handle(first_id) + second = self.database.try_to_find_person_from_handle(second_id) name1 = first.get_primary_name() name2 = second.get_primary_name() @@ -101,18 +101,18 @@ class Sort: def by_birthdate(self,first_id,second_id): """Sort routine for comparing two people by birth dates. If the birth dates are equal, sorts by name""" - first = self.database.try_to_find_person_from_id(first_id) - second = self.database.try_to_find_person_from_id(second_id) + first = self.database.try_to_find_person_from_handle(first_id) + second = self.database.try_to_find_person_from_handle(second_id) - birth_id1 = first.get_birth_id() - if birth_id1: - date1 = self.database.find_event_from_id(birth_id1).get_date_object() + birth_handle1 = first.get_birth_handle() + if birth_handle1: + date1 = self.database.find_event_from_handle(birth_handle1).get_date_object() else: date1 = Date.Date() - birth_id2 = second.get_birth_id() - if birth_id2: - date2 = self.database.find_event_from_id(birth_id2).get_date_object() + birth_handle2 = second.get_birth_handle() + if birth_handle2: + date2 = self.database.find_event_from_handle(birth_handle2).get_date_object() else: date2 = Date.Date() @@ -125,6 +125,6 @@ class Sort: """Sort routine for comparing two events by their dates. """ if not (a_id and b_id): return 0 - a = self.database.find_event_from_id(a_id) - b = self.database.find_event_from_id(b_id) + a = self.database.find_event_from_handle(a_id) + b = self.database.find_event_from_handle(b_id) return Date.compare_dates(a.get_date_object(),b.get_date_object()) diff --git a/src/SourceView.py b/src/SourceView.py index bf9a885fe..543679ff6 100644 --- a/src/SourceView.py +++ b/src/SourceView.py @@ -197,53 +197,53 @@ class SourceView: ans.query_response,self.topWindow) else: trans = self.db.start_transaction() - self.db.remove_source_id(source.get_id(),trans) + self.db.remove_source_handle(source.get_handle(),trans) n = source.get_title() self.db.add_transaction(trans,_("Delete Source (%s)") % n) self.build_tree() def is_used(self,source): - for key in self.db.get_place_id_keys(): - p = self.db.get_place_id(key) + for key in self.db.get_place_handle_keys(): + p = self.db.get_place_handle(key) for sref in p.get_source_references(): - if sref.get_base_id() == source.get_id(): + if sref.get_base_handle() == source.get_handle(): return 1 for key in self.db.get_person_keys(): p = self.db.get_person(key) - for v_id in p.get_event_list() + [p.get_birth_id(), p.get_death_id()]: - v = self.db.find_event_from_id(v_id) + for v_id in p.get_event_list() + [p.get_birth_handle(), p.get_death_handle()]: + v = self.db.find_event_from_handle(v_id) if v: for sref in v.get_source_references(): - if sref.get_base_id() == source.get_id(): + if sref.get_base_handle() == source.get_handle(): return 1 for v in p.get_attribute_list(): for sref in v.get_source_references(): - if sref.get_base_id() == source.get_id(): + if sref.get_base_handle() == source.get_handle(): return 1 for v in p.get_alternate_names() + [p.get_primary_name()]: for sref in v.get_source_references(): - if sref.get_base_id() == source.get_id(): + if sref.get_base_handle() == source.get_handle(): return 1 for v in p.get_address_list(): for sref in v.get_source_references(): - if sref.get_base_id() == source.get_id(): + if sref.get_base_handle() == source.get_handle(): return 1 for p_id in self.db.get_object_keys(): - p = self.db.try_to_find_object_from_id(p_id) + p = self.db.try_to_find_object_from_handle(p_id) for sref in p.get_source_references(): - if sref.get_base_id() == source.get_id(): + if sref.get_base_handle() == source.get_handle(): return 1 for p_id in self.db.get_family_keys(): - p = self.db.find_family_from_id(p_id) + p = self.db.find_family_from_handle(p_id) for v_id in p.get_event_list(): - v = self.db.find_event_from_id(v_id) + v = self.db.find_event_from_handle(v_id) if v: for sref in v.get_source_references(): - if sref.get_base_id() == source.get_id(): + if sref.get_base_handle() == source.get_handle(): return 1 for v in p.get_attribute_list(): for sref in v.get_source_references(): - if sref.get_base_id() == source.get_id(): + if sref.get_base_handle() == source.get_handle(): return 1 return 0 diff --git a/src/Sources.py b/src/Sources.py index 83f61a43c..71c6f2aa6 100644 --- a/src/Sources.py +++ b/src/Sources.py @@ -161,10 +161,10 @@ class SourceSelector: def redraw(self): self.model.clear() for s in self.list: - base_id = s.get_base_id() - base = self.db.try_to_find_source_from_id(base_id) + base_handle = s.get_base_handle() + base = self.db.try_to_find_source_from_handle(base_handle) iter = self.model.append() - self.model.set(iter,0,base_id,1,base.get_title()) + self.model.set(iter,0,base_handle,1,base.get_title()) def src_ok_clicked(self,obj): del self.orig[:] @@ -242,10 +242,10 @@ class SourceTab: def redraw(self): self.model.clear() for s in self.list: - base_id = s.get_base_id() + base_handle = s.get_base_handle() iter = self.model.append() - base = self.db.try_to_find_source_from_id(base_id) - self.model.set(iter,0,base_id,1,base.get_title()) + base = self.db.try_to_find_source_from_handle(base_handle) + self.model.set(iter,0,base_handle,1,base.get_title()) if self.list: Utils.bold_label(self.parent.sources_label) else: @@ -335,7 +335,7 @@ class SourceEditor: self.pub_field = self.get_widget("spubinfo") if self.source_ref: - self.active_source = self.db.try_to_find_source_from_id(self.source_ref.get_base_id()) + self.active_source = self.db.try_to_find_source_from_handle(self.source_ref.get_base_handle()) else: self.active_source = None @@ -416,7 +416,7 @@ class SourceEditor: scom = self.get_widget("scomment") scom.get_buffer().set_text(self.source_ref.get_comments()) - src = self.db.try_to_find_source_from_id(self.source_ref.get_base_id()) + src = self.db.try_to_find_source_from_handle(self.source_ref.get_base_handle()) self.active_source = src if src: self.author_field.set_text(src.get_author()) @@ -432,8 +432,8 @@ class SourceEditor: self.list = [] self.active_source = sel for src_id in keys: - src = self.db.try_to_find_source_from_id(src_id) - l = gtk.Label("%s [%s]" % (src.get_title(),src.get_id())) + src = self.db.try_to_find_source_from_handle(src_id) + l = gtk.Label("%s [%s]" % (src.get_title(),src.get_handle())) l.show() l.set_alignment(0,0.5) c = gtk.ListItem() @@ -454,8 +454,8 @@ class SourceEditor: def on_sourceok_clicked(self,obj): - if self.active_source != self.db.try_to_find_source_from_id(self.source_ref.get_base_id()): - self.source_ref.set_base_id(self.active_source.get_id()) + if self.active_source != self.db.try_to_find_source_from_handle(self.source_ref.get_base_handle()): + self.source_ref.set_base_handle(self.active_source.get_handle()) date = unicode(self.get_widget("sdate").get_text()) conf = self.get_widget("conf").get_menu().get_active().get_data('a') diff --git a/src/SubstKeywords.py b/src/SubstKeywords.py index 9a77b2ca0..6fbaa4ed8 100644 --- a/src/SubstKeywords.py +++ b/src/SubstKeywords.py @@ -65,10 +65,10 @@ class SubstKeywords: $M -> Place of preferred marriage """ - def __init__(self,database,person_id): + def __init__(self,database,person_handle): """Creates a new object and associates a person with it.""" - person = database.try_to_find_person_from_id(person_id) + person = database.try_to_find_person_from_handle(person_handle) self.n = person.get_primary_name().get_regular_name() self.N = person.get_primary_name().get_name() self.b = "" @@ -80,46 +80,46 @@ class SubstKeywords: self.m = "" self.M = "" - birth_id = person.get_birth_id() - if birth_id: - birth = database.find_event_from_id(birth_id) + birth_handle = person.get_birth_handle() + if birth_handle: + birth = database.find_event_from_handle(birth_handle) self.b = birth.get_date() - bplace_id = birth.get_place_id() - if bplace_id: - self.B = database.try_to_find_place_from_id(bplace_id).get_title() - death_id = person.get_death_id() - if death_id: - death = database.find_event_from_id(death_id) + bplace_handle = birth.get_place_handle() + if bplace_handle: + self.B = database.try_to_find_place_from_handle(bplace_handle).get_title() + death_handle = person.get_death_handle() + if death_handle: + death = database.find_event_from_handle(death_handle) self.d = death.get_date() - dplace_id = death.get_place_id() - if dplace_id: - self.D = database.try_to_find_place_from_id(dplace_id).get_title() - self.i = str(person_id) + dplace_handle = death.get_place_handle() + if dplace_handle: + self.D = database.try_to_find_place_from_handle(dplace_handle).get_title() + self.i = str(person_handle) - if person.get_family_id_list(): - f_id = person.get_family_id_list()[0] - f = database.find_family_from_id(f_id) - father_id = f.get_father_id() - mother_id = f.get_mother_id() - if father_id == person_id: - if mother_id: - mother = database.try_to_find_person_from_id(mother_id) + if person.get_family_handle_list(): + f_id = person.get_family_handle_list()[0] + f = database.find_family_from_handle(f_id) + father_handle = f.get_father_handle() + mother_handle = f.get_mother_handle() + if father_handle == person_handle: + if mother_handle: + mother = database.try_to_find_person_from_handle(mother_handle) self.s = mother.get_primary_name().get_regular_name() self.S = mother.get_primary_name().get_name() else: - if father_id: - father = database.try_to_find_person_from_id(father_id) + if father_handle: + father = database.try_to_find_person_from_handle(father_handle) self.s = father.get_primary_name().get_regular_name() self.S = father.get_primary_name().get_name() for e_id in f.get_event_list(): if not e_id: continue - e = database.find_event_from_id(e_id) + e = database.find_event_from_handle(e_id) if e.get_name() == 'Marriage': self.m = e.get_date() - mplace_id = e.get_place_id() - if mplace_id: - self.M = database.try_to_find_place_from_id(mplace_id).get_title() + mplace_handle = e.get_place_handle() + if mplace_handle: + self.M = database.try_to_find_place_from_handle(mplace_handle).get_title() def replace(self,line): """Returns a new line of text with the substitutions performed.""" diff --git a/src/Utils.py b/src/Utils.py index a77d04c4b..19aae49a3 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -121,10 +121,10 @@ def upper_name(person): def family_name(family,db): """Builds a name for the family from the parents names""" - father_id = family.get_father_id() - mother_id = family.get_mother_id() - father = db.try_to_find_person_from_id(father_id) - mother = db.try_to_find_person_from_id(mother_id) + father_handle = family.get_father_handle() + mother_handle = family.get_mother_handle() + father = db.try_to_find_person_from_handle(father_handle) + mother = db.try_to_find_person_from_handle(mother_handle) if father and mother: fname = father.get_primary_name().get_name() mname = mother.get_primary_name().get_name() @@ -137,10 +137,10 @@ def family_name(family,db): def family_upper_name(family,db): """Builds a name for the family from the parents names""" - father_id = family.get_father_id() - mother_id = family.get_mother_id() - father = db.try_to_find_person_from_id(father_id) - mother = db.try_to_find_person_from_id(mother_id) + father_handle = family.get_father_handle() + mother_handle = family.get_mother_handle() + father = db.try_to_find_person_from_handle(father_handle) + mother = db.try_to_find_person_from_handle(mother_handle) if father and mother: fname = father.get_primary_name().get_upper_name() mname = mother.get_primary_name().get_upper_name() @@ -341,7 +341,7 @@ def thumb_path(dir,mobj): type = mobj.get_mime_type() if type[0:5] == "image": - thumb = "%s/.thumb/%s.jpg" % (os.path.dirname(dir),mobj.get_id()) + thumb = "%s/.thumb/%s.jpg" % (os.path.dirname(dir),mobj.get_handle()) try: if RelImage.check_thumb(mobj.get_path(),thumb,const.thumbScale): return thumb @@ -419,7 +419,7 @@ def for_each_ancestor(start, func, data): doneIds = {} while len(todo): p = todo.pop() - pid = p.get_id() + pid = p.get_handle() # Don't process the same Id twice. This can happen # if there is a cycle in the database, or if the # initial list contains X and some of X's ancestors. @@ -428,9 +428,9 @@ def for_each_ancestor(start, func, data): doneIds[pid] = 1 if func(data,pid): return 1 - for fam, mrel, frel in p.get_parent_family_id_list(): - f = fam.get_father_id() - m = fam.get_mother_id() + for fam, mrel, frel in p.get_parent_family_handle_list(): + f = fam.get_father_handle() + m = fam.get_mother_handle() if f: todo.append(f) if m: todo.append(m) return 0 diff --git a/src/Witness.py b/src/Witness.py index 9416b6d27..2b98f2f75 100644 --- a/src/Witness.py +++ b/src/Witness.py @@ -69,8 +69,8 @@ class WitnessTab: for s in self.list: if s.get_type() == RelLib.Event.ID: id = s.get_value() - if self.db.has_person_id(id): - n = self.db.try_to_find_person_from_id(id).get_primary_name().get_name() + if self.db.has_person_handle(id): + n = self.db.try_to_find_person_from_handle(id).get_primary_name().get_name() else: n = _('Unknown') self.model.add([n,s.get_value()],s) @@ -149,7 +149,7 @@ class WitnessEditor: if self.ref.get_type(): self.in_db.set_active(1) self.idval = self.ref.get_value() - person = self.db.try_to_find_person_from_id(self.idval) + person = self.db.try_to_find_person_from_handle(self.idval) self.name.set_text(person.get_primary_name().get_regular_name()) else: self.name.set_text(self.ref.get_value()) @@ -197,7 +197,7 @@ class WitnessEditor: new_person = sel_person.run() if new_person: self.new_person = new_person - self.idval = new_person.get_id() + self.idval = new_person.get_handle() new_name = new_person.get_primary_name().get_regular_name() if new_name: self.name.set_text(new_name) diff --git a/src/WriteXML.py b/src/WriteXML.py index a4d26f557..f7302923e 100644 --- a/src/WriteXML.py +++ b/src/WriteXML.py @@ -202,7 +202,7 @@ class XmlWriter: person_len = self.db.get_number_of_people() family_len = len(familyList) source_len = len(self.db.get_source_keys()) - place_len = len(self.db.get_place_id_keys()) + place_len = len(self.db.get_place_handle_keys()) objList = self.db.get_object_keys() total = person_len + family_len + place_len + source_len @@ -236,7 +236,7 @@ class XmlWriter: self.g.write(" \n") keys = self.db.get_person_keys() @@ -264,12 +264,12 @@ class XmlWriter: self.dump_name("aka",name,3) self.write_line("nick",person.get_nick_name(),3) - birth = self.db.find_event_from_id(person.get_birth_id()) - death = self.db.find_event_from_id(person.get_death_id()) + birth = self.db.find_event_from_handle(person.get_birth_handle()) + death = self.db.find_event_from_handle(person.get_death_handle()) self.dump_my_event("Birth",birth,3) self.dump_my_event("Death",death,3) - for event_id in person.get_event_list(): - event = self.db.find_event_from_id(event_id) + for event_handle in person.get_event_list(): + event = self.db.find_event_from_handle(event_handle) self.dump_event(event,3) self.dump_ordinance("baptism",person.get_lds_baptism(),3) @@ -297,7 +297,7 @@ class XmlWriter: self.write_attribute_list(person.get_attribute_list()) self.write_url_list(person.get_url_list()) - for alt in person.get_parent_family_id_list(): + for alt in person.get_parent_family_handle_list(): if alt[1] != "Birth": mrel=' mrel="%s"' % alt[1] else: @@ -309,7 +309,7 @@ class XmlWriter: self.g.write(" \n" % \ (alt[0], mrel, frel)) - for family in person.get_family_id_list(): + for family in person.get_family_handle_list(): self.write_ref("parentin",family,3) self.write_note("note",person.get_note_object(),3) @@ -324,25 +324,25 @@ class XmlWriter: familyList.sort () for key in self.db.get_family_keys(): - family = self.db.find_family_from_id(key) + family = self.db.find_family_from_handle(key) if self.callback and count % delta == 0: self.callback(float(count)/float(total)) count = count + 1 - self.write_family_id(family,2) - fid = family.get_father_id() - mid = family.get_mother_id() + self.write_family_handle(family,2) + fid = family.get_father_handle() + mid = family.get_mother_handle() self.write_ref("father",fid,3) self.write_ref("mother",mid,3) - for event_id in family.get_event_list(): - event = self.db.find_event_from_id(event_id) + for event_handle in family.get_event_list(): + event = self.db.find_event_from_handle(event_handle) self.dump_event(event,3) self.dump_ordinance("sealed_to_spouse",family.get_lds_sealing(),3) self.write_media_list(family.get_media_list()) - if len(family.get_child_id_list()) > 0: - for person in family.get_child_id_list(): + if len(family.get_child_handle_list()) > 0: + for person in family.get_child_handle_list(): self.write_ref("child",person,3) self.write_attribute_list(family.get_attribute_list()) self.write_note("note",family.get_note_object(),3) @@ -360,7 +360,7 @@ class XmlWriter: if self.callback and count % delta == 0: self.callback(float(count)/float(total)) count = count + 1 - self.g.write(" \n") + self.g.write(" \n") self.write_force_line("stitle",source.get_title(),3) self.write_line("sauthor",source.get_author(),3) self.write_line("spubinfo",source.get_publication_info(),3) @@ -373,11 +373,11 @@ class XmlWriter: if place_len > 0: self.g.write(" \n") - keys = self.db.get_place_id_keys() + keys = self.db.get_place_handle_keys() keys.sort () for key in keys: try: - place = self.db.get_place_id(key) + place = self.db.get_place_handle(key) if self.callback and count % delta == 0: self.callback(float(count)/float(total)) self.write_place_obj(place) @@ -391,14 +391,14 @@ class XmlWriter: self.g.write(" \n") objList.sort () for key in self.db.get_object_keys(): - object = self.db.try_to_find_object_from_id(key) + object = self.db.try_to_find_object_from_handle(key) self.write_object(object) self.g.write(" \n") if len(self.db.get_bookmarks()) > 0: self.g.write(" \n") - for person_id in self.db.get_bookmarks(): - self.g.write(' \n' % person_id) + for person_handle in self.db.get_bookmarks(): + self.g.write(' \n' % person_handle) self.g.write(" \n") self.g.write("\n") @@ -471,7 +471,7 @@ class XmlWriter: self.write_date(event.get_date_object(),index+1) self.write_witness(event.get_witness_list(),index+1) - self.write_ref("place",event.get_place_id(),index+1) + self.write_ref("place",event.get_place_handle(),index+1) self.write_line("cause",event.get_cause(),index+1) self.write_line("description",event.get_description(),index+1) if event.get_note(): @@ -494,11 +494,11 @@ class XmlWriter: self.write_date(dateobj,index+1) if ord.get_temple(): self.g.write('%s\n' % (sp2,self.fix(ord.get_temple()))) - self.write_ref("place",ord.get_place_id(),index+1) + self.write_ref("place",ord.get_place_handle(),index+1) if ord.get_status() != 0: self.g.write('%s\n' % (sp2,ord.get_status())) - if ord.get_family_id(): - self.g.write('%s\n' % (sp2,self.fix(ord.get_family_id().get_id()))) + if ord.get_family_handle(): + self.g.write('%s\n' % (sp2,self.fix(ord.get_family_handle().get_handle()))) if ord.get_note() != "": self.write_note("note",ord.get_note_object(),index+1) for s in ord.get_source_references(): @@ -506,7 +506,7 @@ class XmlWriter: self.g.write('%s\n' % sp) def dump_source_ref(self,source_ref,index=1): - source = self.db.try_to_find_source_from_id(source_ref.get_base_id()) + source = self.db.try_to_find_source_from_handle(source_ref.get_base_handle()) if source: p = source_ref.get_page() c = source_ref.get_comments() @@ -515,12 +515,12 @@ class XmlWriter: q = source_ref.get_confidence_level() self.g.write(" " * index) if p == "" and c == "" and t == "" and d.is_empty() and q == 2: - self.g.write('\n' % source.get_id()) + self.g.write('\n' % source.get_handle()) else: if q == 2: - self.g.write('\n' % source.get_id()) + self.g.write('\n' % source.get_handle()) else: - self.g.write('\n' % (source.get_id(),q)) + self.g.write('\n' % (source.get_handle(),q)) self.write_line("spage",p,index+1) self.write_text("scomments",c,index+1) self.write_text("stext",t,index+1) @@ -533,18 +533,18 @@ class XmlWriter: def write_id(self,label,person,index=1): if person: - self.g.write('%s<%s id="%s"' % (" "*index,label,person.get_id())) + self.g.write('%s<%s id="%s"' % (" "*index,label,person.get_handle())) comp = person.get_complete() if comp: self.g.write(' complete="1"') self.g.write('>\n') - def write_family_id(self,family,index=1): + def write_family_handle(self,family,index=1): if family: rel = family.get_relationship() comp = family.get_complete() sp = " " * index - self.g.write('%s\n") def write_object(self,object): - id = object.get_id() + id = object.get_handle() type = object.get_mime_type() path = object.get_path() if self.strip_photos: @@ -792,8 +792,8 @@ class XmlWriter: # #------------------------------------------------------------------------- def sortById(first,second): - fid = first.get_id() - sid = second.get_id() + fid = first.get_handle() + sid = second.get_handle() if fid < sid: return -1 diff --git a/src/calendars/Makefile.in b/src/calendars/Makefile.in index b47b0287e..a95a34901 100644 --- a/src/calendars/Makefile.in +++ b/src/calendars/Makefile.in @@ -64,6 +64,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/src/data/Makefile.in b/src/data/Makefile.in index f54587450..9aba8dfe6 100644 --- a/src/data/Makefile.in +++ b/src/data/Makefile.in @@ -70,6 +70,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ @@ -142,13 +146,13 @@ dist_pkgdata_DATA = gedcom.xml \ papersize.xml \ tips.xml \ gnome-mime-application-x-gramps.png \ - gnome-mime-application-x-gedcom.png \ + gnome-mime-application-x-gedcom.png \ gnome-mime-application-x-gramps-package.png \ gramps.applications \ gramps.desktop \ gramps.svg \ gramps.keys \ - gramps.mime + gramps.mime EXTRA_DIST = $(dist_pkgdata_DATA) all: all-recursive @@ -458,7 +462,12 @@ uninstall-info: uninstall-info-recursive uninstall-info-am uninstall-local -install-data-local: +install-schemas: + $(INSTALL_DATA) gramps.schemas $(DESTDIR)/etc/gconf/schemas + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \ + gconftool-2 --makefile-install-rule gramps.schemas + +install-data-local: install-schemas $(INSTALL) -d $(DESTDIR)$(prefix)/share/gnome/apps/Applications $(INSTALL_DATA) gramps.desktop $(DESTDIR)$(prefix)/share/applications $(INSTALL) -d $(DESTDIR)$(prefix)/share/icons/gnome/48x48/mimetypes/ @@ -477,6 +486,9 @@ uninstall-local: -rm $(DESTDIR)$(prefix)/share/mime-info/gramps.keys -rm $(DESTDIR)$(prefix)/share/mime-info/gramps.mime -rm $(DESTDIR)$(prefix)/share/mime/packages/gramps.xml + -rm $(DESTDIR)/etc/gconf/schemas/gramps.schemas + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \ + gconftool-2 --makefile-uninstall-rule gramps.schemas # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/src/data/gramps.schemas b/src/data/gramps.schemas index 708e9f258..8cf0db346 100644 --- a/src/data/gramps.schemas +++ b/src/data/gramps.schemas @@ -196,8 +196,8 @@ - /schemas/apps/gramps/behavior/id-edit - /apps/gramps/behavior/id-edit + /schemas/apps/gramps/index-visible + /apps/gramps/index-visible gramps bool 0 diff --git a/src/data/templates/Makefile.in b/src/data/templates/Makefile.in index 47eea40c8..8b044b4db 100644 --- a/src/data/templates/Makefile.in +++ b/src/data/templates/Makefile.in @@ -60,6 +60,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/src/docgen/Makefile.in b/src/docgen/Makefile.in index 5bfc3fc5b..b4a7d97c5 100644 --- a/src/docgen/Makefile.in +++ b/src/docgen/Makefile.in @@ -64,6 +64,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/src/gramps_main.py b/src/gramps_main.py index fe1de63a2..4b2574ea1 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -344,8 +344,6 @@ class Gramps: "on_family_activate" : self.on_family_activate, "on_family1_activate" : self.on_family1_activate, "on_family2_activate" : self.on_family2_activate, -# "on_find_activate" : self.on_find_activate, -# "on_findname_activate" : self.on_findname_activate, "on_home_clicked" : self.on_home_clicked, "on_new_clicked" : self.on_new_clicked, "on_notebook1_switch_page" : self.on_views_switch_page, @@ -385,7 +383,6 @@ class Gramps: self.enable_sidebar(GrampsCfg.get_view()) self.find_place = None - self.find_person = None self.find_source = None self.find_media = None @@ -405,7 +402,7 @@ class Gramps: def undo(self,*args): self.db.undo() if self.active_person: - p = self.db.try_to_find_person_from_id(self.active_person.get_id()) + p = self.db.try_to_find_person_from_handle(self.active_person.get_handle()) self.change_active_person(p) self.place_view.change_db(self.db) self.people_view.change_db(self.db) @@ -523,7 +520,7 @@ class Gramps: person = self.db.get_person(pid) item = gtk.MenuItem("_%d. %s [%s]" % (num,person.get_primary_name().get_name(),pid)) - item.connect("activate",self.bookmark_callback,person.get_id()) + item.connect("activate",self.bookmark_callback,person.get_handle()) item.show() gomenu.append(item) num = num + 1 @@ -552,7 +549,7 @@ class Gramps: hotkey = "_%s" % chr(ord('a')+num-11) elif num >= 21: break - person = self.db.try_to_find_person_from_id(pid) + person = self.db.try_to_find_person_from_handle(pid) item = gtk.MenuItem("%s. %s [%s]" % (hotkey,person.get_primary_name().get_name(),pid)) item.connect("activate",self.back_clicked,num) @@ -703,6 +700,7 @@ class Gramps: Plugins.PluginStatus() def on_sidebar_activate(self,obj): + self.enable_sidebar(obj.get_active()) GrampsCfg.save_view(obj.get_active()) def enable_sidebar(self,val): @@ -784,51 +782,6 @@ class Gramps: self.filter_list.connect('changed',self.on_filter_name_changed) self.filter_text.set_sensitive(0) - def on_find_activate(self,obj): - """Display the find box""" - if self.views.get_current_page() == PLACE_VIEW: - if self.find_place: - self.find_place.show() - else: - self.find_place = Find.FindPlace(self.find_goto_place,self.db) - elif self.views.get_current_page() == SOURCE_VIEW: - if self.find_source: - self.find_source.show() - else: - Find.FindSource(self.find_goto_source,self.db) - elif self.views.get_current_page() == MEDIA_VIEW: - if self.find_media: - self.find_media.show() - else: - Find.FindMedia(self.find_goto_media,self.db) - else: - if self.find_person: - self.find_person.show() - else: - self.find_person = Find.FindPerson(self.find_goto_person,self.db,None) - - def on_findname_activate(self,obj): - """Display the find box""" - pass - - def find_goto_person(self,id): - """Find callback to jump to the selected person""" - self.change_active_person(id) - self.goto_active_person() - self.update_display(0) - - def find_goto_place(self,id): - """Find callback to jump to the selected place""" - self.place_view.goto(id) - - def find_goto_source(self,id): - """Find callback to jump to the selected source""" - self.source_view.goto(id) - - def find_goto_media(self,row): - """Find callback to jump to the selected media""" - self.media_view.goto(row) - def home_page_activate(self,obj): gnome.url_show(_HOMEPAGE) @@ -926,16 +879,14 @@ class Gramps: try: gnome.help_display('gramps-manual','index') except gobject.GError, msg: - ErrorDialog(_("Could not open help"), - str(msg)) + ErrorDialog(_("Could not open help"),str(msg)) def on_faq_activate(self,obj): """Display FAQ""" try: gnome.help_display('gramps-manual','faq') except gobject.GError, msg: - ErrorDialog(_("Could not open help"), - str(msg)) + ErrorDialog(_("Could not open help"),str(msg)) def on_new_clicked(self,obj): """Prompt for permission to close the current database""" @@ -999,16 +950,6 @@ class Gramps: str(msg)) self.dbopen_button = self.dbopen_fs.run() - def auto_save_load(self,filename): - filename = os.path.normpath(os.path.abspath(filename)) - if os.path.isdir(filename): - dirname = filename - else: - dirname = os.path.dirname(filename) - - self.active_person = None - return self.read_file(filename) - def read_gedcom(self,filename): import ReadGedcom @@ -1123,32 +1064,32 @@ class Gramps: #------------------------------------------------------------------------- def remove_clicked(): # File is lost => remove all references and the object itself - mobj = self.db.try_to_find_object_from_id(ObjectId) - for p in self.db.get_family_id_map().values(): + mobj = self.db.try_to_find_object_from_handle(ObjectId) + for p in self.db.get_family_handle_map().values(): nl = p.get_media_list() for o in nl: - if o.get_reference_id() == ObjectId: + if o.get_reference_handle() == ObjectId: nl.remove(o) p.set_media_list(nl) for key in self.db.get_person_keys(): p = self.db.get_person(key) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == ObjectId: + if o.get_reference_handle() == ObjectId: nl.remove(o) p.set_media_list(nl) for key in self.db.get_source_keys(): p = self.db.get_source(key) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == ObjectId: + if o.get_reference_handle() == ObjectId: nl.remove(o) p.set_media_list(nl) - for key in self.db.get_place_id_keys(): - p = self.db.get_place_id(key) + for key in self.db.get_place_handle_keys(): + p = self.db.get_place_handle(key) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == ObjectId: + if o.get_reference_handle() == ObjectId: nl.remove(o) p.set_media_list(nl) @@ -1179,13 +1120,13 @@ class Gramps: name = choose.get_filename() if os.path.isfile(name): RelImage.import_media_object(name,filename,base) - object = self.db.try_to_find_object_from_id(ObjectId) + object = self.db.try_to_find_object_from_handle(ObjectId) object.set_path(name) choose.destroy() #------------------------------------------------------------------------- for ObjectId in self.db.get_object_keys(): - object = self.db.try_to_find_object_from_id(ObjectId) + object = self.db.try_to_find_object_from_handle(ObjectId) if 0: oldfile = object.get_path() (base,ext) = os.path.splitext(os.path.basename(oldfile)) @@ -1218,7 +1159,7 @@ class Gramps: def load_selected_people(self,obj): """Display the selected people in the EditPerson display""" mlist = self.people_view.get_selected_objects() - if mlist and self.active_person.get_id() == mlist[0]: + if mlist and self.active_person.get_handle() == mlist[0]: self.load_person(self.active_person) def load_active_person(self,obj): @@ -1240,7 +1181,7 @@ class Gramps: if cpage == PERSON_VIEW: mlist = self.people_view.get_selected_objects() else: - mlist = [ self.active_person.get_id() ] + mlist = [ self.active_person.get_handle() ] for sel in mlist: p = self.db.get_person(sel) @@ -1266,43 +1207,43 @@ class Gramps: if self.db.get_default_person() == self.active_person: self.db.set_default_person(None) - for family_id in self.active_person.get_family_id_list(): - if not family_id: + for family_handle in self.active_person.get_family_handle_list(): + if not family_handle: continue - family = self.db.find_family_from_id(family_id) - if self.active_person.get_id() == family.get_father_id(): - if family.get_mother_id() == None: - for child_id in family.get_child_id_list(): - child = self.db.try_to_find_person_from_id(child_id) - child.remove_parent_family_id(family.get_id()) + family = self.db.find_family_from_handle(family_handle) + if self.active_person.get_handle() == family.get_father_handle(): + if family.get_mother_handle() == None: + for child_handle in family.get_child_handle_list(): + child = self.db.try_to_find_person_from_handle(child_handle) + child.remove_parent_family_handle(family.get_handle()) self.db.commit_person(child,trans) - self.db.delete_family(family.get_id(),trans) + self.db.delete_family(family.get_handle(),trans) else: - family.set_father_id(None) + family.set_father_handle(None) else: - if family.get_father_id() == None: - for child_id in family.get_child_id_list(): - child = self.db.try_to_find_person_from_id(child_id) - child.remove_parent_family_id(family) + if family.get_father_handle() == None: + for child_handle in family.get_child_handle_list(): + child = self.db.try_to_find_person_from_handle(child_handle) + child.remove_parent_family_handle(family) self.db.commit_person(child,trans) self.db.delete_family(family,trans) else: - family.set_mother_id(None) + family.set_mother_handle(None) self.db.commit_family(family,trans) - for (family_id,mrel,frel) in self.active_person.get_parent_family_id_list(): - if family_id: - family = self.db.find_family_from_id(family_id) - family.remove_child_id(self.active_person.get_id()) + for (family_handle,mrel,frel) in self.active_person.get_parent_family_handle_list(): + if family_handle: + family = self.db.find_family_from_handle(family_handle) + family.remove_child_handle(self.active_person.get_handle()) self.db.commit_family(family,trans) - id = self.active_person.get_id() + id = self.active_person.get_handle() self.people_view.remove_from_person_list(self.active_person) self.people_view.remove_from_history(id) - self.db.remove_person_id(id, trans) + self.db.remove_person_handle(id, trans) if self.hindex >= 0: - self.active_person = self.db.try_to_find_person_from_id(self.history[self.hindex]) + self.active_person = self.db.try_to_find_person_from_handle(self.history[self.hindex]) else: self.change_active_person(None) self.db.add_transaction(trans,_("Delete Person (%s)") % n) @@ -1326,16 +1267,16 @@ class Gramps: self.active_person = None self.modify_statusbar() elif self.active_person == None or \ - person.get_id() != self.active_person.get_id(): - self.active_person = self.db.try_to_find_person_from_id(person.get_id()) + person.get_handle() != self.active_person.get_handle(): + self.active_person = self.db.try_to_find_person_from_handle(person.get_handle()) self.modify_statusbar() self.set_buttons(1) if person: if self.hindex+1 < len(self.history): self.history = self.history[0:self.hindex+1] - self.history.append(person.get_id()) - self.mhistory.append(person.get_id()) + self.history.append(person.get_handle()) + self.mhistory.append(person.get_handle()) self.hindex += 1 self.redraw_histmenu() @@ -1353,7 +1294,7 @@ class Gramps: self.backbtn.set_sensitive(0) self.back.set_sensitive(0) else: - self.active_person = self.db.try_to_find_person_from_id(person.get_id()) + self.active_person = self.db.try_to_find_person_from_handle(person.get_handle()) self.set_buttons(1) def modify_statusbar(self): @@ -1482,10 +1423,10 @@ class Gramps: def new_after_edit(self,epo,trans): if epo: - if epo.person.get_id() == "": + if epo.person.get_handle() == "": self.db.add_person(epo.person,trans) else: - self.db.add_person_no_map(epo.person,epo.person.get_id(),trans) + self.db.add_person_no_map(epo.person,epo.person.get_handle(),trans) self.change_active_person(epo.person) self.people_view.add_to_person_list(epo.person) if self.views.get_current_page() in [FAMILY_VIEW1,FAMILY_VIEW2]: @@ -1503,7 +1444,7 @@ class Gramps: self.people_view.redisplay_person_list(epo.person) else: iter = self.people_view.person_model.get_iter((0,)) - id = epo.person.get_id() + id = epo.person.get_handle() path = self.people_view.person_model.on_get_path(id) self.people_view.person_model.row_changed(path,iter) self.update_display(0) @@ -1619,7 +1560,7 @@ class Gramps: def on_add_bookmark_activate(self,obj): if self.active_person: - self.bookmarks.add(self.active_person.get_id()) + self.bookmarks.add(self.active_person.get_handle()) name = GrampsCfg.get_nameof()(self.active_person) self.status_text(_("%s has been bookmarked") % name) gtk.timeout_add(5000,self.modify_statusbar) @@ -1631,9 +1572,9 @@ class Gramps: def on_edit_bookmarks_activate(self,obj): self.bookmarks.edit() - def bookmark_callback(self,obj,person_id): + def bookmark_callback(self,obj,person_handle): old_person = self.active_person - person = self.db.try_to_find_person_from_id(person_id) + person = self.db.try_to_find_person_from_handle(person_handle) try: self.change_active_person(person) self.update_display(0) diff --git a/src/plugins/AncestorChart.py b/src/plugins/AncestorChart.py index ff8066067..638d07b75 100644 --- a/src/plugins/AncestorChart.py +++ b/src/plugins/AncestorChart.py @@ -89,18 +89,18 @@ class AncestorChart: self.standalone = 0 self.calc() - def filter(self,person_id,index): + def filter(self,person_handle,index): """traverse the ancestors recursively until either the end of a line is found, or until we reach the maximum number of generations that we want to deal with""" - if (not person_id) or (index >= 2**self.max_generations): + if (not person_handle) or (index >= 2**self.max_generations): return - self.map[index] = person_id + self.map[index] = person_handle self.text[index] = [] - subst = SubstKeywords(self.database,person_id) + subst = SubstKeywords(self.database,person_handle) for line in self.display: self.text[index].append(subst.replace(line)) @@ -111,12 +111,12 @@ class AncestorChart: self.lines = max(self.lines,len(self.text[index])) - person = self.database.try_to_find_person_from_id(person_id) - family_id = person.get_main_parents_family_id() - if family_id: - family = self.database.find_family_from_id(family_id) - self.filter(family.get_father_id(),index*2) - self.filter(family.get_mother_id(),(index*2)+1) + person = self.database.try_to_find_person_from_handle(person_handle) + family_handle = person.get_main_parents_family_handle() + if family_handle: + family = self.database.find_family_from_handle(family_handle) + self.filter(family.get_father_handle(),index*2) + self.filter(family.get_mother_handle(),(index*2)+1) def write_report(self): @@ -146,7 +146,7 @@ class AncestorChart: that and the page dimensions, calculate the proper place to put the elements on a page. """ - self.filter(self.start.get_id(),1) + self.filter(self.start.get_handle(),1) self.height = self.lines*pt2cm((125.0*self.font.get_size())/100.0) self.box_width = pt2cm(self.box_width+20) @@ -305,10 +305,10 @@ def report(database,person): _style_file = "ancestor_chart.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _max_gen = 10 _disp_format = [ "$n", "%s $b" % _BORN, "%s $d" % _DIED ] -_options = ( _person_id, _max_gen, _disp_format ) +_options = ( _person_handle, _max_gen, _disp_format ) #------------------------------------------------------------------------ # @@ -381,7 +381,7 @@ class AncestorChartBareDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), self.max_gen, self.report_text ) + self.options = ( self.person.get_handle(), self.max_gen, self.report_text ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ diff --git a/src/plugins/AncestorChart2.py b/src/plugins/AncestorChart2.py index 4a35b4e32..7d30c1cf1 100644 --- a/src/plugins/AncestorChart2.py +++ b/src/plugins/AncestorChart2.py @@ -193,7 +193,7 @@ class AncestorChart: self.font = self.doc.style_list["AC2-Normal"].get_font() self.tfont = self.doc.style_list["AC2-Title"].get_font() - self.filter(self.start.get_id(),1) + self.filter(self.start.get_handle(),1) keys = self.map.keys() keys.sort() @@ -204,18 +204,18 @@ class AncestorChart: self.genchart.set(key,self.map[key]) self.calc() - def filter(self,person_id,index): + def filter(self,person_handle,index): """traverse the ancestors recursively until either the end of a line is found, or until we reach the maximum number of generations that we want to deal with""" - if (not person_id) or (index >= 2**self.max_generations): + if (not person_handle) or (index >= 2**self.max_generations): return - self.map[index] = person_id + self.map[index] = person_handle self.text[index] = [] - subst = SubstKeywords(self.database,person_id) + subst = SubstKeywords(self.database,person_handle) for line in self.display: self.text[index].append(subst.replace(line)) @@ -225,12 +225,12 @@ class AncestorChart: self.lines = max(self.lines,len(self.text[index])) - person = self.database.try_to_find_person_from_id(person_id) - family_id = person.get_main_parents_family_id() - if family_id: - family = self.database.find_family_from_id(family_id) - self.filter(family.get_father_id(),index*2) - self.filter(family.get_mother_id(),(index*2)+1) + person = self.database.try_to_find_person_from_handle(person_handle) + family_handle = person.get_main_parents_family_handle() + if family_handle: + family = self.database.find_family_from_handle(family_handle) + self.filter(family.get_father_handle(),index*2) + self.filter(family.get_mother_handle(),(index*2)+1) def write_report(self): @@ -528,13 +528,13 @@ def report(database,person): _style_file = "ancestor_chart2.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _max_gen = 10 _disp_format = [ "$n", "%s $b" % _BORN, "%s $d" % _DIED ] _compress = 1 _scale = 1 _title = "" -_options = ( _person_id, _max_gen, _disp_format, _title, _compress, _scale) +_options = ( _person_handle, _max_gen, _disp_format, _title, _compress, _scale) #------------------------------------------------------------------------ # @@ -658,7 +658,7 @@ class AncestorChartBareDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), self.max_gen, self.report_text, + self.options = ( self.person.get_handle(), self.max_gen, self.report_text, self.the_title, self.do_compress, self.do_scale ) self.style_name = self.selected_style.get_name() diff --git a/src/plugins/AncestorReport.py b/src/plugins/AncestorReport.py index cd43fcc96..4f6976650 100644 --- a/src/plugins/AncestorReport.py +++ b/src/plugins/AncestorReport.py @@ -64,24 +64,24 @@ class AncestorReport(Report.Report): else: self.standalone = 0 - def filter(self,person_id,index,generation=1): - if not person_id or generation >= self.max_generations: + def filter(self,person_handle,index,generation=1): + if not person_handle or generation >= self.max_generations: return - self.map[index] = person_id + self.map[index] = person_handle - person = self.database.try_to_find_person_from_id(person_id) - family_id = person.get_main_parents_family_id() - if family_id: - family = self.database.find_family_from_id(family_id) - self.filter(family.get_father_id(),index*2,generation+1) - self.filter(family.get_mother_id(),(index*2)+1,generation+1) + person = self.database.try_to_find_person_from_handle(person_handle) + family_handle = person.get_main_parents_family_handle() + if family_handle: + family = self.database.find_family_from_handle(family_handle) + self.filter(family.get_father_handle(),index*2,generation+1) + self.filter(family.get_mother_handle(),(index*2)+1,generation+1) def write_report(self): if self.newpage: self.doc.page_break() - self.filter(self.start.get_id(),1) + self.filter(self.start.get_handle(),1) name = self.start.get_primary_name().get_regular_name() self.doc.start_paragraph("AHN-Title") @@ -104,8 +104,8 @@ class AncestorReport(Report.Report): generation = generation + 1 self.doc.start_paragraph("AHN-Entry","%s." % str(key)) - person_id = self.map[key] - person = self.database.try_to_find_person_from_id(person_id) + person_handle = self.map[key] + person = self.database.try_to_find_person_from_handle(person_handle) name = person.get_primary_name().get_regular_name() self.doc.start_bold() @@ -118,18 +118,18 @@ class AncestorReport(Report.Report): # Check birth record - birth_id = person.get_birth_id() - if birth_id: - birth = self.database.find_event_from_id(birth_id) + birth_handle = person.get_birth_handle() + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle) date = birth.get_date_object().get_start_date() - place_id = birth.get_place_id() - if place_id: - place = self.database.try_to_find_place_from_id(place_id).get_title() + place_handle = birth.get_place_handle() + if place_handle: + place = self.database.try_to_find_place_from_handle(place_handle).get_title() else: place = u'' if place[-1:] == '.': place = place[:-1] - if date.get_date() != "" or place_id: + if date.get_date() != "" or place_handle: if date.get_date() != "": if date.get_day_valid() and date.get_month_valid(): if place != "": @@ -148,23 +148,23 @@ class AncestorReport(Report.Report): self.doc.write_text(t) buried = None - for event_id in person.get_event_list(): - event = self.database.find_event_from_id(event_id) + for event_handle in person.get_event_list(): + event = self.database.find_event_from_handle(event_handle) if string.lower(event.get_name()) == "burial": buried = event - death_id = person.get_death_id() - if death_id: - death = self.database.find_event_from_id(death_id) + death_handle = person.get_death_handle() + if death_handle: + death = self.database.find_event_from_handle(death_handle) date = death.get_date_object().get_start_date() - place_id = death.get_place_id() - if place_id: - place = self.database.try_to_find_place_from_id(place_id).get_title() + place_handle = death.get_place_handle() + if place_handle: + place = self.database.try_to_find_place_from_handle(place_handle).get_title() else: place = u'' if place[-1:] == '.': place = place[:-1] - if date.get_date() != "" or place_id: + if date.get_date() != "" or place_handle: if person.get_gender() == RelLib.Person.male: male = 1 else: @@ -202,14 +202,14 @@ class AncestorReport(Report.Report): if buried: date = buried.get_date_object().get_start_date() - place_id = buried.get_place_id() - if place_id: - place = self.database.try_to_find_place_from_id(place_id).get_title() + place_handle = buried.get_place_handle() + if place_handle: + place = self.database.try_to_find_place_from_handle(place_handle).get_title() else: place = u'' if place[-1:] == '.': place = place[:-1] - if date.get_date() != "" or place_id: + if date.get_date() != "" or place_handle: if date.get_date() != "": if date.get_day_valid() and date.get_month_valid(): if place != "": @@ -308,10 +308,10 @@ def report(database,person): _style_file = "ancestor_report.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _max_gen = 10 _pg_brk = 0 -_options = ( _person_id, _max_gen, _pg_brk ) +_options = ( _person_handle, _max_gen, _pg_brk ) #------------------------------------------------------------------------ # @@ -374,7 +374,7 @@ class AncestorBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), self.max_gen, self.pg_brk ) + self.options = ( self.person.get_handle(), self.max_gen, self.pg_brk ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ diff --git a/src/plugins/Ancestors.py b/src/plugins/Ancestors.py index e0c5ec8af..a7ac90e17 100644 --- a/src/plugins/Ancestors.py +++ b/src/plugins/Ancestors.py @@ -115,7 +115,7 @@ class ComprehensiveAncestorsReport (Report.Report): self.doc.page_break() self.sources = [] - name = self.person_name (self.start.get_id()) + name = self.person_name (self.start.get_handle()) self.doc.start_paragraph("AR-Title") title = _("Ancestors of %s") % name self.doc.write_text(title) @@ -125,11 +125,11 @@ class ComprehensiveAncestorsReport (Report.Report): self.doc.write_text (_("Generation 1")) self.doc.end_paragraph () - self.write_paragraphs (self.person (self.start.get_id(), suppress_children = 1, + self.write_paragraphs (self.person (self.start.get_handle(), suppress_children = 1, needs_name = 1)) - family_ids = [self.start.get_main_parents_family_id ()] - if len (family_ids) > 0: - self.generation (self.max_generations, family_ids, [], [self.start.get_id()]) + family_handles = [self.start.get_main_parents_family_handle ()] + if len (family_handles) > 0: + self.generation (self.max_generations, family_handles, [], [self.start.get_handle()]) if len (self.sources) > 0: self.doc.start_paragraph ("AR-Heading") @@ -137,8 +137,8 @@ class ComprehensiveAncestorsReport (Report.Report): self.doc.end_paragraph () i = 1 - for source_id in self.sources: - source = self.database.try_to_find_source_from_id(source_id) + for source_handle in self.sources: + source = self.database.try_to_find_source_from_handle(source_handle) self.doc.start_paragraph ("AR-Entry") self.doc.write_text ("[%d] %s" % (i, source.get_title ())) author = source.get_author () @@ -179,60 +179,60 @@ class ComprehensiveAncestorsReport (Report.Report): self.doc.write_text ("Call to %s with params %s" % (str (fn), str (params))) - def family (self, family_id, already_described): + def family (self, family_handle, already_described): ret = [] - family = self.database.find_family_from_id(family_id) + family = self.database.find_family_from_handle(family_handle) if not family: return ret - father_id = family.get_father_id () - mother_id = family.get_mother_id () - father = self.database.try_to_find_person_from_id(father_id) - mother = self.database.try_to_find_person_from_id(mother_id) + father_handle = family.get_father_handle () + mother_handle = family.get_mother_handle () + father = self.database.try_to_find_person_from_handle(father_handle) + mother = self.database.try_to_find_person_from_handle(mother_handle) if father: - ret.extend (self.person (father_id, - short_form = father_id in already_described, + ret.extend (self.person (father_handle, + short_form = father_handle in already_described, already_described = already_described, needs_name = not mother, from_family = family)) if mother: - ret.extend (self.person (mother_id, - short_form = mother_id in already_described, + ret.extend (self.person (mother_handle, + short_form = mother_handle in already_described, already_described = already_described, needs_name = not father, from_family = family)) - children_ids = family.get_child_id_list () + children_ids = family.get_child_handle_list () if len (children_ids): ret.append ((self.doc.start_paragraph, ['AR-ChildTitle'])) ret.append ((self.doc.write_text, [_('Their children:')])) ret.append ((self.doc.end_paragraph, [])) - for child_id in children_ids: - child = self.database.try_to_find_person_from_id(child_id) - ret.extend (self.person (child_id, suppress_children = 1, - short_form=child_id in already_described, + for child_handle in children_ids: + child = self.database.try_to_find_person_from_handle(child_handle) + ret.extend (self.person (child_handle, suppress_children = 1, + short_form=child_handle in already_described, already_described = already_described, needs_name = 1, from_family = family)) return ret - def generation (self, generations, pfamily_ids, mfamily_ids, + def generation (self, generations, pfamily_handles, mfamily_handles, already_described, thisgen = 2): - if generations > 1 and (len (pfamily_ids) + len (mfamily_ids)): + if generations > 1 and (len (pfamily_handles) + len (mfamily_handles)): people = [] - for family_id in pfamily_ids: - people.extend (self.family (family_id, already_described)) + for family_handle in pfamily_handles: + people.extend (self.family (family_handle, already_described)) - if thisgen > 2 and len (mfamily_ids): - for self.gp in [self.database.find_family_from_id(mfamily_ids[0]).get_father_id (), - self.database.find_family_from_id(mfamily_ids[0]).get_mother_id ()]: + if thisgen > 2 and len (mfamily_handles): + for self.gp in [self.database.find_family_from_handle(mfamily_handles[0]).get_father_handle (), + self.database.find_family_from_handle(mfamily_handles[0]).get_mother_handle ()]: if self.gp: break relstring = self.relationship.get_grandparents_string (self.start, - self.database.try_to_find_person_from_id(self.gp))[0] + self.database.try_to_find_person_from_handle(self.gp))[0] heading = _("%(name)s's maternal %(grandparents)s") % \ { 'name': self.first_name_or_nick (self.start), 'grandparents': relstring } @@ -240,22 +240,22 @@ class ComprehensiveAncestorsReport (Report.Report): people.append ((self.doc.write_text, [heading])) people.append ((self.doc.end_paragraph, [])) - for family_id in mfamily_ids: - people.extend (self.family (family_id, already_described)) + for family_handle in mfamily_handles: + people.extend (self.family (family_handle, already_described)) if len (people): if self.pgbrk: self.doc.page_break() self.doc.start_paragraph ("AR-Heading") - family_ids = pfamily_ids - family_ids.extend (mfamily_ids) - for self.gp in [self.database.find_family_from_id(family_ids[0]).get_father_id (), - self.database.find_family_from_id(family_ids[0]).get_mother_id ()]: + family_handles = pfamily_handles + family_handles.extend (mfamily_handles) + for self.gp in [self.database.find_family_from_handle(family_handles[0]).get_father_handle (), + self.database.find_family_from_handle(family_handles[0]).get_mother_handle ()]: if self.gp: break relstring = self.relationship.get_grandparents_string (self.start, - self.database.try_to_find_person_from_id(self.gp))[0] + self.database.try_to_find_person_from_handle(self.gp))[0] if thisgen == 2: heading = _("%(name)s's %(parents)s") % \ { 'name': self.first_name_or_nick (self.start), @@ -269,41 +269,41 @@ class ComprehensiveAncestorsReport (Report.Report): self.doc.end_paragraph () self.write_paragraphs (people) - next_pfamily_ids = [] - next_mfamily_ids = [] - for family_id in family_ids: - family = self.database.find_family_from_id(family_id) - father_id = family.get_father_id () - father = self.database.try_to_find_person_from_id(father_id) + next_pfamily_handles = [] + next_mfamily_handles = [] + for family_handle in family_handles: + family = self.database.find_family_from_handle(family_handle) + father_handle = family.get_father_handle () + father = self.database.try_to_find_person_from_handle(father_handle) if father: - already_described.append (father_id) - father_family_id = father.get_main_parents_family_id () - father_family = self.database.find_family_from_id(father_family_id) + already_described.append (father_handle) + father_family_handle = father.get_main_parents_family_handle () + father_family = self.database.find_family_from_handle(father_family_handle) if father_family: - next_pfamily_ids.append (father_family_id) + next_pfamily_handles.append (father_family_handle) - mother_id = family.get_mother_id () - mother = self.database.try_to_find_person_from_id(mother_id) + mother_handle = family.get_mother_handle () + mother = self.database.try_to_find_person_from_handle(mother_handle) if mother: - already_described.append (mother_id) - mother_family_id = mother.get_main_parents_family_id () - mother_family = self.database.find_family_from_id(mother_family_id) + already_described.append (mother_handle) + mother_family_handle = mother.get_main_parents_family_handle () + mother_family = self.database.find_family_from_handle(mother_family_handle) if mother_family: - next_mfamily_ids.append (mother_family_id) + next_mfamily_handles.append (mother_family_handle) - self.generation (generations - 1, next_pfamily_ids, - next_mfamily_ids, already_described, + self.generation (generations - 1, next_pfamily_handles, + next_mfamily_handles, already_described, thisgen + 1) - def person (self, person_id, + def person (self, person_handle, suppress_children = 0, short_form = 0, already_described = [], needs_name = 0, from_family = None): ret = [] - person = self.database.try_to_find_person_from_id(person_id) - name = self.person_name (person_id) + person = self.database.try_to_find_person_from_handle(person_handle) + name = self.person_name (person_handle) if name: photos = person.get_media_list () @@ -311,7 +311,7 @@ class ComprehensiveAncestorsReport (Report.Report): bits += self.short_occupation (person) bits += self.long_born_died (person) if not suppress_children: - bits += self.parents_of (person_id) + bits += self.parents_of (person_handle) else: bits += '.' bits += self.married_whom (person, from_family, suppress_children) @@ -326,25 +326,25 @@ class ComprehensiveAncestorsReport (Report.Report): spouse = [] if from_family: - from_family_father = from_family.get_father_id () - from_family_mother = from_family.get_mother_id () + from_family_father = from_family.get_father_handle () + from_family_mother = from_family.get_mother_handle () else: from_family_father = from_family_mother = None - for family_id in person.get_family_id_list (): - family = self.database.find_family_from_id(family_id) - for partner_id in [family.get_father_id (), - family.get_mother_id ()]: - partner = self.database.try_to_find_person_from_id(partner_id) - if partner_id == person_id or not partner: + for family_handle in person.get_family_handle_list (): + family = self.database.find_family_from_handle(family_handle) + for partner_id in [family.get_father_handle (), + family.get_mother_handle ()]: + partner = self.database.try_to_find_person_from_handle(partner_id) + if partner_id == person_handle or not partner: continue if (suppress_children or (partner != from_family_father and partner != from_family_mother)): for media_ref in partner.get_media_list ()[:1]: - object_id = media_ref.get_reference_id() - mobject = self.database.try_to_find_object_from_id(object_id) + object_handle = media_ref.get_reference_handle() + mobject = self.database.try_to_find_object_from_handle(object_handle) if mobject.get_mime_type()[0:5] == "image": spouse.append ((self.doc.add_media_object, [mobject.get_path (), @@ -376,8 +376,8 @@ class ComprehensiveAncestorsReport (Report.Report): else: ret.append ((self.doc.start_cell, ["AR-Photo"])) for media_ref in photos[:1]: - object_id = media_ref.get_reference_id() - mobject = self.database.try_to_find_object_from_id(object_id) + object_handle = media_ref.get_reference_handle() + mobject = self.database.try_to_find_object_from_handle(object_handle) if mobject.get_mime_type()[0:5] == "image": ret.append ((self.doc.add_media_object, [mobject.get_path (), 'left', 2, 2])) @@ -410,10 +410,10 @@ class ComprehensiveAncestorsReport (Report.Report): def short_occupation (self, person): occupation = '' - for event_id in person.get_event_list (): - if not event_id: + for event_handle in person.get_event_list (): + if not event_handle: continue - event = self.database.find_event_from_id(event_id) + event = self.database.find_event_from_handle(event_handle) if event.get_name () == 'Occupation': if occupation: return '' @@ -452,7 +452,7 @@ class ComprehensiveAncestorsReport (Report.Report): info += _(' in %(month_or_year)s') % \ {'month_or_year': dateobj.get_date ()} - placename = self.database.try_to_find_place_from_id(event.get_place_id()).get_title() + placename = self.database.try_to_find_place_from_handle(event.get_place_handle()).get_title() if placename: info += _(' in %(place)s') % {'place': placename} note = event.get_note () @@ -488,17 +488,17 @@ class ComprehensiveAncestorsReport (Report.Report): def abbrev_born_died (self, person): ret = '' - birth_id = person.get_birth_id () - if birth_id: - birth = self.database.find_event_from_id(birth_id) + birth_handle = person.get_birth_handle () + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle) date = birth.get_date () if date: ret += _(" b. %(date)s") % {'date': date} ret += self.cite_sources (birth.get_source_references ()) - death_id = person.get_death_id () - if death_id: - death = self.database.find_event_from_id(death_id) + death_handle = person.get_death_handle () + if death_handle: + death = self.database.find_event_from_handle(death_handle) date = death.get_date () if date: ret += _(" d. %(date)s)") % {'date': date} @@ -508,16 +508,16 @@ class ComprehensiveAncestorsReport (Report.Report): def long_born_died (self, person): ret = '' - birth_id = person.get_birth_id () - if birth_id: - birth = self.database.find_event_from_id(birth_id) + birth_handle = person.get_birth_handle () + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle) born_info = self.event_info (birth) if born_info: ret = ", " + _("born") + born_info - death_id = person.get_death_id() - if death_id: - death = self.database.find_event_from_id(death_id) + death_handle = person.get_death_handle() + if death_handle: + death = self.database.find_event_from_handle(death_handle) died_info = self.event_info (death) if died_info: if born_info: @@ -529,34 +529,34 @@ class ComprehensiveAncestorsReport (Report.Report): return ret - def parents_of (self, person_id): + def parents_of (self, person_handle): ret = '. ' - person = self.database.try_to_find_person_from_id(person_id) + person = self.database.try_to_find_person_from_handle(person_handle) gender = person.get_gender () - family_id = person.get_main_parents_family_id () - if family_id: - family = self.database.find_family_from_id(family_id) + family_handle = person.get_main_parents_family_handle () + if family_handle: + family = self.database.find_family_from_handle(family_handle) fathername = mothername = None - father_id = family.get_father_id () - if father_id: - #father = self.database.try_to_find_person_from_id(father_id) - fathername = self.person_name (father_id) - mother_id = family.get_mother_id () - if mother_id: - #mother = self.database.try_to_find_person_from_id(mother_id) - mothername = self.person_name (mother_id) + father_handle = family.get_father_handle () + if father_handle: + #father = self.database.try_to_find_person_from_handle(father_handle) + fathername = self.person_name (father_handle) + mother_handle = family.get_mother_handle () + if mother_handle: + #mother = self.database.try_to_find_person_from_handle(mother_handle) + mothername = self.person_name (mother_handle) - if not mother_id and not father_id: + if not mother_handle and not father_handle: pass - elif not father_id: + elif not father_handle: if gender == RelLib.Person.female: ret += _("She is the daughter of %(mother)s.") % \ {'mother': mothername} else: ret += _("He is the son of %(mother)s.") % \ {'mother': mothername} - elif not mother_id: + elif not mother_handle: if gender == RelLib.Person.female: ret += _("She is the daughter of %(father)s.") % \ {'father': fathername} @@ -609,11 +609,11 @@ class ComprehensiveAncestorsReport (Report.Report): continue self.sourcerefs.append (ref) - source_id = ref.get_base_id () - if source_id in self.sources: - ind = self.sources.index (source_id) + 1 + source_handle = ref.get_base_handle () + if source_handle in self.sources: + ind = self.sources.index (source_handle) + 1 else: - self.sources.append (source_id) + self.sources.append (source_handle) ind = len (self.sources) citation += "[%d" % ind @@ -631,8 +631,8 @@ class ComprehensiveAncestorsReport (Report.Report): return citation - def person_name (self, person_id): - person = self.database.try_to_find_person_from_id(person_id) + def person_name (self, person_handle): + person = self.database.try_to_find_person_from_handle(person_handle) primary = person.get_primary_name () name = primary.get_title () @@ -680,17 +680,17 @@ class ComprehensiveAncestorsReport (Report.Report): gender = person.get_gender () first_marriage = 1 ret = '' - for family_id in person.get_family_id_list (): - family = self.database.find_family_from_id(family_id) - mother_id = family.get_mother_id () - mother = self.database.try_to_find_person_from_id(mother_id) - for spouse_id in [family.get_father_id (), mother_id]: - spouse = self.database.try_to_find_person_from_id(spouse_id) - if spouse_id == person.get_id() or not spouse_id: + for family_handle in person.get_family_handle_list (): + family = self.database.find_family_from_handle(family_handle) + mother_handle = family.get_mother_handle () + mother = self.database.try_to_find_person_from_handle(mother_handle) + for spouse_id in [family.get_father_handle (), mother_handle]: + spouse = self.database.try_to_find_person_from_handle(spouse_id) + if spouse_id == person.get_handle() or not spouse_id: continue children = '' - childlist = family.get_child_id_list () + childlist = family.get_child_handle_list () child_count = len (childlist) if ((listing_children or family != from_family) and child_count > 0): @@ -701,8 +701,8 @@ class ComprehensiveAncestorsReport (Report.Report): child_count count = 1 - for child_id in childlist: - child = self.database.try_to_find_person_from_id(child_id) + for child_handle in childlist: + child = self.database.try_to_find_person_from_handle(child_handle) children += self.first_name_or_nick (child) children += self.cite_sources (child.get_primary_name (). get_source_references ()) @@ -714,9 +714,9 @@ class ComprehensiveAncestorsReport (Report.Report): count += 1 - for event_id in family.get_event_list(): - if event_id: - event = self.database.find_event_from_id(event_id) + for event_handle in family.get_event_list(): + if event_handle: + event = self.database.find_event_from_handle(event_handle) if event.get_name() == "Marriage": marriage = event break @@ -736,8 +736,8 @@ class ComprehensiveAncestorsReport (Report.Report): ret += self.event_info (marriage) ret += children + '.' elif (listing_children or - spouse_id == mother_id or - family_id != from_family.get_id()): + spouse_id == mother_handle or + family_handle != from_family.get_handle()): if gender == RelLib.Person.female: ret += _(' She married %(name)s') % \ {'name': self.person_name (spouse_id)} @@ -788,9 +788,9 @@ class ComprehensiveAncestorsReport (Report.Report): paras = [] names = person.get_alternate_names () - event_ids = person.get_event_list () + event_handles = person.get_event_list () addresses = person.get_address_list () - if (len (event_ids) + len (addresses) + len (names)) > 0: + if (len (event_handles) + len (addresses) + len (names)) > 0: paras.append ((self.doc.start_paragraph, ['AR-SubEntry'])) paras.append ((self.doc.write_text, [_("More about %(name)s:") % @@ -804,20 +804,20 @@ class ComprehensiveAncestorsReport (Report.Report): ': ' + name.get_regular_name ()])) paras.append ((self.doc.end_paragraph, [])) - for event_id in [person.get_birth_id (), person.get_death_id ()]: - if not event_id: + for event_handle in [person.get_birth_handle (), person.get_death_handle ()]: + if not event_handle: continue - event = self.database.find_event_from_id(event_id) + event = self.database.find_event_from_handle(event_handle) note = event.get_note () note_format = event.get_note_format () if note and (note_format != 0): paras.append ((self.doc.write_note, [note, format, 'AR-Details'])) - for event_id in event_ids: - if not event_id: + for event_handle in event_handles: + if not event_handle: continue - event = self.database.find_event_from_id(event_id) + event = self.database.find_event_from_handle(event_handle) paras.append ((self.doc.start_paragraph, ['AR-Details'])) paras.append ((self.doc.write_text, [self.event_info (event)])) paras.append ((self.doc.end_paragraph, [])) @@ -978,12 +978,12 @@ def report(database,person): _style_file = "ancestors_report.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _max_gen = 10 _pg_brk = 0 _opt_cite = 1 -_options = ( _person_id, _max_gen, _pg_brk, _opt_cite ) +_options = ( _person_handle, _max_gen, _pg_brk, _opt_cite ) #------------------------------------------------------------------------ # @@ -1057,7 +1057,7 @@ class ComprehensiveAncestorsBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), self.max_gen, self.pg_brk, self.opt_cite ) + self.options = ( self.person.get_handle(), self.max_gen, self.pg_brk, self.opt_cite ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index b2f38f7e5..8dde4dfd8 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -670,7 +670,7 @@ class BookReportSelector: item = BookItem(name) options = saved_item.get_options() if not same_db or not options[0]: - options[0] = self.person.get_id() + options[0] = self.person.get_handle() item.set_options(options) item.set_style_name(saved_item.get_style_name()) self.book.append_item(item) @@ -679,7 +679,7 @@ class BookReportSelector: if data[1] == _("Title"): data.append(_("Not Applicable")) else: - pname = self.db.try_to_find_person_from_id(options[0]) + pname = self.db.try_to_find_person_from_handle(options[0]) data.append(pname.get_primary_name().get_regular_name()) self.bk_model.add(data) @@ -701,7 +701,7 @@ class BookReportSelector: item = BookItem(data[0]) options = item.get_options() if not options[0]: - options[0] = self.person.get_id() + options[0] = self.person.get_handle() item.set_options(options) self.book.append_item(item) diff --git a/src/plugins/ChangeTypes.py b/src/plugins/ChangeTypes.py index 57b4560e6..1e282691c 100644 --- a/src/plugins/ChangeTypes.py +++ b/src/plugins/ChangeTypes.py @@ -78,12 +78,12 @@ class ChangeTypes: original = unicode(self.glade.get_widget("original_text").get_text()) new = unicode(self.glade.get_widget("new_text").get_text()) - for person_id in self.db.get_person_keys(): - person = self.db.try_to_find_person_from_id(person_id) - for event_id in person.get_event_list(): - if not event_id: + for person_handle in self.db.get_person_keys(): + person = self.db.try_to_find_person_from_handle(person_handle) + for event_handle in person.get_event_list(): + if not event_handle: continue - event = self.db.find_event_from_id(event_id) + event = self.db.find_event_from_handle(event_handle) if event.get_name() == original: event.set_name(new) modified = modified + 1 diff --git a/src/plugins/Check.py b/src/plugins/Check.py index 064e781cd..7066d0996 100644 --- a/src/plugins/Check.py +++ b/src/plugins/Check.py @@ -93,46 +93,46 @@ class CheckIntegrity: def check_for_broken_family_links(self): self.broken_links = [] - for family_id in self.db.get_family_keys(): - family = self.db.find_family_from_id(family_id) - father_id = family.get_father_id() - mother_id = family.get_mother_id() - if father_id: - father = self.db.try_to_find_person_from_id(father_id) - if mother_id: - mother = self.db.try_to_find_person_from_id(mother_id) + for family_handle in self.db.get_family_keys(): + family = self.db.find_family_from_handle(family_handle) + father_handle = family.get_father_handle() + mother_handle = family.get_mother_handle() + if father_handle: + father = self.db.try_to_find_person_from_handle(father_handle) + if mother_handle: + mother = self.db.try_to_find_person_from_handle(mother_handle) - if father_id and family_id not in father.get_family_id_list(): - self.broken_parent_links.append((father_id,family_id)) - father.add_family_id(family_id) + if father_handle and family_handle not in father.get_family_handle_list(): + self.broken_parent_links.append((father_handle,family_handle)) + father.add_family_handle(family_handle) self.db.commit_person(father,self.trans) - if mother_id and family_id not in mother.get_family_id_list(): - self.broken_parent_links.append((mother_id,family_id)) - mother.add_family_id(family_id) + if mother_handle and family_handle not in mother.get_family_handle_list(): + self.broken_parent_links.append((mother_handle,family_handle)) + mother.add_family_handle(family_handle) self.db.commit_person(mother,self.trans) - for child_id in family.get_child_id_list(): - child = self.db.try_to_find_person_from_id(child_id) - if family_id == child.get_main_parents_family_id(): + for child_handle in family.get_child_handle_list(): + child = self.db.try_to_find_person_from_handle(child_handle) + if family_handle == child.get_main_parents_family_handle(): continue - for family_type in child.get_parent_family_id_list(): - if family_type[0] == family_id: + for family_type in child.get_parent_family_handle_list(): + if family_type[0] == family_handle: break else: - family.remove_child_id(child_id) + family.remove_child_handle(child_handle) self.db.commit_family(family,self.trans) - self.broken_links.append((child_id,family_id)) + self.broken_links.append((child_handle,family_handle)) def cleanup_missing_photos(self,cl=0): missmedia_action = 0 #------------------------------------------------------------------------- def remove_clicked(): # File is lost => remove all references and the object itself - for person_id in self.db.get_family_keys(): - p = self.db.try_to_find_person_from_id(person_id) + for person_handle in self.db.get_family_keys(): + p = self.db.try_to_find_person_from_handle(person_handle) nl = p.get_media_list() changed = 0 for o in nl: - if o.get_reference_id() == ObjectId: + if o.get_reference_handle() == ObjectId: changed = 1 nl.remove(o) if changed: @@ -140,11 +140,11 @@ class CheckIntegrity: self.db.commit_person(p,self.trans) for key in self.db.get_person_keys(): - p = self.db.try_to_find_person_from_id(key) + p = self.db.try_to_find_person_from_handle(key) nl = p.get_media_list() changed = 0 for o in nl: - if o.get_reference_id() == ObjectId: + if o.get_reference_handle() == ObjectId: changed = 1 nl.remove(o) if changed: @@ -152,23 +152,23 @@ class CheckIntegrity: self.db.commit_person(p,self.trans) for key in self.db.get_source_keys(): - p = self.db.try_to_find_source_from_id(key) + p = self.db.try_to_find_source_from_handle(key) nl = p.get_media_list() changed = 0 for o in nl: - if o.get_reference_id() == ObjectId: + if o.get_reference_handle() == ObjectId: changed = 1 nl.remove(o) if changed: p.set_media_list(nl) self.db.commit_source(p,self.trans) - for key in self.db.get_place_id_keys(): - p = self.db.get_place_id(key) + for key in self.db.get_place_handle_keys(): + p = self.db.get_place_handle(key) nl = p.get_media_list() changed = 0 for o in nl: - if o.get_reference_id() == ObjectId: + if o.get_reference_handle() == ObjectId: changed = 1 nl.remove(o) if changed: @@ -207,7 +207,7 @@ class CheckIntegrity: #------------------------------------------------------------------------- for ObjectId in self.db.get_object_keys(): - obj = self.db.try_to_find_object_from_id(ObjectId) + obj = self.db.try_to_find_object_from_handle(ObjectId) photo_name = obj.get_path() if not os.path.isfile(photo_name): if cl: @@ -232,41 +232,41 @@ class CheckIntegrity: select_clicked() def cleanup_empty_families(self,automatic): - for family_id in self.db.get_family_keys(): - family = self.db.find_family_from_id(family_id) - if not family.get_father_id() and not family.get_mother_id(): - self.empty_family.append(family_id) - self.delete_empty_family(family_id) + for family_handle in self.db.get_family_keys(): + family = self.db.find_family_from_handle(family_handle) + if not family.get_father_handle() and not family.get_mother_handle(): + self.empty_family.append(family_handle) + self.delete_empty_family(family_handle) - def delete_empty_family(self,family_id): + def delete_empty_family(self,family_handle): for key in self.db.get_person_keys(): - child = self.db.try_to_find_person_from_id(key) - child.remove_parent_family_id(family_id) - child.remove_family_id(family_id) - self.db.delete_family(family_id,self.trans) + child = self.db.try_to_find_person_from_handle(key) + child.remove_parent_family_handle(family_handle) + child.remove_family_handle(family_handle) + self.db.delete_family(family_handle,self.trans) def check_parent_relationships(self): for key in self.db.get_family_keys(): - family = self.db.find_family_from_id(key) - mother_id = family.get_mother_id() - father_id = family.get_father_id() - if father_id: - father = self.db.try_to_find_person_from_id(father_id) - if mother_id: - mother = self.db.try_to_find_person_from_id(mother_id) + family = self.db.find_family_from_handle(key) + mother_handle = family.get_mother_handle() + father_handle = family.get_father_handle() + if father_handle: + father = self.db.try_to_find_person_from_handle(father_handle) + if mother_handle: + mother = self.db.try_to_find_person_from_handle(mother_handle) type = family.get_relationship() - if not father_id and not mother_id: + if not father_handle and not mother_handle: continue - elif not father_id: + elif not father_handle: if mother.get_gender() == RelLib.Person.male: - family.set_father_id(mother_id) - family.set_mother_id(None) + family.set_father_handle(mother_handle) + family.set_mother_handle(None) self.db.commit_family(family,self.trans) - elif not mother_id: + elif not mother_handle: if father.get_gender() == RelLib.Person.female: - family.set_mother_id(father_id) - family.set_father_id(None) + family.set_mother_handle(father_handle) + family.set_father_handle(None) self.db.commit_family(family,self.trans) else: fgender = father.get_gender() @@ -274,19 +274,19 @@ class CheckIntegrity: if type != "Partners": if fgender == mgender and fgender != RelLib.Person.unknown: family.set_relationship("Partners") - self.fam_rel.append(family_id) + self.fam_rel.append(family_handle) self.db.commit_family(family,self.trans) elif fgender == RelLib.Person.female or mgender == RelLib.Person.male: - family.set_father_id(mother_id) - family.set_mother_id(father_id) - self.fam_rel.append(family_id) + family.set_father_handle(mother_handle) + family.set_mother_handle(father_handle) + self.fam_rel.append(family_handle) self.db.commit_family(family,self.trans) elif fgender != mgender: family.set_relationship("Unknown") - self.fam_rel.append(family_id) + self.fam_rel.append(family_handle) if fgender == RelLib.Person.female or mgender == RelLib.Person.male: - family.set_father_id(mother_id) - family.set_mother_id(father_id) + family.set_father_handle(mother_handle) + family.set_mother_handle(father_handle) self.db.commit_family(family,self.trans) def build_report(self,cl=0): @@ -315,12 +315,12 @@ class CheckIntegrity: self.text.write(_("1 broken child/family link was fixed\n")) else: self.text.write(_("%d broken child/family links were found\n") % blink) - for (person_id,family_id) in self.broken_links: - person = self.db.try_to_find_person_from_id(person_id) - family = self.db.find_family_from_id(family_id) + for (person_handle,family_handle) in self.broken_links: + person = self.db.try_to_find_person_from_handle(person_handle) + family = self.db.find_family_from_handle(family_handle) cn = person.get_primary_name().get_name() - f = self.db.try_to_find_person_from_id(family.get_father_id()) - m = self.db.try_to_find_person_from_id(family.get_mother_id()) + f = self.db.try_to_find_person_from_handle(family.get_father_handle()) + m = self.db.try_to_find_person_from_handle(family.get_mother_handle()) if f and m: pn = _("%s and %s") % (f.get_primary_name().get_name(),\ m.get_primary_name().get_name()) @@ -338,12 +338,12 @@ class CheckIntegrity: self.text.write(_("1 broken spouse/family link was fixed\n")) else: self.text.write(_("%d broken spouse/family links were found\n") % plink) - for (person_id,family_id) in self.broken_parent_links: - person = self.db.try_to_find_person_from_id(person_id) - family = self.db.find_family_from_id(family_id) + for (person_handle,family_handle) in self.broken_parent_links: + person = self.db.try_to_find_person_from_handle(person_handle) + family = self.db.find_family_from_handle(family_handle) cn = person.get_primary_name().get_name() - f = self.db.try_to_find_person_from_id(family.get_father_id()) - m = self.db.try_to_find_person_from_id(family.get_mother_id()) + f = self.db.try_to_find_person_from_handle(family.get_father_handle()) + m = self.db.try_to_find_person_from_handle(family.get_mother_handle()) if f and m: pn = _("%s and %s") % (f.get_primary_name().get_name(),\ m.get_primary_name().get_name()) diff --git a/src/plugins/CountAncestors.py b/src/plugins/CountAncestors.py index 958b0b1c9..5dfc4a079 100644 --- a/src/plugins/CountAncestors.py +++ b/src/plugins/CountAncestors.py @@ -50,7 +50,7 @@ class CountAncestors: }) thisgen = [] allgen = [] - thisgen.append(person.get_id()) + thisgen.append(person.get_handle()) title = _("Number of ancestors of \"%s\" by generation") % person.get_primary_name().get_name() text = text + title + ':\n' thisgensize = 1 @@ -66,17 +66,17 @@ class CountAncestors: text = text + _("Generation %d has %d individuals.\n") % (gen, thisgensize) temp = thisgen thisgen = [] - for person_id in temp: - person = database.try_to_find_person_from_id(person_id) - family_id = person.get_main_parents_family_id() - if family_id: - family = database.find_family_from_id(family_id) - 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) + for person_handle in temp: + person = database.try_to_find_person_from_handle(person_handle) + family_handle = person.get_main_parents_family_handle() + if family_handle: + family = database.find_family_from_handle(family_handle) + father_handle = family.get_father_handle() + mother_handle = family.get_mother_handle() + if father_handle: + thisgen.append(father_handle) + if mother_handle: + thisgen.append(mother_handle) allgen = allgen + thisgen text = text + _("Total ancestors in generations %d to -1 is %d.\n") % (gen, len(allgen)) diff --git a/src/plugins/CustomBookText.py b/src/plugins/CustomBookText.py index 6f0fecad4..e56fc0c4c 100644 --- a/src/plugins/CustomBookText.py +++ b/src/plugins/CustomBookText.py @@ -121,12 +121,12 @@ def _make_default_style(default_style): _style_file = "custom_text.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _top_text = "" _middle_text = "" _bottom_text = "" -_options = ( _person_id, _top_text, _middle_text, _bottom_text ) +_options = ( _person_handle, _top_text, _middle_text, _bottom_text ) #------------------------------------------------------------------------ @@ -245,7 +245,7 @@ class CustomTextDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), + self.options = ( self.person.get_handle(), self.top_text, self.middle_text, self.bottom_text ) self.style_name = self.selected_style.get_name() diff --git a/src/plugins/DesGraph.py b/src/plugins/DesGraph.py index 53248952f..ad77d7678 100644 --- a/src/plugins/DesGraph.py +++ b/src/plugins/DesGraph.py @@ -96,7 +96,7 @@ class DescendantReport: self.standalone = 0 plist = self.database.get_person_keys() - self.layout = GraphLayout.DescendLine(self.database,plist,person.get_id()) + self.layout = GraphLayout.DescendLine(self.database,plist,person.get_handle()) (self.v,self.e) = self.layout.layout() self.text = {} @@ -386,9 +386,9 @@ def report(database,person): _style_file = "descendant_graph.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _disp_format = [ "$n", "%s $b" % _BORN, "%s $d" % _DIED ] -_options = ( _person_id, _disp_format ) +_options = ( _person_handle, _disp_format ) #------------------------------------------------------------------------ # @@ -459,7 +459,7 @@ class DescendantGraphBareDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), self.report_text ) + self.options = ( self.person.get_handle(), self.report_text ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ diff --git a/src/plugins/Desbrowser.py b/src/plugins/Desbrowser.py index 95180e4d1..0e8d21eec 100644 --- a/src/plugins/Desbrowser.py +++ b/src/plugins/Desbrowser.py @@ -88,7 +88,7 @@ class DesBrowse: self.tree.set_rules_hint(gtk.TRUE) self.tree.set_headers_visible(gtk.FALSE) - self.add_to_tree(None,None,self.active.get_id()) + self.add_to_tree(None,None,self.active.get_handle()) self.tree.expand_all() self.tree.connect('event',self.button_press_event) @@ -116,16 +116,16 @@ class DesBrowse: def present(self,obj): self.window.present() - def add_to_tree(self,parent_id,sib_id,person_id): + def add_to_tree(self,parent_id,sib_id,person_handle): item_id = self.model.insert_after(parent_id,sib_id) - person = self.db.try_to_find_person_from_id(person_id) + person = self.db.try_to_find_person_from_handle(person_handle) self.model.set(item_id,0,GrampsCfg.get_nameof()(person)) - self.model.set(item_id,1,person_id) + self.model.set(item_id,1,person_handle) prev_id = None - for family_id in person.get_family_id_list(): - family = self.db.find_family_from_id(family_id) - for child_id in family.get_child_id_list(): - prev_id = self.add_to_tree(item_id,prev_id,child_id) + for family_handle in person.get_family_handle_list(): + family = self.db.find_family_from_handle(family_handle) + for child_handle in family.get_child_handle_list(): + prev_id = self.add_to_tree(item_id,prev_id,child_handle) return item_id def button_press_event(self,obj,event): @@ -134,8 +134,8 @@ class DesBrowse: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: store,iter = self.tree.get_selection().get_selected() if iter: - person_id = store.get_value(iter,1) - person = self.db.try_to_find_person_from_id(person_id) + person_handle = store.get_value(iter,1) + person = self.db.try_to_find_person_from_handle(person_handle) EditPerson.EditPerson(self.parent,person,self.db,self.callback) #------------------------------------------------------------------------ diff --git a/src/plugins/DescendReport.py b/src/plugins/DescendReport.py index d3d74d5dd..ac45ae373 100644 --- a/src/plugins/DescendReport.py +++ b/src/plugins/DescendReport.py @@ -77,16 +77,16 @@ class DescendantReport: self.by_birthdate = sort.by_birthdate def dump_dates(self, person): - birth_id = person.get_birth_id() - if birth_id: - birth = self.database.find_event_from_id(birth_id).get_date_object().get_start_date() + birth_handle = person.get_birth_handle() + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle).get_date_object().get_start_date() birth_year_valid = birth.get_year_valid() else: birth_year_valid = 0 - death_id = person.get_death_id() - if death_id: - death = self.database.find_event_from_id(death_id).get_date_object().get_start_date() + death_handle = person.get_death_handle() + if death_handle: + death = self.database.find_event_from_handle(death_handle).get_date_object().get_start_date() death_year_valid = death.get_year_valid() else: death_year_valid = 0 @@ -126,14 +126,14 @@ class DescendantReport: return childlist = [] - for family_id in person.get_family_id_list(): - family = self.database.find_family_from_id(family_id) - for child_id in family.get_child_id_list(): - childlist.append(child_id) + for family_handle in person.get_family_handle_list(): + family = self.database.find_family_from_handle(family_handle) + for child_handle in family.get_child_handle_list(): + childlist.append(child_handle) childlist.sort(self.by_birthdate) - for child_id in childlist: - child = self.database.try_to_find_person_from_id(child_id) + for child_handle in childlist: + child = self.database.try_to_find_person_from_handle(child_handle) self.dump(level+1,child) #------------------------------------------------------------------------ @@ -199,10 +199,10 @@ def report(database,person): _style_file = "descend_report.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _max_gen = 1 _pg_brk = 0 -_options = ( _person_id, _max_gen, _pg_brk ) +_options = ( _person_handle, _max_gen, _pg_brk ) #------------------------------------------------------------------------ # @@ -266,7 +266,7 @@ class DescendantBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), self.max_gen, self.pg_brk ) + self.options = ( self.person.get_handle(), self.max_gen, self.pg_brk ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ diff --git a/src/plugins/DetAncestralReport.py b/src/plugins/DetAncestralReport.py index 475582517..b5ca12fd6 100644 --- a/src/plugins/DetAncestralReport.py +++ b/src/plugins/DetAncestralReport.py @@ -74,17 +74,17 @@ class DetAncestorReport(Report.Report): # # #-------------------------------------------------------------------- - def filter(self,person_id,index): - if (not person_id) or (index >= 2**self.max_generations): + def filter(self,person_handle,index): + if (not person_handle) or (index >= 2**self.max_generations): return - self.map[index] = person_id + self.map[index] = person_handle - person = self.database.try_to_find_person_from_id(person_id) - family_id = person.get_main_parents_family_id() - if family_id: - family = self.database.find_family_from_id(family_id) - self.filter(family.get_father_id(),index*2) - self.filter(family.get_mother_id(),(index*2)+1) + person = self.database.try_to_find_person_from_handle(person_handle) + family_handle = person.get_main_parents_family_handle() + if family_handle: + family = self.database.find_family_from_handle(family_handle) + self.filter(family.get_father_handle(),index*2) + self.filter(family.get_mother_handle(),(index*2)+1) def write_children(self, family, rptOptions): @@ -111,19 +111,19 @@ class DetAncestorReport(Report.Report): NAME 0 """ - num_children = len(family.get_child_id_list()) + num_children = len(family.get_child_handle_list()) if num_children > 0: self.doc.start_paragraph("DAR-ChildTitle") - mother_id = family.get_mother_id() - if mother_id: - mother_obj = self.database.try_to_find_person_from_id(mother_id) + mother_handle = family.get_mother_handle() + if mother_handle: + mother_obj = self.database.try_to_find_person_from_handle(mother_handle) mother = mother_obj.get_primary_name().get_regular_name() else: mother = _("unknown") - father_id = family.get_father_id() - if father_id: - father_obj = self.database.try_to_find_person_from_id(father_id) + father_handle = family.get_father_handle() + if father_handle: + father_obj = self.database.try_to_find_person_from_handle(father_handle) father = father_obj.get_primary_name().get_regular_name() else: father = _("unknown") @@ -135,32 +135,32 @@ class DetAncestorReport(Report.Report): self.doc.end_bold() self.doc.end_paragraph() - for child_id in family.get_child_id_list(): + for child_handle in family.get_child_handle_list(): self.doc.start_paragraph("DAR-ChildList") - child = self.database.try_to_find_person_from_id(child_id) + child = self.database.try_to_find_person_from_handle(child_handle) name = child.get_primary_name().get_regular_name() - birth_id = child.get_birth_id() - death_id = child.get_death_id() + birth_handle = child.get_birth_handle() + death_handle = child.get_death_handle() if rptOptions.childRef == reportOptions.Yes: - if self.prevGenIDs.get(child_id) != None: - name= "[" + str(self.prevGenIDs.get(child_id)) + "] "+ name + if self.prevGenIDs.get(child_handle) != None: + name= "[" + str(self.prevGenIDs.get(child_handle)) + "] "+ name - if birth_id: - birth = self.database.find_event_from_id(birth_id) + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle) else: birth = None - if death_id: - death = self.database.find_event_from_id(death_id) + if death_handle: + death = self.database.find_event_from_handle(death_handle) else: death = None if birth and birth.get_date(): - if birth.get_place_id(): - bplace = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() + if birth.get_place_handle(): + bplace = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title() if death and death.get_date(): - if death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + if death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \ (name, birth.get_date(), bplace, death.get_date(), dplace)) # f @@ -168,8 +168,8 @@ class DetAncestorReport(Report.Report): self.doc.write_text(_("- %s Born: %s %s Died: %s") % \ (name, birth.get_date(), bplace, death.get_date())) # e - elif death and death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + elif death and death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s %s Died: %s") % \ (name, birth.get_date(), bplace, dplace)) # d @@ -178,35 +178,35 @@ class DetAncestorReport(Report.Report): (name, birth.get_date(), bplace)) # c else: if death and death.get_date(): - if death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + if death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ (name, birth.get_date(), death.get_date(), \ dplace)) # b else: self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, birth.get_date(), death.get_date())) # a - elif death and death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + elif death and death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, birth.get_date(), dplace)) # 9 else: self.doc.write_text(_("- %s Born: %s") % \ (name, birth.get_date())) # 8 else: - if birth and birth.get_place_id(): - bplace = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() + if birth and birth.get_place_handle(): + bplace = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title() if death and death.get_date(): - if death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + if death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ (name, bplace, \ death.get_date(), dplace)) # 7 else: self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, bplace, death.get_date())) # 6 - elif death and death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + elif death and death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, bplace, dplace)) # 5 else: @@ -214,15 +214,15 @@ class DetAncestorReport(Report.Report): (name, bplace)) # 4 else: if death and death.get_date(): - if death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + if death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Died: %s %s") % \ (name, death.get_date(), dplace)) # 3 else: self.doc.write_text(_("- %s Died: %s") % \ (name, death.get_date())) # 2 - elif death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + elif death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Died: %s") % \ (name, dplace)) # 1 else: @@ -233,8 +233,8 @@ class DetAncestorReport(Report.Report): def write_person(self, key, rptOptions): """Output birth, death, parentage, marriage and notes information """ - person_id = self.map[key] - person = self.database.try_to_find_person_from_id(person_id) + person_handle = self.map[key] + person = self.database.try_to_find_person_from_handle(person_handle) if rptOptions.addImages == reportOptions.Yes: self.insert_images(person) @@ -266,10 +266,10 @@ class DetAncestorReport(Report.Report): return 1 # Duplicate person # Check birth record - birth_id = person.get_birth_id() - if birth_id: + birth_handle = person.get_birth_handle() + if birth_handle: self.write_birth(person, rptOptions) - if person.get_death_id(): + if person.get_death_handle(): self.write_death(person, firstName, rptOptions) self.write_parents(person, firstName) self.write_marriage(person, rptOptions) @@ -300,12 +300,12 @@ class DetAncestorReport(Report.Report): was born in ____________. """ - birth_id = person.get_birth_id() - if birth_id: - birth = self.database.find_event_from_id(birth_id) + birth_handle = person.get_birth_handle() + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle) date = birth.get_date_object().get_start_date() - if birth.get_place_id(): - place = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() + if birth.get_place_handle(): + place = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title() if place[-1:] == '.': place = place[:-1] elif rptOptions.blankDate == reportOptions.Yes: @@ -359,12 +359,12 @@ class DetAncestorReport(Report.Report): . """ t= "" - death_id = person.get_death_id() - if death_id: - death = self.database.find_event_from_id(death_id) + death_handle = person.get_death_handle() + if death_handle: + death = self.database.find_event_from_handle(death_handle) date = death.get_date_object().get_start_date() - if death.get_place_id(): - place = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + if death.get_place_handle(): + place = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() if place[-1:] == '.': place = place[:-1] elif rptOptions.blankPlace == reportOptions.Yes: @@ -403,10 +403,10 @@ class DetAncestorReport(Report.Report): return t= "" - famList = person.get_family_id_list() + famList = person.get_family_handle_list() if len(famList) > 0: for fam_id in famList: - fam = self.database.find_family_from_id(fam_id) + fam = self.database.find_family_from_handle(fam_id) buried = None if buried: date = buried.get_date_object().get_start_date() @@ -443,16 +443,16 @@ class DetAncestorReport(Report.Report): FIRSTNAME is the daughter of FATHER. FIRSTNAME is the daughter of MOTHER. """ - ext_family_id = person.get_main_parents_family_id() - if ext_family_id: - ext_family = self.database.find_family_from_id(ext_family_id) - if ext_family.get_father_id(): - father_obj = self.database.try_to_find_person_from_id(ext_family.get_father_id()) + ext_family_handle = person.get_main_parents_family_handle() + if ext_family_handle: + ext_family = self.database.find_family_from_handle(ext_family_handle) + if ext_family.get_father_handle(): + father_obj = self.database.try_to_find_person_from_handle(ext_family.get_father_handle()) father = father_obj.get_primary_name().get_regular_name() else: father= "" - if ext_family.get_mother_id(): - mother_obj = self.database.try_to_find_person_from_id(ext_family.get_mother_id()) + if ext_family.get_mother_handle(): + mother_obj = self.database.try_to_find_person_from_handle(ext_family.get_mother_handle()) mother = mother_obj.get_primary_name().get_regular_name() else: mother= "" @@ -492,18 +492,18 @@ class DetAncestorReport(Report.Report): HE/SHE married on FULLDATE. HE/SHE married in PLACE. """ - famList= person.get_family_id_list() + famList= person.get_family_handle_list() if len(famList) > 0: fam_num= 0 endOfSent= "" for fam_id in famList: - fam = self.database.find_family_from_id(fam_id) + fam = self.database.find_family_from_handle(fam_id) fam_num= fam_num + 1 spouse= "" t= "" if person.get_gender() == RelLib.Person.male: - if fam.get_mother_id(): - mother = self.database.try_to_find_person_from_id(fam.get_mother_id()) + if fam.get_mother_handle(): + mother = self.database.try_to_find_person_from_handle(fam.get_mother_handle()) spouse = mother.get_primary_name().get_regular_name() if fam_num == 1: heshe= _("He") @@ -517,13 +517,13 @@ class DetAncestorReport(Report.Report): heshe= _(",") else: heshe= _("and she") - if fam.get_father_id(): - father = self.database.try_to_find_person_from_id(fam.get_father_id()) + if fam.get_father_handle(): + father = self.database.try_to_find_person_from_handle(fam.get_father_handle()) spouse = father.get_primary_name().get_regular_name() - for event_id in fam.get_event_list(): - if event_id: - event = self.database.find_event_from_id(event_id) + for event_handle in fam.get_event_list(): + if event_handle: + event = self.database.find_event_from_handle(event_handle) if event.get_name() == "Marriage": marriage = event break @@ -533,8 +533,8 @@ class DetAncestorReport(Report.Report): fulldate = "" place = "" if marriage: - if marriage.get_place_id(): - place = self.database.try_to_find_place_from_id(marriage.get_place_id()).get_title() + if marriage.get_place_handle(): + place = self.database.try_to_find_place_from_handle(marriage.get_place_handle()).get_title() elif rptOptions.blankPlace == reportOptions.Yes: place= "____________" @@ -576,23 +576,23 @@ class DetAncestorReport(Report.Report): def write_mate(self, mate, rptOptions): """Output birth, death, parentage, marriage and notes information """ - famList = mate.get_family_id_list() + famList = mate.get_family_handle_list() if len(famList) > 0: for fam_id in famList: - fam = self.database.find_family_from_id(fam_id) + fam = self.database.find_family_from_handle(fam_id) person= "" if mate.get_gender() == RelLib.Person.male: - if fam.get_mother_id(): - ind_id= fam.get_mother_id() - ind = self.database.try_to_find_person_from_id(ind_id) + if fam.get_mother_handle(): + ind_id= fam.get_mother_handle() + ind = self.database.try_to_find_person_from_handle(ind_id) person = ind.get_primary_name().get_regular_name() firstName = ind.get_primary_name().get_first_name() heshe = _("She") else: heshe= _("He") - if fam.get_father_id(): - ind_id = fam.get_father_id() - ind = self.database.try_to_find_person_from_id(ind_id) + if fam.get_father_handle(): + ind_id = fam.get_father_handle() + ind = self.database.try_to_find_person_from_handle(ind_id) person = ind.get_primary_name().get_regular_name() firstName = ind.get_primary_name().get_first_name() @@ -628,8 +628,8 @@ class DetAncestorReport(Report.Report): photos = person.get_media_list() for photo in photos : - object_id = photo.get_reference_id() - object = self.database.try_to_find_object_from_id(object_id) + object_handle = photo.get_reference_handle() + object = self.database.try_to_find_object_from_handle(object_handle) if object.get_mime_type()[0:5] == "image": file = object.get_path() self.doc.add_media_object(file,"row",4.0,4.0) @@ -643,7 +643,7 @@ class DetAncestorReport(Report.Report): if self.newpage: self.doc.page_break() - self.filter(self.start.get_id(),1) + self.filter(self.start.get_handle(),1) #rptOpt= reportOptions() rptOpt = self.rptOpt @@ -671,16 +671,16 @@ class DetAncestorReport(Report.Report): self.prevGenIDs= self.genIDs.copy() self.genIDs.clear() - person_id = self.map[key] - person = self.database.try_to_find_person_from_id(person_id) - self.genIDs[person_id]= key + person_handle = self.map[key] + person = self.database.try_to_find_person_from_handle(person_handle) + self.genIDs[person_handle]= key dupPerson= self.write_person(key, rptOpt) if dupPerson == 0: # Is this a duplicate ind record if person.get_gender() == RelLib.Person.female and \ rptOpt.listChildren == reportOptions.Yes and \ - len(person.get_family_id_list()) > 0: - family_id = person.get_family_id_list()[0] - family = self.database.find_family_from_id(family_id) + len(person.get_family_handle_list()) > 0: + family_handle = person.get_family_handle_list()[0] + family = self.database.find_family_from_handle(family_handle) self.write_children(family, rptOpt) #if rptOpt.addImages == reportOptions.Yes: @@ -961,7 +961,7 @@ def report(database,person): _style_file = "det_ancestor_report.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _max_gen = 10 _pg_brk = 0 _first_name = 0 @@ -975,7 +975,7 @@ _dup_persons = 1 _child_ref = 1 _images = 0 -_options = ( _person_id, _max_gen, _pg_brk, +_options = ( _person_handle, _max_gen, _pg_brk, _first_name, _full_date, _list_children, _include_notes, _place, _date, _age, _dup_persons, _child_ref, _images ) @@ -1161,7 +1161,7 @@ class DetAncestorBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), self.max_gen, self.pg_brk, + self.options = ( self.person.get_handle(), self.max_gen, self.pg_brk, self.first_name, self.full_date, self.list_children, self.include_notes, self.place, self.date, self.age, self.dup_persons, self.child_ref, self.images ) @@ -1311,15 +1311,15 @@ class reportOptions: null """ - birth_id = ind.get_birth_id() - if birth_id: - birth = self.database.find_event_from_id(birth_id).get_date_object().get_start_date() + birth_handle = ind.get_birth_handle() + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle).get_date_object().get_start_date() birth_year_valid = birth.get_year_valid() else: birth_year_valid = None - death_id = ind.get_death_id() - if death_id: - death = self.database.find_event_from_id(death_id).get_date_object().get_start_date() + death_handle = ind.get_death_handle() + if death_handle: + death = self.database.find_event_from_handle(death_handle).get_date_object().get_start_date() death_year_valid = death.get_year_valid() else: death_year_valid = None diff --git a/src/plugins/DetDescendantReport.py b/src/plugins/DetDescendantReport.py index 1ec6d8fc4..2f662f1ed 100644 --- a/src/plugins/DetDescendantReport.py +++ b/src/plugins/DetDescendantReport.py @@ -75,23 +75,23 @@ class DetDescendantReport(Report.Report): # # #-------------------------------------------------------------------- - def apply_filter(self,person_id,index,cur_gen=1): - if (not person_id) or (cur_gen > self.max_generations): + def apply_filter(self,person_handle,index,cur_gen=1): + if (not person_handle) or (cur_gen > self.max_generations): return - self.map[index] = person_id + self.map[index] = person_handle if len(self.genKeys) < cur_gen: self.genKeys.append([index]) else: self.genKeys[cur_gen-1].append(index) - person = self.database.try_to_find_person_from_id(person_id) - for family_id in person.get_family_id_list(): - family = self.database.find_family_from_id(family_id) - for child_id in family.get_child_id_list(): - child = self.database.find_family_from_id(child_id) + person = self.database.try_to_find_person_from_handle(person_handle) + for family_handle in person.get_family_handle_list(): + family = self.database.find_family_from_handle(family_handle) + for child_handle in family.get_child_handle_list(): + child = self.database.find_family_from_handle(child_handle) ix = max(self.map.keys()) - self.apply_filter(child_id, ix+1, cur_gen+1) + self.apply_filter(child_handle, ix+1, cur_gen+1) def write_children(self, family, rptOptions): """ List children @@ -117,17 +117,17 @@ class DetDescendantReport(Report.Report): NAME 0 """ - num_children = len(family.get_child_id_list()) + num_children = len(family.get_child_handle_list()) if num_children: self.doc.start_paragraph("DDR-ChildTitle") - mother_id = family.get_mother_id() - if mother_id: - mother = self.database.try_to_find_person_from_id(mother_id).get_primary_name().get_regular_name() + mother_handle = family.get_mother_handle() + if mother_handle: + mother = self.database.try_to_find_person_from_handle(mother_handle).get_primary_name().get_regular_name() else: mother = _("unknown") - father_id = family.get_father_id() - if father_id: - father = self.database.try_to_find_person_from_id(father_id).get_primary_name().get_regular_name() + father_handle = family.get_father_handle() + if father_handle: + father = self.database.try_to_find_person_from_handle(father_handle).get_primary_name().get_regular_name() else: father = _("unknown") self.doc.start_bold() @@ -138,32 +138,32 @@ class DetDescendantReport(Report.Report): self.doc.end_bold() self.doc.end_paragraph() - for child_id in family.get_child_id_list(): - child = self.database.try_to_find_person_from_id(child_id) + for child_handle in family.get_child_handle_list(): + child = self.database.try_to_find_person_from_handle(child_handle) self.doc.start_paragraph("DDR-ChildList") name = child.get_primary_name().get_regular_name() - birth_id = child.get_birth_id() - death_id = child.get_death_id() + birth_handle = child.get_birth_handle() + death_handle = child.get_death_handle() if rptOptions.childRef == reportOptions.Yes: - if self.prevGenIDs.get(child_id) != None: - name= "[" + str(self.prevGenIDs.get(child_id)) + "] "+ name + if self.prevGenIDs.get(child_handle) != None: + name= "[" + str(self.prevGenIDs.get(child_handle)) + "] "+ name - if birth_id: - birth = self.database.find_event_from_id(birth_id) + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle) else: birth = None - if death_id: - death = self.database.find_event_from_id(death_id) + if death_handle: + death = self.database.find_event_from_handle(death_handle) else: death = None if birth and birth.get_date(): - if birth.get_place_id(): - bplace = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() + if birth.get_place_handle(): + bplace = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title() if death and death.get_date(): - if death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + if death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \ (name, birth.get_date(), bplace, death.get_date(), dplace)) # f @@ -171,8 +171,8 @@ class DetDescendantReport(Report.Report): self.doc.write_text(_("- %s Born: %s %s Died: %s") % \ (name, birth.get_date(), bplace, death.get_date())) # e - elif death and death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + elif death and death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s %s Died: %s") % \ (name, birth.get_date(), bplace, dplace)) # d @@ -180,35 +180,35 @@ class DetDescendantReport(Report.Report): (name, birth.get_date(), bplace)) # c else: if death and death.get_date(): - if death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + if death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ (name, birth.get_date(), death.get_date(), \ dplace)) # b else: self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, birth.get_date(), death.get_date())) # a - elif death and death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + elif death and death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, birth.get_date(), dplace)) # 9 else: self.doc.write_text(_("- %s Born: %s") % \ (name, birth.get_date())) # 8 else: - if birth and birth.get_place_id(): - bplace = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() + if birth and birth.get_place_handle(): + bplace = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title() if death and death.get_date(): - if death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + if death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ (name, bplace, \ death.get_date(), dplace)) # 7 else: self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, bplace, death.get_date())) # 6 - elif death and death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + elif death and death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, bplace, dplace)) # 5 else: @@ -216,15 +216,15 @@ class DetDescendantReport(Report.Report): (name, bplace)) # 4 else: if death and death.get_date(): - if death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + if death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Died: %s %s") % \ (name, death.get_date(), dplace)) # 3 else: self.doc.write_text(_("- %s Died: %s") % \ (name, death.get_date())) # 2 - elif death and death.get_place_id(): - dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() + elif death and death.get_place_handle(): + dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title() self.doc.write_text(_("- %s Died: %s") % \ (name, dplace)) # 1 else: @@ -235,8 +235,8 @@ class DetDescendantReport(Report.Report): def write_person(self, key, rptOptions): """Output birth, death, parentage, marriage and notes information """ - person_id = self.map[key] - person = self.database.try_to_find_person_from_id(person_id) + person_handle = self.map[key] + person = self.database.try_to_find_person_from_handle(person_handle) if rptOptions.addImages == reportOptions.Yes: self.insert_images(person) @@ -268,8 +268,8 @@ class DetDescendantReport(Report.Report): return 1 # Duplicate person # Check birth record - birth_id = person.get_birth_id() - if birth_id: + birth_handle = person.get_birth_handle() + if birth_handle: self.write_birth(person, rptOptions) self.write_death(person, firstName, rptOptions) self.write_parents(person, firstName) @@ -301,12 +301,12 @@ class DetDescendantReport(Report.Report): was born in ____________. """ - birth_id = person.get_birth_id() - if birth_id: - birth = self.database.find_event_from_id(birth_id) + birth_handle = person.get_birth_handle() + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle) date = birth.get_date_object().get_start_date() - if birth.get_place_id(): - place = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() + if birth.get_place_handle(): + place = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title() if place[-1:] == '.': place = place[:-1] elif rptOptions.blankDate == reportOptions.Yes: @@ -357,13 +357,13 @@ class DetDescendantReport(Report.Report): . """ t= "" - death_id = person.get_death_id() - if death_id: - death = self.database.find_event_from_id(death_id) + death_handle = person.get_death_handle() + if death_handle: + death = self.database.find_event_from_handle(death_handle) date = death.get_date_object().get_start_date() - place_id = death.get_place_id() - if place_id: - place = self.database.try_to_find_place_from_id(place_id).get_title() + place_handle = death.get_place_handle() + if place_handle: + place = self.database.try_to_find_place_from_handle(place_handle).get_title() if place[-1:] == '.': place = place[:-1] elif rptOptions.blankPlace == reportOptions.Yes: @@ -404,10 +404,10 @@ class DetDescendantReport(Report.Report): self.doc.write_text(t) t = "" - famList = person.get_family_id_list() + famList = person.get_family_handle_list() if len(famList): for fam_id in famList: - fam = self.database.find_family_from_id(fam_id) + fam = self.database.find_family_from_handle(fam_id) buried = None if buried: date = buried.get_date_object().get_start_date() @@ -445,17 +445,17 @@ class DetDescendantReport(Report.Report): FIRSTNAME is the daughter of FATHER. FIRSTNAME is the daughter of MOTHER. """ - ext_family_id = person.get_main_parents_family_id() - if ext_family_id: - ext_family = self.database.find_family_from_id(ext_family_id) - father_id = ext_family.get_father_id() - if father_id: - father = self.database.try_to_find_person_from_id(father_id).get_primary_name().get_regular_name() + ext_family_handle = person.get_main_parents_family_handle() + if ext_family_handle: + ext_family = self.database.find_family_from_handle(ext_family_handle) + father_handle = ext_family.get_father_handle() + if father_handle: + father = self.database.try_to_find_person_from_handle(father_handle).get_primary_name().get_regular_name() else: father = "" - mother_id = ext_family.get_father_id() - if mother_id: - mother = self.database.try_to_find_person_from_id(mother_id).get_primary_name().get_regular_name() + mother_handle = ext_family.get_father_handle() + if mother_handle: + mother = self.database.try_to_find_person_from_handle(mother_handle).get_primary_name().get_regular_name() else: mother = "" @@ -491,17 +491,17 @@ class DetDescendantReport(Report.Report): HE/SHE married SPOUSE in PLACE. HE/SHE married SPOUSE """ - famList = person.get_family_id_list() + famList = person.get_family_handle_list() if len(famList): fam_num= 0 for fam_id in famList: - fam = self.database.find_family_from_id(fam_id) + fam = self.database.find_family_from_handle(fam_id) fam_num= fam_num + 1 spouse = "" if person.get_gender() == RelLib.Person.male: - mother_id = fam.get_mother_id() - if mother_id: - spouse = self.database.try_to_find_person_from_id(mother_id).get_primary_name().get_regular_name() + mother_handle = fam.get_mother_handle() + if mother_handle: + spouse = self.database.try_to_find_person_from_handle(mother_handle).get_primary_name().get_regular_name() if fam_num == 1: heshe = _("He") elif fam_num < len(famList): @@ -516,13 +516,13 @@ class DetDescendantReport(Report.Report): else: heshe = _("and she") - father_id = fam.get_father_id() - if father_id: - spouse = self.database.try_to_find_person_from_id(father_id).get_primary_name().get_regular_name() + father_handle = fam.get_father_handle() + if father_handle: + spouse = self.database.try_to_find_person_from_handle(father_handle).get_primary_name().get_regular_name() - for event_id in fam.get_event_list(): - if event_id: - event = self.database.find_event_from_id(event_id) + for event_handle in fam.get_event_list(): + if event_handle: + event = self.database.find_event_from_handle(event_handle) if event.get_name() == "Marriage": marriage = event break @@ -532,8 +532,8 @@ class DetDescendantReport(Report.Report): fulldate = "" place = "" if marriage: - if marriage.get_place_id(): - place = self.database.try_to_find_place_from_id(marriage.get_place_id()).get_title() + if marriage.get_place_handle(): + place = self.database.try_to_find_place_from_handle(marriage.get_place_handle()).get_title() elif rptOptions.blankPlace == reportOptions.Yes: place= "____________" @@ -575,21 +575,21 @@ class DetDescendantReport(Report.Report): def write_mate(self, person, rptOptions): """Output birth, death, parentage, marriage and notes information """ - for fam_id in person.get_family_id_list(): - fam = self.database.find_family_from_id(fam_id) + for fam_id in person.get_family_handle_list(): + fam = self.database.find_family_from_handle(fam_id) mate = "" if person.get_gender() == RelLib.Person.male: heshe = _("She") - mother_id = fam.get_mother_id() - if mother_id: - mate = self.database.try_to_find_person_from_id(mother_id) + mother_handle = fam.get_mother_handle() + if mother_handle: + mate = self.database.try_to_find_person_from_handle(mother_handle) mateName = mate.get_primary_name().get_regular_name() mateFirstName = mate.get_primary_name().get_first_name() else: heshe = _("He") - father_id = fam.get_father_id() - if father_id: - mate = self.database.try_to_find_person_from_id(father_id) + father_handle = fam.get_father_handle() + if father_handle: + mate = self.database.try_to_find_person_from_handle(father_handle) mateName = mate.get_primary_name().get_regular_name() mateFirstName = mate.get_primary_name().get_first_name() @@ -621,8 +621,8 @@ class DetDescendantReport(Report.Report): photos = person.get_media_list() for photo in photos : - object_id = photo.get_reference_id() - object = self.database.try_to_find_object_from_id(object_id) + object_handle = photo.get_reference_handle() + object = self.database.try_to_find_object_from_handle(object_handle) if object.get_mime_type()[0:5] == "image": file = object.get_path() self.doc.add_media_object(file,"row",4.0,4.0) @@ -639,23 +639,23 @@ class DetDescendantReport(Report.Report): rptOpt = self.rptOpt self.cur_gen= 1 - self.apply_filter(self.start.get_id(),1) + self.apply_filter(self.start.get_handle(),1) name = self.start.get_primary_name().get_regular_name() - famList = self.start.get_family_id_list() + famList = self.start.get_family_handle_list() spouseName= "" if len(famList): for fam_id in famList: - fam = self.database.find_family_from_id(fam_id) + fam = self.database.find_family_from_handle(fam_id) if self.start.get_gender() == RelLib.Person.male: - mother_id = fam.get_mother_id() - if mother_id: - spouseName = self.database.try_to_find_person_from_id(mother_id).get_primary_name().get_first_name() + mother_handle = fam.get_mother_handle() + if mother_handle: + spouseName = self.database.try_to_find_person_from_handle(mother_handle).get_primary_name().get_first_name() else: - father_id = fam.get_father_id() - if father_id: - spouseName = self.database.try_to_find_person_from_id(father_id).get_primary_name().get_first_name() + father_handle = fam.get_father_handle() + if father_handle: + spouseName = self.database.try_to_find_person_from_handle(father_handle).get_primary_name().get_first_name() self.doc.start_paragraph("DDR-Title") if spouseName: @@ -683,15 +683,15 @@ class DetDescendantReport(Report.Report): for key in self.genKeys[generation]: - person_id = self.map[key] - person = self.database.try_to_find_person_from_id(person_id) - self.genIDs[person_id]= key + person_handle = self.map[key] + person = self.database.try_to_find_person_from_handle(person_handle) + self.genIDs[person_handle]= key dupPerson= self.write_person(key, rptOpt) if dupPerson == 0: # Is this a duplicate ind record if rptOpt.listChildren == reportOptions.Yes and \ - len(person.get_family_id_list()) > 0: - family_id = person.get_family_id_list()[0] - family = self.database.find_family_from_id(family_id) + len(person.get_family_handle_list()) > 0: + family_handle = person.get_family_handle_list()[0] + family = self.database.find_family_from_handle(family_handle) self.write_children(family, rptOpt) #if rptOpt.addImages == reportOptions.Yes: @@ -973,7 +973,7 @@ def report(database,person): _style_file = "det_descendant_report.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _max_gen = 10 _pg_brk = 0 _first_name = 0 @@ -987,7 +987,7 @@ _dup_persons = 1 _child_ref = 1 _images = 0 -_options = ( _person_id, _max_gen, _pg_brk, +_options = ( _person_handle, _max_gen, _pg_brk, _first_name, _full_date, _list_children, _include_notes, _place, _date, _age, _dup_persons, _child_ref, _images ) @@ -1174,7 +1174,7 @@ class DetDescendantBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), self.max_gen, self.pg_brk, + self.options = ( self.person.get_handle(), self.max_gen, self.pg_brk, self.first_name, self.full_date, self.list_children, self.include_notes, self.place, self.date, self.age, self.dup_persons, self.child_ref, self.images ) @@ -1321,15 +1321,15 @@ class reportOptions: null """ - birth_id = ind.get_birth_id() - if birth_id: - birth = self.database.find_event_from_id(birth_id).get_date_object().get_start_date() + birth_handle = ind.get_birth_handle() + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle).get_date_object().get_start_date() birth_year_valid = birth.get_year_valid() else: birth_year_valid = None - death_id = ind.get_death_id() - if death_id: - death = self.database.find_event_from_id(death_id).get_date_object().get_start_date() + death_handle = ind.get_death_handle() + if death_handle: + death = self.database.find_event_from_handle(death_handle).get_date_object().get_start_date() death_year_valid = death.get_year_valid() else: death_year_valid = None diff --git a/src/plugins/EventCmp.py b/src/plugins/EventCmp.py index 2c81e8353..481dce9aa 100644 --- a/src/plugins/EventCmp.py +++ b/src/plugins/EventCmp.py @@ -316,37 +316,37 @@ class DisplayChart: def build_row_data(self): for individual_id in self.my_list: - individual = self.db.try_to_find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_handle(individual_id) name = individual.get_primary_name().get_name() - birth_id = individual.get_birth_id() + birth_handle = individual.get_birth_handle() bdate = "" bplace = "" - if birth_id: - birth = self.db.find_event_from_id(birth_id) + if birth_handle: + birth = self.db.find_event_from_handle(birth_handle) bdate = birth.get_date() - bplace_id = birth.get_place_id() - if bplace_id: - bplace = self.db.try_to_find_place_from_id(bplace_id).get_title() - death_id = individual.get_death_id() + bplace_handle = birth.get_place_handle() + if bplace_handle: + bplace = self.db.try_to_find_place_from_handle(bplace_handle).get_title() + death_handle = individual.get_death_handle() ddate = "" dplace = "" - if death_id: - death = self.db.find_event_from_id(death_id) + if death_handle: + death = self.db.find_event_from_handle(death_handle) ddate = death.get_date() - dplace_id = death.get_place_id() - if dplace_id: - dplace = self.db.try_to_find_place_from_id(dplace_id).get_title() + dplace_handle = death.get_place_handle() + if dplace_handle: + dplace = self.db.try_to_find_place_from_handle(dplace_handle).get_title() map = {} elist = individual.get_event_list()[:] - for ievent_id in elist: - if not ievent_id: + for ievent_handle in elist: + if not ievent_handle: continue - ievent = self.db.find_event_from_id(ievent_id) + ievent = self.db.find_event_from_handle(ievent_handle) event_name = ievent.get_name() if map.has_key(event_name): - map[event_name].append(ievent_id) + map[event_name].append(ievent_handle) else: - map[event_name] = [ievent_id] + map[event_name] = [ievent_handle] first = 1 done = 0 @@ -359,16 +359,16 @@ class DisplayChart: tlist = ["","",""] for ename in self.event_titles[3:]: if map.has_key(ename) and len(map[ename]) > 0: - event_id = map[ename][0] + event_handle = map[ename][0] del map[ename][0] date = "" place = "" - if event_id: - event = self.db.find_event_from_id(event_id) + if event_handle: + event = self.db.find_event_from_handle(event_handle) date = event.get_date() - place_id = event.get_place_id() - if place_id: - place = self.db.try_to_find_place_from_id(place_id).get_title() + place_handle = event.get_place_handle() + if place_handle: + place = self.db.try_to_find_place_from_handle(place_handle).get_title() tlist.append("%s\n%s" % (date, place)) added = 1 else: @@ -387,12 +387,12 @@ class DisplayChart: name, birth, and death. This should be the column titles of the report""" map = {} for individual_id in self.my_list: - individual = self.db.try_to_find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_handle(individual_id) elist = individual.get_event_list() - for event_id in elist: - if not event_id: + for event_handle in elist: + if not event_handle: continue - event = self.db.find_event_from_id(event_id) + event = self.db.find_event_from_handle(event_handle) name = event.get_name() if not name: break diff --git a/src/plugins/FamilyGroup.py b/src/plugins/FamilyGroup.py index c63823794..16a397060 100644 --- a/src/plugins/FamilyGroup.py +++ b/src/plugins/FamilyGroup.py @@ -50,11 +50,11 @@ from QuestionDialog import ErrorDialog #------------------------------------------------------------------------ class FamilyGroup: - def __init__(self,database,family_id,doc,output,newpage=0): + def __init__(self,database,family_handle,doc,output,newpage=0): self.db = database - if family_id: - self.family = self.db.find_family_from_id(family_id) + if family_handle: + self.family = self.db.find_family_from_handle(family_handle) else: self.family = None self.output = output @@ -130,12 +130,12 @@ class FamilyGroup: if self.standalone: self.doc.close() - def dump_parent(self,person_id): + def dump_parent(self,person_handle): - if not person_id: + if not person_handle: return - person = self.db.try_to_find_person_from_id(person_id) + person = self.db.try_to_find_person_from_handle(person_handle) if person.get_gender() == RelLib.Person.male: id = _("Husband") @@ -152,25 +152,25 @@ class FamilyGroup: self.doc.end_cell() self.doc.end_row() - birth_id = person.get_birth_id() + birth_handle = person.get_birth_handle() bdate = "" bplace = "" - if birth_id: - birth = self.db.find_event_from_id(birth_id) + if birth_handle: + birth = self.db.find_event_from_handle(birth_handle) bdate = birth.get_date() - bplace_id = birth.get_place_id() - if bplace_id: - bplace = self.db.try_to_find_place_from_id(bplace_id).get_title() + bplace_handle = birth.get_place_handle() + if bplace_handle: + bplace = self.db.try_to_find_place_from_handle(bplace_handle).get_title() - death_id = person.get_death_id() + death_handle = person.get_death_handle() ddate = "" dplace = "" - if death_id: - death = self.db.find_event_from_id(death_id) + if death_handle: + death = self.db.find_event_from_handle(death_handle) ddate = death.get_date() - dplace_id = death.get_place_id() - if dplace_id: - dplace = self.db.try_to_find_place_from_id(dplace_id).get_title() + dplace_handle = death.get_place_handle() + if dplace_handle: + dplace = self.db.try_to_find_place_from_handle(dplace_handle).get_title() self.doc.start_row() self.doc.start_cell("FGR-TextContents") @@ -208,17 +208,17 @@ class FamilyGroup: self.doc.end_cell() self.doc.end_row() - family_id = person.get_main_parents_family_id() + family_handle = person.get_main_parents_family_handle() father_name = "" mother_name = "" - if family_id: - family = self.db.find_family_from_id(family_id) - father_id = family.get_father_id() - if father_id: - father_name = self.db.try_to_find_person_from_id(father_id).get_primary_name().get_regular_name() - mother_id = family.get_mother_id() - if mother_id: - mother_name = self.db.try_to_find_person_from_id(mother_id).get_primary_name().get_regular_name() + if family_handle: + family = self.db.find_family_from_handle(family_handle) + father_handle = family.get_father_handle() + if father_handle: + father_name = self.db.try_to_find_person_from_handle(father_handle).get_primary_name().get_regular_name() + mother_handle = family.get_mother_handle() + if mother_handle: + mother_name = self.db.try_to_find_person_from_handle(mother_handle).get_primary_name().get_regular_name() self.doc.start_row() self.doc.start_cell("FGR-TextContents") @@ -253,9 +253,9 @@ class FamilyGroup: place = "" if event: date = event.get_date() - place_id = event.get_place_id() - if place_id: - place = self.db.try_to_find_place_from_id(place_id).get_title() + place_handle = event.get_place_handle() + if place_handle: + place = self.db.try_to_find_place_from_handle(place_handle).get_title() self.doc.start_row() self.doc.start_cell(text) @@ -279,9 +279,9 @@ class FamilyGroup: self.doc.end_cell() self.doc.end_row() - def dump_child(self,index,person_id): + def dump_child(self,index,person_handle): - person = self.db.try_to_find_person_from_id(person_id) + person = self.db.try_to_find_person_from_handle(person_handle) self.doc.start_row() self.doc.start_cell('FGR-TextChild1') self.doc.start_paragraph('FGR-ChildText') @@ -298,15 +298,15 @@ class FamilyGroup: self.doc.end_cell() self.doc.end_row() - families = len(person.get_family_id_list()) - birth_id = person.get_birth_id() - if birth_id: - birth = self.db.find_event_from_id(birth_id) + families = len(person.get_family_handle_list()) + birth_handle = person.get_birth_handle() + if birth_handle: + birth = self.db.find_event_from_handle(birth_handle) else: birth = None - death_id = person.get_death_id() - if death_id: - death = self.db.find_event_from_id(death_id) + death_handle = person.get_death_handle() + if death_handle: + death = self.db.find_event_from_handle(death_handle) else: death = None self.dump_child_event('FGR-TextChild1',_('Birth'),birth) @@ -316,21 +316,21 @@ class FamilyGroup: self.dump_child_event('FGR-TextChild1',_('Death'),death) index = 1 - for family_id in person.get_family_id_list(): - family = self.db.find_family_from_id(family_id) - for event_id in family.get_event_list(): - if event_id: - event = self.db.find_event_from_id(event_id) + for family_handle in person.get_family_handle_list(): + family = self.db.find_family_from_handle(family_handle) + for event_handle in family.get_event_list(): + if event_handle: + event = self.db.find_event_from_handle(event_handle) if event.get_name() == "Marriage": m = event break else: m = None - if person_id == family.get_father_id(): - spouse_id = family.get_mother_id() + if person_handle == family.get_father_handle(): + spouse_id = family.get_mother_handle() else: - spouse_id = family.get_father_id() + spouse_id = family.get_father_handle() self.doc.start_row() self.doc.start_cell('FGR-TextChild1') self.doc.start_paragraph('FGR-Normal') @@ -344,7 +344,7 @@ class FamilyGroup: self.doc.start_cell('FGR-TextContentsEnd',2) self.doc.start_paragraph('FGR-Normal') if spouse_id: - spouse = self.db.try_to_find_person_from_id(spouse_id) + spouse = self.db.try_to_find_person_from_handle(spouse_id) self.doc.write_text(spouse.get_primary_name().get_regular_name()) self.doc.end_paragraph() self.doc.end_cell() @@ -369,12 +369,12 @@ class FamilyGroup: self.doc.end_paragraph() if self.family: - self.dump_parent(self.family.get_father_id()) + self.dump_parent(self.family.get_father_handle()) self.doc.start_paragraph("FGR-blank") self.doc.end_paragraph() - self.dump_parent(self.family.get_mother_id()) + self.dump_parent(self.family.get_mother_handle()) - length = len(self.family.get_child_id_list()) + length = len(self.family.get_child_handle_list()) if length > 0: self.doc.start_paragraph("FGR-blank") self.doc.end_paragraph() @@ -387,8 +387,8 @@ class FamilyGroup: self.doc.end_cell() self.doc.end_row() index = 1 - for child_id in self.family.get_child_id_list(): - self.dump_child(index,child_id) + for child_handle in self.family.get_child_handle_list(): + self.dump_child(index,child_handle) index = index + 1 self.doc.end_table() self.end() @@ -483,9 +483,9 @@ def report(database,person): _style_file = "family_group.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _spouse_name = "" -_options = ( _person_id, _spouse_name ) +_options = ( _person_handle, _spouse_name ) #------------------------------------------------------------------------ # @@ -604,7 +604,7 @@ class FamilyGroupBareDialog(Report.BareReportDialog): else: self.spouse_name = "" - self.options = ( self.person.get_id(), self.spouse_name ) + self.options = ( self.person.get_handle(), self.spouse_name ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ @@ -696,19 +696,19 @@ def _build_spouse_map(database,person): the selected person has never been married then this routine will return a placebo label and disable the OK button.""" spouse_map = {} - family_list = person.get_family_id_list() - for family_id in family_list: - family = database.find_family_from_id(family_id) - if person.get_id() == family.get_father_id(): - spouse_id = family.get_mother_id() + family_list = person.get_family_handle_list() + for family_handle in family_list: + family = database.find_family_from_handle(family_handle) + if person.get_handle() == family.get_father_handle(): + spouse_id = family.get_mother_handle() else: - spouse_id = family.get_father_id() + spouse_id = family.get_father_handle() if spouse_id: - spouse = database.try_to_find_person_from_id(spouse_id) + spouse = database.try_to_find_person_from_handle(spouse_id) name = spouse.get_primary_name().get_name() else: name= _("unknown") - spouse_map[name] = family_id + spouse_map[name] = family_handle return spouse_map #------------------------------------------------------------------------ diff --git a/src/plugins/FanChart.py b/src/plugins/FanChart.py index 6aa479a9e..9b54496b8 100644 --- a/src/plugins/FanChart.py +++ b/src/plugins/FanChart.py @@ -142,18 +142,18 @@ class FanChart: if self.standalone: self.doc.init() - def filter(self,person_id,index): + def filter(self,person_handle,index): """traverse the ancestors recursively until either the end of a line is found, or until we reach the maximum number of generations that we want to deal with""" - if (not person_id) or (index >= 32): + if (not person_handle) or (index >= 32): return - self.map[index-1] = person_id + self.map[index-1] = person_handle self.text[index-1] = [] - subst = SubstKeywords(self.database,person_id) + subst = SubstKeywords(self.database,person_handle) for line in self.display: self.text[index-1].append(subst.replace(line)) @@ -164,16 +164,16 @@ class FanChart: self.lines = max(self.lines,len(self.text[index-1])) - person = self.database.try_to_find_person_from_id(person_id) - family_id = person.get_main_parents_family_id() - if family_id: - family = self.database.find_family_from_id(family_id) - self.filter(family.get_father_id(),index*2) - self.filter(family.get_mother_id(),(index*2)+1) + person = self.database.try_to_find_person_from_handle(person_handle) + family_handle = person.get_main_parents_family_handle() + if family_handle: + family = self.database.find_family_from_handle(family_handle) + self.filter(family.get_father_handle(),index*2) + self.filter(family.get_mother_handle(),(index*2)+1) def write_report(self): - self.filter(self.start.get_id(),1) + self.filter(self.start.get_handle(),1) block_size = self.doc.get_usable_width()/14.0 @@ -200,21 +200,21 @@ class FanChart: if self.standalone: self.doc.close() - def get_info(self,person_id): - person = self.database.try_to_find_person_from_id(person_id) + def get_info(self,person_handle): + person = self.database.try_to_find_person_from_handle(person_handle) pn = person.get_primary_name() - birth_id = person.get_birth_id() - if birth_id: - b = self.database.find_event_from_id(birth_id).get_date_object().get_year() + birth_handle = person.get_birth_handle() + if birth_handle: + b = self.database.find_event_from_handle(birth_handle).get_date_object().get_year() if b == Calendar.UNDEF: b = "" else: b = "" - death_id = person.get_death_id() - if death_id: - d = self.database.find_event_from_id(death_id).get_date_object().get_year() + death_handle = person.get_death_handle() + if death_handle: + d = self.database.find_event_from_handle(death_handle).get_date_object().get_year() if d == Calendar.UNDEF: d = "" else: @@ -377,8 +377,8 @@ def report(database,person): _style_file = "fan_chart.xml" _style_name = "default" -_person_id = "" -_options = ( _person_id, ) +_person_handle = "" +_options = ( _person_handle, ) #------------------------------------------------------------------------ # @@ -437,7 +437,7 @@ class FanChartBareDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), ) + self.options = ( self.person.get_handle(), ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ diff --git a/src/plugins/FilterEditor.py b/src/plugins/FilterEditor.py index af0c56c25..872148285 100644 --- a/src/plugins/FilterEditor.py +++ b/src/plugins/FilterEditor.py @@ -174,7 +174,7 @@ class MyID(gtk.HBox): if val == None: self.set_text('') else: - self.set_text(val.get_id()) + self.set_text(val.get_handle()) def get_text(self): return unicode(self.entry.get_text()) @@ -533,8 +533,8 @@ class EditRule: self.pmap = {} self.add_places = [] - for p_id in self.db.get_place_ids(): - p = self.db.try_to_find_place_from_id(p_id) + for p_id in self.db.get_place_handles(): + p = self.db.try_to_find_place_from_handle(p_id) self.pmap[p.get_title()] = p_id self.active_rule = val @@ -764,8 +764,8 @@ class ShowResults: n = [] for p_id in id_list: - p = db.try_to_find_person_from_id(p_id) - n.append ("%s [%s]\n" % (p.get_primary_name().get_name(),p.get_id())) + p = db.try_to_find_person_from_handle(p_id) + n.append ("%s [%s]\n" % (p.get_primary_name().get_name(),p.get_handle())) n.sort () text.get_buffer().set_text(string.join (n, '')) diff --git a/src/plugins/FtmStyleAncestors.py b/src/plugins/FtmStyleAncestors.py index 9df2a5257..8ea7e3c8f 100644 --- a/src/plugins/FtmStyleAncestors.py +++ b/src/plugins/FtmStyleAncestors.py @@ -64,24 +64,24 @@ class FtmAncestorReport(Report.Report): self.sref_map = {} self.sref_index = 0 - def apply_filter(self,person_id,index,generation=1): - if not person_id or generation >= self.max_generations: + def apply_filter(self,person_handle,index,generation=1): + if not person_handle or generation >= self.max_generations: return - self.map[index] = (person_id,generation) + self.map[index] = (person_handle,generation) - person = self.database.try_to_find_person_from_id(person_id) - family_id = person.get_main_parents_family_id() - if family_id: - family = self.database.find_family_from_id(family_id) - self.apply_filter(family.get_father_id(),index*2,generation+1) - self.apply_filter(family.get_mother_id(),(index*2)+1,generation+1) + person = self.database.try_to_find_person_from_handle(person_handle) + family_handle = person.get_main_parents_family_handle() + if family_handle: + family = self.database.find_family_from_handle(family_handle) + self.apply_filter(family.get_father_handle(),index*2,generation+1) + self.apply_filter(family.get_mother_handle(),(index*2)+1,generation+1) def write_report(self): if self.newpage: self.doc.page_break() - self.apply_filter(self.start.get_id(),1) + self.apply_filter(self.start.get_handle(),1) name = self.start.get_primary_name().get_regular_name() self.doc.start_paragraph("FTA-Title") @@ -93,7 +93,7 @@ class FtmAncestorReport(Report.Report): keys.sort() old_gen = 0 for key in keys : - (person_id,generation) = self.map[key] + (person_handle,generation) = self.map[key] if old_gen != generation: if self.pgbrk and generation > 1: self.doc.page_break() @@ -103,7 +103,7 @@ class FtmAncestorReport(Report.Report): self.doc.end_paragraph() old_gen = generation - person = self.database.try_to_find_person_from_id(person_id) + person = self.database.try_to_find_person_from_handle(person_handle) pri_name = person.get_primary_name() self.doc.start_paragraph("FTA-Entry","%d." % key) name = pri_name.get_regular_name() @@ -113,13 +113,13 @@ class FtmAncestorReport(Report.Report): # Check birth record - birth_id = person.get_birth_id() - if birth_id: + birth_handle = person.get_birth_handle() + if birth_handle: birth_valid = 1 - birth = self.database.find_event_from_id(birth_id) - place_id = birth.get_place_id() - if place_id: - bplace = self.database.try_to_find_place_from_id(place_id).get_title() + birth = self.database.find_event_from_handle(birth_handle) + place_handle = birth.get_place_handle() + if place_handle: + bplace = self.database.try_to_find_place_from_handle(place_handle).get_title() else: bplace = u'' bdate = birth.get_date() @@ -128,13 +128,13 @@ class FtmAncestorReport(Report.Report): bplace = u'' bdate = u'' - death_id = person.get_death_id() - if death_id: + death_handle = person.get_death_handle() + if death_handle: death_valid = 1 - death = self.database.find_event_from_id(death_id) - place_id = death.get_place_id() - if place_id: - dplace = self.database.try_to_find_place_from_id(place_id).get_title() + death = self.database.find_event_from_handle(death_handle) + place_handle = death.get_place_handle() + if place_handle: + dplace = self.database.try_to_find_place_from_handle(place_handle).get_title() else: dplace = u'' ddate = death.get_date() @@ -448,7 +448,7 @@ class FtmAncestorReport(Report.Report): keys.sort() for key in keys: srcref = self.sref_map[key] - base = self.database.try_to_find_source_from_id(srcref.get_base_id()) + base = self.database.try_to_find_source_from_handle(srcref.get_base_handle()) self.doc.start_paragraph('FTA-Endnotes',"%d." % key) self.doc.write_text(base.get_title()) @@ -485,10 +485,10 @@ class FtmAncestorReport(Report.Report): if not first: msg.write(',') first = 0 - ref_base = ref.get_base_id() + ref_base = ref.get_base_handle() the_key = 0 for key in self.sref_map.keys(): - if ref_base == self.sref_map[key].get_base_id(): + if ref_base == self.sref_map[key].get_base_handle(): the_key = key break if the_key: @@ -532,16 +532,16 @@ class FtmAncestorReport(Report.Report): self.doc.end_paragraph() ncount += 1 - for event_id in person.get_event_list(): - event = self.database.find_event_from_id(event_id) + for event_handle in person.get_event_list(): + event = self.database.find_event_from_handle(event_handle) date = event.get_date() - place_id = event.get_place_id() - if place_id: - place = self.database.try_to_find_place_from_id(place_id).get_title() + place_handle = event.get_place_handle() + if place_handle: + place = self.database.try_to_find_place_from_handle(place_handle).get_title() else: place = u'' - if not date and not place_id: + if not date and not place_handle: continue if first: self.doc.start_paragraph('FTA-SubEntry') @@ -573,32 +573,32 @@ class FtmAncestorReport(Report.Report): self.doc.end_paragraph() def print_spouse(self,person): - family_list = person.get_family_id_list() + family_list = person.get_family_handle_list() if not family_list: return - family_id = family_list[0] - family = self.database.find_family_from_id(family_id) - if family.get_father_id() == person.get_id(): - spouse_id = family.get_mother_id() + family_handle = family_list[0] + family = self.database.find_family_from_handle(family_handle) + if family.get_father_handle() == person.get_handle(): + spouse_id = family.get_mother_handle() else: - spouse_id = family.get_father_id() + spouse_id = family.get_father_handle() if not spouse_id: return - spouse = self.database.try_to_find_person_from_id(spouse_id) + spouse = self.database.try_to_find_person_from_handle(spouse_id) spouse_name = spouse.get_primary_name().get_regular_name() - for event_id in family.get_event_list(): - if event_id: - event = self.database.find_event_from_id(event_id) + for event_handle in family.get_event_list(): + if event_handle: + event = self.database.find_event_from_handle(event_handle) if event.get_name() == "Marriage": break else: return date = event.get_date() - place_id = event.get_place_id() - if place_id: - place = self.database.try_to_find_place_from_id(place_id).get_title() + place_handle = event.get_place_handle() + if place_handle: + place = self.database.try_to_find_place_from_handle(place_handle).get_title() else: place = u'' @@ -650,14 +650,14 @@ class FtmAncestorReport(Report.Report): }) self.doc.write_text(' ') - death_id = spouse.get_death_id() - if death_id: + death_handle = spouse.get_death_handle() + if death_handle: death_valid = 1 - death = self.database.find_event_from_id(death_id) + death = self.database.find_event_from_handle(death_handle) ddate = death.get_date() - place_id = death.get_place_id() - if place_id: - dplace = self.database.try_to_find_place_from_id(place_id).get_title() + place_handle = death.get_place_handle() + if place_handle: + dplace = self.database.try_to_find_place_from_handle(place_handle).get_title() else: dplace = u'' else: @@ -665,14 +665,14 @@ class FtmAncestorReport(Report.Report): dplace = u'' ddate = u'' - birth_id = spouse.get_birth_id() - if birth_id: + birth_handle = spouse.get_birth_handle() + if birth_handle: birth_valid = 1 - birth = self.database.find_event_from_id(birth_id) + birth = self.database.find_event_from_handle(birth_handle) bdate = birth.get_date() - place_id = birth.get_place_id() - if place_id: - bplace = self.database.try_to_find_place_from_id(place_id).get_title() + place_handle = birth.get_place_handle() + if place_handle: + bplace = self.database.try_to_find_place_from_handle(place_handle).get_title() else: bplace = u'' else: @@ -956,20 +956,20 @@ class FtmAncestorReport(Report.Report): def print_parents(self,person,dead): - family_id = person.get_main_parents_family_id() - if family_id: - family = self.database.find_family_from_id(family_id) - mother_id = family.get_mother_id() - father_id = family.get_father_id() - if mother_id: - mother = self.database.try_to_find_person_from_id(mother_id) + family_handle = person.get_main_parents_family_handle() + if family_handle: + family = self.database.find_family_from_handle(family_handle) + mother_handle = family.get_mother_handle() + father_handle = family.get_father_handle() + if mother_handle: + mother = self.database.try_to_find_person_from_handle(mother_handle) mother_name = mother.get_primary_name().get_regular_name() - if father_id: - father = self.database.try_to_find_person_from_id(father_id) + if father_handle: + father = self.database.try_to_find_person_from_handle(father_handle) father_name = father.get_primary_name().get_regular_name() if person.get_gender() == RelLib.Person.male: - if mother_id and father_id: + if mother_handle and father_handle: if dead: self.doc.write_text(_("He was the son of %(father)s and %(mother)s.") % { 'father' : father_name, @@ -978,14 +978,14 @@ class FtmAncestorReport(Report.Report): self.doc.write_text(_("He is the son of %(father)s and %(mother)s.") % { 'father' : father_name, 'mother' : mother_name, }) - elif mother_id: + elif mother_handle: if dead: self.doc.write_text(_("He was the son of %(mother)s.") % { 'mother' : mother_name, }) else: self.doc.write_text(_("He is the son of %(mother)s.") % { 'mother' : mother_name, }) - elif father_id: + elif father_handle: if dead: self.doc.write_text(_("He was the son of %(father)s.") % { 'father' : father_name, }) @@ -993,7 +993,7 @@ class FtmAncestorReport(Report.Report): self.doc.write_text(_("He is the son of %(father)s.") % { 'father' : father_name, }) else: - if mother_id and father_id: + if mother_handle and father_handle: if dead: self.doc.write_text(_("She was the daughter of %(father)s and %(mother)s.") % { 'father' : father_name, @@ -1002,14 +1002,14 @@ class FtmAncestorReport(Report.Report): self.doc.write_text(_("She is the daughter of %(father)s and %(mother)s.") % { 'father' : father_name, 'mother' : mother_name, }) - elif mother_id: + elif mother_handle: if dead: self.doc.write_text(_("She was the daughter of %(mother)s.") % { 'mother' : mother_name, }) else: self.doc.write_text(_("She is the daughter of %(mother)s.") % { 'mother' : mother_name, }) - elif father_id: + elif father_handle: if dead: self.doc.write_text(_("She was the daughter of %(father)s.") % { 'father' : father_name, }) @@ -1133,10 +1133,10 @@ def report(database,person): _style_file = "ftm_ancestor_report.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _max_gen = 10 _pg_brk = 0 -_options = ( _person_id, _max_gen, _pg_brk ) +_options = ( _person_handle, _max_gen, _pg_brk ) #------------------------------------------------------------------------ # @@ -1199,7 +1199,7 @@ class FtmAncestorBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), self.max_gen, self.pg_brk ) + self.options = ( self.person.get_handle(), self.max_gen, self.pg_brk ) self.style_name = self.selected_style.get_name() diff --git a/src/plugins/FtmStyleDescendants.py b/src/plugins/FtmStyleDescendants.py index e3874f4ae..d7cd78827 100644 --- a/src/plugins/FtmStyleDescendants.py +++ b/src/plugins/FtmStyleDescendants.py @@ -85,24 +85,24 @@ class FtmDescendantReport(Report.Report): cell = BaseDoc.TableCellStyle() self.doc.add_cell_style('FTD-Normal',cell) - def apply_filter(self,person_id,index,generation=1): + def apply_filter(self,person_handle,index,generation=1): - if (not person_id) or (generation > self.max_generations): + if (not person_handle) or (generation > self.max_generations): return - self.anc_map[index] = person_id + self.anc_map[index] = person_handle try: self.gen_map[generation].append(index) except: self.gen_map[generation] = [] self.gen_map[generation].append(index) - person = self.database.try_to_find_person_from_id(person_id) - for family_id in person.get_family_id_list(): - family = self.database.find_family_from_id(family_id) - for child_id in family.get_child_id_list(): + person = self.database.try_to_find_person_from_handle(person_handle) + for family_handle in person.get_family_handle_list(): + family = self.database.find_family_from_handle(family_handle) + for child_handle in family.get_child_handle_list(): ix = max(self.anc_map.keys()) - self.apply_filter(child_id,ix+1,generation+1) + self.apply_filter(child_handle,ix+1,generation+1) def write_report(self): @@ -110,7 +110,7 @@ class FtmDescendantReport(Report.Report): if self.newpage: self.doc.page_break() - self.apply_filter(self.start.get_id(),1) + self.apply_filter(self.start.get_handle(),1) name = self.start.get_primary_name().get_regular_name() self.doc.start_paragraph("FTD-Title") @@ -132,8 +132,8 @@ class FtmDescendantReport(Report.Report): indexlist = self.gen_map[generation] indexlist.sort() for key in indexlist: - person_id = self.anc_map[key] - person = self.database.try_to_find_person_from_id(person_id) + person_handle = self.anc_map[key] + person = self.database.try_to_find_person_from_handle(person_handle) pri_name = person.get_primary_name() self.doc.start_paragraph("FTD-Entry","%d." % key) @@ -144,25 +144,25 @@ class FtmDescendantReport(Report.Report): # Check birth record - birth_id = person.get_birth_id() + birth_handle = person.get_birth_handle() bplace = "" bdate = "" - if birth_id: - birth = self.database.find_event_from_id(birth_id) + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle) bdate = birth.get_date() - bplace_id = birth.get_place_id() - if bplace_id: - bplace = self.database.try_to_find_place_from_id(bplace_id).get_title() + bplace_handle = birth.get_place_handle() + if bplace_handle: + bplace = self.database.try_to_find_place_from_handle(bplace_handle).get_title() - death_id = person.get_death_id() + death_handle = person.get_death_handle() dplace = "" ddate = "" - if death_id: - death = self.database.find_event_from_id(death_id) + if death_handle: + death = self.database.find_event_from_handle(death_handle) ddate = death.get_date() - dplace_id = death.get_place_id() - if dplace_id: - dplace = self.database.try_to_find_place_from_id(dplace_id).get_title() + dplace_handle = death.get_place_handle() + if dplace_handle: + dplace = self.database.try_to_find_place_from_handle(dplace_handle).get_title() birth_valid = bdate or bplace death_valid = ddate or dplace @@ -475,8 +475,8 @@ class FtmDescendantReport(Report.Report): keys.sort() for key in keys: srcref = self.sref_map[key] - base_id = srcref.get_base_id() - base = self.database.try_to_find_source_from_id(base_id) + base_handle = srcref.get_base_handle() + base = self.database.try_to_find_source_from_handle(base_handle) self.doc.start_paragraph('FTD-Endnotes',"%d." % key) self.doc.write_text(base.get_title()) @@ -513,10 +513,10 @@ class FtmDescendantReport(Report.Report): if not first: msg.write(',') first = 0 - ref_base = ref.get_base_id() + ref_base = ref.get_base_handle() the_key = 0 for key in self.sref_map.keys(): - if ref_base == self.sref_map[key].get_base_id(): + if ref_base == self.sref_map[key].get_base_handle(): the_key = key break if the_key: @@ -560,14 +560,14 @@ class FtmDescendantReport(Report.Report): self.doc.end_paragraph() ncount += 1 - for event_id in person.get_event_list(): - if not event_id: + for event_handle in person.get_event_list(): + if not event_handle: continue - event = self.database.find_event_from_id(event_id) + event = self.database.find_event_from_handle(event_handle) date = event.get_date() - place_id = event.get_place_id() - if place_id: - place = self.database.try_to_find_place_from_id(place_id) + place_handle = event.get_place_handle() + if place_handle: + place = self.database.try_to_find_place_from_handle(place_handle) else: place = None @@ -607,23 +607,23 @@ class FtmDescendantReport(Report.Report): first = 1 - for family_id in person.get_family_id_list(): - family = self.database.find_family_from_id(family_id) - father_id = family.get_father_id() - mother_id = family.get_mother_id() - if father_id and mother_id: - husband = self.database.try_to_find_person_from_id(father_id).get_primary_name().get_regular_name() - wife = self.database.try_to_find_person_from_id(mother_id).get_primary_name().get_regular_name() + for family_handle in person.get_family_handle_list(): + family = self.database.find_family_from_handle(family_handle) + father_handle = family.get_father_handle() + mother_handle = family.get_mother_handle() + if father_handle and mother_handle: + husband = self.database.try_to_find_person_from_handle(father_handle).get_primary_name().get_regular_name() + wife = self.database.try_to_find_person_from_handle(mother_handle).get_primary_name().get_regular_name() else: continue - for event_id in family.get_event_list(): - if not event_id: + for event_handle in family.get_event_list(): + if not event_handle: continue - event = self.database.find_event_from_id(event_id) + event = self.database.find_event_from_handle(event_handle) date = event.get_date() - place_id = event.get_place_id() - if place_id: - place = self.database.try_to_find_place_from_id(place_id) + place_handle = event.get_place_handle() + if place_handle: + place = self.database.try_to_find_place_from_handle(place_handle) else: place = None @@ -662,25 +662,25 @@ class FtmDescendantReport(Report.Report): name = person.get_primary_name().get_regular_name() - for family_id in person.get_family_id_list(): - family = self.database.find_family_from_id(family_id) + for family_handle in person.get_family_handle_list(): + family = self.database.find_family_from_handle(family_handle) first = 1 - father_id = family.get_father_id() - mother_id = family.get_mother_id() - if father_id == person.get_id(): - spouse_id = mother_id + father_handle = family.get_father_handle() + mother_handle = family.get_mother_handle() + if father_handle == person.get_handle(): + spouse_id = mother_handle else: - spouse_id = father_id - spouse = self.database.try_to_find_person_from_id(spouse_id) + spouse_id = father_handle + spouse = self.database.try_to_find_person_from_handle(spouse_id) child_index = 0 - for child_id in family.get_child_id_list(): - child = self.database.try_to_find_person_from_id(child_id) + for child_handle in family.get_child_handle_list(): + child = self.database.try_to_find_person_from_handle(child_handle) child_index = child_index + 1 child_name = child.get_primary_name().get_regular_name() for (ind,p_id) in self.anc_map.items(): - if p_id == child_id: + if p_id == child_handle: index = ind if first: @@ -692,7 +692,7 @@ class FtmDescendantReport(Report.Report): else: self.doc.write_text(_('Children of %(person_name)s are:') % { 'person_name' : name }) self.doc.end_paragraph() - self.doc.start_table(family.get_id(),'FTD-ChildTable') + self.doc.start_table(family.get_handle(),'FTD-ChildTable') self.doc.start_row() self.doc.start_cell('FTD-Normal') @@ -710,25 +710,25 @@ class FtmDescendantReport(Report.Report): self.doc.start_cell('FTD-Normal') self.doc.start_paragraph('FTD-Details') - birth_id = child.get_birth_id() + birth_handle = child.get_birth_handle() bplace = "" bdate = "" - if birth_id: - birth = self.database.find_event_from_id(birth_id) + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle) bdate = birth.get_date() - bplace_id = birth.get_place_id() - if bplace_id: - bplace = self.database.try_to_find_place_from_id(bplace_id).get_title() + bplace_handle = birth.get_place_handle() + if bplace_handle: + bplace = self.database.try_to_find_place_from_handle(bplace_handle).get_title() - death_id = child.get_death_id() + death_handle = child.get_death_handle() dplace = "" ddate = "" - if death_id: - death = self.database.find_event_from_id(death_id) + if death_handle: + death = self.database.find_event_from_handle(death_handle) ddate = death.get_date() - dplace_id = death.get_place_id() - if dplace_id: - dplace = self.database.try_to_find_place_from_id(dplace_id).get_title() + dplace_handle = death.get_place_handle() + if dplace_handle: + dplace = self.database.try_to_find_place_from_handle(dplace_handle).get_title() if child.get_gender() == RelLib.Person.male: if bdate: @@ -996,22 +996,22 @@ class FtmDescendantReport(Report.Report): def print_spouse(self,person): - family_list = person.get_family_id_list() + family_list = person.get_family_handle_list() if not family_list: return - family_id = family_list[0] - family = self.database.find_family_from_id(family_id) - if family.get_father_id() == person.get_id(): - spouse_id = family.get_mother_id() + family_handle = family_list[0] + family = self.database.find_family_from_handle(family_handle) + if family.get_father_handle() == person.get_handle(): + spouse_id = family.get_mother_handle() else: - spouse_id = family.get_father_id() + spouse_id = family.get_father_handle() if not spouse_id: return - spouse = self.database.try_to_find_person_from_id(spouse_id) + spouse = self.database.try_to_find_person_from_handle(spouse_id) - for event_id in family.get_event_list(): - if event_id: - event = self.database.find_event_from_id(event_id) + for event_handle in family.get_event_list(): + if event_handle: + event = self.database.find_event_from_handle(event_handle) if event.get_name() == "Marriage": break else: @@ -1020,9 +1020,9 @@ class FtmDescendantReport(Report.Report): if not event: return date = event.get_date() - place_id = event.get_place_id() - if place_id: - place = self.database.try_to_find_place_from_id(place_id).get_title() + place_handle = event.get_place_handle() + if place_handle: + place = self.database.try_to_find_place_from_handle(place_handle).get_title() else: place = "" @@ -1072,25 +1072,25 @@ class FtmDescendantReport(Report.Report): 'endnotes' : self.endnotes(event)}) self.doc.write_text(' ') - birth_id = spouse.get_birth_id() + birth_handle = spouse.get_birth_handle() bplace = "" bdate = "" - if birth_id: - birth = self.database.find_event_from_id(birth_id) + if birth_handle: + birth = self.database.find_event_from_handle(birth_handle) bdate = birth.get_date() - bplace_id = birth.get_place_id() - if bplace_id: - bplace = self.database.try_to_find_place_from_id(bplace_id).get_title() + bplace_handle = birth.get_place_handle() + if bplace_handle: + bplace = self.database.try_to_find_place_from_handle(bplace_handle).get_title() - death_id = spouse.get_death_id() + death_handle = spouse.get_death_handle() dplace = "" ddate = "" - if death_id: - death = self.database.find_event_from_id(death_id) + if death_handle: + death = self.database.find_event_from_handle(death_handle) ddate = death.get_date() - dplace_id = death.get_place_id() - if dplace_id: - dplace = self.database.try_to_find_place_from_id(dplace_id).get_title() + dplace_handle = death.get_place_handle() + if dplace_handle: + dplace = self.database.try_to_find_place_from_handle(dplace_handle).get_title() death_valid = ddate or dplace birth_valid = bdate or bplace @@ -1379,17 +1379,17 @@ class FtmDescendantReport(Report.Report): def print_parents(self,person,dead): - family_id = person.get_main_parents_family_id() - if family_id: - family = self.database.find_family_from_id(family_id) - mother_id = family.get_mother_id() - if mother_id: - mother = self.database.try_to_find_person_from_id(mother_id) + family_handle = person.get_main_parents_family_handle() + if family_handle: + family = self.database.find_family_from_handle(family_handle) + mother_handle = family.get_mother_handle() + if mother_handle: + mother = self.database.try_to_find_person_from_handle(mother_handle) else: mother = None - father_id = family.get_father_id() - if father_id: - father = self.database.try_to_find_person_from_id(father_id) + father_handle = family.get_father_handle() + if father_handle: + father = self.database.try_to_find_person_from_handle(father_handle) else: father = None if person.get_gender() == RelLib.Person.male: @@ -1567,10 +1567,10 @@ def report(database,person): _style_file = "ftm_descendant_report.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _max_gen = 10 _pg_brk = 0 -_options = ( _person_id, _max_gen, _pg_brk ) +_options = ( _person_handle, _max_gen, _pg_brk ) #------------------------------------------------------------------------ # @@ -1633,7 +1633,7 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), self.max_gen, self.pg_brk ) + self.options = ( self.person.get_handle(), self.max_gen, self.pg_brk ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ diff --git a/src/plugins/GraphViz.py b/src/plugins/GraphViz.py index 8c17c8b79..ad46092ca 100644 --- a/src/plugins/GraphViz.py +++ b/src/plugins/GraphViz.py @@ -110,15 +110,15 @@ class GraphVizDialog(Report.ReportDialog): des = GenericFilter.GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(GenericFilter.IsDescendantOf([self.person.get_id(),1])) + des.add_rule(GenericFilter.IsDescendantOf([self.person.get_handle(),1])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_id(),1])) + ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_handle(),1])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % name) - com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.get_id()])) + com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.get_handle()])) return [all,des,ans,com] @@ -394,20 +394,20 @@ def dump_person(database,person_list,file,adoptionsdashed,arrowheadstyle, for p_id in person_list: person_dict[p_id] = 1 - for person_id in person_list: - pid = string.replace(person_id,'-','_') - person = database.try_to_find_person_from_id(person_id) - for family_id, mrel, frel in person.get_parent_family_id_list(): - family = database.find_family_from_id(family_id) - father_id = family.get_father_id() - mother_id = family.get_mother_id() + for person_handle in person_list: + pid = string.replace(person_handle,'-','_') + person = database.try_to_find_person_from_handle(person_handle) + for family_handle, mrel, frel in person.get_parent_family_handle_list(): + family = database.find_family_from_handle(family_handle) + father_handle = family.get_father_handle() + mother_handle = family.get_mother_handle() fadopted = frel != _("Birth") madopted = mrel != _("Birth") if (show_families and - (father_id and person_dict.has_key(father_id) or - mother_id and person_dict.has_key(mother_id))): + (father_handle and person_dict.has_key(father_handle) or + mother_handle and person_dict.has_key(mother_handle))): # Link to the family node. - famid = string.replace(family_id,'-','_') + famid = string.replace(family_handle,'-','_') file.write('p%s -> f%s [' % (pid, famid)) file.write('arrowhead=%s, arrowtail=%s, ' % (arrowheadstyle, arrowtailstyle)) @@ -418,8 +418,8 @@ def dump_person(database,person_list,file,adoptionsdashed,arrowheadstyle, file.write('];\n') else: # Link to the parents' nodes directly. - if father_id and person_dict.has_key(father_id): - fid = string.replace(father_id,'-','_') + if father_handle and person_dict.has_key(father_handle): + fid = string.replace(father_handle,'-','_') file.write('p%s -> p%s [' % (pid, fid)) file.write('arrowhead=%s, arrowtail=%s, ' % (arrowheadstyle, arrowtailstyle)) @@ -428,8 +428,8 @@ def dump_person(database,person_list,file,adoptionsdashed,arrowheadstyle, else: file.write('style=solid') file.write('];\n') - if mother_id and person_dict.has_key(mother_id): - mid = string.replace(mother_id,'-','_') + if mother_handle and person_dict.has_key(mother_handle): + mid = string.replace(mother_handle,'-','_') file.write('p%s -> p%s [' % (pid, mid)) file.write('arrowhead=%s, arrowtail=%s, ' % (arrowheadstyle, arrowtailstyle)) @@ -449,15 +449,15 @@ def dump_index(database,person_list,file,includedates,includeurl,colorize, # The list of families for which we have output the node, so we # don't do it twice. families_done = [] - for person_id in person_list: - person = database.try_to_find_person_from_id(person_id) + for person_handle in person_list: + person = database.try_to_find_person_from_handle(person_handle) # Output the person's node. label = person.get_primary_name().get_name() - id = string.replace(person_id,'-','_') + id = string.replace(person_handle,'-','_') if includedates: - birth_id = person.get_birth_id() - if birth_id: - birth_event = database.find_event_from_id(birth_id) + birth_handle = person.get_birth_handle() + if birth_handle: + birth_event = database.find_event_from_handle(birth_handle) if birth_event.get_date_object().get_year_valid(): if just_year: birth = '%i' % birth_event.get_date_object().get_year() @@ -465,9 +465,9 @@ def dump_index(database,person_list,file,includedates,includeurl,colorize, birth = birth_event.get_date() else: birth = '' - death_id = person.get_death_id() - if death_id: - death_event = database.find_event_from_id(death_id) + death_handle = person.get_death_handle() + if death_handle: + death_event = database.find_event_from_handle(death_handle) if death_event.get_date_object().get_year_valid(): if just_year: death = '%i' % death_event.get_date_object().get_year() @@ -493,18 +493,18 @@ def dump_index(database,person_list,file,includedates,includeurl,colorize, file.write('fontname="%s", label="%s"];\n' % (font,utf8_to_latin(label))) # Output families's nodes. if show_families: - family_list = person.get_family_id_list() + family_list = person.get_family_handle_list() for fam_id in family_list: fid = string.replace(fam_id,'-','_') if fam_id not in families_done: families_done.append(fam_id) file.write('f%s [shape=ellipse, ' % fid) marriage = "" - fam = database.find_family_from_id(fam_id) + fam = database.find_family_from_handle(fam_id) - for event_id in fam.get_event_list(): - if event_id: - event = database.find_event_from_id(event_id) + for event_handle in fam.get_event_list(): + if event_handle: + event = database.find_event_from_handle(event_handle) if event.get_name() == "Marriage": m = event break diff --git a/src/plugins/IndivComplete.py b/src/plugins/IndivComplete.py index 2d35aab15..de5f5b6b6 100644 --- a/src/plugins/IndivComplete.py +++ b/src/plugins/IndivComplete.py @@ -54,11 +54,11 @@ import gtk # Set up sane defaults for the book_item # #------------------------------------------------------------------------ -_person_id = "" +_person_handle = "" _max_gen = 0 _pg_brk = 0 _filter_num = 0 -_options = ( _person_id, _max_gen, _pg_brk, _filter_num ) +_options = ( _person_handle, _max_gen, _pg_brk, _filter_num ) #------------------------------------------------------------------------ # @@ -122,9 +122,9 @@ class IndivComplete(Report.Report): return name = _(event.get_name()) date = event.get_date() - place_id = event.get_place_id() - if place_id: - place = self.database.try_to_find_place_from_id(place_id).get_title() + place_handle = event.get_place_handle() + if place_handle: + place = self.database.try_to_find_place_from_handle(place_handle).get_title() else: place = "" description = event.get_description() @@ -145,9 +145,9 @@ class IndivComplete(Report.Report): self.normal_cell(name) if self.use_srcs: for s in event.get_source_references(): - #src_id = s.get_base_id() - #src = self.database.find_source_from_id(src_id) - text = "%s [%s]" % (text,s.get_base_id()) + #src_id = s.get_base_handle() + #src = self.database.find_source_from_handle(src_id) + text = "%s [%s]" % (text,s.get_base_handle()) self.slist.append(s) self.normal_cell(text) self.d.end_row() @@ -189,7 +189,7 @@ class IndivComplete(Report.Report): def write_alt_parents(self): - if len(self.person.get_parent_family_id_list()) < 2: + if len(self.person.get_parent_family_handle_list()) < 2: return self.d.start_table("altparents","IDS-IndTable") @@ -201,23 +201,23 @@ class IndivComplete(Report.Report): self.d.end_cell() self.d.end_row() - for (family_id,mrel,frel) in self.person.get_parent_family_id_list(): - if family_id == self.person.get_main_parents_family_id(): + for (family_handle,mrel,frel) in self.person.get_parent_family_handle_list(): + if family_handle == self.person.get_main_parents_family_handle(): continue - family = self.database.find_family_from_id(family_id) - father_id = family.get_father_id() - if father_id: - father = self.database.try_to_find_person_from_id(father_id) + family = self.database.find_family_from_handle(family_handle) + father_handle = family.get_father_handle() + if father_handle: + father = self.database.try_to_find_person_from_handle(father_handle) fname = father.get_primary_name().get_regular_name() frel = const.child_relations.find_value(frel) self.write_p_entry(_('Father'),fname,frel) else: self.write_p_entry(_('Father'),'','') - mother_id = family.get_mother_id() - if mother_id: - mother = self.database.try_to_find_person_from_id(mother_id) + mother_handle = family.get_mother_handle() + if mother_handle: + mother = self.database.try_to_find_person_from_handle(mother_handle) fname = mother.get_primary_name().get_regular_name() frel = const.child_relations.find_value(frel) self.write_p_entry(_('Mother'),fname,frel) @@ -249,7 +249,7 @@ class IndivComplete(Report.Report): text = name.get_regular_name() if self.use_srcs: for s in name.get_source_references(): - text = "%s [%s]" % (text,s.get_base_id().get_id()) + text = "%s [%s]" % (text,s.get_base_handle().get_handle()) self.slist.append(s) self.normal_cell(text) self.d.end_row() @@ -259,7 +259,7 @@ class IndivComplete(Report.Report): def write_families(self): - if not len(self.person.get_family_id_list()): + if not len(self.person.get_family_handle_list()): return self.d.start_table("three","IDS-IndTable") @@ -271,17 +271,17 @@ class IndivComplete(Report.Report): self.d.end_cell() self.d.end_row() - for family_id in self.person.get_family_id_list(): - family = self.database.find_family_from_id(family_id) - if self.person.get_id() == family.get_father_id(): - spouse_id = family.get_mother_id() + for family_handle in self.person.get_family_handle_list(): + family = self.database.find_family_from_handle(family_handle) + if self.person.get_handle() == family.get_father_handle(): + spouse_id = family.get_mother_handle() else: - spouse_id = family.get_father_id() + spouse_id = family.get_father_handle() self.d.start_row() self.d.start_cell("IDS-NormalCell",2) self.d.start_paragraph("IDS-Spouse") if spouse_id: - spouse = self.database.try_to_find_person_from_id(spouse_id) + spouse = self.database.try_to_find_person_from_handle(spouse_id) text = spouse.get_primary_name().get_regular_name() else: text = _("unknown") @@ -290,13 +290,13 @@ class IndivComplete(Report.Report): self.d.end_cell() self.d.end_row() - for event_id in family.get_event_list(): - if event_id: - event = self.database.find_event_from_id(event_id) + for event_handle in family.get_event_list(): + if event_handle: + event = self.database.find_event_from_handle(event_handle) self.write_fact(event) - child_id_list = family.get_child_id_list() - if len(child_id_list): + child_handle_list = family.get_child_handle_list() + if len(child_handle_list): self.d.start_row() self.normal_cell(_("Children")) @@ -304,12 +304,12 @@ class IndivComplete(Report.Report): self.d.start_paragraph("IDS-Normal") first = 1 - for child_id in child_id_list: + for child_handle in child_handle_list: if first == 1: first = 0 else: self.d.write_text('\n') - child = self.database.try_to_find_person_from_id(child_id) + child = self.database.try_to_find_person_from_handle(child_handle) self.d.write_text(child.get_primary_name().get_regular_name()) self.d.end_paragraph() self.d.end_cell() @@ -334,9 +334,9 @@ class IndivComplete(Report.Report): for source in self.slist: self.d.start_row() - s_id = source.get_base_id() + s_id = source.get_base_handle() self.normal_cell(s_id) - src = self.database.try_to_find_source_from_id(s_id) + src = self.database.try_to_find_source_from_handle(s_id) self.normal_cell(src.get_title()) self.d.end_row() self.d.end_table() @@ -351,11 +351,11 @@ class IndivComplete(Report.Report): self.d.end_cell() self.d.end_row() - event_id_list = [ self.person.get_birth_id(), self.person.get_death_id() ] - event_id_list = event_id_list + self.person.get_event_list() - for event_id in event_id_list: - if event_id: - event = self.database.find_event_from_id(event_id) + event_handle_list = [ self.person.get_birth_handle(), self.person.get_death_handle() ] + event_handle_list = event_handle_list + self.person.get_event_list() + for event_handle in event_handle_list: + if event_handle: + event = self.database.find_event_from_handle(event_handle) self.write_fact(event) self.d.end_table() self.d.start_paragraph("IDS-Normal") @@ -372,7 +372,7 @@ class IndivComplete(Report.Report): if self.newpage: self.d.page_break() - #plist = self.database.get_person_id_map().values() + #plist = self.database.get_person_handle_map().values() plist = self.database.get_person_keys() if self.filter: ind_list = self.filter.apply(self.database,plist) @@ -380,8 +380,8 @@ class IndivComplete(Report.Report): ind_list = plist count = 0 - for person_id in ind_list: - self.person = self.database.try_to_find_person_from_id(person_id) + for person_handle in ind_list: + self.person = self.database.try_to_find_person_from_handle(person_handle) self.write_person(count) count = count + 1 self.end() @@ -401,8 +401,8 @@ class IndivComplete(Report.Report): self.d.end_paragraph() if len(media_list) > 0: - object_id = media_list[0].get_reference_id() - object = self.database.try_to_find_object_from_id(object_id) + object_handle = media_list[0].get_reference_handle() + object = self.database.try_to_find_object_from_handle(object_handle) if object.get_mime_type()[0:5] == "image": file = object.get_path() self.d.start_paragraph("IDS-Normal") @@ -418,7 +418,7 @@ class IndivComplete(Report.Report): if self.use_srcs: for s in name.get_source_references(): self.slist.append(s) - text = "%s [%s]" % (text,s.get_base_id()) + text = "%s [%s]" % (text,s.get_base_handle()) self.normal_cell(text) self.d.end_row() @@ -430,18 +430,18 @@ class IndivComplete(Report.Report): self.normal_cell(_("Female")) self.d.end_row() - family_id = self.person.get_main_parents_family_id() - if family_id: - family = self.database.find_family_from_id(family_id) - father_inst_id = family.get_father_id() + family_handle = self.person.get_main_parents_family_handle() + if family_handle: + family = self.database.find_family_from_handle(family_handle) + father_inst_id = family.get_father_handle() if father_inst_id: - father_inst = self.database.try_to_find_person_from_id(father_inst_id) + father_inst = self.database.try_to_find_person_from_handle(father_inst_id) father = father_inst.get_primary_name().get_regular_name() else: father = "" - mother_inst_id = family.get_mother_id() + mother_inst_id = family.get_mother_handle() if mother_inst_id: - mother_inst = self.database.try_to_find_person_from_id(mother_inst_id) + mother_inst = self.database.try_to_find_person_from_handle(mother_inst_id) mother = mother_inst.get_primary_name().get_regular_name() else: mother = "" @@ -634,7 +634,7 @@ class IndivCompleteBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person self.filter_num = self.filter_combo.get_history() - self.options = ( self.person.get_id(), self.max_gen, self.pg_brk, self.filter_num ) + self.options = ( self.person.get_handle(), self.max_gen, self.pg_brk, self.filter_num ) self.style_name = self.selected_style.get_name() @@ -725,15 +725,15 @@ def _get_report_filters(person): filt_id = GenericFilter.GenericFilter() filt_id.set_name(name) - filt_id.add_rule(GenericFilter.HasIdOf([person.get_id()])) + filt_id.add_rule(GenericFilter.HasIdOf([person.get_handle()])) des = GenericFilter.GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(GenericFilter.IsDescendantOf([person.get_id()])) + des.add_rule(GenericFilter.IsDescendantOf([person.get_handle()])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(GenericFilter.IsAncestorOf([person.get_id()])) + ans.add_rule(GenericFilter.IsAncestorOf([person.get_handle()])) all = GenericFilter.GenericFilter() all.set_name(_("Entire Database")) diff --git a/src/plugins/IndivSummary.py b/src/plugins/IndivSummary.py index 44fb45ebd..3dc3d8463 100644 --- a/src/plugins/IndivSummary.py +++ b/src/plugins/IndivSummary.py @@ -56,10 +56,10 @@ from gettext import gettext as _ # #------------------------------------------------------------------------ -_person_id = "" +_person_handle = "" _max_gen = 0 _pg_brk = 0 -_options = ( _person_id, _max_gen, _pg_brk ) +_options = ( _person_handle, _max_gen, _pg_brk ) #------------------------------------------------------------------------ @@ -116,9 +116,9 @@ class IndivSummary(Report.Report): return name = const.display_event(event.get_name()) date = event.get_date() - place_id = event.get_place_id() - if place_id: - place_obj = self.database.try_to_find_place_from_id(place_id) + place_handle = event.get_place_handle() + if place_handle: + place_obj = self.database.try_to_find_place_from_handle(place_handle) place = place_obj.get_title() else: place = "" @@ -167,18 +167,18 @@ class IndivSummary(Report.Report): self.d.end_cell() self.d.end_row() - for family_id in self.person.get_family_id_list(): - family = self.database.find_family_from_id(family_id) - if self.person.get_id() == family.get_father_id(): - spouse_id = family.get_mother_id() + for family_handle in self.person.get_family_handle_list(): + family = self.database.find_family_from_handle(family_handle) + if self.person.get_handle() == family.get_father_handle(): + spouse_id = family.get_mother_handle() else: - spouse_id = family.get_father_id() + spouse_id = family.get_father_handle() self.d.start_row() self.d.start_cell("IVS-NormalCell",2) self.d.start_paragraph("IVS-Spouse") if spouse_id: - spouse = self.database.try_to_find_person_from_id(spouse_id) + spouse = self.database.try_to_find_person_from_handle(spouse_id) self.d.write_text(spouse.get_primary_name().get_regular_name()) else: self.d.write_text(_("unknown")) @@ -186,11 +186,11 @@ class IndivSummary(Report.Report): self.d.end_cell() self.d.end_row() - for event_id in family.get_event_list(): - event = self.database.find_event_from_id(event_id) + for event_handle in family.get_event_list(): + event = self.database.find_event_from_handle(event_handle) self.write_fact(event) - child_list = family.get_child_id_list() + child_list = family.get_child_handle_list() if len(child_list): self.d.start_row() self.d.start_cell("IVS-NormalCell") @@ -203,12 +203,12 @@ class IndivSummary(Report.Report): self.d.start_paragraph("IVS-Normal") first = 1 - for child_id in child_list: + for child_handle in child_list: if first == 1: first = 0 else: self.d.write_text('\n') - child = self.database.try_to_find_person_from_id(child_id) + child = self.database.try_to_find_person_from_handle(child_handle) self.d.write_text(child.get_primary_name().get_regular_name()) self.d.end_paragraph() self.d.end_cell() @@ -231,8 +231,8 @@ class IndivSummary(Report.Report): self.d.end_paragraph() if len(media_list) > 0: - object_id = media_list[0].get_reference_id() - object = self.database.try_to_find_object_from_id(object_id) + object_handle = media_list[0].get_reference_handle() + object = self.database.try_to_find_object_from_handle(object_handle) if object.get_mime_type()[0:5] == "image": file = object.get_path() self.d.start_paragraph("IVS-Normal") @@ -272,18 +272,18 @@ class IndivSummary(Report.Report): self.d.end_cell() self.d.end_row() - fam_id = self.person.get_main_parents_family_id() + fam_id = self.person.get_main_parents_family_handle() if fam_id: - family = self.database.find_family_from_id(fam_id) - father_id = family.get_father_id() - if father_id: - dad = self.database.try_to_find_person_from_id(father_id) + family = self.database.find_family_from_handle(fam_id) + father_handle = family.get_father_handle() + if father_handle: + dad = self.database.try_to_find_person_from_handle(father_handle) father = dad.get_primary_name().get_regular_name() else: father = "" - mother_id = family.get_mother_id() - if mother_id: - mom = self.database.try_to_find_person_from_id(mother_id) + mother_handle = family.get_mother_handle() + if mother_handle: + mom = self.database.try_to_find_person_from_handle(mother_handle) mother = mom.get_primary_name().get_regular_name() else: mother = "" @@ -332,11 +332,11 @@ class IndivSummary(Report.Report): self.d.end_cell() self.d.end_row() - event_list = [ self.person.get_birth_id(), self.person.get_death_id() ] + event_list = [ self.person.get_birth_handle(), self.person.get_death_handle() ] event_list = event_list + self.person.get_event_list() - for event_id in event_list: - if event_id: - event = self.database.find_event_from_id(event_id) + for event_handle in event_list: + if event_handle: + event = self.database.find_event_from_handle(event_handle) self.write_fact(event) self.d.end_table() @@ -475,7 +475,7 @@ class IndivSummaryBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), self.max_gen, self.pg_brk ) + self.options = ( self.person.get_handle(), self.max_gen, self.pg_brk ) self.style_name = self.selected_style.get_name() diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in index 1775e7bce..e3d1edcd5 100644 --- a/src/plugins/Makefile.in +++ b/src/plugins/Makefile.in @@ -68,6 +68,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@ diff --git a/src/plugins/Merge.py b/src/plugins/Merge.py index 9a9498f43..c15177995 100644 --- a/src/plugins/Merge.py +++ b/src/plugins/Merge.py @@ -147,12 +147,12 @@ class Merge: if (not p1_id) or (p1_id in id_list): return id_list.append(p1_id) - p1 = self.db.try_to_find_person_from_id(p1_id) - f1_id = p1.get_main_parents_family_id() + p1 = self.db.try_to_find_person_from_handle(p1_id) + f1_id = p1.get_main_parents_family_handle() if f1_id: - f1 = self.db.find_family_from_id(f1_id) - self.ancestors_of(f1.get_father_id(),id_list) - self.ancestors_of(f1.get_mother_id(),id_list) + f1 = self.db.find_family_from_handle(f1_id) + self.ancestors_of(f1.get_father_handle(),id_list) + self.ancestors_of(f1.get_mother_handle(),id_list) def on_merge_ok_clicked(self,obj): active = self.menu.get_menu().get_active().get_data("v") @@ -184,7 +184,7 @@ class Merge: males = {} females = {} for p1_id in self.person_list: - p1 = self.db.try_to_find_person_from_id(p1_id) + p1 = self.db.try_to_find_person_from_handle(p1_id) key = self.gen_key(p1.get_primary_name().get_surname()) if p1.get_gender() == RelLib.Person.male: if males.has_key(key): @@ -201,7 +201,7 @@ class Merge: num = 0 for p1key in self.person_list: - p1 = self.db.try_to_find_person_from_id(p1key) + p1 = self.db.try_to_find_person_from_handle(p1key) if num % 25 == 0: self.progress_update((float(num)/float(length))*100) num = num + 1 @@ -217,7 +217,7 @@ class Merge: index = index + 1 if p1key == p2key: continue - p2 = self.db.try_to_find_person_from_id(p2key) + p2 = self.db.try_to_find_person_from_handle(p2key) if self.map.has_key(p2key): (v,c) = self.map[p2key] if v == p1key: @@ -297,8 +297,8 @@ class Merge: for (c,p1key,p2key) in list: c1 = "%5.2f" % c c2 = "%5.2f" % (100-c) - pn1 = self.db.try_to_find_person_from_id(p1key).get_primary_name().get_name() - pn2 = self.db.try_to_find_person_from_id(p2key).get_primary_name().get_name() + pn1 = self.db.try_to_find_person_from_handle(p1key).get_primary_name().get_name() + pn2 = self.db.try_to_find_person_from_handle(p2key).get_primary_name().get_name() self.list.add([c, pn1, pn2,c2],(p1key,p2key)) def on_do_merge_clicked(self,obj): @@ -307,8 +307,8 @@ class Merge: return (p1,p2) = self.list.get_object(iter) - pn1 = self.db.try_to_find_person_from_id(p1) - pn2 = self.db.try_to_find_person_from_id(p2) + pn1 = self.db.try_to_find_person_from_handle(p1) + pn2 = self.db.try_to_find_person_from_handle(p2) MergeData.MergePeople(self.parent,self.db,pn1,pn2,self.on_update) def on_update(self,p1_id,p2_id,old_id): @@ -443,13 +443,13 @@ class Merge: if not p1_id: name1 = "" else: - p1 = self.db.try_to_find_place_from_id(p1_id) + p1 = self.db.try_to_find_place_from_handle(p1_id) name1 = p1.get_title() if not p2_id: name2 = "" else: - p2 = self.db.try_to_find_place_from_id(p2_id) + p2 = self.db.try_to_find_place_from_handle(p2_id) name2 = p2.get_title() if not (name1 and name2): @@ -483,27 +483,27 @@ class Merge: if chance == -1 : return -1 - birth1_id = p1.get_birth_id() + birth1_id = p1.get_birth_handle() if birth1_id: - birth1 = self.db.find_event_from_id(birth1_id) + birth1 = self.db.find_event_from_handle(birth1_id) else: birth1 = RelLib.Event() - death1_id = p1.get_death_id() + death1_id = p1.get_death_handle() if death1_id: - death1 = self.db.find_event_from_id(death1_id) + death1 = self.db.find_event_from_handle(death1_id) else: death1 = RelLib.Event() - birth2_id = p2.get_birth_id() + birth2_id = p2.get_birth_handle() if birth2_id: - birth2 = self.db.find_event_from_id(birth2_id) + birth2 = self.db.find_event_from_handle(birth2_id) else: birth2 = RelLib.Event() - death2_id = p2.get_death_id() + death2_id = p2.get_death_handle() if death2_id: - death2 = self.db.find_event_from_id(death2_id) + death2 = self.db.find_event_from_handle(death2_id) else: death2 = RelLib.Event() @@ -517,40 +517,40 @@ class Merge: return -1 chance = chance + value - value = self.place_match(birth1.get_place_id(),birth2.get_place_id()) + value = self.place_match(birth1.get_place_handle(),birth2.get_place_handle()) if value == -1 : return -1 chance = chance + value - value = self.place_match(death1.get_place_id(),death2.get_place_id()) + value = self.place_match(death1.get_place_handle(),death2.get_place_handle()) if value == -1 : return -1 chance = chance + value ancestors = [] - self.ancestors_of(p1.get_id(),ancestors) - if p2.get_id() in ancestors: + self.ancestors_of(p1.get_handle(),ancestors) + if p2.get_handle() in ancestors: return -1 ancestors = [] - self.ancestors_of(p2.get_id(),ancestors) - if p1.get_id() in ancestors: + self.ancestors_of(p2.get_handle(),ancestors) + if p1.get_handle() in ancestors: return -1 - f1_id = p1.get_main_parents_family_id() - f2_id = p2.get_main_parents_family_id() + f1_id = p1.get_main_parents_family_handle() + f2_id = p2.get_main_parents_family_handle() if f1_id and f2_id: - f1 = self.db.find_family_from_id(f1_id) - f2 = self.db.find_family_from_id(f2_id) - dad1_id = f1.get_father_id() + f1 = self.db.find_family_from_handle(f1_id) + f2 = self.db.find_family_from_handle(f2_id) + dad1_id = f1.get_father_handle() if dad1_id: - dad1 = get_name_obj(self.db.try_to_find_person_from_id(dad1_id)) + dad1 = get_name_obj(self.db.try_to_find_person_from_handle(dad1_id)) else: dad1 = None - dad2_id = f2.get_father_id() + dad2_id = f2.get_father_handle() if dad2_id: - dad2 = get_name_obj(self.db.try_to_find_person_from_id(dad2_id)) + dad2 = get_name_obj(self.db.try_to_find_person_from_handle(dad2_id)) else: dad2 = None @@ -561,14 +561,14 @@ class Merge: chance = chance + value - mom1_id = f1.get_mother_id() + mom1_id = f1.get_mother_handle() if mom1_id: - mom1 = get_name_obj(self.db.try_to_find_person_from_id(mom1_id)) + mom1 = get_name_obj(self.db.try_to_find_person_from_handle(mom1_id)) else: mom1 = None - mom2_id = f2.get_mother_id() + mom2_id = f2.get_mother_handle() if mom2_id: - mom2 = get_name_obj(self.db.try_to_find_person_from_id(mom2_id)) + mom2 = get_name_obj(self.db.try_to_find_person_from_handle(mom2_id)) else: mom2 = None @@ -578,33 +578,33 @@ class Merge: chance = chance + value - for f1_id in p1.get_family_id_list(): - f1 = self.db.find_family_from_id(f1_id) - for f2_id in p2.get_family_id_list(): - f2 = self.db.find_family_from_id(f2_id) + for f1_id in p1.get_family_handle_list(): + f1 = self.db.find_family_from_handle(f1_id) + for f2_id in p2.get_family_handle_list(): + f2 = self.db.find_family_from_handle(f2_id) if p1.get_gender() == RelLib.Person.female: - father1_id = f1.get_father_id() - father2_id = f2.get_father_id() + father1_id = f1.get_father_handle() + father2_id = f2.get_father_handle() if father1_id and father2_id: if father1_id == father2_id: chance = chance + 1 else: - father1 = self.db.try_to_find_person_from_id(father1_id) - father2 = self.db.try_to_find_person_from_id(father2_id) + father1 = self.db.try_to_find_person_from_handle(father1_id) + father2 = self.db.try_to_find_person_from_handle(father2_id) fname1 = get_name_obj(father1) fname2 = get_name_obj(father2) value = self.name_match(fname1,fname2) if value != -1: chance = chance + value else: - mother1_id = f1.get_mother_id() - mother2_id = f2.get_mother_id() + mother1_id = f1.get_mother_handle() + mother2_id = f2.get_mother_handle() if mother1_id and mother2_id: if mother1_id == mother2_id: chance = chance + 1 else: - mother1 = self.db.try_to_find_person_from_id(mother1_id) - mother2 = self.db.try_to_find_person_from_id(mother2_id) + mother1 = self.db.try_to_find_person_from_handle(mother1_id) + mother2 = self.db.try_to_find_person_from_handle(mother2_id) mname1 = get_name_obj(mother1) mname2 = get_name_obj(mother2) value = self.name_match(mname1,mname2) @@ -621,7 +621,7 @@ class Merge: def name_of(p): if not p: return "" - return "%s (%s)" % ( GrampsCfg.get_nameof()(p),p.get_id()) + return "%s (%s)" % ( GrampsCfg.get_nameof()(p),p.get_handle()) def get_name_obj(person): if person: @@ -647,7 +647,7 @@ def runTool(database,active_person,callback,parent=None): # #------------------------------------------------------------------------- def by_id(p1,p2): - return cmp(p1.get_id(),p2.get_id()) + return cmp(p1.get_handle(),p2.get_handle()) #------------------------------------------------------------------------- # diff --git a/src/plugins/Partition.py b/src/plugins/Partition.py index e96d25c7b..9f36f82d3 100644 --- a/src/plugins/Partition.py +++ b/src/plugins/Partition.py @@ -61,15 +61,15 @@ prefix = "/tmp/test" def work_on_person( db, person ): global personSeen - if (len(person.get_family_id_list()) + len(person.get_parent_family_id_list())) > 0: + if (len(person.get_family_handle_list()) + len(person.get_parent_family_handle_list())) > 0: database = db else: database = database_for_unlinked_persons - if( database.get_person_id_map().has_key( person.get_id() ) ): + if( database.get_person_handle_map().has_key( person.get_handle() ) ): return - database.add_person_no_map( person, person.get_id() ) + database.add_person_no_map( person, person.get_handle() ) personSeen.append(person) for source_ref in person.get_primary_name().get_source_references(): @@ -85,10 +85,10 @@ def work_on_person( db, person ): work_on_event(database, event) # recursion - for fam in person.get_family_id_list(): + for fam in person.get_family_handle_list(): work_on_family( database, fam ) - for fam in person.get_parent_family_id_list(): + for fam in person.get_parent_family_handle_list(): work_on_family( database, fam[0] ) #------------------------------------------------------------------------- @@ -98,10 +98,10 @@ def work_on_person( db, person ): #------------------------------------------------------------------------- def work_on_family( database, family ): global familySeen - if database.get_family_id_map().has_key( family.get_id() ): + if database.get_family_handle_map().has_key( family.get_handle() ): return - database.get_family_id_map()[family.get_id()] = family + database.get_family_handle_map()[family.get_handle()] = family familySeen.append(family) work_on_event( database, family.get_marriage() ) @@ -110,15 +110,15 @@ def work_on_family( database, family ): # recursion - father = family.get_father_id() + father = family.get_father_handle() if( father != None ): work_on_person( database, father ) - mother = family.get_mother_id() + mother = family.get_mother_handle() if( mother != None ): work_on_person( database, mother ) - for person in family.get_child_id_list(): + for person in family.get_child_handle_list(): work_on_person( database, person ) #------------------------------------------------------------------------- @@ -130,14 +130,14 @@ def work_on_sourceref( database, source_ref ): if source_ref == None: return - source = source_ref.get_base_id() + source = source_ref.get_base_handle() if source == None: return - if database.get_source_map().has_key(source.get_id()): + if database.get_source_map().has_key(source.get_handle()): return - database.add_source_no_map( source, source.get_id() ); + database.add_source_no_map( source, source.get_handle() ); #------------------------------------------------------------------------- @@ -152,7 +152,7 @@ def work_on_event( database, event ): for source_ref in event.get_source_references(): work_on_sourceref( database, source_ref) - work_on_place( database, event.get_place_id() ) + work_on_place( database, event.get_place_handle() ) #------------------------------------------------------------------------- @@ -164,9 +164,9 @@ def work_on_place( database, place ): if place == None: return - if place in database.get_place_ids(): + if place in database.get_place_handles(): return - database.add_place_no_map(place, place.get_id()) + database.add_place_no_map(place, place.get_handle()) #------------------------------------------------------------------------- # @@ -180,7 +180,7 @@ def report(db, person): text = "=== Partitions ===\n" count = 0 - for p in db.get_person_id_map().values(): + for p in db.get_person_handle_map().values(): if not p in personSeen: database = RelLib.GrampsDB() work_on_person( database, p ) diff --git a/src/plugins/PatchNames.py b/src/plugins/PatchNames.py index d351fba06..a7d1071e6 100644 --- a/src/plugins/PatchNames.py +++ b/src/plugins/PatchNames.py @@ -89,7 +89,7 @@ class PatchNames: for key in self.db.get_person_keys(): - person = self.db.try_to_find_person_from_id(key) + person = self.db.try_to_find_person_from_handle(key) first = person.get_primary_name().get_first_name() match = _title_re.match(first) if match: @@ -157,7 +157,7 @@ class PatchNames: self.title_hash = {} for (id,name,nick) in self.nick_list: - p = self.db.try_to_find_person_from_id(id) + p = self.db.try_to_find_person_from_handle(id) iter = self.model.append() self.model.set_value(iter,0,1) self.model.set_value(iter,1,id) @@ -167,7 +167,7 @@ class PatchNames: self.nick_hash[id] = iter for (id,title,nick) in self.title_list: - p = self.db.try_to_find_person_from_id(id) + p = self.db.try_to_find_person_from_handle(id) iter = self.model.append() self.model.set_value(iter,0,1) self.model.set_value(iter,1,id) @@ -215,7 +215,7 @@ class PatchNames: iter = self.title_hash[grp[0]] val = self.model.get_value(iter,0) if val: - p = self.db.try_to_find_person_from_id(grp[0]) + p = self.db.try_to_find_person_from_handle(grp[0]) name = p.get_primary_name() name.set_first_name(grp[2].strip()) name.set_title(grp[1].strip()) diff --git a/src/plugins/ReadGedcom.py b/src/plugins/ReadGedcom.py index 11663d897..b02d7e77b 100644 --- a/src/plugins/ReadGedcom.py +++ b/src/plugins/ReadGedcom.py @@ -448,7 +448,7 @@ class GedcomParser: if note: self.source.set_note(note) if not self.source.get_title(): - self.source.set_title("No title - ID %s" % self.source.get_id()) + self.source.set_title("No title - ID %s" % self.source.get_handle()) self.db.commit_source(self.source, self.trans) self.backup() return @@ -495,15 +495,15 @@ class GedcomParser: self.family = self.db.find_family_with_map(matches[1],self.fmap, self.trans) self.parse_family() if self.addr != None: - father = self.family.get_father_id() + father = self.family.get_father_handle() if father: father.add_address(self.addr) self.db.commit_person(father, self.trans) - mother = self.family.get_mother_id() + mother = self.family.get_mother_handle() if mother: mother.add_address(self.addr) self.db.commit_person(mother, self.trans) - for child in self.family.get_child_id_list(): + for child in self.family.get_child_handle_list(): child.add_address(self.addr) self.db.commit_person(child, self.trans) self.db.commit_family(self.family, self.trans) @@ -515,7 +515,7 @@ class GedcomParser: id = matches[1] id = id[1:-1] self.person = self.find_or_create_person(id) - self.added[self.person.get_id()] = 1 + self.added[self.person.get_handle()] = 1 self.parse_individual() self.db.commit_person(self.person, self.trans) del self.person @@ -621,12 +621,12 @@ class GedcomParser: elif matches[1] == "HUSB": id = matches[2] person = self.find_or_create_person(id[1:-1]) - self.family.set_father_id(person.get_id()) + self.family.set_father_handle(person.get_handle()) self.ignore_sub_junk(2) elif matches[1] == "WIFE": id = matches[2] person = self.find_or_create_person(id[1:-1]) - self.family.set_mother_id(person.get_id()) + self.family.set_mother_handle(person.get_handle()) self.ignore_sub_junk(2) elif matches[1] == "SLGS": ord = RelLib.LdsOrd() @@ -640,18 +640,18 @@ class GedcomParser: mrel,frel = self.parse_ftw_relations(2) id = matches[2] child = self.find_or_create_person(id[1:-1]) - self.family.add_child_id(child.get_id()) + self.family.add_child_handle(child.get_handle()) - for f in child.get_parent_family_id_list(): - if f[0] == self.family.get_id(): + for f in child.get_parent_family_handle_list(): + if f[0] == self.family.get_handle(): break else: if (mrel=="Birth" or mrel=="") and (frel=="Birth" or frel==""): - child.set_main_parent_family_id(self.family.get_id()) + child.set_main_parent_family_handle(self.family.get_handle()) else: - if child.get_main_parents_family_id() == self.family: - child.set_main_parent_family_id(None) - child.add_parent_family_id(self.family.get_id(),mrel,frel) + if child.get_main_parents_family_handle() == self.family: + child.set_main_parent_family_handle(None) + child.add_parent_family_handle(self.family.get_handle(),mrel,frel) self.db.commit_person(child, self.trans) elif matches[1] == "NCHI": a = RelLib.Attribute() @@ -680,7 +680,7 @@ class GedcomParser: if event.get_name() == "Marriage": self.family.set_relationship("Married") self.db.add_event(event,self.trans) - self.family.add_event_id(event.get_id()) + self.family.add_event_handle(event.get_handle()) self.parse_family_event(event,2) self.db.commit_event(event, self.trans) del event @@ -782,7 +782,7 @@ class GedcomParser: self.parse_ord(ord,2) elif matches[1] == "FAMS": family = self.db.find_family_with_map(matches[2],self.fmap, self.trans) - self.person.add_family_id(family.get_id()) + self.person.add_family_handle(family.get_handle()) if note == "": note = self.parse_optional_note(2) else: @@ -792,19 +792,19 @@ class GedcomParser: type,note = self.parse_famc_type(2) family = self.db.find_family_with_map(matches[2],self.fmap, self.trans) - for f in self.person.get_parent_family_id_list(): - if f[0] == family.get_id(): + for f in self.person.get_parent_family_handle_list(): + if f[0] == family.get_handle(): break else: if type == "" or type == "Birth": - if self.person.get_main_parents_family_id() == None: - self.person.set_main_parent_family_id(family.get_id()) + if self.person.get_main_parents_family_handle() == None: + self.person.set_main_parent_family_handle(family.get_handle()) else: - self.person.add_parent_family_id(family.get_id(),"Unknown","Unknown") + self.person.add_parent_family_handle(family.get_handle(),"Unknown","Unknown") else: - if self.person.get_main_parents_family_id() == family.get_id(): - self.person.set_main_parent_family_id(None) - self.person.add_parent_family_id(family.get_id(),type,type) + if self.person.get_main_parents_family_handle() == family.get_handle(): + self.person.set_main_parent_family_handle(None) + self.person.add_parent_family_handle(family.get_handle(),type,type) self.db.commit_family(family, self.trans) elif matches[1] == "RESI": addr = RelLib.Address() @@ -823,29 +823,29 @@ class GedcomParser: elif matches[1] == "BIRT": event = RelLib.Event() self.db.add_event(event, self.trans) - if self.person.get_birth_id(): + if self.person.get_birth_handle(): event.set_name("Alternate Birth") - self.person.add_event_id(event.get_id()) + self.person.add_event_handle(event.get_handle()) else: event.set_name("Birth") - self.person.set_birth_id(event.get_id()) + self.person.set_birth_handle(event.get_handle()) self.parse_person_event(event,2) self.db.commit_event(event, self.trans) elif matches[1] == "ADOP": event = RelLib.Event() event.set_name("Adopted") - self.person.add_event_id(event.get_id()) + self.person.add_event_handle(event.get_handle()) self.parse_adopt_event(event,2) self.db.add_event(event, self.trans) elif matches[1] == "DEAT": event = RelLib.Event() self.db.add_event(event, self.trans) - if self.person.get_death_id(): + if self.person.get_death_handle(): event.set_name("Alternate Death") - self.person.add_event_id(event.get_id()) + self.person.add_event_handle(event.get_handle()) else: event.set_name("Death") - self.person.set_death_id(event.get_id()) + self.person.set_death_handle(event.get_handle()) self.parse_person_event(event,2) self.db.commit_event(event, self.trans) elif matches[1] == "EVEN": @@ -861,14 +861,14 @@ class GedcomParser: self.person.add_attribute(attr) else: self.db.add_event(event, self.trans) - self.person.add_event_id(event.get_id()) + self.person.add_event_handle(event.get_handle()) elif matches[1] == "SOUR": source_ref = self.handle_source(matches,2) self.person.get_primary_name().add_source_reference(source_ref) elif matches[1] == "REFN": if intRE.match(matches[2]): try: - self.refn[self.person.get_id()] = int(matches[2]) + self.refn[self.person.get_handle()] = int(matches[2]) except: pass elif matches[1] in ["AFN","RFN","_UID"]: @@ -901,7 +901,7 @@ class GedcomParser: if matches[2]: event.set_description(matches[2]) self.db.add_event(event, self.trans) - self.person.add_event_id(event.get_id()) + self.person.add_event_handle(event.get_handle()) def parse_optional_note(self,level): note = "" @@ -987,7 +987,7 @@ class GedcomParser: photo.set_mime_type(Utils.get_mime_type(path)) self.db.add_object(photo, self.trans) oref = RelLib.MediaRef() - oref.set_reference_id(photo.get_id()) + oref.set_reference_handle(photo.get_handle()) self.person.add_media_reference(oref) self.db.commit_person(self.person, self.trans) @@ -1026,7 +1026,7 @@ class GedcomParser: photo.set_mime_type(Utils.get_mime_type(path)) self.db.add_object(photo, self.trans) oref = RelLib.MediaRef() - oref.set_reference_id(photo.get_id()) + oref.set_reference_handle(photo.get_handle()) self.family.add_media_reference(photo) self.db.commit_family(self.family, self.trans) @@ -1103,19 +1103,19 @@ class GedcomParser: elif matches[1] == "DATE": ord.set_date_object(self.extract_date(matches[2])) elif matches[1] == "FAMC": - ord.set_family_id(self.db.find_family_with_map(matches[2],self.fmap,self.trans)) + ord.set_family_handle(self.db.find_family_with_map(matches[2],self.fmap,self.trans)) elif matches[1] == "PLAC": try: val = matches[2] if self.placemap.has_key(val): - place_id = self.placemap[val] + place_handle = self.placemap[val] else: place = RelLib.Place() place.set_title(matches[2]) self.db.add_place(place, self.trans) - place_id = place.get_id() - self.placemap[val] = place_id - ord.set_place_id(place_id) + place_handle = place.get_handle() + self.placemap[val] = place_handle + ord.set_place_handle(place_handle) self.ignore_sub_junk(level+1) except NameError: pass @@ -1161,14 +1161,14 @@ class GedcomParser: self.ignore_sub_junk(level+1) else: if self.placemap.has_key(val): - place_id = self.placemap[val] + place_handle = self.placemap[val] else: place = RelLib.Place() place.set_title(matches[2]) self.db.add_place(place, self.trans) - place_id = place.get_id() - self.placemap[val] = place_id - event.set_place_id(place_id) + place_handle = place.get_handle() + self.placemap[val] = place_handle + event.set_place_handle(place_handle) self.ignore_sub_junk(level+1) elif matches[1] == "CAUS": info = matches[2] + self.parse_continue_data(level+1) @@ -1211,20 +1211,20 @@ class GedcomParser: elif matches[1] == "FAMC": family = self.db.find_family_with_map(matches[2],self.fmap,self.trans) mrel,frel = self.parse_adopt_famc(level+1); - if self.person.get_main_parents_family_id() == family.get_id(): - self.person.set_main_parent_family_id(None) - self.person.add_parent_family_id(family.get_id(),mrel,frel) + if self.person.get_main_parents_family_handle() == family.get_handle(): + self.person.set_main_parent_family_handle(None) + self.person.add_parent_family_handle(family.get_handle(),mrel,frel) elif matches[1] == "PLAC": val = matches[2] if self.placemap.has_key(val): - place_id = self.placemap[val] + place_handle = self.placemap[val] else: place = RelLib.Place() place.set_title(matches[2]) self.db.add_place(place, self.trans) - place_id = place.get_id() - self.placemap[val] = place_id - event.set_place_id(place_id) + place_handle = place.get_handle() + self.placemap[val] = place_handle + event.set_place_handle(place_handle) self.ignore_sub_junk(level+1) elif matches[1] == "TYPE": # eventually do something intelligent here @@ -1345,14 +1345,14 @@ class GedcomParser: elif matches[1] == "PLAC": val = matches[2] if self.placemap.has_key(val): - place_id = self.placemap[val] + place_handle = self.placemap[val] else: place = RelLib.Place() place.set_title(matches[2]) self.db.add_place(place, self.trans) - place_id = place.get_id() - self.placemap[val] = place_id - event.set_place_id(place_id) + place_handle = place.get_handle() + self.placemap[val] = place_handle + event.set_place_handle(place_handle) self.ignore_sub_junk(level+1) elif matches[1] == 'OFFI': if note == "": @@ -1711,12 +1711,12 @@ class GedcomParser: self.localref = self.localref + 1 ref = "gsr%d" % self.localref s = self.db.find_source(ref,self.smap, self.trans) - source_ref.set_base_id(s.get_id()) + source_ref.set_base_handle(s.get_handle()) s.set_title('Imported Source #%d' % self.localref) s.set_note(matches[2] + self.parse_continue_data(level)) self.ignore_sub_junk(level+1) else: - source_ref.set_base_id(self.db.find_source(matches[2],self.smap,self.trans).get_id()) + source_ref.set_base_handle(self.db.find_source(matches[2],self.smap,self.trans).get_handle()) self.parse_source_reference(source_ref,level) return source_ref @@ -1734,20 +1734,20 @@ class GedcomParser: new_key = prefix % val new_pmax = max(new_pmax,val) - person = self.db.find_person_from_id(pid,self.trans) + person = self.db.find_person_from_handle(pid,self.trans) # new ID is not used - if not self.db.has_person_id(new_key): - self.db.remove_person_id(pid,self.trans) - person.set_id(new_key) + if not self.db.has_person_handle(new_key): + self.db.remove_person_handle(pid,self.trans) + person.set_handle(new_key) person.set_gramps_id(new_key) self.db.add_person(person,self.trans) else: - tp = self.db.find_person_from_id(new_key,self.trans) + tp = self.db.find_person_from_handle(new_key,self.trans) # same person, just change it if person == tp: - self.db.remove_person_id(pid,self.trans) - person.set_id(new_key) + self.db.remove_person_handle(pid,self.trans) + person.set_handle(new_key) person.set_gramps_id(new_key) self.db.add_person_as(person,self.trans) # give up trying to use the refn as a key diff --git a/src/plugins/RelCalc.py b/src/plugins/RelCalc.py index eef9562ab..b0c1ec437 100644 --- a/src/plugins/RelCalc.py +++ b/src/plugins/RelCalc.py @@ -98,7 +98,7 @@ class RelCalc: if p == self.person: continue val = self.db.get_person_display(key) - self.clist.add([val[0],val[1],val[3],val[5],val[6]],p.get_id()) + self.clist.add([val[0],val[1],val[3],val[5],val[6]],p.get_handle()) self.clist.connect_model() @@ -144,20 +144,20 @@ class RelCalc: length = len(common) if length == 1: - person = self.db.try_to_find_person_from_id(common[0]) + person = self.db.try_to_find_person_from_handle(common[0]) name = person.get_primary_name().get_regular_name() commontext = " " + _("Their common ancestor is %s.") % name elif length == 2: - p1 = self.db.try_to_find_person_from_id(common[0]) - p2 = self.db.try_to_find_person_from_id(common[1]) + p1 = self.db.try_to_find_person_from_handle(common[0]) + p2 = self.db.try_to_find_person_from_handle(common[1]) commontext = " " + _("Their common ancestors are %s and %s.") % \ (p1.get_primary_name().get_regular_name(),\ p2.get_primary_name().get_regular_name()) elif length > 2: index = 0 commontext = " " + _("Their common ancestors are : ") - for person_id in common: - person = self.db.try_to_find_person_from_id(person_id) + for person_handle in common: + person = self.db.try_to_find_person_from_handle(person_handle) if index != 0: commontext = commontext + ", " commontext = commontext + person.get_primary_name().get_regular_name() diff --git a/src/plugins/RelGraph.py b/src/plugins/RelGraph.py index f26fb79ec..77932a00c 100644 --- a/src/plugins/RelGraph.py +++ b/src/plugins/RelGraph.py @@ -145,19 +145,19 @@ class RelGraphDialog(Report.ReportDialog): des = GenericFilter.GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(GenericFilter.IsDescendantOf([self.person.get_id()])) + des.add_rule(GenericFilter.IsDescendantOf([self.person.get_handle()])) fam = GenericFilter.GenericFilter() fam.set_name(_("Descendant family members of %s") % name) - fam.add_rule(GenericFilter.IsDescendantFamilyOf([self.person.get_id()])) + fam.add_rule(GenericFilter.IsDescendantFamilyOf([self.person.get_handle()])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_id()])) + ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_handle()])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % name) - com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.get_id()])) + com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.get_handle()])) return [all, des, fam, ans, com] @@ -409,7 +409,7 @@ class RelGraphDialog(Report.ReportDialog): try: self.individual_set =\ Set(self.filter.apply(self.db, self.db.get_person_keys())) - self.individual_set.add(self.person.get_id()) + self.individual_set.add(self.person.get_handle()) except Errors.FilterError, msg: from QuestionDialog import ErrorDialog (m1,m2) = msg.messages() @@ -506,55 +506,55 @@ def _write_graph_box (self): _write_node(self.File, shape='ellipse', color='black', fontname=self.FontStyle) for individual_id in individual_nodes: - individual = self.db.try_to_find_person_from_id(individual_id) - for family_id in individual.get_family_id_list(): - if family_id not in family_nodes: - family_nodes.add(family_id) - label = _get_family_id_label(self, family_id) - _write_node(self.File, family_id, label, + individual = self.db.try_to_find_person_from_handle(individual_id) + for family_handle in individual.get_family_handle_list(): + if family_handle not in family_nodes: + family_nodes.add(family_handle) + label = _get_family_handle_label(self, family_handle) + _write_node(self.File, family_handle, label, fontname=self.FontStyle) # Links each individual to their parents/family self.File.write('\n// Individual edges\n') _write_edge(self.File, style="solid", arrowHead=self.ArrowHeadStyle,arrowTail=self.ArrowTailStyle) for individual_id in individual_nodes: - individual = self.db.try_to_find_person_from_id(individual_id) - for family_id, mother_rel_ship, father_rel_ship\ - in individual.get_parent_family_id_list(): - family = self.db.find_family_from_id(family_id) - father_id = family.get_father_id() - mother_id = family.get_mother_id() - if self.ShowFamilies and family_id in family_nodes: + individual = self.db.try_to_find_person_from_handle(individual_id) + for family_handle, mother_rel_ship, father_rel_ship\ + in individual.get_parent_family_handle_list(): + family = self.db.find_family_from_handle(family_handle) + father_handle = family.get_father_handle() + mother_handle = family.get_mother_handle() + if self.ShowFamilies and family_handle in family_nodes: # edge from an individual to their family style = _get_edge_style(self, father_rel_ship, mother_rel_ship) - _write_edge(self.File, individual_id, family_id, style) + _write_edge(self.File, individual_id, family_handle, style) else: # edge from an individual to their parents - if father_id and father_id in individual_nodes: - _write_edge(self.File, individual_id, father_id, + if father_handle and father_handle in individual_nodes: + _write_edge(self.File, individual_id, father_handle, _get_edge_style(self, father_rel_ship)) - if mother_id and mother_id in individual_nodes: - _write_edge(self.File, individual_id, mother_id, + if mother_handle and mother_handle in individual_nodes: + _write_edge(self.File, individual_id, mother_handle, _get_edge_style(self, mother_rel_ship)) # Links each family to its components if self.ShowFamilies: self.File.write('\n// Family edges (box graph)\n') _write_edge(self.File, style="solid", arrowHead=self.ArrowHeadStyle,arrowTail=self.ArrowTailStyle) - for family_id in family_nodes: - family = self.db.find_family_from_id(family_id) - father_id = family.get_father_id() - if father_id and father_id in individual_nodes: - _write_edge(self.File, family_id, father_id) - mother_id = family.get_mother_id() - if mother_id and mother_id in individual_nodes: - _write_edge(self.File, family_id, mother_id) + for family_handle in family_nodes: + family = self.db.find_family_from_handle(family_handle) + father_handle = family.get_father_handle() + if father_handle and father_handle in individual_nodes: + _write_edge(self.File, family_handle, father_handle) + mother_handle = family.get_mother_handle() + if mother_handle and mother_handle in individual_nodes: + _write_edge(self.File, family_handle, mother_handle) # Statistics males = 0 females = 0 unknowns = 0 for individual_id in individual_nodes: - individual = self.db.try_to_find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_handle(individual_id) if individual.get_gender() == individual.male: males = males + 1 elif individual.get_gender() == individual.female: @@ -584,10 +584,10 @@ def _write_graph_record (self): # naturalRelatives (direct descendants) and its complementary # subset (in-law relatives). filter = GenericFilter.GenericFilter() - filter.add_rule(GenericFilter.IsDescendantOf([self.person.get_id()])) + filter.add_rule(GenericFilter.IsDescendantOf([self.person.get_handle()])) natural_relatives =\ Set(filter.apply(self.db, self.db.get_person_keys())) - natural_relatives.add(self.person.get_id()) + natural_relatives.add(self.person.get_handle()) else: natural_relatives = self.individual_set self.File.write('\n// Family nodes (record graph)\n') @@ -596,33 +596,33 @@ def _write_graph_record (self): for individual_id in natural_relatives: # If both husband and wife are members of the IndividualSet, # only one record, with the husband first, is displayed. - individual = self.db.try_to_find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_handle(individual_id) if individual.get_gender() == individual.female: # There are exactly three cases where a female node is added: - family_id = None # no family + family_handle = None # no family husbands = [] # filtered-in husbands (naturalRelatives) unknown_husbands = 0 # filtered-out/unknown husbands - for family_id in individual.get_family_id_list(): - family = self.db.find_family_from_id(family_id) - husband_id = family.get_father_id() + for family_handle in individual.get_family_handle_list(): + family = self.db.find_family_from_handle(family_handle) + husband_id = family.get_father_handle() if husband_id and husband_id in self.individual_set: if husband_id not in natural_relatives: husbands.append(husband_id) else: unknown_husbands = 1 - if not family_id or len(husbands) or unknown_husbands: + if not family_handle or len(husbands) or unknown_husbands: family_nodes[individual_id] = [individual_id] + husbands else: family_nodes[individual_id] = [individual_id] - for family_id in individual.get_family_id_list(): - family = self.db.find_family_from_id(family_id) - wife_id = family.get_mother_id() + for family_handle in individual.get_family_handle_list(): + family = self.db.find_family_from_handle(family_handle) + wife_id = family.get_mother_handle() if wife_id in self.individual_set: family_nodes[individual_id].append(wife_id) # Writes out all family records - for individual_id, family_id in family_nodes.items(): + for individual_id, family_handle in family_nodes.items(): (color, url) = _get_individual_data(self, family_nodes[individual_id][0]) - label = _get_family_id_record_label(self, family_nodes[individual_id]) + label = _get_family_handle_record_label(self, family_nodes[individual_id]) _write_node(self.File, individual_id, label, color, url, fontname=self.FontStyle) # Links individual's record to their parents' record @@ -631,47 +631,47 @@ def _write_graph_record (self): self.File.write('\n// Individual edges\n') _write_edge(self.File, style="solid", arrowHead=self.ArrowHeadStyle,arrowTail=self.ArrowTailStyle) - for family_from_id, family_from_id2 in family_nodes.items(): - for individual_from_id in family_from_id2: - individual_from = self.db.try_to_find_person_from_id(individual_from_id) - for family_id, mother_rel_ship, father_rel_ship\ - in individual_from.get_parent_family_id_list(): - family = self.db.find_family_from_id(family_id) - father_id = family.get_father_id() - mother_id = family.get_mother_id() + for family_from_handle, family_from_handle2 in family_nodes.items(): + for individual_from_handle in family_from_handle2: + individual_from = self.db.try_to_find_person_from_handle(individual_from_handle) + for family_handle, mother_rel_ship, father_rel_ship\ + in individual_from.get_parent_family_handle_list(): + family = self.db.find_family_from_handle(family_handle) + father_handle = family.get_father_handle() + mother_handle = family.get_mother_handle() # Things are complicated here because a parent may or # or may not exist. - if not father_id: - father_id = "" - if not mother_id: - mother_id = "" - if family_nodes.has_key(father_id): - if mother_id in family_nodes[father_id]: - _write_edge(self.File, family_from_id, father_id, + if not father_handle: + father_handle = "" + if not mother_handle: + mother_handle = "" + if family_nodes.has_key(father_handle): + if mother_handle in family_nodes[father_handle]: + _write_edge(self.File, family_from_handle, father_handle, _get_edge_style(self, mother_rel_ship), - portFrom=individual_from_id, portTo=mother_id) + portFrom=individual_from_handle, portTo=mother_handle) else: - _write_edge(self.File, family_from_id, father_id, + _write_edge(self.File, family_from_handle, father_handle, _get_edge_style(self, mother_rel_ship), - portFrom=individual_from_id) - if family_nodes.has_key(mother_id): - if father_id in family_nodes[mother_id]: - _write_edge(self.File, family_from_id, mother_id, + portFrom=individual_from_handle) + if family_nodes.has_key(mother_handle): + if father_handle in family_nodes[mother_handle]: + _write_edge(self.File, family_from_handle, mother_handle, _get_edge_style(self, father_rel_ship), - portFrom=individual_from_id, portTo=father_id) + portFrom=individual_from_handle, portTo=father_handle) else: - _write_edge(self.File, family_from_id, mother_id, + _write_edge(self.File, family_from_handle, mother_handle, _get_edge_style(self, mother_rel_ship), - portFrom=individual_from_id) + portFrom=individual_from_handle) # Stats (unique individuals) males = Set() females = Set() unknowns = Set() marriages = 0 - for family_id, family_id2 in family_nodes.items(): - marriages = marriages + (len(family_id2) - 1) - for individual_id in family_id2: - individual = self.db.try_to_find_person_from_id(individual_id) + for family_handle, family_handle2 in family_nodes.items(): + marriages = marriages + (len(family_handle2) - 1) + for individual_id in family_handle2: + individual = self.db.try_to_find_person_from_handle(individual_id) if individual.get_gender() == individual.male\ and individual_id not in males: males.add(individual_id) @@ -692,7 +692,7 @@ def _get_individual_data (self, individual_id): """Returns a tuple of individual data""" # color color = '' - individual = self.db.try_to_find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_handle(individual_id) if self.Colorize: gender = individual.get_gender() if gender == individual.male: @@ -711,10 +711,10 @@ def _get_individual_data (self, individual_id): # _get_event_label # #------------------------------------------------------------------------ -def _get_event_label (self, event_id): +def _get_event_label (self, event_handle): """Returns a formatted string of event data suitable for a label""" - if self.IncludeDates and event_id: - event = self.db.find_event_from_id(event_id) + if self.IncludeDates and event_handle: + event = self.db.find_event_from_handle(event_handle) date_obj = event.get_date_object() if date_obj.get_year_valid(): if self.JustYear: @@ -722,9 +722,9 @@ def _get_event_label (self, event_id): else: return date_obj.get_date() elif self.PlaceCause: - place_id = event.get_place_id() - if place_id: - place = self.db.try_to_find_place_from_id(place_id) + place_handle = event.get_place_handle() + if place_handle: + place = self.db.try_to_find_place_from_handle(place_handle) return place.get_title() else: return event.get_cause() @@ -735,7 +735,7 @@ def _get_event_label (self, event_id): # _get_individual_label # #------------------------------------------------------------------------ -def _get_individual_label (self, individual_id, marriage_event_id=None, family_id=None): +def _get_individual_label (self, individual_id, marriage_event_handle=None, family_handle=None): """Returns a formatted string of individual data suitable for a label Returned string always includes individual's name and optionally @@ -743,23 +743,23 @@ def _get_individual_label (self, individual_id, marriage_event_id=None, family_i individual's and family's IDs. """ # Get data ready - individual = self.db.try_to_find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_handle(individual_id) name = individual.get_primary_name().get_name() if self.IncludeDates: - birth = _get_event_label(self, individual.get_birth_id()) - death = _get_event_label(self, individual.get_death_id()) - if marriage_event_id: - marriage = _get_event_label(self, marriage_event_id) + birth = _get_event_label(self, individual.get_birth_handle()) + death = _get_event_label(self, individual.get_death_handle()) + if marriage_event_handle: + marriage = _get_event_label(self, marriage_event_handle) # Id if self.IncludeId: - if marriage_event_id: - label = "%s (%s)\\n" % (family_id, individual_id) + if marriage_event_handle: + label = "%s (%s)\\n" % (family_handle, individual_id) else: label = "%s\\n" % individual_id else: label = "" # Marriage date - if self.IncludeDates and (marriage_event_id and marriage): + if self.IncludeDates and (marriage_event_handle and marriage): label = label + "%s\\n" % marriage # Individual's name label = label + name @@ -782,56 +782,56 @@ def _get_edge_style (self, father_rel_ship, mother_rel_ship="Birth"): #------------------------------------------------------------------------ # -# _get_family_id_label +# _get_family_handle_label # #------------------------------------------------------------------------ -def _get_family_id_label (self, family_id): +def _get_family_handle_label (self, family_handle): """Returns a formatted string of family data suitable for a label""" - fam = self.db.find_family_from_id(family_id) - for event_id in fam.get_event_list(): - if event_id: - event = self.db.find_event_from_id(event_id) + fam = self.db.find_family_from_handle(family_handle) + for event_handle in fam.get_event_list(): + if event_handle: + event = self.db.find_event_from_handle(event_handle) if event.get_name() == "Marriage": - marriage_event_id = event_id + marriage_event_handle = event_handle break else: - marriage_event_id = None + marriage_event_handle = None - marriage = _get_event_label(self, marriage_event_id) + marriage = _get_event_label(self, marriage_event_handle) if self.IncludeId: - return "%s\\n%s" % (family_id, marriage) + return "%s\\n%s" % (family_handle, marriage) else: return marriage #------------------------------------------------------------------------ # -# _get_family_id_record_label +# _get_family_handle_record_label # #------------------------------------------------------------------------ -def _get_family_id_record_label (self, record): +def _get_family_handle_record_label (self, record): """Returns a formatted string of a family record suitable for a label""" labels = [] spouse_id = record[0] - spouse = self.db.try_to_find_person_from_id(spouse_id) + spouse = self.db.try_to_find_person_from_handle(spouse_id) for individual_id in record: - individual = self.db.try_to_find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_handle(individual_id) if spouse_id == individual_id: label = _get_individual_label(self, individual_id) else: - marriage_event_id = None - for individual_family_id in individual.get_family_id_list(): - if individual_family_id in spouse.get_family_id_list(): - individual_family = self.db.find_family_from_id(individual_family_id) - for event_id in individual_family.get_event_list(): - if event_id: - event = self.db.find_event_from_id(event_id) + marriage_event_handle = None + for individual_family_handle in individual.get_family_handle_list(): + if individual_family_handle in spouse.get_family_handle_list(): + individual_family = self.db.find_family_from_handle(individual_family_handle) + for event_handle in individual_family.get_event_list(): + if event_handle: + event = self.db.find_event_from_handle(event_handle) if event.get_name() == "Marriage": - marriage_event_id = event_id + marriage_event_handle = event_handle break label = _get_individual_label(self, individual_id, - marriage_event_id,individual_family_id) + marriage_event_handle,individual_family_handle) label = string.replace(label, "|", r"\|") label = string.replace(label, "<", r"\<") label = string.replace(label, ">", r"\>") diff --git a/src/plugins/ReorderIds.py b/src/plugins/ReorderIds.py index 62bcfb95f..6941b1058 100644 --- a/src/plugins/ReorderIds.py +++ b/src/plugins/ReorderIds.py @@ -52,11 +52,11 @@ class ReorderIds: self.db = db - self.reorder(db.get_person_id_map(),db.iprefix,db.build_person_display) - self.reorder(db.get_family_id_map(),db.fprefix,None) + self.reorder(db.get_person_handle_map(),db.iprefix,db.build_person_display) + self.reorder(db.get_family_handle_map(),db.fprefix,None) self.reorder(db.get_object_map(),db.oprefix,None) self.reorder(db.get_source_map(),db.sprefix,db.build_source_display) - self.reorder(db.get_place_id_map(),db.pprefix,db.build_place_display) + self.reorder(db.get_place_handle_map(),db.pprefix,db.build_place_display) Utils.history_broken() callback(1) @@ -96,7 +96,7 @@ class ReorderIds: data = data_map[id] data_map[newid] = data newids[newid] = id - data.set_id(newid) + data.set_handle(newid) del data_map[id] if update: update(newid,id) @@ -117,7 +117,7 @@ class ReorderIds: index = index + 1 newids[newid] = newid data = data_map[id] - data.set_id(newid) + data.set_handle(newid) data_map[newid] = data if update: update(newid,id) diff --git a/src/plugins/SimpleBookTitle.py b/src/plugins/SimpleBookTitle.py index 76bb14e18..3524615d7 100644 --- a/src/plugins/SimpleBookTitle.py +++ b/src/plugins/SimpleBookTitle.py @@ -50,13 +50,13 @@ import gtk class SimpleBookTitle(Report.Report): def __init__(self,database, - person,title_string,subtitle_string,object_id,image_size, + person,title_string,subtitle_string,object_handle,image_size, footer_string,doc,output,newpage=0): self.map = {} self.database = database self.start = person self.title_string = title_string - self.object_id = object_id + self.object_handle = object_handle self.image_size = image_size self.subtitle_string = subtitle_string self.footer_string = footer_string @@ -87,8 +87,8 @@ class SimpleBookTitle(Report.Report): self.doc.write_text(self.subtitle_string) self.doc.end_paragraph() - if self.object_id: - object = self.database.get_object(self.object_id) + if self.object_handle: + object = self.database.get_object(self.object_handle) name = object.get_path() if self.image_size: image_size = self.image_size @@ -178,18 +178,18 @@ def make_size_menu(main_menu,def_size_index=0): _style_file = "simple_book_title.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _title_string = "" _subtitle_string = "" -_object_id = "" +_object_handle = "" _size_index = 0 _footer_string = "" _options = ( - _person_id, + _person_handle, _title_string, _subtitle_string, - _object_id, + _object_handle, _size_index, _footer_string ) @@ -225,9 +225,9 @@ class SimpleBookTitleDialog(Report.BareReportDialog): self.subtitle_string = _('Subtitle of the Book') if self.options[3]: - self.object_id = self.options[3] + self.object_handle = self.options[3] else: - self.object_id = "" + self.object_handle = "" if self.options[4]: self.size_index = int(self.options[4]) @@ -246,8 +246,8 @@ class SimpleBookTitleDialog(Report.BareReportDialog): self.subtitle_entry.set_text(self.subtitle_string) self.footer_entry.set_text(self.footer_string) self.size_menu.set_history(self.size_index) - if self.object_id: - object = self.db.get_object(self.object_id) + if self.object_handle: + object = self.db.get_object(self.object_handle) self.obj_title.set_text(object.get_description()) the_type = Utils.get_mime_description(object.get_mime_type()) path = object.get_path() @@ -351,7 +351,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog): pass def remove_obj(self, obj): - self.object_id = "" + self.object_handle = "" self.obj_title.set_text('') self.preview.set_from_pixbuf(None) self.remove_obj_button.set_sensitive(gtk.FALSE) @@ -361,7 +361,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog): s_o = SelectObject.SelectObject(self.db,_("Select an Object")) object = s_o.run() if object: - self.object_id = object.get_id() + self.object_handle = object.get_handle() else: return self.obj_title.set_text(object.get_description()) @@ -381,7 +381,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog): a_o = AddMedia.AddMediaObject(self.db) object = a_o.run() if object: - self.object_id = object.get_id() + self.object_handle = object.get_handle() else: return self.obj_title.set_text(object.get_description()) @@ -408,9 +408,9 @@ class SimpleBookTitleDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.get_id(), + self.options = ( self.person.get_handle(), self.title_string, self.subtitle_string, - self.object_id, self.size_index, self.footer_string ) + self.object_handle, self.size_index, self.footer_string ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ @@ -433,9 +433,9 @@ def write_book_item(database,person,doc,options,newpage=0): else: subtitle_string = _('Subtitle of the Book') if options[3]: - object_id = options[3] + object_handle = options[3] else: - object_id = "" + object_handle = "" if options[4]: size_index = int(options[4]) else: @@ -449,7 +449,7 @@ def write_book_item(database,person,doc,options,newpage=0): name = database.get_researcher().get_name() footer_string = _('Copyright %d %s') % (dateinfo[0], name) return SimpleBookTitle(database, person, - title_string, subtitle_string, object_id, size, + title_string, subtitle_string, object_handle, size, footer_string, doc, None, newpage ) except Errors.ReportError, msg: (m1,m2) = msg.messages() diff --git a/src/plugins/SoundGen.py b/src/plugins/SoundGen.py index 4116f9bd2..7c95e0549 100644 --- a/src/plugins/SoundGen.py +++ b/src/plugins/SoundGen.py @@ -67,8 +67,8 @@ class SoundGen: self.name.connect('changed',self.on_apply_clicked) names = [] - for person_id in self.db.get_person_keys(): - person = self.db.try_to_find_person_from_id(person_id) + for person_handle in self.db.get_person_keys(): + person = self.db.try_to_find_person_from_handle(person_handle) lastname = person.get_primary_name().get_surname() if lastname not in names: names.append(lastname) diff --git a/src/plugins/Summary.py b/src/plugins/Summary.py index 4484a540f..b3dec0bf9 100644 --- a/src/plugins/Summary.py +++ b/src/plugins/Summary.py @@ -71,14 +71,14 @@ def build_report(database,person): pobjects = len(database.get_object_keys()) for photo_id in database.get_object_keys(): - photo = database.try_to_find_object_from_id(photo_id) + photo = database.try_to_find_object_from_handle(photo_id) try: bytes = bytes + posixpath.getsize(photo.get_path()) except: notfound.append(photo.get_path()) - for person_id in personList: - person = database.try_to_find_person_from_id(person_id) + for person_handle in personList: + person = database.try_to_find_person_from_handle(person_handle) if not person: continue length = len(person.get_media_list()) @@ -86,15 +86,15 @@ def build_report(database,person): with_photos = with_photos + 1 total_photos = total_photos + length - person = database.try_to_find_person_from_id(person_id) + person = database.try_to_find_person_from_handle(person_handle) name = person.get_primary_name() if name.get_first_name() == "" or name.get_surname() == "": incomp_names = incomp_names + 1 - if (not person.get_main_parents_family_id()) and (not len(person.get_family_id_list())): + if (not person.get_main_parents_family_handle()) and (not len(person.get_family_handle_list())): disconnected = disconnected + 1 - birth_id = person.get_birth_id() - if birth_id: - birth = database.find_event_from_id(birth_id) + birth_handle = person.get_birth_handle() + if birth_handle: + birth = database.find_event_from_handle(birth_handle) if not birth.get_date(): missing_bday = missing_bday + 1 else: diff --git a/src/plugins/TimeLine.py b/src/plugins/TimeLine.py index e1e9eb806..1447e9070 100644 --- a/src/plugins/TimeLine.py +++ b/src/plugins/TimeLine.py @@ -184,16 +184,16 @@ class TimeLine: self.plist.sort(self.sort_func) for p_id in self.plist: - p = self.db.try_to_find_person_from_id(p_id) - b_id = p.get_birth_id() + p = self.db.try_to_find_person_from_handle(p_id) + b_id = p.get_birth_handle() if b_id: - b = self.db.find_event_from_id(b_id).get_date_object().get_year() + b = self.db.find_event_from_handle(b_id).get_date_object().get_year() else: b = Date.UNDEF - d_id = p.get_death_id() + d_id = p.get_death_handle() if d_id: - d = self.db.find_event_from_id(d_id).get_date_object().get_year() + d = self.db.find_event_from_handle(d_id).get_date_object().get_year() else: d = Date.UNDEF @@ -282,16 +282,16 @@ class TimeLine: self.plist = self.filter.apply(self.db,self.db.get_person_keys()) for p_id in self.plist: - p = self.db.try_to_find_person_from_id(p_id) - b_id = p.get_birth_id() + p = self.db.try_to_find_person_from_handle(p_id) + b_id = p.get_birth_handle() if b_id: - b = self.db.find_event_from_id(b_id).get_date_object().get_year() + b = self.db.find_event_from_handle(b_id).get_date_object().get_year() else: b = Date.UNDEF - d_id = p.get_death_id() + d_id = p.get_death_handle() if d_id: - d = self.db.find_event_from_id(d_id).get_date_object().get_year() + d = self.db.find_event_from_handle(d_id).get_date_object().get_year() else: d = Date.UNDEF @@ -321,7 +321,7 @@ class TimeLine: size = 0 for p_id in self.plist: - p = self.db.try_to_find_person_from_id(p_id) + p = self.db.try_to_find_person_from_handle(p_id) n = p.get_primary_name().get_name() size = max(FontScale.string_width(font,n),size) return pt2cm(size) @@ -376,15 +376,15 @@ def _get_report_filters(person): des = GenericFilter.GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(GenericFilter.IsDescendantOf([person.get_id()])) + des.add_rule(GenericFilter.IsDescendantOf([person.get_handle()])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(GenericFilter.IsAncestorOf([person.get_id()])) + ans.add_rule(GenericFilter.IsAncestorOf([person.get_handle()])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % name) - com.add_rule(GenericFilter.HasCommonAncestorWith([person.get_id()])) + com.add_rule(GenericFilter.HasCommonAncestorWith([person.get_handle()])) return [all,des,ans,com] @@ -520,11 +520,11 @@ def get_description(): _style_file = "timeline.xml" _style_name = "default" -_person_id = "" +_person_handle = "" _filter_num = 0 _sort_func_num = 0 _title_str = "" -_options = ( _person_id, _filter_num, _sort_func_num, _title_str ) +_options = ( _person_handle, _filter_num, _sort_func_num, _title_str ) #------------------------------------------------------------------------ # @@ -622,7 +622,7 @@ class TimeLineBareDialog(Report.BareReportDialog): self.sort_func_num = self.sort_style.get_history() self.title_str = unicode(self.title_box.get_text()) - self.options = ( self.person.get_id(), self.filter_num, + self.options = ( self.person.get_handle(), self.filter_num, self.sort_func_num, self.title_str ) self.style_name = self.selected_style.get_name() diff --git a/src/plugins/Verify.py b/src/plugins/Verify.py index 3ae1c2ee1..664a07f4c 100644 --- a/src/plugins/Verify.py +++ b/src/plugins/Verify.py @@ -108,14 +108,14 @@ class Verify: def present(self,obj): self.window.present() - def get_year(self,event_id): + def get_year(self,event_handle): """ - Returns the year of an event (by its id) or 0 if no event_id + Returns the year of an event (by its id) or 0 if no event_handle or no year specified in the event """ year = 0 - if event_id: - event = self.db.find_event_from_id(event_id) + if event_handle: + event = self.db.find_event_from_handle(event_handle) dateObj = event.get_date_object() if dateObj: if dateObj.get_calendar().NAME != Gregorian.Gregorian: @@ -146,15 +146,15 @@ class Verify: error = cStringIO.StringIO() warn = cStringIO.StringIO() - for person_id in personList: - person = self.db.try_to_find_person_from_id(person_id) - idstr = "%s (%s)" % (person.get_primary_name().get_name(),person_id) + for person_handle in personList: + person = self.db.try_to_find_person_from_handle(person_handle) + idstr = "%s (%s)" % (person.get_primary_name().get_name(),person_handle) # individual checks ageatdeath = 0 - byear = self.get_year( person.get_birth_id() ) + byear = self.get_year( person.get_birth_handle() ) bapyear = 0 - dyear = self.get_year( person.get_death_id() ) + dyear = self.get_year( person.get_death_handle() ) buryear = 0 if byear>0 and bapyear>0: if byear > bapyear: @@ -248,12 +248,12 @@ class Verify: yngpar = yngdad # multiple parentage check - if( len( person.get_parent_family_id_list() ) > 1 ): + if( len( person.get_parent_family_handle_list() ) > 1 ): warn.write( _("Multiple parentage for %s.\n") % idstr ) # marriage checks nkids = 0 - nfam = len( person.get_family_id_list() ) + nfam = len( person.get_family_handle_list() ) if nfam > wedder: if person.get_gender() == RelLib.Person.male: warn.write( _("Married often: %(male_name)s married %(nfam)d times.\n") % { @@ -272,46 +272,46 @@ class Verify: prev_maryear=0 prev_sdyear=0 fnum = 0 - for family_id in person.get_family_id_list(): - family = self.db.find_family_from_id(family_id) + for family_handle in person.get_family_handle_list(): + family = self.db.find_family_from_handle(family_handle) fnum = fnum + 1 - mother_id = family.get_mother_id() - father_id = family.get_father_id() - if mother_id: - mother = self.db.try_to_find_person_from_id(mother_id) - if father_id: - father = self.db.try_to_find_person_from_id(father_id) - if mother_id and father_id: + mother_handle = family.get_mother_handle() + father_handle = family.get_father_handle() + if mother_handle: + mother = self.db.try_to_find_person_from_handle(mother_handle) + if father_handle: + father = self.db.try_to_find_person_from_handle(father_handle) + if mother_handle and father_handle: if ( mother.get_gender() == father.get_gender() ) and mother.get_gender() != RelLib.Person.unknown: - warn.write( _("Homosexual marriage: %s in family %s.\n") % ( idstr, family.get_id() ) ) - if father_id == person.get_id() and person.get_gender() == RelLib.Person.female: - error.write( _("Female husband: %s in family %s.\n") % ( idstr, family.get_id() ) ) - if mother_id == person.get_id() and person.get_gender() == RelLib.Person.male: - error.write( _("Male wife: %s in family %s.\n") % ( idstr, family.get_id() ) ) - if father_id == person.get_id(): - spouse_id = mother_id + warn.write( _("Homosexual marriage: %s in family %s.\n") % ( idstr, family.get_handle() ) ) + if father_handle == person.get_handle() and person.get_gender() == RelLib.Person.female: + error.write( _("Female husband: %s in family %s.\n") % ( idstr, family.get_handle() ) ) + if mother_handle == person.get_handle() and person.get_gender() == RelLib.Person.male: + error.write( _("Male wife: %s in family %s.\n") % ( idstr, family.get_handle() ) ) + if father_handle == person.get_handle(): + spouse_id = mother_handle else: - spouse_id = father_id + spouse_id = father_handle if spouse_id: - spouse = self.db.try_to_find_person_from_id(spouse_id) + spouse = self.db.try_to_find_person_from_handle(spouse_id) if person.get_gender() == RelLib.Person.male and \ person.get_primary_name().get_surname() == spouse.get_primary_name().get_surname(): warn.write( _("Husband and wife with the same surname: %s in family %s, and %s.\n") % ( - idstr,family.get_id(), spouse.get_primary_name().get_name() ) ) - sdyear = self.get_year( spouse.get_death_id() ) - sbyear = self.get_year( spouse.get_birth_id() ) + idstr,family.get_handle(), spouse.get_primary_name().get_name() ) ) + sdyear = self.get_year( spouse.get_death_handle() ) + sbyear = self.get_year( spouse.get_birth_handle() ) if abs(sbyear-byear) > hwdif: warn.write( _("Large age difference between husband and wife: %s in family %s, and %s.\n") % ( - idstr,family.get_id(), spouse.get_primary_name().get_name() ) ) + idstr,family.get_handle(), spouse.get_primary_name().get_name() ) ) if sdyear == 0: sdyear = 0 # burial year - for event_id in family.get_event_list(): - if event_id: - event = self.db.find_event_from_id(event_id) + for event_handle in family.get_event_list(): + if event_handle: + event = self.db.find_event_from_handle(event_handle) if event.get_name() == "Marriage": - marriage_id = event_id + marriage_id = event_handle break else: marriage_id = None @@ -320,11 +320,11 @@ class Verify: if maryear == 0 and estimate_age: # estimate marriage year cnum=0 - for child_id in family.get_child_id_list(): + for child_handle in family.get_child_handle_list(): cnum = cnum + 1 if maryear == 0: - child = self.db.try_to_find_person_from_id(child_id) - birthyear = self.get_year( child.get_birth_id() ) + child = self.db.try_to_find_person_from_handle(child_handle) + birthyear = self.get_year( child.get_birth_handle() ) if birthyear > 0: maryear = birthyear-cnum @@ -375,9 +375,9 @@ class Verify: wdwyear = maryear-prev_sdyear if wdwyear > lngwdw: if person.get_gender() == RelLib.Person.male: - warn.write( _("Long widowhood: %s was a widower %d years before, family %s.\n") % (idstr, wdwyear, family.get_id() ) ) + warn.write( _("Long widowhood: %s was a widower %d years before, family %s.\n") % (idstr, wdwyear, family.get_handle() ) ) if person.get_gender() == RelLib.Person.female: - warn.write( _("Long widowhood: %s was a widow %d years before, family %s.\n") % (idstr, wdwyear, family.get_id() ) ) + warn.write( _("Long widowhood: %s was a widow %d years before, family %s.\n") % (idstr, wdwyear, family.get_handle() ) ) if fnum==nfam and dyear>0 and sdyear>0: wdwyear = dyear - sdyear @@ -389,10 +389,10 @@ class Verify: nkids = 0 cbyears = [] - for child_id in family.get_child_id_list(): + for child_handle in family.get_child_handle_list(): nkids = nkids+1 - child = self.db.try_to_find_person_from_id(child_id) - cbyear = self.get_year( child.get_birth_id() ) + child = self.db.try_to_find_person_from_handle(child_handle) + cbyear = self.get_year( child.get_birth_handle() ) if cbyear: cbyears.append(cbyear) @@ -402,49 +402,49 @@ class Verify: if bage > oldpar: if person.get_gender() == RelLib.Person.male: warn.write( _("Old father: %(male_name)s at age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { - 'male_name' : idstr, 'bage' : bage, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name() } ) + 'male_name' : idstr, 'bage' : bage, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name() } ) if person.get_gender() == RelLib.Person.female: warn.write( _("Old mother: %(female_name)s at age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { - 'female_name' : idstr, 'bage' : bage, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name() } ) + 'female_name' : idstr, 'bage' : bage, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name() } ) if bage < 0: if person.get_gender() == RelLib.Person.male: error.write( _("Unborn father: %(male_name)s born %(byear)d, in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'male_name' : idstr, 'byear' : byear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear } ) + 'male_name' : idstr, 'byear' : byear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear } ) if person.get_gender() == RelLib.Person.female: error.write( _("Unborn mother: %(female_name)s born %(byear)d, in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'female_name' : idstr, 'byear' : byear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear } ) + 'female_name' : idstr, 'byear' : byear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear } ) else: if bage < yngpar: if person.get_gender() == RelLib.Person.male: warn.write( _("Young father: %(male_name)s at the age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { - 'male_name' : idstr, 'bage' : bage, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name() } ) + 'male_name' : idstr, 'bage' : bage, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name() } ) if person.get_gender() == RelLib.Person.female: warn.write( _("Young mother: %(female_name)s at the age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { - 'female_name' : idstr, 'bage' : bage, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name() } ) + 'female_name' : idstr, 'bage' : bage, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name() } ) if dyear>0 and cbyear>dyear: if cbyear-1>dyear: if person.get_gender() == RelLib.Person.male: error.write( _("Dead father: %(male_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'male_name' : idstr, 'dyear' : dyear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) + 'male_name' : idstr, 'dyear' : dyear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) if person.get_gender() == RelLib.Person.female: error.write( _("Dead mother: %(female_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'female_name' : idstr, 'dyear' : dyear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) + 'female_name' : idstr, 'dyear' : dyear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) else: if person.get_gender() == RelLib.Person.male: warn.write( _("Dead father: %(male_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'male_name' : idstr, 'dyear' : dyear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) + 'male_name' : idstr, 'dyear' : dyear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) if person.get_gender() == RelLib.Person.female: warn.write( _("Dead mother: %(female_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'female_name' : idstr, 'dyear' : dyear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) + 'female_name' : idstr, 'dyear' : dyear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) if cbyears: cbyears.sort() if (cbyears[-1] - cbyears[0]) > cbspan: - warn.write(_("Large year span for all children: family %s.\n") % family.get_id() ) + warn.write(_("Large year span for all children: family %s.\n") % family.get_handle() ) if len(cbyears) > 1: cby_diff = [ cbyears[i+1]-cbyears[i] for i in range(len(cbyears)-1) ] if max(cby_diff) > cspace: - warn.write(_("Large age differences between children: family %s.\n") % family.get_id() ) + warn.write(_("Large age differences between children: family %s.\n") % family.get_handle() ) text = "" if error: diff --git a/src/plugins/WebPage.py b/src/plugins/WebPage.py index 1a3144a9a..4d097d984 100644 --- a/src/plugins/WebPage.py +++ b/src/plugins/WebPage.py @@ -215,7 +215,7 @@ class IndividualPage: # # #-------------------------------------------------------------------- - def write_link_row(self,title,person_id): + def write_link_row(self,title,person_handle): self.doc.start_row() self.doc.start_cell("NormalCell") self.doc.start_paragraph("Label") @@ -225,10 +225,10 @@ class IndividualPage: self.doc.start_cell("NormalCell") self.doc.start_paragraph("Data") - if person_id: - person = self.db.try_to_find_person_from_id(person_id) - if self.list.has_key(person_id): - self.doc.start_link("%s.%s" % (person_id,self.ext)) + if person_handle: + person = self.db.try_to_find_person_from_handle(person_handle) + if self.list.has_key(person_handle): + self.doc.start_link("%s.%s" % (person_handle,self.ext)) self.doc.write_text(person.get_primary_name().get_regular_name()) self.doc.end_link() else: @@ -249,8 +249,8 @@ class IndividualPage: self.doc.write_linktarget("s%d" % index) self.doc.write_text('%d. ' % index) index = index + 1 - base_id = sref.get_base_id() - base = self.db.try_to_find_source_from_id(base_id) + base_handle = sref.get_base_handle() + base = self.db.try_to_find_source_from_handle(base_handle) self.write_info(base.get_title()) self.write_info(base.get_author()) self.write_info(base.get_publication_info()) @@ -274,7 +274,7 @@ class IndividualPage: self.doc.write_text("%s. " % info) def write_tree(self,ind_list): - if not self.mini_tree or not self.person.get_main_parents_family_id(): + if not self.mini_tree or not self.person.get_main_parents_family_handle(): return self.doc.start_paragraph("FamilyTitle") self.doc.end_paragraph() @@ -290,7 +290,7 @@ class IndividualPage: def create_page(self,ind_list): """Generate the HTML page for the specific person""" - filebase = "%s.%s" % (self.person.get_id(),self.ext) + filebase = "%s.%s" % (self.person.get_handle(),self.ext) self.doc.open("%s/%s" % (self.dir,filebase)) media_list = self.person.get_media_list() @@ -313,12 +313,12 @@ class IndividualPage: # into the document. if self.photos and len(media_list) > 0: - object_id = media_list[0].get_reference_id() - object = self.db.try_to_find_object_from_id(object_id) + object_handle = media_list[0].get_reference_handle() + object = self.db.try_to_find_object_from_handle(object_handle) if object.get_mime_type()[0:5] == "image": src = object.get_path() junk,ext = os.path.splitext(src) - base = '%s%s' % (object_id,ext) + base = '%s%s' % (object_handle,ext) if os.path.isfile(src): self.doc.start_paragraph("Data") @@ -338,10 +338,10 @@ class IndividualPage: self.write_normal_row("%s:" % _("Name"), name, name_obj.get_source_references()) if self.use_id: if self.id_link: - val = '%s' % (self.id_link,self.person.get_id()) - val = val.replace('*',self.person.get_id()) + val = '%s' % (self.id_link,self.person.get_handle()) + val = val.replace('*',self.person.get_handle()) else: - val = self.person.get_id() + val = self.person.get_handle() self.write_id_row("%s:" % _("ID Number"),val) if self.person.get_gender() == RelLib.Person.male: @@ -351,11 +351,11 @@ class IndividualPage: else: self.write_normal_row("%s:" % _("Gender"), _("Unknown"),None) - family_id = self.person.get_main_parents_family_id() - if family_id: - family = self.db.find_family_from_id(family_id) - self.write_link_row("%s:" % _("Father"), family.get_father_id()) - self.write_link_row("%s:" % _("Mother"), family.get_mother_id()) + family_handle = self.person.get_main_parents_family_handle() + if family_handle: + family = self.db.find_family_from_handle(family_handle) + self.write_link_row("%s:" % _("Father"), family.get_father_handle()) + self.write_link_row("%s:" % _("Mother"), family.get_mother_handle()) else: self.write_link_row("%s:" % _("Father"), None) self.write_link_row("%s:" % _("Mother"), None) @@ -403,8 +403,8 @@ class IndividualPage: index = 0 for object_ref in self.person.get_media_list(): - obj_id = object_ref.get_reference_id() - obj = self.db.try_to_find_object_from_id(obj_id) + obj_id = object_ref.get_reference_handle() + obj = self.db.try_to_find_object_from_handle(obj_id) if obj.get_mime_type()[0:5] != "image": continue if object_ref.get_privacy(): @@ -413,7 +413,7 @@ class IndividualPage: try: src = obj.get_path() junk,ext = os.path.splitext(src) - base = '%s%s' % (obj.get_id(),ext) + base = '%s%s' % (obj.get_handle(),ext) if self.image_dir: shutil.copyfile(src,"%s/%s/%s" % (self.dir,self.image_dir,base)) @@ -510,21 +510,21 @@ class IndividualPage: return count = 0 - 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.sort.by_date) - for event_id in event_id_list: - if not event_id: + event_handle_list = [ self.person.get_birth_handle(), self.person.get_death_handle() ] + event_handle_list = event_handle_list + self.person.get_event_list() + event_handle_list.sort(self.sort.by_date) + for event_handle in event_handle_list: + if not event_handle: continue - event = self.db.find_event_from_id(event_id) + event = self.db.find_event_from_handle(event_handle) if event.get_privacy(): continue name = _(event.get_name()) date = event.get_date() descr = event.get_description() - place_id = event.get_place_id() - if place_id: - place = self.db.try_to_find_place_from_id(place_id).get_title() + place_handle = event.get_place_handle() + if place_handle: + place = self.db.try_to_find_place_from_handle(place_handle).get_title() else: place = "" srcref = event.get_source_references() @@ -579,9 +579,9 @@ class IndividualPage: return name = _(event.get_name()) date = event.get_date() - place_id = event.get_place_id() - if place_id: - place = self.db.try_to_find_place_from_id(place_id).get_title() + place_handle = event.get_place_handle() + if place_handle: + place = self.db.try_to_find_place_from_handle(place_handle).get_title() else: place = "" descr = event.get_description() @@ -619,7 +619,7 @@ class IndividualPage: self.write_marriage_row([name, val]) def write_families(self): - if len(self.person.get_family_id_list()) == 0: + if len(self.person.get_family_handle_list()) == 0: return self.doc.start_paragraph("FamilyTitle") @@ -628,17 +628,17 @@ class IndividualPage: self.doc.start_table("three","IndTable") - for family_id in self.person.get_family_id_list(): - family = self.db.find_family_from_id(family_id) - if self.person.get_id() == family.get_father_id(): - spouse_id = family.get_mother_id() + for family_handle in self.person.get_family_handle_list(): + family = self.db.find_family_from_handle(family_handle) + if self.person.get_handle() == family.get_father_handle(): + spouse_id = family.get_mother_handle() else: - spouse_id = family.get_father_id() + spouse_id = family.get_father_handle() self.doc.start_row() self.doc.start_cell("NormalCell",2) self.doc.start_paragraph("Spouse") if spouse_id: - spouse = self.db.try_to_find_person_from_id(spouse_id) + spouse = self.db.try_to_find_person_from_handle(spouse_id) if self.list.has_key(spouse_id): self.doc.start_link("%s.%s" % (spouse_id,self.ext)) self.doc.write_text(spouse.get_primary_name().get_regular_name()) @@ -652,13 +652,13 @@ class IndividualPage: self.doc.end_row() if not self.alive: - for event_id in family.get_event_list(): - if event_id: - event = self.db.find_event_from_id(event_id) + for event_handle in family.get_event_list(): + if event_handle: + event = self.db.find_event_from_handle(event_handle) if event.get_privacy() == 0: self.write_fam_fact(event) - child_list = family.get_child_id_list() + child_list = family.get_child_handle_list() if len(child_list) > 0: self.doc.start_row() @@ -672,15 +672,15 @@ class IndividualPage: self.doc.start_paragraph("Data") first = 1 - for child_id in family.get_child_id_list(): - child = self.db.try_to_find_person_from_id(child_id) + for child_handle in family.get_child_handle_list(): + child = self.db.try_to_find_person_from_handle(child_handle) name = child.get_primary_name().get_regular_name() if first == 1: first = 0 else: self.doc.write_text('\n') - if self.list.has_key(child_id): - self.doc.start_link("%s.%s" % (child_id,self.ext)) + if self.list.has_key(child_handle): + self.doc.start_link("%s.%s" % (child_handle,self.ext)) self.doc.write_text(name) self.doc.end_link() else: @@ -783,14 +783,14 @@ class WebReport(Report.Report): retval = "AFT %s" % retval return retval - def dump_gendex(self,person_id_list,html_dir): + def dump_gendex(self,person_handle_list,html_dir): fname = "%s/gendex.txt" % html_dir try: f = open(fname,"w") except: return - for p_id in person_id_list: - p = self.db.try_to_find_person_from_id(p_id) + for p_id in person_handle_list: + p = self.db.try_to_find_person_from_handle(p_id) name = p.get_primary_name() firstName = name.get_first_name() surName = name.get_surname() @@ -802,15 +802,15 @@ class WebReport(Report.Report): f.write("%s /%s/|" % (firstName,surName)) else: f.write("%s /%s/, %s|" % (firstName,surName, suffix)) - for e_id in [p.get_birth_id(),p.get_death_id()]: + for e_id in [p.get_birth_handle(),p.get_death_handle()]: if e_id: - e = self.db.find_event_from_id(e_id) + e = self.db.find_event_from_handle(e_id) else: continue if e: f.write("%s|" % self.make_date(e.get_date_object())) - if e.get_place_id(): - f.write('%s|' % self.db.try_to_find_place_from_id(e.get_place_id()).get_title()) + if e.get_place_handle(): + f.write('%s|' % self.db.try_to_find_place_from_handle(e.get_place_handle()).get_title()) else: f.write('|') else: @@ -818,7 +818,7 @@ class WebReport(Report.Report): f.write('\n') f.close() - def dump_index(self,person_id_list,styles,template,html_dir): + def dump_index(self,person_handle_list,styles,template,html_dir): """Writes an index file, listing all people in the person list.""" doc = HtmlLinkDoc(self.selected_style,None,template,None) @@ -830,11 +830,11 @@ class WebReport(Report.Report): doc.write_text(_("Family Tree Index")) doc.end_paragraph() - person_id_list.sort(self.sort.by_last_name) + person_handle_list.sort(self.sort.by_last_name) a = {} - for person_id in person_id_list: - person = self.db.try_to_find_person_from_id(person_id) + for person_handle in person_handle_list: + person = self.db.try_to_find_person_from_handle(person_handle) n = person.get_primary_name().get_surname() if n: a[n[0]] = 1 @@ -864,9 +864,9 @@ class WebReport(Report.Report): if self.separate_alpha: doc.close() for n in link_keys: - p_id_list = [ p_id for p_id in person_id_list if \ - (self.db.try_to_find_person_from_id(p_id).get_primary_name().get_surname() \ - and (self.db.try_to_find_person_from_id(p_id).get_primary_name().get_surname()[0] == n) ) ] + p_id_list = [ p_id for p_id in person_handle_list if \ + (self.db.try_to_find_person_from_handle(p_id).get_primary_name().get_surname() \ + and (self.db.try_to_find_person_from_handle(p_id).get_primary_name().get_surname()[0] == n) ) ] doc = HtmlLinkDoc(self.selected_style,None,template,None) doc.set_extension(self.ext) doc.set_title(_("Section %s") % n) @@ -883,13 +883,13 @@ class WebReport(Report.Report): doc.write_raw('' % td_width) col_len = n_rows - for person_id in p_id_list: - name = self.db.try_to_find_person_from_id(person_id).get_primary_name().get_name() + for person_handle in p_id_list: + name = self.db.try_to_find_person_from_handle(person_handle).get_primary_name().get_name() if self.birth_dates: - birth_id = self.db.try_to_find_person_from_id(person_id).get_birth_id() - if birth_id: - birth_event = self.db.find_event_from_id(birth_id) + birth_handle = self.db.try_to_find_person_from_handle(person_handle).get_birth_handle() + if birth_handle: + birth_event = self.db.find_event_from_handle(birth_handle) if self.year_only: birth_dobj = birth_event.get_date_object() if birth_dobj.get_year_valid(): @@ -901,7 +901,7 @@ class WebReport(Report.Report): else: birth_date = "" - doc.start_link("%s.%s" % (person_id,self.ext)) + doc.start_link("%s.%s" % (person_handle,self.ext)) doc.write_text(name) if self.birth_dates and birth_date: doc.write_text(' (%s %s)' % (_BORN,birth_date)) @@ -916,7 +916,7 @@ class WebReport(Report.Report): doc.write_raw('') doc.close() else: - n_rows = len(person_id_list) + len(link_keys) + n_rows = len(person_handle_list) + len(link_keys) n_rows = n_rows/self.n_cols td_width = 100/self.n_cols @@ -924,9 +924,9 @@ class WebReport(Report.Report): doc.write_raw('' % td_width) col_len = n_rows for n in link_keys: - p_id_list = [ p_id for p_id in person_id_list if \ - (self.db.try_to_find_person_from_id(p_id).get_primary_name().get_surname() \ - and (self.db.try_to_find_person_from_id(p_id).get_primary_name().get_surname()[0] == n) ) ] + p_id_list = [ p_id for p_id in person_handle_list if \ + (self.db.try_to_find_person_from_handle(p_id).get_primary_name().get_surname() \ + and (self.db.try_to_find_person_from_handle(p_id).get_primary_name().get_surname()[0] == n) ) ] doc.start_paragraph('IndexLabel') if self.include_alpha_links: doc.write_linktarget("%03d" % a[n]) @@ -934,13 +934,13 @@ class WebReport(Report.Report): doc.end_paragraph() col_len = col_len - 1 - for person_id in p_id_list: - name = self.db.try_to_find_person_from_id(person_id).get_primary_name().get_name() + for person_handle in p_id_list: + name = self.db.try_to_find_person_from_handle(person_handle).get_primary_name().get_name() if self.birth_dates: - birth_id = self.db.try_to_find_person_from_id(person_id).get_birth_id() - if birth_id: - birth_event = self.db.find_event_from_id(birth_id) + birth_handle = self.db.try_to_find_person_from_handle(person_handle).get_birth_handle() + if birth_handle: + birth_event = self.db.find_event_from_handle(birth_handle) if self.year_only: birth_dobj = birth_event.get_date_object() if birth_dobj.get_year_valid(): @@ -952,7 +952,7 @@ class WebReport(Report.Report): else: birth_date = "" - doc.start_link("%s.%s" % (person_id,self.ext)) + doc.start_link("%s.%s" % (person_handle,self.ext)) doc.write_text(name) if self.birth_dates and birth_date: doc.write_text(' (%s %s)' % (_BORN,birth_date)) @@ -1020,8 +1020,8 @@ class WebReport(Report.Report): my_map = {} for l in ind_list: my_map[l] = l - for person_id in ind_list: - person = self.db.try_to_find_person_from_id(person_id) + for person_handle in ind_list: + person = self.db.try_to_find_person_from_handle(person_handle) tdoc = HtmlLinkDoc(self.selected_style,None,None,None,doc) tdoc.set_extension(self.ext) tdoc.set_keywords([person.get_primary_name().get_surname(), @@ -1217,15 +1217,15 @@ class WebReportDialog(Report.ReportDialog): des = GenericFilter.GenericFilter() des.set_name(_("Direct Descendants of %s") % name) - des.add_rule(GenericFilter.IsDescendantOf([self.person.get_id()])) + des.add_rule(GenericFilter.IsDescendantOf([self.person.get_handle()])) df = GenericFilter.GenericFilter() df.set_name(_("Descendant Families of %s") % name) - df.add_rule(GenericFilter.IsDescendantFamilyOf([self.person.get_id()])) + df.add_rule(GenericFilter.IsDescendantFamilyOf([self.person.get_handle()])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_id()])) + ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_handle()])) return [all,des,df,ans] @@ -1564,8 +1564,8 @@ class MiniTree: else: self.lines_map[position] += indent - if person and person.get_id() and self.map.has_key(person.get_id()): - self.lines_map[position] += "%s" % (person.get_id(), + if person and person.get_handle() and self.map.has_key(person.get_handle()): + self.lines_map[position] += "%s" % (person.get_handle(), self.doc.ext, name) else: self.lines_map[position] += "%s" % name @@ -1576,12 +1576,12 @@ class MiniTree: offset = 2**(generations-1) - family_id = person.get_main_parents_family_id() - if not family_id: return + family_handle = person.get_main_parents_family_handle() + if not family_handle: return - family = self.db.find_family_from_id(family_id) - father_id = family.get_father_id() - mother_id = family.get_mother_id() + family = self.db.find_family_from_handle(family_handle) + father_handle = family.get_father_handle() + mother_handle = family.get_mother_handle() if topline: # if we're on top (father's) line, replace last '|' with space @@ -1597,14 +1597,14 @@ class MiniTree: father_indent = indent + ' ' * len(name) + '|' mother_indent = indent[:-1] + ' ' + ' ' * len(name) + '|' - if father_id: - father = self.db.try_to_find_person_from_id(father_id) + if father_handle: + father = self.db.try_to_find_person_from_handle(father_handle) next_pos = position - offset self.lines_map[position] += '|' self.draw_parents(father,next_pos,father_indent,generations,1) - if mother_id: - mother = self.db.try_to_find_person_from_id(mother_id) + if mother_handle: + mother = self.db.try_to_find_person_from_handle(mother_handle) next_pos = position + offset self.draw_parents(mother,next_pos,mother_indent,generations,0) @@ -1621,8 +1621,8 @@ class MiniTree: self.lines[line] += ' ' * (indent-len(self.lines[line])) + text def draw_link(self, line, person, name): - if person and person.get_id() and self.map.has_key(person.get_id()): - self.lines[line] += "%s" % (person.get_id(), + if person and person.get_handle() and self.map.has_key(person.get_handle()): + self.lines[line] += "%s" % (person.get_handle(), self.doc.ext, name) else: self.lines[line] += "%s" % name diff --git a/src/plugins/WriteCD.py b/src/plugins/WriteCD.py index 9b4b51a3b..36c2e5b3d 100644 --- a/src/plugins/WriteCD.py +++ b/src/plugins/WriteCD.py @@ -146,7 +146,7 @@ class PackageWriter: return for obj_id in self.db.get_object_keys(): - obj = self.db.try_to_find_object_from_id(obj_id) + obj = self.db.try_to_find_object_from_handle(obj_id) oldfile = obj.get_path() root = os.path.basename(oldfile) if os.path.isfile(oldfile): @@ -201,47 +201,47 @@ class PackageWriter: def remove_clicked(): # File is lost => remove all references and the object itself for p_id in self.db.get_family_keys(): - p = self.db.find_family_from_id(p_id) + p = self.db.find_family_from_handle(p_id) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == self.object_id: + if o.get_reference_handle() == self.object_handle: nl.remove(o) p.set_media_list(nl) self.db.commit_family(p,None) for key in self.db.get_person_keys(): - p = self.db.try_to_find_person_from_id(key) + p = self.db.try_to_find_person_from_handle(key) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == self.object_id: + if o.get_reference_handle() == self.object_handle: nl.remove(o) p.set_media_list(nl) self.db.commit_person(p,None) for key in self.db.get_source_keys(): - p = self.db.try_to_find_source_from_id(key) + p = self.db.try_to_find_source_from_handle(key) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == self.object_id: + if o.get_reference_handle() == self.object_handle: nl.remove(o) p.set_media_list(nl) self.db.commit_source(p,None) - for key in self.db.get_place_id_keys(): - p = self.db.try_to_find_place_from_id(key) + for key in self.db.get_place_handle_keys(): + p = self.db.try_to_find_place_from_handle(key) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == self.object_id: + if o.get_reference_handle() == self.object_handle: nl.remove(o) p.set_media_list(nl) self.db.commit_place(p,None) for key in self.db.get_event_keys(): - p = self.db.find_event_from_id(key) + p = self.db.find_event_from_handle(key) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == self.object_id: + if o.get_reference_handle() == self.object_handle: nl.remove(o) p.set_media_list(nl) self.db.commit_event(p,None) - self.db.remove_object(self.object_id,None) + self.db.remove_object(self.object_handle,None) def leave_clicked(): # File is lost => do nothing, leave as is @@ -273,7 +273,7 @@ class PackageWriter: # during the process (i.e. when removing object) for obj_id in self.db.get_object_keys(): - obj = self.db.try_to_find_object_from_id(obj_id) + obj = self.db.try_to_find_object_from_handle(obj_id) oldfile = obj.get_path() root = os.path.basename(oldfile) if os.path.isfile(oldfile): @@ -282,7 +282,7 @@ class PackageWriter: self.make_thumbnail(base,root,obj.get_path()) else: # File is lost => ask what to do - self.object_id = obj.get_id() + self.object_handle = obj.get_handle() if missmedia_action == 0: mmd = QuestionDialog.MissingMediaDialog(_("Media object could not be found"), _("%(file_name)s is referenced in the database, but no longer exists. " diff --git a/src/plugins/WriteFtree.py b/src/plugins/WriteFtree.py index 0525b57b0..20f32a827 100644 --- a/src/plugins/WriteFtree.py +++ b/src/plugins/WriteFtree.py @@ -109,16 +109,16 @@ class FtreeWriter: des = GenericFilter.GenericFilter() des.set_name(_("Descendants of %s") % person.get_primary_name().get_name()) - des.add_rule(GenericFilter.IsDescendantOf([person.get_id()])) + des.add_rule(GenericFilter.IsDescendantOf([person.get_handle()])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % person.get_primary_name().get_name()) - ans.add_rule(GenericFilter.IsAncestorOf([person.get_id()])) + ans.add_rule(GenericFilter.IsAncestorOf([person.get_handle()])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % person.get_primary_name().get_name()) - com.add_rule(GenericFilter.HasCommonAncestorWith([person.get_id()])) + com.add_rule(GenericFilter.HasCommonAncestorWith([person.get_handle()])) self.filter_menu = GenericFilter.build_filter_menu([all,des,ans,com]) self.filter.set_menu(self.filter_menu) @@ -153,8 +153,8 @@ class FtreeWriter: self.plist[p] = 1 else: try: - for p in cfilter.apply(self.db, self.db.get_person_id_map().values()): - self.plist[p.get_id()] = 1 + for p in cfilter.apply(self.db, self.db.get_person_handle_map().values()): + self.plist[p.get_handle()] = 1 except Errors.FilterError, msg: (m1,m2) = msg.messages() ErrorDialog(m1,m2) @@ -198,12 +198,12 @@ class FtreeWriter: email = "" web = "" - family = p.get_main_parents_family_id() + family = p.get_main_parents_family_handle() if family: - if family.get_father_id() and id_map.has_key(family.get_father_id().get_id()): - father = id_map[family.get_father_id().get_id()] - if family.get_mother_id() and id_map.has_key(family.get_mother_id().get_id()): - mother = id_map[family.get_mother_id().get_id()] + if family.get_father_handle() and id_map.has_key(family.get_father_handle().get_handle()): + father = id_map[family.get_father_handle().get_handle()] + if family.get_mother_handle() and id_map.has_key(family.get_mother_handle().get_handle()): + mother = id_map[family.get_mother_handle().get_handle()] # # Calculate Date diff --git a/src/plugins/WriteGedcom.py b/src/plugins/WriteGedcom.py index 18a5fe059..054d21277 100644 --- a/src/plugins/WriteGedcom.py +++ b/src/plugins/WriteGedcom.py @@ -110,15 +110,15 @@ _get_int = re.compile('([0-9]+)') # # #------------------------------------------------------------------------- -def add_familys_sources(db,family_id,slist,private): - family = db.find_family_from_id(family_id) - for event_id in family.get_event_list(): - if event_id: - event = db.find_event_from_id(event_id) +def add_familys_sources(db,family_handle,slist,private): + family = db.find_family_from_handle(family_handle) + for event_handle in family.get_event_list(): + if event_handle: + event = db.find_event_from_handle(event_handle) if private and event.get_privacy(): continue for source_ref in event.get_source_references(): - sbase = source_ref.get_base_id() + sbase = source_ref.get_base_handle() if sbase != None and not slist.has_key(sbase): slist[sbase] = 1 @@ -126,9 +126,9 @@ def add_familys_sources(db,family_id,slist,private): if private and attr.get_privacy(): continue for source_ref in attr.get_source_references(): - sbase = source_ref.get_base_id() - if sbase != None and not slist.has_key(sbase.get_id()): - slist[sbase.get_id()] = 1 + sbase = source_ref.get_base_handle() + if sbase != None and not slist.has_key(sbase.get_handle()): + slist[sbase.get_handle()] = 1 #------------------------------------------------------------------------- # @@ -138,15 +138,15 @@ def add_familys_sources(db,family_id,slist,private): def add_persons_sources(db,person,slist,private): elist = person.get_event_list()[:] - elist.append(person.get_birth_id()) - elist.append(person.get_death_id()) - for event_id in elist: - if event_id: - event = db.find_event_from_id(event_id) + elist.append(person.get_birth_handle()) + elist.append(person.get_death_handle()) + for event_handle in elist: + if event_handle: + event = db.find_event_from_handle(event_handle) if private and event.get_privacy(): continue for source_ref in event.get_source_references(): - sbase = source_ref.get_base_id() + sbase = source_ref.get_base_handle() if sbase != None and not slist.has_key(sbase): slist[sbase] = 1 @@ -154,23 +154,23 @@ def add_persons_sources(db,person,slist,private): if private and event.get_privacy(): continue for source_ref in event.get_source_references(): - sbase = source_ref.get_base_id() - if sbase != None and not slist.has_key(sbase.get_id()): - slist[sbase.get_id()] = 1 + sbase = source_ref.get_base_handle() + if sbase != None and not slist.has_key(sbase.get_handle()): + slist[sbase.get_handle()] = 1 for event in person.get_attribute_list(): if private and event.get_privacy(): continue for source_ref in event.get_source_references(): - sbase = source_ref.get_base_id() - if sbase != None and not slist.has_key(sbase.get_id()): - slist[sbase.get_id()] = 1 + sbase = source_ref.get_base_handle() + if sbase != None and not slist.has_key(sbase.get_handle()): + slist[sbase.get_handle()] = 1 for name in person.get_alternate_names() + [person.get_primary_name()]: if private and name.get_privacy(): continue for source_ref in name.get_source_references(): - sbase = source_ref.get_base_id() + sbase = source_ref.get_base_handle() if sbase != None and not slist.has_key(sbase): slist[sbase] = 1 @@ -191,8 +191,8 @@ def addr_append(text,data): # #------------------------------------------------------------------------- def sortById(first,second): - fid = first.get_id() - sid = second.get_id() + fid = first.get_handle() + sid = second.get_handle() if fid == sid: return 0 @@ -394,16 +394,16 @@ class GedcomWriterOptionBox: des = GenericFilter.GenericFilter() des.set_name(_("Descendants of %s") % self.person.get_primary_name().get_name()) - des.add_rule(GenericFilter.IsDescendantOf([self.person.get_id()])) + des.add_rule(GenericFilter.IsDescendantOf([self.person.get_handle()])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % self.person.get_primary_name().get_name()) - ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_id()])) + ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_handle()])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % self.person.get_primary_name().get_name()) - com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.get_id()])) + com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.get_handle()])) self.filter_menu = GenericFilter.build_filter_menu([all,des,ans,com]) filter_obj.set_menu(self.filter_menu) @@ -569,9 +569,9 @@ class GedcomWriter: for key in self.plist.keys(): p = self.db.get_person(key) add_persons_sources(self.db,p,self.slist,self.option_box.private) - for family_id in p.get_family_id_list(): - add_familys_sources(self.db,family_id,self.slist,self.option_box.private) - self.flist[family_id] = 1 + for family_handle in p.get_family_handle_list(): + add_familys_sources(self.db,family_handle,self.slist,self.option_box.private) + self.flist[family_handle] = 1 def cl_setup(self): self.restrict = 0 @@ -604,9 +604,9 @@ class GedcomWriter: for key in self.plist.keys(): p = self.db.get_person(key) add_persons_sources(self.db,p,self.slist,self.private) - for family_id in p.get_family_id_list(): - add_familys_sources(self.db,family_id,self.slist,self.private) - self.flist[family_id] = 1 + for family_handle in p.get_family_handle_list(): + add_familys_sources(self.db,family_handle,self.slist,self.private) + self.flist[family_handle] = 1 def writeln(self,text): self.g.write('%s%s' % (text,self.nl)) @@ -738,21 +738,21 @@ class GedcomWriter: def write_families(self): nump = float(len(self.flist)) index = 0.0 - for family_id in self.flist.keys(): - family = self.db.find_family_from_id(family_id) + for family_handle in self.flist.keys(): + family = self.db.find_family_from_handle(family_handle) father_alive = mother_alive = 0 - self.writeln("0 @%s@ FAM" % self.fid(family_id)) - self.frefn(family_id) - person_id = family.get_father_id() - if person_id != None and self.plist.has_key(person_id): - person = self.db.try_to_find_person_from_id(person_id) + self.writeln("0 @%s@ FAM" % self.fid(family_handle)) + self.frefn(family_handle) + person_handle = family.get_father_handle() + if person_handle != None and self.plist.has_key(person_handle): + person = self.db.try_to_find_person_from_handle(person_handle) gramps_id = person.get_gramps_id() self.writeln("1 HUSB @%s@" % gramps_id) father_alive = person.probably_alive(self.db) - person_id = family.get_mother_id() - if person_id != None and self.plist.has_key(person_id): - person = self.db.try_to_find_person_from_id(person_id) + person_handle = family.get_mother_handle() + if person_handle != None and self.plist.has_key(person_handle): + person = self.db.try_to_find_person_from_handle(person_handle) gramps_id = person.get_gramps_id() self.writeln("1 WIFE @%s@" % gramps_id) mother_alive = person.probably_alive(self.db) @@ -760,8 +760,8 @@ class GedcomWriter: if not self.restrict or ( not father_alive and not mother_alive ): self.write_ord("SLGS",family.get_lds_sealing(),1,const.lds_ssealing) - for event_id in family.get_event_list(): - event = self.db.find_event_from_id(event_id) + for event_handle in family.get_event_list(): + event = self.db.find_event_from_handle(event_handle) if self.private and event.get_privacy(): continue name = event.get_name() @@ -780,24 +780,24 @@ class GedcomWriter: self.dump_event_stats(event) - for person_id in family.get_child_id_list(): - if not self.plist.has_key(person_id): + for person_handle in family.get_child_handle_list(): + if not self.plist.has_key(person_handle): continue - person = self.db.try_to_find_person_from_id(person_id) + person = self.db.try_to_find_person_from_handle(person_handle) self.writeln("1 CHIL @%s@" % person.get_gramps_id()) if self.adopt == GedcomInfo.ADOPT_FTW: - if person.get_main_parents_family_id() == family.get_id(): + if person.get_main_parents_family_handle() == family.get_handle(): self.writeln('2 _FREL Natural') self.writeln('2 _MREL Natural') else: - for f in person.get_parent_family_id_list(): - if f[0] == family.get_id(): + for f in person.get_parent_family_handle_list(): + if f[0] == family.get_handle(): self.writeln('2 _FREL %s' % f[2]) self.writeln('2 _MREL %s' % f[1]) break if self.adopt == GedcomInfo.ADOPT_LEGACY: - for f in person.get_parent_family_id_list(): - if f[0] == family.get_id(): + for f in person.get_parent_family_handle_list(): + if f[0] == family.get_handle(): self.writeln('2 _STAT %s' % f[2]) break @@ -813,8 +813,8 @@ class GedcomWriter: nump = float(len(self.slist)) index = 0.0 for key in self.slist.keys(): - source = self.db.try_to_find_source_from_id(key) - self.writeln("0 @%s@ SOUR" % self.sid(source.get_id())) + source = self.db.try_to_find_source_from_handle(key) + self.writeln("0 @%s@ SOUR" % self.sid(source.get_handle())) if source.get_title(): self.writeln("1 TITL %s" % fmtline(self.cnvtxt(source.get_title()),248,1,self.nl)) if source.get_author(): @@ -867,17 +867,17 @@ class GedcomWriter: self.writeln("1 SEX F") if not restricted: - birth_id = person.get_birth_id() - birth = self.db.find_event_from_id(birth_id) - if birth_id and not (self.private and birth.get_privacy()): - if not birth.get_date_object().is_empty() or birth.get_place_id(): + birth_handle = person.get_birth_handle() + birth = self.db.find_event_from_handle(birth_handle) + if birth_handle and not (self.private and birth.get_privacy()): + if not birth.get_date_object().is_empty() or birth.get_place_handle(): self.writeln("1 BIRT") self.dump_event_stats(birth) - death_id = person.get_death_id() - death = self.db.find_event_from_id(death_id) - if death_id and not (self.private and death.get_privacy()): - if not death.get_date_object().is_empty() or death.get_place_id(): + death_handle = person.get_death_handle() + death = self.db.find_event_from_handle(death_handle) + if death_handle and not (self.private and death.get_privacy()): + if not death.get_date_object().is_empty() or death.get_place_handle(): self.writeln("1 DEAT") self.dump_event_stats(death) @@ -887,8 +887,8 @@ class GedcomWriter: self.write_ord("ENDL",person.get_lds_endowment(),1,const.lds_baptism) self.write_ord("SLGC",person.get_lds_sealing(),1,const.lds_csealing) - for event_id in person.get_event_list(): - event = self.db.find_event_from_id(event_id) + for event_handle in person.get_event_list(): + event = self.db.find_event_from_handle(event_handle) if self.private and event.get_privacy(): continue name = event.get_name() @@ -902,14 +902,14 @@ class GedcomWriter: ad = 1 self.writeln('1 ADOP') fam = None - for f in person.get_parent_family_id_list(): + for f in person.get_parent_family_handle_list(): mrel = f[1].lower() frel = f[2].lower() if mrel=="adopted" or frel=="adopted": fam = f[0] break if fam: - self.writeln('2 FAMC @%s@' % self.fid(fam.get_id())) + self.writeln('2 FAMC @%s@' % self.fid(fam.get_handle())) if mrel == frel: self.writeln('3 ADOP BOTH') elif mrel == "adopted": @@ -925,17 +925,17 @@ class GedcomWriter: self.dump_event_stats(event) - if self.adopt == GedcomInfo.ADOPT_EVENT and ad == 0 and len(person.get_parent_family_id_list()) != 0: + if self.adopt == GedcomInfo.ADOPT_EVENT and ad == 0 and len(person.get_parent_family_handle_list()) != 0: self.writeln('1 ADOP') fam = None - for f in person.get_parent_family_id_list(): + for f in person.get_parent_family_handle_list(): mrel = f[1].lower() frel = f[2].lower() if mrel=="adopted" or frel=="adopted": fam = f[0] break if fam: - self.writeln('2 FAMC @%s@' % self.fid(fam.get_id())) + self.writeln('2 FAMC @%s@' % self.fid(fam.get_handle())) if mrel == frel: self.writeln('3 ADOP BOTH') elif mrel == "adopted": @@ -1004,8 +1004,8 @@ class GedcomWriter: photos = [] for photo in photos: - photo_obj_id = photo.get_reference_id() - photo_obj = self.db.try_to_find_object_from_id(photo_obj_id) + photo_obj_id = photo.get_reference_handle() + photo_obj = self.db.try_to_find_object_from_handle(photo_obj_id) if photo_obj and photo_obj.get_mime_type() == "image/jpeg": self.writeln('1 OBJE') self.writeln('2 FORM jpeg') @@ -1026,16 +1026,16 @@ class GedcomWriter: "wb").writelines (file (path, "rb").xreadlines ()) - for family in person.get_parent_family_id_list(): + for family in person.get_parent_family_handle_list(): if self.flist.has_key(family[0]): self.writeln("1 FAMC @%s@" % self.fid(family[0])) if self.adopt == GedcomInfo.ADOPT_PEDI: if family[1].lower() == "adopted": self.writeln("2 PEDI Adopted") - for family_id in person.get_family_id_list(): - if family_id != None and self.flist.has_key(family_id): - self.writeln("1 FAMS @%s@" % self.fid(family_id)) + for family_handle in person.get_family_handle_list(): + if family_handle != None and self.flist.has_key(family_handle): + self.writeln("1 FAMS @%s@" % self.fid(family_handle)) if not restricted: if self.obje: @@ -1118,8 +1118,8 @@ class GedcomWriter: def dump_event_stats(self,event): dateobj = event.get_date_object() self.print_date("2 DATE",dateobj) - if event.get_place_id(): - place_name = self.db.try_to_find_place_from_id(event.get_place_id()).get_title() + if event.get_place_handle(): + place_name = self.db.try_to_find_place_from_handle(event.get_place_handle()).get_title() self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(place_name),'\r',' ')) if event.get_cause(): self.writeln("2 CAUS %s" % self.cnvtxt(event.get_cause())) @@ -1133,12 +1133,12 @@ class GedcomWriter: return self.writeln('%d %s' % (index,name)) self.print_date("%d DATE" % (index + 1), ord.get_date_object()) - if ord.get_family_id(): - self.writeln('%d FAMC @%s@' % (index+1,self.fid(ord.get_family_id().get_id()))) + if ord.get_family_handle(): + self.writeln('%d FAMC @%s@' % (index+1,self.fid(ord.get_family_handle().get_handle()))) if ord.get_temple(): self.writeln('%d TEMP %s' % (index+1,ord.get_temple())) - if ord.get_place_id(): - place_name = self.db.try_to_find_place_from_id(ord.get_place_id()).get_title() + if ord.get_place_handle(): + place_name = self.db.try_to_find_place_from_handle(ord.get_place_handle()).get_title() self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(place_name),'\r',' ')) if ord.get_status() != 0: self.writeln("2 STAT %s" % self.cnvtxt(statlist[ord.get_status()])) @@ -1204,12 +1204,12 @@ class GedcomWriter: self.write_source_ref(2,srcref) def write_source_ref(self,level,ref): - if ref.get_base_id() == None: + if ref.get_base_handle() == None: return if self.source_refs: self.writeln("%d SOUR @%s@" % - (level,self.sid(ref.get_base_id()))) + (level,self.sid(ref.get_base_handle()))) if ref.get_page() != "": self.write_long_text("PAGE",level+1,self.cnvtxt(ref.get_page())) @@ -1225,7 +1225,7 @@ class GedcomWriter: # Not using CONC and CONT because GeneWeb does not support these. # TEXT and NOTE will be ignored by GeneWeb, but we can't # output paragaphs in SOUR without CONT. - sbase = ref.get_base_id() + sbase = ref.get_base_handle() if sbase and sbase.get_title(): txt = sbase.get_title() + ". " else: @@ -1252,8 +1252,8 @@ class GedcomWriter: if match: self.writeln('1 REFN %d' % int(match.groups()[0])) - def frefn(self,family_id): - match = _get_int.search(family_id) + def frefn(self,family_handle): + match = _get_int.search(family_handle) if match: self.writeln('1 REFN %d' % int(match.groups()[0])) diff --git a/src/plugins/WritePkg.py b/src/plugins/WritePkg.py index 55f80393b..bfbe16fe8 100644 --- a/src/plugins/WritePkg.py +++ b/src/plugins/WritePkg.py @@ -85,42 +85,42 @@ class PackageWriter: def remove_clicked(): # File is lost => remove all references and the object itself for p_id in self.db.get_family_keys(): - p = self.db.find_family_from_id(p_id) + p = self.db.find_family_from_handle(p_id) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == m_id: + if o.get_reference_handle() == m_id: nl.remove(o) p.set_media_list(nl) self.db.commit_family(p,None) for key in self.db.get_person_keys(): - p = self.db.try_to_find_person_from_id(key) + p = self.db.try_to_find_person_from_handle(key) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == m_id: + if o.get_reference_handle() == m_id: nl.remove(o) p.set_media_list(nl) self.db.commit_person(p,None) for key in self.db.get_source_keys(): - p = self.db.try_to_find_source_from_id(key) + p = self.db.try_to_find_source_from_handle(key) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == m_id: + if o.get_reference_handle() == m_id: nl.remove(o) p.set_media_list(nl) self.db.commit_source(p,None) - for key in self.db.get_place_id_keys(): - p = self.db.try_to_find_place_from_id(key) + for key in self.db.get_place_handle_keys(): + p = self.db.try_to_find_place_from_handle(key) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == m_id: + if o.get_reference_handle() == m_id: nl.remove(o) p.set_media_list(nl) self.db.commit_place(p,None) for key in self.db.get_event_keys(): - p = self.db.find_event_from_id(key) + p = self.db.find_event_from_handle(key) nl = p.get_media_list() for o in nl: - if o.get_reference_id() == m_id: + if o.get_reference_handle() == m_id: nl.remove(o) p.set_media_list(nl) self.db.commit_event(p,None) @@ -157,7 +157,7 @@ class PackageWriter: # Write media files first, since the database may be modified # during the process (i.e. when removing object) for m_id in self.db.get_object_keys(): - mobject = self.db.try_to_find_object_from_id(m_id) + mobject = self.db.try_to_find_object_from_handle(m_id) oldfile = mobject.get_path() base = os.path.basename(oldfile) if os.path.isfile(oldfile): diff --git a/src/plugins/rel_de.py b/src/plugins/rel_de.py index 78c789942..c3263652a 100644 --- a/src/plugins/rel_de.py +++ b/src/plugins/rel_de.py @@ -327,10 +327,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator): return _niece_level[level] def is_spouse(self,orig,other): - for f in orig.get_family_id_list(): - family = self.db.find_family_from_id(f) + for f in orig.get_family_handle_list(): + family = self.db.find_family_from_handle(f) if family: - if other == family.get_father_id() or other == family.get_mother_id(): + if other == family.get_father_handle() or other == family.get_mother_handle(): return 1 return 0 @@ -356,7 +356,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator): if type(common) == types.StringType or type(common) == types.UnicodeType: return (common,[]) elif common: - person_id = common[0] + person_handle = common[0] else: return ("",[]) diff --git a/src/plugins/rel_hu.py b/src/plugins/rel_hu.py index 798cf9b2a..850d79dfb 100644 --- a/src/plugins/rel_hu.py +++ b/src/plugins/rel_hu.py @@ -176,34 +176,34 @@ class RelationshipCalculator(Relationship.RelationshipCalculator): #--------------------------------------------- def is_fathermother_in_law(self,orig,other): - for f in other.get_family_id_list(): - family = self.db.find_family_from_id(f) + for f in other.get_family_handle_list(): + family = self.db.find_family_from_handle(f) sp_id = None if family: - if other == family.get_father_id(): - sp_id = family.get_mother_id() - elif other == family.get_mother_id(): - sp_id = family.get_father_id() - for g in orig.get_family_id_list(): - family = self.db.find_family_from_id(g) + if other == family.get_father_handle(): + sp_id = family.get_mother_handle() + elif other == family.get_mother_handle(): + sp_id = family.get_father_handle() + for g in orig.get_family_handle_list(): + family = self.db.find_family_from_handle(g) if family: - if sp_id in family.get_child_id_list(): + if sp_id in family.get_child_handle_list(): return 1 return 0 def get_fathermother_in_law_common(self,orig,other): - for f in other.get_family_id_list(): - family = self.db.find_family_from_id(f) + for f in other.get_family_handle_list(): + family = self.db.find_family_from_handle(f) sp_id = None if family: - if other == family.get_father_id(): - sp_id = family.get_mother_id() - elif other == family.get_mother_id(): - sp_id = family.get_father_idr() - for g in orig.get_family_id_list(): - family = self.db.find_family_from_id(g) + if other == family.get_father_handle(): + sp_id = family.get_mother_handle() + elif other == family.get_mother_handle(): + sp_id = family.get_father_handler() + for g in orig.get_family_handle_list(): + family = self.db.find_family_from_handle(g) if family: - if sp_id in family.get_child_id_list(): + if sp_id in family.get_child_handle_list(): return [sp] return [] @@ -215,38 +215,38 @@ class RelationshipCalculator(Relationship.RelationshipCalculator): #------------------------------------------------------------------------ def is_brothersister_in_law(self,orig,other): - for f in orig.get_family_id_list(): - family = self.db.find_family_from_id(f) + for f in orig.get_family_handle_list(): + family = self.db.find_family_from_handle(f) sp_id = None if family: - if orig == family.get_father_id(): - sp_id = family.get_mother_id() - elif other == family.get_mother_id(): - sp_id = family.get_father_idr() + if orig == family.get_father_handle(): + sp_id = family.get_mother_handle() + elif other == family.get_mother_handle(): + sp_id = family.get_father_handler() - p = other.get_main_parents_family_id() - family = self.db.find_family_from_id(p) + p = other.get_main_parents_family_handle() + family = self.db.find_family_from_handle(p) if family: - c = family.get_child_id_list() - if (other.get_id() in c) and (sp_id in c): + c = family.get_child_handle_list() + if (other.get_handle() in c) and (sp_id in c): return 1 return 0 def get_brothersister_in_law_common(self,orig,other): - for f in orig.get_family_id_list(): - family = self.db.find_family_from_id(f) + for f in orig.get_family_handle_list(): + family = self.db.find_family_from_handle(f) sp_id = None if family: - if orig == family.get_father_id(): - sp_id = family.get_mother_id() - elif other == family.get_mother_id(): - sp_id = family.get_father_idr() + if orig == family.get_father_handle(): + sp_id = family.get_mother_handle() + elif other == family.get_mother_handle(): + sp_id = family.get_father_handler() - p = other.get_main_parents_family_id() - family = self.db.find_family_from_id(p) + p = other.get_main_parents_family_handle() + family = self.db.find_family_from_handle(p) if family: - c = family.get_child_id_list() - if (other.get_id() in c) and (sp_id in c): + c = family.get_child_handle_list() + if (other.get_handle() in c) and (sp_id in c): return [sp] return [] @@ -292,7 +292,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator): if type(common) == types.StringType or type(common) == types.UnicodeType: return (common,[]) elif common: - person_id = common[0] + person_handle = common[0] else: return ("",[]) diff --git a/src/plugins/rel_it.py b/src/plugins/rel_it.py index 3daa9d8af..24fde2acd 100644 --- a/src/plugins/rel_it.py +++ b/src/plugins/rel_it.py @@ -160,7 +160,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator): if type(common) == types.StringType or type(common) == types.UnicodeType: return (common,[]) elif common: - person_id = common[0] + person_handle = common[0] else: return ("",[]) diff --git a/src/plugins/rel_ru.py b/src/plugins/rel_ru.py index 48110bc45..42e3ea27e 100644 --- a/src/plugins/rel_ru.py +++ b/src/plugins/rel_ru.py @@ -196,10 +196,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator): return _niece_level[level] def is_spouse(self,orig,other): - for f in orig.get_family_id_list(): - family = self.db.find_family_from_id(f) + for f in orig.get_family_handle_list(): + family = self.db.find_family_from_handle(f) if family: - if other == family.get_father_id() or other == family.get_mother_id(): + if other == family.get_father_handle() or other == family.get_mother_handle(): return 1 else: return 0 @@ -229,7 +229,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator): if type(common) == types.StringType or type(common) == types.UnicodeType: return (common,[]) elif common: - person_id = common[0] + person_handle = common[0] else: return ("",[]) diff --git a/src/po/Makefile.in b/src/po/Makefile.in index a450fd037..a55886ded 100644 --- a/src/po/Makefile.in +++ b/src/po/Makefile.in @@ -56,6 +56,10 @@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ GNOMEHELP = @GNOMEHELP@ GPREFIX = @GPREFIX@ ICONV = @ICONV@