Rev 156: Move status to the top-level, remove its use of glade and allow double-clicking on entries to get at the diff for a file. in file:///home/jelmer/bzr-gtk/trunk/

Jelmer Vernooij jelmer at samba.org
Sat Feb 3 16:04:38 GMT 2007


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

------------------------------------------------------------
revno: 156
revision-id: jelmer at samba.org-20070203160323-b0yh0ks5ozxrpqm7
parent: jelmer at samba.org-20070203152448-65ovluij1jetb71l
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2007-02-03 17:03:23 +0100
message:
  Move status to the top-level, remove its use of glade and allow double-clicking on entries to get at the diff for a file.
renamed:
  olive/status.py => status.py status.py-20060803143043-mmdp58hu3hauy0xh-1
modified:
  olive/__init__.py              __init__.py-20060925014013-13wdvwl8vi8gfqi1-2
  status.py                      status.py-20060803143043-mmdp58hu3hauy0xh-1
=== renamed file 'olive/status.py' => 'status.py'
--- a/olive/status.py	2006-10-25 16:29:18 +0000
+++ b/status.py	2007-02-03 16:03:23 +0000
@@ -21,43 +21,44 @@
     pass
 
 import gtk
-import gtk.glade
-
-from guifiles import GLADEFILENAME
-
-
-class OliveStatus:
+
+class StatusDialog(gtk.MessageDialog):
     """ Display Status window and perform the needed actions. """
     def __init__(self, wt, wtpath):
         """ Initialize the Status window. """
-        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_status')
-        
-        # Get the Status window widget
-        self.window = self.glade.get_widget('window_status')
-        
+        super(StatusDialog, self).__init__(flags=gtk.DIALOG_MODAL, buttons=gtk.BUTTONS_OK)
+        self.set_title("Working tree changes")
+        self.set_image(gtk.Label("Working tree status"))
+        self._create()
         self.wt = wt
         self.wtpath = wtpath
-        
-        # Check if current location is a branch
-        file_id = self.wt.path2id(wtpath)
-
         # Set the old working tree
         self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
-        
-        # Dictionary for signal_autoconnect
-        dic = { "on_button_status_close_clicked": self.close }
-        
-        # Connect the signals to the handlers
-        self.glade.signal_autoconnect(dic)
-        
         # Generate status output
         self._generate_status()
 
+    def _create(self):
+        self.set_default_size(400, 300)
+        self.treeview = gtk.TreeView()
+        self.vbox.pack_start(self.treeview, True, True)
+        self.vbox.show_all()
+
+    def row_diff(self, tv, path, tvc):
+        file = self.model[path][1]
+        if file is None:
+            return
+        from bzrlib.plugins.gtk.diff import DiffWindow
+        window = DiffWindow()
+        window.set_diff("Working tree changes", self.old_tree, self.wt)
+        window.set_file(file)
+        window.show()
+
     def _generate_status(self):
         """ Generate 'bzr status' output. """
         self.model = gtk.TreeStore(str, str)
-        self.treeview = self.glade.get_widget('treeview_status')
+        self.treeview.set_headers_visible(False)
         self.treeview.set_model(self.model)
+        self.treeview.connect("row-activated", self.row_diff)
         
         cell = gtk.CellRendererText()
         cell.set_property("width-chars", 20)

=== modified file 'olive/__init__.py'
--- a/olive/__init__.py	2007-02-03 15:24:48 +0000
+++ b/olive/__init__.py	2007-02-03 16:03:23 +0000
@@ -326,8 +326,8 @@
     
     def on_menuitem_branch_status_activate(self, widget):
         """ Branch/Status... menu handler. """
-        from status import OliveStatus
-        status = OliveStatus(self.wt, self.wtpath)
+        from bzrlib.plugins.gtk.status import StatusDialog
+        status = StatusDialog(self.wt, self.wtpath)
         status.display()
     
     @show_bzr_error




More information about the bazaar-commits mailing list