diff options
author | hut <hut@lavabit.com> | 2012-08-07 04:13:53 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2012-08-07 04:14:26 +0200 |
commit | 91f4dcabd2bd6b83afae5d58928cc8e1353286ef (patch) | |
tree | 7fcbb63100cba975ebee3cdc251155cd27d12653 | |
parent | 1fbb9a3f01b6db5da0a70f691639640125f9d790 (diff) | |
download | ranger-91f4dcabd2bd6b83afae5d58928cc8e1353286ef.tar.gz |
widgets.taskview: show progressbar only if task supports it
-rw-r--r-- | ranger/core/loader.py | 2 | ||||
-rw-r--r-- | ranger/gui/widgets/taskview.py | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py index 2b7747c6..7bbd2abf 100644 --- a/ranger/core/loader.py +++ b/ranger/core/loader.py @@ -20,7 +20,7 @@ class Loadable(object): def __init__(self, gen, descr): self.load_generator = gen self.description = descr - self.percent = 0 + self.percent = -1 def get_description(self): return self.description diff --git a/ranger/gui/widgets/taskview.py b/ranger/gui/widgets/taskview.py index 582bb76d..53da5826 100644 --- a/ranger/gui/widgets/taskview.py +++ b/ranger/gui/widgets/taskview.py @@ -51,10 +51,14 @@ class TaskView(Widget, Accumulator): clr.append('selected') descr = obj.get_description() - self.addstr(y, 0, "%3d%% - %s" % (obj.percent, descr), self.wid) - wid = int(self.wid / 100.0 * obj.percent) - self.color_at(y, 0, self.wid, tuple(clr)) - self.color_at(y, 0, wid, tuple(clr), 'loaded') + if obj.percent >= 0 and obj.percent <= 100: + self.addstr(y, 0, "%3d%% - %s" % (obj.percent, descr), self.wid) + wid = int(self.wid / 100.0 * obj.percent) + self.color_at(y, 0, self.wid, tuple(clr)) + self.color_at(y, 0, wid, tuple(clr), 'loaded') + else: + self.addstr(y, 0, descr, self.wid) + self.color_at(y, 0, self.wid, tuple(clr)) else: if self.hei > 1: |