105
105
:param broken_line_length: After how much lines to break
108
super(TreeView, self).__init__(homogeneous=False, spacing=0)
108
GObject.GObject.__init__(self, spacing=0)
110
110
self.progress_widget = ProgressPanel()
111
self.pack_start(self.progress_widget, False, True, 0)
111
self.pack_start(self.progress_widget, expand=False, fill=True)
112
112
if getattr(ui.ui_factory, "set_progress_bar_widget", None) is not None:
113
113
# We'are using our own ui, let's tell it to use our widget.
114
114
ui.ui_factory.set_progress_bar_widget(self.progress_widget)
118
118
Gtk.PolicyType.AUTOMATIC)
119
119
self.scrolled_window.set_shadow_type(Gtk.ShadowType.IN)
120
120
self.scrolled_window.show()
121
self.pack_start(self.scrolled_window, True, True, 0)
121
self.pack_start(self.scrolled_window, expand=True, fill=True)
123
123
self.scrolled_window.add(self.construct_treeview())
131
131
self.maxnum = maxnum
132
132
self.compact = compact
134
self.model = treemodel.BranchTreeModel(self.branch, [])
134
self.model = treemodel.TreeModel(self.branch, [])
135
135
GObject.idle_add(self.populate)
137
137
self.connect("destroy", self._on_destroy)
212
212
:param revid: Revision id of revision to display.
214
self.treeview.set_cursor(
215
Gtk.TreePath(path=self.index[revid]), None, False)
214
self.treeview.set_cursor(self.index[revid])
216
215
self.treeview.grab_focus()
218
217
def get_children(self):
312
311
show_graph = self.graph_column.get_visible()
314
313
self.branch.lock_read()
315
(linegraphdata, index, columns_len) = linegraph(
316
self.branch.repository.get_graph(),
314
(linegraphdata, index, columns_len) = linegraph(self.branch.repository.get_graph(),
324
self.model.set_line_graph_data(linegraphdata)
322
self.model.line_graph_data = linegraphdata
325
323
self.graph_cell.columns_len = columns_len
326
width = self.graph_cell.get_preferred_width(self.treeview)[1]
324
width = self.graph_cell.get_size(self.treeview)[2]
330
# The get_preferred_width() call got an insane value.
332
327
self.graph_column.set_fixed_width(width)
333
328
self.graph_column.set_max_width(width)
334
329
self.index = index
335
330
self.treeview.set_model(self.model)
337
332
if not revision or revision == NULL_REVISION:
338
self.treeview.set_cursor(Gtk.TreePath(path=0), None, False)
333
self.treeview.set_cursor(0)
340
335
self.set_revision(revision)
354
349
# from the key (that is the key is found in a REVNO at the offset 0)
355
350
# or if a MESSAGE *contains* the key anywhere (that is, the key is
356
351
# found case insensitively in a MESSAGE at any offset)
357
def search_equal_func(model, column, key, iter, ignored):
352
def search_equal_func(model, column, key, iter):
358
353
return (model.get_value(iter, treemodel.REVNO).find(key) != 0
359
354
and model.get_value(iter, treemodel.MESSAGE).lower().find(key.lower()) == -1)
361
self.treeview.set_search_equal_func(search_equal_func, None)
356
self.treeview.set_search_equal_func(search_equal_func)
362
357
self.treeview.set_enable_search(True)
364
self.treeview.set_tooltip_column(treemodel.MESSAGE)
365
self.treeview.set_headers_visible(True)
359
set_tooltip(treemodel.MESSAGE)
367
361
self._prev_cursor_path = None
368
362
self.treeview.connect("cursor-changed",
384
378
self.revno_column = Gtk.TreeViewColumn("Revision No")
385
379
self.revno_column.set_resizable(True)
386
380
self.revno_column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
387
self.revno_column.set_fixed_width(
388
cell.get_preferred_width(self.treeview)[1])
389
self.revno_column.pack_start(cell, True)
381
self.revno_column.set_fixed_width(cell.get_size(self.treeview)[2])
382
self.revno_column.pack_start(cell, True, True, 0)
390
383
self.revno_column.add_attribute(cell, "text", treemodel.REVNO)
391
384
self.treeview.append_column(self.revno_column)
394
387
self.graph_column = Gtk.TreeViewColumn()
395
388
self.graph_column.set_resizable(True)
396
389
self.graph_column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
397
self.graph_column.pack_start(self.graph_cell, True)
398
self.graph_column.add_attribute(
399
self.graph_cell, "node", treemodel.NODE)
400
self.graph_column.add_attribute(
401
self.graph_cell, "tags", treemodel.TAGS)
402
self.graph_column.add_attribute(
403
self.graph_cell, "in-lines", treemodel.LAST_LINES)
404
self.graph_column.add_attribute(
405
self.graph_cell, "out-lines", treemodel.LINES)
390
self.graph_column.pack_start(self.graph_cell, True, True, 0)
391
self.graph_column.add_attribute(self.graph_cell, "node", treemodel.NODE)
392
self.graph_column.add_attribute(self.graph_cell, "tags", treemodel.TAGS)
393
self.graph_column.add_attribute(self.graph_cell, "in-lines", treemodel.LAST_LINES)
394
self.graph_column.add_attribute(self.graph_cell, "out-lines", treemodel.LINES)
406
395
self.treeview.append_column(self.graph_column)
408
397
cell = Gtk.CellRendererText()
412
401
self.summary_column.set_resizable(True)
413
402
self.summary_column.set_expand(True)
414
403
self.summary_column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
415
self.summary_column.set_fixed_width(
416
cell.get_preferred_width(self.treeview)[1])
417
self.summary_column.pack_start(cell, True)
404
self.summary_column.set_fixed_width(cell.get_size(self.treeview)[2])
405
self.summary_column.pack_start(cell, True, True, 0)
418
406
self.summary_column.add_attribute(cell, "markup", treemodel.SUMMARY)
419
407
self.treeview.append_column(self.summary_column)
425
413
self.authors_column.set_resizable(False)
426
414
self.authors_column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
427
415
self.authors_column.set_fixed_width(200)
428
self.authors_column.pack_start(cell, True)
416
self.authors_column.pack_start(cell, True, True, 0)
429
417
self.authors_column.add_attribute(cell, "text", treemodel.AUTHORS)
430
418
self.treeview.append_column(self.authors_column)
437
425
self.date_column.set_resizable(True)
438
426
self.date_column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
439
427
self.date_column.set_fixed_width(130)
440
self.date_column.pack_start(cell, True)
428
self.date_column.pack_start(cell, True, True, 0)
441
429
self.date_column.add_attribute(cell, "text", treemodel.TIMESTAMP)
442
430
self.treeview.append_column(self.date_column)
454
442
def _on_revision_selected(self, widget, event):
455
443
from bzrlib.plugins.gtk.revisionmenu import RevisionMenu
456
444
if event.button == 3:
458
rev = self.get_revision()
460
revs.append(rev.revision_id)
461
menu = RevisionMenu(self.branch.repository, revs, self.branch)
445
menu = RevisionMenu(self.branch.repository,
446
[self.get_revision().revision_id],
462
448
menu.connect('tag-added', lambda w, t, r: self.add_tag(t, r))
463
menu.popup(None, None, None, None, event.button, event.get_time())
449
menu.popup(None, None, None, event.button, event.get_time())
465
451
def _on_revision_activated(self, widget, path, col):
466
452
self.emit('revision-activated', path, col)