Moved to a single date for addresses instead of start/stop dates
svn: r54
This commit is contained in:
parent
a073ffba61
commit
4bb330f1e1
@ -82,6 +82,7 @@ class GrampsParser(handler.ContentHandler):
|
||||
self.source = None
|
||||
self.sourceRef = None
|
||||
self.is_import = is_import
|
||||
self.in_address = 0
|
||||
|
||||
self.resname = ""
|
||||
self.resaddr = ""
|
||||
@ -157,6 +158,7 @@ class GrampsParser(handler.ContentHandler):
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def start_address(self,attrs):
|
||||
self.in_address = 1
|
||||
self.address = Address()
|
||||
self.person.addAddress(self.address)
|
||||
|
||||
@ -395,6 +397,14 @@ class GrampsParser(handler.ContentHandler):
|
||||
def stop_attribute(self,tag):
|
||||
self.attribute.setValue(tag)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def stop_address(self,tag):
|
||||
self.in_address = 0
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -447,6 +457,9 @@ class GrampsParser(handler.ContentHandler):
|
||||
#---------------------------------------------------------------------
|
||||
def stop_date(self,tag):
|
||||
if tag:
|
||||
if self.in_address:
|
||||
self.address.setDate(tag)
|
||||
else:
|
||||
self.event.getDateObj().quick_set(tag)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
@ -502,14 +515,6 @@ class GrampsParser(handler.ContentHandler):
|
||||
date.quick_set(tag)
|
||||
self.source.setDate(date)
|
||||
|
||||
def stop_date_start(self,tag):
|
||||
date = self.address.getStartDateObj()
|
||||
date.quick_set(tag)
|
||||
|
||||
def stop_date_stop(self,tag):
|
||||
date = self.address.getStopDateObj()
|
||||
date.quick_set(tag)
|
||||
|
||||
def stop_street(self,tag):
|
||||
self.address.setStreet(tag)
|
||||
|
||||
@ -705,7 +710,7 @@ class GrampsParser(handler.ContentHandler):
|
||||
self.person.addAlternateName(self.name)
|
||||
|
||||
func_map = {
|
||||
"address" : (start_address, None),
|
||||
"address" : (start_address, stop_address),
|
||||
"aka" : (start_name, stop_aka),
|
||||
"attribute" : (start_attribute, stop_attribute),
|
||||
"bookmark" : (start_bmark, None),
|
||||
@ -756,11 +761,9 @@ class GrampsParser(handler.ContentHandler):
|
||||
"sources" : (start_sources, None),
|
||||
"spage" : (None, stop_spage),
|
||||
"spubinfo" : (None, stop_spubinfo),
|
||||
"date_start" : (None, stop_date_start),
|
||||
"state" : (None, stop_state),
|
||||
"stext" : (None, stop_stext),
|
||||
"stitle" : (None, stop_stitle),
|
||||
"date_stop" : (None, stop_date_stop),
|
||||
"street" : (None, stop_street),
|
||||
"suffix" : (None, stop_suffix),
|
||||
"title" : (None, stop_title),
|
||||
|
@ -114,12 +114,18 @@ def loadData(database, filename, callback):
|
||||
parser.parse(xml_file)
|
||||
except xml.sax.SAXParseException:
|
||||
GnomeErrorDialog(_("%s is a corrupt file") % filename)
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
except IOError,msg:
|
||||
GnomeErrorDialog(_("Error reading %s") % filename + "\n" + str(msg))
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
except:
|
||||
GnomeErrorDialog(_("Error reading %s") % filename)
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
|
||||
|
||||
|
@ -101,11 +101,18 @@ def dump_my_event(g,name,event):
|
||||
if source:
|
||||
sourceRef = source.getBase()
|
||||
if sourceRef:
|
||||
p = source.getPage()
|
||||
c = source.getComments()
|
||||
t = source.getText()
|
||||
d = source.getDate().getSaveDate()
|
||||
if p == "" and c == "" and t == "" and d == "":
|
||||
g.write("<sourceref ref=\"%d\"/>\n" % sourceRef.getId())
|
||||
else:
|
||||
g.write("<sourceref ref=\"%d\">\n" % sourceRef.getId())
|
||||
write_line(g,"spage",source.getPage())
|
||||
writeNote(g,"scomments",source.getComments())
|
||||
writeNote(g,"stext",source.getText())
|
||||
write_line(g,"sdate",source.getDate().getSaveDate())
|
||||
write_line(g,"spage",p)
|
||||
writeNote(g,"scomments",c)
|
||||
writeNote(g,"stext",t)
|
||||
write_line(g,"sdate",c)
|
||||
g.write("</sourceref>\n")
|
||||
g.write("</event>\n")
|
||||
|
||||
@ -197,10 +204,8 @@ def exportData(database, filename, callback):
|
||||
|
||||
g.write("<people")
|
||||
person = database.getDefaultPerson()
|
||||
print person
|
||||
if person:
|
||||
g.write(" default=\"" + str(person.getId()) + "\"")
|
||||
print str(person.getId())
|
||||
g.write(">\n")
|
||||
|
||||
total = len(personList) + len(familyList)
|
||||
@ -239,12 +244,7 @@ def exportData(database, filename, callback):
|
||||
g.write("<addresses>\n")
|
||||
for address in person.getAddressList():
|
||||
g.write('<address>\n')
|
||||
g.write('<date_start>')
|
||||
g.write(address.getStartDateObj().getSaveDate())
|
||||
g.write('<date_start>\n')
|
||||
g.write('<date_stop>')
|
||||
g.write(address.getStopDateObj().getSaveDate())
|
||||
g.write('<date_stop>\n')
|
||||
write_line(g,"date",address.getDateObj().getSaveDate())
|
||||
write_line(g,"street",address.getStreet())
|
||||
write_line(g,"city",address.getCity())
|
||||
write_line(g,"state",address.getState())
|
||||
|
Loading…
Reference in New Issue
Block a user