/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 branchview/treeview.py

  • Committer: Jelmer Vernooij
  • Date: 2008-07-31 01:55:07 UTC
  • mto: (580.2.1 gtk.gloom)
  • mto: This revision was merged to the branch mainline in revision 581.
  • Revision ID: jelmer@samba.org-20080731015507-tarukc7r26ud7twu
Avoid making assumptions about a branch being a loom until we've checked.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
        gtk.VBox.__init__(self, spacing=0)
110
110
 
111
111
        loading_msg_widget = ProgressPanel()
112
 
        ui.ui_factory.set_nested_progress_bar_widget(loading_msg_widget.get_progress_bar)
 
112
        if getattr(ui.ui_factory, "set_nested_progress_bar_widget", None) is not None:
 
113
            ui.ui_factory.set_nested_progress_bar_widget(loading_msg_widget.get_progress_bar)
113
114
        self.pack_start(loading_msg_widget, expand=False, fill=True)
114
115
 
115
116
        self.scrolled_window = gtk.ScrolledWindow()
276
277
        """
277
278
 
278
279
        self.progress_bar = ui.ui_factory.nested_progress_bar()
279
 
        self.progress_bar.update(msg="Loading ancestry graph", total_cnt=5)
 
280
        self.progress_bar.update("Loading ancestry graph", 0, 5)
280
281
 
281
282
        try:
282
283
            if self.compact:
325
326
        if set_tooltip is not None:
326
327
            set_tooltip(treemodel.MESSAGE)
327
328
 
 
329
        self._prev_cursor_path = None
328
330
        self.treeview.connect("cursor-changed",
329
331
                self._on_selection_changed)
330
332
 
400
402
    def _on_selection_changed(self, treeview):
401
403
        """callback for when the treeview changes."""
402
404
        (path, focus) = treeview.get_cursor()
403
 
        if path is not None:
 
405
        if (path is not None) and (path != self._prev_cursor_path):
 
406
            self._prev_cursor_path = path # avoid emitting twice per click
404
407
            self.iter = self.model.get_iter(path)
405
408
            self.emit('revision-selected')
406
409
 
407
410
    def _on_revision_selected(self, widget, event):
408
 
        from bzrlib.plugins.gtk.revisionmenu import RevisionPopupMenu
 
411
        from bzrlib.plugins.gtk.revisionmenu import RevisionMenu
409
412
        if event.button == 3:
410
 
            menu = RevisionPopupMenu(self.branch.repository, 
 
413
            menu = RevisionMenu(self.branch.repository, 
411
414
                [self.get_revision().revision_id],
412
415
                self.branch)
413
416
            menu.connect('tag-added', lambda w, t, r: self.add_tag(t, r))