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

  • Committer: Daniel Schierbeck
  • Date: 2007-12-02 16:20:10 UTC
  • mto: This revision was merged to the branch mainline in revision 417.
  • Revision ID: daniel.schierbeck@gmail.com-20071202162010-5ki3hvdtmlzy7x4k
Added branch and revision properties to the revisionview widget.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
pygtk.require("2.0")
20
20
import gtk
21
21
import pango
 
22
import gobject
22
23
 
23
24
from bzrlib.osutils import format_date
24
25
from bzrlib.util import bencode
30
31
    start.
31
32
    """
32
33
 
 
34
    __gproperties__ = {
 
35
        'branch': (
 
36
            gobject.TYPE_PYOBJECT,
 
37
            'Branch',
 
38
            'The branch holding the revision being displayed',
 
39
            gobject.PARAM_CONSTRUCT_ONLY | gobject.PARAM_WRITABLE
 
40
        ),
 
41
 
 
42
        'revision': (
 
43
            gobject.TYPE_PYOBJECT,
 
44
            'Revision',
 
45
            'The revision being displayed',
 
46
            gobject.PARAM_CONSTRUCT | gobject.PARAM_READWRITE
 
47
        )
 
48
    }
 
49
 
 
50
 
33
51
    def __init__(self, revision=None, tags=[],
34
52
                 show_children=False, branch=None):
35
53
        gtk.Notebook.__init__(self)
51
69
            self.set_revision(revision, tags=tags)
52
70
        self.set_file_id(None)
53
71
 
 
72
    def do_get_property(self, property):
 
73
        if property.name == 'branch':
 
74
            return self._branch
 
75
        elif property.name == 'revision':
 
76
            return self._revision
 
77
        else:
 
78
            raise AttributeError, 'unknown property %s' % property.name
 
79
 
 
80
    def do_set_property(self, property, value):
 
81
        if property.name == 'branch':
 
82
            self._branch = value
 
83
        elif property.name == 'revision':
 
84
            self._set_revision(value)
 
85
        else:
 
86
            raise AttributeError, 'unknown property %s' % property.name
 
87
 
54
88
    def set_show_callback(self, callback):
55
89
        self._show_callback = callback
56
90
 
66
100
        self._file_id = file_id
67
101
 
68
102
    def set_revision(self, revision, tags=[], children=[]):
 
103
        self.set_property('revision', revision)
 
104
 
 
105
    def _set_revision(self, revision, tags=[], children=[]):
 
106
        if revision is None: return
 
107
 
69
108
        self._revision = revision
70
109
        self.revision_id.set_text(revision.revision_id)
71
110
        if revision.committer is not None: