261
261
self.buffer.set_text(decoded.encode('UTF-8'))
264
class DiffWindow(Window):
264
class DiffWidget(gtk.HPaned):
267
This object represents and manages a single window containing the
268
differences between two revisions on a branch.
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.
269
super(DiffWidget, self).__init__()
294
271
# The file hierarchy: a scrollable treeview
295
272
scrollwin = gtk.ScrolledWindow()
296
273
scrollwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
297
274
scrollwin.set_shadow_type(gtk.SHADOW_IN)
298
pane.pack1(scrollwin)
275
self.pack1(scrollwin)
301
278
self.model = gtk.TreeStore(str, str)
316
293
# The diffs of the selected file: a scrollable source or
318
295
self.diff_view = DiffView()
319
pane.pack2(self.diff_view)
296
self.pack2(self.diff_view)
320
297
self.diff_view.show()
322
def set_diff(self, description, rev_tree, parent_tree):
299
def set_diff(self, rev_tree, parent_tree):
323
300
"""Set the differences showed by this window.
325
302
Compares the two trees and populates the window with the
356
333
self.model.append(titer, [ path, path ])
358
335
self.treeview.expand_all()
359
self.set_title(description + " - bzrk diff")
361
337
def set_file(self, file_path):
382
358
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)
385
401
def _iter_changes_to_status(source, target):
386
402
"""Determine the differences between trees.