Bug fixes, new child/parent relationship handling, remembering places

svn: r241
This commit is contained in:
Don Allingham 2001-07-13 00:01:04 +00:00
parent 25c2b21dda
commit e80b552a89
15 changed files with 1474 additions and 797 deletions

View File

@ -68,12 +68,16 @@ _date_format_list = [
_("DD-MM-YYYY"),
_("MM.DD.YYYY"),
_("DD.MM.YYYY"),
_("DD. Month Year")
_("DD. Month Year"),
_("YYYY/MM/DD"),
_("YYYY-MM-DD"),
_("YYYY.MM.DD"),
]
_date_entry_list = [
_("MM/DD/YYYY, MM.DD.YYYY, or MM-DD-YYYY"),
_("DD/MM/YYYY, DD.MM.YYYY, or DD-MM-YYYY")
_("DD/MM/YYYY, DD.MM.YYYY, or DD-MM-YYYY"),
_("YYYY/MM/DD, YYYY.MM.DD, or YYYY-MM-DD"),
]
_name_format_list = [
@ -102,6 +106,7 @@ output_preference = None
report_dir = "./"
web_dir = "./"
db_dir = "./"
id_visible = 0
#-------------------------------------------------------------------------
#
@ -142,6 +147,7 @@ def loadConfig(call):
global autoload
global owner
global usetabs
global id_visible
global show_detail
global hide_altnames
global lastfile
@ -161,6 +167,7 @@ def loadConfig(call):
_callback = call
lastfile = gnome.config.get_string("/gramps/data/LastFile")
usetabs = gnome.config.get_bool("/gramps/config/UseTabs")
id_visible = gnome.config.get_bool("/gramps/config/IdVisible")
show_detail = gnome.config.get_bool("/gramps/config/ShowDetail")
status_bar = gnome.config.get_int("/gramps/config/StatusBar")
display_attr = gnome.config.get_bool("/gramps/config/DisplayAttr")
@ -229,6 +236,8 @@ def loadConfig(call):
autoload = 1
if usetabs == None:
usetabs = 0
if id_visible == None:
id_visible = 0
if show_detail == None:
show_detail = 0
if status_bar == None:
@ -318,6 +327,7 @@ def on_propertybox_apply(obj,page):
global nameof
global owner
global usetabs
global id_visible
global status_bar
global display_attr
global attr_name
@ -337,6 +347,7 @@ def on_propertybox_apply(obj,page):
display_attr = prefsTop.get_widget("attr_display").get_active()
attr_name = string.strip(prefsTop.get_widget("attr_name").get_text())
usetabs = prefsTop.get_widget("usetabs").get_active()
id_visible = prefsTop.get_widget("gid_visible").get_active()
hide_altnames = prefsTop.get_widget("display_altnames").get_active()
paper_obj = prefsTop.get_widget("paper_size").get_menu().get_active()
output_obj = prefsTop.get_widget("output_format").get_menu().get_active()
@ -364,6 +375,7 @@ def on_propertybox_apply(obj,page):
output_preference = output_obj.get_data("d")
gnome.config.set_bool("/gramps/config/UseTabs",usetabs)
gnome.config.set_bool("/gramps/config/IdVisible",id_visible)
gnome.config.set_bool("/gramps/config/ShowDetail",show_detail)
gnome.config.set_int("/gramps/config/StatusBar",status_bar)
gnome.config.set_bool("/gramps/config/DisplayAttr",display_attr)
@ -499,6 +511,7 @@ def display_preferences_box():
pbox = prefsTop.get_widget("propertybox")
auto = prefsTop.get_widget("autoload")
vis = prefsTop.get_widget("gid_visible")
tabs = prefsTop.get_widget("usetabs")
detail = prefsTop.get_widget("showdetail")
display_attr_obj = prefsTop.get_widget("attr_display")
@ -506,6 +519,7 @@ def display_preferences_box():
auto.set_active(autoload)
detail.set_active(show_detail)
tabs.set_active(usetabs)
vis.set_active(id_visible)
if status_bar == 0:
prefsTop.get_widget("stat1").set_active(1)

View File

@ -626,16 +626,51 @@ class SingleDate:
if self.month == -1:
retval = str(self.year)
elif self.year == -1:
retval = "%d%s??%s??" % (self.month+1,sep,sep)
retval = "%02d%s??%s??" % (self.month+1,sep,sep)
else:
retval = "%d%s??%s%d" % (self.month+1,sep,sep,self.year)
retval = "%02d%s??%s%04d" % (self.month+1,sep,sep,self.year)
elif self.month == -1:
retval = "??%s%d%s%d" % (sep,self.day,sep,self.year)
retval = "??%s%02d%s%04d" % (sep,self.day,sep,self.year)
else:
if self.year == -1:
retval = "%d%s%d%s????" % (self.month+1,sep,self.day,sep)
retval = "%02d%s%02d%s????" % (self.month+1,sep,self.day,sep)
else:
retval = "%d%s%d%s%d" % (self.month+1,sep,self.day,sep,self.year)
retval = "%02d%s%02d%s%04d" % (self.month+1,sep,self.day,sep,self.year)
if self.mode == SingleDate.about:
retval = "%s %s" % (_("ABT"),retval)
if self.mode == SingleDate.before:
retval = "%s %s" % (_("BEFORE"),retval)
elif self.mode == SingleDate.after:
retval = "%s %s" % (_("AFTER"),retval)
return retval
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def get_yyyymmdd(self,sep):
retval = ""
if self.month == -1 and self.day == -1 and self.year == -1 :
pass
elif self.day == -1:
if self.month == -1:
retval = str(self.year)
elif self.year == -1:
retval = "????%s%02d%s??" % (sep,self.month+1,sep)
else:
retval = "%04d%s%02d%s??" % (self.year,sep,self.month+1,sep)
elif self.month == -1:
retval = "%04d%s??%s%02d" % (self.year,sep,sep,self.day)
else:
if self.year == -1:
retval = "????%02d%s%02d%s" % (self.month+1,sep,self.day,sep)
else:
retval = "%02d%s%02d%s%02d" % (self.year,sep,self.month+1,sep,self.day)
if self.mode == SingleDate.about:
retval = "%s %s" % (_("ABT"),retval)
@ -685,16 +720,16 @@ class SingleDate:
if self.month == -1:
retval = str(self.year)
elif self.year == -1:
retval = "??%s%d%s??" % (sep,self.month+1,sep)
retval = "??%s%02d%s??" % (sep,self.month+1,sep)
else:
retval = "??%s%d%s%d" % (sep,self.month+1,sep,self.year)
retval = "??%s%02d%s%04d" % (sep,self.month+1,sep,self.year)
elif self.month == -1:
retval = "%d%s??%s%d" % (self.day,sep,sep,self.year)
retval = "%02d%s??%s%04d" % (self.day,sep,sep,self.year)
else:
if self.year == -1:
retval = "%d%s%d%s????" % (self.day,sep,self.month+1,sep)
retval = "%02d%s%02d%s????" % (self.day,sep,self.month+1,sep)
else:
retval = "%d%s%d%s%d" % (self.day,sep,self.month+1,sep,self.year)
retval = "%02d%s%02d%s%04d" % (self.day,sep,self.month+1,sep,self.year)
if self.mode == SingleDate.about:
retval = "%s %s" % (_("ABT"),retval)
@ -728,13 +763,39 @@ class SingleDate:
def getFmt9(self):
return self.get_ddmmyyyy(".")
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def getFmt11(self):
return self.get_yyyymmdd("/")
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def getFmt12(self):
return self.get_yyyymmdd("-")
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def getFmt13(self):
return self.get_yyyymmdd(".")
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
fmtFunc = [ getFmt1, getFmt2, getFmt3, getFmt4, getFmt5, getFmt6,
getFmt7, getFmt8, getFmt9, getFmt10 ]
getFmt7, getFmt8, getFmt9, getFmt10, getFmt11, getFmt12,
getFmt13]
#--------------------------------------------------------------------
#
@ -824,7 +885,12 @@ class SingleDate:
self.day = int(matches[2])
except ValueError:
self.day = -1
else:
val = matches[3]
if val == None or val[0] == '?':
self.year = -1
else:
self.year = int(val)
elif Date.entryCode == 1:
try:
self.month = int(matches[2])-1
if self.month > 11:
@ -835,11 +901,27 @@ class SingleDate:
self.day = int(matches[1])
except ValueError:
self.day = -1
val = matches[3]
if val == None or val[0] == '?':
self.year = -1
val = matches[3]
if val == None or val[0] == '?':
self.year = -1
else:
self.year = int(val)
else:
self.year = int(val)
try:
self.month = int(matches[2])-1
if self.month > 11:
raise Date.Error,text
except ValueError:
self.month = -1
try:
self.day = int(matches[3])
except ValueError:
self.day = -1
val = matches[1]
if val == None or val[0] == '?':
self.year = -1
else:
self.year = int(val)
return 1
match = SingleDate.fmt1.match(text)

View File

@ -198,30 +198,6 @@
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>birthPlace</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox19</name>
@ -280,6 +256,42 @@
</child>
</widget>
</widget>
<widget>
<class>GtkCombo</class>
<name>bp_combo</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>birthPlace</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
</widget>
@ -390,31 +402,6 @@
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>deathPlace</name>
<width>200</width>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox20</name>
@ -473,6 +460,42 @@
</child>
</widget>
</widget>
<widget>
<class>GtkCombo</class>
<name>dp_combo</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>deathPlace</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
</widget>
@ -1556,38 +1579,6 @@
</child>
</widget>
<widget>
<class>GnomeEntry</class>
<name>ePlaceBox</name>
<history_id>event_place</history_id>
<max_saved>15</max_saved>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GnomeEntry:entry</child_name>
<name>eventPlace</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
<widget>
<class>GnomeEntry</class>
<name>eDescBox</name>
@ -1736,6 +1727,42 @@
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>eventPlace_combo</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>eventPlace</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
<widget>

View File

@ -188,6 +188,10 @@ class EditPerson:
self.name_list.set_column_visibility(1,Config.show_detail)
self.attr_list.set_column_visibility(2,Config.show_detail)
self.address_list.set_column_visibility(2,Config.show_detail)
if len(const.places) > 0:
self.get_widget("dp_combo").set_popdown_strings(const.places)
self.get_widget("bp_combo").set_popdown_strings(const.places)
self.get_widget("eventPlace_combo").set_popdown_strings(const.places)
if Config.display_attr:
self.get_widget("user_label").set_text(Config.attr_name)
@ -219,7 +223,7 @@ class EditPerson:
self.bplace.set_text(birth.getPlace())
self.ddate.set_text(death.getDate())
self.dplace.set_text(death.getPlace())
# load photos into the photo window
photo_list = person.getPhotoList()
if len(photo_list) != 0:
@ -734,7 +738,7 @@ def on_add_attr_clicked(obj):
attr = Attribute()
name = edit_person_obj.attr_type.get_text()
attr.setType(const.set_pattr(name))
attr.setType(const.save_pattr(name))
attr.setValue(edit_person_obj.attr_value.get_text())
if name not in const.personalAttributes:
@ -792,6 +796,13 @@ def on_event_add_clicked(obj):
menu = edit_person_obj.get_widget("personalEvents")
menu.set_popdown_strings(const.personalEvents)
if place not in const.places:
const.places.append(place)
const.places.sort()
edit_person_obj.get_widget("dp_place").set_popdown_strings(const.places)
edit_person_obj.get_widget("bp_place").set_popdown_strings(const.places)
edit_person_obj.get_widget("eventPlace_combo").set_popdown_strings(const.places)
edit_person_obj.person.addEvent(event)
edit_person_obj.redraw_event_list()
utils.modified()
@ -1015,6 +1026,9 @@ def on_apply_person_clicked(obj):
if surname != name.getSurname():
name.setSurname(surname)
if surname not in edit_person_obj.surname_list:
edit_person_obj.surname_list.append(surname)
edit_person_obj.surname_list.sort()
utils.modified()
if given != name.getFirstName():
@ -1037,6 +1051,11 @@ def on_apply_person_clicked(obj):
ddate = edit_person_obj.ddate.get_text()
dplace = edit_person_obj.dplace.get_text()
for place in [ dplace, bplace ]:
if place not in const.places:
const.places.append(place)
const.places.sort()
newBirth = Event()
newBirth.set("Birth",bdate,bplace,"")

View File

@ -272,7 +272,11 @@ class GrampsParser(handler.ContentHandler):
family = self.db.findFamilyNoMap(u2l(attrs["ref"]))
if attrs.has_key("type"):
type = u2l(attrs["type"])
self.person.AltFamilyList.append((family,type))
self.person.AltFamilyList.append((family,type,type))
elif attrs.has_key("mrel"):
mrel = u2l(attrs["mrel"])
frel = u2l(attrs["frel"])
self.person.AltFamilyList.append((family,mrel,frel))
else:
self.person.MainFamily = family

View File

@ -22,16 +22,11 @@ from gtk import *
import sys
if sys.version[:3] == "1.5":
color_ok = 1
else:
color_ok = 0
enable = 0
oddbg = (0xffff,0xffff,0xffff)
evenbg = (0xffff,0xffff,0xffff)
oddfg = (0,0,0)
evenfg = (0,0,0)
_enable = 0
oddbg = (0xffff,0xffff,0xffff)
evenbg = (0xffff,0xffff,0xffff)
oddfg = (0,0,0)
evenfg = (0,0,0)
class ColorList:
def __init__(self,clist,increment):
@ -39,15 +34,18 @@ class ColorList:
self.modval = 2*increment
self.increment = increment
self.clist = clist
if color_ok:
self.color_ok = 1
try:
self.oddbg = GdkColor(oddbg[0],oddbg[1],oddbg[2])
self.oddfg = GdkColor(oddfg[0],oddfg[1],oddfg[2])
self.evenbg = GdkColor(evenbg[0],evenbg[1],evenbg[2])
self.evenfg = GdkColor(evenfg[0],evenfg[1],evenfg[2])
except OverflowError:
self.color_ok = 0
def add(self,list):
self.clist.append(list)
if enable and color_ok:
if _enable and self.color_ok:
if self.index % self.modval < self.increment:
self.clist.set_background(self.index,self.oddbg)
self.clist.set_foreground(self.index,self.oddfg)
@ -61,12 +59,9 @@ class ColorList:
self.clist.set_row_data(self.index-1,data)
def set_enable(val):
global enable
global _enable
if color_ok:
enable = val
else:
enable = 0
_enable = val
def get_enable():
return enable
return _enable

View File

@ -434,8 +434,8 @@ class Person:
def getAltFamilyList(self) :
return self.AltFamilyList
def addAltFamily(self,family,type) :
self.AltFamilyList.append((family,type))
def addAltFamily(self,family,mrel,frel) :
self.AltFamilyList.append((family,mrel,frel))
def removeAltFamily(self,family):
index = 0
@ -888,6 +888,16 @@ class RelDataBase:
map[attr.getName()] = 1
return map.keys()
def getPlaces(self):
map = {}
for family in self.familyMap.values():
for attr in family.getEventList():
map[attr.getPlace()] = 1
for person in self.personMap.values():
for attr in person.getEventList():
map[attr.getPlace()] = 1
return map.keys()
def getFamilyRelationTypes(self):
map = {}
for family in self.familyMap.values():

View File

@ -307,8 +307,8 @@ def exportData(database, filename, callback):
write_ref(g,"childof",person.getMainFamily())
for alt in person.getAltFamilyList():
g.write("<childof ref=\"" + str(alt[0].getId()))
g.write("\" type=\"" + alt[1] + "\"/>\n")
g.write("<childof ref=\"%s\" mrel=\"%s\" frel=\"%s\"/>\n" % \
(str(alt[0].getId()), alt[1], alt[2]))
for family in person.getFamilyList():
write_ref(g,"parentin",family)

View File

@ -176,6 +176,35 @@
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>gid_visible</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_object_toggled</handler>
<object>propertybox</object>
<last_modification_time>Thu, 12 Jul 2001 13:42:44 GMT</last_modification_time>
</signal>
<label>Display gramps ID in lists</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget>
<widget>

View File

@ -105,11 +105,12 @@ female = _("female")
output_formats = ["OpenOffice", "AbiWord", "PDF", "HTML" ]
childRelations = [
"Birth",
"Adopted",
"Other"
]
childRelations = {
_("Birth") : "Birth",
_("Adopted") : "Adopted",
_("Stepchild") : "Stepchild",
_("Unknown") : "Unknown",
}
#-------------------------------------------------------------------------
#
@ -171,6 +172,7 @@ def save_fevent(st):
#-------------------------------------------------------------------------
personalConstantEvents = {
"Adopted" : "ADOP",
"Adult Christening" : "CHRA",
"Alternate Birth" : "BIRT",
"Alternate Death" : "DEAT",
"Baptism (LDS)" : "BAPL",
@ -179,6 +181,7 @@ personalConstantEvents = {
"Bas Mitzvah" : "BASM",
"Burial" : "BURI",
"Cause Of Death" : "CAUS",
"Ordination" : "ORID",
"Census" : "CENS",
"Christening" : "CHR" ,
"Confirmation" : "CONF",
@ -188,21 +191,24 @@ personalConstantEvents = {
"Education" : "EDUC",
"Elected" : "_ELEC",
"Emigration" : "EMIG",
"First Communion" : "FCOM",
"Graduation" : "GRAD",
"Military Service" : "_MILT",
"Naturalization" : "NATU",
"Immigration" : "IMMI",
"Occupation" : "OCCU",
"Probate" : "PROB",
"Religion" : "RELI",
"Residence" : "RESI",
"Residence" : "RESI",
"Retirement" : "RETI"
"Retirement" : "RETI",
"Will" : "WILL"
}
_pe_e2l = {
"Adopted" : _("Adopted"),
"Alternate Birth" : _("Alternate Birth"),
"Alternate Death" : _("Alternate Death"),
"Adult Christening" : _("Adult Christening"),
"Baptism (LDS)" : _("Baptism (LDS)"),
"Baptism" : _("Baptism"),
"Bar Mitzvah" : _("Bar Mitzvah"),
@ -218,14 +224,18 @@ _pe_e2l = {
"Education" : _("Education"),
"Elected" : _("Elected"),
"Emigration" : _("Emigration"),
"First Communion" : _("First Communion"),
"Immigration" : _("Immigration"),
"Graduation" : _("Graduation"),
"Military Service" : _("Military Service"),
"Naturalization" : _("Naturalization"),
"Occupation" : _("Occupation"),
"Ordination" : _("Ordination"),
"Probate" : _("Probate"),
"Religion" : _("Religion"),
"Residence" : _("Residence"),
"Retirement" : _("Retirement"),
"Will" : _("Will")
}
_pe_l2e = {}
@ -260,14 +270,18 @@ def save_pevent(st):
#
#-------------------------------------------------------------------------
personalConstantAttributes = {
"Caste" : "CAST",
"Description" : "DSCR",
"Identification Number" : "IDNO",
"National Origin" : "NATI",
"Social Security Number": "SSN"
}
_pa_e2l = {
"Caste" : _("Caste"),
"Description" : _("Description"),
"Identification Number" : _("Identification Number"),
"National Origin" : _("National Origin"),
"Social Security Number": _("Social Security Number")
}
@ -438,3 +452,4 @@ personalAttributes = initialize_personal_attribute_list()
marriageEvents = initialize_marriage_event_list()
familyAttributes = initialize_family_attribute_list()
familyRelations = initialize_family_relation_list()
places = []

File diff suppressed because it is too large Load Diff

View File

@ -148,6 +148,11 @@ def deathday(person):
else:
return ""
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def delete_event(widget, event):
widget.hide()
if utils.wasModified():
@ -217,42 +222,15 @@ def on_remove_child_clicked(obj):
utils.modified()
load_family()
#-------------------------------------------------------------------------
#
# Called when the user selects the edit marriage button on the family
# page.
#
#-------------------------------------------------------------------------
def on_edit_marriage_clicked(obj):
global queryTop
if not active_family:
add_spouse()
return
def on_add_sp_clicked(obj):
add_spouse()
queryTop = libglade.GladeXML(const.gladeFile,"marriageQuery")
def on_edit_sp_clicked(obj):
marriage_edit(active_family)
def on_delete_sp_clicked(obj):
delete_spouse()
queryTop.signal_autoconnect({
"on_marriageQuery_clicked" : on_marriageQuery_clicked,
"destroy_passed_object" : utils.destroy_passed_object
})
marriageQuery = queryTop.get_widget("marriageQuery")
marriageQuery.show()
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_marriageQuery_clicked(obj):
if queryTop.get_widget("addSpouse").get_active():
add_spouse()
elif queryTop.get_widget("editMarriage").get_active():
marriage_edit(active_family)
else:
delete_spouse()
utils.destroy_passed_object(obj)
#-------------------------------------------------------------------------
#
#
@ -261,6 +239,7 @@ def on_marriageQuery_clicked(obj):
def on_add_child_clicked(obj):
global select_child
global addChildList
global childWindow
select_child = None
@ -275,7 +254,8 @@ def on_add_child_clicked(obj):
selectChild = childWindow.get_widget("selectChild")
addChildList = childWindow.get_widget("addChild")
redraw_child_list(1)
addChildList.set_column_visibility(1,Config.id_visible)
redraw_child_list(2)
selectChild.show()
#-------------------------------------------------------------------------
@ -292,7 +272,8 @@ def redraw_child_list(filter):
for person in person_list:
if filter and person.getMainFamily() != None:
continue
addChildList.append([utils.phonebook_name(person),birthday(person)])
addChildList.append([utils.phonebook_name(person),birthday(person),\
str(person.getId())])
addChildList.set_row_data(index,person)
index = index + 1
@ -363,10 +344,13 @@ def on_addchild_ok_clicked(obj):
active_family.setMother(active_person)
active_person.addFamily(active_family)
if newChildWindow.get_widget("childStatus").get_active():
mrel = const.childRelations[newChildWindow.get_widget("mrel").get_text()]
frel = const.childRelations[newChildWindow.get_widget("frel").get_text()]
if mrel == "Birth" and frel == "Birth":
person.setMainFamily(active_family)
else:
person.addAltFamily(active_family,"Adopted")
person.addAltFamily(active_family,mrel,frel)
active_family.addChild(person)
@ -397,12 +381,18 @@ def on_save_child_clicked(obj):
active_family.setMother(active_person)
active_family.addChild(select_child)
family = select_child.getMainFamily()
if family != None:
family.removeChild(select_child)
select_child.setMainFamily(active_family)
mrel = const.childRelations[childWindow.get_widget("mrel").get_text()]
frel = const.childRelations[childWindow.get_widget("frel").get_text()]
if mrel == "Birth" and frel == "Birth":
family = select_child.getMainFamily()
if family != None and family != active_family:
family.removeChild(select_child)
select_child.setMainFamily(active_family)
else:
select_child.addAltFamily(active_family,mrel,frel)
utils.modified()
utils.destroy_passed_object(obj)
@ -427,37 +417,6 @@ def get_option_index(obj):
#
#
#-------------------------------------------------------------------------
def on_rtype_clicked(obj,a):
global family_window
active_item = obj.get_active()
index = get_option_index(obj)
type = const.childRelations[index]
select_father = None
select_mother = None
if type == "Birth":
fam = active_person.getMainFamily()
if fam:
select_father = fam.getFather()
select_mother = fam.getMother()
else:
for fam in active_person.getAltFamilyList():
if fam[1] == type:
select_father = fam[0].getFather()
select_mother = fam[0].getMother()
family_window.get_widget("fatherName").set_text(Config.nameof(select_father))
family_window.get_widget("motherName").set_text(Config.nameof(select_mother))
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_choose_parents_clicked(obj):
global select_mother
global select_father
@ -474,7 +433,6 @@ def on_choose_parents_clicked(obj):
family_window.signal_autoconnect({
"on_motherList_select_row" : on_motherList_select_row,
"on_fatherList_select_row" : on_fatherList_select_row,
"on_rtype_clicked" : on_rtype_clicked,
"on_save_parents_clicked" : on_save_parents_clicked,
"destroy_passed_object" : utils.destroy_passed_object
})
@ -497,21 +455,18 @@ def on_choose_parents_clicked(obj):
motherName.set_text(Config.nameof(select_mother))
motherList.set_data("mother_text",motherName)
menu = family_window.get_widget("rtype")
if active_parents == active_person.getMainFamily():
menu.set_history(0)
family_window.get_widget("mrel").set_text(_("Birth"))
family_window.get_widget("frel").set_text(_("Birth"))
else:
for fam in active_person.getAltFamilyList():
if active_parents == fam[0]:
type = fam[1]
for f in active_person.getAltFamilyList():
if f[0] == active_parents:
family_window.get_widget("mrel").set_text(_(f[1]))
family_window.get_widget("frel").set_text(_(f[2]))
break
if type == "Adopted":
menu.set_history(1)
else:
menu.set_history(2)
menu.get_menu().connect("deactivate",on_rtype_clicked,None)
family_window.get_widget("mrel").set_text(_("Unknown"))
family_window.get_widget("frel").set_text(_("Unknown"))
people = database.getPersonMap().values()
people.sort(sort.by_last_name)
@ -530,7 +485,7 @@ def on_choose_parents_clicked(obj):
mother_index = mother_index + 1
familyDialog.show()
#-------------------------------------------------------------------------
#
#
@ -559,6 +514,8 @@ def new_database_response(val):
const.marriageEvents = const.initialize_marriage_event_list()
const.familyAttributes = const.initialize_family_attribute_list()
const.familyRelations = const.initialize_family_relation_list()
const.places = []
database.new()
topWindow.set_title("Gramps")
active_person = None
@ -591,7 +548,9 @@ def marriage_edit(family):
#-------------------------------------------------------------------------
def full_update():
gtop.get_widget(NOTEBOOK).set_show_tabs(Config.usetabs)
gtop.get_widget("child_list").set_column_visibility(4,Config.show_detail)
clist = gtop.get_widget("child_list")
clist.set_column_visibility(4,Config.show_detail)
clist.set_column_visibility(1,Config.id_visible)
apply_filter()
load_family()
load_sources()
@ -872,22 +831,24 @@ def find_family(father,mother):
#
#
#-------------------------------------------------------------------------
def change_family_type(family,type):
def change_family_type(family,mrel,frel):
is_main = mrel == "Birth" and frel == "Birth"
if not family:
if type == "Birth":
if is_main:
main = active_person.getMainFamily()
if main:
main.removeChild(active_person)
active_person.setMainFamily(None)
else:
for fam in active_person.getAltFamilyList():
if fam[1] == type:
if is_main:
active_person.removeAltFamily(fam[0])
fam.removeChild(active_person)
return
elif family == active_person.getMainFamily():
if type != "Birth":
if is_main:
utils.modified()
active_person.setMainFamily(None)
found = 0
@ -903,21 +864,18 @@ def change_family_type(family,type):
else:
for fam in active_person.getAltFamilyList():
if family == fam[0]:
if type == "Birth":
if is_main:
active_person.setMainFamily(family)
active_person.removeAltFamily(family)
utils.modified()
return
if type != fam[1]:
fam[1] = type
if mrel != fam[1] or frel != fam[2]:
active_person.removeAltFamily(family)
active_person.addAltFamily(family,mrel,frel)
utils.modified()
return
if type == fam[1]:
active_person.removeAltFamily(fam[0])
fam[0].removeChild(active_person)
active_person.addAltFamily(family,type)
family.addChild(active_person)
utils.modified()
active_person.addAltFamily(family,mrel,frel)
utils.modified()
#-------------------------------------------------------------------------
#
@ -934,21 +892,10 @@ def on_save_parents_clicked(obj):
else:
family = None
index = get_option_index(family_window.get_widget("rtype").get_menu())
type = const.childRelations[index]
mrel = family_window.get_widget("mrel").get_text()
frel = family_window.get_widget("frel").get_text()
if family != active_family:
utils.modified()
if index == 0:
active_person.setMainFamily(family)
if family:
family.addChild(active_person)
else:
active_person.addAltFamily(family,type)
if family:
family.addChild(active_person)
else:
change_family_type(family,type)
change_family_type(family,mrel,frel)
active_mother = select_mother
active_father = select_father
@ -1125,6 +1072,23 @@ def add_spouse():
spouseList.set_row_data(index,person)
index = index + 1
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_delete_parents_clicked(obj):
if not active_parents:
return
active_parents.removeChild(active_person)
if active_parents == active_person.getMainFamily():
active_person.setMainFamily(None)
else:
active_person.removeAltFamily(active_parents)
load_family()
#-------------------------------------------------------------------------
#
#
@ -1369,6 +1333,7 @@ def on_revert_activate(obj):
#-------------------------------------------------------------------------
def revert_query(value):
if value == 0:
const.places = []
const.personalEvents = const.initialize_personal_event_list()
const.personalAttributes = const.initialize_personal_attribute_list()
const.marriageEvents = const.initialize_marriage_event_list()
@ -1663,7 +1628,7 @@ def load_family():
menuitem.show()
typeMenu.append(menuitem)
for fam in family_types:
menuitem = GtkMenuItem(fam[1])
menuitem = GtkMenuItem("%s/%s" % (fam[2],fam[1]))
menuitem.set_data("parents",fam[0])
menuitem.connect("activate",on_current_type_changed)
menuitem.show()
@ -1698,6 +1663,8 @@ def load_family():
gtop.get_widget("fv_spouse").set_menu(myMenu)
gtop.get_widget("lab_or_list").set_page(1)
gtop.get_widget("edit_sp").set_sensitive(1)
gtop.get_widget("delete_sp").set_sensitive(1)
elif number_of_families == 1:
gtop.get_widget("lab_or_list").set_page(0)
family = active_person.getFamilyList()[0]
@ -1710,6 +1677,8 @@ def load_family():
fv_spouse1.set_text(Config.nameof(spouse))
fv_spouse1.set_data("person",spouse)
fv_spouse1.set_data("family",active_person.getFamilyList()[0])
gtop.get_widget("edit_sp").set_sensitive(1)
gtop.get_widget("delete_sp").set_sensitive(1)
else:
gtop.get_widget("lab_or_list").set_page(0)
gtop.get_widget("fv_spouse1").set_text("")
@ -1717,6 +1686,9 @@ def load_family():
fv_spouse1.set_text("")
fv_spouse1.set_data("person",None)
fv_spouse1.set_data("family",None)
active_spouse = None
gtop.get_widget("edit_sp").set_sensitive(0)
gtop.get_widget("delete_sp").set_sensitive(0)
if number_of_families > 0:
display_marriage(active_person.getFamilyList()[0])
@ -1859,17 +1831,17 @@ def display_marriage(family):
child_list.sort(sort.by_birthdate)
attr = ""
for child in child_list:
status = "unknown"
status = _("unknown")
if child.getGender():
gender = const.male
else:
gender = const.female
if child.getMainFamily() == family:
status = "Natural"
status = _("Birth")
else:
for fam in child.getAltFamilyList():
if fam[0] == family:
status = fam[1]
status = "%s/%s" % (fam[2],fam[1])
if Config.show_detail:
attr = ""
@ -1887,7 +1859,8 @@ def display_marriage(family):
if len(child.getPhotoList()) > 0:
attr = attr + "P"
clist.append([Config.nameof(child),gender,birthday(child),status,attr])
clist.append([Config.nameof(child),str(child.getId()),\
gender,birthday(child),status,attr])
clist.set_row_data(i,child)
i=i+1
if i != 0:
@ -1939,6 +1912,9 @@ def load_database(name):
if ntype not in const.personalEvents:
const.personalEvents.append(ntype)
const.places = database.getPlaces()
const.places.sort()
mylist = database.getFamilyEventTypes()
for type in mylist:
ntype = const.display_fevent(type)
@ -2019,6 +1995,8 @@ def apply_filter():
datacomp = DataFilter.compare
clistadd = color_clist.add_with_data
gname = utils.phonebook_from_name
person_list.set_column_visibility(1,Config.id_visible)
for name_tuple in names:
person = name_tuple[1]
@ -2031,8 +2009,10 @@ def apply_filter():
gender = const.male
else:
gender = const.female
clistadd([gname(name,alt),gender,person.getBirth().getQuoteDate(),\
person.getDeath().getQuoteDate()],person)
bday = person.getBirth().getQuoteDate()
dday = person.getDeath().getQuoteDate()
clistadd([gname(name,alt),str(person.getId()), gender,bday, dday],\
person)
i = i + 1
person_list.thaw()
@ -2233,6 +2213,7 @@ def main(arg):
"on_child_list_button_press_event" : on_child_list_button_press_event,
"on_child_list_select_row" : on_child_list_select_row,
"on_fv_prev_clicked" : on_fv_prev_clicked,
"on_delete_parents_clicked" : on_delete_parents_clicked,
"on_contents_activate" : on_contents_activate,
"on_choose_parents_clicked" : on_choose_parents_clicked,
"on_spouselist_changed" : on_spouselist_changed,
@ -2247,7 +2228,9 @@ def main(arg):
"on_save_activate" : on_save_activate,
"on_revert_activate" : on_revert_activate,
"on_add_child_clicked" : on_add_child_clicked,
"on_edit_marriage_clicked" : on_edit_marriage_clicked,
"on_edit_sp_clicked" : on_edit_sp_clicked,
"on_add_sp_clicked" : on_add_sp_clicked,
"on_delete_sp_clicked" : on_delete_sp_clicked,
"on_remove_child_clicked" : on_remove_child_clicked,
"on_new_clicked" : on_new_clicked,
"on_add_bookmark_activate" : on_add_bookmark_activate,
@ -2273,6 +2256,7 @@ def main(arg):
database = RelDataBase()
Config.loadConfig(full_update)
person_list.set_column_visibility(1,Config.id_visible)
gtop.get_widget(NOTEBOOK).set_show_tabs(Config.usetabs)
gtop.get_widget("child_list").set_column_visibility(4,Config.show_detail)

View File

@ -52,7 +52,6 @@ photo_types = [ "jpeg", "bmp", "pict", "pntg", "tpic", "png", "gif",
_ADDRX = [ "ADDR", "ADR1", "ADR2" ]
ged2rel = {}
for val in const.personalConstantEvents.keys():
key = const.personalConstantEvents[val]
@ -439,19 +438,20 @@ class GedcomParser:
#
#---------------------------------------------------------------------
def parse_ftw_relations(self,level):
retval = ""
mrel = "Birth"
frel = "Birth"
while 1:
matches = self.get_next()
if int(matches[0]) < level:
self.backup()
return retval
return (mrel,frel)
elif matches[1] == "_FREL":
if string.lower(matches[2]) != "natural":
retval = matches[2]
frel = string.capitalize(matches[2])
elif matches[1] == "_MREL":
if string.lower(matches[2]) != "natural":
retval = matches[2]
mrel = matches[2]
else:
self.barf(level+1)
@ -479,13 +479,13 @@ class GedcomParser:
self.addr.setStreet(matches[2] + self.parse_continue_data(2))
self.parse_address(self.addr,2)
elif matches[1] == "CHIL":
type = self.parse_ftw_relations(2)
mrel,frel = self.parse_ftw_relations(2)
child = self.db.findPerson(matches[2],self.pmap)
self.family.addChild(child)
if type != "":
if child.getMainFamily() == self.family:
child.setMainFamily(None)
child.addAltFamily(self.family,type)
child.addAltFamily(self.family,mrel,frel)
elif matches[1] == "NCHI" or matches[1] == "RIN" or matches[1] == "SUBM":
pass
elif matches[1] == "REFN" or matches[1] == "CHAN":
@ -601,9 +601,9 @@ class GedcomParser:
if self.person.getMainFamily() == None:
self.person.setMainFamily(family)
else:
self.person.addAltFamily(family,"unknown")
self.person.addAltFamily(family,"Unknown","Unknown")
else:
self.person.addAltFamily(family,type)
self.person.addAltFamily(family,type,type)
elif matches[1] == "RESI":
addr = Address()
self.person.addAddress(addr)
@ -690,7 +690,7 @@ class GedcomParser:
self.backup()
return (string.capitalize(type),note)
elif matches[1] == "PEDI":
type = matches[2]
type = string.capitalize(matches[2])
elif matches[1] == "_PRIMARY":
type = matches[1]
elif matches[1] == "NOTE":
@ -734,7 +734,8 @@ class GedcomParser:
elif form in photo_types:
path = find_file(file,self.dir_path)
if path == "":
self.warn(_("Could not import %s: either the file could not be found, or it was not a valid image") % file + "\n")
self.warn(_("Could not import %s: either the file could not be found, or it was not a valid image")\
% file + "\n")
else:
photo = Photo()
photo.setPath(path)
@ -917,7 +918,8 @@ class GedcomParser:
if event.getName() == "Birth":
self.person.setMainFamily(family)
else:
self.person.addAltFamily(family,event.getName())
type = string.capitalize(event.getName())
self.person.addAltFamily(family,type,type)
self.ignore_sub_junk(level+1)
elif matches[1] == "PLAC":
event.setPlace(matches[2])

View File

@ -97,7 +97,8 @@ def report(database,person):
text = text + "----------------------------\n"
text = text + "%s : %d\n" % (_("Individuals with images"),with_photos)
text = text + "%s : %d\n" % (_("Total number of images"),total_photos)
text = text + "%s : %d %s\n" % (_("Total size of images"),bytes,_("bytes"))
text = text + "%s : %d %s\n" % (_("Total size of images"),bytes,\
_("bytes"))
text = text + "\n%s\n" % _("Family Information")
text = text + "----------------------------\n"
text = text + "%s : %d\n" % (_("Number of families"),len(familyList))

View File

@ -238,9 +238,11 @@ class IndividualPage:
self.doc.start_table("one","IndTable")
self.write_normal_row("%s:" % _("Name"), name, name_obj.getSourceRef())
if self.person.getGender() == Person.male:
self.write_normal_row("%s:" % _("Gender"), _("Male"),None)
self.write_normal_row("%s:" % _("Gender"), \
_("Male"),None)
else:
self.write_normal_row("%s:" % _("Gender"), _("Female"),None)
self.write_normal_row("%s:" % _("Gender"), \
_("Female"),None)
family = self.person.getMainFamily()
if family: