Changeset 4359
- Timestamp:
- 09/30/08 03:44:37 (3 months ago)
- Files:
-
- screenshotsplugin/0.11/tracscreenshots/core.py (modified) (2 diffs)
- screenshotsplugin/0.11/tracscreenshots/htdocs/css/matrix-view.css (modified) (3 diffs)
- screenshotsplugin/0.11/tracscreenshots/htdocs/css/screenshots.css (modified) (6 diffs)
- screenshotsplugin/0.11/tracscreenshots/matrix_view.py (modified) (3 diffs)
- screenshotsplugin/0.11/tracscreenshots/templates/screenshots-matrix-view.html (modified) (1 diff)
- screenshotsplugin/0.11/tracscreenshots/wiki.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
screenshotsplugin/0.11/tracscreenshots/core.py
r4344 r4359 1 1 # -*- coding: utf8 -*- 2 2 3 import sets, re, os, os.path, shutil, mimetypes, unicodedata, Image 3 import sets, re, os, os.path, shutil, mimetypes, unicodedata, Image, ImageOps 4 4 from datetime import * 5 5 … … 607 607 def _create_image(self, orig_name, path, name, ext, width, height): 608 608 image = Image.open(orig_name) 609 image = image.resize((width, height), Image. BICUBIC)609 image = image.resize((width, height), Image.ANTIALIAS) 610 610 image.save(os.path.join(path, '%s-%sx%s%s' % (name, width, height, 611 611 ext))) screenshotsplugin/0.11/tracscreenshots/htdocs/css/matrix-view.css
r4355 r4359 15 15 } 16 16 17 div.screenshots div.tr, div.screenshots div.td 18 { 19 margin: 0em; 20 padding: 0em; 21 } 22 23 24 div.screenshots div.images div.image 25 { 26 border: 2px solid #b00; 27 margin: 0em; 28 padding: 0em; 29 text-align: center; 30 } 31 32 div.screenshots div.images div.image a 33 { 34 display: block; 35 padding: 0em; 36 margin: 0em; 37 border: none; 38 vertical-align: middle; 39 } 40 17 41 div.screenshots div.images div.image img 18 42 { 19 border: 2px solid #b00;43 vertical-align: middle; 20 44 } 21 45 … … 31 55 } 32 56 33 /* Controls style. */57 /* Global controls style. */ 34 58 div.screenshots div.controls 35 59 { … … 37 61 } 38 62 39 div.screenshots div. controls td a63 div.screenshots div.images div.controls 40 64 { 41 margin : 0em0.5em;65 margin-bottom: 0.5em; 42 66 } 43 67 screenshotsplugin/0.11/tracscreenshots/htdocs/css/screenshots.css
r4344 r4359 61 61 { 62 62 display: block; 63 border-color: #b00; 64 border-style: solid; 63 65 } 64 66 … … 66 68 { 67 69 display: block; 68 border-color: #b00; 69 border-style: solid; 70 margin: auto; 70 71 } 71 72 … … 79 80 { 80 81 display: block; 81 margin: 0em ;82 margin: 0em 2em; 82 83 padding: 0em; 83 84 } … … 86 87 { 87 88 display: block; 88 margin: 0em; 89 margin-top: 0.5em; 89 margin: 0.5em 0em; 90 90 padding: 0em; 91 91 } 92 92 93 span.thumbnail-left a, span.thumbnail-right a ,93 span.thumbnail-left a, span.thumbnail-right a 94 94 { 95 95 display: block; 96 margin: 0em; 97 padding: 0em; 98 border-color: #b00; 99 border-style: solid; 96 100 } 97 101 … … 99 103 { 100 104 display: block; 101 border-color: #b00; 102 border-style: solid; 105 margin: auto; 103 106 } 104 107 … … 111 114 span.thumbnail, span.thumbnail-left, span.thumbnail-right 112 115 { 113 margin: 16px;114 margin-top: 0em;115 padding: 0em;116 116 font-size: 75%; 117 117 text-align: center; screenshotsplugin/0.11/tracscreenshots/matrix_view.py
r4355 r4359 42 42 page = int(req.args.get('page') or -1) 43 43 44 self.log.debug('index: %s' % (index)) 45 self.log.debug('page: %s' % (page)) 46 44 47 # Count index or page depending on user input. 45 48 count = len(data['screenshots']) … … 47 50 if index != -1: 48 51 page = (index / count_on_page) + 1 52 elif page != -1: 53 index = (page - 1) * count_on_page 49 54 else: 50 index = (page - 1) * count_on_page 55 index = 0 56 page = 1 51 57 52 58 self.log.debug('index: %s' % (index)) … … 93 99 for I in xrange(count): 94 100 # Add screenshot. 95 if ( index + I) < len(screenshots):101 if ((index + I) < len(screenshots)) and ((index + I) > 0): 96 102 row.append(screenshots[index + I]) 97 103 else: screenshotsplugin/0.11/tracscreenshots/templates/screenshots-matrix-view.html
r4355 r4359 9 9 <td> 10 10 <py:choose> 11 <div py:when="image.id != -1" class="image"> 12 <a href="${href.screenshots(image.id)}" title="${image.id}"> 13 <img src="${href.screenshots(image.id)}?width=${screenshots.width};height=${screenshots.height};format=raw" 14 alt="${image.description}" width="${screenshots.width}" height="${screenshots.height}"/> 11 <div py:when="image.id != -1" class="image" style="width: ${screenshots.width}px; height: ${screenshots.height}px"> 12 <?python 13 frame_aspect = float(screenshots['width']) / float(screenshots['height']) 14 image_aspect = float(image['width']) / float(image['height']) 15 if frame_aspect < image_aspect: 16 image_width = screenshots['width'] 17 image_height = int(screenshots['width'] / image_aspect + 0.5) 18 else: 19 image_width = int(screenshots['height'] * image_aspect + 0.5) 20 image_height = screenshots['height'] 21 ?> 22 <a href="${href.screenshots(image.id)}" title="${image.id}" style="line-height: ${screenshots.height - 4}px"> 23 <img src="${href.screenshots(image.id)}?width=${image_width};height=${image_height};format=raw" 24 alt="${image.description}"/> 15 25 </a> 16 26 </div> screenshotsplugin/0.11/tracscreenshots/wiki.py
r4344 r4359 151 151 'border' : '1', 152 152 'format' : 'raw', 153 'width' : screenshot['width'],154 'height' : screenshot['height'],155 153 'alt' : screenshot['description'], 156 154 'description' : self.default_description} … … 162 160 if match: 163 161 attributes[str(match.group(1))] = match.group(2) 162 163 # Zero width or height means keep original. 164 if attributes.has_key('width'): 165 if attributes['width'] == 0: 166 attributes['width'] = screenshot['width'] 167 if attributes.has_key('height'): 168 if attributes['height'] == 0: 169 attributes['height'] = screenshot['height'] 170 171 # If one dimension is missing compute second to keep aspect. 172 if not attributes.has_key('width') and \ 173 attributes.has_key('height'): 174 attributes['width'] = int(int(attributes['height']) * ( 175 float(screenshot['width']) / float(screenshot['height'])) 176 + 0.5) 177 if not attributes.has_key('height') and \ 178 attributes.has_key('width'): 179 attributes['height'] = int(int(attributes['width']) * ( 180 float(screenshot['height']) / float(screenshot['width'])) 181 + 0.5) 182 183 # If both dimensions are missing keep original. 184 if not attributes.has_key('width') and not \ 185 attributes.has_key('height'): 186 attributes['width'] = screenshot['width'] 187 attributes['height'] = screenshot['height'] 188 164 189 self.log.debug('attributes: %s' % (attributes,)) 165 190 … … 169 194 170 195 # Make copy of attributes for image tag. 171 img_attributes = {'style' : 'border-width: %spx;' % ( 172 attributes['border'],)} 196 img_attributes = {} 173 197 for attribute in attributes.keys(): 174 198 if attribute not in ('align', 'border', 'description', 175 'format' ):199 'format', 'width', 'height'): 176 200 img_attributes[attribute] = attributes[attribute] 177 201 … … 181 205 # Build screenshot image and/or screenshot link. 182 206 image = html.img(src = formatter.req.href.screenshots( 183 screenshot['id'], width = attributes['width'], height =184 attributes['height'], format = 'raw'), **img_attributes)207 screenshot['id'], format = 'raw', width = attributes['width'], 208 height = attributes['height']), **img_attributes) 185 209 link = html.a(image, href = formatter.req.href.screenshots( 186 210 screenshot['id'], format = attributes['format']), title = 187 screenshot['description']) 211 screenshot['description'], style = 'border-width: %spx;' % ( 212 attributes['border'],)) 188 213 width_and_border = int(attributes['width']) + 2 * \ 189 214 int(attributes['border'])
