Fixed paper/output settings, problems with images with spaces, understand FTW gedcom

svn: r70
This commit is contained in:
Don Allingham
2001-05-31 13:38:24 +00:00
parent ad0d5d0415
commit 23738ca234
9 changed files with 103 additions and 56 deletions

View File

@ -288,6 +288,8 @@ def on_propertybox_apply(obj,page):
global display_attr global display_attr
global attr_name global attr_name
global hide_altnames global hide_altnames
global paper_preference
global output_preference
if page != -1: if page != -1:
return return

View File

@ -699,9 +699,15 @@ def on_add_attr_clicked(obj):
edit_person_obj = obj.get_data(EDITPERSON) edit_person_obj = obj.get_data(EDITPERSON)
attr = Attribute() attr = Attribute()
attr.setType(edit_person_obj.attr_type.get_text()) name = edit_person_obj.attr_type.get_text()
attr.setType(name)
attr.setValue(edit_person_obj.attr_value.get_text()) attr.setValue(edit_person_obj.attr_value.get_text())
if name not in const.personalAttributes:
const.personalAttributes.append(name)
menu = edit_person_obj.get_widget("attribute")
menu.set_popdown_strings(const.personalAttributes)
edit_person_obj.person.addAttribute(attr) edit_person_obj.person.addAttribute(attr)
edit_person_obj.redraw_attr_list() edit_person_obj.redraw_attr_list()
utils.modified() utils.modified()

View File

@ -96,11 +96,11 @@ def on_source_apply_clicked(obj):
utils.modified() utils.modified()
if title != edit.source.getTitle(): if title != edit.source.getTitle():
edit.source.setAuthor(title) edit.source.setTitle(title)
utils.modified() utils.modified()
if pubinfo != edit.source.getPubInfo(): if pubinfo != edit.source.getPubInfo():
edit.source.setAuthor(pubinfo) edit.source.sePubInfo(pubinfo)
utils.modified() utils.modified()
if note != edit.source.getNote(): if note != edit.source.getNote():
@ -108,6 +108,6 @@ def on_source_apply_clicked(obj):
utils.modified() utils.modified()
utils.destroy_passed_object(edit.top) utils.destroy_passed_object(edit.top)
edit.callback(1) edit.callback(edit.source)

View File

@ -425,7 +425,7 @@ class OpenOfficeDoc(TextDoc):
base = os.path.basename(file) base = os.path.basename(file)
image_name = self.tempdir + os.sep + "Pictures" + os.sep + base image_name = self.tempdir + os.sep + "Pictures" + os.sep + base
if no_pil: if no_pil:
cmd = "%s -size %dx%d %s %s" % (const.convert,width,height,file,image_name) cmd = "%s -size %dx%d '%s' '%s'" % (const.convert,width,height,file,image_name)
os.system(cmd) os.system(cmd)
else: else:
im = PIL.Image.open(file) im = PIL.Image.open(file)

View File

@ -61,7 +61,7 @@ def import_photo(filename,path,prefix):
shutil.copy(filename,name) shutil.copy(filename,name)
else: else:
if no_pil: if no_pil:
cmd = "%s %s %s" % (const.convert,filename,name) cmd = "%s '%s' '%s'" % (const.convert,filename,name)
os.system(cmd) os.system(cmd)
else: else:
PIL.Image.open(filename).save(name) PIL.Image.open(filename).save(name)

View File

@ -3719,7 +3719,7 @@ Other
<class>GtkText</class> <class>GtkText</class>
<name>source_note</name> <name>source_note</name>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<editable>False</editable> <editable>True</editable>
<text></text> <text></text>
</widget> </widget>
</widget> </widget>

View File

@ -702,7 +702,7 @@ def on_edit_source_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def new_source_after_edit(source): def new_source_after_edit(source):
database.addSource(source.source) database.addSource(source)
update_display(1) update_display(1)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -419,8 +419,7 @@ def dump_person(person,prefix,templateTop,templateBottom,targetDir):
width = int( (float(image.rgb_width) * 200.0) / float(image.rgb_height)) width = int( (float(image.rgb_width) * 200.0) / float(image.rgb_height))
base = os.path.basename(file) base = os.path.basename(file)
image_name = targetDir + os.sep + base image_name = targetDir + os.sep + base
cmd = const.convert + " -size " + str(width) + "x200 "\ cmd = "%s -size %dx200 '%s' '%s'" % (const.convert,width,file,image_name)
+ file + " " + image_name
os.system(cmd) os.system(cmd)
html.write('<IMG SRC="' + base + '" ALT="') html.write('<IMG SRC="' + base + '" ALT="')
html.write(photo_list[0].getDescription()) html.write(photo_list[0].getDescription())

View File

@ -292,13 +292,17 @@ class GedcomParser:
elif matches[2] == "REPO": elif matches[2] == "REPO":
print "REPO",matches[1] print "REPO",matches[1]
self.ignore_sub_junk(1) self.ignore_sub_junk(1)
elif matches[2] == "NOTE": elif matches[2][0:4] == "NOTE":
if self.nmap.has_key(matches[1]): if self.nmap.has_key(matches[1]):
noteobj = self.nmap[matches[1]] noteobj = self.nmap[matches[1]]
else: else:
noteobj = Note() noteobj = Note()
self.nmap[matches[1]] = noteobj self.nmap[matches[1]] = noteobj
text = matches[2][4:]
if text == "":
noteobj.set(self.parse_continue_data(1)) noteobj.set(self.parse_continue_data(1))
else:
noteobj.set(text + self.parse_continue_data(1))
self.parse_note_data(1) self.parse_note_data(1)
elif matches[2] == "OBJE": elif matches[2] == "OBJE":
print "OBJE",matches[1] print "OBJE",matches[1]
@ -377,6 +381,7 @@ class GedcomParser:
self.ignore_sub_junk(2) self.ignore_sub_junk(2)
elif matches[1] == "CHIL": elif matches[1] == "CHIL":
self.family.addChild(self.db.findPerson(matches[2],self.pmap)) self.family.addChild(self.db.findPerson(matches[2],self.pmap))
self.ignore_sub_junk(2)
elif matches[1] == "NCHI" or matches[1] == "RIN" or matches[1] == "SUBM": elif matches[1] == "NCHI" or matches[1] == "RIN" or matches[1] == "SUBM":
pass pass
elif matches[1] == "REFN" or matches[1] == "CHAN": elif matches[1] == "REFN" or matches[1] == "CHAN":
@ -406,9 +411,9 @@ class GedcomParser:
else: else:
event = Event() event = Event()
try: try:
event.setName(ged2fam[matches[2]]) event.setName(ged2fam[matches[1]])
except: except:
event.setName(matches[2]) event.setName(matches[1])
self.family.addEvent(event) self.family.addEvent(event)
self.parse_family_event(event,2) self.parse_family_event(event,2)
@ -695,7 +700,7 @@ class GedcomParser:
source_ref = SourceRef() source_ref = SourceRef()
source_ref.setBase(self.db.findSource(matches[2],self.smap)) source_ref.setBase(self.db.findSource(matches[2],self.smap))
event.setSourceRef(source_ref) event.setSourceRef(source_ref)
self.parse_source_reference(source,level+1) self.parse_source_reference(source_ref,level+1)
elif matches[1] == "FAMC": elif matches[1] == "FAMC":
family = self.db.findFamily(matches[2],self.fmap) family = self.db.findFamily(matches[2],self.fmap)
if event.getName() == "Birth": if event.getName() == "Birth":
@ -717,6 +722,9 @@ class GedcomParser:
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def parse_family_event(self,event,level): def parse_family_event(self,event,level):
global ged2fam
global ged2rel
while 1: while 1:
matches = self.get_next() matches = self.get_next()
if int(matches[0]) < level: if int(matches[0]) < level:
@ -859,7 +867,6 @@ class GedcomParser:
while 1: while 1:
matches = self.get_next() matches = self.get_next()
print matches[0],matches[1],matches[2]
if int(matches[0]) == 0: if int(matches[0]) == 0:
self.backup() self.backup()
return return
@ -881,7 +888,7 @@ class GedcomParser:
elif matches[1] == "DEST": elif matches[1] == "DEST":
pass pass
elif matches[1] == "FILE": elif matches[1] == "FILE":
self.ignore_sub_junk(1) self.ignore_sub_junk(2)
elif matches[1] == "COPR": elif matches[1] == "COPR":
pass pass
elif matches[1] == "CHAR": elif matches[1] == "CHAR":
@ -890,9 +897,11 @@ class GedcomParser:
self.code = UNICODE self.code = UNICODE
elif matches[2] == "ANSEL": elif matches[2] == "ANSEL":
self.code = ANSEL self.code = ANSEL
self.parse_sub_char(2) self.ignore_sub_junk(2)
elif matches[1] == "GEDC": elif matches[1] == "GEDC":
self.parse_gedc(2) self.ignore_sub_junk(2)
elif matches[1] == "_SCHEMA":
self.parse_ftw_schema(2)
elif matches[1] == "LANG": elif matches[1] == "LANG":
print "Language is",matches[2] print "Language is",matches[2]
elif matches[1] == "PLAC": elif matches[1] == "PLAC":
@ -902,12 +911,79 @@ class GedcomParser:
date.date = matches[2] date.date = matches[2]
elif matches[1] == "NOTE": elif matches[1] == "NOTE":
note = matches[2] + self.parse_continue_data(2) note = matches[2] + self.parse_continue_data(2)
print note
elif matches[1][0] == "_": elif matches[1][0] == "_":
self.ignore_sub_junk(2) self.ignore_sub_junk(2)
else: else:
self.barf(2) self.barf(2)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def parse_ftw_schema(self,level):
while 1:
matches = self.get_next()
if int(matches[0]) < level:
self.backup()
return
elif matches[1] == "INDI":
self.parse_ftw_indi_schema(level+1)
elif matches[1] == "FAM":
self.parse_ftw_fam_schema(level+1)
else:
self.barf(2)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def parse_ftw_indi_schema(self,level):
while 1:
matches = self.get_next()
if int(matches[0]) < level:
self.backup()
return
else:
label = self.parse_label(level+1)
ged2rel[matches[1]] = label
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def parse_label(self,level):
while 1:
matches = self.get_next()
if int(matches[0]) < level:
self.backup()
return
elif matches[1] == "LABL":
return matches[2]
else:
self.barf(2)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def parse_ftw_fam_schema(self,level):
while 1:
matches = self.get_next()
if int(matches[0]) < level:
self.backup()
return
else:
label = self.parse_label(level+1)
ged2fam[matches[1]] = label
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
# #
@ -940,23 +1016,6 @@ class GedcomParser:
else: else:
self.backup() self.backup()
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def parse_sub_char(self,level):
while 1:
matches = self.get_next()
if int(matches[0]) < level:
self.backup()
return
elif matches[1] == "VERS":
print "CHAR version is",matches[2]
else:
self.barf(level+1)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
# #
@ -992,25 +1051,6 @@ class GedcomParser:
self.backup() self.backup()
return data return data
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def parse_gedc(self,level):
while 1:
matches = self.get_next()
if int(matches[0]) < level:
self.backup()
return
elif matches[1] == "VERS":
print "Gedcom version is",matches[2]
elif matches[1] == "FORM":
print "Gedcom form is",matches[2]
else:
self.barf(level+1)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
# #