Bookmark fixes, document generators handling of &, >, and <, bump up version

svn: r1216
This commit is contained in:
Don Allingham 2002-12-01 23:43:46 +00:00
parent 1ec6b99059
commit d974eee90c
12 changed files with 5748 additions and 4638 deletions

4
gramps/configure vendored
View File

@ -1441,7 +1441,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE=gramps PACKAGE=gramps
VERSION=0.8.0 VERSION=0.8.1
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -1567,7 +1567,7 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
RELEASE=pl4 RELEASE=
VERSIONSTRING=$VERSION VERSIONSTRING=$VERSION
if test x"$RELEASE" != "x" if test x"$RELEASE" != "x"

View File

@ -1,8 +1,8 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl May need to run automake && aclocal first dnl May need to run automake && aclocal first
AC_INIT(src/gramps.py) AC_INIT(src/gramps.py)
AM_INIT_AUTOMAKE(gramps, 0.8.0) AM_INIT_AUTOMAKE(gramps, 0.8.1)
RELEASE=pl4 RELEASE=
VERSIONSTRING=$VERSION VERSIONSTRING=$VERSION
if test x"$RELEASE" != "x" if test x"$RELEASE" != "x"

View File

@ -81,6 +81,9 @@ class Bookmarks :
self.bookmarks.append(person) self.bookmarks.append(person)
self.redraw() self.redraw()
def getBookmarkList(self):
return self.bookmarks
def add_to_menu(self,person): def add_to_menu(self,person):
"""adds a person's name to the drop down menu""" """adds a person's name to the drop down menu"""
item = gtk.GtkMenuItem(person.getPrimaryName().getName()) item = gtk.GtkMenuItem(person.getPrimaryName().getName())

View File

@ -1964,6 +1964,10 @@ class GrampsDB(Persistent):
"""returns the list of Person instances in the bookmarks""" """returns the list of Person instances in the bookmarks"""
return extlist(self.bookmarks) return extlist(self.bookmarks)
def setBookmarks(self,list):
"""returns the list of Person instances in the bookmarks"""
self.bookmarks = list
def clean_bookmarks(self): def clean_bookmarks(self):
"""cleans up the bookmark list, removing empty slots""" """cleans up the bookmark list, removing empty slots"""
new_bookmarks = [] new_bookmarks = []

View File

@ -96,7 +96,7 @@ class SubstKeywords:
for e in f.getEventList(): for e in f.getEventList():
if e.getName == 'Marriage': if e.getName == 'Marriage':
self.m = e.getDate() self.m = e.getDate()
self.M = e.getPlace() self.M = e.getPlaceName()
else: else:
self.s = "" self.s = ""
self.S = "" self.S = ""

View File

@ -524,9 +524,12 @@ class HtmlDoc(TextDoc):
self.f.write('</p>\n') self.f.write('</p>\n')
def write_text(self,text): def write_text(self,text):
text = string.replace(text,'&','&amp;'); # Must be first
text = string.replace(text,'<','&lt;');
text = string.replace(text,'>','&gt;');
text = string.replace(text,'\n','<br>')
if text != "": if text != "":
self.empty = 0 self.empty = 0
#text = string.replace(text,'\n','<br>')
self.f.write(text) self.f.write(text)
def start_bold(self): def start_bold(self):

View File

@ -426,6 +426,9 @@ class KwordDoc(TextDoc):
pass pass
def write_text(self,text): def write_text(self,text):
text = string.replace(text,'&','&amp;'); # Must be first
text = string.replace(text,'<','&lt;');
text = string.replace(text,'>','&gt;');
self.text = self.text + text self.text = self.text + text

View File

@ -490,6 +490,9 @@ class OpenOfficeDoc(TextDoc):
self.f.write('</text:h>\n') self.f.write('</text:h>\n')
def write_text(self,text): def write_text(self,text):
text = string.replace(text,'&','&amp;'); # Must be first
text = string.replace(text,'<','&lt;');
text = string.replace(text,'>','&gt;');
text = string.replace(text,'\n','<text:line-break/>') text = string.replace(text,'\n','<text:line-break/>')
self.f.write(latin_to_utf8(text)) self.f.write(latin_to_utf8(text))

View File

@ -78,6 +78,8 @@ class PSDrawDoc(DrawDoc):
self.f.write('%%LanguageLevel: 2\n') self.f.write('%%LanguageLevel: 2\n')
self.f.write('%%Pages: (atend)\n') self.f.write('%%Pages: (atend)\n')
self.f.write('%%PageOrder: Ascend\n') self.f.write('%%PageOrder: Ascend\n')
if self.orientation != PAPER_PORTRAIT:
self.f.write('%%Orientation: Landscape\n')
self.f.write('%%EndComments\n') self.f.write('%%EndComments\n')
self.f.write('/cm { 28.34 mul } def\n') self.f.write('/cm { 28.34 mul } def\n')
@ -101,6 +103,8 @@ class PSDrawDoc(DrawDoc):
self.page = self.page + 1 self.page = self.page + 1
self.f.write("%%Page:") self.f.write("%%Page:")
self.f.write("%d %d\n" % (self.page,self.page)) self.f.write("%d %d\n" % (self.page,self.page))
if self.orientation != PAPER_PORTRAIT:
self.f.write('90 rotate %5.2f cm %5.2f cm translate\n' % (0,-1*self.height))
def end_page(self): def end_page(self):
self.f.write('showpage\n') self.f.write('showpage\n')

View File

@ -794,7 +794,8 @@ class Gramps:
autosave = "%s/autosave.gramps" % filename autosave = "%s/autosave.gramps" % filename
self.statusbar.set_status(_("Saving %s ...") % filename) self.statusbar.set_status(_("Saving %s ...") % filename)
if self.bookmarks:
self.db.setBookmarks(self.bookmarks.getBookmarkList())
Utils.clearModified() Utils.clearModified()
Utils.clear_timer() Utils.clear_timer()
@ -852,7 +853,8 @@ class Gramps:
Utils.clear_timer() Utils.clear_timer()
filename = "%s/autosave.gramps" % (self.db.getSavePath()) filename = "%s/autosave.gramps" % (self.db.getSavePath())
if self.bookmarks:
self.db.setBookmarks(self.bookmarks.getBookmarkList())
self.statusbar.set_status(_("autosaving...")); self.statusbar.set_status(_("autosaving..."));
try: try:
self.db.save(filename,self.quick_progress) self.db.save(filename,self.quick_progress)
@ -933,13 +935,10 @@ class Gramps:
for key in self.db.getFamilyMap().keys(): for key in self.db.getFamilyMap().keys():
family = self.db.getFamily(key) family = self.db.getFamily(key)
if self.active_person == family.getFather(): if self.active_person == family.getFather():
print "removing father"
family.setFather(None) family.setFather(None)
if self.active_person == family.getMother(): if self.active_person == family.getMother():
print "removing mother"
family.setMother(None) family.setMother(None)
if self.active_person in family.getChildList(): if self.active_person in family.getChildList():
print "removing child"
family.removeChild(self.active_person) family.removeChild(self.active_person)
self.db.removePerson(self.active_person.getId()) self.db.removePerson(self.active_person.getId())

View File

@ -361,6 +361,13 @@ class GedcomWriter:
target_obj.set_menu(myMenu) target_obj.set_menu(myMenu)
self.target_menu = myMenu self.target_menu = myMenu
dpath = os.path.dirname(db.getSavePath())
pathname = "%s.ged" % dpath
self.topDialog.get_widget('fileentry1').set_default_path(dpath)
filetgt = self.topDialog.get_widget('filename')
filetgt.set_text(pathname)
self.topDialog.get_widget("gedcomExport").show() self.topDialog.get_widget("gedcomExport").show()
@ -613,6 +620,11 @@ class GedcomWriter:
elif person.getGender() == Person.female: elif person.getGender() == Person.female:
self.g.write("1 SEX F\n") self.g.write("1 SEX F\n")
ad = 0
if (self.adopt == ADOPT_STD or self.adopt == ADOPT_EVENT):
ad = 1
self.write_adopt_event(person)
if not self.restrict or not person.probablyAlive(): if not self.restrict or not person.probablyAlive():
birth = person.getBirth() birth = person.getBirth()
@ -631,8 +643,6 @@ class GedcomWriter:
if uid != "": if uid != "":
self.g.write("1 _UID %s\n" % uid) self.g.write("1 _UID %s\n" % uid)
ad = 0
self.write_ord("BAPL",person.getLdsBaptism(),1,const.lds_baptism) self.write_ord("BAPL",person.getLdsBaptism(),1,const.lds_baptism)
self.write_ord("ENDL",person.getLdsEndowment(),1,const.lds_baptism) self.write_ord("ENDL",person.getLdsEndowment(),1,const.lds_baptism)
self.write_ord("SLGC",person.getLdsSeal(),1,const.lds_csealing) self.write_ord("SLGC",person.getLdsSeal(),1,const.lds_csealing)
@ -646,26 +656,11 @@ class GedcomWriter:
val = const.personalConstantEvents[name] val = const.personalConstantEvents[name]
if val == "": if val == "":
val = self.target_ged.gramps2tag(name) val = self.target_ged.gramps2tag(name)
if self.adopt == ADOPT_EVENT and val == "ADOP": if val == "ADOP" and ad == 1:
ad = 1 continue
self.g.write('1 ADOP\n')
fam = None if val != "" :
for f in person.getParentList():
mrel = string.lower(f[1])
frel = string.lower(f[2])
if mrel=="adopted" or frel=="adopted":
fam = f[0]
break
if fam:
self.g.write('2 FAMC @%s@\n' % self.fid(fam.getId()))
if mrel == frel:
self.g.write('3 ADOP BOTH\n')
elif mrel == "adopted":
self.g.write('3 ADOP WIFE\n')
else:
self.g.write('3 ADOP HUSB\n')
elif val != "" :
self.g.write("1 %s %s\n" % (self.cnvtxt(val),\ self.g.write("1 %s %s\n" % (self.cnvtxt(val),\
self.cnvtxt(event.getDescription()))) self.cnvtxt(event.getDescription())))
else: else:
@ -674,24 +669,6 @@ class GedcomWriter:
self.dump_event_stats(event) self.dump_event_stats(event)
if self.adopt == ADOPT_EVENT and ad == 0 and len(person.getParentList()) > 1:
self.g.write('1 ADOP\n')
fam = None
for f in person.getParentList():
mrel = string.lower(f[1])
frel = string.lower(f[2])
if mrel=="adopted" or frel=="adopted":
fam = f[0]
break
if fam:
self.g.write('2 FAMC @%s@\n' % self.fid(fam.getId()))
if mrel == frel:
self.g.write('3 ADOP BOTH\n')
elif mrel == "adopted":
self.g.write('3 ADOP WIFE\n')
else:
self.g.write('3 ADOP HUSB\n')
for attr in person.getAttributeList(): for attr in person.getAttributeList():
if self.private and attr.getPrivacy(): if self.private and attr.getPrivacy():
continue continue
@ -742,7 +719,7 @@ class GedcomWriter:
for family in person.getParentList(): for family in person.getParentList():
if self.flist.has_key(family[0].getId()): if self.flist.has_key(family[0].getId()):
self.g.write("1 FAMC @%s@\n" % self.fid(family[0].getId())) self.g.write("1 FAMC @%s@\n" % self.fid(family[0].getId()))
if self.adopt == ADOPT_PEDI: if self.adopt == ADOPT_PEDI or self.adopt == ADOPT_STD:
if string.lower(family[1]) == "adopted": if string.lower(family[1]) == "adopted":
self.g.write("2 PEDI Adopted\n") self.g.write("2 PEDI Adopted\n")
@ -762,6 +739,24 @@ class GedcomWriter:
if person.getNote() != "": if person.getNote() != "":
self.write_long_text("NOTE",1,self.cnvtxt(person.getNote())) self.write_long_text("NOTE",1,self.cnvtxt(person.getNote()))
def write_adopt_event(self,person):
fam = None
for f in person.getParentList():
mrel = string.lower(f[1])
frel = string.lower(f[2])
if mrel=="adopted" or frel=="adopted":
fam = f[0]
break
if fam:
self.g.write('1 ADOP\n')
self.g.write('2 FAMC @%s@\n' % self.fid(fam.getId()))
if mrel == frel:
self.g.write('3 ADOP BOTH\n')
elif mrel == "adopted":
self.g.write('3 ADOP WIFE\n')
else:
self.g.write('3 ADOP HUSB\n')
def write_long_text(self,tag,level,note): def write_long_text(self,tag,level,note):
if self.conc == CONC_OK: if self.conc == CONC_OK:
self.write_conc_ok(tag,level,note) self.write_conc_ok(tag,level,note)

File diff suppressed because it is too large Load Diff