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