/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: 2008-06-29 15:47:30 UTC
  • mto: This revision was merged to the branch mainline in revision 519.
  • Revision ID: jelmer@samba.org-20080629154730-xfsotoxwkiytf0ph
Pass graph object rather than full repository to linegraph.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
class GAnnotateWindow(Window):
46
46
    """Annotate window."""
47
47
 
48
 
    def __init__(self, all=False, plain=False, parent=None):
 
48
    def __init__(self, all=False, plain=False, parent=None, branch=None):
49
49
        self.all = all
50
50
        self.plain = plain
 
51
        self._branch = branch
51
52
        
52
53
        Window.__init__(self, parent)
53
54
        
113
114
 
114
115
        self.annoview.set_model(self.annomodel)
115
116
        self.annoview.grab_focus()
 
117
        my_revno = self.dotted.get(self.revision_id, 'current')
 
118
        title = '%s (%s) - gannotate' % (self.tree.id2path(file_id), my_revno)
 
119
        self.set_title(title)
116
120
 
117
121
    def jump_to_line(self, lineno):
118
122
        if lineno > len(self.annomodel) or lineno < 1:
174
178
 
175
179
    def _activate_selected_revision(self, w):
176
180
        rev_id = self._selected_revision()
177
 
        if rev_id is None:
 
181
        if not rev_id or rev_id == NULL_REVISION:
178
182
            return
179
183
        selected = self.revisions[rev_id]
180
184
        self.revisionview.set_revision(selected)
238
242
        self._search.show_for('line')
239
243
        self._search.set_target(self.annoview, LINE_NUM_COL)
240
244
 
241
 
    def row_diff(self, tv, path, tvc):
 
245
    def line_diff(self, tv, path, tvc):
242
246
        row = path[0]
243
247
        revision = self.annotations[row]
244
248
        repository = self.branch.repository
253
257
                tree2 = repository.revision_tree(NULL_REVISION)
254
258
        from bzrlib.plugins.gtk.diff import DiffWindow
255
259
        window = DiffWindow()
256
 
        window.set_diff("Diff for row %d" % (row+1), tree1, tree2)
 
260
        window.set_diff("Diff for line %d" % (row+1), tree1, tree2)
257
261
        window.set_file(tree1.id2path(self.file_id))
258
262
        window.show()
259
263
 
263
267
        tv.set_rules_hint(False)
264
268
        tv.connect("cursor-changed", self._activate_selected_revision)
265
269
        tv.show()
266
 
        tv.connect("row-activated", self.row_diff)
 
270
        tv.connect("row-activated", self.line_diff)
267
271
 
268
272
        cell = gtk.CellRendererText()
269
273
        cell.set_property("xalign", 1.0)
317
321
        return tv
318
322
 
319
323
    def _create_log_view(self):
320
 
        lv = RevisionView()
 
324
        lv = RevisionView(self._branch)
321
325
        lv.show()
322
326
        return lv
323
327