18
from bzrlib.plugins.gtk import _i18n
19
17
from linegraph import linegraph, same_branch
20
18
from graphcell import CellRendererGraph
21
19
from treemodel import TreeModel
107
108
gtk.VBox.__init__(self, spacing=0)
110
self.pack_start(self.construct_loading_msg(), expand=False, fill=True)
111
self.connect('revisions-loaded',
112
lambda x: self.loading_msg_box.hide())
109
114
self.scrolled_window = gtk.ScrolledWindow()
110
115
self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,
111
116
gtk.POLICY_AUTOMATIC)
216
222
self.emit('tag-added', tag, revid)
218
224
def refresh(self):
225
self.loading_msg_box.show()
219
226
gobject.idle_add(self.populate, self.get_revision())
221
228
def update(self):
269
276
should be broken.
272
loading_progress = ui.ui_factory.nested_progress_bar()
273
loading_progress.update(msg="Loading ancestry graph", total=5)
277
broken_line_length = 32
279
broken_line_length = None
281
show_graph = self.graph_column.get_visible()
283
self.branch.lock_read()
284
(linegraphdata, index, columns_len) = linegraph(self.branch.repository.get_graph(),
292
self.model = TreeModel(self.branch, linegraphdata)
293
self.graph_cell.columns_len = columns_len
294
width = self.graph_cell.get_size(self.treeview)[2]
297
self.graph_column.set_fixed_width(width)
298
self.graph_column.set_max_width(width)
300
self.treeview.set_model(self.model)
302
if not revision or revision == NULL_REVISION:
303
self.treeview.set_cursor(0)
305
self.set_revision(revision)
309
loading_progress.finished()
280
broken_line_length = 32
282
broken_line_length = None
284
show_graph = self.graph_column.get_visible()
286
self.branch.lock_read()
287
(linegraphdata, index, columns_len) = linegraph(self.branch.repository,
294
self.model = TreeModel(self.branch, linegraphdata)
295
self.graph_cell.columns_len = columns_len
296
width = self.graph_cell.get_size(self.treeview)[2]
299
self.graph_column.set_fixed_width(width)
300
self.graph_column.set_max_width(width)
302
self.treeview.set_model(self.model)
304
if not revision or revision == NULL_REVISION:
305
self.treeview.set_cursor(0)
307
self.set_revision(revision)
309
self.emit('revisions-loaded')
311
313
def construct_treeview(self):
312
314
self.treeview = gtk.TreeView()
336
338
cell.set_property("width-chars", 15)
337
339
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
338
340
self.revno_column = gtk.TreeViewColumn("Revision No")
339
self.revno_column.set_resizable(False)
341
self.revno_column.set_resizable(True)
340
342
self.revno_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
341
343
self.revno_column.set_fixed_width(cell.get_size(self.treeview)[2])
342
344
self.revno_column.pack_start(cell, expand=True)
346
348
self.graph_cell = CellRendererGraph()
347
349
self.graph_column = gtk.TreeViewColumn()
348
self.graph_column.set_resizable(False)
350
self.graph_column.set_resizable(True)
349
351
self.graph_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
350
self.graph_column.pack_start(self.graph_cell, expand=True)
352
self.graph_column.pack_start(self.graph_cell, expand=False)
351
353
self.graph_column.add_attribute(self.graph_cell, "node", treemodel.NODE)
352
354
self.graph_column.add_attribute(self.graph_cell, "tags", treemodel.TAGS)
353
355
self.graph_column.add_attribute(self.graph_cell, "in-lines", treemodel.LAST_LINES)
358
360
cell.set_property("width-chars", 65)
359
361
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
360
362
self.summary_column = gtk.TreeViewColumn("Summary")
361
self.summary_column.set_resizable(False)
362
self.summary_column.set_expand(True)
363
self.summary_column.set_resizable(True)
363
364
self.summary_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
364
365
self.summary_column.set_fixed_width(cell.get_size(self.treeview)[2])
365
366
self.summary_column.pack_start(cell, expand=True)
370
371
cell.set_property("width-chars", 15)
371
372
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
372
373
self.committer_column = gtk.TreeViewColumn("Committer")
373
self.committer_column.set_resizable(False)
374
self.committer_column.set_resizable(True)
374
375
self.committer_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
375
self.committer_column.set_fixed_width(200)
376
self.committer_column.set_fixed_width(cell.get_size(self.treeview)[2])
376
377
self.committer_column.pack_start(cell, expand=True)
377
378
self.committer_column.add_attribute(cell, "text", treemodel.COMMITTER)
378
379
self.treeview.append_column(self.committer_column)
382
383
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
383
384
self.date_column = gtk.TreeViewColumn("Date")
384
385
self.date_column.set_visible(False)
385
self.date_column.set_resizable(False)
386
self.date_column.set_resizable(True)
386
387
self.date_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
387
self.date_column.set_fixed_width(130)
388
self.date_column.set_fixed_width(cell.get_size(self.treeview)[2])
388
389
self.date_column.pack_start(cell, expand=True)
389
390
self.date_column.add_attribute(cell, "text", treemodel.TIMESTAMP)
390
391
self.treeview.append_column(self.date_column)
392
393
return self.treeview
395
def construct_loading_msg(self):
396
image_loading = gtk.image_new_from_stock(gtk.STOCK_REFRESH,
397
gtk.ICON_SIZE_BUTTON)
400
label_loading = gtk.Label(_("Please wait, loading ancestral graph..."))
401
label_loading.set_alignment(0.0, 0.5)
404
self.loading_msg_box = gtk.HBox()
405
self.loading_msg_box.set_spacing(5)
406
self.loading_msg_box.set_border_width(5)
407
self.loading_msg_box.pack_start(image_loading, False, False)
408
self.loading_msg_box.pack_start(label_loading, True, True)
409
self.loading_msg_box.show()
411
return self.loading_msg_box
394
413
def _on_selection_changed(self, treeview):
395
414
"""callback for when the treeview changes."""