Merge lp:~thisfred/ubuntuone-client/filenames-in-notifications into lp:ubuntuone-client

Proposed by Eric Casteleijn
Status: Merged
Approved by: Eric Casteleijn
Approved revision: 916
Merged at revision: 915
Proposed branch: lp:~thisfred/ubuntuone-client/filenames-in-notifications
Merge into: lp:ubuntuone-client
Diff against target: 505 lines (+183/-98)
2 files modified
tests/status/test_aggregator.py (+101/-59)
ubuntuone/status/aggregator.py (+82/-39)
To merge this branch: bzr merge lp:~thisfred/ubuntuone-client/filenames-in-notifications
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Manuel de la Peña (community) Approve
Review via email: mp+52483@code.launchpad.net

Commit message

Added a filename in the downloading/downloaded/uploading/uploaded notifications to give end user more context.

Description of the change

Added a filename in the downloading/downloaded/uploading/uploaded notifications to give end user more context.

Looks like:

"'foo.bar' was downloaded to your computer."

or:

"'baz.qux' and 796 other files are uploading to your personal cloud."

To post a comment you must log in.
Revision history for this message
Manuel de la Peña (mandel) wrote :

AFAIK most of the code from the notification is platform anostic, which means that we can reuse the logic when doing the port (and use something else instead of libnotify, is this right? if that is the case, we might have to remove the /n with os.sep. Since the /n were already in the code, I'll approve and will fix it in the windows branch whenever needed.

review: Approve
Revision history for this message
Eric Casteleijn (thisfred) wrote :

yeah, everything that is not under platform should be agnostic, so let's fix that.

914. By Eric Casteleijn

keep state in the right place

915. By Eric Casteleijn

move property settings outside of __init__ and escape warnings

916. By Eric Casteleijn

added assertions for the filenames being set

Revision history for this message
Alejandro J. Cura (alecu) wrote :

Great branch!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/status/test_aggregator.py'
--- tests/status/test_aggregator.py 2011-03-03 23:29:37 +0000
+++ tests/status/test_aggregator.py 2011-03-09 20:40:33 +0000
@@ -31,6 +31,9 @@
31from ubuntuone.syncdaemon import status_listener31from ubuntuone.syncdaemon import status_listener
32from ubuntuone.syncdaemon.volume_manager import Share, UDF32from ubuntuone.syncdaemon.volume_manager import Share, UDF
3333
34FILENAME = 'example.txt'
35FILENAME2 = 'another_example.mp3'
36
3437
35class PatchedClock(Clock):38class PatchedClock(Clock):
36 """Patch the clock to fix twisted bug #4823."""39 """Patch the clock to fix twisted bug #4823."""
@@ -746,6 +749,9 @@
746class FakeCommand(object):749class FakeCommand(object):
747 """A fake command."""750 """A fake command."""
748751
752 def __init__(self, path=''):
753 self.path = path
754
749755
750class FakeVolumeManager(object):756class FakeVolumeManager(object):
751 """A fake vm."""757 """A fake vm."""
@@ -767,6 +773,8 @@
767 self.queued_commands = set()773 self.queued_commands = set()
768 self.notification_switch = aggregator.NotificationSwitch()774 self.notification_switch = aggregator.NotificationSwitch()
769 self.connected = False775 self.connected = False
776 self.files_uploading = []
777 self.files_downloading = []
770778
771 def queue_done(self):779 def queue_done(self):
772 """The queue completed all operations."""780 """The queue completed all operations."""
@@ -784,18 +792,35 @@
784 """Create a new toggleable notification object."""792 """Create a new toggleable notification object."""
785 return self.notification_switch.build_notification()793 return self.notification_switch.build_notification()
786794
787 download_started = misc_command_queued795 def download_started(self, command):
788 download_finished = misc_command_unqueued796 """A download just started."""
789 upload_started = misc_command_queued797 self.files_downloading.append(command)
790 upload_finished = misc_command_unqueued798 self.misc_command_queued(command)
799
800 def download_finished(self, command):
801 """A download just finished."""
802 if command in self.files_downloading:
803 self.files_downloading.remove(command)
804 self.misc_command_unqueued(command)
805
806 def upload_started(self, command):
807 """An upload just started."""
808 self.files_uploading.append(command)
809 self.misc_command_queued(command)
810
811 def upload_finished(self, command):
812 """An upload just finished."""
813 if command in self.files_uploading:
814 self.files_uploading.remove(command)
815 self.misc_command_unqueued(command)
791816
792 def connection_made(self):817 def connection_made(self):
793 """The client made the connection to the server."""818 """The client made the connection to the server."""
794 self.connected = True819 self.connected = True
795820
796 def connection_lost(self):821 def connection_lost(self):
797 """The client lost the connection to the server."""822 """The client lost the connection to the server."""
798 self.connected = False823 self.connected = False
799824
800825
801class StatusFrontendTestCase(BaseTwistedTestCase):826class StatusFrontendTestCase(BaseTwistedTestCase):
@@ -1255,9 +1280,11 @@
12551280
1256 def test_file_download_started(self):1281 def test_file_download_started(self):
1257 """Test that a file has started download."""1282 """Test that a file has started download."""
1258 fc = FakeCommand()1283 fc = FakeCommand(path='testfile.txt')
1284 self.assertEqual('', self.aggregator.downloading_filename)
1259 self.status_frontend.download_started(fc)1285 self.status_frontend.download_started(fc)
1260 self.assertEqual(self.aggregator.download_total, 1)1286 self.assertEqual(1, self.aggregator.download_total)
1287 self.assertEqual('testfile.txt', self.aggregator.downloading_filename)
1261 self.assertMiscCommandQueued(fc)1288 self.assertMiscCommandQueued(fc)
1262 self.assertEqual(1, self.fake_bubble.count)1289 self.assertEqual(1, self.fake_bubble.count)
12631290
@@ -1271,9 +1298,11 @@
12711298
1272 def test_file_upload_started(self):1299 def test_file_upload_started(self):
1273 """Test that a file has started upload."""1300 """Test that a file has started upload."""
1274 fc = FakeCommand()1301 fc = FakeCommand(path='testfile.txt')
1302 self.assertEqual('', self.aggregator.uploading_filename)
1275 self.status_frontend.upload_started(fc)1303 self.status_frontend.upload_started(fc)
1276 self.assertEqual(self.aggregator.upload_total, 1)1304 self.assertEqual(1, self.aggregator.upload_total)
1305 self.assertEqual('testfile.txt', self.aggregator.uploading_filename)
1277 self.assertMiscCommandQueued(fc)1306 self.assertMiscCommandQueued(fc)
1278 self.assertEqual(1, self.fake_bubble.count)1307 self.assertEqual(1, self.fake_bubble.count)
12791308
@@ -1289,10 +1318,18 @@
1289 """Test the message that's shown on the discovery bubble."""1318 """Test the message that's shown on the discovery bubble."""
1290 uploading = 101319 uploading = 10
1291 downloading = 81320 downloading = 8
1292 self.aggregator.files_uploading.extend(range(uploading))1321 filename = 'upfile0.ext'
1293 self.aggregator.files_downloading.extend(range(downloading))1322 filename2 = 'downfile0.ext'
1294 expected = (aggregator.files_being_uploaded(uploading) +1323 self.aggregator.files_uploading.extend([
1295 "\n" + aggregator.files_being_downloaded(downloading))1324 FakeCommand(path='upfile%d.ext' % n) for n in range(uploading)])
1325 self.aggregator.uploading_filename = filename
1326 self.aggregator.files_downloading.extend([
1327 FakeCommand(path='downfile%d.ext' % n) for n in
1328 range(downloading)])
1329 self.aggregator.downloading_filename = filename2
1330 expected = (
1331 aggregator.files_being_uploaded(filename, uploading) + "\n" +
1332 aggregator.files_being_downloaded(filename2, downloading))
1296 result = self.aggregator.get_discovery_message()1333 result = self.aggregator.get_discovery_message()
1297 self.assertEqual(expected, result)1334 self.assertEqual(expected, result)
12981335
@@ -1300,44 +1337,44 @@
1300 """Test the message that's shown on the progress bubble."""1337 """Test the message that's shown on the progress bubble."""
1301 self.aggregator.upload_done = 51338 self.aggregator.upload_done = 5
1302 self.aggregator.upload_total = 101339 self.aggregator.upload_total = 10
1340 self.aggregator.uploading_filename = FILENAME
1303 self.aggregator.download_done = 31341 self.aggregator.download_done = 3
1304 self.aggregator.download_total = 81342 self.aggregator.download_total = 8
1343 self.aggregator.downloading_filename = FILENAME2
1305 self.aggregator.done_counter = 91344 self.aggregator.done_counter = 9
1306 self.aggregator.total_counter = 201345 self.aggregator.total_counter = 20
1307 percentage = int(100.0 * self.aggregator.done_counter /1346 percentage = int(100.0 * self.aggregator.done_counter /
1308 self.aggregator.total_counter)1347 self.aggregator.total_counter)
1309 format_args = {1348
1310 "percentage_completed": percentage,1349 expected = (
1311 }1350 aggregator.files_being_uploaded(
13121351 FILENAME, self.aggregator.upload_total) + "\n" +
1313 format_string = (1352 aggregator.files_being_downloaded(
1314 aggregator.files_being_uploaded(self.aggregator.upload_total) +1353 FILENAME2, self.aggregator.download_total) + "\n" +
1315 "\n" +1354 aggregator.PROGRESS_COMPLETED) % {
1316 aggregator.files_being_downloaded(self.aggregator.download_total) +1355 'percentage_completed': percentage}
1317 "\n" + aggregator.PROGRESS_COMPLETED)1356
1318
1319 expected = format_string % format_args
1320 result = self.aggregator.get_progress_message()1357 result = self.aggregator.get_progress_message()
1321 self.assertEqual(expected, result)1358 self.assertEqual(expected, result)
13221359
1323 def test_get_progress_message_no_uploads(self):1360 def test_get_progress_message_no_uploads(self):
1324 """The progress message when no uploads are going on."""1361 """The progress message when no uploads are going on."""
1362
1325 self.aggregator.upload_done = 01363 self.aggregator.upload_done = 0
1326 self.aggregator.upload_total = 01364 self.aggregator.upload_total = 0
1365 self.aggregator.downloading_filename = FILENAME
1327 self.aggregator.download_done = 31366 self.aggregator.download_done = 3
1328 self.aggregator.download_total = 81367 self.aggregator.download_total = 8
1329 self.aggregator.done_counter = 91368 self.aggregator.done_counter = 9
1330 self.aggregator.total_counter = 201369 self.aggregator.total_counter = 20
1331 percentage = int(100.0 * self.aggregator.done_counter /1370 percentage = int(100.0 * self.aggregator.done_counter /
1332 self.aggregator.total_counter)1371 self.aggregator.total_counter)
1333 format_args = {1372 expected = (
1334 "percentage_completed": percentage}1373 aggregator.files_being_downloaded(
13351374 FILENAME, self.aggregator.download_total) + "\n" +
1336 format_string = (1375 aggregator.PROGRESS_COMPLETED) % {
1337 aggregator.files_being_downloaded(self.aggregator.download_total) +1376 'percentage_completed': percentage}
1338 "\n" + aggregator.PROGRESS_COMPLETED)1377
1339
1340 expected = format_string % format_args
1341 result = self.aggregator.get_progress_message()1378 result = self.aggregator.get_progress_message()
1342 self.assertEqual(expected, result)1379 self.assertEqual(expected, result)
13431380
@@ -1345,21 +1382,19 @@
1345 """The progress message when no downloads are going on."""1382 """The progress message when no downloads are going on."""
1346 self.aggregator.upload_done = 51383 self.aggregator.upload_done = 5
1347 self.aggregator.upload_total = 101384 self.aggregator.upload_total = 10
1385 self.aggregator.uploading_filename = FILENAME
1348 self.aggregator.download_done = 01386 self.aggregator.download_done = 0
1349 self.aggregator.download_total = 01387 self.aggregator.download_total = 0
1350 self.aggregator.done_counter = 91388 self.aggregator.done_counter = 9
1351 self.aggregator.total_counter = 201389 self.aggregator.total_counter = 20
1352 percentage = int(100.0 * self.aggregator.done_counter /1390 percentage = int(100.0 * self.aggregator.done_counter /
1353 self.aggregator.total_counter)1391 self.aggregator.total_counter)
1354 format_args = {1392 expected = (
1355 "percentage_completed": percentage,1393 aggregator.files_being_uploaded(
1356 }1394 FILENAME, self.aggregator.upload_total) +
13571395 "\n" + aggregator.PROGRESS_COMPLETED) % {
1358 format_string = (1396 'percentage_completed': percentage}
1359 aggregator.files_being_uploaded(self.aggregator.upload_total) +1397
1360 "\n" + aggregator.PROGRESS_COMPLETED)
1361
1362 expected = format_string % format_args
1363 result = self.aggregator.get_progress_message()1398 result = self.aggregator.get_progress_message()
1364 self.assertEqual(expected, result)1399 self.assertEqual(expected, result)
13651400
@@ -1371,40 +1406,47 @@
1371 def test_get_final_status_message(self):1406 def test_get_final_status_message(self):
1372 """The final status message."""1407 """The final status message."""
1373 done = (5, 10)1408 done = (5, 10)
1409 self.aggregator.uploading_filename = FILENAME
1410 self.aggregator.downloading_filename = FILENAME2
1374 self.aggregator.upload_done, self.aggregator.download_done = done1411 self.aggregator.upload_done, self.aggregator.download_done = done
13751412
1376 format_string = (1413 expected = (
1377 aggregator.FINAL_COMPLETED + "\n" +1414 aggregator.FINAL_COMPLETED + "\n" +
1378 aggregator.files_were_uploaded(self.aggregator.upload_done) +1415 aggregator.files_were_uploaded(
1379 "\n" +1416 FILENAME, self.aggregator.upload_done) + "\n" +
1380 aggregator.files_were_downloaded(self.aggregator.download_done))1417 aggregator.files_were_downloaded(
1418 FILENAME2, self.aggregator.download_done))
13811419
1382 result = self.aggregator.get_final_status_message()1420 result = self.aggregator.get_final_status_message()
1383 self.assertEqual(format_string, result)1421 self.assertEqual(expected, result)
13841422
1385 def test_get_final_status_message_no_uploads(self):1423 def test_get_final_status_message_no_uploads(self):
1386 """The final status message when there were no uploads."""1424 """The final status message when there were no uploads."""
1387 done = (0, 12)1425 done = (0, 12)
1388 self.aggregator.upload_done, self.aggregator.download_done = done1426 self.aggregator.upload_done, self.aggregator.download_done = done
1427 self.aggregator.downloading_filename = FILENAME2
13891428
1390 format_string = (aggregator.FINAL_COMPLETED + "\n" +1429 expected = (
1391 aggregator.files_were_downloaded(1430 aggregator.FINAL_COMPLETED + "\n" +
1392 self.aggregator.download_done))1431 aggregator.files_were_downloaded(
1432 FILENAME2, self.aggregator.download_done))
13931433
1394 result = self.aggregator.get_final_status_message()1434 result = self.aggregator.get_final_status_message()
1395 self.assertEqual(format_string, result)1435 self.assertEqual(expected, result)
13961436
1397 def test_get_final_status_message_no_downloads(self):1437 def test_get_final_status_message_no_downloads(self):
1398 """The final status message when there were no downloads."""1438 """The final status message when there were no downloads."""
1399 done = (8, 0)1439 done = (8, 0)
1400 self.aggregator.upload_done, self.aggregator.download_done = done1440 self.aggregator.upload_done, self.aggregator.download_done = done
1441 self.aggregator.uploading_filename = FILENAME
14011442
1402 format_string = (aggregator.FINAL_COMPLETED + "\n" +1443 expected = (
1403 aggregator.files_were_uploaded(1444 aggregator.FINAL_COMPLETED + "\n" +
1404 self.aggregator.upload_done))1445 aggregator.files_were_uploaded(
1446 FILENAME, self.aggregator.upload_done))
14051447
1406 result = self.aggregator.get_final_status_message()1448 result = self.aggregator.get_final_status_message()
1407 self.assertEqual(format_string, result)1449 self.assertEqual(expected, result)
14081450
1409 def test_started_progress_bubble(self):1451 def test_started_progress_bubble(self):
1410 """The progress bubble is started."""1452 """The progress bubble is started."""
@@ -1490,7 +1532,7 @@
1490 self.patch(aggregator, "UbuntuOneLauncher", FakeLauncher)1532 self.patch(aggregator, "UbuntuOneLauncher", FakeLauncher)
1491 self.patch(aggregator.session, "Inhibitor", FakeInhibitor)1533 self.patch(aggregator.session, "Inhibitor", FakeInhibitor)
1492 clock = PatchedClock()1534 clock = PatchedClock()
1493 upload = FakeCommand()1535 upload = FakeCommand(path='upload.foo')
1494 sf = aggregator.StatusFrontend(clock=clock)1536 sf = aggregator.StatusFrontend(clock=clock)
1495 sf.set_show_all_notifications(True)1537 sf.set_show_all_notifications(True)
14961538
@@ -1507,7 +1549,7 @@
1507 clock.advance(aggregator.FileDiscoveryGatheringState.initial_delay)1549 clock.advance(aggregator.FileDiscoveryGatheringState.initial_delay)
1508 # files found notification1550 # files found notification
1509 self.assertEqual(1, len(notifications_shown))1551 self.assertEqual(1, len(notifications_shown))
1510 download = FakeCommand()1552 download = FakeCommand('download.bar')
1511 sf.download_started(download)1553 sf.download_started(download)
1512 self.assertEqual(1, len(notifications_shown))1554 self.assertEqual(1, len(notifications_shown))
1513 # the progress still is zero1555 # the progress still is zero
15141556
=== modified file 'ubuntuone/status/aggregator.py'
--- ubuntuone/status/aggregator.py 2011-03-03 23:29:37 +0000
+++ ubuntuone/status/aggregator.py 2011-03-09 20:40:33 +0000
@@ -53,50 +53,72 @@
53FILE_SYNC_IN_PROGRESS = Q_("File synchronization in progress")53FILE_SYNC_IN_PROGRESS = Q_("File synchronization in progress")
5454
5555
56def files_being_uploaded(files_uploading):56def files_being_uploaded(filename, files_uploading):
57 """Get the i18n string for files being uploaded."""57 """Get the i18n string for files being uploaded."""
58 format_args = {"total_uploading_files": files_uploading}58 other_files = files_uploading - 1
59 if other_files < 1:
60 return Q_(
61 "'%(filename)s' is being uploaded to your personal cloud.") % {
62 'filename': filename}
63 format_args = {
64 "filename": filename, "other_files": other_files}
59 return gettext.dngettext(65 return gettext.dngettext(
60 GETTEXT_PACKAGE,66 GETTEXT_PACKAGE,
61 "%(total_uploading_files)d file is being uploaded to your personal "67 "'%(filename)s' and %(other_files)d other file is being "
62 "cloud.",68 "uploaded to your personal cloud.",
63 "%(total_uploading_files)d files are being uploaded to your personal "69 "'%(filename)s' and %(other_files)d other files are being "
64 "cloud.",70 "uploaded to your personal cloud.", other_files) % format_args
65 files_uploading) % format_args71
6672
6773def files_being_downloaded(filename, files_downloading):
68def files_being_downloaded(files_downloading):
69 """Get the i18n string for files being downloaded."""74 """Get the i18n string for files being downloaded."""
70 format_args = {"total_downloading_files": files_downloading}75 other_files = files_downloading - 1
76 if other_files < 1:
77 return Q_(
78 "'%(filename)s' is being downloaded to your computer.") % {
79 'filename': filename}
80 format_args = {
81 "filename": filename, "other_files": other_files}
71 return gettext.dngettext(82 return gettext.dngettext(
72 GETTEXT_PACKAGE,83 GETTEXT_PACKAGE,
73 "%(total_downloading_files)d file is being downloaded to your "84 "'%(filename)s' and %(other_files)d other file is being "
74 "computer.",85 "downloaded to your computer.",
75 "%(total_downloading_files)d files are being downloaded to "86 "'%(filename)s' and %(other_files)d other files are being "
76 "your computer.",87 "downloaded to your computer.", other_files) % format_args
77 files_downloading) % format_args88
7889
7990def files_were_uploaded(filename, upload_done):
80def files_were_uploaded(upload_done):
81 """Get the i18n string for files that were uploaded."""91 """Get the i18n string for files that were uploaded."""
82 format_args = {'total_uploaded_files': upload_done}92 other_files = upload_done - 1
93 if other_files < 1:
94 return Q_(
95 "'%(filename)s' was uploaded to your personal cloud.") % {
96 'filename': filename}
97 format_args = {
98 'filename': filename, 'other_files': other_files}
83 return gettext.dngettext(99 return gettext.dngettext(
84 GETTEXT_PACKAGE,100 GETTEXT_PACKAGE,
85 "%(total_uploaded_files)d file was uploaded to your personal "101 "'%(filename)s' and %(other_files)d other file was uploaded to "
86 "cloud.",102 "your personal cloud.",
87 "%(total_uploaded_files)d files were uploaded to your "103 "'%(filename)s' and %(other_files)d other files were uploaded "
88 "personal cloud.", upload_done) % format_args104 "to your personal cloud.", other_files) % format_args
89105
90106
91def files_were_downloaded(download_done):107def files_were_downloaded(filename, download_done):
92 """Get the i18n string for files that were downloaded."""108 """Get the i18n string for files that were downloaded."""
93 format_args = {'total_downloaded_files': download_done}109 other_files = download_done - 1
110 if other_files < 1:
111 return Q_(
112 "'%(filename)s' was downloaded to your computer.") % {
113 'filename': filename}
114 format_args = {
115 'filename': filename, 'other_files': other_files}
94 return gettext.dngettext(116 return gettext.dngettext(
95 GETTEXT_PACKAGE,117 GETTEXT_PACKAGE,
96 "%(total_downloaded_files)d file was downloaded to your "118 "'%(filename)s' and %(other_files)d other file was "
97 "computer.",119 "downloaded to your computer.",
98 "%(total_downloaded_files)d files were downloaded to your "120 "'%(filename)s' and %(other_files)d other files were "
99 "computer.", download_done) % format_args121 "downloaded to your computer.", other_files) % format_args
100122
101123
102class ToggleableNotification(object):124class ToggleableNotification(object):
@@ -592,6 +614,7 @@
592 """Create a new toggleable notification object."""614 """Create a new toggleable notification object."""
593 return self.notification_switch.build_notification()615 return self.notification_switch.build_notification()
594616
617 # pylint: disable=W0201
595 def reset(self):618 def reset(self):
596 """Reset all counters and notifications."""619 """Reset all counters and notifications."""
597 self.total_counter = 0620 self.total_counter = 0
@@ -601,7 +624,9 @@
601 self.upload_total = 0624 self.upload_total = 0
602 self.upload_done = 0625 self.upload_done = 0
603 self.files_uploading = []626 self.files_uploading = []
627 self.uploading_filename = ''
604 self.files_downloading = []628 self.files_downloading = []
629 self.downloading_filename = ''
605630
606 if self.file_discovery_bubble:631 if self.file_discovery_bubble:
607 self.file_discovery_bubble.cleanup()632 self.file_discovery_bubble.cleanup()
@@ -615,17 +640,21 @@
615 if self.final_status_bubble:640 if self.final_status_bubble:
616 self.final_status_bubble.cleanup()641 self.final_status_bubble.cleanup()
617 self.final_status_bubble = FinalStatusBubble(self)642 self.final_status_bubble = FinalStatusBubble(self)
643 # pylint: enable=W0201
618644
619 def get_discovery_message(self):645 def get_discovery_message(self):
620 """Get the text for the discovery bubble."""646 """Get the text for the discovery bubble."""
621 lines = []647 lines = []
622 files_uploading = len(self.files_uploading)648 files_uploading = len(self.files_uploading)
623 if files_uploading > 0:649 if files_uploading > 0:
624 lines.append(files_being_uploaded(files_uploading))650 lines.append(files_being_uploaded(
625651 self.uploading_filename, files_uploading))
626 files_downloading = len(self.files_downloading)652 files_downloading = len(self.files_downloading)
627 if files_downloading > 0:653 if files_downloading > 0:
628 lines.append(files_being_downloaded(files_downloading))654 self.downloading_filename = self.files_downloading[0].path.split(
655 os.path.sep)[-1]
656 lines.append(files_being_downloaded(
657 self.downloading_filename, files_downloading))
629 return "\n".join(lines)658 return "\n".join(lines)
630659
631 def get_progress_message(self):660 def get_progress_message(self):
@@ -634,10 +663,12 @@
634 parts = []663 parts = []
635 upload_total = self.upload_total664 upload_total = self.upload_total
636 if upload_total:665 if upload_total:
637 parts.append(files_being_uploaded(upload_total))666 parts.append(files_being_uploaded(
667 self.uploading_filename, upload_total))
638 download_total = self.download_total668 download_total = self.download_total
639 if download_total:669 if download_total:
640 parts.append(files_being_downloaded(download_total))670 parts.append(files_being_downloaded(
671 self.downloading_filename, download_total))
641 progress_percentage = 100.0 * self.done_counter / self.total_counter672 progress_percentage = 100.0 * self.done_counter / self.total_counter
642 format_args = {"percentage_completed": int(progress_percentage)}673 format_args = {"percentage_completed": int(progress_percentage)}
643 parts.append(PROGRESS_COMPLETED % format_args)674 parts.append(PROGRESS_COMPLETED % format_args)
@@ -649,11 +680,13 @@
649 parts.append(FINAL_COMPLETED)680 parts.append(FINAL_COMPLETED)
650 upload_done = self.upload_done681 upload_done = self.upload_done
651 if upload_done:682 if upload_done:
652 parts.append(files_were_uploaded(upload_done))683 parts.append(files_were_uploaded(
684 self.uploading_filename, upload_done))
653685
654 download_done = self.download_done686 download_done = self.download_done
655 if download_done:687 if download_done:
656 parts.append(files_were_downloaded(download_done))688 parts.append(files_were_downloaded(
689 self.downloading_filename, download_done))
657 return "\n".join(parts)690 return "\n".join(parts)
658691
659 def restart_progress_bubble(self):692 def restart_progress_bubble(self):
@@ -689,6 +722,11 @@
689 """A download just started."""722 """A download just started."""
690 self.files_downloading.append(command)723 self.files_downloading.append(command)
691 self.download_total += 1724 self.download_total += 1
725 # pylint: disable=W0201
726 if not self.downloading_filename:
727 self.downloading_filename = self.files_downloading[0].path.split(
728 os.path.sep)[-1]
729 # pylint: enable=W0201
692 self.misc_command_queued(command)730 self.misc_command_queued(command)
693 self.file_discovery_bubble.new_file_found()731 self.file_discovery_bubble.new_file_found()
694732
@@ -703,6 +741,11 @@
703 """An upload just started."""741 """An upload just started."""
704 self.files_uploading.append(command)742 self.files_uploading.append(command)
705 self.upload_total += 1743 self.upload_total += 1
744 # pylint: disable=W0201
745 if not self.uploading_filename:
746 self.uploading_filename = self.files_uploading[0].path.split(
747 os.path.sep)[-1]
748 # pylint: enable=W0201
706 self.misc_command_queued(command)749 self.misc_command_queued(command)
707 self.file_discovery_bubble.new_file_found()750 self.file_discovery_bubble.new_file_found()
708751

Subscribers

People subscribed via source and target branches