/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: rodney.dawes at canonical
  • Date: 2008-10-25 06:02:09 UTC
  • Revision ID: rodney.dawes@canonical.com-20081025060209-irlizouino63cs1m
        * preferences/__init__.py:
        Remove the dialog separator
        Remove useless extra call to self._create_pages()
        Make the default window size smaller
        Set the default border width on various widgets
        Set the current notebook page to the first one

        * preferences/identity.py:
        Set various border widths appropriately
        Align the labels to the left
        Remove the unneeded bold markup from the labels
        Change the "User Id" label to "E-Mail"
        Align the radio group labels to the top of the groups

        * preferences/plugins.py:
        Set various border widths appropriately
        Set the default paned position to something more sensible
        Set the shadow type on the treeview's scrolled window to in
        Align the Author and Version labels to the left

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
                              (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT)),
94
94
        'tag-added': (gobject.SIGNAL_RUN_FIRST,
95
95
                              gobject.TYPE_NONE,
96
 
                              (gobject.TYPE_STRING, gobject.TYPE_STRING))
 
96
                              (gobject.TYPE_STRING, gobject.TYPE_STRING)),
 
97
        'refreshed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
 
98
                              ())
97
99
    }
98
100
 
99
101
    def __init__(self, branch, start, maxnum, compact=True):
109
111
        gtk.VBox.__init__(self, spacing=0)
110
112
 
111
113
        loading_msg_widget = ProgressPanel()
112
 
        ui.ui_factory.set_nested_progress_bar_widget(loading_msg_widget.get_progress_bar)
 
114
        if getattr(ui.ui_factory, "set_nested_progress_bar_widget", None) is not None:
 
115
            ui.ui_factory.set_nested_progress_bar_widget(loading_msg_widget.get_progress_bar)
113
116
        self.pack_start(loading_msg_widget, expand=False, fill=True)
114
117
 
115
118
        self.scrolled_window = gtk.ScrolledWindow()
124
127
        self.iter = None
125
128
        self.branch = branch
126
129
        self.revision = None
 
130
        self.index = {}
127
131
 
128
132
        self.start = start
129
133
        self.maxnum = maxnum
179
183
        """Return revision id of currently selected revision, or None."""
180
184
        return self.get_property('revision')
181
185
 
 
186
    def has_revision_id(self, revision_id):
 
187
        return (revision_id in self.index)
 
188
 
182
189
    def set_revision(self, revision):
183
190
        self.set_property('revision', revision)
184
191
 
276
283
        """
277
284
 
278
285
        self.progress_bar = ui.ui_factory.nested_progress_bar()
279
 
        self.progress_bar.update(msg="Loading ancestry graph", total_cnt=5)
 
286
        self.progress_bar.update("Loading ancestry graph", 0, 5)
280
287
 
281
288
        try:
282
289
            if self.compact:
310
317
            else:
311
318
                self.set_revision(revision)
312
319
 
 
320
            self.emit('refreshed')
313
321
            return False
314
322
        finally:
315
323
            self.progress_bar.finished()
325
333
        if set_tooltip is not None:
326
334
            set_tooltip(treemodel.MESSAGE)
327
335
 
 
336
        self._prev_cursor_path = None
328
337
        self.treeview.connect("cursor-changed",
329
338
                self._on_selection_changed)
330
339
 
400
409
    def _on_selection_changed(self, treeview):
401
410
        """callback for when the treeview changes."""
402
411
        (path, focus) = treeview.get_cursor()
403
 
        if path is not None:
 
412
        if (path is not None) and (path != self._prev_cursor_path):
 
413
            self._prev_cursor_path = path # avoid emitting twice per click
404
414
            self.iter = self.model.get_iter(path)
405
415
            self.emit('revision-selected')
406
416
 
407
417
    def _on_revision_selected(self, widget, event):
408
 
        from bzrlib.plugins.gtk.revisionmenu import RevisionPopupMenu
 
418
        from bzrlib.plugins.gtk.revisionmenu import RevisionMenu
409
419
        if event.button == 3:
410
 
            menu = RevisionPopupMenu(self.branch.repository, 
 
420
            menu = RevisionMenu(self.branch.repository, 
411
421
                [self.get_revision().revision_id],
412
422
                self.branch)
413
423
            menu.connect('tag-added', lambda w, t, r: self.add_tag(t, r))