* src/GrampsBSDDB.py: add upgrade to version 3 for new Name type

* src/NameEdit.py: add date editor field
* src/ReadXML.py: read date field attached to a name
* src/WriteXML.py: write date field attached to a name
* src/RelLib.py: add date field to Name
* src/gramps.glade: add date editor field to Name Editor dialog


svn: r4121
This commit is contained in:
Don Allingham 2005-03-06 23:47:26 +00:00
parent 6fdd7e2556
commit 47efc514f4
7 changed files with 1865 additions and 10 deletions

View File

@ -1,3 +1,11 @@
2005-03-06 Don Allingham <dallingham@users.sourceforge.net>
* src/GrampsBSDDB.py: add upgrade to version 3 for new Name type
* src/NameEdit.py: add date editor field
* src/ReadXML.py: read date field attached to a name
* src/WriteXML.py: write date field attached to a name
* src/RelLib.py: add date field to Name
* src/gramps.glade: add date editor field to Name Editor dialog
2005-03-06 Alex Roitman <shura@alex.neuro.umn.edu>
* src/EditSource.py (display_references): List source's references
from personal and family gallery objects.

View File

@ -33,7 +33,7 @@ from RelLib import *
from GrampsDbBase import *
from bsddb import dbshelve, db
_DBVERSION = 2
_DBVERSION = 3
def find_surname(key,data):
return str(data[3].get_surname())
@ -390,4 +390,18 @@ class GrampsBSDDB(GrampsDbBase):
self.commit_person(person,None)
data = cursor.next()
cursor.close()
self.metadata['version'] = 2
if version < 3:
cursor = self.get_person_cursor()
data = cursor.first()
while data:
handle,info = data
person = Person()
person.unserialize(info)
person.primary_name.date = None
for name in person.alternate_names:
name.date = None
self.commit_person(person,None)
data = cursor.next()
cursor.close()
self.metadata['version'] = 3

View File

@ -46,6 +46,8 @@ import AutoComp
import Sources
import RelLib
import NameDisplay
import DateEdit
import DateHandler
#-------------------------------------------------------------------------
#
@ -81,6 +83,13 @@ class NameEditor:
self.suffix_field = self.top.get_widget("alt_suffix")
self.patronymic_field = self.top.get_widget("patronymic")
self.combo = self.top.get_widget("alt_surname_list")
self.date = self.top.get_widget('date')
self.date_obj = self.name.get_date_object()
self.date.set_text(DateHandler.displayer.display(self.date_obj))
self.date_check = DateEdit.DateEdit(
self.date_obj, self.date,
self.top.get_widget("date_stat"), self.window)
AutoComp.fill_combo(self.combo,self.parent.db.get_surname_list())
self.surname_field = self.combo.get_child()

View File

@ -154,7 +154,7 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
for m_id in database.get_media_object_handles():
mobject = database.get_object_from_handle(m_id)
oldfile = mobject.get_path()
if oldfile[0] != '/':
if oldfile and oldfile[0] != '/':
if first:
os.mkdir(img_dir)
first = 0
@ -979,6 +979,8 @@ class GrampsParser:
dv = self.object.get_date_object()
elif self.address:
dv = self.address.get_date_object()
elif self.name:
dv = self.name.get_date_object()
else:
dv = self.event.get_date_object()
@ -1031,6 +1033,8 @@ class GrampsParser:
dv = self.object.get_date_object()
elif self.address:
dv = self.address.get_date_object()
elif self.name:
dv = self.name.get_date_object()
else:
dv = self.event.get_date_object()

View File

@ -2629,6 +2629,10 @@ class Name(DataObj):
self.group_as = source.group_as
self.sort_as = source.sort_as
self.display_as = source.display_as
if source.date:
self.date = Date.Date(source.date)
else:
self.date = None
else:
self.first_name = ""
self.surname = ""
@ -2641,6 +2645,7 @@ class Name(DataObj):
self.group_as = ""
self.sort_as = self.DEF
self.display_as = self.DEF
self.date = None
def set_group_as(self,name):
"""
@ -2886,6 +2891,66 @@ class Name(DataObj):
index += 1
return True
def set_date(self, date) :
"""
Sets the date of the L{Name} instance. The date is parsed into
a L{Date} instance.
@param date: String representation of a date. The locale specific
L{DateParser} is used to parse the string into a GRAMPS L{Date}
object.
@type date: str
"""
self.date = DateHandler.parser.parse(date)
def get_date(self) :
"""
Returns a string representation of the date of the L{Name} instance
based off the default date display format determined by the
locale's L{DateDisplay} instance.
@return: Returns a string representing the L{Name}'s date
@rtype: str
"""
if self.date:
return DateHandler.displayer.display(self.date)
return u""
def get_quote_date(self) :
"""
Returns a string representation of the date of the L{Name} instance
based off the default date display format determined by the
locale's L{DateDisplay} instance. The date is enclosed in
quotes if the L{Date} is not a valid date.
@return: Returns a string representing the L{Name}'s date
@rtype: str
"""
if self.date:
return DateHandler.displayer.quote_display(self.date)
return u""
def get_date_object(self):
"""
Returns the L{Date} object associated with the L{Name}.
@return: Returns a L{Name}'s L{Date} instance.
@rtype: L{Date}
"""
if not self.date:
self.date = Date.Date()
return self.date
def set_date_object(self,date):
"""
Sets the L{Date} object associated with the L{Name}.
@param date: L{Date} instance to be assigned to the L{Name}
@type date: L{Date}
"""
self.date = date
class Url:
"""Contains information related to internet Uniform Resource Locators,
allowing gramps to store information about internet resources"""

View File

@ -674,6 +674,8 @@ class XmlWriter:
self.write_line("suffix",name.get_suffix(),index+1)
self.write_line("patronymic",name.get_patronymic(),index+1)
self.write_line("title",name.get_title(),index+1)
if name.date:
self.write_date(name.date,4)
if name.get_note() != "":
self.write_note("note",name.get_note_object(),index+1)
for s in name.get_source_references():

File diff suppressed because it is too large Load Diff