Mercurial > hg > index.fcgi > www > www-1
comparison pics2/pics_app.py @ 58:675002109a6a
add vice.com in myrss/FEEDS
author | paulo |
---|---|
date | Wed, 15 Jan 2014 00:49:30 -0700 |
parents | 496714f2fd8c |
children | b7966ae653f2 |
comparison
equal
deleted
inserted
replaced
2:33cc05f1f73b | 3:e25dadc6786d |
---|---|
77 body.h1(title) | 77 body.h1(title) |
78 | 78 |
79 return (root, header, body) | 79 return (root, header, body) |
80 | 80 |
81 | 81 |
82 def _go_thumbnail_links_to_browse_imgs_html_body(self, body, t, b, selclass=None): | 82 def _go_thumbnail_links_to_browse_imgs_html_body(self, body, t, b, a_args={}, img_args={}): |
83 thumb_img_url = self._get_pics_url(t) | 83 thumb_img_url = self._get_pics_url(t) |
84 browse_url = self._get_app_url(b) | 84 browse_url = self._get_app_url(b) |
85 | 85 |
86 a = body.a(href=browse_url) | 86 a = body.a(href=browse_url, **a_args) |
87 | 87 a.img(src=thumb_img_url, **img_args) |
88 if selclass is not None: | |
89 a.img(src=thumb_img_url, klass=selclass) | |
90 else: | |
91 a.img(src=thumb_img_url) | |
92 | 88 |
93 body.text(' ') | 89 body.text(' ') |
94 | 90 |
95 | 91 |
96 def __init__(self, environ): | 92 def __init__(self, environ): |
165 from_img = qs["from"][0] | 161 from_img = qs["from"][0] |
166 | 162 |
167 html_p = html_body.p | 163 html_p = html_body.p |
168 for (t, b) in _get_images(d): | 164 for (t, b) in _get_images(d): |
169 if from_img is not None and b == from_img: | 165 if from_img is not None and b == from_img: |
170 self._go_thumbnail_links_to_browse_imgs_html_body(html_p, t, b, "sel2") | 166 self._go_thumbnail_links_to_browse_imgs_html_body(html_p, t, b, img_args={"klass":"sel2", "id":"selected"}) |
171 else: | 167 else: |
172 self._go_thumbnail_links_to_browse_imgs_html_body(html_p, t, b) | 168 self._go_thumbnail_links_to_browse_imgs_html_body(html_p, t, b) |
173 | 169 |
174 html_body.a("(Other pictures)", href=self._get_app_url('')) | 170 html_body.a("(Other pictures)", href=self._get_app_url('')) |
175 return html_root | 171 return html_root |
199 | 195 |
200 if x is None: | 196 if x is None: |
201 raise AssertionError | 197 raise AssertionError |
202 | 198 |
203 (html_root, html_header, html_body) = self._get_standard_html_doc(u"%s \u2014 %s of %s" % (d, x, len(imgs))) | 199 (html_root, html_header, html_body) = self._get_standard_html_doc(u"%s \u2014 %s of %s" % (d, x, len(imgs))) |
200 | |
201 html_header.script('', type="text/javascript", src=self._get_pics_url("np_keys.js")) | |
204 | 202 |
205 browse_img_url = self._get_pics_url(img) | 203 browse_img_url = self._get_pics_url(img) |
206 html_body.p.img(src=browse_img_url) | 204 html_body.p.img(src=browse_img_url) |
207 | 205 |
208 logging.debug("imgs_circ = %s" % imgs_circ) | 206 logging.debug("imgs_circ = %s" % imgs_circ) |
209 | 207 |
210 html_p = html_body.p | 208 html_p = html_body.p |
211 for i in imgs_circ: | 209 for (i, img_c) in enumerate(imgs_circ): |
212 if i is not None: | 210 if img_c is not None: |
213 (t, b) = i | 211 (t, b) = img_c |
212 a_args = {} | |
213 img_args = {} | |
214 if b == img: | 214 if b == img: |
215 self._go_thumbnail_links_to_browse_imgs_html_body(html_p, t, d + "?from=" + img, "sel") | 215 a_args = {"id": "up"} |
216 else: | 216 img_args = {"klass": "sel"} |
217 self._go_thumbnail_links_to_browse_imgs_html_body(html_p, t, b) | 217 b = "%s?from=%s#selected" % (d, img) |
218 elif i == v + 1: | |
219 a_args = {"id": "next"} | |
220 elif i == v - 1: | |
221 a_args = {"id": "prev"} | |
222 | |
223 self._go_thumbnail_links_to_browse_imgs_html_body(html_p, t, b, a_args, img_args) | |
218 | 224 |
219 return html_root | 225 return html_root |
220 | 226 |
221 | 227 |
222 def app(environ, start_response): | 228 def app(environ, start_response): |