/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
0.1.1 by Dan Loda
First working version of xannotate.
1
# Copyright (C) 2005 Dan Loda <danloda@gmail.com>
175 by Jelmer Vernooij
Add very simple gmissing command.
2
# Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org>
0.1.1 by Dan Loda
First working version of xannotate.
3
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18
import pygtk
19
pygtk.require("2.0")
20
import gtk
21
import pango
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
22
import gobject
0.1.1 by Dan Loda
First working version of xannotate.
23
24
from bzrlib.osutils import format_date
412.1.8 by Daniel Schierbeck
Only import the bdecode function from the bzrlib.util.bencode package.
25
from bzrlib.util.bencode import bdecode
0.1.1 by Dan Loda
First working version of xannotate.
26
330.3.1 by Daniel Schierbeck
Renamed logview 'revisionview'.
27
class RevisionView(gtk.Notebook):
0.1.1 by Dan Loda
First working version of xannotate.
28
    """ Custom widget for commit log details.
29
30
    A variety of bzr tools may need to implement such a thing. This is a
31
    start.
32
    """
33
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
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',
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
46
            gobject.PARAM_READWRITE
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
47
        ),
48
412.1.13 by Daniel Schierbeck
Re-added support for displaying the children of a revision.
49
        'children': (
50
            gobject.TYPE_PYOBJECT,
51
            'Children',
52
            'Child revisions',
53
            gobject.PARAM_READWRITE
54
        ),
55
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
56
        'file-id': (
57
            gobject.TYPE_PYOBJECT,
58
            'File Id',
59
            'The file id',
60
            gobject.PARAM_READWRITE
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
61
        )
62
    }
63
64
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
65
    def __init__(self, branch=None):
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
66
        gtk.Notebook.__init__(self)
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
67
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
68
        self._create_general()
69
        self._create_relations()
278.1.45 by John Arbash Meinel
Switch to a new tab for per-file messages.
70
        self._create_file_info_view()
324.2.9 by Daniel Schierbeck
Made 'General' the default page of the logview.
71
72
        self.set_current_page(0)
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
73
        
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
74
        self._show_callback = None
75
        self._clicked_callback = None
0.1.1 by Dan Loda
First working version of xannotate.
76
412.1.9 by Daniel Schierbeck
Removed the use of RevisionView.set_go_callback().
77
        self._revision = None
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
78
        self._branch = branch
79
423.7.4 by Daniel Schierbeck
Made revisionview and branchview update when a tag is added.
80
        self.update_tags()
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
81
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
82
        self.set_file_id(None)
0.1.1 by Dan Loda
First working version of xannotate.
83
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
84
    def do_get_property(self, property):
85
        if property.name == 'branch':
86
            return self._branch
87
        elif property.name == 'revision':
88
            return self._revision
412.1.13 by Daniel Schierbeck
Re-added support for displaying the children of a revision.
89
        elif property.name == 'children':
90
            return self._children
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
91
        elif property.name == 'file-id':
92
            return self._file_id
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
93
        else:
94
            raise AttributeError, 'unknown property %s' % property.name
95
96
    def do_set_property(self, property, value):
97
        if property.name == 'branch':
98
            self._branch = value
99
        elif property.name == 'revision':
100
            self._set_revision(value)
412.1.13 by Daniel Schierbeck
Re-added support for displaying the children of a revision.
101
        elif property.name == 'children':
102
            self.set_children(value)
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
103
        elif property.name == 'file-id':
104
            self._file_id = value
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
105
        else:
106
            raise AttributeError, 'unknown property %s' % property.name
107
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
108
    def set_show_callback(self, callback):
109
        self._show_callback = callback
110
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
111
    def set_file_id(self, file_id):
112
        """Set a specific file id that we want to track.
113
114
        This just effects the display of a per-file commit message.
115
        If it is set to None, then all commit messages will be shown.
116
        """
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
117
        self.set_property('file-id', file_id)
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
118
412.1.13 by Daniel Schierbeck
Re-added support for displaying the children of a revision.
119
    def set_revision(self, revision):
412.1.9 by Daniel Schierbeck
Removed the use of RevisionView.set_go_callback().
120
        if revision != self._revision:
121
            self.set_property('revision', revision)
122
123
    def get_revision(self):
124
        return self.get_property('revision')
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
125
412.1.15 by Daniel Schierbeck
Removed redundant method argument.
126
    def _set_revision(self, revision):
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
127
        if revision is None: return
128
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
129
        self._revision = revision
192 by Jelmer Vernooij
Allow committer to be None.
130
        if revision.committer is not None:
131
            self.committer.set_text(revision.committer)
132
        else:
133
            self.committer.set_text("")
259 by Aaron Bentley
Add author support to gannotate and log viewer
134
        author = revision.properties.get('author', '')
135
        if author != '':
136
            self.author.set_text(author)
137
            self.author.show()
138
            self.author_label.show()
139
        else:
140
            self.author.hide()
141
            self.author_label.hide()
142
197 by Jelmer Vernooij
Fix some warnings when displaying ghost revisions. Reported by John.
143
        if revision.timestamp is not None:
144
            self.timestamp.set_text(format_date(revision.timestamp,
145
                                                revision.timezone))
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
146
        try:
147
            self.branchnick_label.set_text(revision.properties['branch-nick'])
148
        except KeyError:
149
            self.branchnick_label.set_text("")
150
256.2.23 by Gary van der Merwe
Show Children
151
        self._add_parents_or_children(revision.parent_ids,
152
                                      self.parents_widgets,
153
                                      self.parents_table)
154
        
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
155
        file_info = revision.properties.get('file-info', None)
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
156
        if file_info is not None:
412.1.8 by Daniel Schierbeck
Only import the bdecode function from the bzrlib.util.bencode package.
157
            file_info = bdecode(file_info.encode('UTF-8'))
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
158
159
        if file_info:
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
160
            if self._file_id is None:
161
                text = []
162
                for fi in file_info:
163
                    text.append('%(path)s\n%(message)s' % fi)
164
                self.file_info_buffer.set_text('\n'.join(text))
165
                self.file_info_box.show()
166
            else:
167
                text = []
168
                for fi in file_info:
169
                    if fi['file_id'] == self._file_id:
170
                        text.append(fi['message'])
171
                if text:
172
                    self.file_info_buffer.set_text('\n'.join(text))
173
                    self.file_info_box.show()
174
                else:
175
                    self.file_info_box.hide()
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
176
        else:
177
            self.file_info_box.hide()
178
423.7.4 by Daniel Schierbeck
Made revisionview and branchview update when a tag is added.
179
    def update_tags(self):
180
        if self._branch is not None and self._branch.supports_tags():
181
            self._tagdict = self._branch.tags.get_reverse_tag_dict()
182
        else:
183
            self._tagdict = {}
184
185
        self._add_tags()
186
412.1.13 by Daniel Schierbeck
Re-added support for displaying the children of a revision.
187
    def set_children(self, children):
188
        self._add_parents_or_children(children,
189
                                      self.children_widgets,
190
                                      self.children_table)
191
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
192
    def _show_clicked_cb(self, widget, revid, parentid):
193
        """Callback for when the show button for a parent is clicked."""
194
        self._show_callback(revid, parentid)
195
196
    def _go_clicked_cb(self, widget, revid):
197
        """Callback for when the go button for a parent is clicked."""
198
412.1.4 by Daniel Schierbeck
Made tag list smarter.
199
    def _add_tags(self, *args):
423.7.4 by Daniel Schierbeck
Made revisionview and branchview update when a tag is added.
200
        if self._revision is None: return
201
412.1.4 by Daniel Schierbeck
Made tag list smarter.
202
        if self._tagdict.has_key(self._revision.revision_id):
203
            tags = self._tagdict[self._revision.revision_id]
204
        else:
205
            tags = []
206
            
241 by Jelmer Vernooij
Show tags in bzr viz.
207
        if tags == []:
208
            self.tags_list.hide()
209
            self.tags_label.hide()
210
            return
211
212
        for widget in self.tags_widgets:
213
            self.tags_list.remove(widget)
214
242 by Jelmer Vernooij
Avoid cleanup warning.
215
        self.tags_widgets = []
216
241 by Jelmer Vernooij
Show tags in bzr viz.
217
        for tag in tags:
218
            widget = gtk.Label(tag)
219
            widget.set_selectable(True)
220
            self.tags_widgets.append(widget)
221
            self.tags_list.add(widget)
222
        self.tags_list.show_all()
223
        self.tags_label.show_all()
224
        
256.2.23 by Gary van der Merwe
Show Children
225
    def _add_parents_or_children(self, revids, widgets, table):
226
        while len(widgets) > 0:
227
            widget = widgets.pop()
228
            table.remove(widget)
229
        
230
        table.resize(max(len(revids), 1), 2)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
231
256.2.23 by Gary van der Merwe
Show Children
232
        for idx, revid in enumerate(revids):
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
233
            align = gtk.Alignment(0.0, 0.0)
256.2.23 by Gary van der Merwe
Show Children
234
            widgets.append(align)
235
            table.attach(align, 1, 2, idx, idx + 1,
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
236
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
237
            align.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
238
239
            hbox = gtk.HBox(False, spacing=6)
240
            align.add(hbox)
241
            hbox.show()
242
243
            image = gtk.Image()
244
            image.set_from_stock(
245
                gtk.STOCK_FIND, gtk.ICON_SIZE_SMALL_TOOLBAR)
246
            image.show()
247
148 by Jelmer Vernooij
Clean up interface a bit: don't show diff button when no diff can be accessed, use label instead of button when there is no callback set.
248
            if self._show_callback is not None:
249
                button = gtk.Button()
250
                button.add(image)
251
                button.connect("clicked", self._show_clicked_cb,
256.2.23 by Gary van der Merwe
Show Children
252
                               self._revision.revision_id, revid)
148 by Jelmer Vernooij
Clean up interface a bit: don't show diff button when no diff can be accessed, use label instead of button when there is no callback set.
253
                hbox.pack_start(button, expand=False, fill=True)
254
                button.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
255
412.1.9 by Daniel Schierbeck
Removed the use of RevisionView.set_go_callback().
256
            button = gtk.Button(revid)
257
            button.connect("clicked",
412.1.14 by Daniel Schierbeck
Fixed bug in the way the child buttons worked.
258
                    lambda w, r: self.set_revision(self._branch.repository.get_revision(r)), revid)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
259
            button.set_use_underline(False)
260
            hbox.pack_start(button, expand=False, fill=True)
261
            button.show()
0.1.1 by Dan Loda
First working version of xannotate.
262
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
263
    def _create_general(self):
0.1.1 by Dan Loda
First working version of xannotate.
264
        vbox = gtk.VBox(False, 6)
265
        vbox.set_border_width(6)
266
        vbox.pack_start(self._create_headers(), expand=False, fill=True)
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
267
        vbox.pack_start(self._create_message_view())
268
        self.append_page(vbox, tab_label=gtk.Label("General"))
269
        vbox.show()
270
271
    def _create_relations(self):
272
        vbox = gtk.VBox(False, 6)
273
        vbox.set_border_width(6)
291 by Jelmer Vernooij
Put children widget on a new line.
274
        vbox.pack_start(self._create_parents(), expand=False, fill=True)
412.1.13 by Daniel Schierbeck
Re-added support for displaying the children of a revision.
275
        vbox.pack_start(self._create_children(), expand=False, fill=True)
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
276
        self.append_page(vbox, tab_label=gtk.Label("Relations"))
0.1.1 by Dan Loda
First working version of xannotate.
277
        vbox.show()
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
278
0.1.1 by Dan Loda
First working version of xannotate.
279
    def _create_headers(self):
241 by Jelmer Vernooij
Show tags in bzr viz.
280
        self.table = gtk.Table(rows=5, columns=2)
0.1.1 by Dan Loda
First working version of xannotate.
281
        self.table.set_row_spacings(6)
282
        self.table.set_col_spacings(6)
283
        self.table.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
284
285
        align = gtk.Alignment(1.0, 0.5)
286
        label = gtk.Label()
287
        label.set_markup("<b>Revision Id:</b>")
288
        align.add(label)
289
        self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
290
        align.show()
291
        label.show()
292
293
        align = gtk.Alignment(0.0, 0.5)
412.1.5 by Daniel Schierbeck
Made the revision id label use signals when updating.
294
        revision_id = gtk.Label()
295
        revision_id.set_selectable(True)
296
        self.connect('notify::revision', 
297
                lambda w, p: revision_id.set_text(self._revision.revision_id))
298
        align.add(revision_id)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
299
        self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
300
        align.show()
412.1.5 by Daniel Schierbeck
Made the revision id label use signals when updating.
301
        revision_id.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
302
0.1.1 by Dan Loda
First working version of xannotate.
303
        align = gtk.Alignment(1.0, 0.5)
259 by Aaron Bentley
Add author support to gannotate and log viewer
304
        self.author_label = gtk.Label()
305
        self.author_label.set_markup("<b>Author:</b>")
306
        align.add(self.author_label)
307
        self.table.attach(align, 0, 1, 1, 2, gtk.FILL, gtk.FILL)
308
        align.show()
309
        self.author_label.show()
310
311
        align = gtk.Alignment(0.0, 0.5)
312
        self.author = gtk.Label()
313
        self.author.set_selectable(True)
314
        align.add(self.author)
315
        self.table.attach(align, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
316
        align.show()
317
        self.author.show()
318
        self.author.hide()
319
320
        align = gtk.Alignment(1.0, 0.5)
0.1.1 by Dan Loda
First working version of xannotate.
321
        label = gtk.Label()
322
        label.set_markup("<b>Committer:</b>")
323
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
324
        self.table.attach(align, 0, 1, 2, 3, gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
325
        align.show()
326
        label.show()
327
328
        align = gtk.Alignment(0.0, 0.5)
329
        self.committer = gtk.Label()
330
        self.committer.set_selectable(True)
331
        align.add(self.committer)
259 by Aaron Bentley
Add author support to gannotate and log viewer
332
        self.table.attach(align, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
333
        align.show()
334
        self.committer.show()
335
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
336
        align = gtk.Alignment(0.0, 0.5)
337
        label = gtk.Label()
338
        label.set_markup("<b>Branch nick:</b>")
339
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
340
        self.table.attach(align, 0, 1, 3, 4, gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
341
        label.show()
342
        align.show()
343
344
        align = gtk.Alignment(0.0, 0.5)
345
        self.branchnick_label = gtk.Label()
346
        self.branchnick_label.set_selectable(True)
347
        align.add(self.branchnick_label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
348
        self.table.attach(align, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
349
        self.branchnick_label.show()
350
        align.show()
351
0.1.1 by Dan Loda
First working version of xannotate.
352
        align = gtk.Alignment(1.0, 0.5)
353
        label = gtk.Label()
354
        label.set_markup("<b>Timestamp:</b>")
355
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
356
        self.table.attach(align, 0, 1, 4, 5, gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
357
        align.show()
358
        label.show()
359
360
        align = gtk.Alignment(0.0, 0.5)
361
        self.timestamp = gtk.Label()
362
        self.timestamp.set_selectable(True)
363
        align.add(self.timestamp)
259 by Aaron Bentley
Add author support to gannotate and log viewer
364
        self.table.attach(align, 1, 2, 4, 5, gtk.EXPAND | gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
365
        align.show()
366
        self.timestamp.show()
367
241 by Jelmer Vernooij
Show tags in bzr viz.
368
        align = gtk.Alignment(1.0, 0.5)
369
        self.tags_label = gtk.Label()
370
        self.tags_label.set_markup("<b>Tags:</b>")
371
        align.add(self.tags_label)
372
        align.show()
261 by Aaron Bentley
Fix tags formatting
373
        self.table.attach(align, 0, 1, 5, 6, gtk.FILL, gtk.FILL)
241 by Jelmer Vernooij
Show tags in bzr viz.
374
        self.tags_label.show()
375
376
        align = gtk.Alignment(0.0, 0.5)
377
        self.tags_list = gtk.VBox()
378
        align.add(self.tags_list)
261 by Aaron Bentley
Fix tags formatting
379
        self.table.attach(align, 1, 2, 5, 6, gtk.EXPAND | gtk.FILL, gtk.FILL)
241 by Jelmer Vernooij
Show tags in bzr viz.
380
        align.show()
381
        self.tags_list.show()
382
        self.tags_widgets = []
383
412.1.4 by Daniel Schierbeck
Made tag list smarter.
384
        self.connect('notify::revision', self._add_tags)
385
0.1.1 by Dan Loda
First working version of xannotate.
386
        return self.table
387
256.2.23 by Gary van der Merwe
Show Children
388
    
291 by Jelmer Vernooij
Put children widget on a new line.
389
    def _create_parents(self):
390
        hbox = gtk.HBox(True, 3)
256.2.23 by Gary van der Merwe
Show Children
391
        
392
        self.parents_table = self._create_parents_or_children_table(
393
            "<b>Parents:</b>")
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
394
        self.parents_widgets = []
256.2.23 by Gary van der Merwe
Show Children
395
        hbox.pack_start(self.parents_table)
291 by Jelmer Vernooij
Put children widget on a new line.
396
397
        hbox.show()
398
        return hbox
399
400
    def _create_children(self):
401
        hbox = gtk.HBox(True, 3)
402
        self.children_table = self._create_parents_or_children_table(
403
            "<b>Children:</b>")
404
        self.children_widgets = []
405
        hbox.pack_start(self.children_table)
256.2.23 by Gary van der Merwe
Show Children
406
        hbox.show()
407
        return hbox
408
        
409
    def _create_parents_or_children_table(self, text):
410
        table = gtk.Table(rows=1, columns=2)
411
        table.set_row_spacings(3)
412
        table.set_col_spacings(6)
413
        table.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
414
415
        label = gtk.Label()
256.2.23 by Gary van der Merwe
Show Children
416
        label.set_markup(text)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
417
        align = gtk.Alignment(0.0, 0.5)
418
        align.add(label)
256.2.23 by Gary van der Merwe
Show Children
419
        table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
420
        label.show()
421
        align.show()
422
256.2.23 by Gary van der Merwe
Show Children
423
        return table
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
424
0.1.1 by Dan Loda
First working version of xannotate.
425
    def _create_message_view(self):
412.1.6 by Daniel Schierbeck
Made the message buffer use signals when updating.
426
        msg_buffer = gtk.TextBuffer()
427
        self.connect('notify::revision',
428
                lambda w, p: msg_buffer.set_text(self._revision.message))
324.2.2 by Daniel Schierbeck
Surrounded the commit message textview with a scrolled window and added a shadow.
429
        window = gtk.ScrolledWindow()
430
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
431
        window.set_shadow_type(gtk.SHADOW_IN)
412.1.6 by Daniel Schierbeck
Made the message buffer use signals when updating.
432
        tv = gtk.TextView(msg_buffer)
0.1.1 by Dan Loda
First working version of xannotate.
433
        tv.set_editable(False)
434
        tv.set_wrap_mode(gtk.WRAP_WORD)
435
        tv.modify_font(pango.FontDescription("Monospace"))
436
        tv.show()
324.2.2 by Daniel Schierbeck
Surrounded the commit message textview with a scrolled window and added a shadow.
437
        window.add(tv)
438
        window.show()
439
        return window
0.1.1 by Dan Loda
First working version of xannotate.
440
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
441
    def _create_file_info_view(self):
278.1.45 by John Arbash Meinel
Switch to a new tab for per-file messages.
442
        self.file_info_box = gtk.VBox(False, 6)
443
        self.file_info_box.set_border_width(6)
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
444
        self.file_info_buffer = gtk.TextBuffer()
278.1.44 by John Arbash Meinel
Merge in trunk, and update logview per-file commit messages.
445
        window = gtk.ScrolledWindow()
446
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
447
        window.set_shadow_type(gtk.SHADOW_IN)
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
448
        tv = gtk.TextView(self.file_info_buffer)
449
        tv.set_editable(False)
450
        tv.set_wrap_mode(gtk.WRAP_WORD)
451
        tv.modify_font(pango.FontDescription("Monospace"))
452
        tv.show()
278.1.44 by John Arbash Meinel
Merge in trunk, and update logview per-file commit messages.
453
        window.add(tv)
454
        window.show()
455
        self.file_info_box.pack_start(window)
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
456
        self.file_info_box.hide() # Only shown when there are per-file messages
278.1.45 by John Arbash Meinel
Switch to a new tab for per-file messages.
457
        self.append_page(self.file_info_box, tab_label=gtk.Label('Per-file'))
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
458