From 99e5a83582eff3900cb74fec86a1abd12ef96bad Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 27 May 2007 12:39:35 +0000 Subject: [PATCH] Add SIGWINCH support so that the progress bar is resized if the xterm is resized. svn path=/main/trunk/; revision=6640 --- bin/emaint | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/emaint b/bin/emaint index c44bbe85a..0628db371 100755 --- a/bin/emaint +++ b/bin/emaint @@ -1,6 +1,6 @@ #!/usr/bin/python -O -import sys, os, time +import sys, os, time, signal from optparse import OptionParser, OptionValueError if not hasattr(__builtins__, "set"): from sets import Set as set @@ -218,13 +218,18 @@ def emaint_main(myargv): progressBar = portage.output.TermProgressBar() progressHandler = ProgressHandler() def display(): - progressBar.set(progressHandler.maxval, progressHandler.curval) + progressBar.set(progressHandler.curval, progressHandler.maxval) progressHandler.display = display + def sigwinch_handler(signum, frame): + lines, progressBar.term_columns = \ + portage.output.get_term_size() + signal.signal(signal.SIGWINCH, sigwinch_handler) result = getattr(inst, func)(onProgress=progressHandler.onProgress) if isatty: # make sure the final progress is displayed progressHandler.display() print + signal.signal(signal.SIGWINCH, signal.SIG_DFL) if result: print print "\n".join(result) -- 2.26.2