From 5a4fbf1ae4ffd498fe85e1492db4debabca111df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Charette?= Date: Sun, 8 Feb 2009 04:49:15 +0000 Subject: [PATCH] changes suggested by Benny (code review) svn: r11907 --- src/plugins/webreport/NarrativeWeb.py | 42 ++++++++++++--------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index 799a91310..d4bbe3eca 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -1151,8 +1151,6 @@ class MediaPage(BasePage): ************************************* """ - # TODO, FIXME: Please code review this next block! - # get all of the backlinks to this media object; meaning all of # the people, events, places, etc..., that use this image _region_items = set() @@ -1175,33 +1173,29 @@ class MediaPage(BasePage): _obj = db.get_event_from_handle( newhandle ) _name = _obj.get_description() - # if we found a db object to work with... - if _obj: + # keep looking if we don't have an object + if _obj is None: + continue - # get a list of all media refs for this object - medialist = _obj.get_media_list() + # get a list of all media refs for this object + medialist = _obj.get_media_list() - # go media refs looking for one that points to this image - for mediaref in medialist: - rh = mediaref.get_referenced_handles() - (classname, h) = rh[0] + # go media refs looking for one that points to this image + for mediaref in medialist: - # if the handles indicate this is a match... - if h == handle: + # is this mediaref for this image? do we have a rect? + if mediaref.ref == handle and mediaref.rect is not None: - # get the rectangle (if any) defined in this media ref - rectangle = mediaref.get_rectangle() - if rectangle: - (x1, y1, x2, y2) = rectangle - # GRAMPS gives us absolute coordinates, - # but we need relative width + height - w = x2 - x1 - h = y2 - y1 + (x1, y1, x2, y2) = mediaref.rect + # GRAMPS gives us absolute coordinates, + # but we need relative width + height + w = x2 - x1 + h = y2 - y1 - # remember all this information, cause we'll need - # need it later when we output the
  • ...
  • tags - item = (_name, x1, y1, w, h, _linkurl) - _region_items.add(item) + # remember all this information, cause we'll need + # need it later when we output the
  • ...
  • tags + item = (_name, x1, y1, w, h, _linkurl) + _region_items.add(item) """ ************************************* end of code that looks for and prepares the media object regions