/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: 2008-06-29 16:24:24 UTC
  • mto: This revision was merged to the branch mainline in revision 519.
  • Revision ID: jelmer@samba.org-20080629162424-48a6rrjmmpejfcyr
Stop emitting no longer used revisions-loaded message.

Show diffs side-by-side

added added

removed removed

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