/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: Aaron Bentley
  • Date: 2007-01-17 07:36:36 UTC
  • mto: This revision was merged to the branch mainline in revision 129.
  • Revision ID: aaron.bentley@utoronto.ca-20070117073636-2kxf22i9bhskcl2m
Add back button to see older versions

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
        model.set(iter, HIGHLIGHT_COLOR_COL,
171
171
                  self.annotate_colormap.get_color(revision, now))
172
172
 
173
 
    def _show_log(self, w):
 
173
    def _selected_revision(self):
174
174
        (path, col) = self.annoview.get_cursor()
175
175
        if path is None:
 
176
            return None
 
177
        return self.annomodel[path][REVISION_ID_COL]
 
178
 
 
179
    def _show_log(self, w):
 
180
        rev_id = self._selected_revision()
 
181
        if rev_id is None:
176
182
            return
177
 
        rev_id = self.annomodel[path][REVISION_ID_COL]
178
183
        self.logview.set_revision(self.revisions[rev_id])
179
184
 
180
185
    def _create(self):
199
204
        vbox.pack_start(pane, expand=True, fill=True)
200
205
        
201
206
        hbox = gtk.HBox(True, 6)
202
 
        hbox.pack_start(self._create_button_box(), expand=False, fill=True)
 
207
        hbox.pack_start(self._create_prev_button(), expand=False, fill=True)
 
208
        hbox.pack_end(self._create_button_box(), expand=False, fill=True)
203
209
        hbox.show()
204
210
        vbox.pack_start(hbox, expand=False, fill=True)
205
211
 
302
308
 
303
309
        return box
304
310
 
 
311
    def _create_prev_button(self):
 
312
        box = gtk.HButtonBox()
 
313
        box.set_layout(gtk.BUTTONBOX_START)
 
314
        box.show()
 
315
        
 
316
        button = gtk.Button()
 
317
        button.set_use_stock(True)
 
318
        button.set_label("gtk-go-back")
 
319
        button.connect("clicked", lambda w: self.go_back())
 
320
        button.show()
 
321
        box.pack_start(button, expand=False, fill=False)
 
322
        return box
 
323
 
 
324
    def go_back(self):
 
325
        rev_id = self._selected_revision()
 
326
        parent_id = self.revisions[rev_id].parent_ids[0]
 
327
        tree = self.branch.repository.revision_tree(parent_id)
 
328
        if self.file_id in tree:
 
329
            self.annotate(tree, self.branch, self.file_id)
 
330
 
305
331
 
306
332
class FakeRevision:
307
333
    """ A fake revision.