261
261
self.buffer.set_text(decoded.encode('UTF-8'))
264
class DiffWidget(gtk.HPaned):
264
class DiffWindow(Window):
267
This object represents and manages a single window containing the
268
differences between two revisions on a branch.
269
super(DiffWidget, self).__init__()
271
def __init__(self, parent=None):
272
Window.__init__(self, parent)
273
self.set_border_width(0)
274
self.set_title("bzrk diff")
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)
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.
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)
278
301
self.model = gtk.TreeStore(str, str)
293
316
# The diffs of the selected file: a scrollable source or
295
318
self.diff_view = DiffView()
296
self.pack2(self.diff_view)
319
pane.pack2(self.diff_view)
297
320
self.diff_view.show()
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.
302
325
Compares the two trees and populates the window with the
333
356
self.model.append(titer, [ path, path ])
335
358
self.treeview.expand_all()
359
self.set_title(description + " - bzrk diff")
337
361
def set_file(self, file_path):
358
382
self.diff_view.show_diff(specific_files)
361
class DiffWindow(Window):
364
This object represents and manages a single window containing the
365
differences between two revisions on a branch.
368
def __init__(self, parent=None):
369
Window.__init__(self, parent)
370
self.set_border_width(0)
371
self.set_title("bzrk diff")
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)
383
"""Construct the window contents."""
384
self.diff = DiffWidget()
388
def set_diff(self, description, rev_tree, parent_tree):
389
"""Set the differences showed by this window.
391
Compares the two trees and populates the window with the
394
self.diff.set_diff(rev_tree, parent_tree)
395
self.set_title(description + " - bzrk diff")
397
def set_file(self, file_path):
398
self.diff.set_file(file_path)
401
385
def _iter_changes_to_status(source, target):
402
386
"""Determine the differences between trees.