Changeset 1697
- Timestamp:
- 12/16/06 07:29:42 (2 years ago)
- Files:
-
- revtreeplugin/0.10/revtree/htdocs/js/svgtip.js (modified) (1 diff)
- revtreeplugin/0.10/revtree/svgview.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
revtreeplugin/0.10/revtree/htdocs/js/svgtip.js
r1696 r1697 48 48 } 49 49 50 if(hasArea>((params['width']*1)+ 75)){50 if(hasArea>((params['width']*1)+box.w)){ 51 51 var arrowOffset = box.w + 11; 52 52 var clickElementx = box.x + arrowOffset + 3; revtreeplugin/0.10/revtree/svgview.py
r1696 r1697 15 15 import SVGdraw as SVG 16 16 import os 17 import md5 17 18 18 19 from colorsys import rgb_to_hsv, hsv_to_rgb … … 64 65 'orange': (0xff,0x9f,0) } 65 66 66 def __init__(self, value=None ):67 def __init__(self, value=None, name=None): 67 68 if value is not None: 68 69 if isinstance(value, SvgColor): … … 78 79 else: 79 80 raise AssertionError, "unsupportedcolor: %s" % value 80 else: 81 # FIXME: use some kind of checksum-based colorization 82 # i.e. branchname -> checksum -> color for permanent branch-color 83 # mapping (persistence over graph generation) 81 elif name is not None: 82 self._color = SvgColor.from_name(name) 83 else: 84 84 self._color = SvgColor.random() 85 85 … … 121 121 128+14*int(rand[2])) 122 122 random = staticmethod(random) 123 124 def from_name(name): 125 dig = md5.new(name).digest() 126 vr = 14*(int(ord(dig[0]))%10) 127 vg = 14*(int(ord(dig[1]))%10) 128 vb = 14*(int(ord(dig[2]))%10) 129 return (128+vr, 128+vg, 128+vb) 130 from_name = staticmethod(from_name) 123 131 124 132 def invert(self): … … 391 399 392 400 def _get_color(self, name, trunks): 393 """ Generates a random pastel color and returns it as a string,394 or returns a predefined color if the branch is a trunk"""401 """Creates a random pastel color based on the branch name 402 or returns a predefined color if the branch is a trunk""" 395 403 if name in trunks: 396 404 return SvgColor(self._parent.env.config.get('revtree', … … 398 406 '#cfcfcf')) 399 407 else: 400 return SvgColor( )408 return SvgColor(name=name) 401 409 402 410 def build(self, position):
