Rev 3025: Rename the long-not-directly used ProgressBar factory out of the way. in http://people.ubuntu.com/~robertc/baz2.0/nested-pb

Robert Collins robertc at robertcollins.net
Tue Nov 20 08:58:07 GMT 2007


At http://people.ubuntu.com/~robertc/baz2.0/nested-pb

------------------------------------------------------------
revno: 3025
revision-id:robertc at robertcollins.net-20071120085757-yud1ied1pn0cjcbx
parent: robertc at robertcollins.net-20071120085359-5zr8flo9akcq3fxi
committer: Robert Collins <robertc at robertcollins.net>
branch nick: pb.simplify
timestamp: Tue 2007-11-20 19:57:57 +1100
message:
  Rename the long-not-directly used ProgressBar factory out of the way.
modified:
  bzrlib/progress.py             progress.py-20050610070202-df9faaab791964c0
  bzrlib/weave.py                knit.py-20050627021749-759c29984154256b
=== modified file 'bzrlib/progress.py'
--- a/bzrlib/progress.py	2007-11-20 08:53:59 +0000
+++ b/bzrlib/progress.py	2007-11-20 08:57:57 +0000
@@ -19,11 +19,11 @@
 """Progress indicators.
 
 The usual way to use this is via bzrlib.ui.ui_factory.nested_progress_bar which
-will maintain a ProgressBarStack for you.
+will maintain a stack for you.
 
-For direct use, the factory ProgressBar will return an auto-detected progress
+For direct use, the factory _ProgressBar will return an auto-detected progress
 bar that should match your terminal type. You can manually create a
-ProgressBarStack too if you need multiple levels of cooperating progress bars.
+_ProgressBarStack too if you need multiple levels of cooperating progress bars.
 Note that bzrlib's internal functions use the ui module, so if you are using
 bzrlib it really is best to use bzrlib.ui.ui_factory.
 
@@ -99,7 +99,7 @@
     return DotsTaskDisplay
 
 
-def ProgressBar(to_file=None, **kwargs):
+def _ProgressBar(to_file=None, **kwargs):
     """Abstract factory"""
     if to_file is None:
         to_file = sys.stderr
@@ -201,7 +201,7 @@
         self._show_count = show_count
         self._to_messages_file = to_messages_file
         self._stack = []
-        self._klass = klass or ProgressBar
+        self._klass = klass or _ProgressBar
 
     def top(self):
         if len(self._stack) != 0:
@@ -769,7 +769,7 @@
     sleep(1.5)
     
     print 'smart-terminal test:'
-    pb = ProgressBar(show_pct=True, show_bar=True, show_spinner=False)
+    pb = _ProgressBar(show_pct=True, show_bar=True, show_spinner=False)
     for i in range(100):
         pb.update('Elephanten', i, 99)
         sleep(0.1)

=== modified file 'bzrlib/weave.py'
--- a/bzrlib/weave.py	2007-11-09 17:50:31 +0000
+++ b/bzrlib/weave.py	2007-11-20 08:57:57 +0000
@@ -1078,7 +1078,7 @@
         sys.path.append('..')
         import bzrlib
     from bzrlib.weavefile import write_weave, read_weave
-    from bzrlib.progress import ProgressBar
+    from bzrlib.progress import _ProgressBar
 
     try:
         import psyco
@@ -1144,11 +1144,11 @@
         weave_toc(readit())
 
     elif cmd == 'stats':
-        weave_stats(argv[2], ProgressBar())
+        weave_stats(argv[2], _ProgressBar())
         
     elif cmd == 'check':
         w = readit()
-        pb = ProgressBar()
+        pb = _ProgressBar()
         w.check(pb)
         pb.clear()
         print '%d versions ok' % w.num_versions()



More information about the bazaar-commits mailing list