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 attr_name
global hide_altnames
global paper_preference
global output_preference
if page != -1:
return

View File

@ -699,9 +699,15 @@ def on_add_attr_clicked(obj):
edit_person_obj = obj.get_data(EDITPERSON)
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())
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.redraw_attr_list()
utils.modified()

View File

@ -96,11 +96,11 @@ def on_source_apply_clicked(obj):
utils.modified()
if title != edit.source.getTitle():
edit.source.setAuthor(title)
edit.source.setTitle(title)
utils.modified()
if pubinfo != edit.source.getPubInfo():
edit.source.setAuthor(pubinfo)
edit.source.sePubInfo(pubinfo)
utils.modified()
if note != edit.source.getNote():
@ -108,6 +108,6 @@ def on_source_apply_clicked(obj):
utils.modified()
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)
image_name = self.tempdir + os.sep + "Pictures" + os.sep + base
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)
else:
im = PIL.Image.open(file)

View File

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

View File

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

View File

@ -702,7 +702,7 @@ def on_edit_source_clicked(obj):
#
#-------------------------------------------------------------------------
def new_source_after_edit(source):
database.addSource(source.source)
database.addSource(source)
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))
base = os.path.basename(file)
image_name = targetDir + os.sep + base
cmd = const.convert + " -size " + str(width) + "x200 "\
+ file + " " + image_name
cmd = "%s -size %dx200 '%s' '%s'" % (const.convert,width,file,image_name)
os.system(cmd)
html.write('<IMG SRC="' + base + '" ALT="')
html.write(photo_list[0].getDescription())

View File

@ -292,13 +292,17 @@ class GedcomParser:
elif matches[2] == "REPO":
print "REPO",matches[1]
self.ignore_sub_junk(1)
elif matches[2] == "NOTE":
elif matches[2][0:4] == "NOTE":
if self.nmap.has_key(matches[1]):
noteobj = self.nmap[matches[1]]
else:
noteobj = Note()
self.nmap[matches[1]] = noteobj
noteobj.set(self.parse_continue_data(1))
text = matches[2][4:]
if text == "":
noteobj.set(self.parse_continue_data(1))
else:
noteobj.set(text + self.parse_continue_data(1))
self.parse_note_data(1)
elif matches[2] == "OBJE":
print "OBJE",matches[1]
@ -377,6 +381,7 @@ class GedcomParser:
self.ignore_sub_junk(2)
elif matches[1] == "CHIL":
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":
pass
elif matches[1] == "REFN" or matches[1] == "CHAN":
@ -406,9 +411,9 @@ class GedcomParser:
else:
event = Event()
try:
event.setName(ged2fam[matches[2]])
event.setName(ged2fam[matches[1]])
except:
event.setName(matches[2])
event.setName(matches[1])
self.family.addEvent(event)
self.parse_family_event(event,2)
@ -695,7 +700,7 @@ class GedcomParser:
source_ref = SourceRef()
source_ref.setBase(self.db.findSource(matches[2],self.smap))
event.setSourceRef(source_ref)
self.parse_source_reference(source,level+1)
self.parse_source_reference(source_ref,level+1)
elif matches[1] == "FAMC":
family = self.db.findFamily(matches[2],self.fmap)
if event.getName() == "Birth":
@ -717,6 +722,9 @@ class GedcomParser:
#
#---------------------------------------------------------------------
def parse_family_event(self,event,level):
global ged2fam
global ged2rel
while 1:
matches = self.get_next()
if int(matches[0]) < level:
@ -859,7 +867,6 @@ class GedcomParser:
while 1:
matches = self.get_next()
print matches[0],matches[1],matches[2]
if int(matches[0]) == 0:
self.backup()
return
@ -881,7 +888,7 @@ class GedcomParser:
elif matches[1] == "DEST":
pass
elif matches[1] == "FILE":
self.ignore_sub_junk(1)
self.ignore_sub_junk(2)
elif matches[1] == "COPR":
pass
elif matches[1] == "CHAR":
@ -890,9 +897,11 @@ class GedcomParser:
self.code = UNICODE
elif matches[2] == "ANSEL":
self.code = ANSEL
self.parse_sub_char(2)
self.ignore_sub_junk(2)
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":
print "Language is",matches[2]
elif matches[1] == "PLAC":
@ -902,12 +911,79 @@ class GedcomParser:
date.date = matches[2]
elif matches[1] == "NOTE":
note = matches[2] + self.parse_continue_data(2)
print note
elif matches[1][0] == "_":
self.ignore_sub_junk(2)
else:
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:
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()
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)
#---------------------------------------------------------------------
#
#