/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/treemodel.py

  • Committer: Jelmer Vernooij
  • Date: 2011-02-18 13:16:37 UTC
  • mto: This revision was merged to the branch mainline in revision 714.
  • Revision ID: jelmer@samba.org-20110218131637-jo72qis53vvu0zud
'bzr viz' now shows authors instead of committers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
import gobject
12
12
import re
13
13
from xml.sax.saxutils import escape
 
14
 
 
15
from bzrlib.config import parse_username
14
16
from bzrlib.revision import NULL_REVISION
15
17
 
16
18
from time import (strftime, localtime)
53
55
 
54
56
    def on_get_flags(self):
55
57
        return gtk.TREE_MODEL_LIST_ONLY
56
 
    
 
58
 
57
59
    def on_get_n_columns(self):
58
 
        return 13
59
 
    
 
60
        return 14
 
61
 
60
62
    def on_get_column_type(self, index):
61
63
        if index == REVID: return gobject.TYPE_STRING
62
64
        if index == NODE: return gobject.TYPE_PYOBJECT
71
73
        if index == PARENTS: return gobject.TYPE_PYOBJECT
72
74
        if index == CHILDREN: return gobject.TYPE_PYOBJECT
73
75
        if index == TAGS: return gobject.TYPE_PYOBJECT
74
 
        
 
76
        if index == AUTHORS: return gobject.TYPE_STRING
 
77
 
75
78
    def on_get_iter(self, path):
76
79
        return path[0]
77
 
    
 
80
 
78
81
    def on_get_path(self, rowref):
79
82
        return rowref
80
 
    
 
83
 
81
84
    def on_get_value(self, rowref, column):
82
85
        if len(self.line_graph_data) > 0:
83
86
            (revid, node, lines, parents,
107
110
            self.revisions[revid] = revision
108
111
        else:
109
112
            revision = self.revisions[revid]
110
 
        
 
113
 
111
114
        if column == REVISION: return revision
112
115
        if column == SUMMARY: return escape(revision.get_summary())
113
116
        if column == MESSAGE: return escape(revision.message)
114
 
        if column == COMMITTER: return re.sub('<.*@.*>', '', 
115
 
                                             revision.committer).strip(' ')
116
 
        if column == TIMESTAMP: 
 
117
        if column == COMMITTER: return parse_username(revision.committer)[0]
 
118
        if column == TIMESTAMP:
117
119
            return strftime("%Y-%m-%d %H:%M", localtime(revision.timestamp))
 
120
        if column == AUTHORS:
 
121
            return ", ".join([
 
122
                parse_username(author)[0] for author in revision.get_apparent_authors()])
118
123
 
119
124
    def on_iter_next(self, rowref):
120
125
        if rowref < len(self.line_graph_data) - 1:
121
126
            return rowref+1
122
127
        return None
123
 
    
 
128
 
124
129
    def on_iter_children(self, parent):
125
130
        if parent is None: return 0
126
131
        return None
127
 
    
 
132
 
128
133
    def on_iter_has_child(self, rowref):
129
134
        return False
130
 
    
 
135
 
131
136
    def on_iter_n_children(self, rowref):
132
137
        if rowref is None: return len(self.line_graph_data)
133
138
        return 0
134
 
    
 
139
 
135
140
    def on_iter_nth_child(self, parent, n):
136
141
        if parent is None: return n
137
142
        return None
138
 
    
 
143
 
139
144
    def on_iter_parent(self, child):
140
145
        return None