Added name types to alternate names

svn: r809
This commit is contained in:
Don Allingham 2002-03-01 14:16:41 +00:00
parent fd2a2f43a3
commit defd32824c
7 changed files with 228 additions and 34 deletions

View File

@ -895,7 +895,7 @@
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>False</use_arrows>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
@ -1294,7 +1294,7 @@
<widget>
<class>GtkTable</class>
<name>table10</name>
<rows>4</rows>
<rows>5</rows>
<columns>3</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
@ -1469,8 +1469,8 @@
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@ -1495,8 +1495,8 @@
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>False</xexpand>
@ -1599,6 +1599,84 @@
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label267</name>
<label>:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>3</ypad>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label268</name>
<label>Type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>3</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>name_type</name>
<label></label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
@ -1708,8 +1786,8 @@
<handler>on_name_button_press</handler>
<last_modification_time>Sun, 04 Nov 2001 15:40:59 GMT</last_modification_time>
</signal>
<columns>2</columns>
<column_widths>450,50</column_widths>
<columns>3</columns>
<column_widths>350,100,50</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
@ -1718,7 +1796,20 @@
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label57</name>
<label>Alternate Names</label>
<label>Name</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label57a</name>
<label>Type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@ -5376,7 +5467,7 @@
<widget>
<class>GtkTable</class>
<name>table23</name>
<rows>5</rows>
<rows>6</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
@ -5451,8 +5542,8 @@
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<top_attach>5</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>False</xexpand>
@ -5485,8 +5576,8 @@
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<top_attach>5</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@ -5506,8 +5597,8 @@
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@ -5670,6 +5761,70 @@
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label266</name>
<label>Type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>8</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>name_type</name>
<value_in_list>True</value_in_list>
<ok_if_empty>False</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items>Married Name
Also Known As
</items>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</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>combo-entry2</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>Married Name</text>
</widget>
</widget>
</widget>
</widget>
</widget>

View File

@ -174,6 +174,7 @@ class EditPerson:
self.alt_given_field = self.get_widget("alt_given")
self.alt_last_field = self.get_widget("alt_last")
self.alt_suffix_field = self.get_widget("alt_suffix")
self.name_type_field = self.get_widget("name_type")
self.surname_field = self.get_widget("surname")
self.suffix = self.get_widget("suffix")
self.given = self.get_widget("givenName")
@ -227,7 +228,7 @@ class EditPerson:
self.gid.set_text(person.getId())
self.gid.set_editable(GrampsCfg.id_edit)
self.event_list.set_column_visibility(3,GrampsCfg.show_detail)
self.name_list.set_column_visibility(1,GrampsCfg.show_detail)
self.name_list.set_column_visibility(2,GrampsCfg.show_detail)
self.attr_list.set_column_visibility(2,GrampsCfg.show_detail)
self.addr_list.set_column_visibility(2,GrampsCfg.show_detail)
@ -972,6 +973,7 @@ class EditPerson:
self.alt_given_field.set_text(name.getFirstName())
self.alt_last_field.set_text(name.getSurname())
self.alt_suffix_field.set_text(name.getSuffix())
self.name_type_field.set_text(name.getType())
self.name_details_field.set_text(Utils.get_detail_text(name))
def on_web_list_select_row(self,obj,row,b,c):
@ -1350,7 +1352,7 @@ def update_ord(func,ord,date,temple,stat,place):
#
#-------------------------------------------------------------------------
def disp_name(name):
return [name.getName(),Utils.get_detail_flags(name)]
return [name.getName(),name.getType(),Utils.get_detail_flags(name)]
#-------------------------------------------------------------------------
#

View File

@ -192,20 +192,20 @@ class GrampsParser:
self.event = Event()
self.event_type = u2l(attrs["type"])
if attrs.has_key("conf"):
self.conf = int(attrs["conf"])
self.event.conf = int(attrs["conf"])
else:
self.conf = 2
self.event.conf = 2
if attrs.has_key("priv"):
self.event.private = int(attrs["priv"])
def start_attribute(self,attrs):
self.attribute = Attribute()
if attrs.has_key("conf"):
self.conf = int(attrs["conf"])
self.attribute.conf = int(attrs["conf"])
else:
self.conf = 2
self.attribute.conf = 2
if attrs.has_key("priv"):
self.attribute.privacy = int(attrs["priv"])
self.attribute.private = int(attrs["priv"])
if attrs.has_key('type'):
self.attribute.setType(u2l(attrs["type"]))
if attrs.has_key('value'):
@ -225,9 +225,9 @@ class GrampsParser:
self.address = Address()
self.person.addAddress(self.address)
if attrs.has_key("conf"):
self.conf = int(attrs["conf"])
self.address.conf = int(attrs["conf"])
else:
self.conf = 2
self.address.conf = 2
if attrs.has_key("priv"):
self.address.private = int(attrs["priv"])
@ -311,10 +311,12 @@ class GrampsParser:
def start_name(self,attrs):
self.name = Name()
if attrs.has_key("type"):
self.name.setType(u2l(attrs["type"]))
if attrs.has_key("conf"):
self.conf = int(attrs["conf"])
self.name.conf = int(attrs["conf"])
else:
self.conf = 2
self.name.conf = 2
if attrs.has_key("priv"):
self.name.private = int(attrs["priv"])
@ -722,6 +724,8 @@ class GrampsParser:
def stop_aka(self,tag):
self.person.addAlternateName(self.name)
if self.name.getType() == "":
self.name.setType("Also Known As")
self.name = None
func_map = {

View File

@ -32,6 +32,7 @@ import libglade
#-------------------------------------------------------------------------
import const
import Utils
import AutoComp
from RelLib import *
from intl import gettext
@ -52,8 +53,10 @@ class NameEditor:
self.given_field = self.top.get_widget("alt_given")
self.surname_field = self.top.get_widget("alt_last")
self.suffix_field = self.top.get_widget("alt_suffix")
self.type_field = self.top.get_widget("name_type")
self.note_field = self.top.get_widget("alt_note")
Utils.attach_surnames(self.top.get_widget("alt_surname_list"))
slist = self.top.get_widget("alt_surname_list")
self.combo = AutoComp.AutoCombo(slist,const.surnames)
self.priv = self.top.get_widget("priv")
if self.name:
@ -70,11 +73,13 @@ class NameEditor:
self.window.editable_enters(self.given_field)
self.window.editable_enters(self.surname_field)
self.window.editable_enters(self.suffix_field)
self.window.editable_enters(self.type_field.entry)
if name != None:
self.given_field.set_text(name.getFirstName())
self.surname_field.set_text(name.getSurname())
self.suffix_field.set_text(name.getSuffix())
self.type_field.entry.set_text(_(name.getType()))
self.priv.set_active(name.getPrivacy())
self.note_field.set_point(0)
self.note_field.insert_defaults(name.getNote())
@ -97,19 +102,25 @@ class NameEditor:
suffix = self.suffix_field.get_text()
note = self.note_field.get_chars(0,-1)
priv = self.priv.get_active()
type = self.type_field.entry.get_text()
if const.NameTypesMap.has_key(type):
type = const.NameTypesMap[type]
else:
type = "Also Known As"
if self.name == None:
self.name = Name()
self.name.setSourceRefList(self.srcreflist)
self.parent.nlist.append(self.name)
self.update_name(first,last,suffix,note,priv)
self.update_name(first,last,suffix,type,note,priv)
self.parent.lists_changed = 1
self.parent.redraw_name_list()
Utils.destroy_passed_object(obj)
def update_name(self,first,last,suffix,note,priv):
def update_name(self,first,last,suffix,type,note,priv):
if self.name.getFirstName() != first:
self.name.setFirstName(first)
@ -126,6 +137,10 @@ class NameEditor:
self.name.setSuffix(suffix)
self.parent.lists_changed = 1
if self.name.getType() != type:
self.name.setType(type)
self.parent.lists_changed = 1
if self.name.getNote() != note:
self.name.setNote(note)
self.parent.lists_changed = 1

View File

@ -729,11 +729,21 @@ class Name(DataObj):
self.Surname = source.Surname
self.Suffix = source.Suffix
self.Title = source.Title
self.type = source.type
else:
self.FirstName = ""
self.Surname = ""
self.Suffix = ""
self.Title = ""
self.type = ""
def setType(self,type):
"""sets the type of the Name instance"""
self.type = type
def getType(self):
"""returns the type of the Name instance"""
return self.type
def setFirstName(self,name):
"""sets the given name for the Name instance"""

View File

@ -169,14 +169,14 @@ class XmlWriter:
total = len(personList) + len(familyList) + len(placeList) + len(sourceList)
self.g.write('<?xml version="1.0" encoding="iso-8859-1"?>\n')
self.g.write('<!DOCTYPE self.db SYSTEM "gramps.dtd" []>\n')
self.g.write('<!DOCTYPE database SYSTEM "gramps.dtd" []>\n')
self.g.write("<database>\n")
self.g.write(" <header>\n")
self.g.write(" <created date=\"%s %s %s\"" % (date[2],string.upper(date[1]),date[4]))
self.g.write(" version=\"" + const.version + "\"")
self.g.write(" people=\"%d\"" % (len(self.db.getPersonMap().values())))
self.g.write(" families=\"%d\"\n" % len(self.db.getFamilyMap().values()))
self.g.write(" sources=\"%d\"\n" % len(self.db.getSourceMap().values()))
self.g.write(" families=\"%d\"" % len(self.db.getFamilyMap().values()))
self.g.write(" sources=\"%d\"" % len(self.db.getSourceMap().values()))
self.g.write(" places=\"%d\"/>\n" % len(self.db.getPlaceMap().values()))
self.g.write(" <researcher>\n")
self.write_line("resname",owner.getName(),3)
@ -492,7 +492,11 @@ class XmlWriter:
def dump_name(self,label,name,index=1):
sp = " "*index
self.g.write('%s<%s%s>\n' % (sp,label,conf_priv(name)))
type = name.getType()
if type:
self.g.write('%s<%s type="%s"%s>\n' % (sp,label,type,conf_priv(name)))
else:
self.g.write('%s<%s%s>\n' % (sp,label,conf_priv(name)))
self.write_line("first",name.getFirstName(),index+1)
self.write_line("last",name.getSurname(),index+1)
self.write_line("suffix",name.getSuffix(),index+1)

View File

@ -857,3 +857,7 @@ lds_ssealing = [
]
NameTypesMap = {
_("Also Known As") : "Also Known As",
_("Married") : "Married",
}