diff options
author | hut <hut@lavabit.com> | 2010-01-01 21:56:06 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-01-01 21:56:06 +0100 |
commit | 86594dde3122e6c58319b93568ce390b15dedba0 (patch) | |
tree | 54111abc0072fe0ab65360ad4b5f855d64a8d291 | |
parent | 779d21f45b9407653d922a41fd39e93ffa67b42d (diff) | |
download | ranger-86594dde3122e6c58319b93568ce390b15dedba0.tar.gz |
taskview: fixed redrawing
-rw-r--r-- | ranger/gui/widgets/taskview.py | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/ranger/gui/widgets/taskview.py b/ranger/gui/widgets/taskview.py index a7f90dff..70c3b8ae 100644 --- a/ranger/gui/widgets/taskview.py +++ b/ranger/gui/widgets/taskview.py @@ -10,6 +10,8 @@ from ranger.container import CommandList from collections import deque class TaskView(Widget, Accumulator): + old_lst = None + def __init__(self, win): Widget.__init__(self, win) Accumulator.__init__(self) @@ -22,39 +24,45 @@ class TaskView(Widget, Accumulator): base_clr.append('in_taskview') lst = self.get_list() - if not self.pointer_is_synced(): - self.sync_index() + if self.old_lst != lst: + self.old_lst = lst + self.need_redraw = True - if self.hei <= 0: - return + if self.need_redraw: + self.win.erase() + if not self.pointer_is_synced(): + self.sync_index() - self.addstr(0, 0, "Task View") - self.color_at(0, 0, self.wid, base_clr, 'title') + if self.hei <= 0: + return - if lst: - for i in range(self.hei - 1): - i += self.scroll_begin - try: - obj = lst[i] - except IndexError: - break + self.addstr(0, 0, "Task View") + self.color_at(0, 0, self.wid, base_clr, 'title') - y = i + 1 - clr = deque(base_clr) + if lst: + for i in range(self.hei - 1): + i += self.scroll_begin + try: + obj = lst[i] + except IndexError: + break - if self.pointer == i: - clr.append('selected') + y = i + 1 + clr = deque(base_clr) - descr = obj.get_description() - self.addstr(y, 0, descr, self.wid) - self.color_at(y, 0, self.wid, clr) + if self.pointer == i: + clr.append('selected') - else: - if self.hei > 1: - self.addstr(1, 0, "No task in the queue.") - self.color_at(1, 0, self.wid, base_clr, 'error') + descr = obj.get_description() + self.addstr(y, 0, descr, self.wid) + self.color_at(y, 0, self.wid, clr) + + else: + if self.hei > 1: + self.addstr(1, 0, "No task in the queue.") + self.color_at(1, 0, self.wid, base_clr, 'error') - self.color_reset() + self.color_reset() def task_remove(self, i=None): if i is None: @@ -85,4 +93,3 @@ class TaskView(Widget, Accumulator): def get_list(self): return self.fm.loader.queue - return self.loader.queue |