/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: matkor
  • Date: 2007-08-23 10:17:40 UTC
  • mto: This revision was merged to the branch mainline in revision 265.
  • Revision ID: matkor@laptop-hp-20070823101740-s17kf9qa383wiuje
Code for "branch update" menuitem and toolbox. Typo fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
class GAnnotateWindow(gtk.Window):
45
45
    """Annotate window."""
46
46
 
47
 
    def __init__(self, all=False, plain=False, parent=None):
 
47
    def __init__(self, all=False, plain=False):
48
48
        self.all = all
49
49
        self.plain = plain
50
 
        self._parent = parent
51
50
        
52
51
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
53
 
 
54
 
        self.connect("key-press-event", self._on_key_pressed)
55
52
        
56
53
        self.set_icon(self.render_icon(gtk.STOCK_FIND, gtk.ICON_SIZE_BUTTON))
57
54
        self.annotate_colormap = AnnotateColorSaturation()
84
81
            for line_no, (revision, revno, line)\
85
82
                    in enumerate(self._annotate(tree, file_id)):
86
83
                if revision.revision_id == last_seen and not self.all:
87
 
                    revno = author = ""
 
84
                    revno = committer = ""
88
85
                else:
89
86
                    last_seen = revision.revision_id
90
 
                    author = revision.get_apparent_author()
 
87
                    committer = revision.properties.get('author',
 
88
                        revision.committer)
91
89
 
92
90
                if revision.revision_id not in self.revisions:
93
91
                    self.revisions[revision.revision_id] = revision
94
92
 
95
93
                self.annomodel.append([revision.revision_id,
96
94
                                       line_no + 1,
97
 
                                       author,
 
95
                                       committer,
98
96
                                       revno,
99
97
                                       None,
100
98
                                       line.rstrip("\r\n")
394
392
            if i + n >= row:
395
393
                return j - i
396
394
 
397
 
    def _on_key_pressed(self, widget, event):
398
 
        """ Key press event handler. """
399
 
        keyname = gtk.gdk.keyval_name(event.keyval)
400
 
        func = getattr(self, '_on_key_press_' + keyname, None)
401
 
        if func:
402
 
            return func(event)
403
 
 
404
 
    def _on_key_press_w(self, event):
405
 
        if event.state & gtk.gdk.CONTROL_MASK:
406
 
            self.destroy()
407
 
            if self._parent is None:
408
 
                gtk.main_quit()
409
 
 
410
 
    def _on_key_press_q(self, event):
411
 
        if event.state & gtk.gdk.CONTROL_MASK:
412
 
            gtk.main_quit()
413
 
    
414
 
 
415
395
 
416
396
 
417
397
class FakeRevision:
429
409
        self.timezone = 0
430
410
        self.properties = {}
431
411
 
432
 
    def get_apparent_author(self):
433
 
        return self.committer
434
 
 
435
412
 
436
413
class RevisionCache(object):
437
414
    """A caching revision source"""