summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-01 21:56:06 +0100
committerhut <hut@lavabit.com>2010-01-01 21:56:06 +0100
commit86594dde3122e6c58319b93568ce390b15dedba0 (patch)
tree54111abc0072fe0ab65360ad4b5f855d64a8d291
parent779d21f45b9407653d922a41fd39e93ffa67b42d (diff)
downloadranger-86594dde3122e6c58319b93568ce390b15dedba0.tar.gz
taskview: fixed redrawing
-rw-r--r--ranger/gui/widgets/taskview.py59
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
#n19'>19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178