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
@ -1120,32 +1120,32 @@ div#Residence table.infolist tr td {
|
||||
/* Subsections : Gallery
|
||||
----------------------------------------------------- */
|
||||
#indivgallery h4 {
|
||||
margin-bottom:1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
#indivgallery .thumbnail {
|
||||
margin:0;
|
||||
float:left;
|
||||
width:130px;
|
||||
height:150px;
|
||||
text-align:center;
|
||||
margin: 0;
|
||||
float: left;
|
||||
width: 130px;
|
||||
height: 150px;
|
||||
text-align: center;
|
||||
}
|
||||
#indivgallery div.thumbnail a {
|
||||
display:block;
|
||||
margin:0;
|
||||
padding:0;
|
||||
background:none;
|
||||
display: block;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
#indivgallery div.thumbnail a img {
|
||||
margin-bottom:.5cm;
|
||||
padding:0;
|
||||
padding: 0;
|
||||
border: solid 1px #000;
|
||||
}
|
||||
#indivgallery div.thumbnail p {
|
||||
font:normal .7em/1.4em sans-serif;
|
||||
text-align:center;
|
||||
width:80%;
|
||||
margin:0 auto;
|
||||
padding:0;
|
||||
font: normal .7em/1.4em sans-serif;
|
||||
text-align: center;
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Subsections : Narrative
|
||||
|
@ -1516,7 +1516,7 @@ class BasePage(object):
|
||||
|
||||
# begin individualgallery division and section title
|
||||
with Html("div", class_ = "subsection", id = "indivgallery") as section:
|
||||
section += Html("h4", _("Gallery"), inline = True)
|
||||
section += Html("h4", _("Media"), inline = True)
|
||||
|
||||
displayed = []
|
||||
for mediaref in photolist_ordered:
|
||||
@ -1537,13 +1537,13 @@ class BasePage(object):
|
||||
lnkref = (self.report.cur_fname, self.page_title, self.gid)
|
||||
self.report.add_lnkref_to_photo(photo, lnkref)
|
||||
real_path, newpath = self.report.prepare_copy_media(photo)
|
||||
# TODO. Check if build_url_fname can be used.
|
||||
newpath = "/".join(['..']*3 + [newpath])
|
||||
if constfunc.win():
|
||||
newpath = newpath.replace('\\',"/")
|
||||
|
||||
# create thumbnail url
|
||||
# extension needs to be added as it is not already there
|
||||
url = self.report.build_url_fname(photo_handle, "thumb", True) + ".png"
|
||||
|
||||
# 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:
|
||||
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))
|
||||
displayed.append(photo_handle)
|
||||
|
||||
# add clearline for proper styling
|
||||
# add fullclear for proper styling
|
||||
section += fullclear
|
||||
|
||||
# return indivgallery division to its caller
|
||||
@ -1827,16 +1827,25 @@ class BasePage(object):
|
||||
# return hyperlink to its caller
|
||||
return hyper
|
||||
|
||||
# TODO. Check img_url of callers
|
||||
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)
|
||||
|
||||
# begin thumbnail division
|
||||
with Html("div", class_ = "thumbnail") as thumbnail:
|
||||
|
||||
# begin hyperlink
|
||||
hyper = (Html("a", href = url, title = name) +
|
||||
Html("img", src = img_url, alt = name) )
|
||||
hyper = Html("a", href = url, title = name) + (
|
||||
Html("img", src = img_url, alt = name)
|
||||
)
|
||||
thumbnail += hyper
|
||||
|
||||
if usedescr:
|
||||
@ -1846,11 +1855,18 @@ class BasePage(object):
|
||||
return thumbnail
|
||||
|
||||
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)
|
||||
|
||||
# begin thumbnail division
|
||||
thumbnail = Html("div", class_ = "thumbnail")
|
||||
with Html("div", class_ = "thumbnail") as thumbnail:
|
||||
|
||||
# begin hyperlink
|
||||
hyper = Html("a", href = url, title = name)
|
||||
|
Loading…
Reference in New Issue
Block a user