39
39
def get_parents(self):
40
40
return self.parents
42
def set_branch(self, branch, start, maxnum):
45
gobject.idle_add(self.populate, start, maxnum)
48
(path, col) = self.treeview.get_cursor()
49
revision = self.model[path][treemodel.REVISION]
50
parents = self.model[path][treemodel.PARENTS]
54
for parent_id in parents:
55
parent_index = self.index[parent_id]
56
parent = self.model[parent_index][treemodel.REVISION]
57
if same_branch(revision, parent):
58
self.treeview.set_cursor(parent_index)
61
self.treeview.set_cursor(self.index[parents[0]])
62
self.treeview.grab_focus()
65
(path, col) = self.treeview.get_cursor()
66
revision = self.model[path][treemodel.REVISION]
67
children = self.model[path][treemodel.CHILDREN]
71
for child_id in children:
72
child_index = self.index[child_id]
73
child = self.model[child_index][treemodel.REVISION]
74
if same_branch(child, revision):
75
self.treeview.set_cursor(child_index)
78
self.treeview.set_cursor(self.index[children[0]])
79
self.treeview.grab_focus()
81
def populate(self, start, maxnum):
82
self.branch.lock_read()
84
(linegraphdata, index, columns_len) = linegraph(self.branch,
88
self.model = TreeModel(self.branch, linegraphdata)
89
self.graph_cell.columns_len = columns_len
90
width = self.graph_cell.get_size(self.treeview)[2]
91
self.graph_column.set_fixed_width(width)
92
self.graph_column.set_max_width(width)
94
self.treeview.set_model(self.model)
95
self.treeview.set_cursor(0)
42
99
def construct_treeview(self):
43
100
self.treeview = gtk.TreeView()
102
159
column.add_attribute(cell, "text", treemodel.COMMITER)
103
160
self.treeview.append_column(column)
105
def set_branch(self, branch, start, maxnum):
108
gobject.idle_add(self.populate, start, maxnum)
110
def populate(self, start, maxnum):
111
self.branch.lock_read()
113
(linegraphdata, index, columns_len) = linegraph(self.branch,
117
self.model = TreeModel(self.branch, linegraphdata)
118
self.graph_cell.columns_len = columns_len
119
width = self.graph_cell.get_size(self.treeview)[2]
120
self.graph_column.set_fixed_width(width)
121
self.graph_column.set_max_width(width)
123
self.treeview.set_model(self.model)
124
self.treeview.get_selection().select_path(0)
128
162
def _on_selection_changed(self, selection, *args):
129
163
"""callback for when the treeview changes."""
130
164
(model, selected_rows) = selection.get_selected_rows()