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