Rev 581: Add gloom command. in file:///data/jelmer/bzr-gtk/trunk/

Jelmer Vernooij jelmer at samba.org
Thu Jul 31 00:52:07 BST 2008


At file:///data/jelmer/bzr-gtk/trunk/

------------------------------------------------------------
revno: 581
revision-id: jelmer at samba.org-20080730235206-4stv1rmgw5ey0ttw
parent: jelmer at samba.org-20080727132554-l5lg7qoskksnr3lq
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2008-07-31 01:52:06 +0200
message:
  Add gloom command.
added:
  loom.py                        loom.py-20080730235158-elzoq27ll0eh6401-1
modified:
  __init__.py                    __init__.py-20060519165329-a1fd52c8a829fcd5
=== modified file '__init__.py'
--- a/__init__.py	2008-07-25 22:29:51 +0000
+++ b/__init__.py	2008-07-30 23:52:06 +0000
@@ -22,6 +22,7 @@
 gconflicts        GTK+ conflicts. 
 gdiff             Show differences in working tree in a GTK+ Window. 
 ginit             Initialise a new branch.
+gloom             GTK+ loom browse dialog
 gmerge            GTK+ merge dialog
 gmissing          GTK+ missing revisions dialog. 
 gpreferences      GTK+ preferences dialog. 
@@ -172,11 +173,24 @@
     def run(self, location="."):
         (br, path) = branch.Branch.open_containing(location)
         open_display()
-        from push import PushDialog
+        from bzrlib.plugins.gtk.push import PushDialog
         dialog = PushDialog(br.repository, br.last_revision(), br)
         dialog.run()
 
 
+class cmd_gloom(GTKCommand):
+    """ GTK+ loom.
+    
+    """
+    takes_args = [ "location?" ]
+
+    def run(self, location="."):
+        (br, path) = branch.Branch.open_containing(location)
+        open_display()
+        from bzrlib.plugins.gtk.loom import LoomDialog
+        dialog = LoomDialog(br)
+        dialog.run()
+
 
 class cmd_gdiff(GTKCommand):
     """Show differences in working tree in a GTK+ Window.
@@ -548,6 +562,9 @@
     cmd_visualise
     ]
 
+if getattr(bzrlib.plugins, "loom", None) is not None:
+    commands.append(cmd_gloom)
+
 for cmd in commands:
     register_command(cmd)
 

=== added file 'loom.py'
--- a/loom.py	1970-01-01 00:00:00 +0000
+++ b/loom.py	2008-07-30 23:52:06 +0000
@@ -0,0 +1,62 @@
+# Copyright (C) 2008 Jelmer Vernooij <jelmer at samba.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+try:
+    import pygtk
+    pygtk.require("2.0")
+except:
+    pass
+
+import gtk
+import gobject
+
+from bzrlib.plugins.gtk import _i18n
+from bzrlib.plugins.gtk.dialog import question_dialog
+from bzrlib.plugins.loom import branch as loom_branch
+
+class LoomDialog(gtk.Dialog):
+    """Simple Loom browse dialog."""
+
+    def __init__(self, branch, parent=None):
+        gtk.Dialog.__init__(self, title="Threads",
+                                  parent=parent,
+                                  flags=0,
+                                  buttons=(gtk.STOCK_CLOSE,gtk.RESPONSE_OK))
+        self.branch = branch
+
+        self._construct()
+
+    def run(self):
+        try:
+            loom_branch.require_loom_branch(self.branch)
+        except loom_branch.NotALoom:
+            response = question_dialog(
+                _i18n("Upgrade to Loom branch?"),
+                _i18n("Branch is not a loom branch. Upgrade to Loom format?"),
+                parent=self)
+                # Doesn't set a parent for the dialog..
+            if response == gtk.RESPONSE_NO:
+                return
+            loom_branch.loomify(self.branch)
+        return super(LoomDialog, self).run()
+
+    def _construct(self):
+        self._threads_view = gtk.TreeView()
+        self._threads_view.show()
+        self.vbox.pack_start(self._threads_view)
+
+        # Buttons: combine-thread, export-loom, revert-loom, up-thread
+




More information about the bazaar-commits mailing list