2006-04-19 Alex Roitman <shura@gramps-project.org>
* src/Utils.py: Remove obsolete code. * src/DisplayTabs.py (EventRefModel.column_role): Adapt to new types. * src/PeopleModel.py: Adapt to new types. * src/plugins/TestcaseGenerator.py: Adapt to new types. * src/RelLib/Makefile.am: Ship new files. * src/RelLib/_EventRef.py: Adapt to new types. * src/RelLib/_PrimaryObject.py: Adapt to new types. * src/RelLib/_EventRoleType.py: Add new module. * src/RelLib/_RepoRef.py: Adapt to new types. * src/RelLib/_MarkerType.py: Add new module. * src/RelLib/_Family.py: Adapt to new types. * src/RelLib/_Person.py: Adapt to new types. * src/RelLib/_SourceMediaType.py: Add new module. * src/RelLib/__init__.py: Expose new modules. * src/Editors/_EditPerson.py: Use new type. * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Adapt to new types. * src/GrampsDb/_ConstXML.py: Comment out obsolete code. * src/GrampsDb/_ReadXML.py: Adapt to new types. * src/GrampsDb/_GrampsDbBase.py (commit_person): Properly use marker. * src/GrampsDb/_ReadGedcom.py: Adapt to new types. * src/DataViews/_FamilyView.py (write_relationship): Use new type. * src/DataViews/_PedigreeView.py (format_relation): Use new type. svn: r6372
This commit is contained in:
parent
41a9e9205c
commit
cd5518015b
24
ChangeLog
24
ChangeLog
@ -1,3 +1,27 @@
|
||||
2006-04-19 Alex Roitman <shura@gramps-project.org>
|
||||
* src/Utils.py: Remove obsolete code.
|
||||
* src/DisplayTabs.py (EventRefModel.column_role): Adapt to new types.
|
||||
* src/PeopleModel.py: Adapt to new types.
|
||||
* src/plugins/TestcaseGenerator.py: Adapt to new types.
|
||||
* src/RelLib/Makefile.am: Ship new files.
|
||||
* src/RelLib/_EventRef.py: Adapt to new types.
|
||||
* src/RelLib/_PrimaryObject.py: Adapt to new types.
|
||||
* src/RelLib/_EventRoleType.py: Add new module.
|
||||
* src/RelLib/_RepoRef.py: Adapt to new types.
|
||||
* src/RelLib/_MarkerType.py: Add new module.
|
||||
* src/RelLib/_Family.py: Adapt to new types.
|
||||
* src/RelLib/_Person.py: Adapt to new types.
|
||||
* src/RelLib/_SourceMediaType.py: Add new module.
|
||||
* src/RelLib/__init__.py: Expose new modules.
|
||||
* src/Editors/_EditPerson.py: Use new type.
|
||||
* src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Adapt to new types.
|
||||
* src/GrampsDb/_ConstXML.py: Comment out obsolete code.
|
||||
* src/GrampsDb/_ReadXML.py: Adapt to new types.
|
||||
* src/GrampsDb/_GrampsDbBase.py (commit_person): Properly use marker.
|
||||
* src/GrampsDb/_ReadGedcom.py: Adapt to new types.
|
||||
* src/DataViews/_FamilyView.py (write_relationship): Use new type.
|
||||
* src/DataViews/_PedigreeView.py (format_relation): Use new type.
|
||||
|
||||
2006-04-19 Don Allingham <don@gramps-project.org>
|
||||
* src/DataViews/_FamilyView.py: GrampsType support
|
||||
* src/DataViews/_PedigreeView.py: GrampsType support
|
||||
|
@ -284,6 +284,10 @@ src/RelLib/_FamilyRelType.py
|
||||
src/RelLib/_UrlType.py
|
||||
src/RelLib/_NameType.py
|
||||
src/RelLib/_ChildRefType.py
|
||||
src/RelLib/_SourceMediaType.py
|
||||
src/RelLib/_MarkerType.py
|
||||
src/RelLib/_EventRoleType.py
|
||||
src/RelLib/_EventType.py
|
||||
#
|
||||
# Glade files
|
||||
#
|
||||
|
@ -583,15 +583,8 @@ class FamilyView(PageView.PersonNavView):
|
||||
self.dbstate.change_active_handle(handle)
|
||||
|
||||
def write_relationship(self, family):
|
||||
rtype = family.get_relationship()
|
||||
if type(rtype) == tuple:
|
||||
if rtype[0] == RelLib.Family.CUSTOM:
|
||||
rel_text = rtype[1]
|
||||
else:
|
||||
rel_text = Utils.family_relations[rtype[0]]
|
||||
else:
|
||||
rel_text = Utils.family_relations[rtype]
|
||||
self.write_data(_('Relationship type: %s') % rel_text)
|
||||
self.write_data(_('Relationship type: %s') %
|
||||
str(family.get_relationship()))
|
||||
|
||||
def place_name(self, handle):
|
||||
p = self.dbstate.db.get_place_from_handle(handle)
|
||||
|
@ -358,10 +358,11 @@ class FormattingHelper:
|
||||
text = ""
|
||||
for event_ref in family.get_event_ref_list():
|
||||
event = self.db.get_event_from_handle(event_ref.ref)
|
||||
if event and int(event.get_type) == RelLib.EventType.MARRIAGE:
|
||||
if event and int(event.get_type()) == RelLib.EventType.MARRIAGE:
|
||||
if line_count < 3:
|
||||
return DateHandler.get_date(event)
|
||||
(i,s) = event.get_type()
|
||||
i = int(event.get_type())
|
||||
s = str(even.get_type())
|
||||
name = Utils.family_events.get(i)
|
||||
text += name
|
||||
text += "\n"
|
||||
@ -372,7 +373,7 @@ class FormattingHelper:
|
||||
return text;
|
||||
break
|
||||
if not text:
|
||||
text = Utils.format_family_relation(family.get_relationship())
|
||||
text = str(family.get_relationship())
|
||||
return text
|
||||
|
||||
def get_place_name( self, place_handle):
|
||||
|
@ -672,7 +672,7 @@ class EventEmbedList(EmbeddedList):
|
||||
return RelLib.EventType(RelLib.EventType.MARRIAGE)
|
||||
|
||||
def default_role(self):
|
||||
return (RelLib.EventRef.FAMILY, '')
|
||||
return (RelLib.EventRoleType.FAMILY, '')
|
||||
|
||||
def add_button_clicked(self, obj):
|
||||
try:
|
||||
@ -735,7 +735,7 @@ class PersonEventEmbedList(EventEmbedList):
|
||||
return self.orig_data
|
||||
|
||||
def default_role(self):
|
||||
return (RelLib.EventRef.PRIMARY, '')
|
||||
return (RelLib.EventRoleType.PRIMARY, '')
|
||||
|
||||
def default_type(self):
|
||||
type_list = []
|
||||
@ -1976,7 +1976,7 @@ class EventRefModel(gtk.ListStore):
|
||||
])
|
||||
|
||||
def column_role(self, event_ref):
|
||||
return Utils.format_event_role(event_ref.get_role())
|
||||
return str(event_ref.get_role())
|
||||
|
||||
def column_date(self, event_ref):
|
||||
event = self.db.get_event_from_handle(event_ref.ref)
|
||||
|
@ -180,7 +180,7 @@ class EditPerson(EditPrimary):
|
||||
self.obj.set_marker,
|
||||
self.obj.get_marker,
|
||||
dict(Utils.marker_types),
|
||||
RelLib.PrimaryObject.MARKER_CUSTOM,
|
||||
RelLib.MarkerType.CUSTOM,
|
||||
self.db.readonly)
|
||||
|
||||
if self.use_patronymic:
|
||||
|
@ -108,34 +108,34 @@ attributes = (
|
||||
# (RelLib.NameType.MARRIED , "Married Name"),
|
||||
# )
|
||||
|
||||
source_media_types = (
|
||||
(RelLib.RepoRef.UNKNOWN , "Unknown"),
|
||||
(RelLib.RepoRef.AUDIO , "Audio"),
|
||||
(RelLib.RepoRef.BOOK , "Book"),
|
||||
(RelLib.RepoRef.CARD , "Card"),
|
||||
(RelLib.RepoRef.ELECTRONIC , "Electronic"),
|
||||
(RelLib.RepoRef.FICHE , "Fiche"),
|
||||
(RelLib.RepoRef.FILM , "Film"),
|
||||
(RelLib.RepoRef.MAGAZINE , "Magazine"),
|
||||
(RelLib.RepoRef.MANUSCRIPT , "Manuscript"),
|
||||
(RelLib.RepoRef.MAP , "Map"),
|
||||
(RelLib.RepoRef.NEWSPAPER , "Newspaper"),
|
||||
(RelLib.RepoRef.PHOTO , "Photo"),
|
||||
(RelLib.RepoRef.TOMBSTONE , "Tombstone"),
|
||||
(RelLib.RepoRef.VIDEO , "Video"),
|
||||
)
|
||||
## source_media_types = (
|
||||
## (RelLib.RepoRef.UNKNOWN , "Unknown"),
|
||||
## (RelLib.RepoRef.AUDIO , "Audio"),
|
||||
## (RelLib.RepoRef.BOOK , "Book"),
|
||||
## (RelLib.RepoRef.CARD , "Card"),
|
||||
## (RelLib.RepoRef.ELECTRONIC , "Electronic"),
|
||||
## (RelLib.RepoRef.FICHE , "Fiche"),
|
||||
## (RelLib.RepoRef.FILM , "Film"),
|
||||
## (RelLib.RepoRef.MAGAZINE , "Magazine"),
|
||||
## (RelLib.RepoRef.MANUSCRIPT , "Manuscript"),
|
||||
## (RelLib.RepoRef.MAP , "Map"),
|
||||
## (RelLib.RepoRef.NEWSPAPER , "Newspaper"),
|
||||
## (RelLib.RepoRef.PHOTO , "Photo"),
|
||||
## (RelLib.RepoRef.TOMBSTONE , "Tombstone"),
|
||||
## (RelLib.RepoRef.VIDEO , "Video"),
|
||||
## )
|
||||
|
||||
event_roles = (
|
||||
(RelLib.EventRef.UNKNOWN , "Unknown"),
|
||||
(RelLib.EventRef.PRIMARY , "Primary"),
|
||||
(RelLib.EventRef.CLERGY , "Clergy"),
|
||||
(RelLib.EventRef.CELEBRANT , "Celebrant"),
|
||||
(RelLib.EventRef.AIDE , "Aide"),
|
||||
(RelLib.EventRef.BRIDE , "Bride"),
|
||||
(RelLib.EventRef.GROOM , "Groom"),
|
||||
(RelLib.EventRef.WITNESS , "Witness"),
|
||||
(RelLib.EventRef.FAMILY , "Family"),
|
||||
)
|
||||
## event_roles = (
|
||||
## (RelLib.EventRef.UNKNOWN , "Unknown"),
|
||||
## (RelLib.EventRef.PRIMARY , "Primary"),
|
||||
## (RelLib.EventRef.CLERGY , "Clergy"),
|
||||
## (RelLib.EventRef.CELEBRANT , "Celebrant"),
|
||||
## (RelLib.EventRef.AIDE , "Aide"),
|
||||
## (RelLib.EventRef.BRIDE , "Bride"),
|
||||
## (RelLib.EventRef.GROOM , "Groom"),
|
||||
## (RelLib.EventRef.WITNESS , "Witness"),
|
||||
## (RelLib.EventRef.FAMILY , "Family"),
|
||||
## )
|
||||
|
||||
# repository_types = (
|
||||
# (RelLib.Repository.UNKNOWN , "Unknown"),
|
||||
@ -150,11 +150,11 @@ event_roles = (
|
||||
# (RelLib.Repository.SAFE , "Safe"),
|
||||
# )
|
||||
|
||||
marker_types = (
|
||||
(RelLib.PrimaryObject.MARKER_NONE , ""),
|
||||
(RelLib.PrimaryObject.MARKER_COMPLETE , "complete"),
|
||||
(RelLib.PrimaryObject.MARKER_TODO , "todo"),
|
||||
)
|
||||
## marker_types = (
|
||||
## (RelLib.PrimaryObject.MARKER_NONE , ""),
|
||||
## (RelLib.PrimaryObject.MARKER_COMPLETE , "complete"),
|
||||
## (RelLib.PrimaryObject.MARKER_TODO , "todo"),
|
||||
## )
|
||||
|
||||
# url_types = (
|
||||
# (RelLib.Url.UNKNOWN , "Unknown"),
|
||||
@ -170,10 +170,10 @@ custom_types = {
|
||||
attributes : RelLib.Attribute.CUSTOM,
|
||||
# family_relations : RelLib.Family.CUSTOM,
|
||||
# name_types : RelLib.NameType.CUSTOM,
|
||||
source_media_types : RelLib.RepoRef.CUSTOM,
|
||||
event_roles : RelLib.EventRef.CUSTOM,
|
||||
# source_media_types : RelLib.RepoRef.CUSTOM,
|
||||
# event_roles : RelLib.EventRef.CUSTOM,
|
||||
# repository_types : RelLib.Repository.CUSTOM,
|
||||
marker_types : RelLib.PrimaryObject.MARKER_CUSTOM,
|
||||
# marker_types : RelLib.PrimaryObject.MARKER_CUSTOM,
|
||||
# url_types : RelLib.Url.CUSTOM,
|
||||
}
|
||||
|
||||
|
@ -1323,13 +1323,13 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
family.note, family.change) = info
|
||||
|
||||
if complete:
|
||||
family.marker = (PrimaryObject.MARKER_COMPLETE,"")
|
||||
family.marker.set(MarkerType.COMPLETE)
|
||||
|
||||
# Change every event handle to the EventRef
|
||||
for event_handle in event_list:
|
||||
event_ref = EventRef()
|
||||
event_ref.ref = event_handle
|
||||
event_ref.role = (EventRef.PRIMARY,'')
|
||||
event_ref.role.set(EventRoleType.FAMILY)
|
||||
family.event_ref_list.append(event_ref)
|
||||
|
||||
# Change child_list into child_ref_list
|
||||
@ -1375,25 +1375,22 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
|
||||
# Convert complete flag into marker
|
||||
if complete:
|
||||
person.marker = (PrimaryObject.MARKER_COMPLETE,"")
|
||||
person.marker.set(MarkerType.COMPLETE)
|
||||
|
||||
# Change every event handle to the EventRef
|
||||
if birth_handle:
|
||||
event_ref = EventRef()
|
||||
event_ref.ref = birth_handle
|
||||
event_ref.role = (EventRef.PRIMARY,'')
|
||||
person.birth_ref = event_ref
|
||||
|
||||
if death_handle:
|
||||
event_ref = EventRef()
|
||||
event_ref.ref = death_handle
|
||||
event_ref.role = (EventRef.PRIMARY,'')
|
||||
person.death_ref = event_ref
|
||||
|
||||
for event_handle in event_list:
|
||||
event_ref = EventRef()
|
||||
event_ref.ref = event_handle
|
||||
event_ref.role = (EventRef.PRIMARY,'')
|
||||
person.event_ref_list.append(event_ref)
|
||||
|
||||
# In all Name instances, convert type from string to a tuple
|
||||
@ -1552,7 +1549,7 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
# to this event using ROLE_WITNESS role
|
||||
event_ref = EventRef()
|
||||
event_ref.ref = event.handle
|
||||
event_ref.role = (EventRef.WITNESS,'')
|
||||
event_ref.role.set(EventRoleType.WITNESS)
|
||||
# Add privacy and comment
|
||||
event_ref.private = witness.private
|
||||
if witness.comment:
|
||||
|
@ -412,7 +412,7 @@ class GrampsDbBase(GrampsDBCallback):
|
||||
for attr in person.attribute_list:
|
||||
self.individual_attributes.add(attr.type)
|
||||
|
||||
self.marker_names.add(person.marker[1])
|
||||
self.marker_names.add(str(person.marker))
|
||||
|
||||
def commit_media_object(self, obj, transaction, change_time=None):
|
||||
"""
|
||||
|
@ -1166,7 +1166,7 @@ class GedcomParser:
|
||||
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle(event.handle)
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
event_ref.set_role(RelLib.EventRoleType.FAMILY)
|
||||
self.family.add_event_ref(event_ref)
|
||||
del event
|
||||
|
||||
@ -2174,7 +2174,6 @@ class GedcomParser:
|
||||
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle(event.handle)
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
|
||||
if state.person.get_birth_ref():
|
||||
state.person.add_event_ref(event_ref)
|
||||
@ -2191,7 +2190,6 @@ class GedcomParser:
|
||||
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle(event.handle)
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
state.person.add_event_ref(event_ref)
|
||||
|
||||
def func_person_deat(self,matches,state):
|
||||
@ -2207,7 +2205,6 @@ class GedcomParser:
|
||||
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle(event.handle)
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
|
||||
if state.person.get_death_ref():
|
||||
state.person.add_event_ref(event_ref)
|
||||
@ -2230,7 +2227,6 @@ class GedcomParser:
|
||||
self.db.add_event(event, self.trans)
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle(event.handle)
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
state.person.add_event_ref(event_ref)
|
||||
|
||||
def func_person_sour(self,matches,state):
|
||||
@ -2286,7 +2282,6 @@ class GedcomParser:
|
||||
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle(event.handle)
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
state.person.add_event_ref(event_ref)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -733,7 +733,7 @@ class GrampsParser:
|
||||
# to this event using ROLE_WITNESS role
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.ref = self.event.handle
|
||||
event_ref.role = (RelLib.EventRef.WITNESS,'')
|
||||
event_ref.role.set(RelLib.EventRoleType.WITNESS)
|
||||
person.event_ref_list.append(event_ref)
|
||||
self.db.commit_person(person,self.trans,self.change)
|
||||
|
||||
@ -767,8 +767,7 @@ class GrampsParser:
|
||||
self.eventref = RelLib.EventRef()
|
||||
self.eventref.ref = attrs['hlink'].replace('_','')
|
||||
self.eventref.private = bool(attrs.get('priv'))
|
||||
self.eventref.role = _ConstXML.tuple_from_xml(_ConstXML.event_roles,
|
||||
attrs.get('role',''))
|
||||
self.eventref.role.set_from_xml_str(attrs.get('role'))
|
||||
# We count here on events being already parsed prior to parsing
|
||||
# people or families. This code will fail if this is not true.
|
||||
event = self.db.get_event_from_handle(self.eventref.ref)
|
||||
@ -830,10 +829,9 @@ class GrampsParser:
|
||||
|
||||
# Old and new markers: complete=1 and marker=word both have to work
|
||||
if attrs.get('complete'): # this is only true for complete=1
|
||||
self.person.marker = (RelLib.PrimaryObject.MARKER_COMPLETE,"")
|
||||
self.person.marker.set(RelLib.MarkerType.COMPLETE)
|
||||
else:
|
||||
self.person.marker = _ConstXML.tuple_from_xml(
|
||||
_ConstXML.marker_types,attrs.get("marker",''))
|
||||
self.person.marker.set_from_xml_str(attrs.get("marker",''))
|
||||
|
||||
def start_people(self,attrs):
|
||||
if attrs.has_key('home'):
|
||||
@ -927,10 +925,9 @@ class GrampsParser:
|
||||
|
||||
# Old and new markers: complete=1 and marker=word both have to work
|
||||
if attrs.get('complete'): # this is only true for complete=1
|
||||
self.family.marker = (RelLib.PrimaryObject.MARKER_COMPLETE,"")
|
||||
self.family.marker.set(RelLib.MarkerType.COMPLETE)
|
||||
else:
|
||||
self.family.marker = _ConstXML.tuple_from_xml(
|
||||
_ConstXML.marker_types,attrs.get("marker",''))
|
||||
self.family.marker.set_from_xml_str(attrs.get("marker",''))
|
||||
|
||||
def start_rel(self,attrs):
|
||||
self.family.type = RelLib.FamilyRelType().set_from_xml_str(
|
||||
@ -1055,8 +1052,8 @@ class GrampsParser:
|
||||
|
||||
self.reporef.ref = handle
|
||||
self.reporef.call_number = attrs.get('callno','')
|
||||
self.reporef.media_type = _ConstXML.tuple_from_xml(
|
||||
_ConstXML.source_media_types,attrs.get('medium',"Unknown"))
|
||||
self.reporef.media_type = RelLib.SourceMediaType().set_from_xml_str(
|
||||
attrs.get('medium'))
|
||||
# we count here on self.source being available
|
||||
# reporefs can only be found within source
|
||||
self.source.add_repo_reference(self.reporef)
|
||||
@ -1385,7 +1382,7 @@ class GrampsParser:
|
||||
def stop_type(self,tag):
|
||||
if self.event:
|
||||
# Event type
|
||||
self.event.type = _ConstXML.tuple_from_xml(_ConstXML.events,tag)
|
||||
self.event.type.set_from_xml_str(tag)
|
||||
elif self.repo:
|
||||
# Repository type
|
||||
self.repo.type = RelLib.RepositoryType()
|
||||
@ -1405,13 +1402,13 @@ class GrampsParser:
|
||||
ref = RelLib.EventRef()
|
||||
ref.ref = self.event.handle
|
||||
ref.private = self.event.private
|
||||
ref.role = (RelLib.EventRef.FAMILY,'')
|
||||
ref.role.set(RelLib.EventRoleType.FAMILY)
|
||||
self.family.add_event_ref(ref)
|
||||
elif self.person:
|
||||
ref = RelLib.EventRef()
|
||||
ref.ref = self.event.handle
|
||||
ref.private = self.event.private
|
||||
ref.role = (RelLib.EventRef.PRIMARY,'')
|
||||
ref.role.set(RelLib.EventRoleType.PRIMARY)
|
||||
if int(self.event.type) == RelLib.EventType.BIRTH:
|
||||
self.person.birth_ref = ref
|
||||
elif int(self.event.type) == RelLib.EventType.DEATH:
|
||||
@ -1465,7 +1462,7 @@ class GrampsParser:
|
||||
# to this event using ROLE_WITNESS role
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.ref = self.event.handle
|
||||
event_ref.role = (RelLib.EventRef.WITNESS,'')
|
||||
event_ref.role.set(RelLib.EventRoleType.WITNESS)
|
||||
person.event_ref_list.append(event_ref)
|
||||
self.db.commit_person(person,self.trans,self.change)
|
||||
|
||||
|
@ -472,10 +472,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
def column_marker_text(self, data, node):
|
||||
try:
|
||||
if data[_MARKER_COL]:
|
||||
if data[_MARKER_COL][0] == PrimaryObject.MARKER_CUSTOM:
|
||||
return data[_MARKER_COL][1]
|
||||
elif data[_MARKER_COL][0] in Utils.marker_types.keys():
|
||||
return Utils.marker_types[data[_MARKER_COL][0]]
|
||||
return str(data[_MARKER_COL])
|
||||
except IndexError:
|
||||
return ""
|
||||
return ""
|
||||
@ -483,11 +480,11 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
def column_marker_color(self, data, node):
|
||||
try:
|
||||
if data[_MARKER_COL]:
|
||||
if data[_MARKER_COL][0] == PrimaryObject.MARKER_COMPLETE:
|
||||
if int(data[_MARKER_COL]) == MarkerType.COMPLETE:
|
||||
return u"#46a046" # green
|
||||
if data[_MARKER_COL][0] == PrimaryObject.MARKER_TODO:
|
||||
if int(data[_MARKER_COL]) == MarkerType.TODO:
|
||||
return u"#df421e" # red
|
||||
if data[_MARKER_COL][0] == PrimaryObject.MARKER_CUSTOM:
|
||||
if int(data[_MARKER_COL]) == MarkerType.CUSTOM:
|
||||
return u"#eed680" # blue
|
||||
except IndexError:
|
||||
pass
|
||||
|
@ -52,7 +52,10 @@ pkgdata_PYTHON = \
|
||||
_RefBase.py\
|
||||
_ChildRef.py\
|
||||
_ChildRefType.py\
|
||||
_FamilyRelType.py
|
||||
_FamilyRelType.py\
|
||||
_SourceMediaType.py\
|
||||
_MarkerType.py\
|
||||
_EventRoleType.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/RelLib
|
||||
pkgpythondir = @pkgpythondir@/RelLib
|
||||
|
@ -40,6 +40,7 @@ from _BaseObject import BaseObject
|
||||
from _PrivacyBase import PrivacyBase
|
||||
from _NoteBase import NoteBase
|
||||
from _RefBase import RefBase
|
||||
from _EventRoleType import EventRoleType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -54,17 +55,6 @@ class EventRef(BaseObject,PrivacyBase,NoteBase,RefBase):
|
||||
to the refereneced event.
|
||||
"""
|
||||
|
||||
UNKNOWN = -1
|
||||
CUSTOM = 0
|
||||
PRIMARY = 1
|
||||
CLERGY = 2
|
||||
CELEBRANT = 3
|
||||
AIDE = 4
|
||||
BRIDE = 5
|
||||
GROOM = 6
|
||||
WITNESS = 7
|
||||
FAMILY = 8
|
||||
|
||||
def __init__(self,source=None):
|
||||
"""
|
||||
Creates a new EventRef instance, copying from the source if present.
|
||||
@ -76,21 +66,22 @@ class EventRef(BaseObject,PrivacyBase,NoteBase,RefBase):
|
||||
if source:
|
||||
self.role = source.role
|
||||
else:
|
||||
self.role = (EventRef.CUSTOM,"")
|
||||
self.role = EventRoleType()
|
||||
|
||||
def serialize(self):
|
||||
return (
|
||||
PrivacyBase.serialize(self),
|
||||
NoteBase.serialize(self),
|
||||
RefBase.serialize(self),
|
||||
self.role
|
||||
self.role.serialize()
|
||||
)
|
||||
|
||||
def unserialize(self,data):
|
||||
(privacy,note,ref,self.role) = data
|
||||
(privacy,note,ref,role) = data
|
||||
PrivacyBase.unserialize(self,privacy)
|
||||
NoteBase.unserialize(self,note)
|
||||
RefBase.unserialize(self,ref)
|
||||
self.role = EventRoleType(role)
|
||||
return self
|
||||
|
||||
def get_text_data_list(self):
|
||||
@ -100,7 +91,7 @@ class EventRef(BaseObject,PrivacyBase,NoteBase,RefBase):
|
||||
@return: Returns the list of all textual attributes of the object.
|
||||
@rtype: list
|
||||
"""
|
||||
return [self.role_str]
|
||||
return [str(self.role)]
|
||||
|
||||
def get_text_data_child_list(self):
|
||||
"""
|
||||
@ -136,12 +127,7 @@ class EventRef(BaseObject,PrivacyBase,NoteBase,RefBase):
|
||||
"""
|
||||
Sets the role according to the given argument.
|
||||
"""
|
||||
if not type(role) == tuple:
|
||||
if role in range(-1,9):
|
||||
warn( "set_role now takes a tuple", DeprecationWarning, 2)
|
||||
# Wrapper for old API
|
||||
# remove when transitition done.
|
||||
role = (role,'')
|
||||
else:
|
||||
assert type(role) == tuple
|
||||
self.role = role
|
||||
if type(role) == tuple:
|
||||
self.role = EventRoleType(role)
|
||||
else:
|
||||
self.role = role
|
||||
|
60
src/RelLib/_EventRoleType.py
Normal file
60
src/RelLib/_EventRoleType.py
Normal file
@ -0,0 +1,60 @@
|
||||
#
|
||||
# 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: _Name.py 6326 2006-04-13 11:21:33Z loshawlos $
|
||||
|
||||
from _GrampsType import GrampsType, init_map
|
||||
from gettext import gettext as _
|
||||
|
||||
class EventRoleType(GrampsType):
|
||||
|
||||
UNKNOWN = -1
|
||||
CUSTOM = 0
|
||||
PRIMARY = 1
|
||||
CLERGY = 2
|
||||
CELEBRANT = 3
|
||||
AIDE = 4
|
||||
BRIDE = 5
|
||||
GROOM = 6
|
||||
WITNESS = 7
|
||||
FAMILY = 8
|
||||
|
||||
_CUSTOM = CUSTOM
|
||||
_DEFAULT = PRIMARY
|
||||
|
||||
_DATAMAP = [
|
||||
(UNKNOWN, _("Unknown"), "Unknown"),
|
||||
(CUSTOM, _("Custom"), "Custom"),
|
||||
(PRIMARY, _("Primary"), "Primary"),
|
||||
(CLERGY, _("Clergy"), "Clergy"),
|
||||
(CELEBRANT, _("Celebrant"), "Celebrant"),
|
||||
(AIDE, _("Aide"), "Aide"),
|
||||
(BRIDE, _("Bride"), "Bride"),
|
||||
(GROOM, _("Groom"), "Groom"),
|
||||
(WITNESS, _("Witness"), "Witness"),
|
||||
(FAMILY, _("Family"), "Family"),
|
||||
]
|
||||
|
||||
_I2SMAP = init_map(_DATAMAP, 0, 1)
|
||||
_S2IMAP = init_map(_DATAMAP, 1, 0)
|
||||
_I2EMAP = init_map(_DATAMAP, 0, 2)
|
||||
_E2IMAP = init_map(_DATAMAP, 2, 0)
|
||||
|
||||
def __init__(self, value=None):
|
||||
GrampsType.__init__(self, value)
|
@ -45,6 +45,7 @@ from _EventRef import EventRef
|
||||
from _LdsOrdBase import LdsOrdBase
|
||||
from _ChildRef import ChildRef
|
||||
from _FamilyRelType import FamilyRelType
|
||||
from _MarkerType import MarkerType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -89,7 +90,7 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
|
||||
self.father_handle = None
|
||||
self.mother_handle = None
|
||||
self.child_ref_list = []
|
||||
self.type = FamilyRelType(FamilyRelType.MARRIED)
|
||||
self.type = FamilyRelType()
|
||||
self.event_ref_list = []
|
||||
self.lds_seal = None
|
||||
self.complete = 0
|
||||
@ -124,7 +125,7 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
|
||||
LdsOrdBase.serialize(self),
|
||||
SourceBase.serialize(self),
|
||||
NoteBase.serialize(self),
|
||||
self.change, self.marker, self.private)
|
||||
self.change, self.marker.serialize(), self.private)
|
||||
|
||||
def unserialize(self, data):
|
||||
"""
|
||||
@ -134,8 +135,9 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
|
||||
(self.handle, self.gramps_id, self.father_handle, self.mother_handle,
|
||||
child_ref_list, the_type, event_ref_list, media_list,
|
||||
attribute_list, lds_seal_list, source_list, note,
|
||||
self.change, self.marker, self.private) = data
|
||||
self.change, marker, self.private) = data
|
||||
|
||||
self.marker.unserialize(marker)
|
||||
self.type.unserialize(the_type)
|
||||
self.event_ref_list = [EventRef().unserialize(er)
|
||||
for er in event_ref_list]
|
||||
@ -412,7 +414,6 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
|
||||
# remove when transitition done.
|
||||
event_ref = EventRef()
|
||||
event_ref.set_reference_handle(event_handle)
|
||||
event_ref.set_role((EventRef.PRIMARY,''))
|
||||
self.add_event_ref(event_ref)
|
||||
|
||||
def add_event_ref(self,event_ref):
|
||||
@ -457,7 +458,6 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
|
||||
for event_handle in event_list:
|
||||
event_ref = EventRef()
|
||||
event_ref.set_reference_handle(event_handle)
|
||||
event_ref.set_role((EventRef.PRIMARY,''))
|
||||
event_ref_list.append( event_ref)
|
||||
self.set_event_ref_list(event_ref_list)
|
||||
|
||||
|
48
src/RelLib/_MarkerType.py
Normal file
48
src/RelLib/_MarkerType.py
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
# 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: _Name.py 6326 2006-04-13 11:21:33Z loshawlos $
|
||||
|
||||
from _GrampsType import GrampsType, init_map
|
||||
from gettext import gettext as _
|
||||
|
||||
class MarkerType(GrampsType):
|
||||
|
||||
NONE = -1
|
||||
CUSTOM = 0
|
||||
COMPLETE = 1
|
||||
TODO = 2
|
||||
|
||||
_CUSTOM = CUSTOM
|
||||
_DEFAULT = NONE
|
||||
|
||||
_DATAMAP = [
|
||||
(NONE, "", ""),
|
||||
(CUSTOM, _("Custom"), "Custom"),
|
||||
(COMPLETE, _("Complete"), "Complete"),
|
||||
(TODO, _("ToDo"), "ToDo"),
|
||||
]
|
||||
|
||||
_I2SMAP = init_map(_DATAMAP, 0, 1)
|
||||
_S2IMAP = init_map(_DATAMAP, 1, 0)
|
||||
_I2EMAP = init_map(_DATAMAP, 0, 2)
|
||||
_E2IMAP = init_map(_DATAMAP, 2, 0)
|
||||
|
||||
def __init__(self, value=None):
|
||||
GrampsType.__init__(self, value)
|
@ -49,6 +49,7 @@ from _NameType import NameType
|
||||
from _EventRef import EventRef
|
||||
from _LdsOrd import LdsOrd
|
||||
from _PersonRef import PersonRef
|
||||
from _MarkerType import MarkerType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -161,7 +162,7 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
SourceBase.serialize(self), # 16
|
||||
NoteBase.serialize(self), # 17
|
||||
self.change, # 18
|
||||
self.marker, # 19
|
||||
self.marker.serialize(), # 19
|
||||
self.private, # 20
|
||||
[pr.serialize() for pr in self.person_ref_list] # 21
|
||||
)
|
||||
@ -195,11 +196,12 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
source_list, # 16
|
||||
note, # 17
|
||||
self.change, # 18
|
||||
self.marker, # 19
|
||||
marker, # 19
|
||||
self.private, # 20
|
||||
person_ref_list, # 21
|
||||
) = data
|
||||
|
||||
self.marker = MarkerType(marker)
|
||||
self.primary_name.unserialize(primary_name)
|
||||
if death_ref:
|
||||
self.death_ref = EventRef().unserialize(death_ref)
|
||||
@ -351,7 +353,7 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
DeprecationWarning, 2)
|
||||
# Wrapper for old API
|
||||
# remove when transitition done.
|
||||
return self.marker[0] == PrimaryObject.MARKER_COMPLETE
|
||||
return int(self.marker) == MarkerType.COMPLETE
|
||||
|
||||
def set_primary_name(self, name):
|
||||
"""
|
||||
@ -448,7 +450,6 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
# remove when transitition done.
|
||||
event_ref = EventRef()
|
||||
event_ref.set_reference_handle(event_handle)
|
||||
event_ref.set_role((EventRef.PRIMARY, ''))
|
||||
self.set_birth_ref( event_ref)
|
||||
|
||||
def set_birth_ref(self, event_ref):
|
||||
@ -472,7 +473,6 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
# remove when transitition done.
|
||||
event_ref = EventRef()
|
||||
event_ref.set_reference_handle(event_handle)
|
||||
event_ref.set_role((EventRef.PRIMARY, ''))
|
||||
self.set_death_ref( event_ref)
|
||||
|
||||
def set_death_ref(self, event_ref):
|
||||
@ -518,7 +518,6 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
# remove when transitition done.
|
||||
event_ref = EventRef()
|
||||
event_ref.set_reference_handle(event_handle)
|
||||
event_ref.set_role((EventRef.PRIMARY, ''))
|
||||
self.add_event_ref( event_ref)
|
||||
|
||||
def add_event_ref(self, event_ref):
|
||||
@ -565,7 +564,6 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
for event_handle in event_list:
|
||||
event_ref = EventRef()
|
||||
event_ref.set_reference_handle(event_handle)
|
||||
event_ref.set_role((EventRef.PRIMARY, ''))
|
||||
event_ref_list.append( event_ref)
|
||||
self.set_event_ref_list(event_ref_list)
|
||||
|
||||
|
@ -41,6 +41,7 @@ from _BaseObject import BaseObject
|
||||
from _PrivacyBase import PrivacyBase
|
||||
from _SourceBase import SourceBase
|
||||
from _MediaBase import MediaBase
|
||||
from _MarkerType import MarkerType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -63,11 +64,6 @@ class PrimaryObject(BaseObject,PrivacyBase):
|
||||
ID is the user visible version.
|
||||
"""
|
||||
|
||||
MARKER_NONE = -1
|
||||
MARKER_CUSTOM = 0
|
||||
MARKER_COMPLETE = 1
|
||||
MARKER_TODO = 2
|
||||
|
||||
def __init__(self,source=None):
|
||||
"""
|
||||
Initialize a PrimaryObject. If source is None, both the ID and handle
|
||||
@ -88,7 +84,7 @@ class PrimaryObject(BaseObject,PrivacyBase):
|
||||
self.gramps_id = None
|
||||
self.handle = None
|
||||
self.change = 0
|
||||
self.marker = (PrimaryObject.MARKER_NONE,"")
|
||||
self.marker = MarkerType()
|
||||
|
||||
def get_change_time(self):
|
||||
"""
|
||||
@ -214,7 +210,10 @@ class PrimaryObject(BaseObject,PrivacyBase):
|
||||
pass
|
||||
|
||||
def set_marker(self,marker):
|
||||
self.marker = marker
|
||||
if type(marker) == tuple:
|
||||
self.marker = MarkerType(marker)
|
||||
else:
|
||||
self.marker = marker
|
||||
|
||||
def get_marker(self):
|
||||
return self.marker
|
||||
|
@ -32,6 +32,7 @@ Repository Reference class for GRAMPS
|
||||
from _BaseObject import BaseObject
|
||||
from _NoteBase import NoteBase
|
||||
from _RefBase import RefBase
|
||||
from _SourceMediaType import SourceMediaType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -43,22 +44,6 @@ class RepoRef(BaseObject,NoteBase,RefBase):
|
||||
Repository reference class.
|
||||
"""
|
||||
|
||||
UNKNOWN = -1
|
||||
CUSTOM = 0
|
||||
AUDIO = 1
|
||||
BOOK = 2
|
||||
CARD = 3
|
||||
ELECTRONIC = 4
|
||||
FICHE = 5
|
||||
FILM = 6
|
||||
MAGAZINE = 7
|
||||
MANUSCRIPT = 8
|
||||
MAP = 9
|
||||
NEWSPAPER = 10
|
||||
PHOTO = 11
|
||||
TOMBSTONE = 12
|
||||
VIDEO = 13
|
||||
|
||||
def __init__(self,source=None):
|
||||
BaseObject.__init__(self)
|
||||
NoteBase.__init__(self)
|
||||
@ -68,16 +53,17 @@ class RepoRef(BaseObject,NoteBase,RefBase):
|
||||
self.media_type = source.media_type
|
||||
else:
|
||||
self.call_number = ""
|
||||
self.media_type = (RepoRef.CUSTOM,"")
|
||||
self.media_type = SourceMediaType()
|
||||
|
||||
def serialize(self):
|
||||
return (
|
||||
NoteBase.serialize(self),
|
||||
RefBase.serialize(self),
|
||||
self.call_number,self.media_type)
|
||||
self.call_number,self.media_type.serialize())
|
||||
|
||||
def unserialize(self,data):
|
||||
(note,ref,self.call_number,self.media_type) = data
|
||||
(note,ref,self.call_number,media_type) = data
|
||||
self.media_type = SourceMediaType(media_type)
|
||||
NoteBase.unserialize(self,note)
|
||||
RefBase.unserialize(self,ref)
|
||||
return self
|
||||
@ -89,7 +75,7 @@ class RepoRef(BaseObject,NoteBase,RefBase):
|
||||
@return: Returns the list of all textual attributes of the object.
|
||||
@rtype: list
|
||||
"""
|
||||
return [self.call_number,self.media_type[1]]
|
||||
return [self.call_number,str(self.media_type)]
|
||||
|
||||
def get_text_data_child_list(self):
|
||||
"""
|
||||
@ -125,4 +111,7 @@ class RepoRef(BaseObject,NoteBase,RefBase):
|
||||
return self.media_type
|
||||
|
||||
def set_media_type(self,media_type):
|
||||
self.media_type = media_type
|
||||
if type(media_type) == tuple:
|
||||
self.media_type = SourceMediaType(media_type)
|
||||
else:
|
||||
self.media_type = media_type
|
||||
|
70
src/RelLib/_SourceMediaType.py
Normal file
70
src/RelLib/_SourceMediaType.py
Normal file
@ -0,0 +1,70 @@
|
||||
#
|
||||
# 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: _Name.py 6326 2006-04-13 11:21:33Z loshawlos $
|
||||
|
||||
from _GrampsType import GrampsType, init_map
|
||||
from gettext import gettext as _
|
||||
|
||||
class SourceMediaType(GrampsType):
|
||||
|
||||
UNKNOWN = -1
|
||||
CUSTOM = 0
|
||||
AUDIO = 1
|
||||
BOOK = 2
|
||||
CARD = 3
|
||||
ELECTRONIC = 4
|
||||
FICHE = 5
|
||||
FILM = 6
|
||||
MAGAZINE = 7
|
||||
MANUSCRIPT = 8
|
||||
MAP = 9
|
||||
NEWSPAPER = 10
|
||||
PHOTO = 11
|
||||
TOMBSTONE = 12
|
||||
VIDEO = 13
|
||||
|
||||
_CUSTOM = CUSTOM
|
||||
_DEFAULT = BOOK
|
||||
|
||||
_DATAMAP = [
|
||||
(UNKNOWN, _("Unknown"), "Unknown"),
|
||||
(CUSTOM, _("Custom"), "Custom"),
|
||||
(AUDIO, _("Audio"), "Audio"),
|
||||
(BOOK, _("Book"), "Book"),
|
||||
(CARD, _("Card"), "Card"),
|
||||
(ELECTRONIC, _("Electronic"), "Electronic"),
|
||||
(FICHE, _("Fiche"), "Fiche"),
|
||||
(FILM, _("Film"), "Film"),
|
||||
(MAGAZINE, _("Magazine"), "Magazine"),
|
||||
(MANUSCRIPT, _("Manuscript"), "Manuscript"),
|
||||
(MAP, _("Map"), "Map"),
|
||||
(NEWSPAPER, _("Newspaper"), "Newspaper"),
|
||||
(PHOTO, _("Photo"), "Photo"),
|
||||
(TOMBSTONE, _("Tombstone"), "Tombstone"),
|
||||
(VIDEO, _("Video"), "Video"),
|
||||
]
|
||||
|
||||
_I2SMAP = init_map(_DATAMAP, 0, 1)
|
||||
_S2IMAP = init_map(_DATAMAP, 1, 0)
|
||||
_I2EMAP = init_map(_DATAMAP, 0, 2)
|
||||
_E2IMAP = init_map(_DATAMAP, 2, 0)
|
||||
|
||||
def __init__(self, value=None):
|
||||
GrampsType.__init__(self, value)
|
@ -66,3 +66,6 @@ from _ChildRefType import ChildRefType
|
||||
from _RepositoryType import RepositoryType
|
||||
from _EventType import EventType
|
||||
from _FamilyRelType import FamilyRelType
|
||||
from _SourceMediaType import SourceMediaType
|
||||
from _EventRoleType import EventRoleType
|
||||
from _MarkerType import MarkerType
|
||||
|
124
src/Utils.py
124
src/Utils.py
@ -210,61 +210,61 @@ family_rel_descriptions = {
|
||||
"a man and woman"),
|
||||
}
|
||||
|
||||
source_media_types = {
|
||||
RelLib.RepoRef.UNKNOWN : _("Unknown"),
|
||||
RelLib.RepoRef.CUSTOM : _("Custom"),
|
||||
RelLib.RepoRef.AUDIO : _("Audio"),
|
||||
RelLib.RepoRef.BOOK : _("Book"),
|
||||
RelLib.RepoRef.CARD : _("Card"),
|
||||
RelLib.RepoRef.ELECTRONIC : _("Electronic"),
|
||||
RelLib.RepoRef.FICHE : _("Fiche"),
|
||||
RelLib.RepoRef.FILM : _("Film"),
|
||||
RelLib.RepoRef.MAGAZINE : _("Magazine"),
|
||||
RelLib.RepoRef.MANUSCRIPT : _("Manuscript"),
|
||||
RelLib.RepoRef.MAP : _("Map"),
|
||||
RelLib.RepoRef.NEWSPAPER : _("Newspaper"),
|
||||
RelLib.RepoRef.PHOTO : _("Photo"),
|
||||
RelLib.RepoRef.TOMBSTONE : _("Tombstone"),
|
||||
RelLib.RepoRef.VIDEO : _("Video"),
|
||||
}
|
||||
def format_source_media_type( type):
|
||||
if type[0] == RelLib.RepoRef.CUSTOM:
|
||||
return type[1]
|
||||
return source_media_types.get(type[0],_("Invalid id %d ('%s')")%type)
|
||||
## source_media_types = {
|
||||
## RelLib.RepoRef.UNKNOWN : _("Unknown"),
|
||||
## RelLib.RepoRef.CUSTOM : _("Custom"),
|
||||
## RelLib.RepoRef.AUDIO : _("Audio"),
|
||||
## RelLib.RepoRef.BOOK : _("Book"),
|
||||
## RelLib.RepoRef.CARD : _("Card"),
|
||||
## RelLib.RepoRef.ELECTRONIC : _("Electronic"),
|
||||
## RelLib.RepoRef.FICHE : _("Fiche"),
|
||||
## RelLib.RepoRef.FILM : _("Film"),
|
||||
## RelLib.RepoRef.MAGAZINE : _("Magazine"),
|
||||
## RelLib.RepoRef.MANUSCRIPT : _("Manuscript"),
|
||||
## RelLib.RepoRef.MAP : _("Map"),
|
||||
## RelLib.RepoRef.NEWSPAPER : _("Newspaper"),
|
||||
## RelLib.RepoRef.PHOTO : _("Photo"),
|
||||
## RelLib.RepoRef.TOMBSTONE : _("Tombstone"),
|
||||
## RelLib.RepoRef.VIDEO : _("Video"),
|
||||
## }
|
||||
## def format_source_media_type( type):
|
||||
## if type[0] == RelLib.RepoRef.CUSTOM:
|
||||
## return type[1]
|
||||
## return source_media_types.get(type[0],_("Invalid id %d ('%s')")%type)
|
||||
|
||||
event_roles = {
|
||||
RelLib.EventRef.UNKNOWN : _("Unknown"),
|
||||
RelLib.EventRef.CUSTOM : _("Custom"),
|
||||
RelLib.EventRef.PRIMARY : _("Primary"),
|
||||
RelLib.EventRef.CLERGY : _("Clergy"),
|
||||
RelLib.EventRef.CELEBRANT : _("Celebrant"),
|
||||
RelLib.EventRef.AIDE : _("Aide"),
|
||||
RelLib.EventRef.BRIDE : _("Bride"),
|
||||
RelLib.EventRef.GROOM : _("Groom"),
|
||||
RelLib.EventRef.WITNESS : _("Witness"),
|
||||
}
|
||||
def format_personal_event_role( type):
|
||||
if type[0] == RelLib.EventRef.CUSTOM:
|
||||
return type[1]
|
||||
return event_roles.get(type[0],_("Invalid id %d ('%s')")%type)
|
||||
## event_roles = {
|
||||
## RelLib.EventRef.UNKNOWN : _("Unknown"),
|
||||
## RelLib.EventRef.CUSTOM : _("Custom"),
|
||||
## RelLib.EventRef.PRIMARY : _("Primary"),
|
||||
## RelLib.EventRef.CLERGY : _("Clergy"),
|
||||
## RelLib.EventRef.CELEBRANT : _("Celebrant"),
|
||||
## RelLib.EventRef.AIDE : _("Aide"),
|
||||
## RelLib.EventRef.BRIDE : _("Bride"),
|
||||
## RelLib.EventRef.GROOM : _("Groom"),
|
||||
## RelLib.EventRef.WITNESS : _("Witness"),
|
||||
## }
|
||||
## def format_personal_event_role( type):
|
||||
## if type[0] == RelLib.EventRef.CUSTOM:
|
||||
## return type[1]
|
||||
## return event_roles.get(type[0],_("Invalid id %d ('%s')")%type)
|
||||
|
||||
family_event_roles = {
|
||||
RelLib.EventRef.UNKNOWN : _("Unknown"),
|
||||
RelLib.EventRef.CUSTOM : _("Custom"),
|
||||
RelLib.EventRef.FAMILY : _("Family"),
|
||||
}
|
||||
def format_family_event_role( type):
|
||||
if type[0] == RelLib.EventRef.CUSTOM:
|
||||
return type[1]
|
||||
return family_event_roles.get(type[0],_("Invalid id %d ('%s')")%type)
|
||||
## family_event_roles = {
|
||||
## RelLib.EventRef.UNKNOWN : _("Unknown"),
|
||||
## RelLib.EventRef.CUSTOM : _("Custom"),
|
||||
## RelLib.EventRef.FAMILY : _("Family"),
|
||||
## }
|
||||
## def format_family_event_role( type):
|
||||
## if type[0] == RelLib.EventRef.CUSTOM:
|
||||
## return type[1]
|
||||
## return family_event_roles.get(type[0],_("Invalid id %d ('%s')")%type)
|
||||
|
||||
def format_event_role( type):
|
||||
if type[0] == RelLib.EventRef.CUSTOM:
|
||||
return type[1]
|
||||
val = event_roles.get(type[0])
|
||||
if not val:
|
||||
val = family_event_roles.get(type[0],_("Invalid id %d ('%s')")%type)
|
||||
return val
|
||||
## def format_event_role( type):
|
||||
## if type[0] == RelLib.EventRef.CUSTOM:
|
||||
## return type[1]
|
||||
## val = event_roles.get(type[0])
|
||||
## if not val:
|
||||
## val = family_event_roles.get(type[0],_("Invalid id %d ('%s')")%type)
|
||||
## return val
|
||||
|
||||
# repository_types = {
|
||||
# RelLib.Repository.UNKNOWN : _("Unknown"),
|
||||
@ -285,16 +285,16 @@ def format_event_role( type):
|
||||
# return repository_types.get(type[0],_("Invalid id %d ('%s')")%type)
|
||||
|
||||
|
||||
marker_types = {
|
||||
RelLib.PrimaryObject.MARKER_NONE : "",
|
||||
RelLib.PrimaryObject.MARKER_CUSTOM : _("Custom"),
|
||||
RelLib.PrimaryObject.MARKER_COMPLETE : _("Information is complete"),
|
||||
RelLib.PrimaryObject.MARKER_TODO : _("TODO"),
|
||||
}
|
||||
def format_marker_type( type):
|
||||
if type[0] == RelLib.PrimaryObject.MARKER_CUSTOM:
|
||||
return type[1]
|
||||
return marker_types.get(type[0],_("Invalid id %d ('%s')")%type)
|
||||
## marker_types = {
|
||||
## RelLib.PrimaryObject.MARKER_NONE : "",
|
||||
## RelLib.PrimaryObject.MARKER_CUSTOM : _("Custom"),
|
||||
## RelLib.PrimaryObject.MARKER_COMPLETE : _("Information is complete"),
|
||||
## RelLib.PrimaryObject.MARKER_TODO : _("TODO"),
|
||||
## }
|
||||
## def format_marker_type( type):
|
||||
## if type[0] == RelLib.PrimaryObject.MARKER_CUSTOM:
|
||||
## return type[1]
|
||||
## return marker_types.get(type[0],_("Invalid id %d ('%s')")%type)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -529,7 +529,6 @@ class TestcaseGenerator(Tool.Tool):
|
||||
person = self.db.get_person_from_handle(person_h)
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle("InvalidHandle4")
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
person.set_birth_ref(event_ref)
|
||||
self.db.commit_person(person,self.trans)
|
||||
self.commit_transaction() # COMMIT TRANSACTION STEP
|
||||
@ -539,7 +538,6 @@ class TestcaseGenerator(Tool.Tool):
|
||||
person = self.db.get_person_from_handle(person_h)
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle("InvalidHandle5")
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
person.set_death_ref(event_ref)
|
||||
self.db.commit_person(person,self.trans)
|
||||
self.commit_transaction() # COMMIT TRANSACTION STEP
|
||||
@ -549,7 +547,6 @@ class TestcaseGenerator(Tool.Tool):
|
||||
person = self.db.get_person_from_handle(person_h)
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle("InvalidHandle6")
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
person.add_event_ref(event_ref)
|
||||
self.db.commit_person(person,self.trans)
|
||||
self.commit_transaction() # COMMIT TRANSACTION STEP
|
||||
@ -561,7 +558,6 @@ class TestcaseGenerator(Tool.Tool):
|
||||
event_h = self.db.add_event(event,self.trans)
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle(event_h)
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
person = self.db.get_person_from_handle(person_h)
|
||||
person.set_birth_ref(event_ref)
|
||||
self.db.commit_person(person,self.trans)
|
||||
@ -574,7 +570,6 @@ class TestcaseGenerator(Tool.Tool):
|
||||
event_h = self.db.add_event(event,self.trans)
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle(event_h)
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
person = self.db.get_person_from_handle(person_h)
|
||||
person.set_death_ref(event_ref)
|
||||
self.db.commit_person(person,self.trans)
|
||||
@ -587,7 +582,6 @@ class TestcaseGenerator(Tool.Tool):
|
||||
event_h = self.db.add_event(event,self.trans)
|
||||
event_ref = RelLib.EventRef()
|
||||
event_ref.set_reference_handle(event_h)
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
person = self.db.get_person_from_handle(person_h)
|
||||
person.add_event_ref(event_ref)
|
||||
self.db.commit_person(person,self.trans)
|
||||
@ -697,7 +691,6 @@ class TestcaseGenerator(Tool.Tool):
|
||||
self.generated_events.append(bevent_h)
|
||||
bevent_ref = RelLib.EventRef()
|
||||
bevent_ref.set_reference_handle(bevent_h)
|
||||
bevent_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
# for the death event display the date as text and parse it back to a new date
|
||||
ndate = None
|
||||
try:
|
||||
@ -727,7 +720,6 @@ class TestcaseGenerator(Tool.Tool):
|
||||
self.generated_events.append(devent_h)
|
||||
devent_ref = RelLib.EventRef()
|
||||
devent_ref.set_reference_handle(devent_h)
|
||||
devent_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
person_h = self.generate_person(None, "DateTest")
|
||||
person = self.db.get_person_from_handle(person_h)
|
||||
person.set_birth_ref(bevent_ref)
|
||||
@ -824,7 +816,7 @@ class TestcaseGenerator(Tool.Tool):
|
||||
eref = RelLib.EventRef()
|
||||
self.fill_object( eref)
|
||||
eref.set_reference_handle(e_h)
|
||||
eref.set_role( self.rand_type(Utils.event_roles))
|
||||
eref.set_role( self.rand_type(RelLib.EventRoleType()))
|
||||
np.add_event_ref(eref)
|
||||
|
||||
person_handle = self.db.add_person(np,self.trans)
|
||||
@ -1231,7 +1223,6 @@ class TestcaseGenerator(Tool.Tool):
|
||||
event_ref = RelLib.EventRef()
|
||||
self.fill_object(event_ref)
|
||||
event_ref.set_reference_handle(event_h)
|
||||
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
|
||||
return (year, event_ref)
|
||||
|
||||
def rand_type( self, list):
|
||||
|
Loading…
Reference in New Issue
Block a user