migrate emaint to use the new title and label features of the progressbar.
authorBrian Dolbec <dolsen@gentoo.org>
Tue, 10 Jul 2012 00:04:58 +0000 (17:04 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 10 Jul 2012 00:11:02 +0000 (17:11 -0700)
bin/emaint

index cf2ccb8ec61771a81f9b075889e8807f5753de72..5f54f6af5690f6835456af9e9e1b0d4e15ed5876 100755 (executable)
@@ -610,19 +610,16 @@ def emaint_main(myargv):
 
 
        if action == "-c/--check":
-               status = "Checking %s for problems"
                func = "check"
        else:
-               status = "Attempting to fix %s"
                func = "fix"
 
        isatty = os.environ.get('TERM') != 'dumb' and sys.stdout.isatty()
        for task in tasks:
-               print(status % task.name())
                inst = task()
                onProgress = None
                if isatty:
-                       progressBar = portage.output.TermProgressBar()
+                       progressBar = portage.output.TermProgressBar(title="Emaint", max_desc_length=26)
                        progressHandler = ProgressHandler()
                        onProgress = progressHandler.onProgress
                        def display():
@@ -632,6 +629,7 @@ def emaint_main(myargv):
                                lines, progressBar.term_columns = \
                                        portage.output.get_term_size()
                        signal.signal(signal.SIGWINCH, sigwinch_handler)
+                       progressBar.label(func + " " + inst.name())
                result = getattr(inst, func)(onProgress=onProgress)
                if isatty:
                        # make sure the final progress is displayed