summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/progressbar/widgets.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/progressbar/widgets.py')
-rw-r--r--bitbake/lib/progressbar/widgets.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/bitbake/lib/progressbar/widgets.py b/bitbake/lib/progressbar/widgets.py
index 6434ad5591..77285ca7a3 100644
--- a/bitbake/lib/progressbar/widgets.py
+++ b/bitbake/lib/progressbar/widgets.py
@@ -353,3 +353,39 @@ class BouncingBar(Bar):
353 if not self.fill_left: rpad, lpad = lpad, rpad 353 if not self.fill_left: rpad, lpad = lpad, rpad
354 354
355 return '%s%s%s%s%s' % (left, lpad, marker, rpad, right) 355 return '%s%s%s%s%s' % (left, lpad, marker, rpad, right)
356
357
358class BouncingSlider(Bar):
359 """
360 A slider that bounces back and forth in response to update() calls
361 without reference to the actual value. Based on a combination of
362 BouncingBar from a newer version of this module and RotatingMarker.
363 """
364 def __init__(self, marker='<=>'):
365 self.curmark = -1
366 self.forward = True
367 Bar.__init__(self, marker=marker)
368 def update(self, pbar, width):
369 left, marker, right = (format_updatable(i, pbar) for i in
370 (self.left, self.marker, self.right))
371
372 width -= len(left) + len(right)
373 if width < 0:
374 return ''
375
376 if pbar.finished: return '%s%s%s' % (left, width * '=', right)
377
378 self.curmark = self.curmark + 1
379 position = int(self.curmark % (width * 2 - 1))
380 if position + len(marker) > width:
381 self.forward = not self.forward
382 self.curmark = 1
383 position = 1
384 lpad = ' ' * (position - 1)
385 rpad = ' ' * (width - len(marker) - len(lpad))
386
387 if not self.forward:
388 temp = lpad
389 lpad = rpad
390 rpad = temp
391 return '%s%s%s%s%s' % (left, lpad, marker, rpad, right)