2007-04-17 Don Allingham <don@gramps-project.org>
* src/DataViews/_FamilyList.py: add marriage date column * src/GrampsDb/_DbUtils.py: add function for finding a marriage event * src/DisplayModels/_FamilyModel.py: add marriage date column * src/GrampsDbUtils/_GedcomParse.py: handle place form handing * src/GrampsDbUtils/_GedcomLex.py: handle place form handing * src/GrampsDbUtils/_WriteGedcom.py: handle note list * src/docgen/ODFDoc.py: escape special characters svn: r8398
This commit is contained in:
parent
ec251900c5
commit
6edbffe3a3
@ -1,3 +1,12 @@
|
||||
2007-04-17 Don Allingham <don@gramps-project.org>
|
||||
* src/DataViews/_FamilyList.py: add marriage date column
|
||||
* src/GrampsDb/_DbUtils.py: add function for finding a marriage event
|
||||
* src/DisplayModels/_FamilyModel.py: add marriage date column
|
||||
* src/GrampsDbUtils/_GedcomParse.py: handle place form handing
|
||||
* src/GrampsDbUtils/_GedcomLex.py: handle place form handing
|
||||
* src/GrampsDbUtils/_WriteGedcom.py: handle note list
|
||||
* src/docgen/ODFDoc.py: escape special characters
|
||||
|
||||
2007-04-17 Benny Malengier <bm@cage.ugent.be>
|
||||
* src/images/
|
||||
* src/GrampsWidgets.py
|
||||
|
@ -52,6 +52,7 @@ column_names = [
|
||||
_('Father'),
|
||||
_('Mother'),
|
||||
_('Relationship'),
|
||||
_('Marriage Date'),
|
||||
_('Last Changed'),
|
||||
]
|
||||
|
||||
|
@ -123,8 +123,10 @@ class RelationshipView(PageView.PersonNavView):
|
||||
self.redrawing = False
|
||||
self.use_shade = Config.get(Config.RELATION_SHADE)
|
||||
self.toolbar_visible = Config.get(Config.TOOLBAR_ON)
|
||||
|
||||
self.color = gtk.TextView().style.white
|
||||
self.child = None
|
||||
|
||||
Config.client.notify_add("/apps/gramps/preferences/relation-shade",
|
||||
self.shade_update)
|
||||
Config.client.notify_add("/apps/gramps/interface/editbutton",
|
||||
|
@ -43,8 +43,10 @@ import gtk
|
||||
import const
|
||||
import ToolTips
|
||||
import GrampsLocale
|
||||
import DateHandler
|
||||
from BasicUtils import NameDisplay
|
||||
import RelLib
|
||||
import GrampsDb
|
||||
|
||||
from _BaseModel import BaseModel
|
||||
|
||||
@ -66,6 +68,7 @@ class FamilyModel(BaseModel):
|
||||
self.column_father,
|
||||
self.column_mother,
|
||||
self.column_type,
|
||||
self.column_marriage,
|
||||
self.column_change,
|
||||
self.column_handle,
|
||||
self.column_tooltip,
|
||||
@ -77,13 +80,14 @@ class FamilyModel(BaseModel):
|
||||
self.sort_father,
|
||||
self.sort_mother,
|
||||
self.column_type,
|
||||
self.sort_marriage,
|
||||
self.sort_change,
|
||||
self.column_handle,
|
||||
self.column_tooltip,
|
||||
self.column_marker_text,
|
||||
self.column_marker_color,
|
||||
]
|
||||
self.marker_color_column = 8
|
||||
self.marker_color_column = 9
|
||||
BaseModel.__init__(self, db, scol, order, tooltip_column=6,
|
||||
search=search, skip=skip, sort_map=sort_map)
|
||||
|
||||
@ -124,6 +128,22 @@ class FamilyModel(BaseModel):
|
||||
def column_type(self, data):
|
||||
return str(RelLib.FamilyRelType(data[5]))
|
||||
|
||||
def column_marriage(self, data):
|
||||
erlist = [ RelLib.EventRef().unserialize(d) for d in data[6] ]
|
||||
event = GrampsDb.marriage_from_eventref_list(self.db, erlist)
|
||||
if event:
|
||||
return DateHandler.displayer.display(event.date)
|
||||
else:
|
||||
return u''
|
||||
|
||||
def sort_marriage(self, data):
|
||||
erlist = [ RelLib.EventRef().unserialize(d) for d in data[6] ]
|
||||
event = GrampsDb.marriage_from_eventref_list(self.db, erlist)
|
||||
if event:
|
||||
return "%09d" % event.date.get_sort_value()
|
||||
else:
|
||||
return u''
|
||||
|
||||
def column_id(self, data):
|
||||
return unicode(data[1])
|
||||
|
||||
|
@ -704,7 +704,6 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
else:
|
||||
return u''
|
||||
|
||||
|
||||
def column_int_id(self, data, node):
|
||||
return node
|
||||
|
||||
|
@ -164,6 +164,13 @@ def remove_child_from_family(db, person_handle, family_handle, trans=None):
|
||||
if need_commit:
|
||||
db.transaction_commit(trans,_("Remove child from family"))
|
||||
|
||||
def marriage_from_eventref_list(db, eventref_list):
|
||||
for eventref in eventref_list:
|
||||
event = db.get_event_from_handle(eventref.ref)
|
||||
if int(event.get_type()) == RelLib.EventType.MARRIAGE:
|
||||
return event
|
||||
else:
|
||||
return None
|
||||
|
||||
def add_child_to_family(db, family, child,
|
||||
mrel=RelLib.ChildRefType(),
|
||||
|
@ -253,6 +253,9 @@ def extract_date(text):
|
||||
Converts the specified text to a RelLib.Date object.
|
||||
"""
|
||||
dateobj = RelLib.Date()
|
||||
|
||||
text = text.replace('BET ABT','EST BET') # Horrible hack for Tim Lyons
|
||||
|
||||
try:
|
||||
# extract out the MOD line
|
||||
match = MOD.match(text)
|
||||
@ -265,7 +268,7 @@ def extract_date(text):
|
||||
# parse the range if we match, if so, return
|
||||
match = RANGE.match(text)
|
||||
if match:
|
||||
(cal1, data1, cal2, data2) = match.groups()
|
||||
(cal1, data1, ignore, cal2, data2) = match.groups()
|
||||
|
||||
cal = CALENDAR_MAP.get(cal1, RelLib.Date.CAL_GREGORIAN)
|
||||
|
||||
|
@ -4141,7 +4141,7 @@ class GedcomParser(UpdateCallback):
|
||||
"""
|
||||
self.gedsource = self.gedmap.get_from_source_tag(line.data)
|
||||
self.lexer.set_broken_conc(self.gedsource.get_conc())
|
||||
if line.data == "FTW":
|
||||
if line.data.strip() == "FTW":
|
||||
self.is_ftw = True
|
||||
elif line.data == "Ancestry.com Family Trees":
|
||||
self.is_ancestry_com = True
|
||||
@ -4207,7 +4207,8 @@ class GedcomParser(UpdateCallback):
|
||||
@param state: The current state
|
||||
@type state: CurrentState
|
||||
"""
|
||||
self.__parse_level(state, self.place_form, self.__undefined)
|
||||
sub_state = GedcomUtils.CurrentState(level=state.level+1)
|
||||
self.__parse_level(sub_state, self.place_form, self.__undefined)
|
||||
|
||||
def __place_form(self, line, state):
|
||||
"""
|
||||
|
@ -722,8 +722,8 @@ class GedcomWriter(UpdateCallback):
|
||||
else:
|
||||
self.writeln("2 TYPE %s" % self.cnvtxt(the_name))
|
||||
|
||||
if attr.get_note():
|
||||
self.write_long_text("NOTE",2,self.cnvtxt(attr.get_note()))
|
||||
for note in attr.get_note_list():
|
||||
self.write_long_text("NOTE",2,self.cnvtxt(note))
|
||||
for srcref in attr.get_source_references():
|
||||
self.write_source_ref(2,srcref)
|
||||
|
||||
@ -764,8 +764,8 @@ class GedcomWriter(UpdateCallback):
|
||||
continue
|
||||
self.write_photo(photo,1)
|
||||
|
||||
if family.get_note():
|
||||
self.write_long_text("NOTE",1,self.cnvtxt(family.get_note()))
|
||||
for note in family.get_note_list():
|
||||
self.write_long_text("NOTE",1,self.cnvtxt(note))
|
||||
|
||||
self.write_change(1,family.get_change_time())
|
||||
self.update()
|
||||
@ -809,8 +809,8 @@ class GedcomWriter(UpdateCallback):
|
||||
for reporef in source.get_reporef_list():
|
||||
self.write_reporef(reporef,1)
|
||||
|
||||
if source.get_note():
|
||||
self.write_long_text("NOTE",1,self.cnvtxt(source.get_note()))
|
||||
for note in source.get_note_list():
|
||||
self.write_long_text("NOTE",1,self.cnvtxt(note))
|
||||
self.write_change(1,source.get_change_time())
|
||||
|
||||
def write_repos(self):
|
||||
@ -850,8 +850,8 @@ class GedcomWriter(UpdateCallback):
|
||||
self.writeln("1 PHON %s"
|
||||
% self.cnvtxt(addr.get_phone()))
|
||||
|
||||
if repo.get_note():
|
||||
self.write_long_text("NOTE",1,self.cnvtxt(repo.get_note()))
|
||||
for note in repo.get_note_list():
|
||||
self.write_long_text("NOTE",1,self.cnvtxt(note))
|
||||
|
||||
def write_reporef(self,reporef,level):
|
||||
|
||||
@ -866,9 +866,9 @@ class GedcomWriter(UpdateCallback):
|
||||
|
||||
self.writeln("%d REPO @%s@" % (level,repo_id) )
|
||||
|
||||
if reporef.get_note():
|
||||
for note in reporef.get_note_list():
|
||||
self.write_long_text("NOTE",level+1,
|
||||
self.cnvtxt(reporef.get_note()))
|
||||
self.cnvtxt(note))
|
||||
|
||||
if reporef.get_call_number():
|
||||
self.writeln("%d CALN %s" %
|
||||
@ -895,7 +895,7 @@ class GedcomWriter(UpdateCallback):
|
||||
|
||||
if restricted and self.exclnotes:
|
||||
primaryname = RelLib.Name (primaryname)
|
||||
primaryname.set_note ('')
|
||||
primaryname.set_note_list ([])
|
||||
|
||||
if restricted and self.exclsrcs:
|
||||
primaryname = RelLib.Name (primaryname)
|
||||
@ -1070,8 +1070,8 @@ class GedcomWriter(UpdateCallback):
|
||||
else:
|
||||
self.writeln("2 TYPE %s" % self.cnvtxt(key))
|
||||
|
||||
if attr.get_note():
|
||||
self.write_long_text("NOTE",2,self.cnvtxt(attr.get_note()))
|
||||
for note in attr.get_note_list():
|
||||
self.write_long_text("NOTE", 2, self.cnvtxt(note))
|
||||
for srcref in attr.get_source_references():
|
||||
self.write_source_ref(2,srcref)
|
||||
|
||||
@ -1108,8 +1108,8 @@ class GedcomWriter(UpdateCallback):
|
||||
if text:
|
||||
self.writeln("2 PLAC %s"
|
||||
% self.cnvtxt(text).replace('\r',' '))
|
||||
if addr.get_note():
|
||||
self.write_long_text("NOTE",2,self.cnvtxt(addr.get_note()))
|
||||
for note in addr.get_note_list():
|
||||
self.write_long_text("NOTE", 2, self.cnvtxt(note))
|
||||
for srcref in addr.get_source_references():
|
||||
self.write_source_ref(2,srcref)
|
||||
|
||||
@ -1157,8 +1157,8 @@ class GedcomWriter(UpdateCallback):
|
||||
self.writeln('2 FILE %s' % url.get_path())
|
||||
|
||||
if not restricted or not self.exclnotes:
|
||||
if person.get_note():
|
||||
self.write_long_text("NOTE",1,self.cnvtxt(person.get_note()))
|
||||
for note in person.get_note_list():
|
||||
self.write_long_text("NOTE", 1, self.cnvtxt(note))
|
||||
|
||||
self.write_change(1,person.get_change_time())
|
||||
|
||||
@ -1267,8 +1267,8 @@ class GedcomWriter(UpdateCallback):
|
||||
elif t == RelLib.AttributeType.MOTHER_AGE:
|
||||
self.writeln("2 WIFE")
|
||||
self.writeln("3 AGE %s" % self.cnvtxt(attr.get_value()))
|
||||
if event.get_note():
|
||||
self.write_long_text("NOTE",2,self.cnvtxt(event.get_note()))
|
||||
for note in event.get_note_list():
|
||||
self.write_long_text("NOTE", 2, self.cnvtxt(note))
|
||||
for srcref in event.get_source_references():
|
||||
self.write_source_ref(2,srcref)
|
||||
|
||||
@ -1302,8 +1302,8 @@ class GedcomWriter(UpdateCallback):
|
||||
if ord.get_status() != RelLib.LdsOrd.STATUS_NONE:
|
||||
self.writeln("2 STAT %s" %
|
||||
self.cnvtxt(lds_status[ord.get_status()]))
|
||||
if ord.get_note():
|
||||
self.write_long_text("NOTE",index+1,self.cnvtxt(ord.get_note()))
|
||||
for note in ord.get_note_list():
|
||||
self.write_long_text("NOTE", index+1, self.cnvtxt(note))
|
||||
for srcref in ord.get_source_references():
|
||||
self.write_source_ref(index+1,srcref)
|
||||
|
||||
@ -1368,8 +1368,8 @@ class GedcomWriter(UpdateCallback):
|
||||
self.writeln("2 NPFX %s" % title)
|
||||
if nick:
|
||||
self.writeln('2 NICK %s' % nick)
|
||||
if name.get_note():
|
||||
self.write_long_text("NOTE",2,self.cnvtxt(name.get_note()))
|
||||
for note in name.get_note_list():
|
||||
self.write_long_text("NOTE", 2, self.cnvtxt(note))
|
||||
for srcref in name.get_source_references():
|
||||
self.write_source_ref(2,srcref)
|
||||
|
||||
@ -1392,8 +1392,9 @@ class GedcomWriter(UpdateCallback):
|
||||
# Reference to the source
|
||||
self.writeln("%d SOUR @%s@" % (level,src.get_gramps_id()))
|
||||
if ref.get_page() != "":
|
||||
page_text = self.cnvtxt(ref.get_page())
|
||||
self.writeln('%d PAGE %s' % (level+1,page_text))
|
||||
sep = "\n%d CONT " % (level+2)
|
||||
page_text = self.cnvtxt(ref.get_page().replace('\n',sep))
|
||||
self.writeln('%d PAGE %s' % (level+1, page_text))
|
||||
conf = ref.get_confidence_level()
|
||||
# Cap the maximum level
|
||||
conf = min(conf,RelLib.SourceRef.CONF_VERY_HIGH)
|
||||
@ -1426,8 +1427,8 @@ class GedcomWriter(UpdateCallback):
|
||||
if ref_text:
|
||||
self.write_long_text("TEXT",level+1,self.cnvtxt(ref_text))
|
||||
|
||||
if ref.get_note():
|
||||
self.write_long_text("NOTE",level+1,self.cnvtxt(ref.get_note()))
|
||||
for note in ref.get_note_list():
|
||||
self.write_long_text("NOTE", level+1, self.cnvtxt(note))
|
||||
|
||||
def write_photo(self,photo,level):
|
||||
photo_obj_id = photo.get_reference_handle()
|
||||
@ -1465,9 +1466,8 @@ class GedcomWriter(UpdateCallback):
|
||||
basename = os.path.basename (path)
|
||||
self.writeln('%d FILE %s' % (level+1,os.path.join(self.images_path,
|
||||
basename)))
|
||||
if photo_obj.get_note():
|
||||
self.write_long_text("NOTE",level+1,
|
||||
self.cnvtxt(photo_obj.get_note()))
|
||||
for note in photo_obj.get_note_list():
|
||||
self.write_long_text("NOTE", level+1, self.cnvtxt(note))
|
||||
|
||||
def write_place(self,place,level):
|
||||
if self.private and place.private:
|
||||
@ -1496,8 +1496,8 @@ def exportData(database,filename,person,option_box,callback=None):
|
||||
try:
|
||||
gw = GedcomWriter(database,person,0,filename,option_box,callback)
|
||||
ret = gw.export_data(filename)
|
||||
except AttributeError, msg:
|
||||
RunDatabaseRepair(msg)
|
||||
# except AttributeError, msg:
|
||||
# RunDatabaseRepair(msg)
|
||||
except Errors.DatabaseError, msg:
|
||||
ErrorDialog(_("Export failed"),str(msg))
|
||||
return ret
|
||||
|
@ -32,6 +32,7 @@ import time
|
||||
import locale
|
||||
from cStringIO import StringIO
|
||||
from math import pi, cos, sin
|
||||
from xml.sax.saxutils import escape
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -853,7 +854,7 @@ class ODFDoc(BaseDoc.BaseDoc):
|
||||
|
||||
self.start_paragraph(style_name)
|
||||
self.cntnt.write('<text:span text:style-name="GRAMPS-preformat">')
|
||||
self.cntnt.write(text)
|
||||
self.cntnt.write(escape(text))
|
||||
self.cntnt.write('</text:span>')
|
||||
self.end_paragraph()
|
||||
elif format == 0:
|
||||
@ -997,7 +998,7 @@ class ODFDoc(BaseDoc.BaseDoc):
|
||||
self.cntnt.write('<text:p text:style-name="X%s"> ' % pname)
|
||||
|
||||
self.cntnt.write('<text:span text:style-name="F%s">\n' % pname)
|
||||
self.write_text('\n'.join(text))
|
||||
self.write_text('\n'.join(escape(text)))
|
||||
self.cntnt.write('</text:span>\n</text:p>\n</draw:text-box>\n')
|
||||
self.cntnt.write('</draw:frame>\n')
|
||||
|
||||
@ -1066,7 +1067,7 @@ class ODFDoc(BaseDoc.BaseDoc):
|
||||
self.cntnt.write('<text:p text:style-name="F%s">' % para_name)
|
||||
self.cntnt.write('<text:span text:style-name="F%s"' % para_name)
|
||||
self.cntnt.write(' fo:max-height="%.2f">' % font.get_size() )
|
||||
self.cntnt.write(text)
|
||||
self.cntnt.write(escape(text))
|
||||
self.cntnt.write('</text:span></text:p>')
|
||||
self.cntnt.write('</draw:text-box>\n')
|
||||
self.cntnt.write('</draw:frame>\n')
|
||||
@ -1124,7 +1125,7 @@ class ODFDoc(BaseDoc.BaseDoc):
|
||||
self.cntnt.write('<draw:text-box>')
|
||||
self.cntnt.write('<text:p text:style-name="X%s">' % para_name)
|
||||
self.cntnt.write('<text:span text:style-name="F%s">' % para_name)
|
||||
self.cntnt.write(text)
|
||||
self.cntnt.write(escape(text))
|
||||
self.cntnt.write('</text:span>\n')
|
||||
self.cntnt.write('</text:p>\n')
|
||||
self.cntnt.write('</draw:text-box>')
|
||||
|
Loading…
Reference in New Issue
Block a user