Changeset 2272

Show
Ignore:
Timestamp:
06/02/07 16:06:35 (1 year ago)
Author:
eblot
Message:

RevtreePlugin:

Improve changeset info boxes:

  • Boxes use the same foreground/background color as their respective branches
  • Boxes do not disappear as soon as the changeset is blurred: it is now possible to hover the changeset info box, and select embedded links (such as changeset, tickets, wiki pages etc.)
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • revtreeplugin/0.11/revtree/htdocs/css/revtree.css

    r2271 r2272  
    7575 
    7676/* jTip */ 
    77 #JT_arrow_left { 
    78  background-image: url(../images/arrow_left.gif); 
    79  background-repeat: no-repeat; 
    80  background-position: left top; 
    81  position: absolute; 
    82  z-index:101; 
    83  left:-12px; 
    84  height:23px; 
    85  width:10px; 
    86  top:-3px; 
    87 } 
    88 #JT_arrow_right { 
    89  background-image: url(../images/arrow_right.gif); 
    90  background-repeat: no-repeat; 
    91  background-position: left top; 
    92  position: absolute; 
    93  z-index:101; 
    94  height:23px; 
    95  width:11px; 
    96  top:-2px; 
    97 } 
    9877#JT { 
    9978 position: absolute; 
     
    11796} 
    11897#JT_close_left { 
    119  background-color: #CCCCCC; 
    12098 text-align: left; 
    12199 padding-left: 8px; 
     
    125103} 
    126104#JT_close_right { 
    127  background-color: #CCCCCC; 
    128105 text-align: left; 
    129106 padding-left: 8px; 
  • revtreeplugin/0.11/revtree/htdocs/js/svgtip.js

    r2271 r2272  
    99 */ 
    1010 
     11var jttimeout = null; 
    1112function JT_init(){ 
    12   $('a[@id^=rev]').hover(function(){JT_show(this)},function(){JT_hide(this)}); 
     13  $('a[@id^=rev]').hover(function(){JT_show(this)}, 
     14                         function(){jttimeout=setTimeout("JT_remove();", 250);}); 
    1315} 
    1416 
    15 function JT_hide(object) { 
     17function JT_cancel() { 
     18   if (jttimeout) { 
     19      clearTimeout(jttimeout); 
     20      jttimeout = null; 
     21   } 
     22
     23 
     24function JT_remove() { 
    1625   var jt = $('#JT'); 
    17    if ( jt ) { jt.remove(); } 
     26   if ( jt ) {  jt.remove(); } 
     27
     28 
     29function JT_hide() { 
     30   JT_cancel(); 
     31   JT_remove(); 
    1832} 
    1933 
    2034function JT_show(object) { 
     35  if ( $('#JT') ) { 
     36     JT_hide(); 
     37  } 
    2138  var href = 'href'; 
    2239  if (! jQuery.browser.opera) { href = 'xlink:' + href; } 
     
    2441  var logurl = url.replace(/\/changeset\//, '/revtree_log/'); 
    2542  var id = object.getAttribute('id'); 
     43  var style = object.getAttribute('style'); 
     44  var colors = style.split(';') 
     45  var fgc = colors[0].replace(/^.*color:/,''); 
     46  var bgc = colors[1].replace(/^.*color:/,''); 
    2647  var title = id.replace(/^rev/, 'Changeset '); 
    2748  var box = getSvgPosition(id); 
     
    3657     
    3758  if(hasArea>((params['width']*1)+box.w)){ 
    38      var arrowOffset = box.w + 11; 
    39      var clickElementx = box.x + arrowOffset + 3; 
     59     var clickElementx = box.x + box.w + 4; 
    4060     var side = 'left'; 
    4161  } else { 
    42      var clickElementx = box.x - ((params['width']*1) + 15) - 3
     62     var clickElementx = box.x - (params['width']*1) - 5
    4363     var side = 'right'; 
    4464  } 
     
    4666  $('body').append('<div id="JT" style="width:'+params['width']*1+'px; '+ 
    4767                                       'left:'+clickElementx+'px; ' + 
    48                                        'top:'+clickElementy+'px;"></div>'); 
     68                                       'top:'+clickElementy+'px; ' + 
     69                                       'border: 2px solid '+fgc+'">' + 
     70                                       '</div>'); 
     71  $('#JT').hover(function(){JT_cancel();}, 
     72                 function(){JT_remove();}); 
     73 
    4974  var style=''; 
    5075  if (side=='right'){style='style="left:'+((params['width']*1)+1)+'px;"'} 
    51   $('#JT').append('<div id="JT_arrow_'+side+'" '+style+'></div>'
    52                   '<div id="JT_close_'+side+'" >'+title+'</div>' + 
    53                   '<div id="JT_copy" ><div id="JT_loader">' + 
     76  $('#JT').append('<div id="JT_close_'+side+'" style="background-color:'+bgc
     77                    '">'+title+'</div>' + 
     78                  '<div id="JT_copy"><div id="JT_loader">' + 
    5479                  '<span id="loading">loading changeset&#8230;</span>' + 
    5580                  '</div></div>'); 
  • revtreeplugin/0.11/revtree/svgview.py

    r2178 r2272  
    210210        """Marks the changeset as the first of the branch. 
    211211           Inverts the background and the foreground color""" 
    212         (self._fillcolor, self._strokecolor) = \ 
    213             (self._strokecolor, self._fillcolor) 
    214         self._textcolor.invert() 
     212        #(self._fillcolor, self._strokecolor) = \ 
     213        #    (self._strokecolor, self._fillcolor) 
     214        #self._textcolor.invert() 
    215215        self._classes.append('firstchangeset') 
    216216         
    217217    def mark_last(self): 
    218218        """Mark the changeset as the latest of the branch""" 
    219         self._fillcolor = SvgColor('black') 
    220         self._textcolor = SvgColor('white') 
    221219        self._classes.append('lastchangeset') 
    222220 
    223221    def build(self): 
    224222        SvgBaseChangeset.build(self) 
     223        (fgc, bgc) = (self._strokecolor, self._fillcolor) 
     224        txc = self._textcolor 
     225        if 'firstchangeset' in self._classes: 
     226            (fgc, bgc) = (bgc, fgc) 
     227        if 'lastchangeset' in self._classes: 
     228            bgc = SvgColor('black') 
     229            txc = SvgColor('white') 
     230             
    225231        widgets = [] 
    226232        if self._shape == 'circle': 
    227233            widgets.append(SVG.circle(self._position[0], self._position[1], 
    228                                       self._radius,  
    229                                       self._fillcolor, 
    230                                       self._strokecolor, 
     234                                      self._radius, bgc, fgc, 
    231235                                      self._parent.strokewidth())) 
    232236            if self._enhance: 
     
    234238                (d,hr) = (self._radius*SQRT3/2, self._radius/2) 
    235239                widgets.append(SVG.line(x-d,y-hr,x+d,y-hr,  
    236                                         self._strokecolor, 
    237                                         self._parent.strokewidth())) 
     240                                        fgc, self._parent.strokewidth())) 
    238241                widgets.append(SVG.line(x-d,y+hr,x+d,y+hr,  
    239                                         self._strokecolor, 
    240                                         self._parent.strokewidth())) 
     242                                        fgc, self._parent.strokewidth())) 
    241243                               
    242244        elif self._shape == 'square': 
     
    245247            widgets.append(SVG.rect(self._position[0]-size,  
    246248                                    self._position[1]-size, 
    247                                     2*size, 2*size,  
    248                                     self._fillcolor, 
    249                                     self._strokecolor, 
     249                                    2*size, 2*size, bgc, fgc, 
    250250                                    self._parent.strokewidth())) 
    251251            outline.attributes['rx'] = r 
     
    263263            pd.line(x-r,y-hr) 
    264264            pd.line(x,y-r) 
    265             widgets.append(SVG.path(pd, self._parent.fillcolor(),  
    266                                     self._parent.strokecolor(),  
     265            widgets.append(SVG.path(pd, bgc, fgc,  
    267266                                    self._parent.strokewidth())) 
    268267        else: 
     
    273272                         str(self._revision),  
    274273                         self._parent.fontsize(), self._parent.fontname()) 
    275         title.attributes['style'] = 'fill:%s; text-anchor: middle' % \ 
    276                                     self._textcolor.rgb() 
     274        title.attributes['style'] = 'fill:%s; text-anchor: middle' % txc.rgb() 
    277275        widgets.append(title) 
    278276        g = SVG.group('grp%d' % self._revision, elements=widgets) 
     
    280278        self._link = SVG.link(link, elements=[g]) 
    281279        if self._revision: 
     280            self._link.attributes['style'] = \ 
     281                'color: %s; background-color: %s' % \ 
     282                    (self._strokecolor, self._fillcolor) 
    282283            self._link.attributes['id'] = 'rev%d' % self._revision 
    283284            self._link.attributes['class'] = ' '.join(self._classes) 
  • revtreeplugin/0.11/setup.py

    r2271 r2272  
    1616 
    1717PACKAGE = 'TracRevtreePlugin' 
    18 VERSION = '0.5.2
     18VERSION = '0.5.3
    1919 
    2020setup (