/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 viz/treeview.py

  • Committer: Jelmer Vernooij
  • Date: 2007-10-24 18:03:11 UTC
  • Revision ID: jelmer@samba.org-20071024180311-f7117v3sfyw3e9sc
Add docstrings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    }
31
31
 
32
32
    def __init__(self, branch, start, maxnum):
 
33
        """Create a new TreeView.
 
34
 
 
35
        :param branch: Branch object for branch to show.
 
36
        :param start: Revision id of top revision.
 
37
        :param maxnum: Maximum number of revisions to display, 
 
38
                       None for no limit.
 
39
        """
33
40
        gtk.ScrolledWindow.__init__(self)
34
41
 
35
42
        self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
49
56
        self.connect('destroy', lambda w: self.branch.unlock())
50
57
 
51
58
    def get_revision(self):
 
59
        """Return revision id of currently selected revision, or None."""
52
60
        return self.revision
53
61
 
54
62
    def set_revision(self, revid):
 
63
        """Change the currently selected revision.
 
64
 
 
65
        :param revid: Revision id of revision to display.
 
66
        """
55
67
        self.treeview.set_cursor(self.index[revid])
56
68
        self.treeview.grab_focus()
57
69
 
58
70
    def get_children(self):
 
71
        """Return the children of the currently selected revision.
 
72
 
 
73
        :return: list of revision ids.
 
74
        """
59
75
        return self.children
60
76
 
61
77
    def get_parents(self):
 
78
        """Return the parents of the currently selected revision.
 
79
 
 
80
        :return: list of revision ids.
 
81
        """
62
82
        return self.parents
63
83
        
64
84
    def back(self):
 
85
        """Signal handler for the Back button."""
65
86
        (path, col) = self.treeview.get_cursor()
66
87
        revision = self.model[path][treemodel.REVISION]
67
88
        parents = self.model[path][treemodel.PARENTS]
79
100
        self.treeview.grab_focus()
80
101
 
81
102
    def forward(self):
 
103
        """Signal handler for the Forward button."""
82
104
        (path, col) = self.treeview.get_cursor()
83
105
        revision = self.model[path][treemodel.REVISION]
84
106
        children = self.model[path][treemodel.CHILDREN]
96
118
        self.treeview.grab_focus()
97
119
 
98
120
    def populate(self, start, maxnum):
 
121
        """Fill the treeview with contents.
 
122
 
 
123
        :param start: Revision id of revision to start with.
 
124
        :param maxnum: Maximum number of revisions to display, or None 
 
125
                       for no limit.
 
126
        """
99
127
        (linegraphdata, index, columns_len) = linegraph(self.branch,
100
128
                                                        start,
101
129
                                                        maxnum)