* src/GrampsDb/_ReadXML.py: read region tag in xml
* src/GrampsDb/_WriteXML.py: output region tag in xml (=subsection of picture) * src/Editors/_EditMediaRef.py: make sure rectangle is none if nothing given 2007-09-29 Benny Malengier <benny.malengier@gramps-project.org> svn: r9039
This commit is contained in:
parent
38a312e4a4
commit
bb231a73f1
@ -1,3 +1,8 @@
|
|||||||
|
2007-09-29 Benny Malengier <benny.malengier@gramps-project.org>
|
||||||
|
* src/GrampsDb/_ReadXML.py: read region tag in xml
|
||||||
|
* src/GrampsDb/_WriteXML.py: output region tag in xml (=subsection of picture)
|
||||||
|
* src/Editors/_EditMediaRef.py: make sure rectangle is none if nothing given
|
||||||
|
|
||||||
2007-09-29 Benny Malengier <benny.malengier@gramps-project.org>
|
2007-09-29 Benny Malengier <benny.malengier@gramps-project.org>
|
||||||
* src/GrampsDb/_ReadXML.py: remove bug: no more creation of objects if bookmark is found with
|
* src/GrampsDb/_ReadXML.py: remove bug: no more creation of objects if bookmark is found with
|
||||||
handle that is not in database. This causes corruption of database!
|
handle that is not in database. This causes corruption of database!
|
||||||
|
@ -206,7 +206,10 @@ class EditMediaRef(EditReference):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (coord[0] == None and coord[1] == None
|
if (coord[0] == None and coord[1] == None
|
||||||
and coord[2] == None and coord[3] == None):
|
and coord[2] == None and coord[3] == None) or (
|
||||||
|
coord[0] == 0 and coord[1] == 0
|
||||||
|
and coord[2] == 0 and coord[3] == 0
|
||||||
|
):
|
||||||
coord = None
|
coord = None
|
||||||
|
|
||||||
self.source_ref.set_rectangle(coord)
|
self.source_ref.set_rectangle(coord)
|
||||||
|
@ -386,6 +386,7 @@ class GrampsParser(UpdateCallback):
|
|||||||
"families" : (None, self.stop_families),
|
"families" : (None, self.stop_families),
|
||||||
"family" : (self.start_family, self.stop_family),
|
"family" : (self.start_family, self.stop_family),
|
||||||
"rel" : (self.start_rel, None),
|
"rel" : (self.start_rel, None),
|
||||||
|
"region" : (self.start_region, None),
|
||||||
"father" : (self.start_father, None),
|
"father" : (self.start_father, None),
|
||||||
"first" : (None, self.stop_first),
|
"first" : (None, self.stop_first),
|
||||||
"call" : (None, self.stop_call),
|
"call" : (None, self.stop_call),
|
||||||
@ -1190,6 +1191,13 @@ class GrampsParser(UpdateCallback):
|
|||||||
elif self.placeobj:
|
elif self.placeobj:
|
||||||
self.placeobj.add_media_reference(self.objref)
|
self.placeobj.add_media_reference(self.objref)
|
||||||
|
|
||||||
|
def start_region(self,attrs):
|
||||||
|
rect = (int(attrs.get('corner1_x')),
|
||||||
|
int(attrs.get('corner1_y')),
|
||||||
|
int(attrs.get('corner2_x')),
|
||||||
|
int(attrs.get('corner2_y')) )
|
||||||
|
self.objref.set_rectangle(rect)
|
||||||
|
|
||||||
def start_object(self,attrs):
|
def start_object(self,attrs):
|
||||||
gramps_id = self.map_oid(attrs['id'])
|
gramps_id = self.map_oid(attrs['id'])
|
||||||
try:
|
try:
|
||||||
|
@ -911,11 +911,30 @@ class XmlWriter(UpdateCallback):
|
|||||||
self.g.write(' priv="1"')
|
self.g.write(' priv="1"')
|
||||||
proplist = photo.get_attribute_list()
|
proplist = photo.get_attribute_list()
|
||||||
refslist = photo.get_source_references()
|
refslist = photo.get_source_references()
|
||||||
|
rect = photo.get_rectangle()
|
||||||
|
if rect is not None :
|
||||||
|
corner1_x = rect[0]
|
||||||
|
corner1_y = rect[1]
|
||||||
|
corner2_x = rect[2]
|
||||||
|
corner2_y = rect[3]
|
||||||
|
if corner1_x==None : corner1_x = 0
|
||||||
|
if corner1_y==None : corner1_y = 0
|
||||||
|
if corner2_x==None : corner2_x = 0
|
||||||
|
if corner2_y==None : corner2_y = 0
|
||||||
|
#don't output not set rectangle
|
||||||
|
if (corner1_x == 0 and corner1_y == 0
|
||||||
|
and corner2_x == 0 and corner2_y == 0
|
||||||
|
):
|
||||||
|
rect = None
|
||||||
if len(proplist) == 0 and len(refslist) == 0 \
|
if len(proplist) == 0 and len(refslist) == 0 \
|
||||||
and photo.get_note() == "":
|
and photo.get_note() == "" and rect is None:
|
||||||
self.g.write("/>\n")
|
self.g.write("/>\n")
|
||||||
else:
|
else:
|
||||||
self.g.write(">\n")
|
self.g.write(">\n")
|
||||||
|
if rect is not None :
|
||||||
|
self.g.write(' %s<region corner1_x="%d" corner1_y="%d" '
|
||||||
|
'corner2_x="%d" corner2_y="%d"/>\n' %
|
||||||
|
(sp,corner1_x,corner1_y,corner2_x,corner2_y))
|
||||||
self.write_attribute_list(proplist,indent+1)
|
self.write_attribute_list(proplist,indent+1)
|
||||||
for ref in refslist:
|
for ref in refslist:
|
||||||
self.dump_source_ref(ref,indent+1)
|
self.dump_source_ref(ref,indent+1)
|
||||||
|
Loading…
Reference in New Issue
Block a user