Pep8 cleanup, media_link() and doc_link(): can see object description now and making them look and work like each other. indivgallery changes in style sheet.
svn: r15579
This commit is contained in:
parent
71ecdfdee8
commit
1915b899b3
@ -1133,10 +1133,10 @@ div#Residence table.infolist tr td {
|
|||||||
display: block;
|
display: block;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background:none;
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
#indivgallery div.thumbnail a img {
|
#indivgallery div.thumbnail a img {
|
||||||
margin-bottom:.5cm;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: solid 1px #000;
|
border: solid 1px #000;
|
||||||
}
|
}
|
||||||
|
@ -1516,7 +1516,7 @@ class BasePage(object):
|
|||||||
|
|
||||||
# begin individualgallery division and section title
|
# begin individualgallery division and section title
|
||||||
with Html("div", class_ = "subsection", id = "indivgallery") as section:
|
with Html("div", class_ = "subsection", id = "indivgallery") as section:
|
||||||
section += Html("h4", _("Gallery"), inline = True)
|
section += Html("h4", _("Media"), inline = True)
|
||||||
|
|
||||||
displayed = []
|
displayed = []
|
||||||
for mediaref in photolist_ordered:
|
for mediaref in photolist_ordered:
|
||||||
@ -1537,13 +1537,13 @@ class BasePage(object):
|
|||||||
lnkref = (self.report.cur_fname, self.page_title, self.gid)
|
lnkref = (self.report.cur_fname, self.page_title, self.gid)
|
||||||
self.report.add_lnkref_to_photo(photo, lnkref)
|
self.report.add_lnkref_to_photo(photo, lnkref)
|
||||||
real_path, newpath = self.report.prepare_copy_media(photo)
|
real_path, newpath = self.report.prepare_copy_media(photo)
|
||||||
# TODO. Check if build_url_fname can be used.
|
|
||||||
newpath = "/".join(['..']*3 + [newpath])
|
# create thumbnail url
|
||||||
if constfunc.win():
|
# extension needs to be added as it is not already there
|
||||||
newpath = newpath.replace('\\',"/")
|
url = self.report.build_url_fname(photo_handle, "thumb", True) + ".png"
|
||||||
|
|
||||||
# begin hyperlink
|
# begin hyperlink
|
||||||
section += self.media_link(photo_handle, newpath, descr, True, False)
|
section += self.media_link(photo_handle, url, descr, True)
|
||||||
|
|
||||||
except (IOError, OSError), msg:
|
except (IOError, OSError), msg:
|
||||||
WarningDialog(_("Could not add photo to page"), str(msg))
|
WarningDialog(_("Could not add photo to page"), str(msg))
|
||||||
@ -1565,7 +1565,7 @@ class BasePage(object):
|
|||||||
WarningDialog(_("Could not add photo to page"), str(msg))
|
WarningDialog(_("Could not add photo to page"), str(msg))
|
||||||
displayed.append(photo_handle)
|
displayed.append(photo_handle)
|
||||||
|
|
||||||
# add clearline for proper styling
|
# add fullclear for proper styling
|
||||||
section += fullclear
|
section += fullclear
|
||||||
|
|
||||||
# return indivgallery division to its caller
|
# return indivgallery division to its caller
|
||||||
@ -1827,16 +1827,25 @@ class BasePage(object):
|
|||||||
# return hyperlink to its caller
|
# return hyperlink to its caller
|
||||||
return hyper
|
return hyper
|
||||||
|
|
||||||
# TODO. Check img_url of callers
|
|
||||||
def media_link(self, handle, img_url, name, up, usedescr = True):
|
def media_link(self, handle, img_url, name, up, usedescr = True):
|
||||||
|
"""
|
||||||
|
creates and returns a hyperlink to the thumbnail image
|
||||||
|
|
||||||
|
@param: handle - photo handle
|
||||||
|
@param: img_url - thumbnail url
|
||||||
|
@param: name - photo description
|
||||||
|
@param: up - whether to add "../../.." to url
|
||||||
|
@param: usedescr - add media description
|
||||||
|
"""
|
||||||
url = self.report.build_url_fname_html(handle, "img", up)
|
url = self.report.build_url_fname_html(handle, "img", up)
|
||||||
|
|
||||||
# begin thumbnail division
|
# begin thumbnail division
|
||||||
with Html("div", class_ = "thumbnail") as thumbnail:
|
with Html("div", class_ = "thumbnail") as thumbnail:
|
||||||
|
|
||||||
# begin hyperlink
|
# begin hyperlink
|
||||||
hyper = (Html("a", href = url, title = name) +
|
hyper = Html("a", href = url, title = name) + (
|
||||||
Html("img", src = img_url, alt = name) )
|
Html("img", src = img_url, alt = name)
|
||||||
|
)
|
||||||
thumbnail += hyper
|
thumbnail += hyper
|
||||||
|
|
||||||
if usedescr:
|
if usedescr:
|
||||||
@ -1846,11 +1855,18 @@ class BasePage(object):
|
|||||||
return thumbnail
|
return thumbnail
|
||||||
|
|
||||||
def doc_link(self, handle, name, up, usedescr = True):
|
def doc_link(self, handle, name, up, usedescr = True):
|
||||||
# TODO. Check extension of handle
|
"""
|
||||||
|
create a hyperlink for the media object and returns it
|
||||||
|
|
||||||
|
@param: handle - document handle
|
||||||
|
@param: name - document name
|
||||||
|
@param: up - whether to add "../../.." or not
|
||||||
|
@param: usedescr - add description to hyperlink
|
||||||
|
"""
|
||||||
url = self.report.build_url_fname(handle, "img", up)
|
url = self.report.build_url_fname(handle, "img", up)
|
||||||
|
|
||||||
# begin thumbnail division
|
# begin thumbnail division
|
||||||
thumbnail = Html("div", class_ = "thumbnail")
|
with Html("div", class_ = "thumbnail") as thumbnail:
|
||||||
|
|
||||||
# begin hyperlink
|
# begin hyperlink
|
||||||
hyper = Html("a", href = url, title = name)
|
hyper = Html("a", href = url, title = name)
|
||||||
|
Loading…
Reference in New Issue
Block a user