From b7bb27440949d7179060e465d56ada27c4e42daf Mon Sep 17 00:00:00 2001
From: Don Allingham <don@gramps-project.org>
Date: Fri, 24 Dec 2004 18:46:34 +0000
Subject: [PATCH] * src/RelLib.py: documentation improvements, move family
 relations constants from const.py.in * src/AddSpouse.py: relationship
 constant changes * src/BaseDoc.py: documentation improvements *
 src/ChooseParents.py: relationship constant changes * src/Date.py:
 documentation changes * src/ReadGedcom.py: relationship constant changes,
 remove unused global * src/ReadXML.py: relationship constant changes *
 src/SelectChild.py: has_family to get_parent_family * src/const.py.in: moved
 family relation constants to RelLib * src/plugins/Check.py: relationship
 constant changes * src/plugins/ImportGeneWeb.py: relationship constant
 changes * src/plugins/WriteGeneWeb.py: relationship constant changes

svn: r3836
---
 gramps2/ChangeLog                    |  16 +
 gramps2/src/AddSpouse.py             |   6 +-
 gramps2/src/BaseDoc.py               | 202 ++++---
 gramps2/src/ChooseParents.py         |  12 +-
 gramps2/src/Date.py                  |  32 +-
 gramps2/src/ReadGedcom.py            |   7 +-
 gramps2/src/ReadXML.py               |   2 +-
 gramps2/src/RelLib.py                | 824 +++++++++++++++++++++------
 gramps2/src/SelectChild.py           |   2 +-
 gramps2/src/const.py.in              |   6 -
 gramps2/src/plugins/Check.py         |   6 +-
 gramps2/src/plugins/ImportGeneWeb.py |   2 +-
 gramps2/src/plugins/WriteGeneWeb.py  |   2 +-
 13 files changed, 818 insertions(+), 301 deletions(-)

diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog
index c29164b63..118c858d7 100644
--- a/gramps2/ChangeLog
+++ b/gramps2/ChangeLog
@@ -1,3 +1,19 @@
+2004-12-24  Don Allingham  <dallingham@users.sourceforge.net>
+	* src/RelLib.py: documentation improvements, move family 
+	relations constants from const.py.in
+	* src/AddSpouse.py: relationship constant changes
+	* src/BaseDoc.py: documentation improvements
+	* src/ChooseParents.py: relationship constant changes
+	* src/Date.py: documentation changes
+	* src/ReadGedcom.py: relationship constant changes, remove 
+	unused global
+	* src/ReadXML.py: relationship constant changes
+	* src/SelectChild.py: has_family to get_parent_family
+	* src/const.py.in: moved family relation constants to RelLib
+	* src/plugins/Check.py: relationship constant changes
+	* src/plugins/ImportGeneWeb.py: relationship constant changes
+	* src/plugins/WriteGeneWeb.py: relationship constant changes
+
 2004-12-23 Alex Roitman  <shura@alex.neuro.umn.edu>
 	* src/ReportOptions.py (ReportOptions): Add wrappers to hide handler.
 	* src/plugins/BookReport.py: Use wrappers.
diff --git a/gramps2/src/AddSpouse.py b/gramps2/src/AddSpouse.py
index 3b58d7e09..af099a852 100644
--- a/gramps2/src/AddSpouse.py
+++ b/gramps2/src/AddSpouse.py
@@ -139,7 +139,7 @@ class AddSpouse:
             "destroy_passed_object"    : Utils.destroy_passed_object
             })
 
-        self.rel_combo.set_active(const.FAMILY_MARRIED)
+        self.rel_combo.set_active(RelLib.Family.MARRIED)
         self.update_data()
         
     def add_columns(self,tree):
@@ -189,7 +189,7 @@ class AddSpouse:
         import EditPerson
 
         relation = self.rel_combo.get_active()
-        if relation == const.FAMILY_CIVIL_UNION:
+        if relation == RelLib.Family.CIVIL_UNION:
             if self.person.get_gender() == RelLib.Person.male:
                 gen = RelLib.Person.male
             else:
@@ -335,7 +335,7 @@ class AddSpouse:
         return 1
 
     def set_gender(self):
-        if self.rel_combo.get_active() == const.FAMILY_CIVIL_UNION:
+        if self.rel_combo.get_active() == RelLib.Family.CIVIL_UNION:
             if self.gender == RelLib.Person.male:
                 self.sgender = RelLib.Person.female
             else:
diff --git a/gramps2/src/BaseDoc.py b/gramps2/src/BaseDoc.py
index ae2fba408..07c4ca93a 100644
--- a/gramps2/src/BaseDoc.py
+++ b/gramps2/src/BaseDoc.py
@@ -150,9 +150,9 @@ class PaperStyle:
         """
         Creates a new paper style with.
 
-        name - Name of the new style
-        height - page height in centimeters
-        width - page width in centimeters
+        @param name: name of the new style
+        @param height: page height in centimeters
+        @param width: page width in centimeters
         """
         self.name = name
         self.orientation = PAPER_PORTRAIT
@@ -171,8 +171,8 @@ class PaperStyle:
         """
         Sets the page orientation.
 
-        val - new orientation, should be either PAPER_PORTRAIT or
-              PAPER_LANDSCAPE
+        @param val: new orientation, should be either PAPER_PORTRAIT or
+            PAPER_LANDSCAPE
         """
         self.orientation = val
 
@@ -221,8 +221,8 @@ class FontStyle:
         """
         Creates a new FontStyle object, accepting the default values.
 
-        style - if specified, initializes the FontStyle from the passed
-                FontStyle instead of using the defaults.
+        @param style: if specified, initializes the FontStyle from the passed
+            FontStyle instead of using the defaults.
         """
         if style:
             self.face   = style.face
@@ -243,14 +243,14 @@ class FontStyle:
         """
         Sets font characteristics.
 
-        face - font type face, either FONT_SERIF or FONT_SANS_SERIF
-        size - type face size in points
-        italic - 1 enables italics, 0 disables italics
-        bold - 1 enables bold face, 0 disables bold face
-        underline - 1 enables underline, 0 disables underline
-        color - an RGB color representation in the form of three integers
-                in the range of 0-255 represeting the red, green, and blue
-                components of a color.
+        @param face: font type face, either FONT_SERIF or FONT_SANS_SERIF
+        @param size: type face size in points
+        @param italic: True enables italics, False disables italics
+        @param bold: True enables bold face, False disables bold face
+        @param underline: True enables underline, False disables underline
+        @param color: an RGB color representation in the form of three integers
+            in the range of 0-255 represeting the red, green, and blue
+            components of a color.
         """
         if face != None:
             self.set_type_face(face)
@@ -330,8 +330,8 @@ class TableStyle:
         Creates a new TableStyle object, with the values initialized to
         empty, with allocating space for up to 100 columns.
 
-        obj - if not None, then the object created gets is attributes from
-              the passed object instead of being initialized to empty.
+        @param obj: if not None, then the object created gets is attributes
+            from the passed object instead of being initialized to empty.
         """
         if obj:
             self.width = obj.width
@@ -343,38 +343,47 @@ class TableStyle:
             self.colwid = [ 0 ] * 100
 
     def set_width(self,width):
-        """Sets the width of the table in terms of percent of the available
-           width"""
+        """
+        Sets the width of the table in terms of percent of the available
+        width
+        """
         self.width = width
 
     def get_width(self):
-        "Returns the specified width as a percentage of the available space"
+        """
+        Returns the specified width as a percentage of the available space
+        """
         return self.width
 
     def set_columns(self,columns):
-        """Sets the number of columns.
+        """
+        Sets the number of columns.
 
-           columns - number of columns that should be used.
+        @param columns: number of columns that should be used.
         """
         self.columns = columns
 
     def get_columns(self):
-        "Returns the number of columns"
+        """
+        Returns the number of columns
+        """
         return self.columns 
 
     def set_column_widths(self, list):
-        """Sets the width of all the columns at once, taking the percentages
-           from the passed list.
+        """
+        Sets the width of all the columns at once, taking the percentages
+        from the passed list.
         """
         self.columns = len(list)
         for i in range(self.columns):
             self.colwid[i] = list[i]
 
     def set_column_width(self,index,width):
-        """Sets the width of a specified column to the specified width.
+        """
+        Sets the width of a specified column to the specified width.
 
-           index - column being set (index starts at 0)
-           width - percentage of the table width assigned to the column
+        @param index: column being set (index starts at 0)
+        @param width: percentage of the table width assigned to the column
         """
 	self.colwid[index] = width
 
@@ -383,7 +392,7 @@ class TableStyle:
         Returns the column width of the specified column as a percentage of
         the entire table width.
 
-        index - column to return (index starts at 0)
+        @param index: column to return (index starts at 0)
         """
 	return self.colwid[index]
 
@@ -401,8 +410,8 @@ class TableCellStyle:
         """
         Creates a new TableCellStyle instance.
 
-        obj - if not None, specifies that the values should be copied from
-              the passed object instead of being initialized to empty.
+        @param obj: if not None, specifies that the values should be
+            copied from the passed object instead of being initialized to empty.
         """
         if obj:
             self.rborder = obj.rborder
@@ -427,7 +436,7 @@ class TableCellStyle:
         """
         Defines if a right border in used
 
-        val - if 1, a right border is used, if 0, it is not
+        @param val: if True, a right border is used, if False, it is not
         """
         self.rborder = val
 
@@ -435,7 +444,7 @@ class TableCellStyle:
         """
         Defines if a left border in used
 
-        val - if 1, a left border is used, if 0, it is not
+        @param val: if True, a left border is used, if False, it is not
         """
         self.lborder = val
 
@@ -443,7 +452,7 @@ class TableCellStyle:
         """
         Defines if a top border in used
 
-        val - if 1, a top border is used, if 0, it is not
+        @param val: if True, a top border is used, if False, it is not
         """
         self.tborder = val
 
@@ -451,7 +460,7 @@ class TableCellStyle:
         """
         Defines if a bottom border in used
 
-        val - if 1, a bottom border is used, if 0, it is not
+        @param val: if 1, a bottom border is used, if 0, it is not
         """
         self.bborder = val
 
@@ -493,10 +502,12 @@ class ParagraphStyle:
     alignment, level, top border, bottom border, right border, left
     border, padding, and background color.
 
-    source - if not None, then the ParagraphStyle is created using the
-             values of the source instead of the default values.
     """
     def __init__(self,source=None):
+        """
+        @param source: if not None, then the ParagraphStyle is created
+            using the values of the source instead of the default values.
+        """
         if source:
             self.font    = FontStyle(source.font)
             self.rmargin = source.rmargin
@@ -538,18 +549,18 @@ class ParagraphStyle:
         """
         Allows the values of the object to be set.
 
-        rmargin - right margin in centimeters
-        lmargin - left margin in centimeters
-        first_indent - first line indent in centimeters
-        align - alignment type (PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT,
-                PARA_ALIGN_CENTER, or PARA_ALIGN_JUSTIFY)
-        tborder - non zero indicates that a top border should be used
-        bborder - non zero indicates that a bottom border should be used
-        rborder - non zero indicates that a right border should be used
-        lborder - non zero indicates that a left border should be used
-        pad - padding in centimeters
-        bgcolor - background color of the paragraph as an RGB tuple.
-        font - FontStyle instance that defines the font
+        @param rmargin: right margin in centimeters
+        @param lmargin: left margin in centimeters
+        @param first_indent: first line indent in centimeters
+            align - alignment type (PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT,
+            PARA_ALIGN_CENTER, or PARA_ALIGN_JUSTIFY)
+        @param tborder: non zero indicates that a top border should be used
+        @param bborder: non zero indicates that a bottom border should be used
+        @param rborder: non zero indicates that a right border should be used
+        @param lborder: non zero indicates that a left border should be used
+        @param pad: padding in centimeters
+        @param bgcolor: background color of the paragraph as an RGB tuple.
+        @param font: FontStyle instance that defines the font
         """
         if font != None:
             self.font = FontStyle(font)
@@ -591,7 +602,7 @@ class ParagraphStyle:
         """
         Sets the font style of the paragraph.
 
-        font - FontStyle object containing the font definition to use.
+        @param font: FontStyle object containing the font definition to use.
         """
         self.font = FontStyle(font)
 
@@ -603,7 +614,7 @@ class ParagraphStyle:
         """
         Sets the paragraph padding in centimeters
 
-        val - floating point value indicating the padding in centimeters
+        @param val: floating point value indicating the padding in centimeters
         """
         self.pad = val
 
@@ -615,7 +626,8 @@ class ParagraphStyle:
         """
         Sets the presence or absence of top border.
 
-        val - 1 indicates a border should be used, 0 indicates no border.
+        @param val: True indicates a border should be used, False indicates
+            no border.
         """
         self.top_border = val
 
@@ -627,7 +639,8 @@ class ParagraphStyle:
         """
         Sets the presence or absence of bottom border.
 
-        val - 1 indicates a border should be used, 0 indicates no border.
+        @param val: True indicates a border should be used, False
+            indicates no border.
         """
         self.bottom_border = val
 
@@ -639,7 +652,8 @@ class ParagraphStyle:
         """
         Sets the presence or absence of left border.
 
-        val - 1 indicates a border should be used, 0 indicates no border.
+        @param val: True indicates a border should be used, False
+            indicates no border.
         """
         self.left_border = val
 
@@ -651,7 +665,8 @@ class ParagraphStyle:
         """
         Sets the presence or absence of rigth border.
 
-        val - 1 indicates a border should be used, 0 indicates no border.
+        @param val: True indicates a border should be used, False
+            indicates no border.
         """
         self.right_border = val
 
@@ -670,8 +685,8 @@ class ParagraphStyle:
         """
         Sets the background color of the paragraph.
 
-        color - tuple representing the RGB components of a color (0,0,0)
-                to (255,255,255)
+        @param color: tuple representing the RGB components of a color
+            (0,0,0) to (255,255,255)
         """
         self.bgcolor = color
 
@@ -679,8 +694,8 @@ class ParagraphStyle:
         """
         Sets the paragraph alignment.
 
-        align - PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER, or
-                PARA_ALIGN_JUSTIFY
+        @param align: PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER,
+            or PARA_ALIGN_JUSTIFY
         """
         self.align = align
 
@@ -859,8 +874,8 @@ class StyleSheet:
         """
         Creates a new empty StyleSheet.
 
-        obj - if not None, creates the StyleSheet from the values in
-              obj, instead of creating an empty StyleSheet
+        @param obj: if not None, creates the StyleSheet from the values in
+            obj, instead of creating an empty StyleSheet
         """
         self.style_list = {}
         self.name = ""
@@ -1065,14 +1080,14 @@ class BaseDoc:
         interface. This class should never be instantiated directly, but
         only through a derived class.
 
-        styles      - StyleSheet containing the paragraph styles used.
-        paper_type  - PaperStyle instance containing information about
-                      the paper. If set to None, then the document is
-                      not a page oriented document (e.g. HTML)
-        template    - Format template for document generators that are
-                      not page oriented.
-        orientation - page orientation, either PAPER_PORTRAIT or
-                      PAPER_LANDSCAPE
+        @param styles: StyleSheet containing the paragraph styles used.
+        @param paper_type: PaperStyle instance containing information about
+            the paper. If set to None, then the document is not a page
+            oriented document (e.g. HTML)
+        @param template: Format template for document generators that are
+            not page oriented.
+        @param orientation: page orientation, either PAPER_PORTRAIT or
+            PAPER_LANDSCAPE
         """
         self.orientation = orientation
         self.template = template
@@ -1119,7 +1134,7 @@ class BaseDoc:
         """
         Sets the name of the owner of the document.
 
-        owner - User's name
+        @param owner: User's name
         """
         self.owner = owner
         
@@ -1127,11 +1142,11 @@ class BaseDoc:
         """
         Adds a photo of the specified width (in centimeters)
 
-        name  - filename of the image to add
-        align - alignment of the image. Valid values are 'left', 'right',
-                'center', and 'single'
-        w_cm  - width in centimeters
-        h_cm  - height in centimeters
+        @param name: filename of the image to add
+        @param align: alignment of the image. Valid values are 'left',
+            'right', 'center', and 'single'
+        @param w_cm: width in centimeters
+        @param h_cm: height in centimeters
         """
         pass
     
@@ -1169,7 +1184,7 @@ class BaseDoc:
         """
         Sets the title of the document.
 
-        name - Title of the document
+        @param name: Title of the document
         """
         self.title = name
 
@@ -1180,8 +1195,8 @@ class BaseDoc:
         """
         Adds the TableStyle with the specfied name.
 
-        name  - name of the table style
-        style - TableStyle instance to be added
+        @param name: name of the table style
+        @param style: TableStyle instance to be added
         """
         self.table_styles[name] = TableStyle(style)
 
@@ -1189,8 +1204,8 @@ class BaseDoc:
         """
         Adds the TableCellStyle with the specfied name.
 
-        name  - name of the table cell style
-        style - TableCellStyle instance to be added
+        @param name: name of the table cell style
+        @param style: TableCellStyle instance to be added
         """
         self.cell_styles[name] = TableCellStyle(style)
 
@@ -1198,7 +1213,7 @@ class BaseDoc:
         """
         Opens the document.
 
-        filename - path name of the file to create
+        @param filename: path name of the file to create
         """
         pass
 
@@ -1234,7 +1249,7 @@ class BaseDoc:
         """
 	Starts a new listing block, using the specified style name.
 
-        style_name - name of the ParagraphStyle to use for the block.
+        @param style_name: name of the ParagraphStyle to use for the block.
 	"""
         pass
 
@@ -1245,8 +1260,10 @@ class BaseDoc:
         """
         Starts a new paragraph, using the specified style name.
 
-        style_name - name of the ParagraphStyle to use for the paragraph.
-        leader     - Leading text for a paragraph. Typically used for numbering.
+        @param style_name: name of the ParagraphStyle to use for the
+            paragraph.
+        @param leader: Leading text for a paragraph. Typically used
+            for numbering.
         """
         pass
 
@@ -1258,8 +1275,8 @@ class BaseDoc:
         """
         Starts a new table.
 
-        name       - Unique name of the table.
-        style_name - TableStyle to use for the new table
+        @param name: Unique name of the table.
+        @param style_name: TableStyle to use for the new table
         """
         pass
 
@@ -1279,8 +1296,8 @@ class BaseDoc:
         """
         Starts a new table cell, using the paragraph style specified.
 
-        style_name - TableCellStyle to use for the cell
-        span       - number of columns to span
+        @param style_name: TableCellStyle to use for the cell
+        @param span: number of columns to span
         """
         pass
 
@@ -1297,9 +1314,8 @@ class BaseDoc:
         Writes the note's text and take care of paragraphs, 
         depending on the format. 
 
-        text - text to write.
-        format - format to use for writing: 
-            0 for flowed text, 
+        @param text: text to write.
+        @param format: format to use for writing. True for flowed text, 
             1 for preformatted text.
         """
         pass
@@ -1309,7 +1325,7 @@ class BaseDoc:
         Writes the text in the current paragraph. Should only be used after a
         start_paragraph and before an end_paragraph.
 
-        text - text to write.
+        @param text: text to write.
         """
         pass
 
@@ -1318,7 +1334,7 @@ class BaseDoc:
         Writes the text in the current paragraph. Should only be used after a
         start_paragraph and before an end_paragraph.
 
-        text - text to write.
+        @param text: text to write.
         """
         pass
 
diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py
index d50deeff8..3e628a01d 100644
--- a/gramps2/src/ChooseParents.py
+++ b/gramps2/src/ChooseParents.py
@@ -152,7 +152,7 @@ class ChooseParents:
         if self.family:
             self.type = self.family.get_relationship()
         else:
-            self.type = const.FAMILY_MARRIED
+            self.type = RelLib.Family.MARRIED
 
         self.prel.set_active(self.type)
         self.redrawm()
@@ -332,7 +332,7 @@ class ChooseParents:
         self.father_list.set_model(self.father_model)
         self.father_model.refilter()
         
-        if self.type == const.FAMILY_CIVIL_UNION:
+        if self.type == RelLib.Family.CIVIL_UNION:
             self.flabel.set_label("<b>%s</b>" % _("Par_ent"))
         else:
             self.flabel.set_label("<b>%s</b>" % _("Fath_er"))
@@ -358,7 +358,7 @@ class ChooseParents:
         self.mother_list.set_model(self.mother_model)
         self.mother_model.refilter()
         
-        if self.type == const.FAMILY_CIVIL_UNION:
+        if self.type == RelLib.Family.CIVIL_UNION:
             self.mlabel.set_label("<b>%s</b>" % _("Pa_rent"))
         else:
             self.mlabel.set_label("<b>%s</b>" % _("Mothe_r"))
@@ -367,7 +367,7 @@ class ChooseParents:
         """Called everytime the parent relationship information is changed"""
         self.old_type = self.type
         self.type = self.prel.get_active()
-        if self.old_type == const.FAMILY_CIVIL_UNION or self.type == const.FAMILY_CIVIL_UNION:
+        if self.old_type == RelLib.Family.CIVIL_UNION or self.type == RelLib.Family.CIVIL_UNION:
             self.redrawf()
             self.redrawm()
 
@@ -563,7 +563,7 @@ class ChooseParents:
         name = person.get_primary_name().get_surname()
         self.type = self.prel.get_active()
 
-        if self.type == const.FAMILY_CIVIL_UNION:
+        if self.type == RelLib.Family.CIVIL_UNION:
             self.parent_relation_changed(self.prel)
         elif person.get_gender() == RelLib.Person.male:
             self.redrawf()
@@ -671,7 +671,7 @@ class ModifyParents:
 
         self.title.set_use_markup(gtk.TRUE)
 
-        if self.family.get_relationship() == const.FAMILY_CIVIL_UNION:
+        if self.family.get_relationship() == RelLib.Family.CIVIL_UNION:
             self.mlabel.set_label("<b>%s</b>" % _("Pa_rent"))
             self.flabel.set_label("<b>%s</b>" % _("Par_ent"))
         else:
diff --git a/gramps2/src/Date.py b/gramps2/src/Date.py
index 784a15508..8b356d4f3 100644
--- a/gramps2/src/Date.py
+++ b/gramps2/src/Date.py
@@ -206,7 +206,7 @@ class Date:
     def get_modifier(self):
         """
         Returns an integer indicating the calendar selected. The valid
-        values are:
+        values are::
         
            MOD_NONE       = no modifier (default)
            MOD_BEFORE     = before
@@ -227,7 +227,7 @@ class Date:
     def get_quality(self):
         """
         Returns an integer indicating the calendar selected. The valid
-        values are:
+        values are::
         
            QUAL_NONE       = normal (default)
            QUAL_ESTIMATED  = estimated
@@ -244,7 +244,7 @@ class Date:
     def get_calendar(self):
         """
         Returns an integer indicating the calendar selected. The valid
-        values are:
+        values are::
 
            CAL_GREGORIAN  - Gregorian calendar
            CAL_JULIAN     - Julian calendar
@@ -399,20 +399,20 @@ class Date:
 
     def set(self,quality,modifier,calendar,value,text=None):
         """
-        Sets the date to the specified value. Parameters are:
+        Sets the date to the specified value. Parameters are::
 
-        quality  - The date quality for the date (see get_quality
-                   for more information)
-        modified - The date modifier for the date (see get_modifier
-                   for more information)
-        calendar - The calendar associated with the date (see
-                   get_calendar for more information).
-        value    - A tuple representing the date information. For a
-                   non-compound date, the format is (DD,MM,YY,slash)
-                   and for a compound date the tuple stores data as
-                   (DD,MM,YY,slash1,DD,MM,YY,slash2)
-        text     - A text string holding either the verbatim user input
-                   or a comment relating to the date.
+          quality  - The date quality for the date (see get_quality
+                     for more information)
+          modified - The date modifier for the date (see get_modifier
+                     for more information)
+          calendar - The calendar associated with the date (see
+                     get_calendar for more information).
+          value    - A tuple representing the date information. For a
+                     non-compound date, the format is (DD,MM,YY,slash)
+                     and for a compound date the tuple stores data as
+                     (DD,MM,YY,slash1,DD,MM,YY,slash2)
+          text     - A text string holding either the verbatim user input
+                     or a comment relating to the date.
 
         The sort value is recalculated.
         """
diff --git a/gramps2/src/ReadGedcom.py b/gramps2/src/ReadGedcom.py
index be1a4c39e..a3c9c0f2c 100644
--- a/gramps2/src/ReadGedcom.py
+++ b/gramps2/src/ReadGedcom.py
@@ -66,7 +66,6 @@ ANSEL = 1
 UNICODE = 2
 UPDATE = 25
 
-db = None
 callback = None
 
 _title_string = _("GEDCOM")
@@ -823,7 +822,7 @@ class GedcomParser:
                 except:
                     event.set_name(matches[1])
                 if event.get_name() == "Marriage":
-                    self.family.set_relationship(const.FAMILY_MARRIED)
+                    self.family.set_relationship(RelLib.Family.MARRIED)
                 self.db.add_event(event,self.trans)
                 self.family.add_event_handle(event.get_handle())
                 self.parse_family_event(event,2)
@@ -1941,11 +1940,9 @@ def extract_temple(matches):
 #
 #-------------------------------------------------------------------------
 def readData(database,active_person,cb):
-    global db
     global callback
     global file_topa
     
-    db = database
     callback = cb
 
     choose = gtk.FileChooserDialog("%s - GRAMPS" % _title_string,
@@ -1971,7 +1968,7 @@ def readData(database,active_person,cb):
         filename = choose.get_filename()
         choose.destroy()
         try:
-            importData(db,filename)
+            importData(database,filename)
         except:
             import DisplayTrace
             DisplayTrace.DisplayTrace()
diff --git a/gramps2/src/ReadXML.py b/gramps2/src/ReadXML.py
index df7c61f8a..7d5a7d278 100644
--- a/gramps2/src/ReadXML.py
+++ b/gramps2/src/ReadXML.py
@@ -784,7 +784,7 @@ class GrampsParser:
 
         if attrs.has_key("type"):
             self.family.set_relationship(_FAMILY_TRANS.get(attrs["type"],
-                                                           const.FAMILY_UNKNOWN))
+                                                           RelLib.Family.UNKNOWN))
         if attrs.has_key("complete"):
             self.family.set_complete_flag(int(attrs['complete']))
         else:
diff --git a/gramps2/src/RelLib.py b/gramps2/src/RelLib.py
index f51f2c1e0..fb82d8b70 100644
--- a/gramps2/src/RelLib.py
+++ b/gramps2/src/RelLib.py
@@ -1,4 +1,4 @@
-
+#
 # Gramps - a GTK+/GNOME based genealogy program
 #
 # Copyright (C) 2000-2004  Donald N. Allingham
@@ -74,10 +74,11 @@ parser  = DateHandler.create_parser()
 
 class PrimaryObject:
     """
-    The base class for all primary objects in the database. Primary objects
-    are the core objects in the database. Each object has a database handle
-    and a GRAMPS ID value. The database handle is used as the record number
-    for the database, and the GRAMPS ID is the user visible version.
+    The PrimaryObject is the base class for all primary objects in the
+    database. Primary objects are the core objects in the database.
+    Each object has a database handle and a GRAMPS ID value. The database
+    handle is used as the record number for the database, and the GRAMPS
+    ID is the user visible version.
     """
 
     def __init__(self,source=None):
@@ -85,6 +86,9 @@ class PrimaryObject:
         Initialize a PrimaryObject. If source is None, both the ID and handle
         are assigned as empty strings. If source is not None, then object
         is initialized from values of the source object.
+
+        @param source: Object used to initialize the new object
+        @type source: PrimaryObject
         """
         if source:
             self.gramps_id = source.gramps_id
@@ -97,14 +101,22 @@ class PrimaryObject:
 
     def get_change_time(self):
         """
-        Returns the time that the data was last changed. The value in the format
-        returned by the time.time() command.
+        Returns the time that the data was last changed. The value
+        in the format returned by the time.time() command.
+           
+        @returns: Time that the data was last changed. The value
+           in the format returned by the time.time() command.
+        @rtype: int
         """
         return self.change
 
     def get_change_display(self):
         """
-        Returns a string representation of the last change time.
+        Returns the string representation of the last change time.
+
+        @returns: string representation of the last change time.
+        @rtype: str
+        
         """
         if self.change:
             return time.asctime(time.localtime(self.change))
@@ -112,26 +124,53 @@ class PrimaryObject:
             return ''
 
     def set_handle(self,handle):
-        """Sets the database handle for the primary object"""
+        """
+        Sets the database handle for the primary object
+
+        @param handle: object database handle
+        @type handle: str
+        """
         self.handle = handle
 
     def get_handle(self):
-        """Returns the database handle for the primary object"""
+        """
+        Returns the database handle for the primary object
+
+        @returns: database handle associated with the object
+        @rtype: str
+        """
         return self.handle
 
     def set_gramps_id(self,gramps_id):
-        """Sets the GRAMPS ID for the primary object"""
+        """
+        Sets the GRAMPS ID for the primary object
+        
+        @param gramps_id: GRAMPS ID
+        @type gramps_id: str
+        """
         self.gramps_id = gramps_id
 
     def get_gramps_id(self):
-        """Returns the GRAMPS ID for the primary object"""
+        """
+        Returns the GRAMPS ID for the primary object
+
+        @returns: GRAMPS ID associated with the object
+        @rtype: str
+        """
         return self.gramps_id
 
 class SourceNote:
-    """Base class for storing source references and notes"""
+    """
+    Base class for storing source references and notes
+    """
     
     def __init__(self,source=None):
-        """Create a new SourceNote, copying from source if not None"""
+        """
+        Create a new SourceNote, copying from source if not None
+        
+        @param source: Object used to initialize the new object
+        @type source: SourceNote
+        """
         
         self.source_list = []
         self.note = None
@@ -142,49 +181,98 @@ class SourceNote:
             if source.note:
                 self.note = Note(source.note.get())
 
-    def add_source_reference(self,handle) :
-        """Set the source reference"""
-        self.source_list.append(handle)
+    def add_source_reference(self,src_ref) :
+        """
+        Adds a source reference to this object.
+
+        @param src_ref: The source reference to be added to the
+            SourceNote's list of source references.
+        @type src_ref: L{SourceRef}
+        """
+        self.source_list.append(src_ref)
 
     def get_source_references(self) :
-        """Return the source reference"""
+        """
+        Returns the list of source references associated with the object.
+
+        @return: Returns the list of L{SourceRef} objects assocated with
+            the object.
+        @rtype: list
+        """
         return self.source_list
 
-    def set_source_reference_list(self,list) :
-        """Replaces the source reference"""
-        self.source_list = list
+    def set_source_reference_list(self,src_ref_list) :
+        """
+        Assigns the passed list to the object's list of source references.
+
+        @param src_ref_list: List of source references to ba associated
+            with the object
+        @type src_ref_list: list of L{SourceRef} instances
+        """
+        self.source_list = src_ref_list
 
     def set_note(self,text):
-        """Set the note to the given text"""
+        """
+        Assigns the specified text to the associated note.
+
+        @param text: Text of the note
+        @type text: str
+        """
         if self.note == None:
             self.note = Note()
         self.note.set(text)
 
     def get_note(self):
-        """Return the current note"""
+        """
+        Returns the text of the current note.
+
+        @returns: the text of the current note
+        @rtype: str
+        """
         if self.note == None:
             return ""
         else:
             return self.note.get() 
 
     def set_note_format(self,val):
-        """Set the note's format to the given value"""
+        """
+        Sets the note's format to the given value. The format indicates
+        whether the text is flowed (wrapped) or preformatted.
+
+        @param val: True indicates the text is flowed
+        @type val: bool
+        """
         if self.note:
             self.note.set_format(val)
 
     def get_note_format(self):
-        """Return the current note's format"""
+        """
+        Returns the current note's format
+
+        @returns: True indicates that the note should be flowed (wrapped)
+        @rtype: bool
+        """
         if self.note == None:
-            return 0
+            return False
         else:
             return self.note.get_format()
 
-    def set_note_object(self,obj):
-        """Change the note object instance to obj"""
-        self.note = obj
+    def set_note_object(self,note_obj):
+        """
+        Replaces the current Note object associated with the object
+
+        @param note_obj: New Note object to be assigned
+        @type note_obj: Note
+        """
+        self.note = note_obj
 
     def get_note_object(self):
-        """Return in note instance, not just the text"""
+        """
+        Returns the Note instance associated with the object.
+
+        @returns: Note object assocated with the object
+        @rtype: Note
+        """
         return self.note
 
     def unique_note(self):
@@ -192,10 +280,14 @@ class SourceNote:
         self.note = Note(self.note.get())
 
 class DataObj(SourceNote):
-    """Base class for data elements, providing source, note, and privacy data"""
+    """
+    Base class for data elements, providing source, note, and privacy data
+    """
 
     def __init__(self,source=None):
-        """Create a new DataObj, copying data from a source object if provided"""
+        """
+        Create a new DataObj, copying data from a source object if provided
+        """
         SourceNote.__init__(self,source)
         
         if source:
@@ -204,18 +296,22 @@ class DataObj(SourceNote):
             self.private = False
 
     def set_privacy(self,val):
-        """Sets or clears the privacy flag of the data"""
+        """
+        Sets or clears the privacy flag of the data
+        """
         self.private = val
 
     def get_privacy(self):
-        """Returns the privacy level of the data"""
+        """
+        Returns the privacy level of the data
+        """
         return self.private
 
 class Person(PrimaryObject,SourceNote):
     """
-    GRAMPS Person record. Represents an individual person. Contains all
-    information about the person, including names, events, attributes,
-    and other information.
+    GRAMPS Person record. This object represents an individual person.
+    It contains all the information about the person, including names,
+    events, attributes, and other information.
     """
     
     unknown = 2
@@ -223,7 +319,11 @@ class Person(PrimaryObject,SourceNote):
     female = 0
 
     def __init__(self):
-        """creates a new Person instance"""
+        """
+        Creates a new Person instance. After initialization, most
+        data items have empty or null values, including the database
+        handle.
+        """
         PrimaryObject.__init__(self)
         SourceNote.__init__(self)
         self.primary_name = Name()
@@ -242,7 +342,7 @@ class Person(PrimaryObject,SourceNote):
         self.lds_bapt = None
         self.lds_endow = None
         self.lds_seal = None
-        self.complete = 0
+        self.complete = False
 
         # We hold a reference to the GrampsDB so that we can maintain
         # its genderStats.  It doesn't get set here, but from
@@ -251,7 +351,7 @@ class Person(PrimaryObject,SourceNote):
         
     def serialize(self):
         """
-        Converts the data held in the event to a Python tuple that
+        Converts the data held in the Person to a Python tuple that
         represents all the data elements. This method is used to convert
         the object into a form that can easily be saved to a database.
 
@@ -260,11 +360,15 @@ class Person(PrimaryObject,SourceNote):
         target database cannot handle complex types (such as objectes or
         lists), the database is responsible for converting the data into
         a form that it can use.
+
+        @returns: Returns a python tuple containing the data that should
+            be considered persistent.
+        @rtype: tuple
         """
         return (self.handle, self.gramps_id, self.gender, 
-                self.primary_name, self.alternate_names, unicode(self.nickname), 
-                self.death_handle, self.birth_handle, self.event_list,
-                self.family_list, self.parent_family_list,
+                self.primary_name, self.alternate_names,
+                unicode(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, self.change)
@@ -272,7 +376,11 @@ class Person(PrimaryObject,SourceNote):
     def unserialize(self,data):
         """
         Converts the data held in a tuple created by the serialize method
-        back into the data in an Event structure.
+        back into the data in an Person structure.
+
+        @param data: tuple containing the persistent data associated the
+            Person object
+        @type data: tuple
         """
         (self.handle, self.gramps_id, self.gender, self.primary_name,
          self.alternate_names, self.nickname, self.death_handle,
@@ -286,20 +394,28 @@ class Person(PrimaryObject,SourceNote):
         """
         Sets or clears the complete flag, which is used to indicate that the
         Person's data is considered to be complete.
+
+        @param val: True indicates the Person object is considered to be
+            complete
+        @type val: bool
         """
         self.complete = val
 
     def get_complete_flag(self):
         """
-        Gets the complete flag, which is used to indicate that the
+        Returns the complete flag, which is used to indicate that the
         Person's data is considered to be complete.
+
+        @return: True indicates that the Person's record is considered to
+            be complete.
+        @rtype: bool
         """
         return self.complete
 
     def get_display_info(self):
         """
-        Returns a list consisting of the information typically used for a display.
-        The data consists of: Display Name, ID, Gender, Date of Birth,
+        Returns a list consisting of the information typically used for a
+        display. The data consists of: Display Name, ID, Gender, Date of Birth,
         Date of Death, sort name, etc.
         """
         if self.gender == Person.male:
@@ -315,8 +431,13 @@ class Person(PrimaryObject,SourceNote):
                  GrampsCfg.get_display_surname()(self.primary_name)]
                                           
     def set_primary_name(self,name):
-        """sets the primary name of the Person to the specified
-        Name instance"""
+        """
+        Sets the primary name of the Person to the specified
+        L{Name} instance
+
+        @param name: L{Name} to be assigned to the person
+        @type name: L{Name}
+        """
         db = self.db
         if db:
             db.genderStats.uncount_person (self)
@@ -325,236 +446,598 @@ class Person(PrimaryObject,SourceNote):
             db.genderStats.count_person (self, db)
 
     def get_primary_name(self):
-        """returns the Name instance marked as the Person's primary name"""
+        """
+        Returns the L{Name} instance marked as the Person's primary name
+
+        @return: Returns the primary name
+        @rtype: L{Name}
+        """
         return self.primary_name
 
     def get_alternate_names(self):
-        """returns the list of alternate Names"""
+        """
+        Returns the list of alternate L{Name} instances
+
+        @return: List of L{Name} instances
+        @rtype: list
+        """
         return self.alternate_names
 
-    def set_alternate_names(self,list):
-        """changes the list of alternate names to the passed list"""
-        self.alternate_names = list
+    def set_alternate_names(self,alt_name_list):
+        """
+        Changes the list of alternate names to the passed list. 
+        @param alt_name_list: List of L{Name} instances
+        @type alt_name_list: list
+        """
+        self.alternate_names = alt_name_list
 
     def add_alternate_name(self,name):
-        """adds an alternate Name instance to the list"""
+        """
+        Adds a L{Name} instance to the list of alternative names
+
+        @param name: L{Name} to add to the list
+        @type name: L{Name}
+        """
         self.alternate_names.append(name)
 
     def get_url_list(self):
-        """returns the list of URL instances"""
+        """
+        Returns the list of L{Url} instances associated with the Person
+
+        @returns: List of L{Url} instances
+        @rtype: list
+        """
         return self.urls
 
-    def set_url_list(self,list):
-        """sets the list of URL instances to list"""
-        self.urls = list
+    def set_url_list(self,url_list):
+        """
+        Sets the list of L{Url} instances to passed the list.
+
+        @param url_list: List of L{Url} instances
+        @type url_list: list
+        """
+        self.urls = url_list
 
     def add_url(self,url):
-        """adds a URL instance to the list"""
+        """
+        Adds a L{Url} instance to the Person's list of L{Url} instances
+
+        @param url: L{Url} instance to be added to the Person's list of
+            related web sites.
+        @type url: L{Url}
+        """
         self.urls.append(url)
     
     def set_nick_name(self,name):
-        """sets the nickname for the Person"""
+        """
+        Sets the nickname field for the Person
+
+        @param name: Nickname to be assigned
+        @type name: str
+        """
         self.nickname = name
 
     def get_nick_name(self) :
-        """returns the nickname for the Person"""
+        """
+        Returns the nickname for the Person
+
+        @returns: Returns the nickname associated with the Person
+        @rtype str
+        """
         return self.nickname
 
-    def set_gender(self,val) :
-        """sets the gender of the Person"""
-        db = self.db
-        if db:
-            db.genderStats.uncount_person (self)
-        self.gender = val
-        if db:
-            db.genderStats.count_person (self, db)
+    def set_gender(self,gender) :
+        """
+        Sets the gender of the Person.
+
+        @param gender: Assigns the Person's gender to one of the
+            following constants::
+                Person.male
+                Person.female
+                Person.unknown
+        @type gender: int
+        """
+        # if the db object has been assigned, update the
+        # genderStats of the database
+        if self.db:
+            self.db.genderStats.uncount_person (self)
+        self.gender = gender
+        if self.db:
+            self.db.genderStats.count_person (self, self.db)
 
     def get_gender(self) :
-        """returns the gender of the Person"""
+        """
+        Returns the gender of the Person
+
+        @returns: Returns one of the following constants::
+            Person.male
+            Person.female
+            Person.unknown
+        @rtype: int
+        """
         return self.gender
 
-    def set_birth_handle(self,event_handle) :
-        """sets the birth event to the passed event"""
+    def set_birth_handle(self,event_handle):
+        """
+        Assigns the birth event to the Person object. This is accomplished
+        by assigning the handle of a valid L{Event} in the current database.
+
+        @param event_handle: handle of the L{Event} to be associated with
+            the Person's birth.
+        @type event_handle: str
+        """
         self.birth_handle = event_handle
 
-    def set_death_handle(self,event_handle) :
-        """sets the death event to the passed event"""
+    def set_death_handle(self,event_handle):
+        """
+        Assigns the death event to the Person object. This is accomplished
+        by assigning the handle of a valid L{Event} in the current database.
+
+        @param event_handle: handle of the L{Event} to be associated with
+            the Person's death.
+        @type event_handle: str
+        """
         self.death_handle = event_handle
 
-    def get_birth_handle(self) :
-        """returns the birth event"""
+    def get_birth_handle(self):
+        """
+        Returns the database handle for the Person's birth event. This
+        should correspond to an L{Event} in the database's L{Event} list.
+
+        @returns: Returns the birth L{Event} handle or None if no birth
+            L{Event} has been assigned.
+        @rtype: str
+        """
         return self.birth_handle
 
-    def get_death_handle(self) :
-        """returns the death event"""
+    def get_death_handle(self):
+        """
+        Returns the database handle for the Person's death event. This
+        should correspond to an L{Event} in the database's L{Event} list.
+
+        @returns: Returns the death L{Event} handle or None if no death
+            L{Event} has been assigned.
+        @rtype: str
+        """
         return self.death_handle
 
-    def add_media_reference(self,media_id):
-        """adds a MediaObject instance to the image list"""
-        self.media_list.append(media_id)
+    def add_media_reference(self,media_ref):
+        """
+        Adds a L{MediaRef} instance to the Person's media list.
+
+        @param media_ref: L{MediaRef} instance to be added to the Person's
+            media list.
+        @type media_ref: L{MediaRef}
+        """
+        self.media_list.append(media_ref)
 
     def get_media_list(self):
-        """returns the list of MediaObjects"""
+        """
+        Returns the list of L{MediaRef} instances associated with the Person
+
+        @returns: list of L{MediaRef} instances associated with the Person
+        @rtype: list
+        """
         return self.media_list
 
-    def set_media_list(self,list):
-        """Sets the list of MediaObject objects"""
-        self.media_list = list
+    def set_media_list(self,media_ref_list):
+        """
+        Sets the list of L{MediaRef} instances associated with the Person.
+        It replaces the previous list.
+
+        @param media_ref_list: list of L{MediaRef} instances to be assigned
+            to the Person.
+        @type media_ref_list: list
+        """
+        self.media_list = media_ref_list
 
     def add_event_handle(self,event_handle):
-        """adds an Event to the event list"""
+        """
+        Adds the L{Event} to the Person instance's L{Event} list. This is
+        accomplished by assigning the handle of a valid L{Event} in the
+        current database.
+        
+        @param event_handle: handle of the L{Event} to be added to the
+            Person's L{Event} list.
+        @type event_handle: str
+        """
         self.event_list.append(event_handle)
 
     def get_event_list(self):
-        """returns the list of Event instances"""
+        """
+        Returns the list of handles associated with L{Event} instances.
+
+        @returns: Returns the list of L{Event} handles associated with
+            the Person instance.
+        @rtype: list
+        """
         return self.event_list
 
-    def set_event_list(self,elist):
-        """sets the event list to the passed list"""
-        self.event_list = elist
+    def set_event_list(self,event_list):
+        """
+        Sets the Person instance's L{Event} list to the passed list.
+
+        @param event_list: List of valid L{Event} handles
+        @type event_list: list
+        """
+        self.event_list = event_list
 
     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"""
+        """
+        Adds the L{Family} handle to the Person instance's L{Family} list.
+        This is accomplished by assigning the handle of a valid L{Family}
+        in the current database.
 
+        Adding a L{Family} handle to a Person does not automatically update
+        the corresponding L{Family}. The developer is responsible to make
+        sure that when a L{Family} is added to Person, that the Person is
+        assigned to either the father or mother role in the L{Family}.
+        
+        @param family_handle: handle of the L{Family} to be added to the
+            Person's L{Family} list.
+        @type family_handle: str
+        """
         self.family_list.append(family_handle)
 
-    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 set_preferred_family_handle(self,family_handle):
+        """
+        Sets the family_handle specified to be the preferred L{Family}.
+        The preferred L{Family} is determined by the first L{Family} in the
+        L{Family} list, and is typically used to indicate the preferred
+        L{Family} for navigation or reporting.
+        
+        The family_handle must already be in the list, or the function
+        call has no effect.
+
+        @param family_handle: Handle of the L{Family} to make the preferred
+            L{Family}.
+        @type family_handle: str
+        @returns: True if the call succeeded, False if the family_handle
+            was not already in the L{Family} list
+        @rtype: bool
+        """
+        if family_handle in self.family_list:
+            self.family_list.remove(family_handle)
+            self.family_list = [family_handle] + self.family_list
+            return True
+        else:
+            return False
 
     def get_family_handle_list(self) :
-        """returns the list of Family instances in which the
-        person is a parent or spouse"""
+        """
+        Returns the list of L{Family} handles in which the person is a
+        parent or spouse.
+
+        @return: Returns the list of handles corresponding to the
+        L{Family} records with which the person is associated.
+        @rtype: list
+        """
         return self.family_list
 
-    def set_family_handle_list(self,flist) :
-        """returns the list of Family instances in which the
-        person is a parent or spouse"""
-        self.family_list = flist
-
-    def clear_family_handle_list(self) :
+    def set_family_handle_list(self,family_list) :
         """
-        Removes all familyts from the family list.
+        Assigns the passed list to the Person's list of families in
+        which it is a parent or spouse.
+
+        @param family_list: List of L{Family} handles to ba associated
+            with the Person
+        @type family_list: list 
+        """
+        self.family_list = family_list
+
+    def clear_family_handle_list(self):
+        """
+        Removes all L{Family} handles from the L{Family} list.
         """
         self.family_list = []
 
-    def remove_family_handle(self,family):
-        """removes the specified Family instance from the list
-        of marriages/partnerships"""
-        if family in self.family_list:
-            self.family_list.remove(family)
+    def remove_family_handle(self,family_handle):
+        """
+        Removes the specified L{Family} handle from the list
+        of marriages/partnerships. If the handle does not
+        exist in the list, the operation has no effect.
+
+        @param family_handle: L{Family} handle to remove from the list
+        @type family_handle: str
+
+        @return: True if the handle was removed, False if it was not
+            in the list.
+        @rtype: bool
+        """
+        if family_handle in self.family_list:
+            self.family_list.remove(family_handle)
+            return True
+        else:
+            return False
 
     def add_address(self,address):
-        """adds the Address instance to the list of addresses"""
+        """
+        Adds the L{Address} instance to the Person's list of addresses
+
+        @param address: L{Address} instance to add to the Person's address
+            list
+        @type address: list
+        """
         self.address_list.append(address)
 
     def remove_address(self,address):
-        """removes the Address instance from the list of addresses"""
+        """
+        Removes the specified L{Address} instance from the address list
+        If the instance does not exist in the list, the operation has
+        no effect.
+
+        @param address: L{Address} instance to remove from the list
+        @type address: L{Address}
+
+        @return: True if the address was removed, False if it was not
+            in the list.
+        @rtype: bool
+        """
         if address in self.address_list:
             self.address_list.remove(address)
+            return True
+        else:
+            return False
 
     def get_address_list(self):
-        """returns the list of addresses"""
+        """
+        Returns the list of L{Address} instances associated with the
+        Person
+        @return: Returns the list of L{Address} instances
+        @rtype: list
+        """
         return self.address_list
 
-    def set_address_list(self,alist):
-        """sets the address list to the specified list"""
-        self.address_list = alist
+    def set_address_list(self,address_list):
+        """
+        Assigns the passed list to the Person's list of L{Address} instances.
+        @param address_list: List of L{Address} instances to ba associated
+            with the Person
+        @type address_list: list
+        """
+        self.address_list = address_list
 
     def add_attribute(self,attribute):
-        """adds an Attribute instance to the attribute list"""
+        """
+        Adds the L{Attribute} instance to the Person's list of attributes
+
+        @param attribute: L{Attribute} instance to add to the Person's address
+            list
+        @type attribute: list
+        """
         self.attribute_list.append(attribute)
 
     def remove_attribute(self,attribute):
-        """removes the specified Attribute instance from the attribute list"""
+        """
+        Removes the specified L{Attribute} instance from the attribute list
+        If the instance does not exist in the list, the operation has
+        no effect.
+
+        @param attribute: L{Attribute} instance to remove from the list
+        @type attribute: L{Attribute}
+
+        @return: True if the attribute was removed, False if it was not
+            in the list.
+        @rtype: bool
+        """
         if attribute in self.attribute_list:
             self.attribute_list.remove(attribute)
+            return True
+        else:
+            return False
 
     def get_attribute_list(self):
-        """returns the attribute list"""
+        """
+        Returns the list of L{Attribute} instances associated with the
+        Person
+        @return: Returns the list of L{Attribute} instances
+        @rtype: list
+        """
         return self.attribute_list
 
-    def set_attribute_list(self,list):
-        """sets the attribute list to the specified list"""
-        self.attribute_list = list
+    def set_attribute_list(self,attribute_list):
+        """
+        Assigns the passed list to the Person's list of L{Attribute} instances.
+
+        @param attribute_list: List of L{Attribute} instances to ba associated
+            with the Person
+        @type attribute_list: list
+        """
+        self.attribute_list = attribute_list
 
     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"""
+        """
+        Returns the list of L{Family} handles in which the person is a
+        child.
+
+        @return: Returns the list of handles corresponding to the
+        L{Family} records with which the person is a child.
+        @rtype: list
+        """
         return self.parent_family_list
 
-    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)"""
-        self.parent_family_list.append((family,mrel,frel))
+    def add_parent_family_handle(self,family_handle,mrel,frel):
+        """
+        Adds the L{Family} handle to the Person instance's list of
+        families in which it is a child. This is accomplished by
+        assigning the handle of a valid L{Family} in the current database.
+
+        Adding a L{Family} handle to a Person does not automatically update
+        the corresponding L{Family}. The developer is responsible to make
+        sure that when a L{Family} is added to Person, that the Person is
+        added to the L{Family} instance's child list.
+        
+        @param family_handle: handle of the L{Family} to be added to the
+            Person's L{Family} list.
+        @type family_handle: str
+        @param mrel: relationship between the Person and its mother
+        @type mrel: str
+        @param frel: relationship between the Person and its father
+        @type frel: str
+        """
+        self.parent_family_list.append((family_handle,mrel,frel))
 
     def clear_parent_family_handle_list(self):
+        """
+        Removes all L{Family} handles from the parent L{Family} list.
+        """
         self.parent_family_list = []
 
-    def remove_parent_family_handle(self,family):
-        """removes a Family instance from the alternate family list"""
+    def remove_parent_family_handle(self,family_handle):
+        """
+        Removes the specified L{Family} handle from the list of parent
+        families (families in which the parent is a child). If the
+        handle does not exist in the list, the operation has no effect.
+
+        @param family_handle: L{Family} handle to remove from the list
+        @type family_handle: str
+
+        @return: Returns a tuple of three strings, consisting of the
+            removed handle, relationship to mother, and relationship
+            to father. None is returned if the handle is not in the
+            list.
+        @rtype: tuple
+        """
         for f in self.parent_family_list[:]:
-            if f[0] == family:
+            if f[0] == family_handle:
                 self.parent_family_list.remove(f)
                 return f
         else:
             return None
 
-    def change_parent_family_handle(self,family,mrel,frel):
-        """removes a Family instance from the alternate family list"""
-        index = 0
+    def change_parent_family_handle(self,family_handle,mrel,frel):
+        """
+        Changes the relationships of the L{Family} handle in the Person
+        instance's list of families in which it is a child. The handle
+        is assumed to already be in the list.
+        
+        @param family_handle: handle of the L{Family} to be added to the
+            Person's L{Family} list.
+        @type family_handle: str
+        @param mrel: relationship between the Person and its mother
+        @type mrel: str
+        @param frel: relationship between the Person and its father
+        @type frel: str
+        """
+        index=0
         for f in self.parent_family_list[:]:
-            if f[0] == family:
-                self.parent_family_list[index] = (family,mrel,frel)
+            if f[0] == family_handle:
+                self.parent_family_list[index] = (family_handle,mrel,frel)
+                return True
             index += 1
+        return False
+    
+    def get_parent_family(self,family_handle):
+        """
+        Finds the L{Family} and relationships associated with passed
+        family_handle.
 
-    def has_family(self,family):
+        @param family_handle: L{Family} handle used to search the parent
+            family list.
+        @type family_handle: str
+        @return: Returns a tuple consisting of the L{Family} handle, the
+            mother relationship, and father relationship
+        @rtype: tuple
+        """
         for f in self.parent_family_list:
-            if f[0] == family:
+            if f[0] == family_handle:
                 return f
         else:
             return None
 
-    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"""
-        f = self.remove_parent_family_handle(family)
+    def set_main_parent_family_handle(self,family_handle):
+        """
+        Sets the main L{Family} in which the Person is a child. The
+        main L{Family} is the L{Family} typically used for reports and
+        navigation. This is accomplished by moving the L{Family} to
+        the beginning of the list. The family_handle must be in
+        the list for this to have any effect.
+
+        @param family_handle: handle of the L{Family} to be marked
+            as the main L{Family}
+        @type family_handle: str
+        @return: Returns True if the assignment has successful
+        @rtype: bool
+        """
+        f = self.remove_parent_family_handle(family_handle)
         if f:
             self.parent_family_list = [f] + self.parent_family_list
+            return True
+        else:
+            return False
         
     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"""
+        """
+        Returns the handle of the L{Family} considered to be the main
+        L{Family} in which the Person is a child.
+
+        @return: Returns the family_handle if a family_handle exists,
+            If no L{Family} is assigned, None is returned
+        @rtype: str
+        """
         if len(self.parent_family_list) == 0:
             return None
         else:
             return self.parent_family_list[0][0]
 
-    def set_lds_baptism(self,ord):
-        """Sets the LDS Baptism ordinance"""
-        self.lds_bapt = ord
+    def set_lds_baptism(self,lds_ord):
+        """
+        Sets the LDS Baptism ordinance. An ordinance can be removed
+        by assigning to None.
+
+        @param lds_ord: L{LdsOrd} to assign as the LDS Baptism ordinance.
+        @type lds_ord: L{LdsOrd}
+        """
+        self.lds_bapt = lds_ord
 
     def get_lds_baptism(self):
-        """Gets the LDS Baptism ordinance"""
+        """
+        Returns the LDS Baptism ordinance.
+
+        @returns: returns the L{LdsOrd} instance assigned as the LDS
+        Baptism ordinance, or None if no ordinance has been assigned.
+        @rtype: L{LdsOrd}
+        """
         return self.lds_bapt
 
-    def set_lds_endowment(self,ord):
-        """Sets the LDS Endowment ordinance"""
-        self.lds_endow = ord
+    def set_lds_endowment(self,lds_ord):
+        """
+        Sets the LDS Endowment ordinance. An ordinance can be removed
+        by assigning to None.
+
+        @param lds_ord: L{LdsOrd} to assign as the LDS Endowment ordinance.
+        @type lds_ord: L{LdsOrd}
+        """
+        self.lds_endow = lds_ord
 
     def get_lds_endowment(self):
-        """Gets the LDS Endowment ordinance"""
+        """
+        Returns the LDS Endowment ordinance.
+
+        @returns: returns the L{LdsOrd} instance assigned as the LDS
+        Endowment ordinance, or None if no ordinance has been assigned.
+        @rtype: L{LdsOrd}
+        """
         return self.lds_endow
 
-    def set_lds_sealing(self,ord):
-        """Sets the LDS Sealing ordinance"""
-        self.lds_seal = ord
+    def set_lds_sealing(self,lds_ord):
+        """
+        Sets the LDS Sealing ordinance. An ordinance can be removed
+        by assigning to None.
+
+        @param lds_ord: L{LdsOrd} to assign as the LDS Sealing ordinance.
+        @type lds_ord: L{LdsOrd}
+        """
+        self.lds_seal = lds_ord
 
     def get_lds_sealing(self):
-        """Gets the LDS Sealing ordinance"""
+        """
+        Returns the LDS Sealing ordinance.
+
+        @returns: returns the L{LdsOrd} instance assigned as the LDS
+        Sealing ordinance, or None if no ordinance has been assigned.
+        @rtype: L{LdsOrd}
+        """
         return self.lds_seal
 
 class Family(PrimaryObject,SourceNote):
@@ -566,6 +1049,12 @@ class Family(PrimaryObject,SourceNote):
     opposite sex or same sex.
     """
 
+    MARRIED     = 0
+    UNMARRIED   = 1
+    CIVIL_UNION = 2
+    UNKNOWN     = 3
+    OTHER       = 4
+    
     def __init__(self):
         """creates a new Family instance"""
         PrimaryObject.__init__(self)
@@ -573,7 +1062,7 @@ class Family(PrimaryObject,SourceNote):
         self.father_handle = None
         self.mother_handle = None
         self.child_list = []
-        self.type = const.FAMILY_MARRIED
+        self.type = Family.MARRIED
         self.event_list = []
         self.media_list = []
         self.attribute_list = []
@@ -684,11 +1173,11 @@ class Family(PrimaryObject,SourceNote):
         self.child_list = list[:]
 
     def add_event_handle(self,event_handle):
-        """adds an Event to the event list"""
+        """adds an L{Event} to the event list"""
         self.event_list.append(event_handle)
 
     def get_event_list(self) :
-        """returns the list of Event instances"""
+        """returns the list of L{Event} instances"""
         return self.event_list
 
     def set_event_list(self,list) :
@@ -709,16 +1198,21 @@ class Family(PrimaryObject,SourceNote):
 
 class Event(PrimaryObject,DataObj):
     """
-    GRAMPS Event record. A GRAMPS event is some type of action that occurred
-    at a particular place at a particular time, such as a birth, death, or
-    marriage.
+    The Event record is used to store information about some type of
+    action that occurred at a particular place at a particular time,
+    such as a birth, death, or marriage.
     """
 
     NAME = 0
     ID = 1
     
     def __init__(self,source=None):
-        """creates a new Event instance, copying from the source if present"""
+        """
+        creates a new Event instance, copying from the source if present
+
+        @param source: An event used to initialize the new event
+        @type source: Event
+        """
 
         PrimaryObject.__init__(self,source)
         DataObj.__init__(self,source)
diff --git a/gramps2/src/SelectChild.py b/gramps2/src/SelectChild.py
index ff0168195..eb696c2ca 100644
--- a/gramps2/src/SelectChild.py
+++ b/gramps2/src/SelectChild.py
@@ -424,7 +424,7 @@ class EditRel:
             "destroy_passed_object"    : self.close
             })
 
-        f = self.child.has_family(self.family.get_handle())
+        f = self.child.get_parent_family(self.family.get_handle())
         if f:
             self.fentry.set_text(_(f[2]))
             self.mentry.set_text(_(f[1]))
diff --git a/gramps2/src/const.py.in b/gramps2/src/const.py.in
index e530cf813..d81e45d54 100644
--- a/gramps2/src/const.py.in
+++ b/gramps2/src/const.py.in
@@ -444,12 +444,6 @@ def save_attr(st):
 #
 #-------------------------------------------------------------------------
 
-FAMILY_MARRIED     = 0
-FAMILY_UNMARRIED   = 1
-FAMILY_CIVIL_UNION = 2
-FAMILY_UNKNOWN     = 3
-FAMILY_OTHER       = 4
-
 
 family_relations = [
     (_("Married"),     _("A legal or common-law relationship between a husband and wife")),
diff --git a/gramps2/src/plugins/Check.py b/gramps2/src/plugins/Check.py
index d53b1145e..c68572495 100644
--- a/gramps2/src/plugins/Check.py
+++ b/gramps2/src/plugins/Check.py
@@ -272,9 +272,9 @@ class CheckIntegrity:
             else:
                 fgender = father.get_gender()
                 mgender = mother.get_gender()
-                if type != const.FAMILY_CIVIL_UNION:
+                if type != RelLib.Family._CIVIL_UNION:
                     if fgender == mgender and fgender != RelLib.Person.unknown:
-                        family.set_relationship(const.FAMILY_CIVIL_UNION)
+                        family.set_relationship(RelLib.Family._CIVIL_UNION)
                         self.fam_rel.append(family_handle)
                         self.db.commit_family(family,self.trans)
                     elif fgender == RelLib.Person.female or mgender == RelLib.Person.male:
@@ -283,7 +283,7 @@ class CheckIntegrity:
                         self.fam_rel.append(family_handle)
                         self.db.commit_family(family,self.trans)
                 elif fgender != mgender:
-                    family.set_relationship(const.FAMILY_UNKNOWN)
+                    family.set_relationship(RelLib.Family._UNKNOWN)
                     self.fam_rel.append(family_handle)
                     if fgender == RelLib.Person.female or mgender == RelLib.Person.male:
                         family.set_father_handle(mother_handle)
diff --git a/gramps2/src/plugins/ImportGeneWeb.py b/gramps2/src/plugins/ImportGeneWeb.py
index 4eb0a5013..24f98c6df 100644
--- a/gramps2/src/plugins/ImportGeneWeb.py
+++ b/gramps2/src/plugins/ImportGeneWeb.py
@@ -353,7 +353,7 @@ class GeneWebParser:
             self.current_family.add_event_handle(sep.get_handle())
 
         if not married:
-            self.current_family.set_relationship(const.FAMILY_UNMARRIED)
+            self.current_family.set_relationship(RelLib.Family.UNMARRIED)
             
         self.db.commit_family(self.current_family,self.trans)
         return idx
diff --git a/gramps2/src/plugins/WriteGeneWeb.py b/gramps2/src/plugins/WriteGeneWeb.py
index 7d14dd66d..2637f3ed1 100644
--- a/gramps2/src/plugins/WriteGeneWeb.py
+++ b/gramps2/src/plugins/WriteGeneWeb.py
@@ -482,7 +482,7 @@ class GeneWebWriter:
             if eng_source != "":
                 ret = ret + "#ms %s " % self.rem_spaces( m_source)
         else:
-            if family.get_relationship() != const.FAMILY_MARRIED:
+            if family.get_relationship() != RelLib.Family.MARRIED:
                 """Not married or engaged"""
                 ret = ret + " #nm "