* src/EditSource.py, src/ListBox.py, src/ReadGedcom.py, src/WriteGedcom.py: Constants moved from const to Utils and RelLib
svn: r4746
This commit is contained in:
parent
7db59a7cab
commit
d8e28d4c4c
@ -1,3 +1,7 @@
|
|||||||
|
2005-05-31 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
|
* src/EditSource.py, src/ListBox.py, src/ReadGedcom.py,
|
||||||
|
src/WriteGedcom.py: Constants moved from const to Utils and RelLib
|
||||||
|
|
||||||
2005-05-31 Alex Roitman <shura@gramps-project.org>
|
2005-05-31 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/AutoComp.py (StandardCustomSelector): Add class to handle
|
* src/AutoComp.py (StandardCustomSelector): Add class to handle
|
||||||
(int,str) selections including custom strings.
|
(int,str) selections including custom strings.
|
||||||
|
@ -424,17 +424,17 @@ class EditSource:
|
|||||||
import EventEdit
|
import EventEdit
|
||||||
event = self.db.get_event_from_handle(handle)
|
event = self.db.get_event_from_handle(handle)
|
||||||
event_name = event.get_name()
|
event_name = event.get_name()
|
||||||
if const.family_events.has_key(event_name):
|
if Utils.family_events.has_key(event_name):
|
||||||
EventEdit.EventEditor(
|
EventEdit.EventEditor(
|
||||||
self,", ", const.marriageEvents, const.family_events,
|
self,", ", const.marriageEvents, Utils.family_events,
|
||||||
event, None, 0, None, None, self.db.readonly)
|
event, None, 0, None, None, self.db.readonly)
|
||||||
elif const.personal_events.has_key(event_name):
|
elif Utils.personal_events.has_key(event_name):
|
||||||
EventEdit.EventEditor(
|
EventEdit.EventEditor(
|
||||||
self,", ", const.personalEvents, const.personal_events,
|
self,", ", const.personalEvents, Utils.personal_events,
|
||||||
event, None, 0, None, None, self.db.readonly)
|
event, None, 0, None, None, self.db.readonly)
|
||||||
elif event_name in ["Birth","Death"]:
|
elif event_name in ["Birth","Death"]:
|
||||||
EventEdit.EventEditor(
|
EventEdit.EventEditor(
|
||||||
self,", ", const.personalEvents, const.personal_events,
|
self,", ", const.personalEvents, Utils.personal_events,
|
||||||
event, None, 1, None, None, self.db.readonly)
|
event, None, 1, None, None, self.db.readonly)
|
||||||
elif data_type == 3:
|
elif data_type == 3:
|
||||||
import EditPlace
|
import EditPlace
|
||||||
|
@ -196,7 +196,7 @@ class AttrListBox(ReorderListBox):
|
|||||||
|
|
||||||
def __init__(self, parent, person, obj, label, button_list):
|
def __init__(self, parent, person, obj, label, button_list):
|
||||||
|
|
||||||
attrlist = const.personal_attributes
|
attrlist = Utils.personal_attributes
|
||||||
|
|
||||||
titles = [
|
titles = [
|
||||||
# Title Sort Col, Size, Type
|
# Title Sort Col, Size, Type
|
||||||
@ -219,7 +219,7 @@ class AttrListBox(ReorderListBox):
|
|||||||
def add(self,obj):
|
def add(self,obj):
|
||||||
"""Brings up the AttributeEditor for a new attribute"""
|
"""Brings up the AttributeEditor for a new attribute"""
|
||||||
AttrEdit.AttributeEditor(self.parent, None, self.name,
|
AttrEdit.AttributeEditor(self.parent, None, self.name,
|
||||||
const.personal_attributes,
|
Utils.personal_attributes,
|
||||||
self.edit_callback,self.parent.window)
|
self.edit_callback,self.parent.window)
|
||||||
|
|
||||||
def update(self,obj):
|
def update(self,obj):
|
||||||
@ -227,7 +227,7 @@ class AttrListBox(ReorderListBox):
|
|||||||
if node:
|
if node:
|
||||||
attr = self.list_model.get_object(node)
|
attr = self.list_model.get_object(node)
|
||||||
AttrEdit.AttributeEditor(self.parent, attr, self.name,
|
AttrEdit.AttributeEditor(self.parent, attr, self.name,
|
||||||
const.personal_attributes,
|
Utils.personal_attributes,
|
||||||
self.edit_callback,self.parent.window)
|
self.edit_callback,self.parent.window)
|
||||||
|
|
||||||
def display_data(self,attr):
|
def display_data(self,attr):
|
||||||
@ -254,7 +254,7 @@ class EventListBox(ReorderListBox):
|
|||||||
for event_ref in person.get_event_ref_list():
|
for event_ref in person.get_event_ref_list():
|
||||||
self.data.append(parent.db.get_event_from_handle(event_ref.ref))
|
self.data.append(parent.db.get_event_from_handle(event_ref.ref))
|
||||||
|
|
||||||
eventnames = const.personal_events.values()
|
eventnames = Utils.personal_events.values()
|
||||||
|
|
||||||
evalues = [
|
evalues = [
|
||||||
# Title Sort Col Size, Type Argument
|
# Title Sort Col Size, Type Argument
|
||||||
@ -288,8 +288,8 @@ class EventListBox(ReorderListBox):
|
|||||||
def add(self,obj):
|
def add(self,obj):
|
||||||
"""Brings up the EventEditor for a new event"""
|
"""Brings up the EventEditor for a new event"""
|
||||||
EventEdit.EventEditor(
|
EventEdit.EventEditor(
|
||||||
self.parent, self.name, const.personal_events,
|
self.parent, self.name, Utils.personal_events,
|
||||||
const.personal_events, None, None, 0,
|
Utils.personal_events, None, None, 0,
|
||||||
self.edit_callback, noedit=self.db.readonly)
|
self.edit_callback, noedit=self.db.readonly)
|
||||||
|
|
||||||
def update(self,obj):
|
def update(self,obj):
|
||||||
@ -298,8 +298,8 @@ class EventListBox(ReorderListBox):
|
|||||||
return
|
return
|
||||||
event = self.list_model.get_object(node)
|
event = self.list_model.get_object(node)
|
||||||
EventEdit.EventEditor(
|
EventEdit.EventEditor(
|
||||||
self.parent, self.name, const.personal_events,
|
self.parent, self.name, Utils.personal_events,
|
||||||
const.personal_events, event, None, 0,
|
Utils.personal_events, event, None, 0,
|
||||||
self.edit_callback, noedit=self.db.readonly)
|
self.edit_callback, noedit=self.db.readonly)
|
||||||
|
|
||||||
def display_data(self,event):
|
def display_data(self,event):
|
||||||
|
@ -83,15 +83,15 @@ file_systems = {
|
|||||||
"SMBFS" : _('Networked Windows file system')
|
"SMBFS" : _('Networked Windows file system')
|
||||||
}
|
}
|
||||||
|
|
||||||
rel_types = (const.CHILD_BIRTH,
|
rel_types = (RelLib.Person.CHILD_BIRTH,
|
||||||
const.CHILD_UNKNOWN,
|
RelLib.Person.CHILD_UNKNOWN,
|
||||||
const.CHILD_NONE)
|
RelLib.Person.CHILD_NONE)
|
||||||
|
|
||||||
pedi_type = {
|
pedi_type = {
|
||||||
'birth' : const.CHILD_BIRTH,
|
'birth' : RelLib.Person.CHILD_BIRTH,
|
||||||
'natural': const.CHILD_BIRTH,
|
'natural': RelLib.Person.CHILD_BIRTH,
|
||||||
'adopted': const.CHILD_ADOPTED,
|
'adopted': RelLib.Person.CHILD_ADOPTED,
|
||||||
'foster' : const.CHILD_FOSTER,
|
'foster' : RelLib.Person.CHILD_FOSTER,
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -100,14 +100,14 @@ pedi_type = {
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
ged2gramps = {}
|
ged2gramps = {}
|
||||||
for _val in const.personalConstantEvents.keys():
|
for _val in Utils.personalConstantEvents.keys():
|
||||||
_key = const.personalConstantEvents[_val]
|
_key = Utils.personalConstantEvents[_val]
|
||||||
if _key != "":
|
if _key != "":
|
||||||
ged2gramps[_key] = _val
|
ged2gramps[_key] = _val
|
||||||
|
|
||||||
ged2fam = {}
|
ged2fam = {}
|
||||||
for _val in const.familyConstantEvents.keys():
|
for _val in Utils.familyConstantEvents.keys():
|
||||||
_key = const.familyConstantEvents[_val]
|
_key = Utils.familyConstantEvents[_val]
|
||||||
if _key != "":
|
if _key != "":
|
||||||
ged2fam[_key] = _val
|
ged2fam[_key] = _val
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ class GedcomParser:
|
|||||||
|
|
||||||
self.error_count = 0
|
self.error_count = 0
|
||||||
|
|
||||||
amap = const.personalConstantAttributes
|
amap = Utils.personalConstantAttributes
|
||||||
self.attrs = amap.values()
|
self.attrs = amap.values()
|
||||||
self.gedattr = {}
|
self.gedattr = {}
|
||||||
for val in amap.keys():
|
for val in amap.keys():
|
||||||
@ -781,8 +781,8 @@ class GedcomParser:
|
|||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_ftw_relations(self,level):
|
def parse_ftw_relations(self,level):
|
||||||
mrel = const.CHILD_BIRTH
|
mrel = RelLib.Person.CHILD_BIRTH
|
||||||
frel = const.CHILD_BIRTH
|
frel = RelLib.Person.CHILD_BIRTH
|
||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
@ -791,17 +791,17 @@ class GedcomParser:
|
|||||||
return (mrel,frel)
|
return (mrel,frel)
|
||||||
# FTW
|
# FTW
|
||||||
elif matches[1] == "_FREL":
|
elif matches[1] == "_FREL":
|
||||||
frel = pedi_type.get(matches[2].lower(),const.CHILD_BIRTH)
|
frel = pedi_type.get(matches[2].lower(),RelLib.Person.CHILD_BIRTH)
|
||||||
# FTW
|
# FTW
|
||||||
elif matches[1] == "_MREL":
|
elif matches[1] == "_MREL":
|
||||||
mrel = pedi_type.get(matches[2].lower(),const.CHILD_BIRTH)
|
mrel = pedi_type.get(matches[2].lower(),RelLib.Person.CHILD_BIRTH)
|
||||||
elif matches[1] == "ADOP":
|
elif matches[1] == "ADOP":
|
||||||
mrel = const.CHILD_ADOPTED
|
mrel = RelLib.Person.CHILD_ADOPTED
|
||||||
frel = const.CHILD_ADOPTED
|
frel = RelLib.Person.CHILD_ADOPTED
|
||||||
# Legacy
|
# Legacy
|
||||||
elif matches[1] == "_STAT":
|
elif matches[1] == "_STAT":
|
||||||
mrel = const.CHILD_BIRTH
|
mrel = RelLib.Person.CHILD_BIRTH
|
||||||
frel = const.CHILD_BIRTH
|
frel = RelLib.Person.CHILD_BIRTH
|
||||||
#mrel = matches[2]
|
#mrel = matches[2]
|
||||||
#frel = matches[2]
|
#frel = matches[2]
|
||||||
# Legacy _PREF
|
# Legacy _PREF
|
||||||
@ -1003,7 +1003,7 @@ class GedcomParser:
|
|||||||
else:
|
else:
|
||||||
if ftype in rel_types:
|
if ftype in rel_types:
|
||||||
self.person.add_parent_family_handle(
|
self.person.add_parent_family_handle(
|
||||||
handle, const.CHILD_BIRTH, const.CHILD_BIRTH)
|
handle, RelLib.Person.CHILD_BIRTH, RelLib.Person.CHILD_BIRTH)
|
||||||
else:
|
else:
|
||||||
if self.person.get_main_parents_family_handle() == handle:
|
if self.person.get_main_parents_family_handle() == handle:
|
||||||
self.person.set_main_parent_family_handle(None)
|
self.person.set_main_parent_family_handle(None)
|
||||||
@ -1129,7 +1129,7 @@ class GedcomParser:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def parse_famc_type(self,level):
|
def parse_famc_type(self,level):
|
||||||
ftype = const.CHILD_BIRTH
|
ftype = RelLib.Person.CHILD_BIRTH
|
||||||
note = ""
|
note = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
@ -1477,8 +1477,8 @@ class GedcomParser:
|
|||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_adopt_famc(self,level):
|
def parse_adopt_famc(self,level):
|
||||||
mrel = const.CHILD_ADOPTED
|
mrel = RelLib.Person.CHILD_ADOPTED
|
||||||
frel = const.CHILD_ADOPTED
|
frel = RelLib.Person.CHILD_ADOPTED
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
@ -1486,9 +1486,9 @@ class GedcomParser:
|
|||||||
return (mrel,frel)
|
return (mrel,frel)
|
||||||
elif matches[1] == "ADOP":
|
elif matches[1] == "ADOP":
|
||||||
if matches[2] == "HUSB":
|
if matches[2] == "HUSB":
|
||||||
mrel = const.CHILD_BIRTH
|
mrel = RelLib.Person.CHILD_BIRTH
|
||||||
elif matches[2] == "WIFE":
|
elif matches[2] == "WIFE":
|
||||||
frel = const.CHILD_BIRTH
|
frel = RelLib.Person.CHILD_BIRTH
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
return None
|
return None
|
||||||
|
@ -697,8 +697,8 @@ class GedcomWriter:
|
|||||||
continue
|
continue
|
||||||
name = event.get_name()
|
name = event.get_name()
|
||||||
val = ""
|
val = ""
|
||||||
if const.familyConstantEvents.has_key(name):
|
if Utils.familyConstantEvents.has_key(name):
|
||||||
val = const.familyConstantEvents[name]
|
val = Utils.familyConstantEvents[name]
|
||||||
if val == "":
|
if val == "":
|
||||||
val = self.target_ged.gramps2tag(name)
|
val = self.target_ged.gramps2tag(name)
|
||||||
|
|
||||||
@ -831,8 +831,8 @@ class GedcomWriter:
|
|||||||
continue
|
continue
|
||||||
name = event.get_name()
|
name = event.get_name()
|
||||||
val = ""
|
val = ""
|
||||||
if const.personalConstantEvents.has_key(name):
|
if Utils.personalConstantEvents.has_key(name):
|
||||||
val = const.personalConstantEvents[name]
|
val = Utils.personalConstantEvents[name]
|
||||||
if val == "":
|
if val == "":
|
||||||
val = self.target_ged.gramps2tag(name)
|
val = self.target_ged.gramps2tag(name)
|
||||||
|
|
||||||
@ -843,8 +843,8 @@ class GedcomWriter:
|
|||||||
for f in person.get_parent_family_handle_list():
|
for f in person.get_parent_family_handle_list():
|
||||||
mrel = f[1]
|
mrel = f[1]
|
||||||
frel = f[2]
|
frel = f[2]
|
||||||
if (mrel == const.CHILD_ADOPTED or
|
if (mrel == RelLib.Person.CHILD_ADOPTED or
|
||||||
frel == const.CHILD_ADOPTED):
|
frel == RelLib.Person.CHILD_ADOPTED):
|
||||||
fam = f[0]
|
fam = f[0]
|
||||||
break
|
break
|
||||||
if fam:
|
if fam:
|
||||||
@ -870,8 +870,8 @@ class GedcomWriter:
|
|||||||
for f in person.get_parent_family_handle_list():
|
for f in person.get_parent_family_handle_list():
|
||||||
mrel = f[1]
|
mrel = f[1]
|
||||||
frel = f[2]
|
frel = f[2]
|
||||||
if (mrel == const.CHILD_ADOPTED or
|
if (mrel == RelLib.Person.CHILD_ADOPTED or
|
||||||
frel == const.CHILD_ADOPTED):
|
frel == RelLib.Person.CHILD_ADOPTED):
|
||||||
fam = f[0]
|
fam = f[0]
|
||||||
break
|
break
|
||||||
if fam:
|
if fam:
|
||||||
@ -892,8 +892,8 @@ class GedcomWriter:
|
|||||||
self.writeln("1 %s %s" % ( name, attr.get_value()))
|
self.writeln("1 %s %s" % ( name, attr.get_value()))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if const.personalConstantAttributes.has_key(name):
|
if Utils.personalConstantAttributes.has_key(name):
|
||||||
val = const.personalConstantAttributes[name]
|
val = Utils.personalConstantAttributes[name]
|
||||||
else:
|
else:
|
||||||
val = ""
|
val = ""
|
||||||
if val :
|
if val :
|
||||||
@ -973,7 +973,7 @@ class GedcomWriter:
|
|||||||
if self.flist.has_key(family[0]):
|
if self.flist.has_key(family[0]):
|
||||||
self.writeln("1 FAMC @%s@" % self.fid(family[0]))
|
self.writeln("1 FAMC @%s@" % self.fid(family[0]))
|
||||||
if self.adopt == GedcomInfo.ADOPT_PEDI:
|
if self.adopt == GedcomInfo.ADOPT_PEDI:
|
||||||
if family[1] == const.CHILD_ADOPTED:
|
if family[1] == RelLib.Person.CHILD_ADOPTED:
|
||||||
self.writeln("2 PEDI Adopted")
|
self.writeln("2 PEDI Adopted")
|
||||||
|
|
||||||
for family_handle in person.get_family_handle_list():
|
for family_handle in person.get_family_handle_list():
|
||||||
|
Loading…
Reference in New Issue
Block a user