/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to annotate/gannotate.py

  • Committer: Jelmer Vernooij
  • Date: 2007-07-15 18:12:57 UTC
  • Revision ID: jelmer@samba.org-20070715181257-g264qus2zyi3v39z
Add RevisionSelectionBox widget, use in TagDialog.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
from colormap import AnnotateColorMap, AnnotateColorSaturation
31
31
from bzrlib.plugins.gtk.logview import LogView
32
 
from bzrlib.plugins.gtk.window import Window
33
32
 
34
33
 
35
34
(
42
41
) = range(6)
43
42
 
44
43
 
45
 
class GAnnotateWindow(Window):
 
44
class GAnnotateWindow(gtk.Window):
46
45
    """Annotate window."""
47
46
 
48
 
    def __init__(self, all=False, plain=False, parent=None):
 
47
    def __init__(self, all=False, plain=False):
49
48
        self.all = all
50
49
        self.plain = plain
51
50
        
52
 
        Window.__init__(self, parent)
 
51
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
53
52
        
54
53
        self.set_icon(self.render_icon(gtk.STOCK_FIND, gtk.ICON_SIZE_BUTTON))
55
54
        self.annotate_colormap = AnnotateColorSaturation()
67
66
        self.revision_id = getattr(tree, 'get_revision_id', 
68
67
                                   lambda: CURRENT_REVISION)()
69
68
        
70
 
        # [revision id, line number, author, revno, highlight color, line]
 
69
        # [revision id, line number, committer, revno, highlight color, line]
71
70
        self.annomodel = gtk.ListStore(gobject.TYPE_STRING,
72
71
                                       gobject.TYPE_STRING,
73
72
                                       gobject.TYPE_STRING,
82
81
            for line_no, (revision, revno, line)\
83
82
                    in enumerate(self._annotate(tree, file_id)):
84
83
                if revision.revision_id == last_seen and not self.all:
85
 
                    revno = author = ""
 
84
                    revno = committer = ""
86
85
                else:
87
86
                    last_seen = revision.revision_id
88
 
                    author = revision.get_apparent_author()
 
87
                    committer = revision.committer
89
88
 
90
89
                if revision.revision_id not in self.revisions:
91
90
                    self.revisions[revision.revision_id] = revision
92
91
 
93
92
                self.annomodel.append([revision.revision_id,
94
93
                                       line_no + 1,
95
 
                                       author,
 
94
                                       committer,
96
95
                                       revno,
97
96
                                       None,
98
97
                                       line.rstrip("\r\n")
393
392
                return j - i
394
393
 
395
394
 
 
395
 
396
396
class FakeRevision:
397
397
    """ A fake revision.
398
398
 
408
408
        self.timezone = 0
409
409
        self.properties = {}
410
410
 
411
 
    def get_apparent_author(self):
412
 
        return self.committer
413
 
 
414
411
 
415
412
class RevisionCache(object):
416
413
    """A caching revision source"""