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 | 257 | self.assertNotIn(notification, | 257 | self.assertNotIn(notification, |
6 | 258 | self.toggleable.notification.notifications_shown) | 258 | self.toggleable.notification.notifications_shown) |
7 | 259 | 259 | ||
10 | 260 | def test_send_notification_passes_thru(self): | 260 | def test_send_notification_passes_through(self): |
11 | 261 | """The send_notification method passes thru.""" | 261 | """The send_notification method passes through.""" |
12 | 262 | args = (1, 2, 3, 4) | 262 | args = (1, 2, 3, 4) |
13 | 263 | self.toggleable.send_notification(*args) | 263 | self.toggleable.send_notification(*args) |
14 | 264 | self.assertShown(args) | 264 | self.assertShown(args) |
15 | @@ -339,7 +339,7 @@ | |||
16 | 339 | """The popup callback shows notifications.""" | 339 | """The popup callback shows notifications.""" |
17 | 340 | self.bubble.connection_made() | 340 | self.bubble.connection_made() |
18 | 341 | self.bubble.new_file_found() | 341 | self.bubble.new_file_found() |
20 | 342 | self.bubble._popup() | 342 | self.bubble.popup() |
21 | 343 | message = self.aggregator.build_discovery_message() | 343 | message = self.aggregator.build_discovery_message() |
22 | 344 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) | 344 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) |
23 | 345 | self.assertIn(notification, self.get_notifications_shown()) | 345 | self.assertIn(notification, self.get_notifications_shown()) |
24 | @@ -355,7 +355,7 @@ | |||
25 | 355 | def test_popup_shows_no_notification_before_connection_made(self): | 355 | def test_popup_shows_no_notification_before_connection_made(self): |
26 | 356 | """The popup callback shows notifications.""" | 356 | """The popup callback shows notifications.""" |
27 | 357 | self.bubble.new_file_found() | 357 | self.bubble.new_file_found() |
29 | 358 | self.bubble._popup() | 358 | self.bubble.popup() |
30 | 359 | message = self.aggregator.build_discovery_message() | 359 | message = self.aggregator.build_discovery_message() |
31 | 360 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) | 360 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) |
32 | 361 | self.assertNotIn(notification, self.get_notifications_shown()) | 361 | self.assertNotIn(notification, self.get_notifications_shown()) |
33 | @@ -365,7 +365,7 @@ | |||
34 | 365 | self.bubble.connection_made() | 365 | self.bubble.connection_made() |
35 | 366 | self.bubble.connection_lost() | 366 | self.bubble.connection_lost() |
36 | 367 | self.bubble.new_file_found() | 367 | self.bubble.new_file_found() |
38 | 368 | self.bubble._popup() | 368 | self.bubble.popup() |
39 | 369 | message = self.aggregator.build_discovery_message() | 369 | message = self.aggregator.build_discovery_message() |
40 | 370 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) | 370 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) |
41 | 371 | self.assertNotIn(notification, self.get_notifications_shown()) | 371 | self.assertNotIn(notification, self.get_notifications_shown()) |
42 | @@ -374,7 +374,7 @@ | |||
43 | 374 | """The notification is printed in the debug log.""" | 374 | """The notification is printed in the debug log.""" |
44 | 375 | self.bubble.connection_made() | 375 | self.bubble.connection_made() |
45 | 376 | self.bubble.new_file_found() | 376 | self.bubble.new_file_found() |
47 | 377 | self.bubble._popup() | 377 | self.bubble.popup() |
48 | 378 | msg = "notification shown: %s" % self.get_notifications_shown()[0][1] | 378 | msg = "notification shown: %s" % self.get_notifications_shown()[0][1] |
49 | 379 | self.assertTrue(self.handler.check_debug(msg)) | 379 | self.assertTrue(self.handler.check_debug(msg)) |
50 | 380 | 380 | ||
51 | @@ -466,9 +466,9 @@ | |||
52 | 466 | """The update callback updates notifications.""" | 466 | """The update callback updates notifications.""" |
53 | 467 | self.bubble.connection_made() | 467 | self.bubble.connection_made() |
54 | 468 | self.bubble.new_file_found() | 468 | self.bubble.new_file_found() |
56 | 469 | self.bubble._popup() | 469 | self.bubble.popup() |
57 | 470 | self.bubble.new_file_found() | 470 | self.bubble.new_file_found() |
59 | 471 | self.bubble._update() | 471 | self.bubble.update() |
60 | 472 | message = self.aggregator.build_discovery_message() | 472 | message = self.aggregator.build_discovery_message() |
61 | 473 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) | 473 | notification = (aggregator.UBUNTUONE_TITLE, message, None, False) |
62 | 474 | self.assertIn(notification, self.get_notifications_shown()) | 474 | self.assertIn(notification, self.get_notifications_shown()) |
63 | @@ -477,9 +477,9 @@ | |||
64 | 477 | """The notification is logged when _update is called.""" | 477 | """The notification is logged when _update is called.""" |
65 | 478 | self.bubble.connection_made() | 478 | self.bubble.connection_made() |
66 | 479 | self.bubble.new_file_found() | 479 | self.bubble.new_file_found() |
68 | 480 | self.bubble._popup() | 480 | self.bubble.popup() |
69 | 481 | self.bubble.new_file_found() | 481 | self.bubble.new_file_found() |
71 | 482 | self.bubble._update() | 482 | self.bubble.update() |
72 | 483 | msg = "notification updated: %s" % self.get_notifications_shown()[1][1] | 483 | msg = "notification updated: %s" % self.get_notifications_shown()[1][1] |
73 | 484 | self.assertTrue(self.handler.check_debug(msg)) | 484 | self.assertTrue(self.handler.check_debug(msg)) |
74 | 485 | 485 | ||
75 | @@ -494,7 +494,6 @@ | |||
76 | 494 | self.clock = PatchedClock() | 494 | self.clock = PatchedClock() |
77 | 495 | self.aggregator = FakeStatusAggregator(clock=self.clock) | 495 | self.aggregator = FakeStatusAggregator(clock=self.clock) |
78 | 496 | self.bubble = aggregator.FinalStatusBubble(self.aggregator) | 496 | self.bubble = aggregator.FinalStatusBubble(self.aggregator) |
79 | 497 | self.addCleanup(self.bubble.cleanup) | ||
80 | 498 | 497 | ||
81 | 499 | def test_notification_not_shown_initially(self): | 498 | def test_notification_not_shown_initially(self): |
82 | 500 | """The notification is not shown initially.""" | 499 | """The notification is not shown initially.""" |
83 | @@ -1181,6 +1180,9 @@ | |||
84 | 1181 | def connection_lost(self): | 1180 | def connection_lost(self): |
85 | 1182 | """Connection lost.""" | 1181 | """Connection lost.""" |
86 | 1183 | 1182 | ||
87 | 1183 | def set_idle(self): | ||
88 | 1184 | """Reset this bubble to the initial state.""" | ||
89 | 1185 | |||
90 | 1184 | 1186 | ||
91 | 1185 | class FakeFinalBubble(object): | 1187 | class FakeFinalBubble(object): |
92 | 1186 | """A fake FinalStatusBubble.""" | 1188 | """A fake FinalStatusBubble.""" |
93 | @@ -1229,15 +1231,17 @@ | |||
94 | 1229 | self.assertEqual(0, self.aggregator.download_done) | 1231 | self.assertEqual(0, self.aggregator.download_done) |
95 | 1230 | self.assertEqual(0, self.aggregator.upload_done) | 1232 | self.assertEqual(0, self.aggregator.upload_done) |
96 | 1231 | self.assertEqual(0, len(self.aggregator.files_uploading)) | 1233 | self.assertEqual(0, len(self.aggregator.files_uploading)) |
97 | 1234 | self.assertEqual('', self.aggregator.uploading_filename) | ||
98 | 1232 | self.assertEqual(0, len(self.aggregator.files_downloading)) | 1235 | self.assertEqual(0, len(self.aggregator.files_downloading)) |
99 | 1236 | self.assertEqual('', self.aggregator.downloading_filename) | ||
100 | 1237 | self.assertIdentical(None, self.aggregator.queue_done_timer) | ||
101 | 1233 | self.assertEqual({}, self.aggregator.progress) | 1238 | self.assertEqual({}, self.aggregator.progress) |
102 | 1234 | self.assertEqual({}, self.aggregator.to_do) | 1239 | self.assertEqual({}, self.aggregator.to_do) |
103 | 1235 | self.assertIdentical(None, self.aggregator.queue_done_timer) | ||
104 | 1236 | 1240 | ||
105 | 1237 | def assertMiscCommandQueued(self, fc): | 1241 | def assertMiscCommandQueued(self, fc): |
106 | 1238 | """Assert that some command was queued.""" | 1242 | """Assert that some command was queued.""" |
107 | 1239 | self.assertEqual(len(self.aggregator.to_do), 1) | 1243 | self.assertEqual(len(self.aggregator.to_do), 1) |
109 | 1240 | message = "queueing command (total: 1): %s" % fc.__class__.__name__ | 1244 | message = "command %s started (total: 0/1)" % fc.__class__.__name__ |
110 | 1241 | self.assertEqual(fc.deflated_size, sum(self.aggregator.to_do.values())) | 1245 | self.assertEqual(fc.deflated_size, sum(self.aggregator.to_do.values())) |
111 | 1242 | self.assertTrue(self.handler.check_debug(message)) | 1246 | self.assertTrue(self.handler.check_debug(message)) |
112 | 1243 | self.assertTrue(self.aggregator.progress_bar.visible) | 1247 | self.assertTrue(self.aggregator.progress_bar.visible) |
113 | @@ -1246,7 +1250,7 @@ | |||
114 | 1246 | """Assert that some command was unqueued.""" | 1250 | """Assert that some command was unqueued.""" |
115 | 1247 | self.assertEqual( | 1251 | self.assertEqual( |
116 | 1248 | 1, self.aggregator.download_done + self.aggregator.upload_done) | 1252 | 1, self.aggregator.download_done + self.aggregator.upload_done) |
118 | 1249 | message = "unqueueing command: %s" % fc.__class__.__name__ | 1253 | message = "command %s done (total: 1/1)" % fc.__class__.__name__ |
119 | 1250 | self.assertTrue(self.handler.check_debug(message)) | 1254 | self.assertTrue(self.handler.check_debug(message)) |
120 | 1251 | 1255 | ||
121 | 1252 | def test_counters_start_at_zero(self): | 1256 | def test_counters_start_at_zero(self): |
122 | @@ -1565,3 +1569,69 @@ | |||
123 | 1565 | self.assertEqual(0, len(notifications_shown)) | 1569 | self.assertEqual(0, len(notifications_shown)) |
124 | 1566 | sf.queue_done() | 1570 | sf.queue_done() |
125 | 1567 | self.assertEqual(0, len(notifications_shown)) | 1571 | self.assertEqual(0, len(notifications_shown)) |
126 | 1572 | |||
127 | 1573 | def test_queue_done_resets_filename(self): | ||
128 | 1574 | """Bug LP: #807005""" | ||
129 | 1575 | self.patch(aggregator, "ToggleableNotification", | ||
130 | 1576 | FakeNotificationSingleton()) | ||
131 | 1577 | self.patch(aggregator, "UbuntuOneLauncher", FakeLauncher) | ||
132 | 1578 | self.patch(aggregator.session, "Inhibitor", FakeInhibitor) | ||
133 | 1579 | clock = PatchedClock() | ||
134 | 1580 | upload = FakeCommand(path='upload.foo') | ||
135 | 1581 | sf = aggregator.StatusFrontend(clock=clock) | ||
136 | 1582 | sf.server_connection_made() | ||
137 | 1583 | sf.set_show_all_notifications(True) | ||
138 | 1584 | sf.upload_started(upload) | ||
139 | 1585 | notifications_shown = ( | ||
140 | 1586 | sf.aggregator.file_discovery_bubble. | ||
141 | 1587 | notification.notifications_shown) | ||
142 | 1588 | # no notifications shown yet | ||
143 | 1589 | self.assertEqual(0, len(notifications_shown)) | ||
144 | 1590 | clock.advance(aggregator.FileDiscoveryGatheringState.initial_timeout) | ||
145 | 1591 | # files found notification | ||
146 | 1592 | self.assertEqual(1, len(notifications_shown)) | ||
147 | 1593 | sf.upload_finished(upload) | ||
148 | 1594 | sf.queue_done() | ||
149 | 1595 | clock.advance(sf.aggregator.finished_delay * 2) | ||
150 | 1596 | self.assertEqual(2, len(notifications_shown)) | ||
151 | 1597 | final_text = notifications_shown[-1][1] | ||
152 | 1598 | upload2 = FakeCommand(path='upload.bar') | ||
153 | 1599 | sf.upload_started(upload2) | ||
154 | 1600 | # no notifications shown yet | ||
155 | 1601 | self.assertEqual(2, len(notifications_shown)) | ||
156 | 1602 | clock.advance(aggregator.FileDiscoveryGatheringState.initial_timeout) | ||
157 | 1603 | # files found notification | ||
158 | 1604 | self.assertEqual(3, len(notifications_shown)) | ||
159 | 1605 | sf.upload_finished(upload2) | ||
160 | 1606 | sf.queue_done() | ||
161 | 1607 | clock.advance(sf.aggregator.finished_delay * 2) | ||
162 | 1608 | self.assertEqual(4, len(notifications_shown)) | ||
163 | 1609 | self.assertNotEqual(final_text, notifications_shown[-1][1]) | ||
164 | 1610 | |||
165 | 1611 | def test_queue_done_resets_filename2(self): | ||
166 | 1612 | """Bug LP: #807005""" | ||
167 | 1613 | self.patch(aggregator, "ToggleableNotification", | ||
168 | 1614 | FakeNotificationSingleton()) | ||
169 | 1615 | self.patch(aggregator, "UbuntuOneLauncher", FakeLauncher) | ||
170 | 1616 | self.patch(aggregator.session, "Inhibitor", FakeInhibitor) | ||
171 | 1617 | clock = PatchedClock() | ||
172 | 1618 | upload = FakeCommand(path='upload.foo') | ||
173 | 1619 | sf = aggregator.StatusFrontend(clock=clock) | ||
174 | 1620 | sf.server_connection_made() | ||
175 | 1621 | sf.set_show_all_notifications(True) | ||
176 | 1622 | sf.upload_started(upload) | ||
177 | 1623 | sf.upload_started(upload) | ||
178 | 1624 | sf.upload_started(upload) | ||
179 | 1625 | notifications_shown = ( | ||
180 | 1626 | sf.aggregator.file_discovery_bubble. | ||
181 | 1627 | notification.notifications_shown) | ||
182 | 1628 | # no notifications shown yet | ||
183 | 1629 | self.assertEqual(0, len(notifications_shown)) | ||
184 | 1630 | clock.advance( | ||
185 | 1631 | aggregator.FileDiscoveryGatheringState.initial_timeout) | ||
186 | 1632 | # files found notification | ||
187 | 1633 | self.assertEqual(1, len(notifications_shown)) | ||
188 | 1634 | sf.upload_finished(upload) | ||
189 | 1635 | sf.queue_done() | ||
190 | 1636 | clock.advance(sf.aggregator.finished_delay * 2) | ||
191 | 1637 | self.assertEqual(2, len(notifications_shown)) | ||
192 | 1568 | 1638 | ||
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 | 59 | self.newly_created_local_files = set() | 59 | self.newly_created_local_files = set() |
198 | 60 | 60 | ||
199 | 61 | def handle_AQ_CREATE_SHARE_OK(self, share_id, marker): | 61 | def handle_AQ_CREATE_SHARE_OK(self, share_id, marker): |
201 | 62 | """Log the 'directory shared thru the server' event.""" | 62 | """Log the 'directory shared through the server' event.""" |
202 | 63 | share_id = str(share_id) | 63 | share_id = str(share_id) |
203 | 64 | share = self.vm.shared.get(share_id) | 64 | share = self.vm.shared.get(share_id) |
204 | 65 | if not share: | 65 | if not share: |
205 | @@ -68,7 +68,7 @@ | |||
206 | 68 | self.log_folder_shared(share, share_id) | 68 | self.log_folder_shared(share, share_id) |
207 | 69 | 69 | ||
208 | 70 | def handle_AQ_SHARE_INVITATION_SENT(self, marker): | 70 | def handle_AQ_SHARE_INVITATION_SENT(self, marker): |
210 | 71 | """Log the 'directory shared thru http' event.""" | 71 | """Log the 'directory shared through http' event.""" |
211 | 72 | share = self.vm.marker_share_map[marker] | 72 | share = self.vm.marker_share_map[marker] |
212 | 73 | mdo = self.fsm.get_by_mdid(marker) | 73 | mdo = self.fsm.get_by_mdid(marker) |
213 | 74 | self.log_folder_shared(share, mdo.share_id) | 74 | self.log_folder_shared(share, mdo.share_id) |
214 | 75 | 75 | ||
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 | 15 | # | 15 | # |
220 | 16 | # You should have received a copy of the GNU General Public License along | 16 | # You should have received a copy of the GNU General Public License along |
221 | 17 | # with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
223 | 18 | """Inhibit session logout when busy thru the Gnome Session DBus service.""" | 18 | """Inhibit session logout when busy through the Gnome Session DBus service.""" |
224 | 19 | 19 | ||
225 | 20 | import dbus | 20 | import dbus |
226 | 21 | 21 | ||
227 | 22 | 22 | ||
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 | 51 | """Set the launcher to urgent to alert the user.""" | 51 | """Set the launcher to urgent to alert the user.""" |
233 | 52 | launcher = UbuntuOneLauncher() | 52 | launcher = UbuntuOneLauncher() |
234 | 53 | launcher.set_urgent() | 53 | launcher.set_urgent() |
235 | 54 | logger.debug("Launcher set to urgent.") | ||
236 | 54 | 55 | ||
237 | 55 | 56 | ||
238 | 56 | def files_being_uploaded(filename, files_uploading): | 57 | def files_being_uploaded(filename, files_uploading): |
239 | @@ -130,9 +131,14 @@ | |||
240 | 130 | self.notification = Notification() | 131 | self.notification = Notification() |
241 | 131 | 132 | ||
242 | 132 | def send_notification(self, *args): | 133 | def send_notification(self, *args): |
244 | 133 | """Passthru the notification.""" | 134 | """Pass through the notification.""" |
245 | 134 | if self.notification_switch.enabled: | 135 | if self.notification_switch.enabled: |
246 | 136 | logger.debug( | ||
247 | 137 | "Displayed notification with arguments %r.", args) | ||
248 | 135 | return self.notification.send_notification(*args) | 138 | return self.notification.send_notification(*args) |
249 | 139 | logger.debug( | ||
250 | 140 | "Asked to display notification with arguments %r, but " | ||
251 | 141 | "notifications switched off.", args) | ||
252 | 136 | 142 | ||
253 | 137 | 143 | ||
254 | 138 | class NotificationSwitch(object): | 144 | class NotificationSwitch(object): |
255 | @@ -150,10 +156,12 @@ | |||
256 | 150 | def enable_notifications(self): | 156 | def enable_notifications(self): |
257 | 151 | """Turn the switch on.""" | 157 | """Turn the switch on.""" |
258 | 152 | self.enabled = True | 158 | self.enabled = True |
259 | 159 | logger.debug("Notifications enabled.") | ||
260 | 153 | 160 | ||
261 | 154 | def disable_notifications(self): | 161 | def disable_notifications(self): |
262 | 155 | """Turn the switch off.""" | 162 | """Turn the switch off.""" |
263 | 156 | self.enabled = False | 163 | self.enabled = False |
264 | 164 | logger.debug("Notifications disabled.") | ||
265 | 157 | 165 | ||
266 | 158 | 166 | ||
267 | 159 | class StatusEvent(object): | 167 | class StatusEvent(object): |
268 | @@ -187,7 +195,7 @@ | |||
269 | 187 | def many(self, events): | 195 | def many(self, events): |
270 | 188 | """Show the number of files if many event of this type.""" | 196 | """Show the number of files if many event of this type.""" |
271 | 189 | no_of_files = len(events) | 197 | no_of_files = len(events) |
273 | 190 | gettext.dngettext( | 198 | return gettext.dngettext( |
274 | 191 | GETTEXT_PACKAGE, | 199 | GETTEXT_PACKAGE, |
275 | 192 | "%(event_count)d file was just made public.", | 200 | "%(event_count)d file was just made public.", |
276 | 193 | "%(event_count)d files were just made public.", | 201 | "%(event_count)d files were just made public.", |
277 | @@ -203,7 +211,7 @@ | |||
278 | 203 | def many(self, events): | 211 | def many(self, events): |
279 | 204 | """Show the number of files if many event of this type.""" | 212 | """Show the number of files if many event of this type.""" |
280 | 205 | no_of_files = len(events) | 213 | no_of_files = len(events) |
282 | 206 | gettext.dngettext( | 214 | return gettext.dngettext( |
283 | 207 | GETTEXT_PACKAGE, | 215 | GETTEXT_PACKAGE, |
284 | 208 | "%(event_count)d file is no longer published.", | 216 | "%(event_count)d file is no longer published.", |
285 | 209 | "%(event_count)d files are no longer published.", | 217 | "%(event_count)d files are no longer published.", |
286 | @@ -218,7 +226,7 @@ | |||
287 | 218 | def many(self, events): | 226 | def many(self, events): |
288 | 219 | """Show the number of files if many event of this type.""" | 227 | """Show the number of files if many event of this type.""" |
289 | 220 | no_of_files = len(events) | 228 | no_of_files = len(events) |
291 | 221 | gettext.dngettext( | 229 | return gettext.dngettext( |
292 | 222 | GETTEXT_PACKAGE, | 230 | GETTEXT_PACKAGE, |
293 | 223 | "Found %(event_count)d new cloud folder.", | 231 | "Found %(event_count)d new cloud folder.", |
294 | 224 | "Found %(event_count)d new cloud folders.", | 232 | "Found %(event_count)d new cloud folders.", |
295 | @@ -288,21 +296,30 @@ | |||
296 | 288 | def cancel_if_active(self, call): | 296 | def cancel_if_active(self, call): |
297 | 289 | """Cancel a call if it is active.""" | 297 | """Cancel a call if it is active.""" |
298 | 290 | if call.active(): | 298 | if call.active(): |
299 | 299 | logger.debug('callback %r cancelled.', call.func) | ||
300 | 291 | call.cancel() | 300 | call.cancel() |
301 | 292 | 301 | ||
302 | 293 | def cleanup(self): | 302 | def cleanup(self): |
303 | 294 | """Cancel all active calls.""" | 303 | """Cancel all active calls.""" |
304 | 295 | self.cancel_if_active(self.delay_call) | 304 | self.cancel_if_active(self.delay_call) |
305 | 305 | logger.debug('%r cleaned up.', self) | ||
306 | 296 | 306 | ||
307 | 297 | def callback(self, result=None): | 307 | def callback(self, result=None): |
308 | 298 | """Make sure the timers are stopped when firing the callback.""" | 308 | """Make sure the timers are stopped when firing the callback.""" |
309 | 299 | self.cleanup() | 309 | self.cleanup() |
310 | 300 | defer.Deferred.callback(self, result) | 310 | defer.Deferred.callback(self, result) |
311 | 301 | 311 | ||
312 | 312 | def errback(self, failure=None): | ||
313 | 313 | """Log the failure.""" | ||
314 | 314 | logger.error('Failure in %s %r: %r', self.__class__, self, failure) | ||
315 | 315 | defer.Deferred.errback(self, failure) | ||
316 | 316 | |||
317 | 302 | def reset(self): | 317 | def reset(self): |
318 | 303 | """Reset the delay.""" | 318 | """Reset the delay.""" |
319 | 304 | if not self.called: | 319 | if not self.called: |
320 | 305 | self.delay_call.reset(self.delay) | 320 | self.delay_call.reset(self.delay) |
321 | 321 | logger.debug( | ||
322 | 322 | '%s %r delay reset to %.2f.', self.__class__, self, self.delay) | ||
323 | 306 | 323 | ||
324 | 307 | @property | 324 | @property |
325 | 308 | def active(self): | 325 | def active(self): |
326 | @@ -345,7 +362,7 @@ | |||
327 | 345 | 362 | ||
328 | 346 | def new_file_found(self): | 363 | def new_file_found(self): |
329 | 347 | """New files found.""" | 364 | """New files found.""" |
331 | 348 | self.bubble._start() | 365 | self.bubble.start() |
332 | 349 | 366 | ||
333 | 350 | 367 | ||
334 | 351 | class FileDiscoveryGatheringState(FileDiscoveryBaseState): | 368 | class FileDiscoveryGatheringState(FileDiscoveryBaseState): |
335 | @@ -365,7 +382,7 @@ | |||
336 | 365 | def _timeout(self, result): | 382 | def _timeout(self, result): |
337 | 366 | """Show the notification bubble.""" | 383 | """Show the notification bubble.""" |
338 | 367 | self.cleanup() | 384 | self.cleanup() |
340 | 368 | self.bubble._popup() | 385 | self.bubble.popup() |
341 | 369 | 386 | ||
342 | 370 | def new_file_found(self): | 387 | def new_file_found(self): |
343 | 371 | """New files found.""" | 388 | """New files found.""" |
344 | @@ -396,7 +413,7 @@ | |||
345 | 396 | 413 | ||
346 | 397 | def _update(self, result): | 414 | def _update(self, result): |
347 | 398 | """The bubble should be updated.""" | 415 | """The bubble should be updated.""" |
349 | 399 | self.bubble._update() | 416 | self.bubble.update() |
350 | 400 | 417 | ||
351 | 401 | def new_file_found(self): | 418 | def new_file_found(self): |
352 | 402 | """New files found.""" | 419 | """New files found.""" |
353 | @@ -424,7 +441,7 @@ | |||
354 | 424 | 441 | ||
355 | 425 | def _timeout(self, result): | 442 | def _timeout(self, result): |
356 | 426 | """Move the notification to the idle state.""" | 443 | """Move the notification to the idle state.""" |
358 | 427 | self.bubble._set_idle() | 444 | self.bubble.set_idle() |
359 | 428 | 445 | ||
360 | 429 | def cleanup(self): | 446 | def cleanup(self): |
361 | 430 | """Clean up the timers.""" | 447 | """Clean up the timers.""" |
362 | @@ -449,25 +466,29 @@ | |||
363 | 449 | self.files_found = False | 466 | self.files_found = False |
364 | 450 | self.clock = clock | 467 | self.clock = clock |
365 | 451 | self.status_aggregator = status_aggregator | 468 | self.status_aggregator = status_aggregator |
367 | 452 | self._set_idle() | 469 | self.set_idle() |
368 | 453 | self.notification = None | 470 | self.notification = None |
369 | 454 | 471 | ||
370 | 455 | def _change_state(self, new_state_class): | 472 | def _change_state(self, new_state_class): |
371 | 456 | """Change to a new state.""" | 473 | """Change to a new state.""" |
372 | 457 | if self.state: | 474 | if self.state: |
373 | 458 | self.state.cleanup() | 475 | self.state.cleanup() |
374 | 476 | old_state = self.state.__class__ | ||
375 | 459 | self.state = new_state_class(self) | 477 | self.state = new_state_class(self) |
376 | 478 | logger.debug( | ||
377 | 479 | "FileDiscoveryBubble state changed from %s to %s", | ||
378 | 480 | old_state, new_state_class) | ||
379 | 460 | 481 | ||
381 | 461 | def _set_idle(self): | 482 | def set_idle(self): |
382 | 462 | """Reset this bubble to the initial state.""" | 483 | """Reset this bubble to the initial state.""" |
383 | 463 | self._change_state(FileDiscoveryIdleState) | 484 | self._change_state(FileDiscoveryIdleState) |
384 | 464 | 485 | ||
386 | 465 | def _start(self): | 486 | def start(self): |
387 | 466 | """The first file was found, so start gathering.""" | 487 | """The first file was found, so start gathering.""" |
388 | 467 | self.notification = self.status_aggregator.get_notification() | 488 | self.notification = self.status_aggregator.get_notification() |
389 | 468 | self._change_state(FileDiscoveryGatheringState) | 489 | self._change_state(FileDiscoveryGatheringState) |
390 | 469 | 490 | ||
392 | 470 | def _popup(self): | 491 | def popup(self): |
393 | 471 | """Display the notification.""" | 492 | """Display the notification.""" |
394 | 472 | if not self.connected: | 493 | if not self.connected: |
395 | 473 | return | 494 | return |
396 | @@ -477,7 +498,7 @@ | |||
397 | 477 | logger.debug("notification shown: %s", text) | 498 | logger.debug("notification shown: %s", text) |
398 | 478 | self._change_state(FileDiscoveryUpdateState) | 499 | self._change_state(FileDiscoveryUpdateState) |
399 | 479 | 500 | ||
401 | 480 | def _update(self): | 501 | def update(self): |
402 | 481 | """Update the notification.""" | 502 | """Update the notification.""" |
403 | 482 | if not self.connected: | 503 | if not self.connected: |
404 | 483 | return | 504 | return |
405 | @@ -498,7 +519,7 @@ | |||
406 | 498 | """Connection made.""" | 519 | """Connection made.""" |
407 | 499 | self.connected = True | 520 | self.connected = True |
408 | 500 | if self.files_found: | 521 | if self.files_found: |
410 | 501 | self._popup() | 522 | self.popup() |
411 | 502 | 523 | ||
412 | 503 | def connection_lost(self): | 524 | def connection_lost(self): |
413 | 504 | """Connection lost.""" | 525 | """Connection lost.""" |
414 | @@ -512,6 +533,7 @@ | |||
415 | 512 | 533 | ||
416 | 513 | class ProgressBar(object): | 534 | class ProgressBar(object): |
417 | 514 | """Update a progressbar no more than 10 times a second.""" | 535 | """Update a progressbar no more than 10 times a second.""" |
418 | 536 | |||
419 | 515 | pulsating = True | 537 | pulsating = True |
420 | 516 | visible = False | 538 | visible = False |
421 | 517 | progress = 0.0 | 539 | progress = 0.0 |
422 | @@ -534,11 +556,11 @@ | |||
423 | 534 | self.timer.cleanup() | 556 | self.timer.cleanup() |
424 | 535 | self.timer = None | 557 | self.timer = None |
425 | 536 | 558 | ||
427 | 537 | def _timeout(self, result): | 559 | def _timeout(self, _): |
428 | 538 | """The aggregating timer has expired, so update the UI.""" | 560 | """The aggregating timer has expired, so update the UI.""" |
429 | 539 | self.timer = None | 561 | self.timer = None |
430 | 540 | self.launcher.set_progress(self.progress) | 562 | self.launcher.set_progress(self.progress) |
432 | 541 | logger.debug("progressbar updated: %f", self.progress) | 563 | logger.debug("progressbar set to: %.2f", self.progress) |
433 | 542 | 564 | ||
434 | 543 | def set_progress(self, progress): | 565 | def set_progress(self, progress): |
435 | 544 | """Steps amount changed. Set up a timer if there isn't one ticking.""" | 566 | """Steps amount changed. Set up a timer if there isn't one ticking.""" |
436 | @@ -579,9 +601,6 @@ | |||
437 | 579 | """Initialize this instance.""" | 601 | """Initialize this instance.""" |
438 | 580 | self.status_aggregator = status_aggregator | 602 | self.status_aggregator = status_aggregator |
439 | 581 | 603 | ||
440 | 582 | def cleanup(self): | ||
441 | 583 | """Clean up this instance.""" | ||
442 | 584 | |||
443 | 585 | def show(self): | 604 | def show(self): |
444 | 586 | """Show the final status notification.""" | 605 | """Show the final status notification.""" |
445 | 587 | self.notification = self.status_aggregator.get_notification() | 606 | self.notification = self.status_aggregator.get_notification() |
446 | @@ -601,17 +620,15 @@ | |||
447 | 601 | 620 | ||
448 | 602 | file_discovery_bubble = None | 621 | file_discovery_bubble = None |
449 | 603 | final_status_bubble = None | 622 | final_status_bubble = None |
450 | 623 | queue_done_timer = None | ||
451 | 624 | finished_delay = 10 | ||
452 | 604 | 625 | ||
453 | 605 | def __init__(self, clock=reactor): | 626 | def __init__(self, clock=reactor): |
454 | 606 | """Initialize this instance.""" | 627 | """Initialize this instance.""" |
455 | 607 | self.clock = clock | 628 | self.clock = clock |
456 | 608 | self.notification_switch = NotificationSwitch() | 629 | self.notification_switch = NotificationSwitch() |
457 | 609 | self.queue_done_timer = None | ||
458 | 610 | self.reset() | ||
459 | 611 | self.progress_bar = ProgressBar(clock=self.clock) | 630 | self.progress_bar = ProgressBar(clock=self.clock) |
463 | 612 | self.finished_delay = 10 | 631 | self.reset() |
461 | 613 | self.progress = {} | ||
462 | 614 | self.to_do = {} | ||
464 | 615 | 632 | ||
465 | 616 | def get_notification(self): | 633 | def get_notification(self): |
466 | 617 | """Create a new toggleable notification object.""" | 634 | """Create a new toggleable notification object.""" |
467 | @@ -629,17 +646,17 @@ | |||
468 | 629 | if self.queue_done_timer is not None: | 646 | if self.queue_done_timer is not None: |
469 | 630 | self.queue_done_timer.cleanup() | 647 | self.queue_done_timer.cleanup() |
470 | 631 | self.queue_done_timer = None | 648 | self.queue_done_timer = None |
471 | 632 | |||
472 | 633 | if self.file_discovery_bubble: | 649 | if self.file_discovery_bubble: |
473 | 634 | self.file_discovery_bubble.cleanup() | 650 | self.file_discovery_bubble.cleanup() |
479 | 635 | self.file_discovery_bubble = FileDiscoveryBubble(self, | 651 | self.file_discovery_bubble.set_idle() |
480 | 636 | clock=self.clock) | 652 | else: |
481 | 637 | 653 | self.file_discovery_bubble = FileDiscoveryBubble( | |
482 | 638 | if self.final_status_bubble: | 654 | self, clock=self.clock) |
478 | 639 | self.final_status_bubble.cleanup() | ||
483 | 640 | self.final_status_bubble = FinalStatusBubble(self) | 655 | self.final_status_bubble = FinalStatusBubble(self) |
484 | 641 | self.progress = {} | 656 | self.progress = {} |
485 | 642 | self.to_do = {} | 657 | self.to_do = {} |
486 | 658 | logger.debug("All status aggregation information reset.") | ||
487 | 659 | |||
488 | 643 | # pylint: enable=W0201 | 660 | # pylint: enable=W0201 |
489 | 644 | 661 | ||
490 | 645 | def get_discovery_message(self): | 662 | def get_discovery_message(self): |
491 | @@ -674,9 +691,9 @@ | |||
492 | 674 | 691 | ||
493 | 675 | def _queue_done(self, _): | 692 | def _queue_done(self, _): |
494 | 676 | """Show final bubble and reset counters.""" | 693 | """Show final bubble and reset counters.""" |
495 | 694 | logger.debug("queue done callback fired") | ||
496 | 677 | self.queue_done_timer.cleanup() | 695 | self.queue_done_timer.cleanup() |
497 | 678 | self.queue_done_timer = None | 696 | self.queue_done_timer = None |
498 | 679 | logger.debug("queue done callback fired") | ||
499 | 680 | if self.upload_done + self.download_done > 0: | 697 | if self.upload_done + self.download_done > 0: |
500 | 681 | self.final_status_bubble.show() | 698 | self.final_status_bubble.show() |
501 | 682 | self.progress_bar.completed() | 699 | self.progress_bar.completed() |
502 | @@ -685,15 +702,16 @@ | |||
503 | 685 | def queue_done(self): | 702 | def queue_done(self): |
504 | 686 | """Queue is finished.""" | 703 | """Queue is finished.""" |
505 | 687 | if not self.to_do: | 704 | if not self.to_do: |
506 | 705 | logger.debug("queue done but no events to process.") | ||
507 | 688 | return | 706 | return |
508 | 689 | if self.queue_done_timer is None: | 707 | if self.queue_done_timer is None: |
509 | 690 | logger.debug("queue done callback added") | ||
510 | 691 | self.queue_done_timer = Timer( | 708 | self.queue_done_timer = Timer( |
511 | 692 | self.finished_delay, clock=self.clock) | 709 | self.finished_delay, clock=self.clock) |
512 | 693 | self.queue_done_timer.addCallback(self._queue_done) | 710 | self.queue_done_timer.addCallback(self._queue_done) |
513 | 711 | logger.debug("queue done callback added") | ||
514 | 694 | return | 712 | return |
515 | 713 | self.queue_done_timer.reset() | ||
516 | 695 | logger.debug("queue done callback reset") | 714 | logger.debug("queue done callback reset") |
517 | 696 | self.queue_done_timer.reset() | ||
518 | 697 | 715 | ||
519 | 698 | def update_progressbar(self): | 716 | def update_progressbar(self): |
520 | 699 | """Update the counters of the progressbar.""" | 717 | """Update the counters of the progressbar.""" |
521 | @@ -701,6 +719,9 @@ | |||
522 | 701 | progress = float( | 719 | progress = float( |
523 | 702 | sum(self.progress.values())) / sum(self.to_do.values()) | 720 | sum(self.progress.values())) / sum(self.to_do.values()) |
524 | 703 | self.progress_bar.set_progress(progress) | 721 | self.progress_bar.set_progress(progress) |
525 | 722 | return | ||
526 | 723 | logger.debug( | ||
527 | 724 | "Update progress bar called while we have zero todo items.") | ||
528 | 704 | 725 | ||
529 | 705 | def download_started(self, command): | 726 | def download_started(self, command): |
530 | 706 | """A download just started.""" | 727 | """A download just started.""" |
531 | @@ -711,15 +732,21 @@ | |||
532 | 711 | if command.deflated_size is not None: | 732 | if command.deflated_size is not None: |
533 | 712 | self.to_do[ | 733 | self.to_do[ |
534 | 713 | (command.share_id, command.node_id)] = command.deflated_size | 734 | (command.share_id, command.node_id)] = command.deflated_size |
535 | 735 | logger.debug( | ||
536 | 736 | 'to_do[(%s, %s)] set to %i', command.share_id, | ||
537 | 737 | command.node_id, command.deflated_size) | ||
538 | 714 | # pylint: disable=W0201 | 738 | # pylint: disable=W0201 |
539 | 715 | if not self.downloading_filename: | 739 | if not self.downloading_filename: |
540 | 716 | self.downloading_filename = self.files_downloading[0].path.split( | 740 | self.downloading_filename = self.files_downloading[0].path.split( |
541 | 717 | os.path.sep)[-1] | 741 | os.path.sep)[-1] |
542 | 742 | logger.debug( | ||
543 | 743 | 'downloading_filename set to %s' % self.downloading_filename) | ||
544 | 718 | # pylint: enable=W0201 | 744 | # pylint: enable=W0201 |
545 | 719 | self.update_progressbar() | 745 | self.update_progressbar() |
546 | 720 | logger.debug( | 746 | logger.debug( |
549 | 721 | "queueing command (total: %d): %s", | 747 | "command %s started (total: %d/%d)", |
550 | 722 | len(self.to_do), command.__class__.__name__) | 748 | command.__class__.__name__, self.download_done + self.upload_done, |
551 | 749 | len(self.to_do)) | ||
552 | 723 | self.file_discovery_bubble.new_file_found() | 750 | self.file_discovery_bubble.new_file_found() |
553 | 724 | 751 | ||
554 | 725 | def download_finished(self, command): | 752 | def download_finished(self, command): |
555 | @@ -730,7 +757,10 @@ | |||
556 | 730 | if command.deflated_size is not None: | 757 | if command.deflated_size is not None: |
557 | 731 | self.progress[ | 758 | self.progress[ |
558 | 732 | (command.share_id, command.node_id)] = command.deflated_size | 759 | (command.share_id, command.node_id)] = command.deflated_size |
560 | 733 | logger.debug("unqueueing command: %s", command.__class__.__name__) | 760 | logger.debug( |
561 | 761 | "command %s done (total: %d/%d)", | ||
562 | 762 | command.__class__.__name__, self.download_done + self.upload_done, | ||
563 | 763 | len(self.to_do)) | ||
564 | 734 | self.update_progressbar() | 764 | self.update_progressbar() |
565 | 735 | 765 | ||
566 | 736 | def upload_started(self, command): | 766 | def upload_started(self, command): |
567 | @@ -742,15 +772,21 @@ | |||
568 | 742 | if command.deflated_size is not None: | 772 | if command.deflated_size is not None: |
569 | 743 | self.to_do[ | 773 | self.to_do[ |
570 | 744 | (command.share_id, command.node_id)] = command.deflated_size | 774 | (command.share_id, command.node_id)] = command.deflated_size |
571 | 775 | logger.debug( | ||
572 | 776 | 'to_do[(%s, %s)] set to %i', command.share_id, | ||
573 | 777 | command.node_id, command.deflated_size) | ||
574 | 745 | # pylint: disable=W0201 | 778 | # pylint: disable=W0201 |
575 | 746 | if not self.uploading_filename: | 779 | if not self.uploading_filename: |
576 | 747 | self.uploading_filename = self.files_uploading[0].path.split( | 780 | self.uploading_filename = self.files_uploading[0].path.split( |
577 | 748 | os.path.sep)[-1] | 781 | os.path.sep)[-1] |
578 | 782 | logger.debug( | ||
579 | 783 | 'uploading_filename set to %s' % self.uploading_filename) | ||
580 | 749 | # pylint: enable=W0201 | 784 | # pylint: enable=W0201 |
581 | 750 | self.update_progressbar() | 785 | self.update_progressbar() |
582 | 751 | logger.debug( | 786 | logger.debug( |
585 | 752 | "queueing command (total: %d): %s", len(self.to_do), | 787 | "command %s started (total: %d/%d)", |
586 | 753 | command.__class__.__name__) | 788 | command.__class__.__name__, self.download_done + self.upload_done, |
587 | 789 | len(self.to_do)) | ||
588 | 754 | self.file_discovery_bubble.new_file_found() | 790 | self.file_discovery_bubble.new_file_found() |
589 | 755 | 791 | ||
590 | 756 | def upload_finished(self, command): | 792 | def upload_finished(self, command): |
591 | @@ -761,7 +797,10 @@ | |||
592 | 761 | if command.deflated_size is not None: | 797 | if command.deflated_size is not None: |
593 | 762 | self.progress[ | 798 | self.progress[ |
594 | 763 | (command.share_id, command.node_id)] = command.deflated_size | 799 | (command.share_id, command.node_id)] = command.deflated_size |
596 | 764 | logger.debug("unqueueing command: %s", command.__class__.__name__) | 800 | logger.debug( |
597 | 801 | "command %s done (total: %d/%d)", | ||
598 | 802 | command.__class__.__name__, self.download_done + self.upload_done, | ||
599 | 803 | len(self.to_do)) | ||
600 | 765 | self.update_progressbar() | 804 | self.update_progressbar() |
601 | 766 | 805 | ||
602 | 767 | def progress_made(self, share_id, node_id, n_bytes_written, deflated_size): | 806 | def progress_made(self, share_id, node_id, n_bytes_written, deflated_size): |
603 | @@ -794,48 +833,61 @@ | |||
604 | 794 | 833 | ||
605 | 795 | def file_published(self, public_url): | 834 | def file_published(self, public_url): |
606 | 796 | """A file was published.""" | 835 | """A file was published.""" |
607 | 836 | logger.debug('file published event received. url: %s', public_url) | ||
608 | 797 | status_event = FilePublishingStatus(new_public_url=public_url) | 837 | status_event = FilePublishingStatus(new_public_url=public_url) |
609 | 798 | self.notification.send_notification( | 838 | self.notification.send_notification( |
610 | 799 | UBUNTUONE_TITLE, status_event.one()) | 839 | UBUNTUONE_TITLE, status_event.one()) |
611 | 800 | 840 | ||
612 | 801 | def file_unpublished(self, public_url): # pylint: disable=W0613 | 841 | def file_unpublished(self, public_url): # pylint: disable=W0613 |
613 | 802 | """A file was unpublished.""" | 842 | """A file was unpublished.""" |
614 | 843 | logger.debug('file unpublished event received. url: %s', public_url) | ||
615 | 803 | self.notification.send_notification( | 844 | self.notification.send_notification( |
616 | 804 | UBUNTUONE_TITLE, FileUnpublishingStatus().one()) | 845 | UBUNTUONE_TITLE, FileUnpublishingStatus().one()) |
617 | 805 | 846 | ||
618 | 806 | def download_started(self, command): | 847 | def download_started(self, command): |
619 | 807 | """A file was queued for download.""" | 848 | """A file was queued for download.""" |
620 | 849 | logger.debug('download started event received. command: %r', command) | ||
621 | 808 | self.aggregator.download_started(command) | 850 | self.aggregator.download_started(command) |
622 | 809 | 851 | ||
623 | 810 | def download_finished(self, command): | 852 | def download_finished(self, command): |
624 | 811 | """A file download was unqueued.""" | 853 | """A file download was unqueued.""" |
625 | 854 | logger.debug('download finished event received. command: %r', command) | ||
626 | 812 | self.aggregator.download_finished(command) | 855 | self.aggregator.download_finished(command) |
627 | 813 | 856 | ||
628 | 814 | def upload_started(self, command): | 857 | def upload_started(self, command): |
629 | 815 | """A file was queued for upload.""" | 858 | """A file was queued for upload.""" |
630 | 859 | logger.debug('upload started event received. command: %r', command) | ||
631 | 816 | self.aggregator.upload_started(command) | 860 | self.aggregator.upload_started(command) |
632 | 817 | 861 | ||
633 | 818 | def upload_finished(self, command): | 862 | def upload_finished(self, command): |
634 | 819 | """A file upload was unqueued.""" | 863 | """A file upload was unqueued.""" |
635 | 864 | logger.debug('upload finished event received. command: %r', command) | ||
636 | 820 | self.aggregator.upload_finished(command) | 865 | self.aggregator.upload_finished(command) |
637 | 821 | 866 | ||
638 | 822 | def progress_made(self, share_id, node_id, n_bytes_written, deflated_size): | 867 | def progress_made(self, share_id, node_id, n_bytes_written, deflated_size): |
639 | 823 | """Progress made on up- or download.""" | 868 | """Progress made on up- or download.""" |
640 | 869 | logger.debug( | ||
641 | 870 | 'progress made event received. share_id %s, node_id %s, ' | ||
642 | 871 | 'n_bytes_written %i, deflated_size %i', | ||
643 | 872 | share_id, node_id, n_bytes_written, deflated_size) | ||
644 | 824 | self.aggregator.progress_made( | 873 | self.aggregator.progress_made( |
645 | 825 | share_id, node_id, n_bytes_written, deflated_size) | 874 | share_id, node_id, n_bytes_written, deflated_size) |
646 | 826 | 875 | ||
647 | 827 | def queue_done(self): | 876 | def queue_done(self): |
648 | 828 | """The queue is empty.""" | 877 | """The queue is empty.""" |
649 | 878 | logger.debug('queue done event received.') | ||
650 | 829 | self.aggregator.queue_done() | 879 | self.aggregator.queue_done() |
651 | 830 | 880 | ||
652 | 831 | def new_share_available(self, share): | 881 | def new_share_available(self, share): |
653 | 832 | """A new share is available for subscription.""" | 882 | """A new share is available for subscription.""" |
654 | 883 | logger.debug('new share available event received. share: %r', share) | ||
655 | 833 | self.messaging.show_message(share.other_visible_name) | 884 | self.messaging.show_message(share.other_visible_name) |
656 | 834 | self.notification.send_notification( | 885 | self.notification.send_notification( |
657 | 835 | UBUNTUONE_TITLE, ShareAvailableStatus(share=share).one()) | 886 | UBUNTUONE_TITLE, ShareAvailableStatus(share=share).one()) |
658 | 836 | 887 | ||
659 | 837 | def new_udf_available(self, udf): | 888 | def new_udf_available(self, udf): |
660 | 838 | """A new udf is available for subscription.""" | 889 | """A new udf is available for subscription.""" |
661 | 890 | logger.debug('new udf available event received. udf: %r', udf) | ||
662 | 839 | if udf.subscribed: | 891 | if udf.subscribed: |
663 | 840 | return | 892 | return |
664 | 841 | self.notification.send_notification( | 893 | self.notification.send_notification( |
665 | @@ -843,22 +895,24 @@ | |||
666 | 843 | 895 | ||
667 | 844 | def server_connection_lost(self): | 896 | def server_connection_lost(self): |
668 | 845 | """The client lost the connection to the server.""" | 897 | """The client lost the connection to the server.""" |
670 | 846 | logger.debug("server connection lost") | 898 | logger.debug("server connection lost event received.") |
671 | 847 | self.aggregator.connection_lost() | 899 | self.aggregator.connection_lost() |
672 | 848 | 900 | ||
673 | 849 | def server_connection_made(self): | 901 | def server_connection_made(self): |
674 | 850 | """The client made the connection to the server.""" | 902 | """The client made the connection to the server.""" |
676 | 851 | logger.debug("server connection made") | 903 | logger.debug("server connection made event received.") |
677 | 852 | self.aggregator.connection_made() | 904 | self.aggregator.connection_made() |
678 | 853 | 905 | ||
679 | 854 | def udf_quota_exceeded(self, volume_dict): | 906 | def udf_quota_exceeded(self, volume_dict): |
680 | 855 | """Quota exceeded in UDF.""" | 907 | """Quota exceeded in UDF.""" |
682 | 856 | logger.debug("UDF quota exceeded for volume %r." % volume_dict) | 908 | logger.debug( |
683 | 909 | "UDF quota exceeded event received. volume: %r.", volume_dict) | ||
684 | 857 | alert_user() | 910 | alert_user() |
685 | 858 | 911 | ||
686 | 859 | def share_quota_exceeded(self, volume_dict): | 912 | def share_quota_exceeded(self, volume_dict): |
687 | 860 | """Sharing user's quota exceeded in share.""" | 913 | """Sharing user's quota exceeded in share.""" |
689 | 861 | logger.debug("Share quota exceeded for volume %r." % volume_dict) | 914 | logger.debug( |
690 | 915 | "Share quota exceeded event received. volume: %r.", volume_dict) | ||
691 | 862 | if self.quota_timer is not None: | 916 | if self.quota_timer is not None: |
692 | 863 | if self.quota_timer.active: | 917 | if self.quota_timer.active: |
693 | 864 | return | 918 | return |
694 | @@ -871,7 +925,8 @@ | |||
695 | 871 | 925 | ||
696 | 872 | def root_quota_exceeded(self, volume_dict): | 926 | def root_quota_exceeded(self, volume_dict): |
697 | 873 | """Quota exceeded in root.""" | 927 | """Quota exceeded in root.""" |
699 | 874 | logger.debug("Root quota exceeded for volume %r." % volume_dict) | 928 | logger.debug( |
700 | 929 | "Root quota exceeded event received. volume: %r.", volume_dict) | ||
701 | 875 | alert_user() | 930 | alert_user() |
702 | 876 | 931 | ||
703 | 877 | def set_show_all_notifications(self, value): | 932 | def set_show_all_notifications(self, value): |
I still have the problem using this branch, see attached logs in the bug.