event/name type fixes
svn: r4780
This commit is contained in:
parent
e523edce30
commit
b239854bb4
@ -1,3 +1,10 @@
|
|||||||
|
2005-06-03 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/DisplayModels.py: remove unused print
|
||||||
|
* src/ListBox.py: get EventBox working for event types
|
||||||
|
* src/PedView.py: handle event types
|
||||||
|
* src/ReadXML.py: handle name types properly
|
||||||
|
* src/RelLib.py: add type checking for set_type
|
||||||
|
|
||||||
2005-06-03 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
2005-06-03 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
* src/DisplayModels.py (RepositoryModel): Display repository type as text
|
* src/DisplayModels.py (RepositoryModel): Display repository type as text
|
||||||
* src/RelLib.py (Repository): Serialize type as tuple not unicode
|
* src/RelLib.py (Repository): Serialize type as tuple not unicode
|
||||||
|
Binary file not shown.
@ -220,7 +220,6 @@ class ChildModel(gtk.ListStore):
|
|||||||
def column_birth_day(self,data):
|
def column_birth_day(self,data):
|
||||||
event_ref = data.get_birth_ref()
|
event_ref = data.get_birth_ref()
|
||||||
if event_ref and event_ref.ref:
|
if event_ref and event_ref.ref:
|
||||||
print event_ref.ref
|
|
||||||
return self.db.get_event_from_handle(event_ref.ref).get_date()
|
return self.db.get_event_from_handle(event_ref.ref).get_date()
|
||||||
else:
|
else:
|
||||||
return u""
|
return u""
|
||||||
|
@ -270,8 +270,18 @@ class EventListBox(ReorderListBox):
|
|||||||
ReorderListBox.__init__(self, parent, person, obj, label,
|
ReorderListBox.__init__(self, parent, person, obj, label,
|
||||||
button_list, evalues, DdTargets.EVENT)
|
button_list, evalues, DdTargets.EVENT)
|
||||||
|
|
||||||
|
self.name_map = {}
|
||||||
|
self.val_map = Utils.personal_events
|
||||||
|
self.custom = RelLib.Event.CUSTOM
|
||||||
|
for key in self.val_map.keys():
|
||||||
|
self.name_map[self.val_map[key]] = key
|
||||||
|
|
||||||
def set_name(self,index,value):
|
def set_name(self,index,value):
|
||||||
self.data[index][1].set_name(value)
|
val = self.name_map.get(value,self.custom)
|
||||||
|
if val == self.custom:
|
||||||
|
self.data[index][1].set_type((val,value))
|
||||||
|
else:
|
||||||
|
self.data[index][1].set_type((val,self.val_map[val]))
|
||||||
self.change_list.add(self.data[index])
|
self.change_list.add(self.data[index])
|
||||||
|
|
||||||
def set_description(self,index,value):
|
def set_description(self,index,value):
|
||||||
|
@ -46,6 +46,7 @@ import GrampsCfg
|
|||||||
import Relationship
|
import Relationship
|
||||||
import NameDisplay
|
import NameDisplay
|
||||||
import RelLib
|
import RelLib
|
||||||
|
import Utils
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -690,7 +691,9 @@ class PedigreeView:
|
|||||||
if event:
|
if event:
|
||||||
if line_count < 3:
|
if line_count < 3:
|
||||||
return event.get_date()
|
return event.get_date()
|
||||||
text += _(event.get_name())
|
i,s = event.get_type()
|
||||||
|
name = Utils.family_relations[i]
|
||||||
|
text += name
|
||||||
text += "\n"
|
text += "\n"
|
||||||
text += event.get_date()
|
text += event.get_date()
|
||||||
text += "\n"
|
text += "\n"
|
||||||
|
@ -64,6 +64,14 @@ _FAMILY_TRANS = {
|
|||||||
'Other' : RelLib.Family.CUSTOM,
|
'Other' : RelLib.Family.CUSTOM,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_NAME_TRANS = {
|
||||||
|
"Unknown" : RelLib.Name.UNKNOWN,
|
||||||
|
"Custom" : RelLib.Name.CUSTOM,
|
||||||
|
"Also Known As" : RelLib.Name.AKA,
|
||||||
|
"Birth Name" : RelLib.Name.BIRTH,
|
||||||
|
"Married Name" : RelLib.Name.MARRIED,
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Importing data into the currently open database.
|
# Importing data into the currently open database.
|
||||||
@ -893,7 +901,11 @@ class GrampsParser:
|
|||||||
if not self.in_witness:
|
if not self.in_witness:
|
||||||
self.name = RelLib.Name()
|
self.name = RelLib.Name()
|
||||||
if attrs.has_key("type"):
|
if attrs.has_key("type"):
|
||||||
self.name.set_type(attrs["type"])
|
tval = _NAME_TRANS[attrs['type']]
|
||||||
|
if tval == RelLib.Name.CUSTOM:
|
||||||
|
self.name.set_type((tval,attrs["type"]))
|
||||||
|
else:
|
||||||
|
self.name.set_type((tval,Utils.name_types[tval]))
|
||||||
if attrs.has_key("sort"):
|
if attrs.has_key("sort"):
|
||||||
self.name.set_sort_as(int(attrs["sort"]))
|
self.name.set_sort_as(int(attrs["sort"]))
|
||||||
if attrs.has_key("display"):
|
if attrs.has_key("display"):
|
||||||
@ -1242,7 +1254,6 @@ class GrampsParser:
|
|||||||
self.person.set_death_ref(ref)
|
self.person.set_death_ref(ref)
|
||||||
else:
|
else:
|
||||||
self.person.add_event_ref(ref)
|
self.person.add_event_ref(ref)
|
||||||
print self.event.get_date()
|
|
||||||
self.db.commit_event(self.event,self.trans,self.change)
|
self.db.commit_event(self.event,self.trans,self.change)
|
||||||
self.event = None
|
self.event = None
|
||||||
|
|
||||||
@ -1254,6 +1265,7 @@ class GrampsParser:
|
|||||||
self.name.set_type("Birth Name")
|
self.name.set_type("Birth Name")
|
||||||
self.person.set_primary_name (self.name)
|
self.person.set_primary_name (self.name)
|
||||||
self.person.get_primary_name().build_sort_name()
|
self.person.get_primary_name().build_sort_name()
|
||||||
|
print "*",self.person.primary_name.get_name()
|
||||||
self.name = None
|
self.name = None
|
||||||
|
|
||||||
def stop_ref(self,tag):
|
def stop_ref(self,tag):
|
||||||
@ -1293,6 +1305,7 @@ class GrampsParser:
|
|||||||
|
|
||||||
def stop_person(self,*tag):
|
def stop_person(self,*tag):
|
||||||
self.db.commit_person(self.person,self.trans,self.change)
|
self.db.commit_person(self.person,self.trans,self.change)
|
||||||
|
print self.person.handle,self.person.primary_name.get_name()
|
||||||
self.person = None
|
self.person = None
|
||||||
while gtk.events_pending():
|
while gtk.events_pending():
|
||||||
gtk.main_iteration()
|
gtk.main_iteration()
|
||||||
|
@ -2369,6 +2369,7 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
|
|||||||
@param the_type: Type to assign to the Event
|
@param the_type: Type to assign to the Event
|
||||||
@type the_type: tuple
|
@type the_type: tuple
|
||||||
"""
|
"""
|
||||||
|
assert type(the_type) == tuple
|
||||||
self.type = the_type
|
self.type = the_type
|
||||||
|
|
||||||
def get_type(self):
|
def get_type(self):
|
||||||
@ -3535,6 +3536,7 @@ class Attribute(PrivateSourceNote):
|
|||||||
|
|
||||||
def set_type(self,val):
|
def set_type(self,val):
|
||||||
"""sets the type (or key) of the Attribute instance"""
|
"""sets the type (or key) of the Attribute instance"""
|
||||||
|
assert type(the_type) == tuple
|
||||||
self.type = val
|
self.type = val
|
||||||
|
|
||||||
def get_type(self):
|
def get_type(self):
|
||||||
@ -3801,9 +3803,10 @@ class Name(PrivateSourceNote,DateBase):
|
|||||||
"""
|
"""
|
||||||
self.prefix = val
|
self.prefix = val
|
||||||
|
|
||||||
def set_type(self,type):
|
def set_type(self,the_type):
|
||||||
"""sets the type of the Name instance"""
|
"""sets the type of the Name instance"""
|
||||||
self.type = type
|
assert type(the_type) == tuple
|
||||||
|
self.type = the_type
|
||||||
|
|
||||||
def get_type(self):
|
def get_type(self):
|
||||||
"""returns the type of the Name instance"""
|
"""returns the type of the Name instance"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user