/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

Merged with mainline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
REVISION = 9
28
28
PARENTS = 10
29
29
CHILDREN = 11
 
30
TAGS = 12
30
31
 
31
32
class TreeModel(gtk.GenericTreeModel):
32
33
 
33
34
    
34
 
    def __init__ (self, repository, line_graph_data):
 
35
    def __init__ (self, branch, line_graph_data):
35
36
        gtk.GenericTreeModel.__init__(self)
36
37
        self.revisions = {}
37
 
        self.repository = repository
 
38
        self.branch = branch
 
39
        self.repository = branch.repository
38
40
        self.line_graph_data = line_graph_data
39
 
    
 
41
 
 
42
        if self.branch.supports_tags():
 
43
            self.tags = self.branch.tags.get_reverse_tag_dict()
 
44
        else:
 
45
            self.tags = {}
 
46
 
 
47
    def add_tag(self, tag, revid):
 
48
        self.branch.tags.set_tag(tag, revid)
 
49
        try:
 
50
            self.tags[revid].append(tag)
 
51
        except KeyError:
 
52
            self.tags[revid] = [tag]
 
53
 
40
54
    def on_get_flags(self):
41
55
        return gtk.TREE_MODEL_LIST_ONLY
42
56
    
43
57
    def on_get_n_columns(self):
44
 
        return 12
 
58
        return 13
45
59
    
46
60
    def on_get_column_type(self, index):
47
61
        if index == REVID: return gobject.TYPE_STRING
56
70
        if index == REVISION: return gobject.TYPE_PYOBJECT
57
71
        if index == PARENTS: return gobject.TYPE_PYOBJECT
58
72
        if index == CHILDREN: return gobject.TYPE_PYOBJECT
 
73
        if index == TAGS: return gobject.TYPE_PYOBJECT
59
74
        
60
75
    def on_get_iter(self, path):
61
76
        return path[0]
82
97
            return []
83
98
        if column == REVNO: return ".".join(["%d" % (revno)
84
99
                                      for revno in revno_sequence])
85
 
        
 
100
 
 
101
        if column == TAGS: return self.tags.get(revid, [])
 
102
 
86
103
        if revid is None:
87
104
            return None
88
105
        if revid not in self.revisions: