summaryrefslogtreecommitdiff
path: root/community-testing/ubuntuone-client/1339_1338.diff
blob: cbd966a70daade480452331a96878ae583c045c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
=== modified file 'tests/platform/sync_menu/test_linux.py'
--- tests/platform/sync_menu/test_linux.py	2012-10-10 14:54:49 +0000
+++ tests/platform/sync_menu/test_linux.py	2012-10-11 12:01:27 +0000
@@ -124,6 +124,7 @@
         """Check that the dummy has the proper methods required by the API."""
         dummy = linux.DummySyncMenu('random', 'args')
         self.assertIsInstance(dummy.update_transfers, Callable)
+        self.assertIsInstance(dummy.sync_status_changed, Callable)
 
 
 class SyncMenuTestCase(TestCase):

=== modified file 'ubuntuone/platform/sync_menu/linux.py'
--- ubuntuone/platform/sync_menu/linux.py	2012-10-10 17:06:14 +0000
+++ ubuntuone/platform/sync_menu/linux.py	2012-10-11 13:00:10 +0000
@@ -183,7 +183,7 @@
             self.timer.addCallback(self._timeout)
 
 
-class TransfersMenu(Dbusmenu.Menuitem):
+class TransfersMenu(Dbusmenu.Menuitem if use_syncmenu else object):
     """Menu that handles the recent and current transfers."""
 
     def __init__(self, status_frontend):
@@ -227,7 +227,7 @@
         items_added = 0
         remove = []
         for item in self._uploading_items:
-            if item in uploading_data:
+            if item in uploading_data.keys():
                 size, written = uploading_data[item]
                 percentage = written * 100 / size
                 upload_item = self._uploading_items[item]
@@ -243,7 +243,7 @@
         for item in remove:
             self._uploading_items.pop(item)
         if items_added < 5:
-            for item in uploading_data:
+            for item in uploading_data.keys():
                 if item not in self._uploading_items and items_added < 5:
                     size, written = uploading_data[item]
                     percentage = written * 100 / size
@@ -270,4 +270,12 @@
     def update_transfers(self):
         """Do nothing."""
 
-UbuntuOneSyncMenu = UbuntuOneSyncMenuLinux if use_syncmenu else DummySyncMenu
+    def sync_status_changed(self):
+        """Do nothing."""
+
+
+if use_syncmenu:
+    UbuntuOneSyncMenu = UbuntuOneSyncMenuLinux
+else:
+    UbuntuOneSyncMenu = DummySyncMenu
+    TransfersMenu = None