/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()
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.properties.get('author',
88
 
                        revision.committer)
 
88
                    author = revision.get_apparent_author()
89
89
 
90
90
                if revision.revision_id not in self.revisions:
91
91
                    self.revisions[revision.revision_id] = revision
92
92
 
93
93
                self.annomodel.append([revision.revision_id,
94
94
                                       line_no + 1,
95
 
                                       committer,
 
95
                                       author,
96
96
                                       revno,
97
97
                                       None,
98
98
                                       line.rstrip("\r\n")
393
393
                return j - i
394
394
 
395
395
 
396
 
 
397
396
class FakeRevision:
398
397
    """ A fake revision.
399
398
 
409
408
        self.timezone = 0
410
409
        self.properties = {}
411
410
 
 
411
    def get_apparent_author(self):
 
412
        return self.committer
 
413
 
412
414
 
413
415
class RevisionCache(object):
414
416
    """A caching revision source"""