hggtk/history: show progress bar when populating diff chunks
authorTK Soh <teekaysoh@yahoo.com>
Sat, 26 Apr 2008 09:47:01 +0100
changeset 1147 e2b03522d571
parent 1146 4c5a64b79885
child 1148 e30153694940
hggtk/history: show progress bar when populating diff chunks
hggtk/changeset.py
hggtk/history.py
--- a/hggtk/changeset.py	Sat Apr 26 08:26:54 2008 +0100
+++ b/hggtk/changeset.py	Sat Apr 26 09:47:01 2008 +0100
@@ -23,11 +23,16 @@
 from gdialog import *
 from hgcmd import CmdDialog
 from hglib import toutf, fromutf
+from gtklib import StatusBar
 
 
 class ChangeSet(GDialog):
     """GTK+ based dialog for displaying repository logs
     """
+    def __init__(self, ui, repo, cwd, pats, opts, main, stbar=None):
+        GDialog.__init__(self, ui, repo, cwd, pats, opts, main)
+        self.stbar = stbar
+
     def get_title(self):
         title = os.path.basename(self.repo.root) + ' changeset '
         title += self.opts['rev'][0]
@@ -105,6 +110,8 @@
             self.textview.thaw_child_notify()
 
     def _fill_buffer(self, buf, rev, ctx, filelist):
+        self.stbar.begin('Retrieving changeset data...')
+        
         def title_line(title, text, tag):
             pad = ' ' * (12 - len(title))
             utext = toutf(title + pad + text)
@@ -176,6 +183,7 @@
         try:
             status, file, txt = iterator.next()
         except StopIteration:
+            self.stbar.end()
             return False
 
         lines = txt.splitlines()
@@ -513,7 +521,19 @@
         self._hpaned.pack1(list_frame, True, True)
         self._hpaned.pack2(details_frame, True, True)
         self._hpaned.set_position(self._setting_hpos)
-        return self._hpaned
+
+        if self.stbar:
+            # embedded by changelog browser
+            return self._hpaned
+        else:
+            # add status bar for main app
+            vbox = gtk.VBox()
+            vbox.pack_start(self._hpaned, True, True)
+            self.stbar = StatusBar()
+            self.stbar.show()
+            vbox.pack_start(gtk.HSeparator(), False, False)
+            vbox.pack_start(self.stbar, False, False)
+            return vbox
 
     def setup_tags(self):
         """Creates the tags to be used inside the TextView"""
--- a/hggtk/history.py	Sat Apr 26 08:26:54 2008 +0100
+++ b/hggtk/history.py	Sat Apr 26 09:47:01 2008 +0100
@@ -236,7 +236,7 @@
 
         # Allocate ChangeSet instance to use internally
         self.changeview = ChangeSet(self.ui, self.repo, self.cwd, [],
-                self.opts, False)
+                self.opts, False, self.stbar)
         self.changeview.display(False)
         self.changeview.glog_parent = self