Merge lp:~thisfred/ubuntuone-client/reset-filenames into lp:ubuntuone-client
- reset-filenames
- Merge into trunk
Proposed by
Eric Casteleijn
Status: | Rejected | ||||
---|---|---|---|---|---|
Rejected by: | Eric Casteleijn | ||||
Proposed branch: | lp:~thisfred/ubuntuone-client/reset-filenames | ||||
Merge into: | lp:ubuntuone-client | ||||
Diff against target: |
703 lines (+186/-61) 4 files modified
tests/status/test_aggregator.py (+84/-14) ubuntuone/eventlog/zg_listener.py (+2/-2) ubuntuone/platform/linux/session.py (+1/-1) ubuntuone/status/aggregator.py (+99/-44) |
||||
To merge this branch: | bzr merge lp:~thisfred/ubuntuone-client/reset-filenames | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Facundo Batista (community) | Abstain | ||
Review via email: mp+67386@code.launchpad.net |
Commit message
No longer forgets connection status after completed uploads/downloads.
Description of the change
No longer forgets connection status after completed uploads/downloads.
To post a comment you must log in.
- 1053. By Eric Casteleijn
-
forgot to save tests
Revision history for this message
Eric Casteleijn (thisfred) wrote : | # |
Facundo: It's a shame this bug does not solve the bug in question, but I'd still like to land it, as it improves the code and solves similar issues. If we land this I will not mark the bug as fixed, but as you can see from the commit message, it does not promise to.
Revision history for this message
Eric Casteleijn (thisfred) wrote : | # |
s/bug does not solve/branch does not solve/
Revision history for this message
Facundo Batista (facundo) : | # |
review:
Abstain
Unmerged revisions
- 1053. By Eric Casteleijn
-
forgot to save tests
- 1052. By Eric Casteleijn
-
think I've fixed it
- 1051. By Eric Casteleijn
-
fixed reset not to set connected to False
- 1050. By Eric Casteleijn
-
fixed logging issues
- 1049. By Eric Casteleijn
-
added extensive debug logging
- 1048. By Eric Casteleijn
-
minor refactorings and cleanup
- 1047. By Eric Casteleijn
-
minor refactorings and cleanup
- 1046. By Eric Casteleijn
-
unchanged: attach bug
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'tests/status/test_aggregator.py' |
2 | --- tests/status/test_aggregator.py 2011-07-01 19:02:13 +0000 |
3 | +++ tests/status/test_aggregator.py 2011-07-08 20:38:00 +0000 |
4 | @@ -257,8 +257,8 @@ |
5 | self.assertNotIn(notification, |
6 | self.toggleable.notification.notifications_shown) |
7 | |
8 | - def test_send_notification_passes_thru(self): |
9 | - """The send_notification method passes thru.""" |
10 | + def test_send_notification_passes_through(self): |
11 | + """The send_notification method passes through.""" |
12 | args = (1, 2, 3, 4) |
13 | self.toggleable.send_notification(*args) |
14 | self.assertShown(args) |
15 | @@ -339,7 +339,7 @@ |
16 | """The popup callback shows notifications.""" |
17 | self.bubble.connection_made() |
18 | self.bubble.new_file_found() |
19 | - self.bubble._popup() |
20 | + self.bubble.popup() |
21 | message = self.aggregator.build_discovery_message() |
22 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) |
23 | self.assertIn(notification, self.get_notifications_shown()) |
24 | @@ -355,7 +355,7 @@ |
25 | def test_popup_shows_no_notification_before_connection_made(self): |
26 | """The popup callback shows notifications.""" |
27 | self.bubble.new_file_found() |
28 | - self.bubble._popup() |
29 | + self.bubble.popup() |
30 | message = self.aggregator.build_discovery_message() |
31 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) |
32 | self.assertNotIn(notification, self.get_notifications_shown()) |
33 | @@ -365,7 +365,7 @@ |
34 | self.bubble.connection_made() |
35 | self.bubble.connection_lost() |
36 | self.bubble.new_file_found() |
37 | - self.bubble._popup() |
38 | + self.bubble.popup() |
39 | message = self.aggregator.build_discovery_message() |
40 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) |
41 | self.assertNotIn(notification, self.get_notifications_shown()) |
42 | @@ -374,7 +374,7 @@ |
43 | """The notification is printed in the debug log.""" |
44 | self.bubble.connection_made() |
45 | self.bubble.new_file_found() |
46 | - self.bubble._popup() |
47 | + self.bubble.popup() |
48 | msg = "notification shown: %s" % self.get_notifications_shown()[0][1] |
49 | self.assertTrue(self.handler.check_debug(msg)) |
50 | |
51 | @@ -466,9 +466,9 @@ |
52 | """The update callback updates notifications.""" |
53 | self.bubble.connection_made() |
54 | self.bubble.new_file_found() |
55 | - self.bubble._popup() |
56 | + self.bubble.popup() |
57 | self.bubble.new_file_found() |
58 | - self.bubble._update() |
59 | + self.bubble.update() |
60 | message = self.aggregator.build_discovery_message() |
61 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) |
62 | self.assertIn(notification, self.get_notifications_shown()) |
63 | @@ -477,9 +477,9 @@ |
64 | """The notification is logged when _update is called.""" |
65 | self.bubble.connection_made() |
66 | self.bubble.new_file_found() |
67 | - self.bubble._popup() |
68 | + self.bubble.popup() |
69 | self.bubble.new_file_found() |
70 | - self.bubble._update() |
71 | + self.bubble.update() |
72 | msg = "notification updated: %s" % self.get_notifications_shown()[1][1] |
73 | self.assertTrue(self.handler.check_debug(msg)) |
74 | |
75 | @@ -494,7 +494,6 @@ |
76 | self.clock = PatchedClock() |
77 | self.aggregator = FakeStatusAggregator(clock=self.clock) |
78 | self.bubble = aggregator.FinalStatusBubble(self.aggregator) |
79 | - self.addCleanup(self.bubble.cleanup) |
80 | |
81 | def test_notification_not_shown_initially(self): |
82 | """The notification is not shown initially.""" |
83 | @@ -1181,6 +1180,9 @@ |
84 | def connection_lost(self): |
85 | """Connection lost.""" |
86 | |
87 | + def set_idle(self): |
88 | + """Reset this bubble to the initial state.""" |
89 | + |
90 | |
91 | class FakeFinalBubble(object): |
92 | """A fake FinalStatusBubble.""" |
93 | @@ -1229,15 +1231,17 @@ |
94 | self.assertEqual(0, self.aggregator.download_done) |
95 | self.assertEqual(0, self.aggregator.upload_done) |
96 | self.assertEqual(0, len(self.aggregator.files_uploading)) |
97 | + self.assertEqual('', self.aggregator.uploading_filename) |
98 | self.assertEqual(0, len(self.aggregator.files_downloading)) |
99 | + self.assertEqual('', self.aggregator.downloading_filename) |
100 | + self.assertIdentical(None, self.aggregator.queue_done_timer) |
101 | self.assertEqual({}, self.aggregator.progress) |
102 | self.assertEqual({}, self.aggregator.to_do) |
103 | - self.assertIdentical(None, self.aggregator.queue_done_timer) |
104 | |
105 | def assertMiscCommandQueued(self, fc): |
106 | """Assert that some command was queued.""" |
107 | self.assertEqual(len(self.aggregator.to_do), 1) |
108 | - message = "queueing command (total: 1): %s" % fc.__class__.__name__ |
109 | + message = "command %s started (total: 0/1)" % fc.__class__.__name__ |
110 | self.assertEqual(fc.deflated_size, sum(self.aggregator.to_do.values())) |
111 | self.assertTrue(self.handler.check_debug(message)) |
112 | self.assertTrue(self.aggregator.progress_bar.visible) |
113 | @@ -1246,7 +1250,7 @@ |
114 | """Assert that some command was unqueued.""" |
115 | self.assertEqual( |
116 | 1, self.aggregator.download_done + self.aggregator.upload_done) |
117 | - message = "unqueueing command: %s" % fc.__class__.__name__ |
118 | + message = "command %s done (total: 1/1)" % fc.__class__.__name__ |
119 | self.assertTrue(self.handler.check_debug(message)) |
120 | |
121 | def test_counters_start_at_zero(self): |
122 | @@ -1565,3 +1569,69 @@ |
123 | self.assertEqual(0, len(notifications_shown)) |
124 | sf.queue_done() |
125 | self.assertEqual(0, len(notifications_shown)) |
126 | + |
127 | + def test_queue_done_resets_filename(self): |
128 | + """Bug LP: #807005""" |
129 | + self.patch(aggregator, "ToggleableNotification", |
130 | + FakeNotificationSingleton()) |
131 | + self.patch(aggregator, "UbuntuOneLauncher", FakeLauncher) |
132 | + self.patch(aggregator.session, "Inhibitor", FakeInhibitor) |
133 | + clock = PatchedClock() |
134 | + upload = FakeCommand(path='upload.foo') |
135 | + sf = aggregator.StatusFrontend(clock=clock) |
136 | + sf.server_connection_made() |
137 | + sf.set_show_all_notifications(True) |
138 | + sf.upload_started(upload) |
139 | + notifications_shown = ( |
140 | + sf.aggregator.file_discovery_bubble. |
141 | + notification.notifications_shown) |
142 | + # no notifications shown yet |
143 | + self.assertEqual(0, len(notifications_shown)) |
144 | + clock.advance(aggregator.FileDiscoveryGatheringState.initial_timeout) |
145 | + # files found notification |
146 | + self.assertEqual(1, len(notifications_shown)) |
147 | + sf.upload_finished(upload) |
148 | + sf.queue_done() |
149 | + clock.advance(sf.aggregator.finished_delay * 2) |
150 | + self.assertEqual(2, len(notifications_shown)) |
151 | + final_text = notifications_shown[-1][1] |
152 | + upload2 = FakeCommand(path='upload.bar') |
153 | + sf.upload_started(upload2) |
154 | + # no notifications shown yet |
155 | + self.assertEqual(2, len(notifications_shown)) |
156 | + clock.advance(aggregator.FileDiscoveryGatheringState.initial_timeout) |
157 | + # files found notification |
158 | + self.assertEqual(3, len(notifications_shown)) |
159 | + sf.upload_finished(upload2) |
160 | + sf.queue_done() |
161 | + clock.advance(sf.aggregator.finished_delay * 2) |
162 | + self.assertEqual(4, len(notifications_shown)) |
163 | + self.assertNotEqual(final_text, notifications_shown[-1][1]) |
164 | + |
165 | + def test_queue_done_resets_filename2(self): |
166 | + """Bug LP: #807005""" |
167 | + self.patch(aggregator, "ToggleableNotification", |
168 | + FakeNotificationSingleton()) |
169 | + self.patch(aggregator, "UbuntuOneLauncher", FakeLauncher) |
170 | + self.patch(aggregator.session, "Inhibitor", FakeInhibitor) |
171 | + clock = PatchedClock() |
172 | + upload = FakeCommand(path='upload.foo') |
173 | + sf = aggregator.StatusFrontend(clock=clock) |
174 | + sf.server_connection_made() |
175 | + sf.set_show_all_notifications(True) |
176 | + sf.upload_started(upload) |
177 | + sf.upload_started(upload) |
178 | + sf.upload_started(upload) |
179 | + notifications_shown = ( |
180 | + sf.aggregator.file_discovery_bubble. |
181 | + notification.notifications_shown) |
182 | + # no notifications shown yet |
183 | + self.assertEqual(0, len(notifications_shown)) |
184 | + clock.advance( |
185 | + aggregator.FileDiscoveryGatheringState.initial_timeout) |
186 | + # files found notification |
187 | + self.assertEqual(1, len(notifications_shown)) |
188 | + sf.upload_finished(upload) |
189 | + sf.queue_done() |
190 | + clock.advance(sf.aggregator.finished_delay * 2) |
191 | + self.assertEqual(2, len(notifications_shown)) |
192 | |
193 | === modified file 'ubuntuone/eventlog/zg_listener.py' |
194 | --- ubuntuone/eventlog/zg_listener.py 2011-03-22 20:01:59 +0000 |
195 | +++ ubuntuone/eventlog/zg_listener.py 2011-07-08 20:38:00 +0000 |
196 | @@ -59,7 +59,7 @@ |
197 | self.newly_created_local_files = set() |
198 | |
199 | def handle_AQ_CREATE_SHARE_OK(self, share_id, marker): |
200 | - """Log the 'directory shared thru the server' event.""" |
201 | + """Log the 'directory shared through the server' event.""" |
202 | share_id = str(share_id) |
203 | share = self.vm.shared.get(share_id) |
204 | if not share: |
205 | @@ -68,7 +68,7 @@ |
206 | self.log_folder_shared(share, share_id) |
207 | |
208 | def handle_AQ_SHARE_INVITATION_SENT(self, marker): |
209 | - """Log the 'directory shared thru http' event.""" |
210 | + """Log the 'directory shared through http' event.""" |
211 | share = self.vm.marker_share_map[marker] |
212 | mdo = self.fsm.get_by_mdid(marker) |
213 | self.log_folder_shared(share, mdo.share_id) |
214 | |
215 | === modified file 'ubuntuone/platform/linux/session.py' |
216 | --- ubuntuone/platform/linux/session.py 2011-02-22 23:57:51 +0000 |
217 | +++ ubuntuone/platform/linux/session.py 2011-07-08 20:38:00 +0000 |
218 | @@ -15,7 +15,7 @@ |
219 | # |
220 | # You should have received a copy of the GNU General Public License along |
221 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
222 | -"""Inhibit session logout when busy thru the Gnome Session DBus service.""" |
223 | +"""Inhibit session logout when busy through the Gnome Session DBus service.""" |
224 | |
225 | import dbus |
226 | |
227 | |
228 | === modified file 'ubuntuone/status/aggregator.py' |
229 | --- ubuntuone/status/aggregator.py 2011-07-07 13:10:02 +0000 |
230 | +++ ubuntuone/status/aggregator.py 2011-07-08 20:38:00 +0000 |
231 | @@ -51,6 +51,7 @@ |
232 | """Set the launcher to urgent to alert the user.""" |
233 | launcher = UbuntuOneLauncher() |
234 | launcher.set_urgent() |
235 | + logger.debug("Launcher set to urgent.") |
236 | |
237 | |
238 | def files_being_uploaded(filename, files_uploading): |
239 | @@ -130,9 +131,14 @@ |
240 | self.notification = Notification() |
241 | |
242 | def send_notification(self, *args): |
243 | - """Passthru the notification.""" |
244 | + """Pass through the notification.""" |
245 | if self.notification_switch.enabled: |
246 | + logger.debug( |
247 | + "Displayed notification with arguments %r.", args) |
248 | return self.notification.send_notification(*args) |
249 | + logger.debug( |
250 | + "Asked to display notification with arguments %r, but " |
251 | + "notifications switched off.", args) |
252 | |
253 | |
254 | class NotificationSwitch(object): |
255 | @@ -150,10 +156,12 @@ |
256 | def enable_notifications(self): |
257 | """Turn the switch on.""" |
258 | self.enabled = True |
259 | + logger.debug("Notifications enabled.") |
260 | |
261 | def disable_notifications(self): |
262 | """Turn the switch off.""" |
263 | self.enabled = False |
264 | + logger.debug("Notifications disabled.") |
265 | |
266 | |
267 | class StatusEvent(object): |
268 | @@ -187,7 +195,7 @@ |
269 | def many(self, events): |
270 | """Show the number of files if many event of this type.""" |
271 | no_of_files = len(events) |
272 | - gettext.dngettext( |
273 | + return gettext.dngettext( |
274 | GETTEXT_PACKAGE, |
275 | "%(event_count)d file was just made public.", |
276 | "%(event_count)d files were just made public.", |
277 | @@ -203,7 +211,7 @@ |
278 | def many(self, events): |
279 | """Show the number of files if many event of this type.""" |
280 | no_of_files = len(events) |
281 | - gettext.dngettext( |
282 | + return gettext.dngettext( |
283 | GETTEXT_PACKAGE, |
284 | "%(event_count)d file is no longer published.", |
285 | "%(event_count)d files are no longer published.", |
286 | @@ -218,7 +226,7 @@ |
287 | def many(self, events): |
288 | """Show the number of files if many event of this type.""" |
289 | no_of_files = len(events) |
290 | - gettext.dngettext( |
291 | + return gettext.dngettext( |
292 | GETTEXT_PACKAGE, |
293 | "Found %(event_count)d new cloud folder.", |
294 | "Found %(event_count)d new cloud folders.", |
295 | @@ -288,21 +296,30 @@ |
296 | def cancel_if_active(self, call): |
297 | """Cancel a call if it is active.""" |
298 | if call.active(): |
299 | + logger.debug('callback %r cancelled.', call.func) |
300 | call.cancel() |
301 | |
302 | def cleanup(self): |
303 | """Cancel all active calls.""" |
304 | self.cancel_if_active(self.delay_call) |
305 | + logger.debug('%r cleaned up.', self) |
306 | |
307 | def callback(self, result=None): |
308 | """Make sure the timers are stopped when firing the callback.""" |
309 | self.cleanup() |
310 | defer.Deferred.callback(self, result) |
311 | |
312 | + def errback(self, failure=None): |
313 | + """Log the failure.""" |
314 | + logger.error('Failure in %s %r: %r', self.__class__, self, failure) |
315 | + defer.Deferred.errback(self, failure) |
316 | + |
317 | def reset(self): |
318 | """Reset the delay.""" |
319 | if not self.called: |
320 | self.delay_call.reset(self.delay) |
321 | + logger.debug( |
322 | + '%s %r delay reset to %.2f.', self.__class__, self, self.delay) |
323 | |
324 | @property |
325 | def active(self): |
326 | @@ -345,7 +362,7 @@ |
327 | |
328 | def new_file_found(self): |
329 | """New files found.""" |
330 | - self.bubble._start() |
331 | + self.bubble.start() |
332 | |
333 | |
334 | class FileDiscoveryGatheringState(FileDiscoveryBaseState): |
335 | @@ -365,7 +382,7 @@ |
336 | def _timeout(self, result): |
337 | """Show the notification bubble.""" |
338 | self.cleanup() |
339 | - self.bubble._popup() |
340 | + self.bubble.popup() |
341 | |
342 | def new_file_found(self): |
343 | """New files found.""" |
344 | @@ -396,7 +413,7 @@ |
345 | |
346 | def _update(self, result): |
347 | """The bubble should be updated.""" |
348 | - self.bubble._update() |
349 | + self.bubble.update() |
350 | |
351 | def new_file_found(self): |
352 | """New files found.""" |
353 | @@ -424,7 +441,7 @@ |
354 | |
355 | def _timeout(self, result): |
356 | """Move the notification to the idle state.""" |
357 | - self.bubble._set_idle() |
358 | + self.bubble.set_idle() |
359 | |
360 | def cleanup(self): |
361 | """Clean up the timers.""" |
362 | @@ -449,25 +466,29 @@ |
363 | self.files_found = False |
364 | self.clock = clock |
365 | self.status_aggregator = status_aggregator |
366 | - self._set_idle() |
367 | + self.set_idle() |
368 | self.notification = None |
369 | |
370 | def _change_state(self, new_state_class): |
371 | """Change to a new state.""" |
372 | if self.state: |
373 | self.state.cleanup() |
374 | + old_state = self.state.__class__ |
375 | self.state = new_state_class(self) |
376 | + logger.debug( |
377 | + "FileDiscoveryBubble state changed from %s to %s", |
378 | + old_state, new_state_class) |
379 | |
380 | - def _set_idle(self): |
381 | + def set_idle(self): |
382 | """Reset this bubble to the initial state.""" |
383 | self._change_state(FileDiscoveryIdleState) |
384 | |
385 | - def _start(self): |
386 | + def start(self): |
387 | """The first file was found, so start gathering.""" |
388 | self.notification = self.status_aggregator.get_notification() |
389 | self._change_state(FileDiscoveryGatheringState) |
390 | |
391 | - def _popup(self): |
392 | + def popup(self): |
393 | """Display the notification.""" |
394 | if not self.connected: |
395 | return |
396 | @@ -477,7 +498,7 @@ |
397 | logger.debug("notification shown: %s", text) |
398 | self._change_state(FileDiscoveryUpdateState) |
399 | |
400 | - def _update(self): |
401 | + def update(self): |
402 | """Update the notification.""" |
403 | if not self.connected: |
404 | return |
405 | @@ -498,7 +519,7 @@ |
406 | """Connection made.""" |
407 | self.connected = True |
408 | if self.files_found: |
409 | - self._popup() |
410 | + self.popup() |
411 | |
412 | def connection_lost(self): |
413 | """Connection lost.""" |
414 | @@ -512,6 +533,7 @@ |
415 | |
416 | class ProgressBar(object): |
417 | """Update a progressbar no more than 10 times a second.""" |
418 | + |
419 | pulsating = True |
420 | visible = False |
421 | progress = 0.0 |
422 | @@ -534,11 +556,11 @@ |
423 | self.timer.cleanup() |
424 | self.timer = None |
425 | |
426 | - def _timeout(self, result): |
427 | + def _timeout(self, _): |
428 | """The aggregating timer has expired, so update the UI.""" |
429 | self.timer = None |
430 | self.launcher.set_progress(self.progress) |
431 | - logger.debug("progressbar updated: %f", self.progress) |
432 | + logger.debug("progressbar set to: %.2f", self.progress) |
433 | |
434 | def set_progress(self, progress): |
435 | """Steps amount changed. Set up a timer if there isn't one ticking.""" |
436 | @@ -579,9 +601,6 @@ |
437 | """Initialize this instance.""" |
438 | self.status_aggregator = status_aggregator |
439 | |
440 | - def cleanup(self): |
441 | - """Clean up this instance.""" |
442 | - |
443 | def show(self): |
444 | """Show the final status notification.""" |
445 | self.notification = self.status_aggregator.get_notification() |
446 | @@ -601,17 +620,15 @@ |
447 | |
448 | file_discovery_bubble = None |
449 | final_status_bubble = None |
450 | + queue_done_timer = None |
451 | + finished_delay = 10 |
452 | |
453 | def __init__(self, clock=reactor): |
454 | """Initialize this instance.""" |
455 | self.clock = clock |
456 | self.notification_switch = NotificationSwitch() |
457 | - self.queue_done_timer = None |
458 | - self.reset() |
459 | self.progress_bar = ProgressBar(clock=self.clock) |
460 | - self.finished_delay = 10 |
461 | - self.progress = {} |
462 | - self.to_do = {} |
463 | + self.reset() |
464 | |
465 | def get_notification(self): |
466 | """Create a new toggleable notification object.""" |
467 | @@ -629,17 +646,17 @@ |
468 | if self.queue_done_timer is not None: |
469 | self.queue_done_timer.cleanup() |
470 | self.queue_done_timer = None |
471 | - |
472 | if self.file_discovery_bubble: |
473 | self.file_discovery_bubble.cleanup() |
474 | - self.file_discovery_bubble = FileDiscoveryBubble(self, |
475 | - clock=self.clock) |
476 | - |
477 | - if self.final_status_bubble: |
478 | - self.final_status_bubble.cleanup() |
479 | + self.file_discovery_bubble.set_idle() |
480 | + else: |
481 | + self.file_discovery_bubble = FileDiscoveryBubble( |
482 | + self, clock=self.clock) |
483 | self.final_status_bubble = FinalStatusBubble(self) |
484 | self.progress = {} |
485 | self.to_do = {} |
486 | + logger.debug("All status aggregation information reset.") |
487 | + |
488 | # pylint: enable=W0201 |
489 | |
490 | def get_discovery_message(self): |
491 | @@ -674,9 +691,9 @@ |
492 | |
493 | def _queue_done(self, _): |
494 | """Show final bubble and reset counters.""" |
495 | + logger.debug("queue done callback fired") |
496 | self.queue_done_timer.cleanup() |
497 | self.queue_done_timer = None |
498 | - logger.debug("queue done callback fired") |
499 | if self.upload_done + self.download_done > 0: |
500 | self.final_status_bubble.show() |
501 | self.progress_bar.completed() |
502 | @@ -685,15 +702,16 @@ |
503 | def queue_done(self): |
504 | """Queue is finished.""" |
505 | if not self.to_do: |
506 | + logger.debug("queue done but no events to process.") |
507 | return |
508 | if self.queue_done_timer is None: |
509 | - logger.debug("queue done callback added") |
510 | self.queue_done_timer = Timer( |
511 | self.finished_delay, clock=self.clock) |
512 | self.queue_done_timer.addCallback(self._queue_done) |
513 | + logger.debug("queue done callback added") |
514 | return |
515 | + self.queue_done_timer.reset() |
516 | logger.debug("queue done callback reset") |
517 | - self.queue_done_timer.reset() |
518 | |
519 | def update_progressbar(self): |
520 | """Update the counters of the progressbar.""" |
521 | @@ -701,6 +719,9 @@ |
522 | progress = float( |
523 | sum(self.progress.values())) / sum(self.to_do.values()) |
524 | self.progress_bar.set_progress(progress) |
525 | + return |
526 | + logger.debug( |
527 | + "Update progress bar called while we have zero todo items.") |
528 | |
529 | def download_started(self, command): |
530 | """A download just started.""" |
531 | @@ -711,15 +732,21 @@ |
532 | if command.deflated_size is not None: |
533 | self.to_do[ |
534 | (command.share_id, command.node_id)] = command.deflated_size |
535 | + logger.debug( |
536 | + 'to_do[(%s, %s)] set to %i', command.share_id, |
537 | + command.node_id, command.deflated_size) |
538 | # pylint: disable=W0201 |
539 | if not self.downloading_filename: |
540 | self.downloading_filename = self.files_downloading[0].path.split( |
541 | os.path.sep)[-1] |
542 | + logger.debug( |
543 | + 'downloading_filename set to %s' % self.downloading_filename) |
544 | # pylint: enable=W0201 |
545 | self.update_progressbar() |
546 | logger.debug( |
547 | - "queueing command (total: %d): %s", |
548 | - len(self.to_do), command.__class__.__name__) |
549 | + "command %s started (total: %d/%d)", |
550 | + command.__class__.__name__, self.download_done + self.upload_done, |
551 | + len(self.to_do)) |
552 | self.file_discovery_bubble.new_file_found() |
553 | |
554 | def download_finished(self, command): |
555 | @@ -730,7 +757,10 @@ |
556 | if command.deflated_size is not None: |
557 | self.progress[ |
558 | (command.share_id, command.node_id)] = command.deflated_size |
559 | - logger.debug("unqueueing command: %s", command.__class__.__name__) |
560 | + logger.debug( |
561 | + "command %s done (total: %d/%d)", |
562 | + command.__class__.__name__, self.download_done + self.upload_done, |
563 | + len(self.to_do)) |
564 | self.update_progressbar() |
565 | |
566 | def upload_started(self, command): |
567 | @@ -742,15 +772,21 @@ |
568 | if command.deflated_size is not None: |
569 | self.to_do[ |
570 | (command.share_id, command.node_id)] = command.deflated_size |
571 | + logger.debug( |
572 | + 'to_do[(%s, %s)] set to %i', command.share_id, |
573 | + command.node_id, command.deflated_size) |
574 | # pylint: disable=W0201 |
575 | if not self.uploading_filename: |
576 | self.uploading_filename = self.files_uploading[0].path.split( |
577 | os.path.sep)[-1] |
578 | + logger.debug( |
579 | + 'uploading_filename set to %s' % self.uploading_filename) |
580 | # pylint: enable=W0201 |
581 | self.update_progressbar() |
582 | logger.debug( |
583 | - "queueing command (total: %d): %s", len(self.to_do), |
584 | - command.__class__.__name__) |
585 | + "command %s started (total: %d/%d)", |
586 | + command.__class__.__name__, self.download_done + self.upload_done, |
587 | + len(self.to_do)) |
588 | self.file_discovery_bubble.new_file_found() |
589 | |
590 | def upload_finished(self, command): |
591 | @@ -761,7 +797,10 @@ |
592 | if command.deflated_size is not None: |
593 | self.progress[ |
594 | (command.share_id, command.node_id)] = command.deflated_size |
595 | - logger.debug("unqueueing command: %s", command.__class__.__name__) |
596 | + logger.debug( |
597 | + "command %s done (total: %d/%d)", |
598 | + command.__class__.__name__, self.download_done + self.upload_done, |
599 | + len(self.to_do)) |
600 | self.update_progressbar() |
601 | |
602 | def progress_made(self, share_id, node_id, n_bytes_written, deflated_size): |
603 | @@ -794,48 +833,61 @@ |
604 | |
605 | def file_published(self, public_url): |
606 | """A file was published.""" |
607 | + logger.debug('file published event received. url: %s', public_url) |
608 | status_event = FilePublishingStatus(new_public_url=public_url) |
609 | self.notification.send_notification( |
610 | UBUNTUONE_TITLE, status_event.one()) |
611 | |
612 | def file_unpublished(self, public_url): # pylint: disable=W0613 |
613 | """A file was unpublished.""" |
614 | + logger.debug('file unpublished event received. url: %s', public_url) |
615 | self.notification.send_notification( |
616 | UBUNTUONE_TITLE, FileUnpublishingStatus().one()) |
617 | |
618 | def download_started(self, command): |
619 | """A file was queued for download.""" |
620 | + logger.debug('download started event received. command: %r', command) |
621 | self.aggregator.download_started(command) |
622 | |
623 | def download_finished(self, command): |
624 | """A file download was unqueued.""" |
625 | + logger.debug('download finished event received. command: %r', command) |
626 | self.aggregator.download_finished(command) |
627 | |
628 | def upload_started(self, command): |
629 | """A file was queued for upload.""" |
630 | + logger.debug('upload started event received. command: %r', command) |
631 | self.aggregator.upload_started(command) |
632 | |
633 | def upload_finished(self, command): |
634 | """A file upload was unqueued.""" |
635 | + logger.debug('upload finished event received. command: %r', command) |
636 | self.aggregator.upload_finished(command) |
637 | |
638 | def progress_made(self, share_id, node_id, n_bytes_written, deflated_size): |
639 | """Progress made on up- or download.""" |
640 | + logger.debug( |
641 | + 'progress made event received. share_id %s, node_id %s, ' |
642 | + 'n_bytes_written %i, deflated_size %i', |
643 | + share_id, node_id, n_bytes_written, deflated_size) |
644 | self.aggregator.progress_made( |
645 | share_id, node_id, n_bytes_written, deflated_size) |
646 | |
647 | def queue_done(self): |
648 | """The queue is empty.""" |
649 | + logger.debug('queue done event received.') |
650 | self.aggregator.queue_done() |
651 | |
652 | def new_share_available(self, share): |
653 | """A new share is available for subscription.""" |
654 | + logger.debug('new share available event received. share: %r', share) |
655 | self.messaging.show_message(share.other_visible_name) |
656 | self.notification.send_notification( |
657 | UBUNTUONE_TITLE, ShareAvailableStatus(share=share).one()) |
658 | |
659 | def new_udf_available(self, udf): |
660 | """A new udf is available for subscription.""" |
661 | + logger.debug('new udf available event received. udf: %r', udf) |
662 | if udf.subscribed: |
663 | return |
664 | self.notification.send_notification( |
665 | @@ -843,22 +895,24 @@ |
666 | |
667 | def server_connection_lost(self): |
668 | """The client lost the connection to the server.""" |
669 | - logger.debug("server connection lost") |
670 | + logger.debug("server connection lost event received.") |
671 | self.aggregator.connection_lost() |
672 | |
673 | def server_connection_made(self): |
674 | """The client made the connection to the server.""" |
675 | - logger.debug("server connection made") |
676 | + logger.debug("server connection made event received.") |
677 | self.aggregator.connection_made() |
678 | |
679 | def udf_quota_exceeded(self, volume_dict): |
680 | """Quota exceeded in UDF.""" |
681 | - logger.debug("UDF quota exceeded for volume %r." % volume_dict) |
682 | + logger.debug( |
683 | + "UDF quota exceeded event received. volume: %r.", volume_dict) |
684 | alert_user() |
685 | |
686 | def share_quota_exceeded(self, volume_dict): |
687 | """Sharing user's quota exceeded in share.""" |
688 | - logger.debug("Share quota exceeded for volume %r." % volume_dict) |
689 | + logger.debug( |
690 | + "Share quota exceeded event received. volume: %r.", volume_dict) |
691 | if self.quota_timer is not None: |
692 | if self.quota_timer.active: |
693 | return |
694 | @@ -871,7 +925,8 @@ |
695 | |
696 | def root_quota_exceeded(self, volume_dict): |
697 | """Quota exceeded in root.""" |
698 | - logger.debug("Root quota exceeded for volume %r." % volume_dict) |
699 | + logger.debug( |
700 | + "Root quota exceeded event received. volume: %r.", volume_dict) |
701 | alert_user() |
702 | |
703 | def set_show_all_notifications(self, value): |
I still have the problem using this branch, see attached logs in the bug.