2007-10-01 Benny Malengier <benny.malengier@gramps-project.org>

* src/GrampsDbUtils/_ReadXML.py: read region tag in xml
	* src/GrampsDb/_GrampsDbWriteXML.py: output region tag in xml (=subsection of picture)
	* src/GrampsDb/_GrampsDbConst.py: change env_dir in ENV_DIR
	* src/Editors/_EditMediaRef.py: remove bug with coord None


svn: r9057
This commit is contained in:
Benny Malengier 2007-10-01 19:55:48 +00:00
parent b7803fefc4
commit 7a7d31bbbc
5 changed files with 41 additions and 5 deletions

View File

@ -1,4 +1,10 @@
2007-09-28 James G. Sack <jgsack@san.rr.com>
2007-10-01 Benny Malengier <benny.malengier@gramps-project.org>
* src/GrampsDbUtils/_ReadXML.py: read region tag in xml
* src/GrampsDb/_GrampsDbWriteXML.py: output region tag in xml (=subsection of picture)
* src/GrampsDb/_GrampsDbConst.py: change env_dir in ENV_DIR
* src/Editors/_EditMediaRef.py: remove bug with coord None
2007-10-01 James G. Sack <jgsack@san.rr.com>
* src/gramps.py: remove wrong setting of sys.path
2007-10-01 Zsolt Foldvari <zfoldvar@users.sourceforge.net>

View File

@ -88,12 +88,12 @@ class EditMediaRef(EditReference):
coord = self.source_ref.get_rectangle()
#upgrade path: set invalid (from eg old db) to none
if (coord[0] == None and coord[1] == None
if coord is not None and ((coord[0] == None and coord[1] == None
and coord[2] == None and coord[3] == None) or (
coord[0] == 0 and coord[1] == 0
and coord[2] == 100 and coord[3] == 100) or (
coord[0] == coord[2] and coord[1] == coord[3]
):
)):
coord = None
self.rectangle = coord

View File

@ -40,7 +40,7 @@ else:
USER_HOME = os.environ['HOME']
HOME_DIR = os.path.join(USER_HOME,'.gramps')
env_dir = os.path.join(HOME_DIR,"env")
ENV_DIR = os.path.join(HOME_DIR,"env")
APP_GRAMPS = "application/x-gramps"

View File

@ -943,10 +943,32 @@ class GrampsDbXmlWriter(UpdateCallback):
proplist = photo.get_attribute_list()
refslist = photo.get_source_references()
nreflist = photo.get_note_list()
if (len(proplist) + len(nreflist) + len(refslist)) == 0:
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 = 100
if corner2_y==None : corner2_y = 100
#don't output not set rectangle
if (corner1_x == 0 and corner1_y == 0
and corner2_x == 0 and corner2_y == 0
) or (corner1_x == 0 and corner1_y == 0
and corner2_x == 100 and corner2_y == 100
):
rect = None
if (len(proplist) + len(nreflist) + len(refslist)) == 0 \
and rect is None:
self.g.write("/>\n")
else:
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)
for ref in refslist:
self.dump_source_ref(ref,indent+1)

View File

@ -382,6 +382,7 @@ class GrampsParser(UpdateCallback):
"families" : (None, self.stop_families),
"family" : (self.start_family, self.stop_family),
"rel" : (self.start_rel, None),
"region" : (self.start_region, None),
"father" : (self.start_father, None),
"first" : (None, self.stop_first),
"call" : (None, self.stop_call),
@ -1342,6 +1343,13 @@ class GrampsParser(UpdateCallback):
elif self.placeobj:
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):
gramps_id = self.map_oid(attrs['id'])
try: