/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: Daniel Schierbeck
  • Date: 2007-10-14 15:54:57 UTC
  • mto: This revision was merged to the branch mainline in revision 317.
  • Revision ID: daniel.schierbeck@gmail.com-20071014155457-m3ek29p4ima8ev7d
Added the new Window base class.

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