Rev 152: Cleanup some more code. in file:///home/jelmer/bzr-gtk/trunk/
Jelmer Vernooij
jelmer at samba.org
Sat Feb 3 14:19:37 GMT 2007
At file:///home/jelmer/bzr-gtk/trunk/
------------------------------------------------------------
revno: 152
revision-id: jelmer at samba.org-20070203141920-cnhba99657gb78ay
parent: jelmer at samba.org-20070203141857-9xxd3uvju5oo1p8z
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2007-02-03 15:19:20 +0100
message:
Cleanup some more code.
removed:
viz/bzrkapp.py bzrkapp.py-20051017001327-f638ae3a8eab3a9f
modified:
__init__.py __init__.py-20060519165329-a1fd52c8a829fcd5
viz/branchwin.py branchwin.py-20051016222514-15fd120652fcf25c
=== removed file 'viz/bzrkapp.py'
--- a/viz/bzrkapp.py 2007-02-03 13:01:12 +0000
+++ b/viz/bzrkapp.py 1970-01-01 00:00:00 +0000
@@ -1,55 +0,0 @@
-# -*- coding: UTF-8 -*-
-"""Application object.
-
-This module contains the application object that manages the windows
-on screen, and can be used to create new windows of various types.
-"""
-
-__copyright__ = "Copyright © 2005 Canonical Ltd."
-__author__ = "Scott James Remnant <scott at ubuntu.com>"
-
-
-import pygtk
-pygtk.require("2.0")
-
-import gtk
-
-from branchwin import BranchWindow
-from bzrlib.plugins.gtk.diff import DiffWindow
-
-
-class BzrkApp(object):
- """Application manager.
-
- This object manages the bzrk application, creating and managing
- individual branch windows and ensuring the application exits when
- the last window is closed.
- """
-
- def show(self, branch, start, maxnum):
- """Open a new window to show the given branch."""
- window = BranchWindow(self)
- window.set_branch(branch, start, maxnum)
- window.connect("destroy", self._destroy_cb)
- window.show()
-
- def show_diff(self, branch, revid, parentid):
- """Open a new window to show a diff between the given revisions."""
- window = DiffWindow()
- rev_tree = branch.repository.revision_tree(revid)
- parent_tree = branch.repository.revision_tree(parentid)
- description = revid + " - " + branch.nick
- window.set_diff(description, rev_tree, parent_tree)
- window.show()
-
- def _destroy_cb(self, widget):
- """Callback for when a window we manage is destroyed."""
- self.quit()
-
- def main(self):
- """Start the GTK+ main loop."""
- gtk.main()
-
- def quit(self):
- """Stop the GTK+ main loop."""
- gtk.main_quit()
=== modified file '__init__.py'
--- a/__init__.py 2007-02-03 13:01:12 +0000
+++ b/__init__.py 2007-02-03 14:19:20 +0000
@@ -176,10 +176,10 @@
tree1 = wt
tree2 = tree1.basis_tree()
- from viz.diff import DiffWindow
+ from diff import DiffWindow
import gtk
window = DiffWindow()
- window.connect("destroy", lambda w: gtk.main_quit())
+ window.connect("destroy", gtk.main_quit)
window.set_diff("Working Tree", tree1, tree2)
if filename is not None:
tree_filename = wt.relpath(filename)
@@ -226,14 +226,17 @@
else:
(revno, revid) = revision[0].in_history(branch)
- from viz.bzrkapp import BzrkApp
+ from viz.branchwin import BranchWindow
+ import gtk
- app = BzrkApp()
- app.show(branch, revid, limit)
+ pp = BranchWindow()
+ pp.set_branch(branch, revid, limit)
+ pp.connect("destroy", lambda w: gtk.main_quit())
+ pp.show()
+ gtk.main()
finally:
branch.repository.unlock()
branch.unlock()
- app.main()
register_command(cmd_visualise)
@@ -357,6 +360,9 @@
register_command(cmd_gcommit)
+import gettext
+gettext.install('olive-gtk')
+
class NoDisplayError(BzrCommandError):
"""gtk could not find a proper display"""
=== modified file 'viz/branchwin.py'
--- a/viz/branchwin.py 2007-02-03 12:35:55 +0000
+++ b/viz/branchwin.py 2007-02-03 14:19:20 +0000
@@ -26,13 +26,11 @@
for a particular branch.
"""
- def __init__(self, app=None):
+ def __init__(self):
gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
self.set_border_width(0)
self.set_title("bzrk")
- self.app = app
-
# Use three-quarters of the screen by default
screen = self.get_screen()
monitor = screen.get_monitor_geometry(0)
@@ -246,10 +244,19 @@
self.treeview.set_cursor(self.index[self.revisions[revid]])
self.treeview.grab_focus()
+ def show_diff(self, branch, revid, parentid):
+ """Open a new window to show a diff between the given revisions."""
+ from bzrlib.plugins.gtk.diff import DiffWindow
+ window = DiffWindow()
+ rev_tree = branch.repository.revision_tree(revid)
+ parent_tree = branch.repository.revision_tree(parentid)
+ description = revid + " - " + branch.nick
+ window.set_diff(description, rev_tree, parent_tree)
+ window.show()
+
def _show_clicked_cb(self, revid, parentid):
"""Callback for when the show button for a parent is clicked."""
- if self.app is not None:
- self.app.show_diff(self.branch, revid, parentid)
+ self.show_diff(self.branch, revid, parentid)
self.treeview.grab_focus()
def _treeview_row_activated_cb(self, widget, path, col):
@@ -260,6 +267,5 @@
# Ignore revisions without parent
return
parent_id = self.parent_ids[revision][0]
- if self.app is not None:
- self.app.show_diff(self.branch, revision.revision_id, parent_id)
+ self.show_diff(self.branch, revision.revision_id, parent_id)
self.treeview.grab_focus()
More information about the bazaar-commits
mailing list