Changeset 1696
- Timestamp:
- 12/15/06 19:22:48 (2 years ago)
- Files:
-
- revtreeplugin/0.10/enhancers (added)
- revtreeplugin/0.10/enhancers/logenhancer (added)
- revtreeplugin/0.10/enhancers/logenhancer/__init__.py (added)
- revtreeplugin/0.10/enhancers/logenhancer/logenhancer.py (added)
- revtreeplugin/0.10/enhancers/setup.cfg (added)
- revtreeplugin/0.10/enhancers/setup.py (added)
- revtreeplugin/0.10/revtree/enhancer.py (modified) (2 diffs)
- revtreeplugin/0.10/revtree/htdocs/js/svgtip.js (modified) (3 diffs)
- revtreeplugin/0.10/revtree/svgview.py (modified) (5 diffs)
- revtreeplugin/0.10/setup.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
revtreeplugin/0.10/revtree/enhancer.py
r1694 r1696 57 57 # changeset(from another branch) 58 58 if firstchgset and firstchgset.clone: 59 # tweak the colorappearance of this changeset ..60 svgbranch.svgchangeset(firstchgset). invert_color()59 # tweak the appearance of this changeset .. 60 svgbranch.svgchangeset(firstchgset).mark_first() 61 61 (rev, path) = branch.source() 62 62 srcchg = enhancer.repos.changeset(rev) … … 70 70 if lastchgset.last: 71 71 # tweak the color of this changeset 72 svgbranch.svgchangeset(lastchgset). kill()72 svgbranch.svgchangeset(lastchgset).mark_last() 73 73 return enhancer 74 74 revtreeplugin/0.10/revtree/htdocs/js/svgtip.js
r1675 r1696 5 5 * JTip is built on top of the very light weight jquery library. 6 6 * 7 * Badly hacked & tweaked to support XHTML/XML and SVG <emmanuel.blot@free.fr> 7 * Badly hacked & tweaked to support XHTML/XML and SVG for the RevtreePlugin 8 * <emmanuel.blot@free.fr> 8 9 */ 9 10 … … 42 43 var params = parseQuery( queryString ); 43 44 if(params['width'] === undefined){params['width'] = 250}; 44 if(params['link'] !== undefined){ 45 if(params['link'] !== undefined){ 45 46 $(object).bind('click',function(){window.location = params['link']}); 46 47 //$(object).css('cursor','pointer'); … … 99 100 var elem; 100 101 for ( var n = 0; n < cnodes.length; n++ ) { 101 if ( cnodes[n].tagName == " circle" ) {102 if ( cnodes[n].tagName == "g" ) { 102 103 elem = cnodes[n] 103 break;104 }105 if ( cnodes[n].tagName == "rect" ) {106 box = cnodes[n];107 104 break; 108 105 } revtreeplugin/0.10/revtree/svgview.py
r1694 r1696 54 54 55 55 colormap = { 'black': (0,0,0), 56 'white': (0xff,0xff,0xff), 56 57 'darkred': (0x7f,0,0), 57 58 'darkgreen': (0,0x7f,0), … … 195 196 self._strokecolor = self._parent.strokecolor() 196 197 self._textcolor = SvgColor('black') 198 self._classes = ['svgchangeset'] 197 199 198 200 def set_shape(self, shape): 201 """Define the shape of the svg changeset [circle,square,hexa]. 202 If the first letter is uppercase, the shape is augmented with 203 fancy lines. 204 """ 199 205 self._shape = shape.lower() 200 206 self._enhance = shape[0] != self._shape[0] 201 207 202 def invert_color(self): 208 def mark_first(self): 209 """Marks the changeset as the first of the branch. 210 Inverts the background and the foreground color""" 203 211 (self._fillcolor, self._strokecolor) = \ 204 212 (self._strokecolor, self._fillcolor) 205 213 self._textcolor.invert() 206 207 def kill(self): 208 self._strokecolor = SvgColor('red') 214 self._classes.append('firstchangeset') 215 216 def mark_last(self): 217 """Mark the changeset as the latest of the branch""" 218 self._fillcolor = SvgColor('black') 219 self._textcolor = SvgColor('white') 220 self._classes.append('lastchangeset') 209 221 210 222 def build(self): 211 223 SvgBaseChangeset.build(self) 224 widgets = [] 212 225 if self._shape == 'circle': 213 self._widget =SVG.circle(self._position[0], self._position[1],226 widgets.append(SVG.circle(self._position[0], self._position[1], 214 227 self._radius, 215 228 self._fillcolor, 216 229 self._strokecolor, 217 self._parent.strokewidth()) 230 self._parent.strokewidth())) 218 231 if self._enhance: 219 232 (x,y) = self._position 220 233 (d,hr) = (self._radius*SQRT3/2, self._radius/2) 221 lt = SVG.line(x-d,y-hr,x+d,y-hr, 222 self._strokecolor, 223 self._parent.strokewidth()) 224 lb = SVG.line(x-d,y+hr,x+d,y+hr, 225 self._strokecolor, 226 self._parent.strokewidth()) 227 g = SVG.group('grp%d' % self._revision, 228 elements=[self._widget, lt, lb]) 229 self._widget = g 234 widgets.append(SVG.line(x-d,y-hr,x+d,y-hr, 235 self._strokecolor, 236 self._parent.strokewidth())) 237 widgets.append(SVG.line(x-d,y+hr,x+d,y+hr, 238 self._strokecolor, 239 self._parent.strokewidth())) 230 240 231 241 elif self._shape == 'square': 232 size = self._radius-UNIT/6 233 self._widget = SVG.rect(self._position[0]-size, 242 r = UNIT/6 243 size = self._radius-r 244 widgets.append(SVG.rect(self._position[0]-size, 234 245 self._position[1]-size, 235 246 2*size, 2*size, 236 247 self._fillcolor, 237 248 self._strokecolor, 238 self._parent.strokewidth()) 249 self._parent.strokewidth())) 250 outline.attributes['rx'] = r 251 outline.attributes['ry'] = r 252 239 253 elif self._shape == 'hexa': 240 254 (x,y) = self._position … … 248 262 pd.line(x-r,y-hr) 249 263 pd.line(x,y-r) 250 self._widget =SVG.path(pd, self._parent.fillcolor(),251 self._parent.strokecolor(),252 self._parent.strokewidth())264 widgets.append(SVG.path(pd, self._parent.fillcolor(), 265 self._parent.strokecolor(), 266 self._parent.strokewidth())) 253 267 else: 254 268 raise AssertionError, \ 255 269 "unsupported changeset shape (%d)" % self._revision 256 270 257 self._text = SVG.text(self._position[0] - self._htw, 258 self._position[1] + UNIT/6, 259 str(self._revision), FONT_SIZE, FONT_NAME) 260 self._text.attributes['style'] = 'fill:%s' % self._textcolor.rgb() 271 title = SVG.text(self._position[0] - self._htw, 272 self._position[1] + UNIT/6, 273 str(self._revision), FONT_SIZE, FONT_NAME) 274 title.attributes['style'] = 'fill:%s' % self._textcolor.rgb() 275 widgets.append(title) 276 277 g = SVG.group('grp%d' % self._revision, elements=widgets) 261 278 262 279 link = "%s/revtree_log/?rev=%d&link=%s/changeset/%d" \ 263 280 % (self._parent.urlbase(), self._revision, 264 281 self._parent.urlbase(), self._revision) 265 self._link = SVG.link(link, elements=[ self._widget, self._text])282 self._link = SVG.link(link, elements=[g]) 266 283 if self._revision: 267 284 self._link.attributes['id'] = 'rev%d' % self._revision 268 285 self._link.attributes['title'] = 'Changeset %d' % self._revision 269 self._link.attributes['class'] = ' svgtip'286 self._link.attributes['class'] = ' '.join(self._classes) 270 287 271 288 def visible(self): … … 596 613 (such as a switch/branch creation, a merge operation, ...)""" 597 614 598 def __init__(self, parent, srcChg, dstChg, color='black' ):615 def __init__(self, parent, srcChg, dstChg, color='black', classes=[]): 599 616 self._parent = parent 600 617 self._source = srcChg 601 618 self._dest = dstChg 602 619 self._color = SvgColor(color) 620 self._classes = classes 603 621 604 622 def build(self): … … 710 728 self._widget.attributes['marker-%s' % (head and 'start' or 'end') ] = \ 711 729 self._parent.svgarrow(self._color, head) 730 if self._classes: 731 self._widget.attributes['class'] = ' '.join(self._classes) 712 732 713 733 def extent(self): revtreeplugin/0.10/setup.py
r1694 r1696 15 15 from setuptools import setup, find_packages 16 16 17 PACKAGE = ' RevtreePlugin'18 VERSION = '0.4. 3'17 PACKAGE = 'TracRevtreePlugin' 18 VERSION = '0.4.4' 19 19 20 20 setup ( … … 27 27 url='http://trac-hacks.org/wiki/RevtreePlugin', 28 28 keywords = "trac revision svg graphical tree browser", 29 packages = find_packages(exclude=['ez_setup', '*.tests*' ]),29 packages = find_packages(exclude=['ez_setup', '*.tests*', '*.enhancers.*']), 30 30 package_data={ 31 31 'revtree': [
