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