##// END OF EJS Templates
progress: react more reasonably to nested progress topics...
Augie Fackler -
r13130:f139f34b default
parent child Browse files
Show More
@@ -61,6 +61,7 b' class progbar(object):'
61
61
62 def resetstate(self):
62 def resetstate(self):
63 self.topics = []
63 self.topics = []
64 self.topicstates = {}
64 self.printed = False
65 self.printed = False
65 self.lastprint = time.time() + float(self.ui.config(
66 self.lastprint = time.time() + float(self.ui.config(
66 'progress', 'delay', default=3))
67 'progress', 'delay', default=3))
@@ -161,17 +162,24 b' class progbar(object):'
161
162
162 def progress(self, topic, pos, item='', unit='', total=None):
163 def progress(self, topic, pos, item='', unit='', total=None):
163 if pos is None:
164 if pos is None:
164 if self.topics and self.topics[-1] == topic and self.printed:
165 self.topicstates.pop(topic, None)
166 # reset the progress bar if this is the outermost topic
167 if self.topics and self.topics[0] == topic and self.printed:
165 self.complete()
168 self.complete()
166 self.resetstate()
169 self.resetstate()
170 # truncate the list of topics assuming all topics within
171 # this one are also closed
172 if topic in self.topics:
173 self.topics = self.topics[:self.topics.index(topic)]
167 else:
174 else:
168 if topic not in self.topics:
175 if topic not in self.topics:
169 self.topics.append(topic)
176 self.topics.append(topic)
170 now = time.time()
177 now = time.time()
171 if (now - self.lastprint >= self.refresh
178 self.topicstates[topic] = pos, item, unit, total
172 and topic == self.topics[-1]):
179 if now - self.lastprint >= self.refresh and self.topics:
173 self.lastprint = now
180 self.lastprint = now
174 self.show(topic, pos, item, unit, total)
181 current = self.topics[-1]
182 self.show(current, *self.topicstates[current])
175
183
176 def uisetup(ui):
184 def uisetup(ui):
177 class progressui(ui.__class__):
185 class progressui(ui.__class__):
@@ -196,13 +196,11 b" Test convert progress bar'"
196
196
197 converting [=======> ] 1/7
197 converting [=======> ] 1/7
198 scanning paths [ ] 0/1
198 scanning paths [ ] 0/1
199
200 getting files [==========================================================>] 1/1
199 getting files [==========================================================>] 1/1
201
200
202 converting [================> ] 2/7
201 converting [================> ] 2/7
203 scanning paths [ ] 0/2
202 scanning paths [ ] 0/2
204 scanning paths [============================> ] 1/2
203 scanning paths [============================> ] 1/2
205
206 getting files [=============> ] 1/4
204 getting files [=============> ] 1/4
207 getting files [============================> ] 2/4
205 getting files [============================> ] 2/4
208 getting files [===========================================> ] 3/4
206 getting files [===========================================> ] 3/4
@@ -210,19 +208,16 b" Test convert progress bar'"
210
208
211 converting [=========================> ] 3/7
209 converting [=========================> ] 3/7
212 scanning paths [ ] 0/1
210 scanning paths [ ] 0/1
213
214 getting files [==========================================================>] 1/1
211 getting files [==========================================================>] 1/1
215
212
216 converting [==================================> ] 4/7
213 converting [==================================> ] 4/7
217 scanning paths [ ] 0/1
214 scanning paths [ ] 0/1
218
219 getting files [==========================================================>] 1/1
215 getting files [==========================================================>] 1/1
220
216
221 converting [===========================================> ] 5/7
217 converting [===========================================> ] 5/7
222 scanning paths [ ] 0/3
218 scanning paths [ ] 0/3
223 scanning paths [==================> ] 1/3
219 scanning paths [==================> ] 1/3
224 scanning paths [=====================================> ] 2/3
220 scanning paths [=====================================> ] 2/3
225
226 getting files [======> ] 1/8
221 getting files [======> ] 1/8
227 getting files [=============> ] 2/8
222 getting files [=============> ] 2/8
228 getting files [=====================> ] 3/8
223 getting files [=====================> ] 3/8
@@ -234,7 +229,6 b" Test convert progress bar'"
234
229
235 converting [====================================================> ] 6/7
230 converting [====================================================> ] 6/7
236 scanning paths [ ] 0/1
231 scanning paths [ ] 0/1
237
238 getting files [======> ] 1/8
232 getting files [======> ] 1/8
239 getting files [=============> ] 2/8
233 getting files [=============> ] 2/8
240 getting files [=====================> ] 3/8
234 getting files [=====================> ] 3/8
General Comments 0
You need to be logged in to leave comments. Login now