changes suggested by Benny (code review)

svn: r11907
This commit is contained in:
Stéphane Charette 2009-02-08 04:49:15 +00:00
parent f5681c0168
commit 5a4fbf1ae4

View File

@ -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,24 +1173,20 @@ 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()
# go media refs looking for one that points to this image
for mediaref in medialist:
rh = mediaref.get_referenced_handles()
(classname, h) = rh[0]
# 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
(x1, y1, x2, y2) = mediaref.rect
# GRAMPS gives us absolute coordinates,
# but we need relative width + height
w = x2 - x1