/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to diff.py

  • Committer: Daniel Schierbeck
  • Date: 2008-01-23 16:36:21 UTC
  • mto: (423.1.8 trunk)
  • mto: This revision was merged to the branch mainline in revision 429.
  • Revision ID: daniel.schierbeck@gmail.com-20080123163621-x8kublc38ojipnly
Made the revision popup menu correctly add tags.

Show diffs side-by-side

added added

removed removed

Lines of Context:
261
261
        self.buffer.set_text(decoded.encode('UTF-8'))
262
262
 
263
263
 
264
 
class DiffWidget(gtk.HPaned):
265
 
    """Diff widget
 
264
class DiffWindow(Window):
 
265
    """Diff window.
266
266
 
 
267
    This object represents and manages a single window containing the
 
268
    differences between two revisions on a branch.
267
269
    """
268
 
    def __init__(self):
269
 
        super(DiffWidget, self).__init__()
 
270
 
 
271
    def __init__(self, parent=None):
 
272
        Window.__init__(self, parent)
 
273
        self.set_border_width(0)
 
274
        self.set_title("bzrk diff")
 
275
 
 
276
        # Use two thirds of the screen by default
 
277
        screen = self.get_screen()
 
278
        monitor = screen.get_monitor_geometry(0)
 
279
        width = int(monitor.width * 0.66)
 
280
        height = int(monitor.height * 0.66)
 
281
        self.set_default_size(width, height)
 
282
 
 
283
        self.construct()
 
284
 
 
285
    def construct(self):
 
286
        """Construct the window contents."""
 
287
        # The   window  consists  of   a  pane   containing:  the
 
288
        # hierarchical list  of files on  the left, and  the diff
 
289
        # for the currently selected file on the right.
 
290
        pane = gtk.HPaned()
 
291
        self.add(pane)
 
292
        pane.show()
270
293
 
271
294
        # The file hierarchy: a scrollable treeview
272
295
        scrollwin = gtk.ScrolledWindow()
273
296
        scrollwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
274
297
        scrollwin.set_shadow_type(gtk.SHADOW_IN)
275
 
        self.pack1(scrollwin)
 
298
        pane.pack1(scrollwin)
276
299
        scrollwin.show()
277
300
 
278
301
        self.model = gtk.TreeStore(str, str)
293
316
        # The diffs of the  selected file: a scrollable source or
294
317
        # text view
295
318
        self.diff_view = DiffView()
296
 
        self.pack2(self.diff_view)
 
319
        pane.pack2(self.diff_view)
297
320
        self.diff_view.show()
298
321
 
299
 
    def set_diff(self, rev_tree, parent_tree):
 
322
    def set_diff(self, description, rev_tree, parent_tree):
300
323
        """Set the differences showed by this window.
301
324
 
302
325
        Compares the two trees and populates the window with the
333
356
                self.model.append(titer, [ path, path ])
334
357
 
335
358
        self.treeview.expand_all()
 
359
        self.set_title(description + " - bzrk diff")
336
360
 
337
361
    def set_file(self, file_path):
338
362
        tv_path = None
358
382
        self.diff_view.show_diff(specific_files)
359
383
 
360
384
 
361
 
class DiffWindow(Window):
362
 
    """Diff window.
363
 
 
364
 
    This object represents and manages a single window containing the
365
 
    differences between two revisions on a branch.
366
 
    """
367
 
 
368
 
    def __init__(self, parent=None):
369
 
        Window.__init__(self, parent)
370
 
        self.set_border_width(0)
371
 
        self.set_title("bzrk diff")
372
 
 
373
 
        # Use two thirds of the screen by default
374
 
        screen = self.get_screen()
375
 
        monitor = screen.get_monitor_geometry(0)
376
 
        width = int(monitor.width * 0.66)
377
 
        height = int(monitor.height * 0.66)
378
 
        self.set_default_size(width, height)
379
 
 
380
 
        self.construct()
381
 
 
382
 
    def construct(self):
383
 
        """Construct the window contents."""
384
 
        self.diff = DiffWidget()
385
 
        self.add(self.diff)
386
 
        self.diff.show_all()
387
 
 
388
 
    def set_diff(self, description, rev_tree, parent_tree):
389
 
        """Set the differences showed by this window.
390
 
 
391
 
        Compares the two trees and populates the window with the
392
 
        differences.
393
 
        """
394
 
        self.diff.set_diff(rev_tree, parent_tree)
395
 
        self.set_title(description + " - bzrk diff")
396
 
 
397
 
    def set_file(self, file_path):
398
 
        self.diff.set_file(file_path)
399
 
 
400
 
 
401
385
def _iter_changes_to_status(source, target):
402
386
    """Determine the differences between trees.
403
387