diff options
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index b31a8a18e1..948f52769d 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -32,6 +32,7 @@ import fcntl | |||
32 | import struct | 32 | import struct |
33 | import copy | 33 | import copy |
34 | import atexit | 34 | import atexit |
35 | |||
35 | from bb.ui import uihelper | 36 | from bb.ui import uihelper |
36 | 37 | ||
37 | featureSet = [bb.cooker.CookerFeatures.SEND_SANITYEVENTS] | 38 | featureSet = [bb.cooker.CookerFeatures.SEND_SANITYEVENTS] |
@@ -40,7 +41,7 @@ logger = logging.getLogger("BitBake") | |||
40 | interactive = sys.stdout.isatty() | 41 | interactive = sys.stdout.isatty() |
41 | 42 | ||
42 | class BBProgress(progressbar.ProgressBar): | 43 | class BBProgress(progressbar.ProgressBar): |
43 | def __init__(self, msg, maxval, widgets=None, extrapos=-1): | 44 | def __init__(self, msg, maxval, widgets=None, extrapos=-1, resize_handler=None): |
44 | self.msg = msg | 45 | self.msg = msg |
45 | self.extrapos = extrapos | 46 | self.extrapos = extrapos |
46 | if not widgets: | 47 | if not widgets: |
@@ -48,10 +49,10 @@ class BBProgress(progressbar.ProgressBar): | |||
48 | progressbar.ETA()] | 49 | progressbar.ETA()] |
49 | self.extrapos = 4 | 50 | self.extrapos = 4 |
50 | 51 | ||
51 | try: | 52 | if resize_handler: |
53 | self._resize_default = resize_handler | ||
54 | else: | ||
52 | self._resize_default = signal.getsignal(signal.SIGWINCH) | 55 | self._resize_default = signal.getsignal(signal.SIGWINCH) |
53 | except: | ||
54 | self._resize_default = None | ||
55 | progressbar.ProgressBar.__init__(self, maxval, [self.msg + ": "] + widgets, fd=sys.stdout) | 56 | progressbar.ProgressBar.__init__(self, maxval, [self.msg + ": "] + widgets, fd=sys.stdout) |
56 | 57 | ||
57 | def _handle_resize(self, signum=None, frame=None): | 58 | def _handle_resize(self, signum=None, frame=None): |
@@ -247,10 +248,10 @@ class TerminalFilter(object): | |||
247 | start_time = activetasks[t].get("starttime", None) | 248 | start_time = activetasks[t].get("starttime", None) |
248 | if not pbar or pbar.bouncing != (progress < 0): | 249 | if not pbar or pbar.bouncing != (progress < 0): |
249 | if progress < 0: | 250 | if progress < 0: |
250 | pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2) | 251 | pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2, resize_handler=self.sigwinch_handle) |
251 | pbar.bouncing = True | 252 | pbar.bouncing = True |
252 | else: | 253 | else: |
253 | pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=4) | 254 | pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=4, resize_handler=self.sigwinch_handle) |
254 | pbar.bouncing = False | 255 | pbar.bouncing = False |
255 | activetasks[t]["progressbar"] = pbar | 256 | activetasks[t]["progressbar"] = pbar |
256 | tasks.append((pbar, progress, rate, start_time)) | 257 | tasks.append((pbar, progress, rate, start_time)) |
@@ -274,7 +275,7 @@ class TerminalFilter(object): | |||
274 | maxtask = self.helper.tasknumber_total | 275 | maxtask = self.helper.tasknumber_total |
275 | if not self.main_progress or self.main_progress.maxval != maxtask: | 276 | if not self.main_progress or self.main_progress.maxval != maxtask: |
276 | widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()] | 277 | widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()] |
277 | self.main_progress = BBProgress("Running tasks", maxtask, widgets=widgets) | 278 | self.main_progress = BBProgress("Running tasks", maxtask, widgets=widgets, resize_handler=self.sigwinch_handle) |
278 | self.main_progress.start(False) | 279 | self.main_progress.start(False) |
279 | self.main_progress.setmessage(content) | 280 | self.main_progress.setmessage(content) |
280 | progress = self.helper.tasknumber_current - 1 | 281 | progress = self.helper.tasknumber_current - 1 |