Start of better LDS support

svn: r6261
This commit is contained in:
Don Allingham 2006-04-04 18:07:23 +00:00
parent ecb78626c6
commit d761bee9a6
15 changed files with 593 additions and 154 deletions

View File

@ -1,3 +1,17 @@
2006-04-04 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_GrampsBSDDB.py: new upgrade for LDS change
* src/Editors/_EditLdsOrd.py: addedn
* src/Editors/__init__.py: add EditLdsOrd
* src/Editors/_EditPerson.py: LDS support
* src/RelLib/_LdsOrdBase.py: added
* src/RelLib/_Person.py: use a list of LdsOrds
* src/RelLib/_Family.py: use a list of LdsOrds
* src/RelLib/_LdsOrd.py: add type field
* src/DisplayTabs.py: lds tab
* src/GrampsWidgets.py: menus
* src/glade/gramps.glade: lds support
* src/lds.py: additional support
2006-04-04 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2006-04-04 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/TestcaseGenerator.py: Fix lds ord; Add new option * src/plugins/TestcaseGenerator.py: Fix lds ord; Add new option
to put a linebreak into each textfield to put a linebreak into each textfield
@ -8,6 +22,7 @@
* src/plugins/DescendReport.py: fix death dates * src/plugins/DescendReport.py: fix death dates
2006-04-02 Don Allingham <don@gramps-project.org> 2006-04-02 Don Allingham <don@gramps-project.org>
* src/PluginUtils/Plugins.py: Fix args
* src/GrampsWidgets.py: Fix place autocompletion * src/GrampsWidgets.py: Fix place autocompletion
* src/glade/gramps.glade: start of LDS Ord editor * src/glade/gramps.glade: start of LDS Ord editor

View File

@ -1181,6 +1181,63 @@ class AddrEmbedList(EmbeddedList):
def edit_callback(self,name): def edit_callback(self,name):
self.rebuild() self.rebuild()
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
class LdsEmbedList(EmbeddedList):
_HANDLE_COL = 5
_DND_TYPE = DdTargets.ADDRESS
_column_names = [
(_('Type'), 0, 150),
(_('Date'), 1, 150),
(_('Temple'), 2, 225),
(_('Place'), 3, 100),
]
def __init__(self,dbstate,uistate,track,data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('LDS'), LdsModel)
def get_data(self):
return self.data
def column_order(self):
return ((1,0),(1,1),(1,2),(1,3))
def add_button_clicked(self,obj):
lds = RelLib.LdsOrd()
try:
from Editors import EditLdsOrd
EditLdsOrd(self.dbstate, self.uistate, self.track,
lds, self.add_callback)
except Errors.WindowActiveError:
pass
def add_callback(self,name):
self.get_data().append(name)
self.rebuild()
def edit_button_clicked(self,obj):
lds = self.get_selected()
if lds:
try:
from Editors import EditLdsOrd
EditLdsOrd(self.dbstate, self.uistate, self.track,
lds, self.edit_callback)
except Errors.WindowActiveError:
pass
def edit_callback(self,name):
self.rebuild()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #
@ -1857,6 +1914,38 @@ class AttrModel(gtk.ListStore):
def type_name(self, attr): def type_name(self, attr):
return Utils.format_attribute( attr.get_type()) return Utils.format_attribute( attr.get_type())
#-------------------------------------------------------------------------
#
# LdsModel
#
#-------------------------------------------------------------------------
class LdsModel(gtk.ListStore):
_HANDLE_COL = 5
def __init__(self,lds_list,db):
gtk.ListStore.__init__(self, str, str, str, str, str, object)
import lds
self.db = db
for lds_ord in lds_list:
self.append(row=[
lds.ord_type[lds_ord.get_type()],
DateHandler.get_date(lds_ord),
lds_ord.get_status(),
lds_ord.get_temple(),
self.column_place(lds_ord),
lds_ord,
])
def column_place(self, lds_ord):
if lds_ord:
place_handle = lds_ord.get_place_handle()
if place_handle:
return self.db.get_place_from_handle(place_handle).get_title()
return u""
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# NameModel # NameModel

View File

@ -12,6 +12,7 @@ pkgdata_PYTHON = \
_EditEvent.py \ _EditEvent.py \
_EditEventRef.py \ _EditEventRef.py \
_EditFamily.py \ _EditFamily.py \
_EditLdsOrd.py \
_EditLocation.py \ _EditLocation.py \
_EditMedia.py \ _EditMedia.py \
_EditMediaRef.py \ _EditMediaRef.py \

View File

@ -0,0 +1,143 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2005 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: _EditAttribute.py 6248 2006-03-31 23:46:34Z dallingham $
"""
The EditAttribute module provides the AttributeEditor class. This provides a
mechanism for the user to edit attribute information.
"""
__author__ = "Donald N. Allingham"
__version__ = "$Revision: 6248 $"
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
from TransUtils import sgettext as _
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk.glade
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import const
import Utils
import RelLib
import GrampsDisplay
import lds
from _EditSecondary import EditSecondary
from DisplayTabs import *
from GrampsWidgets import *
#-------------------------------------------------------------------------
#
# EditAttribute class
#
#-------------------------------------------------------------------------
class EditLdsOrd(EditSecondary):
"""
Displays a dialog that allows the user to edit an attribute.
"""
def __init__(self, state, uistate, track, attrib, callback):
"""
Displays the dialog box.
parent - The class that called the Address editor.
attrib - The attribute that is to be edited
title - The title of the dialog box
list - list of options for the pop down menu
"""
EditSecondary.__init__(self, state, uistate, track, attrib, callback)
def attribute_list(self):
return Utils.personal_attributes
def _local_init(self):
self.top = gtk.glade.XML(const.gladeFile, "lds_person_edit","gramps")
self.define_top_level(self.top.get_widget("lds_person_edit"),
self.top.get_widget('title'),
_('LDS Ordinance Editor'))
def _connect_signals(self):
self.define_cancel_button(self.top.get_widget('cancel'))
self.define_help_button(self.top.get_widget('help'),'adv-at')
self.define_ok_button(self.top.get_widget('ok'),self.save)
def _setup_fields(self):
self.priv = PrivacyButton(
self.top.get_widget("private"),
self.obj)
self.date_field = MonitoredDate(
self.top.get_widget("date"),
self.top.get_widget("date_stat"),
self.obj.get_date_object(),
self.window, self.db.readonly)
self.place_field = PlaceEntry(
self.top.get_widget("place"),
self.obj.get_place_handle(),
self.dbstate.get_place_completion(),
self.db.readonly)
temple_list = []
for val in lds.temple_codes.keys():
temple_list.append((lds.temple_codes[val],val))
def _create_tabbed_pages(self):
notebook = gtk.Notebook()
self.srcref_list = self._add_tab(
notebook,
SourceEmbedList(self.dbstate,self.uistate, self.track,
self.obj.source_list))
self.note_tab = self._add_tab(
notebook,
NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_object()))
notebook.show_all()
vbox = self.top.get_widget('vbox').pack_start(notebook,True)
def build_menu_names(self, attrib):
label = _("LDS Ordinance")
return (label, _('LDS Ordinance Editor'))
def save(self,*obj):
"""
Called when the OK button is pressed. Gets data from the
form and updates the Attribute data structure.
"""
if self.callback:
self.callback(self.obj)
self.close_window(obj)

View File

@ -250,6 +250,11 @@ class EditPerson(EditPrimary):
WebEmbedList(self.dbstate,self.uistate,self.track, WebEmbedList(self.dbstate,self.uistate,self.track,
self.obj.get_url_list())) self.obj.get_url_list()))
self.lds_list = self._add_tab(
notebook,
LdsEmbedList(self.dbstate,self.uistate,self.track,
self.obj.get_lds_ord_list()))
notebook.show_all() notebook.show_all()
self.top.get_widget('vbox').pack_start(notebook,True) self.top.get_widget('vbox').pack_start(notebook,True)

View File

@ -23,6 +23,7 @@ from _EditAttribute import *
from _EditEvent import * from _EditEvent import *
from _EditEventRef import * from _EditEventRef import *
from _EditFamily import * from _EditFamily import *
from _EditLdsOrd import *
from _EditLocation import * from _EditLocation import *
from _EditMedia import * from _EditMedia import *
from _EditMediaRef import * from _EditMediaRef import *

View File

@ -56,7 +56,7 @@ from _GrampsDbBase import *
import const import const
_MINVERSION = 5 _MINVERSION = 5
_DBVERSION = 9 _DBVERSION = 10
def find_surname(key,data): def find_surname(key,data):
return str(data[3][3]) return str(data[3][3])
@ -1180,6 +1180,8 @@ class GrampsBSDDB(GrampsDbBase):
self.gramps_upgrade_8() self.gramps_upgrade_8()
if version < 9: if version < 9:
self.gramps_upgrade_9() self.gramps_upgrade_9()
if version < 10:
self.gramps_upgrade_10()
# self.metadata.put('version',_DBVERSION) # self.metadata.put('version',_DBVERSION)
# self.metadata.sync() # self.metadata.sync()
print "Upgrade time:", int(time.time()-t), "seconds" print "Upgrade time:", int(time.time()-t), "seconds"
@ -1604,6 +1606,45 @@ class GrampsBSDDB(GrampsDbBase):
self.metadata.sync() self.metadata.sync()
print "Done upgrading to DB version 9" print "Done upgrading to DB version 9"
def gramps_upgrade_10(self):
print "Upgrading to DB version 10"
table_flags = self.open_flags()
self.reference_map_primary_map = db.DB(self.env)
self.reference_map_primary_map.set_flags(db.DB_DUP)
self.reference_map_primary_map.open(self.full_name,
"reference_map_primary_map",
db.DB_BTREE, flags=table_flags)
self.reference_map.associate(self.reference_map_primary_map,
find_primary_handle,
table_flags)
trans = self.transaction_begin("",True)
for handle in self.person_map.keys():
val = list(self.get_raw_person_data(handle))
lds_list = [ x for x in [val[15],val[16],val[17]] if x ]
data=tuple(val[:15]) + (lds_list,) + tuple(val[18:])
p = Person(data=data)
self.commit_person(p,trans)
for handle in self.family_map.keys():
val = list(self.get_raw_family_data(handle))
if val[9]:
data = tuple(val[:9]) + (val[9],) + tuple(val[10:])
else:
data = tuple(val[:9]) + ([],) + tuple(val[10:])
p = Family()
p.unserialize(data)
self.commit_family(p,trans)
self.transaction_commit(trans,"Upgrade to DB version 10")
self.reference_map_primary_map.close()
self.metadata.put('version',10)
self.metadata.sync()
class BdbTransaction(Transaction): class BdbTransaction(Transaction):
def __init__(self,msg,db,batch=False,no_magic=False): def __init__(self,msg,db,batch=False,no_magic=False):

View File

@ -363,6 +363,13 @@ class MonitoredMenu:
def on_change(self, obj): def on_change(self, obj):
self.set_val(self.model.get_value(obj.get_active_iter(),1)) self.set_val(self.model.get_value(obj.get_active_iter(),1))
def force(self,value):
self.obj.set_active(self.data.index(value))
def on_change(self, obj):
value = self.data[self.model.get_value(obj.get_active_iter(),1)]
self.set_val(value)
class MonitoredDate: class MonitoredDate:

View File

@ -19,6 +19,7 @@ pkgdata_PYTHON = \
_Family.py\ _Family.py\
_GenderStats.py\ _GenderStats.py\
__init__.py\ __init__.py\
_LdsOrdBase.py\
_LdsOrd.py\ _LdsOrd.py\
_LocationBase.py\ _LocationBase.py\
_Location.py\ _Location.py\

View File

@ -41,13 +41,14 @@ from _SourceNote import SourceNote
from _MediaBase import MediaBase from _MediaBase import MediaBase
from _AttributeBase import AttributeBase from _AttributeBase import AttributeBase
from _EventRef import EventRef from _EventRef import EventRef
from _LdsOrdBase import LdsOrdBase
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Family class # Family class
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase): class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase,LdsOrdBase):
""" """
Introduction Introduction
============ ============
@ -85,6 +86,7 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
SourceNote.__init__(self) SourceNote.__init__(self)
MediaBase.__init__(self) MediaBase.__init__(self)
AttributeBase.__init__(self) AttributeBase.__init__(self)
LdsOrdBase.__init__(self)
self.father_handle = None self.father_handle = None
self.mother_handle = None self.mother_handle = None
self.child_list = [] self.child_list = []
@ -118,7 +120,8 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
[er.serialize() for er in self.event_ref_list], [er.serialize() for er in self.event_ref_list],
MediaBase.serialize(self), MediaBase.serialize(self),
AttributeBase.serialize(self), AttributeBase.serialize(self),
lds_seal,SourceNote.serialize(self), LdsOrdBase.serialize(self),
SourceNote.serialize(self),
self.change, self.marker, self.private) self.change, self.marker, self.private)
def unserialize(self, data): def unserialize(self, data):
@ -128,7 +131,7 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
""" """
(self.handle, self.gramps_id, self.father_handle, self.mother_handle, (self.handle, self.gramps_id, self.father_handle, self.mother_handle,
self.child_list, self.type, self.child_list, self.type,
event_ref_list, media_list, attribute_list, lds_seal, sn, event_ref_list, media_list, attribute_list, lds_seal_list, sn,
self.change,self.marker, self.private) = data self.change,self.marker, self.private) = data
self.event_ref_list = [EventRef().unserialize(er) self.event_ref_list = [EventRef().unserialize(er)
@ -136,6 +139,7 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
MediaBase.unserialize(self,media_list) MediaBase.unserialize(self,media_list)
AttributeBase.unserialize(self,attribute_list) AttributeBase.unserialize(self,attribute_list)
SourceNote.unserialize(self,sn) SourceNote.unserialize(self,sn)
LdsOrdBase.unserialize(self,lds_seal_list)
def _has_handle_reference(self,classname,handle): def _has_handle_reference(self,classname,handle):
if classname == 'Event': if classname == 'Event':
@ -143,7 +147,7 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
elif classname == 'Person': elif classname == 'Person':
return handle in self.child_list + [self.father_handle,self.mother_handle] return handle in self.child_list + [self.father_handle,self.mother_handle]
elif classname == 'Place': elif classname == 'Place':
return bool(self.lds_seal) and self.lds_seal.place == handle return handle in [ x.place for x in self.lds_ord_list ]
return False return False
def _remove_handle_references(self,classname,handle_list): def _remove_handle_references(self,classname,handle_list):
@ -160,8 +164,9 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
if self.mother_handle in handle_list: if self.mother_handle in handle_list:
self.mother_handle = None self.mother_handle = None
elif classname == 'Place': elif classname == 'Place':
if self.lds_seal and self.lds_seal.place in handle_list: for x in self.lds_ord_list:
self.lds_seal.place = None if x.place in handle_list:
x.place = None
def _replace_handle_reference(self,classname,old_handle,new_handle): def _replace_handle_reference(self,classname,old_handle,new_handle):
if classname == 'Event': if classname == 'Event':
@ -179,8 +184,9 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
if self.mother_handle == old_handle: if self.mother_handle == old_handle:
self.mother_handle = new_handle self.mother_handle = new_handle
elif classname == 'Place': elif classname == 'Place':
if self.lds_seal and self.lds_seal.place == old_handle: for x in self.lds_ord_list:
self.lds_seal.place = new_handle if x.place == old_handle:
x.place = new_handle
def get_text_data_list(self): def get_text_data_list(self):
""" """
@ -198,7 +204,7 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
@return: Returns the list of child objects that may carry textual data. @return: Returns the list of child objects that may carry textual data.
@rtype: list @rtype: list
""" """
check_list = [self.lds_seal,self.note] check_list = self.lds_ord_list + [self.note]
add_list = [item for item in check_list if item] add_list = [item for item in check_list if item]
return self.media_list + self.attribute_list + \ return self.media_list + self.attribute_list + \
self.source_list + add_list self.source_list + add_list
@ -210,9 +216,7 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
@return: Returns the list of child secondary child objects that may refer sources. @return: Returns the list of child secondary child objects that may refer sources.
@rtype: list @rtype: list
""" """
check_list = self.media_list + self.attribute_list check_list = self.media_list + self.attribute_list + self.lds_ord_list
if self.lds_seal:
check_list.append(self.lds_seal)
return check_list return check_list
def get_referenced_handles(self): def get_referenced_handles(self):
@ -262,26 +266,6 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
""" """
return self.complete return self.complete
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):
"""
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
def set_relationship(self,relationship_type): def set_relationship(self,relationship_type):
""" """
Sets the relationship type between the people identified as the Sets the relationship type between the people identified as the

View File

@ -32,13 +32,14 @@ LDS Ordinance class for GRAMPS
from _SourceNote import SourceNote from _SourceNote import SourceNote
from _DateBase import DateBase from _DateBase import DateBase
from _PlaceBase import PlaceBase from _PlaceBase import PlaceBase
from _PrivacyBase import PrivacyBase
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# LDS Ordinance class # LDS Ordinance class
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class LdsOrd(SourceNote,DateBase,PlaceBase): class LdsOrd(SourceNote,DateBase,PlaceBase,PrivacyBase):
""" """
Class that contains information about LDS Ordinances. LDS Class that contains information about LDS Ordinances. LDS
ordinances are similar to events, but have very specific additional ordinances are similar to events, but have very specific additional
@ -46,17 +47,26 @@ class LdsOrd(SourceNote,DateBase,PlaceBase):
of Latter Day Saints (Morman church). The LDS church is the largest of Latter Day Saints (Morman church). The LDS church is the largest
source of genealogical information in the United States. source of genealogical information in the United States.
""" """
BAPTISM = 0
ENDOWMENT = 1
SEAL_TO_PARENTS = 2
SEAL_TO_SPOUSE = 3
def __init__(self,source=None): def __init__(self,source=None):
"""Creates a LDS Ordinance instance""" """Creates a LDS Ordinance instance"""
SourceNote.__init__(self,source) SourceNote.__init__(self,source)
DateBase.__init__(self,source) DateBase.__init__(self,source)
PlaceBase.__init__(self,source) PlaceBase.__init__(self,source)
PrivacyBase.__init__(self,source)
if source: if source:
self.type = source.type
self.famc = source.famc self.famc = source.famc
self.temple = source.temple self.temple = source.temple
self.status = source.status self.status = source.status
else: else:
self.type = self.BAPTISM
self.famc = None self.famc = None
self.temple = "" self.temple = ""
self.status = 0 self.status = 0
@ -117,6 +127,12 @@ class LdsOrd(SourceNote,DateBase,PlaceBase):
""" """
return self.source_list return self.source_list
def get_type(self):
return self.type
def set_type(self, ord_type):
self.type = ord_type
def set_family_handle(self,family): def set_family_handle(self,family):
"""Sets the Family database handle associated with the LDS ordinance""" """Sets the Family database handle associated with the LDS ordinance"""
self.famc = family self.famc = family

View File

@ -0,0 +1,108 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: _LdsOrdBase.py 5875 2006-02-03 22:03:53Z rshura $
"""
LdsOrdBase class for GRAMPS
"""
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from _LdsOrd import LdsOrd
#-------------------------------------------------------------------------
#
# LdsOrdBase classes
#
#-------------------------------------------------------------------------
class LdsOrdBase:
"""
Base class for lds_ord-aware objects.
"""
def __init__(self,source=None):
"""
Initialize a LdsOrdBase. If the 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: LdsOrdBase
"""
if source:
self.lds_ord_list = [ LdsOrd(lds_ord) \
for lds_ord in source.lds_ord_list ]
else:
self.lds_ord_list = []
def serialize(self):
return [addr.serialize() for addr in self.lds_ord_list]
def unserialize(self,data):
self.lds_ord_list = [LdsOrd().unserialize(item) for item in data]
def add_lds_ord(self,lds_ord):
"""
Adds the L{LdsOrd} instance to the object's list of lds_ordes
@param lds_ord: L{LdsOrd} instance to add to the object's lds_ord list
@type lds_ord: list
"""
self.lds_ord_list.append(lds_ord)
def remove_lds_ord(self,lds_ord):
"""
Removes the specified L{LdsOrd} instance from the lds_ord list
If the instance does not exist in the list, the operation has
no effect.
@param lds_ord: L{LdsOrd} instance to remove from the list
@type lds_ord: L{LdsOrd}
@return: True if the lds_ord was removed, False if it was not in the list.
@rtype: bool
"""
if lds_ord in self.lds_ord_list:
self.lds_ord_list.remove(lds_ord)
return True
else:
return False
def get_lds_ord_list(self):
"""
Returns the list of L{LdsOrd} instances associated with the object
@return: Returns the list of L{LdsOrd} instances
@rtype: list
"""
return self.lds_ord_list
def set_lds_ord_list(self,lds_ord_list):
"""
Assigns the passed list to the object's list of L{LdsOrd} instances.
@param lds_ord_list: List of L{LdsOrd} instances to be associated
with the object
@type lds_ord_list: list
"""
self.lds_ord_list = lds_ord_list

View File

@ -41,6 +41,7 @@ from _SourceNote import SourceNote
from _MediaBase import MediaBase from _MediaBase import MediaBase
from _AttributeBase import AttributeBase from _AttributeBase import AttributeBase
from _AddressBase import AddressBase from _AddressBase import AddressBase
from _LdsOrdBase import LdsOrdBase
from _UrlBase import UrlBase from _UrlBase import UrlBase
from _Name import Name from _Name import Name
from _EventRef import EventRef from _EventRef import EventRef
@ -52,7 +53,7 @@ from _LdsOrd import LdsOrd
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Person(PrimaryObject,SourceNote, class Person(PrimaryObject,SourceNote,
MediaBase,AttributeBase,AddressBase,UrlBase): MediaBase,AttributeBase,AddressBase,UrlBase,LdsOrdBase):
""" """
Introduction Introduction
============ ============
@ -101,6 +102,7 @@ class Person(PrimaryObject,SourceNote,
AttributeBase.__init__(self) AttributeBase.__init__(self)
AddressBase.__init__(self) AddressBase.__init__(self)
UrlBase.__init__(self) UrlBase.__init__(self)
LdsOrdBase.__init__(self)
self.primary_name = Name() self.primary_name = Name()
self.event_ref_list = [] self.event_ref_list = []
self.family_list = [] self.family_list = []
@ -110,9 +112,6 @@ class Person(PrimaryObject,SourceNote,
self.gender = Person.UNKNOWN self.gender = Person.UNKNOWN
self.death_ref = None self.death_ref = None
self.birth_ref = None self.birth_ref = None
self.lds_bapt = None
self.lds_endow = None
self.lds_seal = None
if data: if data:
self.unserialize(data) self.unserialize(data)
@ -145,32 +144,26 @@ class Person(PrimaryObject,SourceNote,
death_ref = None death_ref = None
else: else:
death_ref = self.death_ref.serialize() death_ref = self.death_ref.serialize()
if self.lds_bapt == None:
lds_bapt = None
else:
lds_bapt = self.lds_bapt.serialize()
if self.lds_endow == None:
lds_endow = None
else:
lds_endow = self.lds_endow.serialize()
if self.lds_seal == None:
lds_seal = None
else:
lds_seal = self.lds_seal.serialize()
return (self.handle, self.gramps_id, self.gender, return (self.handle,
self.gramps_id,
self.gender,
self.primary_name.serialize(), self.primary_name.serialize(),
[name.serialize() for name in self.alternate_names], [name.serialize() for name in self.alternate_names],
unicode(self.nickname), death_ref, birth_ref, unicode(self.nickname),
death_ref,
birth_ref,
[er.serialize() for er in self.event_ref_list], [er.serialize() for er in self.event_ref_list],
self.family_list,self.parent_family_list, self.family_list,
self.parent_family_list,
MediaBase.serialize(self), MediaBase.serialize(self),
AddressBase.serialize(self), AddressBase.serialize(self),
AttributeBase.serialize(self), AttributeBase.serialize(self),
UrlBase.serialize(self), UrlBase.serialize(self),
lds_bapt, lds_endow, lds_seal, LdsOrdBase.serialize(self),
SourceNote.serialize(self), SourceNote.serialize(self),
self.change, self.marker, self.change,
self.marker,
self.private) self.private)
def unserialize(self,data): def unserialize(self,data):
@ -182,30 +175,38 @@ class Person(PrimaryObject,SourceNote,
Person object Person object
@type data: tuple @type data: tuple
""" """
(self.handle, self.gramps_id, self.gender, primary_name, (self.handle,
alternate_names, self.nickname, death_ref, self.gramps_id,
birth_ref, event_ref_list, self.family_list, self.gender,
self.parent_family_list, media_list, address_list, primary_name,
attribute_list, urls, lds_bapt, lds_endow, alternate_names,
lds_seal, sn, self.change, self.nickname,
self.marker, self.private) = (data + (False,))[0:22] death_ref,
birth_ref,
event_ref_list,
self.family_list,
self.parent_family_list,
media_list,
address_list,
attribute_list,
urls,
lds_ord_list,
sn,
self.change,
self.marker,
self.private) = data
self.primary_name.unserialize(primary_name) self.primary_name.unserialize(primary_name)
if death_ref: if death_ref:
self.death_ref = EventRef().unserialize(death_ref) self.death_ref = EventRef().unserialize(death_ref)
if birth_ref: if birth_ref:
self.birth_ref = EventRef().unserialize(birth_ref) self.birth_ref = EventRef().unserialize(birth_ref)
if lds_bapt:
self.lds_bapt = LdsOrd().unserialize(lds_bapt)
if lds_endow:
self.lds_endow = LdsOrd().unserialize(lds_endow)
if lds_seal:
self.lds_seal = LdsOrd().unserialize(lds_seal)
self.alternate_names = [Name().unserialize(name) self.alternate_names = [Name().unserialize(name)
for name in alternate_names] for name in alternate_names]
self.event_ref_list = [EventRef().unserialize(er) self.event_ref_list = [EventRef().unserialize(er)
for er in event_ref_list] for er in event_ref_list]
MediaBase.unserialize(self,media_list) MediaBase.unserialize(self,media_list)
LdsOrdBase.unserialize(self,lds_ord_list)
AddressBase.unserialize(self,address_list) AddressBase.unserialize(self,address_list)
AttributeBase.unserialize(self,attribute_list) AttributeBase.unserialize(self,attribute_list)
UrlBase.unserialize(self,urls) UrlBase.unserialize(self,urls)
@ -221,9 +222,7 @@ class Person(PrimaryObject,SourceNote,
return handle in self.family_list + \ return handle in self.family_list + \
[item[0] for item in self.parent_family_list ] [item[0] for item in self.parent_family_list ]
elif classname == 'Place': elif classname == 'Place':
return handle in [ordinance.place return handle in self.lds_ord_list
for ordinance in [self.lds_bapt,self.lds_endow,self.lds_seal]
if ordinance]
return False return False
def _remove_handle_references(self,classname,handle_list): def _remove_handle_references(self,classname,handle_list):
@ -243,7 +242,7 @@ class Person(PrimaryObject,SourceNote,
if item[0] not in handle_list ] if item[0] not in handle_list ]
self.parent_family_list = new_list self.parent_family_list = new_list
elif classname == 'Place': elif classname == 'Place':
for ordinance in [self.lds_bapt,self.lds_endow,self.lds_seal]: for ordinance in self.lds_ord_list:
if ordinance.place in handle_list: if ordinance.place in handle_list:
ordinance.place = None ordinance.place = None
@ -271,7 +270,7 @@ class Person(PrimaryObject,SourceNote,
new_list.append(item) new_list.append(item)
self.parent_family_list = new_list self.parent_family_list = new_list
elif classname == 'Place': elif classname == 'Place':
for ordinance in [self.lds_bapt,self.lds_endow,self.lds_seal]: for ordinance in self.lds_ord_list:
if ordinance.place == old_handle: if ordinance.place == old_handle:
ordinance.place = new_handle ordinance.place = new_handle
@ -291,7 +290,7 @@ class Person(PrimaryObject,SourceNote,
@return: Returns the list of child objects that may carry textual data. @return: Returns the list of child objects that may carry textual data.
@rtype: list @rtype: list
""" """
check_list = [self.lds_bapt,self.lds_endow,self.lds_seal,self.note] check_list = self.lds_ord_list + [self.note]
add_list = [item for item in check_list if item] add_list = [item for item in check_list if item]
return [self.primary_name] + self.media_list + \ return [self.primary_name] + self.media_list + \
self.alternate_names + self.address_list + \ self.alternate_names + self.address_list + \
@ -305,11 +304,9 @@ class Person(PrimaryObject,SourceNote,
@return: Returns the list of child secondary child objects that may refer sources. @return: Returns the list of child secondary child objects that may refer sources.
@rtype: list @rtype: list
""" """
lds_list = [self.lds_bapt,self.lds_endow,self.lds_seal]
lds_check_list = [item for item in lds_list if item]
return [self.primary_name] + self.media_list + \ return [self.primary_name] + self.media_list + \
self.alternate_names + self.address_list + \ self.alternate_names + self.address_list + \
self.attribute_list + lds_check_list self.attribute_list + self.lds_ord_list
def get_referenced_handles(self): def get_referenced_handles(self):
""" """
@ -825,63 +822,3 @@ class Person(PrimaryObject,SourceNote,
return None return None
else: else:
return self.parent_family_list[0][0] return self.parent_family_list[0][0]
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):
"""
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,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):
"""
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,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):
"""
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

View File

@ -15283,7 +15283,7 @@ You should select parents before adding any new information. If you select paren
</child> </child>
</widget> </widget>
<widget class="GtkDialog" id="dialog1"> <widget class="GtkDialog" id="lds_person_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="title" translatable="yes"></property> <property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="type">GTK_WINDOW_TOPLEVEL</property>
@ -15315,7 +15315,7 @@ You should select parents before adding any new information. If you select paren
<property name="layout_style">GTK_BUTTONBOX_END</property> <property name="layout_style">GTK_BUTTONBOX_END</property>
<child> <child>
<widget class="GtkButton" id="button180"> <widget class="GtkButton" id="cancel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
@ -15329,7 +15329,7 @@ You should select parents before adding any new information. If you select paren
</child> </child>
<child> <child>
<widget class="GtkButton" id="button181"> <widget class="GtkButton" id="ok">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">Accept changes and close window</property> <property name="tooltip" translatable="yes">Accept changes and close window</property>
<property name="can_default">True</property> <property name="can_default">True</property>
@ -15345,7 +15345,7 @@ You should select parents before adding any new information. If you select paren
</child> </child>
<child> <child>
<widget class="GtkButton" id="button182"> <widget class="GtkButton" id="help">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
@ -15367,13 +15367,13 @@ You should select parents before adding any new information. If you select paren
</child> </child>
<child> <child>
<widget class="GtkVBox" id="vbox124"> <widget class="GtkVBox" id="vbox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="homogeneous">False</property> <property name="homogeneous">False</property>
<property name="spacing">0</property> <property name="spacing">0</property>
<child> <child>
<widget class="GtkLabel" id="label637"> <widget class="GtkLabel" id="title">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes"></property> <property name="label" translatable="yes"></property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
@ -15401,7 +15401,7 @@ You should select parents before adding any new information. If you select paren
<widget class="GtkTable" id="table72"> <widget class="GtkTable" id="table72">
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="n_rows">4</property> <property name="n_rows">5</property>
<property name="n_columns">3</property> <property name="n_columns">3</property>
<property name="homogeneous">False</property> <property name="homogeneous">False</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -15420,6 +15420,7 @@ You should select parents before adding any new information. If you select paren
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xpad">0</property> <property name="xpad">0</property>
<property name="ypad">0</property> <property name="ypad">0</property>
<property name="mnemonic_widget">date</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property> <property name="width_chars">-1</property>
<property name="single_line_mode">False</property> <property name="single_line_mode">False</property>
@ -15448,6 +15449,7 @@ You should select parents before adding any new information. If you select paren
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xpad">0</property> <property name="xpad">0</property>
<property name="ypad">0</property> <property name="ypad">0</property>
<property name="mnemonic_widget">place</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property> <property name="width_chars">-1</property>
<property name="single_line_mode">False</property> <property name="single_line_mode">False</property>
@ -15464,7 +15466,7 @@ You should select parents before adding any new information. If you select paren
</child> </child>
<child> <child>
<widget class="GtkEntry" id="entry4"> <widget class="GtkEntry" id="date">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_focus">True</property> <property name="has_focus">True</property>
@ -15486,7 +15488,7 @@ You should select parents before adding any new information. If you select paren
</child> </child>
<child> <child>
<widget class="GtkEntry" id="entry7"> <widget class="GtkEntry" id="place">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="editable">True</property> <property name="editable">True</property>
@ -15507,7 +15509,7 @@ You should select parents before adding any new information. If you select paren
</child> </child>
<child> <child>
<widget class="GtkToggleButton" id="togglebutton1"> <widget class="GtkToggleButton" id="private">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property> <property name="relief">GTK_RELIEF_NONE</property>
@ -15538,7 +15540,7 @@ You should select parents before adding any new information. If you select paren
</child> </child>
<child> <child>
<widget class="GtkButton" id="button183"> <widget class="GtkButton" id="date_stat">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property> <property name="relief">GTK_RELIEF_NONE</property>
@ -15621,7 +15623,7 @@ You should select parents before adding any new information. If you select paren
</child> </child>
<child> <child>
<widget class="GtkComboBox" id="combobox1"> <widget class="GtkComboBox" id="type">
<property name="visible">True</property> <property name="visible">True</property>
<property name="add_tearoffs">False</property> <property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property> <property name="focus_on_click">True</property>
@ -15637,7 +15639,7 @@ You should select parents before adding any new information. If you select paren
</child> </child>
<child> <child>
<widget class="GtkComboBox" id="combobox2"> <widget class="GtkComboBox" id="temple">
<property name="visible">True</property> <property name="visible">True</property>
<property name="add_tearoffs">False</property> <property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property> <property name="focus_on_click">True</property>
@ -15651,6 +15653,88 @@ You should select parents before adding any new information. If you select paren
<property name="y_options">fill</property> <property name="y_options">fill</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkLabel" id="parents_label">
<property name="label" translatable="yes">Parents:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="parents">
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="parent_select">
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkImage" id="image2693">
<property name="visible">True</property>
<property name="stock">gtk-index</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">0</property>

View File

@ -42,7 +42,7 @@ from TransUtils import sgettext as _
#Last update: 1/12/02 #Last update: 1/12/02
# #
lds_temple_codes = { temple_codes = {
"Aba, Nigeria" : "ABA", #1 Added "Aba, Nigeria" : "ABA", #1 Added
"Accra, Ghana" : "ACCRA", #2 Added "Accra, Ghana" : "ACCRA", #2 Added
"Adelaide, Australia" : "ADELA", #3 Added "Adelaide, Australia" : "ADELA", #3 Added
@ -180,9 +180,16 @@ lds_temple_codes = {
} }
lds_temple_to_abrev = {} temple_to_abrev = {}
for (name,abbr) in lds_temple_codes.iteritems(): for (name,abbr) in temple_codes.iteritems():
lds_temple_to_abrev[abbr] = name temple_to_abrev[abbr] = name
ord_type = {
0 : _('Baptism'),
1 : _('Endowment'),
2 : _('Sealed to Parents'),
3 : _('Sealed to Spouse'),
}
status = { status = {
"BIC" : 1, "CANCELED" : 1, "CHILD" : 1, "BIC" : 1, "CANCELED" : 1, "CHILD" : 1,