33
class TreeModel(gtk.GenericTreeModel):
37
class TreeModel(Gtk.GenericTreeModel):
36
39
def __init__ (self, branch, line_graph_data):
37
gtk.GenericTreeModel.__init__(self)
40
GObject.GObject.__init__(self)
38
41
self.revisions = {}
40
43
self.repository = branch.repository
41
44
self.line_graph_data = line_graph_data
43
if self.branch.supports_tags():
46
if self.branch.supports_tags():
44
47
self.tags = self.branch.tags.get_reverse_tag_dict()
53
56
self.tags[revid] = [tag]
55
58
def on_get_flags(self):
56
return gtk.TREE_MODEL_LIST_ONLY
59
return Gtk.TREE_MODEL_LIST_ONLY
58
61
def on_get_n_columns(self):
61
64
def on_get_column_type(self, index):
62
if index == REVID: return gobject.TYPE_STRING
63
if index == NODE: return gobject.TYPE_PYOBJECT
64
if index == LINES: return gobject.TYPE_PYOBJECT
65
if index == LAST_LINES: return gobject.TYPE_PYOBJECT
66
if index == REVNO: return gobject.TYPE_STRING
67
if index == SUMMARY: return gobject.TYPE_STRING
68
if index == MESSAGE: return gobject.TYPE_STRING
69
if index == COMMITTER: return gobject.TYPE_STRING
70
if index == TIMESTAMP: return gobject.TYPE_STRING
71
if index == REVISION: return gobject.TYPE_PYOBJECT
72
if index == PARENTS: return gobject.TYPE_PYOBJECT
73
if index == CHILDREN: return gobject.TYPE_PYOBJECT
74
if index == TAGS: return gobject.TYPE_PYOBJECT
65
if index == REVID: return GObject.TYPE_STRING
66
if index == NODE: return GObject.TYPE_PYOBJECT
67
if index == LINES: return GObject.TYPE_PYOBJECT
68
if index == LAST_LINES: return GObject.TYPE_PYOBJECT
69
if index == REVNO: return GObject.TYPE_STRING
70
if index == SUMMARY: return GObject.TYPE_STRING
71
if index == MESSAGE: return GObject.TYPE_STRING
72
if index == COMMITTER: return GObject.TYPE_STRING
73
if index == TIMESTAMP: return GObject.TYPE_STRING
74
if index == REVISION: return GObject.TYPE_PYOBJECT
75
if index == PARENTS: return GObject.TYPE_PYOBJECT
76
if index == CHILDREN: return GObject.TYPE_PYOBJECT
77
if index == TAGS: return GObject.TYPE_PYOBJECT
78
if index == AUTHORS: return GObject.TYPE_STRING
76
80
def on_get_iter(self, path):
79
83
def on_get_path(self, rowref):
82
86
def on_get_value(self, rowref, column):
83
87
if len(self.line_graph_data) > 0:
84
88
(revid, node, lines, parents,
108
112
self.revisions[revid] = revision
110
114
revision = self.revisions[revid]
112
116
if column == REVISION: return revision
113
117
if column == SUMMARY: return escape(revision.get_summary())
114
118
if column == MESSAGE: return escape(revision.message)
115
if column == COMMITTER: return re.sub('<.*@.*>', '',
116
revision.committer).strip(' ')
117
if column == TIMESTAMP:
119
if column == COMMITTER: return parse_username(revision.committer)[0]
120
if column == TIMESTAMP:
118
121
return strftime("%Y-%m-%d %H:%M", localtime(revision.timestamp))
122
if column == AUTHORS:
124
parse_username(author)[0] for author in revision.get_apparent_authors()])
120
126
def on_iter_next(self, rowref):
121
127
if rowref < len(self.line_graph_data) - 1:
125
131
def on_iter_children(self, parent):
126
132
if parent is None: return 0
129
135
def on_iter_has_child(self, rowref):
132
138
def on_iter_n_children(self, rowref):
133
139
if rowref is None: return len(self.line_graph_data)
136
142
def on_iter_nth_child(self, parent, n):
137
143
if parent is None: return n
140
146
def on_iter_parent(self, child):