/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
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
25
from bzrlib.util import bencode
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
49
        'file-id': (
50
            gobject.TYPE_PYOBJECT,
51
            'File Id',
52
            'The file id',
53
            gobject.PARAM_READWRITE
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
54
        )
55
    }
56
57
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
58
    def __init__(self, branch=None):
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
59
        gtk.Notebook.__init__(self)
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
60
        self.show_children = False
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
61
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
62
        self._create_general()
63
        self._create_relations()
278.1.45 by John Arbash Meinel
Switch to a new tab for per-file messages.
64
        self._create_file_info_view()
324.2.9 by Daniel Schierbeck
Made 'General' the default page of the logview.
65
66
        self.set_current_page(0)
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
67
        
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
68
        self._show_callback = None
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.
69
        self._go_callback = None
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
70
        self._clicked_callback = None
0.1.1 by Dan Loda
First working version of xannotate.
71
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
72
        self._branch = branch
73
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
74
        if self._branch.supports_tags():
75
            self._tagdict = self._branch.tags.get_reverse_tag_dict()
412.1.3 by Daniel Schierbeck
Fixed problem with branches that do not support tags.
76
        else:
77
            self._tagdict = {}
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
78
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
79
        self.set_file_id(None)
0.1.1 by Dan Loda
First working version of xannotate.
80
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
81
    def do_get_property(self, property):
82
        if property.name == 'branch':
83
            return self._branch
84
        elif property.name == 'revision':
85
            return self._revision
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
86
        elif property.name == 'file-id':
87
            return self._file_id
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
88
        else:
89
            raise AttributeError, 'unknown property %s' % property.name
90
91
    def do_set_property(self, property, value):
92
        if property.name == 'branch':
93
            self._branch = value
94
        elif property.name == 'revision':
95
            self._set_revision(value)
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
96
        elif property.name == 'file-id':
97
            self._file_id = value
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
98
        else:
99
            raise AttributeError, 'unknown property %s' % property.name
100
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
101
    def set_show_callback(self, callback):
102
        self._show_callback = callback
103
104
    def set_go_callback(self, callback):
105
        self._go_callback = callback
106
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
107
    def set_file_id(self, file_id):
108
        """Set a specific file id that we want to track.
109
110
        This just effects the display of a per-file commit message.
111
        If it is set to None, then all commit messages will be shown.
112
        """
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
113
        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.
114
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
115
    def set_revision(self, revision, children=[]):
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
116
        self.set_property('revision', revision)
117
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
118
    def _set_revision(self, revision, children=[]):
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
119
        if revision is None: return
120
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
121
        self._revision = revision
192 by Jelmer Vernooij
Allow committer to be None.
122
        if revision.committer is not None:
123
            self.committer.set_text(revision.committer)
124
        else:
125
            self.committer.set_text("")
259 by Aaron Bentley
Add author support to gannotate and log viewer
126
        author = revision.properties.get('author', '')
127
        if author != '':
128
            self.author.set_text(author)
129
            self.author.show()
130
            self.author_label.show()
131
        else:
132
            self.author.hide()
133
            self.author_label.hide()
134
197 by Jelmer Vernooij
Fix some warnings when displaying ghost revisions. Reported by John.
135
        if revision.timestamp is not None:
136
            self.timestamp.set_text(format_date(revision.timestamp,
137
                                                revision.timezone))
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
138
        try:
139
            self.branchnick_label.set_text(revision.properties['branch-nick'])
140
        except KeyError:
141
            self.branchnick_label.set_text("")
142
256.2.23 by Gary van der Merwe
Show Children
143
        self._add_parents_or_children(revision.parent_ids,
144
                                      self.parents_widgets,
145
                                      self.parents_table)
146
        
147
        if self.show_children:
148
            self._add_parents_or_children(children,
149
                                          self.children_widgets,
150
                                          self.children_table)
151
        
324.2.10 by Daniel Schierbeck
Reduced overhead by only calculating diff when 'Changes' page is selected.
152
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
153
        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.
154
        if file_info is not None:
278.1.31 by John Arbash Meinel
We can make bencode work again by a simple decode/encode step.
155
            file_info = bencode.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.
156
157
        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.
158
            if self._file_id is None:
159
                text = []
160
                for fi in file_info:
161
                    text.append('%(path)s\n%(message)s' % fi)
162
                self.file_info_buffer.set_text('\n'.join(text))
163
                self.file_info_box.show()
164
            else:
165
                text = []
166
                for fi in file_info:
167
                    if fi['file_id'] == self._file_id:
168
                        text.append(fi['message'])
169
                if text:
170
                    self.file_info_buffer.set_text('\n'.join(text))
171
                    self.file_info_box.show()
172
                else:
173
                    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.
174
        else:
175
            self.file_info_box.hide()
176
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
177
    def _show_clicked_cb(self, widget, revid, parentid):
178
        """Callback for when the show button for a parent is clicked."""
179
        self._show_callback(revid, parentid)
180
181
    def _go_clicked_cb(self, widget, revid):
182
        """Callback for when the go button for a parent is clicked."""
183
        self._go_callback(revid)
184
412.1.4 by Daniel Schierbeck
Made tag list smarter.
185
    def _add_tags(self, *args):
186
        if self._tagdict.has_key(self._revision.revision_id):
187
            tags = self._tagdict[self._revision.revision_id]
188
        else:
189
            tags = []
190
            
241 by Jelmer Vernooij
Show tags in bzr viz.
191
        if tags == []:
192
            self.tags_list.hide()
193
            self.tags_label.hide()
194
            return
195
196
        for widget in self.tags_widgets:
197
            self.tags_list.remove(widget)
198
242 by Jelmer Vernooij
Avoid cleanup warning.
199
        self.tags_widgets = []
200
241 by Jelmer Vernooij
Show tags in bzr viz.
201
        for tag in tags:
202
            widget = gtk.Label(tag)
203
            widget.set_selectable(True)
204
            self.tags_widgets.append(widget)
205
            self.tags_list.add(widget)
206
        self.tags_list.show_all()
207
        self.tags_label.show_all()
208
        
256.2.23 by Gary van der Merwe
Show Children
209
    def _add_parents_or_children(self, revids, widgets, table):
210
        while len(widgets) > 0:
211
            widget = widgets.pop()
212
            table.remove(widget)
213
        
214
        table.resize(max(len(revids), 1), 2)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
215
256.2.23 by Gary van der Merwe
Show Children
216
        for idx, revid in enumerate(revids):
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
217
            align = gtk.Alignment(0.0, 0.0)
256.2.23 by Gary van der Merwe
Show Children
218
            widgets.append(align)
219
            table.attach(align, 1, 2, idx, idx + 1,
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
220
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
221
            align.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
222
223
            hbox = gtk.HBox(False, spacing=6)
224
            align.add(hbox)
225
            hbox.show()
226
227
            image = gtk.Image()
228
            image.set_from_stock(
229
                gtk.STOCK_FIND, gtk.ICON_SIZE_SMALL_TOOLBAR)
230
            image.show()
231
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.
232
            if self._show_callback is not None:
233
                button = gtk.Button()
234
                button.add(image)
235
                button.connect("clicked", self._show_clicked_cb,
256.2.23 by Gary van der Merwe
Show Children
236
                               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.
237
                hbox.pack_start(button, expand=False, fill=True)
238
                button.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
239
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.
240
            if self._go_callback is not None:
256.2.23 by Gary van der Merwe
Show Children
241
                button = gtk.Button(revid)
242
                button.connect("clicked", self._go_clicked_cb, 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.
243
            else:
256.2.23 by Gary van der Merwe
Show Children
244
                button = gtk.Label(revid)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
245
            button.set_use_underline(False)
246
            hbox.pack_start(button, expand=False, fill=True)
247
            button.show()
0.1.1 by Dan Loda
First working version of xannotate.
248
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
249
    def _create_general(self):
0.1.1 by Dan Loda
First working version of xannotate.
250
        vbox = gtk.VBox(False, 6)
251
        vbox.set_border_width(6)
252
        vbox.pack_start(self._create_headers(), expand=False, fill=True)
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
253
        vbox.pack_start(self._create_message_view())
254
        self.append_page(vbox, tab_label=gtk.Label("General"))
255
        vbox.show()
256
257
    def _create_relations(self):
258
        vbox = gtk.VBox(False, 6)
259
        vbox.set_border_width(6)
291 by Jelmer Vernooij
Put children widget on a new line.
260
        vbox.pack_start(self._create_parents(), expand=False, fill=True)
261
        if self.show_children:
262
            vbox.pack_start(self._create_children(), expand=False, fill=True)
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
263
        self.append_page(vbox, tab_label=gtk.Label("Relations"))
0.1.1 by Dan Loda
First working version of xannotate.
264
        vbox.show()
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
265
0.1.1 by Dan Loda
First working version of xannotate.
266
    def _create_headers(self):
241 by Jelmer Vernooij
Show tags in bzr viz.
267
        self.table = gtk.Table(rows=5, columns=2)
0.1.1 by Dan Loda
First working version of xannotate.
268
        self.table.set_row_spacings(6)
269
        self.table.set_col_spacings(6)
270
        self.table.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
271
272
        align = gtk.Alignment(1.0, 0.5)
273
        label = gtk.Label()
274
        label.set_markup("<b>Revision Id:</b>")
275
        align.add(label)
276
        self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
277
        align.show()
278
        label.show()
279
280
        align = gtk.Alignment(0.0, 0.5)
412.1.5 by Daniel Schierbeck
Made the revision id label use signals when updating.
281
        revision_id = gtk.Label()
282
        revision_id.set_selectable(True)
283
        self.connect('notify::revision', 
284
                lambda w, p: revision_id.set_text(self._revision.revision_id))
285
        align.add(revision_id)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
286
        self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
287
        align.show()
412.1.5 by Daniel Schierbeck
Made the revision id label use signals when updating.
288
        revision_id.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
289
0.1.1 by Dan Loda
First working version of xannotate.
290
        align = gtk.Alignment(1.0, 0.5)
259 by Aaron Bentley
Add author support to gannotate and log viewer
291
        self.author_label = gtk.Label()
292
        self.author_label.set_markup("<b>Author:</b>")
293
        align.add(self.author_label)
294
        self.table.attach(align, 0, 1, 1, 2, gtk.FILL, gtk.FILL)
295
        align.show()
296
        self.author_label.show()
297
298
        align = gtk.Alignment(0.0, 0.5)
299
        self.author = gtk.Label()
300
        self.author.set_selectable(True)
301
        align.add(self.author)
302
        self.table.attach(align, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
303
        align.show()
304
        self.author.show()
305
        self.author.hide()
306
307
        align = gtk.Alignment(1.0, 0.5)
0.1.1 by Dan Loda
First working version of xannotate.
308
        label = gtk.Label()
309
        label.set_markup("<b>Committer:</b>")
310
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
311
        self.table.attach(align, 0, 1, 2, 3, gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
312
        align.show()
313
        label.show()
314
315
        align = gtk.Alignment(0.0, 0.5)
316
        self.committer = gtk.Label()
317
        self.committer.set_selectable(True)
318
        align.add(self.committer)
259 by Aaron Bentley
Add author support to gannotate and log viewer
319
        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.
320
        align.show()
321
        self.committer.show()
322
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
323
        align = gtk.Alignment(0.0, 0.5)
324
        label = gtk.Label()
325
        label.set_markup("<b>Branch nick:</b>")
326
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
327
        self.table.attach(align, 0, 1, 3, 4, gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
328
        label.show()
329
        align.show()
330
331
        align = gtk.Alignment(0.0, 0.5)
332
        self.branchnick_label = gtk.Label()
333
        self.branchnick_label.set_selectable(True)
334
        align.add(self.branchnick_label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
335
        self.table.attach(align, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
336
        self.branchnick_label.show()
337
        align.show()
338
0.1.1 by Dan Loda
First working version of xannotate.
339
        align = gtk.Alignment(1.0, 0.5)
340
        label = gtk.Label()
341
        label.set_markup("<b>Timestamp:</b>")
342
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
343
        self.table.attach(align, 0, 1, 4, 5, gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
344
        align.show()
345
        label.show()
346
347
        align = gtk.Alignment(0.0, 0.5)
348
        self.timestamp = gtk.Label()
349
        self.timestamp.set_selectable(True)
350
        align.add(self.timestamp)
259 by Aaron Bentley
Add author support to gannotate and log viewer
351
        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.
352
        align.show()
353
        self.timestamp.show()
354
241 by Jelmer Vernooij
Show tags in bzr viz.
355
        align = gtk.Alignment(1.0, 0.5)
356
        self.tags_label = gtk.Label()
357
        self.tags_label.set_markup("<b>Tags:</b>")
358
        align.add(self.tags_label)
359
        align.show()
261 by Aaron Bentley
Fix tags formatting
360
        self.table.attach(align, 0, 1, 5, 6, gtk.FILL, gtk.FILL)
241 by Jelmer Vernooij
Show tags in bzr viz.
361
        self.tags_label.show()
362
363
        align = gtk.Alignment(0.0, 0.5)
364
        self.tags_list = gtk.VBox()
365
        align.add(self.tags_list)
261 by Aaron Bentley
Fix tags formatting
366
        self.table.attach(align, 1, 2, 5, 6, gtk.EXPAND | gtk.FILL, gtk.FILL)
241 by Jelmer Vernooij
Show tags in bzr viz.
367
        align.show()
368
        self.tags_list.show()
369
        self.tags_widgets = []
370
412.1.4 by Daniel Schierbeck
Made tag list smarter.
371
        self.connect('notify::revision', self._add_tags)
372
0.1.1 by Dan Loda
First working version of xannotate.
373
        return self.table
374
256.2.23 by Gary van der Merwe
Show Children
375
    
291 by Jelmer Vernooij
Put children widget on a new line.
376
    def _create_parents(self):
377
        hbox = gtk.HBox(True, 3)
256.2.23 by Gary van der Merwe
Show Children
378
        
379
        self.parents_table = self._create_parents_or_children_table(
380
            "<b>Parents:</b>")
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
381
        self.parents_widgets = []
256.2.23 by Gary van der Merwe
Show Children
382
        hbox.pack_start(self.parents_table)
291 by Jelmer Vernooij
Put children widget on a new line.
383
384
        hbox.show()
385
        return hbox
386
387
    def _create_children(self):
388
        hbox = gtk.HBox(True, 3)
389
        self.children_table = self._create_parents_or_children_table(
390
            "<b>Children:</b>")
391
        self.children_widgets = []
392
        hbox.pack_start(self.children_table)
256.2.23 by Gary van der Merwe
Show Children
393
        hbox.show()
394
        return hbox
395
        
396
    def _create_parents_or_children_table(self, text):
397
        table = gtk.Table(rows=1, columns=2)
398
        table.set_row_spacings(3)
399
        table.set_col_spacings(6)
400
        table.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
401
402
        label = gtk.Label()
256.2.23 by Gary van der Merwe
Show Children
403
        label.set_markup(text)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
404
        align = gtk.Alignment(0.0, 0.5)
405
        align.add(label)
256.2.23 by Gary van der Merwe
Show Children
406
        table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
407
        label.show()
408
        align.show()
409
256.2.23 by Gary van der Merwe
Show Children
410
        return table
411
    
412
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
413
0.1.1 by Dan Loda
First working version of xannotate.
414
    def _create_message_view(self):
412.1.6 by Daniel Schierbeck
Made the message buffer use signals when updating.
415
        msg_buffer = gtk.TextBuffer()
416
        self.connect('notify::revision',
417
                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.
418
        window = gtk.ScrolledWindow()
419
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
420
        window.set_shadow_type(gtk.SHADOW_IN)
412.1.6 by Daniel Schierbeck
Made the message buffer use signals when updating.
421
        tv = gtk.TextView(msg_buffer)
0.1.1 by Dan Loda
First working version of xannotate.
422
        tv.set_editable(False)
423
        tv.set_wrap_mode(gtk.WRAP_WORD)
424
        tv.modify_font(pango.FontDescription("Monospace"))
425
        tv.show()
324.2.2 by Daniel Schierbeck
Surrounded the commit message textview with a scrolled window and added a shadow.
426
        window.add(tv)
427
        window.show()
428
        return window
0.1.1 by Dan Loda
First working version of xannotate.
429
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
430
    def _create_file_info_view(self):
278.1.45 by John Arbash Meinel
Switch to a new tab for per-file messages.
431
        self.file_info_box = gtk.VBox(False, 6)
432
        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.
433
        self.file_info_buffer = gtk.TextBuffer()
278.1.44 by John Arbash Meinel
Merge in trunk, and update logview per-file commit messages.
434
        window = gtk.ScrolledWindow()
435
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
436
        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.
437
        tv = gtk.TextView(self.file_info_buffer)
438
        tv.set_editable(False)
439
        tv.set_wrap_mode(gtk.WRAP_WORD)
440
        tv.modify_font(pango.FontDescription("Monospace"))
441
        tv.show()
278.1.44 by John Arbash Meinel
Merge in trunk, and update logview per-file commit messages.
442
        window.add(tv)
443
        window.show()
444
        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.
445
        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.
446
        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.
447