Changeset 1707

Show
Ignore:
Timestamp:
12/17/06 11:54:12 (2 years ago)
Author:
eblot
Message:

RevtreePlugin:

  • Bug fixing:
    • Fix up revision-based filter
    • Fix up the revision range selection
    • Fix up an issue introduced in the latest revision with branch names
  • Interface improvements:
    • Tweak the appearance of the filter interface
    • Make the font face and the font size configurable
  • Implementation enhancements:
    • Remove obsoleted code
    • Use SVG groups for branch header widgets
Files:

Legend:

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

    r1694 r1707  
    1414 border-right: solid 1px #333; 
    1515} 
    16 #treestyle div { 
    17    display: block; 
     16div.revprops span.legend { 
     17   /*Seemms that legend tag cannot be selected, use span instead*/ 
     18        font-weight:bold; 
    1819} 
    1920#treeoptions { 
    2021   white-space: normal; 
    21    width: 12ex; 
     22   width: 13ex; 
     23   display: inline; 
    2224} 
    2325#treeoptions label { 
    2426   margin-top: 0; 
    2527   padding-left: 3ex; 
     28   text-align: right; 
    2629} 
    27 #treeupdate { 
    28  border-right: none; 
     30#treestyle { 
     31   border-right: none; 
     32
     33#treestyle div { 
     34   display: block; 
    2935} 
    3036#settings { 
     
    3440   margin-left: 0; 
    3541   margin-right: 0; 
    36    margin-bottom: 10em; 
     42   margin-bottom: 11em; 
    3743} 
    3844#prefs { 
  • revtreeplugin/0.10/revtree/svgview.py

    r1705 r1707  
    2626SQRT2=sqrt(2) 
    2727SQRT3=sqrt(3) 
    28  
    29 # FIXME: This should be set in Trac properties, or event better:  
    30 #        as CSS properties 
    31 FONT_NAME = 'Verdana' 
    32 FONT_SIZE = '14pt' 
    3328 
    3429# Debug functions to place debug circles on the SVG graph 
     
    276271            raise AssertionError, \ 
    277272                  "unsupported changeset shape (%d)" % self._revision 
    278                    
    279         title = SVG.text(self._position[0] - self._htw,  
     273        title = SVG.text(self._position[0],  
    280274                         self._position[1] + UNIT/6, 
    281                          str(self._revision), FONT_SIZE, FONT_NAME) 
    282         title.attributes['style'] = 'fill:%s' % self._textcolor.rgb() 
     275                         str(self._revision),  
     276                         self._parent.fontsize(), self._parent.fontname()) 
     277        title.attributes['style'] = 'fill:%s; text-anchor: middle' % \ 
     278                                    self._textcolor.rgb() 
    283279        widgets.append(title) 
    284280 
     
    305301    def __init__(self, parent, title): 
    306302        self._parent = parent 
    307         self._title = "/%s" % (title or '') 
     303        self._title = title or '' 
    308304        self._tw = textwidth(self._title)+UNIT/2 
    309305        self._w = max(self._tw, 6*UNIT) 
     
    330326        y = self._position[1] 
    331327        r = UNIT/2 
    332         self._widget = SVG.rect(x,y,self._tw,self._h, 
    333                                 self._parent.fillcolor(),  
    334                                 self._parent.strokecolor(),  
    335                                 self._parent.strokewidth()) 
    336         self._widget.attributes['rx'] = r 
    337         self._widget.attributes['ry'] = r         
    338         self._text = SVG.text(x+UNIT/6,  
    339                               self._position[1]+self._h/2+UNIT/6, 
    340                               self._title, FONT_SIZE, FONT_NAME) 
     328        rect = SVG.rect(x,y,self._tw,self._h, 
     329                        self._parent.fillcolor(),  
     330                        self._parent.strokecolor(),  
     331                        self._parent.strokewidth()) 
     332        rect.attributes['rx'] = r 
     333        rect.attributes['ry'] = r         
     334        text = SVG.text(self._position[0]++self._w/2,  
     335                        self._position[1]+self._h/2+UNIT/6, 
     336                        "/%s" % self._title,  
     337                        self._parent.fontsize(), self._parent.fontname()) 
     338        text.attributes['style'] = 'text-anchor: middle' 
     339        name = self._title.encode('ascii', 'ignore').replace('/','') 
     340        g = SVG.group('grp%s' % name, elements=[rect, text]) 
    341341        self._link = SVG.link(plink('%s/browser/%s' % \ 
    342342                              (self._parent.urlbase(), self._title)),  
    343                               elements=[self._widget, self._text]) 
     343                              elements=[g]) 
    344344         
    345345    def render(self): 
     
    468468        return self._fillcolor 
    469469         
     470    def fontsize(self): 
     471        return self._parent.fontsize 
     472         
     473    def fontname(self): 
     474        return self._parent.fontname 
     475 
    470476    def urlbase(self): 
    471477        return self._parent.urlbase 
     
    797803        self.trunks = self.env.config.get('revtree', 'trunks',  
    798804                                          'trunk').split(' ') 
     805        # FIXME: Use CSS properties instead - when browsers support them... 
     806        # Font name 
     807        self.fontname = self.env.config.get('revtree', 'fontname', 'arial') 
     808        # Font size 
     809        self.fontsize = self.env.config.get('revtree', 'fontsize', '14pt') 
    799810        # Dictionnary of branch widgets (branches as keys) 
    800811        self._svgbranches = {} 
  • revtreeplugin/0.10/revtree/templates/revtree.cs

    r1675 r1707  
    1212  <div class="revprops"> 
    1313    <fieldset id="properties"> 
    14      <legend>Filters</legend> 
     14     <legend><span class="legend">Filters</span></legend> 
    1515     <div class="field"> 
    1616      <label for="branch">Branch</label> 
     
    3232   <div class="revprops"> 
    3333    <fieldset id="limits"> 
    34      <legend>Revisions</legend> 
     34     <legend><span class="legend">Revisions</span></legend> 
    3535     <div class="field"> 
    3636      <input type="radio" id="limperiod" name="limits" value="limperiod" <?cs  
     
    6262   </div> 
    6363  
     64   <div class="revprops" id="treeoptions"> 
     65    <fieldset> 
     66     <legend><span class="legend">Options</span></legend> 
     67     <div class="field"> 
     68      <input type="hidden" name="checkbox_hideterm"/> 
     69      <input type="checkbox" id="hideterm" 
     70        name="hideterm" <?cs if:revtree.hideterm 
     71        ?>checked="checked"<?cs /if ?> value="1"/><label for="hideterm">Hide  
     72        terminated branches</label> 
     73     </div> 
     74    </fieldset> 
     75   </div> 
     76  
    6477   <div class="revprops" id="treestyle"> 
    6578    <fieldset> 
    66      <legend>Style</legend> 
     79     <legend><span class="legend">Style</span></legend> 
    6780      <div class="field"> 
    6881        <div> 
     
    7790        </div> 
    7891      </div> 
     92      <div class="buttons"> 
     93       <input type="submit" value="Update"/> 
     94      </div> 
    7995    </fieldset> 
    8096   </div> 
    8197  
    82    <div class="revprops" id="treeoptions"> 
    83     <fieldset> 
    84      <legend>Options</legend> 
    85      <div class="field"> 
    86       <input type="hidden" name="checkbox_hideterm"/> 
    87       <input type="checkbox" id="hideterm" 
    88         name="hideterm" <?cs if:revtree.hideterm 
    89         ?>checked="checked"<?cs /if ?> value="1"/><label for="hideterm">Hide  
    90         terminated branches</label> 
    91      </div> 
    92     </fieldset> 
    93    </div> 
    94   
    95    <div class="revprops" id="treeupdate"> 
    96     <div class="buttons"> 
    97      <input type="submit" value="Update"/> 
    98     </div> 
    99    </div> 
    10098 </form> 
    10199</div> 
  • revtreeplugin/0.10/revtree/web_ui.py

    r1694 r1707  
    9292    def compute_range(self): 
    9393        """Computes the range of revisions to show""" 
     94        self.revrange = self.revspan 
    9495        if self['limits'] == 'limrev': 
    9596            self.revrange = (int(self['revmin']), int(self['revmax'])) 
     
    100101                self.timerange = (now-period*86400, now) 
    101102                return 
    102         self.revrange = self.revspan 
    103103 
    104104    def can_be_rendered(self): 
     
    217217        self.oldest = int(self.env.config.get('revtree', 'revbase',  
    218218                                              repos.get_oldest_rev())) 
    219         self.youngest = repos.get_youngest_rev(
     219        self.youngest = int(repos.get_youngest_rev()
    220220        if self.config.getbool('revtree', 'reltime', True): 
    221221            self.timebase = repos.get_changeset(self.youngest).date 
     
    276276            repos.build(self.bcre, revstore.revrange, revstore.timerange) 
    277277 
    278             (revisions, branches, authors) = \ 
     278            (branches, authors) = \ 
    279279                self._select_parameters(repos, req, revstore) 
    280             filename = self._get_filename() 
    281280                                         
    282281            svgrevtree = RevtreeSystem(self.env).get_revtree(repos) 
    283              
    284             #enhancer = Enhancer(repos, svgrevtree) 
    285             #svgrevtree.add_enhancer(enhancer) 
    286              
    287282            svgrevtree.create(req, revstore.revrange, revstore.get_branches(),  
    288283                              revstore.get_authors(),  
     
    322317             
    323318        revrange = repos.revision_range() 
    324         revisions = self._get_ui_revisions(revrange) 
     319        revisions = self._get_ui_revisions((self.oldest, self.youngest), 
     320                                           revrange) 
    325321 
    326322        # fill in the HDF  
     
    344340        return periods 
    345341 
    346     def _get_filename(self): 
    347         """Generates a unique filename""" 
    348         return '%d.svg' % int(time.time()) 
    349  
    350     def _get_ui_revisions(self, revspan): 
     342    def _get_ui_revisions(self, revspan, revrange): 
    351343        """Generates the list of displayable revisions""" 
    352344        (revmin, revmax) = revspan 
     
    358350        for rev in revs: 
    359351            if len(revisions) > 40: 
    360                 if int(rev)%20
     352                if int(rev)%20 and (rev not in revrange)
    361353                    continue 
    362354            elif len(revisions) > 10: 
    363                 if int(rev)%10
     355                if int(rev)%10 and (rev not in revrange)
    364356                    continue 
    365357            revisions.append(str(rev)) 
     
    373365        revs = [c for c in repos.changesets()] 
    374366        revs.reverse() 
    375         revisions = [] 
    376         for rev in revs: 
    377             if len(revisions) > 40: 
    378                 if int(rev)%20: 
    379                     continue 
    380             elif len(revisions) > 10: 
    381                 if int(rev)%10: 
    382                     continue 
    383             revisions.append(rev) 
    384         if revisions[-1] != str(revstore.revspan[0]): 
    385             revisions.append(str(revstore.revspan[0])) 
    386367        brnames = [bn for bn in repos.branches().keys() \ 
    387368                      if bn not in self.trunks] 
     
    405386            vbranches = self.trunks 
    406387            vbranches.extend(branches) 
    407         return ((revisions[0], revisions[-1]), vbranches, authors) 
     388        return (vbranches, authors) 
  • revtreeplugin/0.10/setup.py

    r1696 r1707  
    1616 
    1717PACKAGE = 'TracRevtreePlugin' 
    18 VERSION = '0.4.4
     18VERSION = '0.4.5
    1919 
    2020setup (