/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: Ali Sabil
  • Date: 2008-01-21 12:31:58 UTC
  • mto: (423.5.5 viz-tags-fancy)
  • mto: This revision was merged to the branch mainline in revision 429.
  • Revision ID: ali.sabil@gmail.com-20080121123158-czjjqha0j043x2ib
Added tags visualization in the graph

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
TIMESTAMP = 7
26
26
REVISION = 8
27
27
PARENTS = 9
28
 
CHILDREN = 10
 
28
CHILDREN = 10
 
29
TAGS = 11
29
30
 
30
31
class TreeModel(gtk.GenericTreeModel):
31
32
 
32
33
    
33
 
    def __init__ (self, repository, line_graph_data):
 
34
    def __init__ (self, branch, line_graph_data):
34
35
        gtk.GenericTreeModel.__init__(self)
35
 
        self.revisions = {}
36
 
        self.repository = repository
 
36
        self.revisions = {}
 
37
        self.branch = branch
 
38
        self.repository = branch.repository
37
39
        self.line_graph_data = line_graph_data
38
40
    
39
41
    def on_get_flags(self):
40
42
        return gtk.TREE_MODEL_LIST_ONLY
41
43
    
42
44
    def on_get_n_columns(self):
43
 
        return 11
 
45
        return 12
44
46
    
45
47
    def on_get_column_type(self, index):
46
48
        if index == REVID: return gobject.TYPE_STRING
53
55
        if index == TIMESTAMP: return gobject.TYPE_STRING
54
56
        if index == REVISION: return gobject.TYPE_PYOBJECT
55
57
        if index == PARENTS: return gobject.TYPE_PYOBJECT
56
 
        if index == CHILDREN: return gobject.TYPE_PYOBJECT
 
58
        if index == CHILDREN: return gobject.TYPE_PYOBJECT
 
59
        if index == TAGS: return gobject.TYPE_PYOBJECT
57
60
        
58
61
    def on_get_iter(self, path):
59
62
        return path[0]
80
83
            return []
81
84
        if column == REVNO: return ".".join(["%d" % (revno)
82
85
                                      for revno in revno_sequence])
83
 
        
 
86
 
 
87
        if column == TAGS:
 
88
            if not self.branch.supports_tags():
 
89
                return []
 
90
            try:
 
91
                return self.branch.tags.get_reverse_tag_dict()[revid]
 
92
            except KeyError:
 
93
                return []
 
94
 
84
95
        if revid is None:
85
96
            return None
86
97
        if revid not in self.revisions: