Merge lp:~diegosarmentero/ubuntuone-client/ipcmenu into lp:ubuntuone-client
- ipcmenu
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Alejandro J. Cura |
Approved revision: | 1298 |
Merged at revision: | 1290 |
Proposed branch: | lp:~diegosarmentero/ubuntuone-client/ipcmenu |
Merge into: | lp:ubuntuone-client |
Prerequisite: | lp:~diegosarmentero/ubuntuone-client/menu |
Diff against target: |
346 lines (+126/-11) 12 files modified
contrib/testing/testcase.py (+6/-0) tests/platform/ipc/test_external_interface.py (+14/-0) tests/platform/test_tools.py (+10/-0) tests/status/test_aggregator.py (+16/-7) ubuntuone/platform/ipc/ipc_client.py (+16/-0) ubuntuone/platform/ipc/linux.py (+33/-0) ubuntuone/platform/ipc/perspective_broker.py (+5/-0) ubuntuone/platform/tools/__init__.py (+7/-0) ubuntuone/status/aggregator.py (+1/-1) ubuntuone/syncdaemon/__init__.py (+5/-0) ubuntuone/syncdaemon/interaction_interfaces.py (+4/-0) ubuntuone/syncdaemon/status_listener.py (+9/-3) |
To merge this branch: | bzr merge lp:~diegosarmentero/ubuntuone-client/ipcmenu |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alejandro J. Cura (community) | Approve | ||
Brian Curtin (community) | Approve | ||
Roberto Alsina (community) | Approve | ||
Review via email: mp+118621@code.launchpad.net |
Commit message
- Adding ipc support to share the menu data (LP: #1032659).
Description of the change
Roberto Alsina (ralsina) : | # |
Brian Curtin (brian.curtin) : | # |
- 1296. By Diego Sarmentero
-
Adding more complete doctrings and making some strings constants.
Diego Sarmentero (diegosarmentero) wrote : | # |
> Please make constants out of the keys for the data dict ('recent-transfers'
> and 'uploading'), so that the strings are only defined once and use those
> constants through the branch. This makes it faster to catch mistakes.
>
> Please provide detailed information on the keys, and very detailed info too on
> the dbus types of each of the possible values, of the dbus dictionary of
> variants returned by the method exposed on dbus. This should be done as a
> multiline docstring of the exported method.
Fixed!
Alejandro J. Cura (alecu) wrote : | # |
19 + return {RECENT_TRANSFERS: (), UPLOADING: ()}
123 + {UPLOADING: expected, RECENT_TRANSFERS: ()})
133 + {UPLOADING: expected, RECENT_TRANSFERS: ()})
All of this should be empty lists, not tuples.
Both in Python and DBus, lists are used to signify collections of homogeneous items, while tuples or dbus.Structs are used for collections of heterogeneous items, so it makes better sense to use lists there.
---
162 +
163 + This method return the following structure:
164 + {
165 + 'recent-transfers': (str),
166 + 'uploading': (str, int, int)
167 + }
This notation does not imply that each of those are lists, and also the doc is not explicit about the contents of each field. Please replace with something like this:
"""
This method returns a dictionary, with the following keys and values:
Key: 'recent-transfers'
Value: a list of strings, each being the name of a file that was recently transferred.
Key: 'uploading'
Value: a list of tuples, with each tuple having the following items:
* str: the name of a file that's currently being uploaded
* int: ???
* int: ???
"""
---
- 1297. By Diego Sarmentero
-
fixing docstrings
- 1298. By Diego Sarmentero
-
fixing tests
Preview Diff
1 | === modified file 'contrib/testing/testcase.py' | |||
2 | --- contrib/testing/testcase.py 2012-06-22 09:59:14 +0000 | |||
3 | +++ contrib/testing/testcase.py 2012-08-13 15:04:21 +0000 | |||
4 | @@ -57,6 +57,8 @@ | |||
5 | 57 | main, | 57 | main, |
6 | 58 | local_rescan, | 58 | local_rescan, |
7 | 59 | tritcask, | 59 | tritcask, |
8 | 60 | RECENT_TRANSFERS, | ||
9 | 61 | UPLOADING, | ||
10 | 60 | ) | 62 | ) |
11 | 61 | from ubuntuone.syncdaemon import logger | 63 | from ubuntuone.syncdaemon import logger |
12 | 62 | from ubuntuone import platform | 64 | from ubuntuone import platform |
13 | @@ -208,6 +210,10 @@ | |||
14 | 208 | 210 | ||
15 | 209 | show_all_notifications = True | 211 | show_all_notifications = True |
16 | 210 | 212 | ||
17 | 213 | def menu_data(self): | ||
18 | 214 | """Fake menu_data.""" | ||
19 | 215 | return {RECENT_TRANSFERS: [], UPLOADING: []} | ||
20 | 216 | |||
21 | 211 | 217 | ||
22 | 212 | class FakeMain(main.Main): | 218 | class FakeMain(main.Main): |
23 | 213 | """ A fake Main class to setup the tests """ | 219 | """ A fake Main class to setup the tests """ |
24 | 214 | 220 | ||
25 | === modified file 'tests/platform/ipc/test_external_interface.py' | |||
26 | --- tests/platform/ipc/test_external_interface.py 2012-08-03 14:56:05 +0000 | |||
27 | +++ tests/platform/ipc/test_external_interface.py 2012-08-13 15:04:21 +0000 | |||
28 | @@ -40,6 +40,10 @@ | |||
29 | 40 | StatusTestCase, | 40 | StatusTestCase, |
30 | 41 | SyncDaemonTestCase, | 41 | SyncDaemonTestCase, |
31 | 42 | ) | 42 | ) |
32 | 43 | from ubuntuone.syncdaemon import ( | ||
33 | 44 | RECENT_TRANSFERS, | ||
34 | 45 | UPLOADING, | ||
35 | 46 | ) | ||
36 | 43 | 47 | ||
37 | 44 | STR = 'something' | 48 | STR = 'something' |
38 | 45 | STR_STR_DICT = {'foo': 'bar'} | 49 | STR_STR_DICT = {'foo': 'bar'} |
39 | @@ -132,6 +136,16 @@ | |||
40 | 132 | self.assert_remote_method('waiting_metadata', | 136 | self.assert_remote_method('waiting_metadata', |
41 | 133 | in_signature=None, out_signature='a(sa{ss})') | 137 | in_signature=None, out_signature='a(sa{ss})') |
42 | 134 | 138 | ||
43 | 139 | @defer.inlineCallbacks | ||
44 | 140 | def test_sync_menu(self): | ||
45 | 141 | """Test sync_menu.""" | ||
46 | 142 | result = {RECENT_TRANSFERS: [], UPLOADING: []} | ||
47 | 143 | method = 'sync_menu' | ||
48 | 144 | yield self.assert_method_called(self.service.status, | ||
49 | 145 | method, result) | ||
50 | 146 | self.assert_remote_method(method, | ||
51 | 147 | in_signature=None, out_signature='a{sv}') | ||
52 | 148 | |||
53 | 135 | 149 | ||
54 | 136 | class EventsTests(EventsTestCase): | 150 | class EventsTests(EventsTestCase): |
55 | 137 | """Basic tests for the Events exposed object.""" | 151 | """Basic tests for the Events exposed object.""" |
56 | 138 | 152 | ||
57 | === modified file 'tests/platform/test_tools.py' | |||
58 | --- tests/platform/test_tools.py 2012-05-30 15:35:49 +0000 | |||
59 | +++ tests/platform/test_tools.py 2012-08-13 15:04:21 +0000 | |||
60 | @@ -36,12 +36,15 @@ | |||
61 | 36 | from ubuntuone.devtools.handlers import MementoHandler | 36 | from ubuntuone.devtools.handlers import MementoHandler |
62 | 37 | 37 | ||
63 | 38 | from contrib.testing.testcase import FakeCommand, skipIfOS | 38 | from contrib.testing.testcase import FakeCommand, skipIfOS |
64 | 39 | |||
65 | 39 | from ubuntuone.syncdaemon import ( | 40 | from ubuntuone.syncdaemon import ( |
66 | 40 | action_queue, | 41 | action_queue, |
67 | 41 | event_queue, | 42 | event_queue, |
68 | 42 | interaction_interfaces, | 43 | interaction_interfaces, |
69 | 43 | states, | 44 | states, |
70 | 44 | volume_manager, | 45 | volume_manager, |
71 | 46 | RECENT_TRANSFERS, | ||
72 | 47 | UPLOADING, | ||
73 | 45 | ) | 48 | ) |
74 | 46 | from ubuntuone.platform import tools | 49 | from ubuntuone.platform import tools |
75 | 47 | from tests.platform import IPCTestCase | 50 | from tests.platform import IPCTestCase |
76 | @@ -243,6 +246,13 @@ | |||
77 | 243 | self.assertEqual('share_id', result['volume_id']) | 246 | self.assertEqual('share_id', result['volume_id']) |
78 | 244 | self.assertEqual(False, self.main.vm.shares['share_id'].accepted) | 247 | self.assertEqual(False, self.main.vm.shares['share_id'].accepted) |
79 | 245 | 248 | ||
80 | 249 | @defer.inlineCallbacks | ||
81 | 250 | def test_sync_menu(self): | ||
82 | 251 | """Test accept_share method.""" | ||
83 | 252 | result = yield self.tool.sync_menu() | ||
84 | 253 | self.assertIn(RECENT_TRANSFERS, result) | ||
85 | 254 | self.assertIn(UPLOADING, result) | ||
86 | 255 | |||
87 | 246 | 256 | ||
88 | 247 | class TestWaitForSignals(TestToolsBase): | 257 | class TestWaitForSignals(TestToolsBase): |
89 | 248 | """Test case for the wait_for_signals method from SyncDaemonTool.""" | 258 | """Test case for the wait_for_signals method from SyncDaemonTool.""" |
90 | 249 | 259 | ||
91 | === modified file 'tests/status/test_aggregator.py' | |||
92 | --- tests/status/test_aggregator.py 2012-08-06 14:25:15 +0000 | |||
93 | +++ tests/status/test_aggregator.py 2012-08-13 15:04:21 +0000 | |||
94 | @@ -42,7 +42,11 @@ | |||
95 | 42 | from ubuntuone.status import aggregator | 42 | from ubuntuone.status import aggregator |
96 | 43 | from ubuntuone.status.notification import AbstractNotification | 43 | from ubuntuone.status.notification import AbstractNotification |
97 | 44 | from ubuntuone.status.messaging import AbstractMessaging | 44 | from ubuntuone.status.messaging import AbstractMessaging |
99 | 45 | from ubuntuone.syncdaemon import status_listener | 45 | from ubuntuone.syncdaemon import ( |
100 | 46 | status_listener, | ||
101 | 47 | RECENT_TRANSFERS, | ||
102 | 48 | UPLOADING, | ||
103 | 49 | ) | ||
104 | 46 | from ubuntuone.syncdaemon.volume_manager import Share, UDF, Root | 50 | from ubuntuone.syncdaemon.volume_manager import Share, UDF, Root |
105 | 47 | 51 | ||
106 | 48 | FILENAME = 'example.txt' | 52 | FILENAME = 'example.txt' |
107 | @@ -813,11 +817,12 @@ | |||
108 | 813 | self.listener.handle_SYS_QUEUE_ADDED(fake_command) | 817 | self.listener.handle_SYS_QUEUE_ADDED(fake_command) |
109 | 814 | self.listener.handle_SYS_QUEUE_REMOVED(fake_command) | 818 | self.listener.handle_SYS_QUEUE_REMOVED(fake_command) |
110 | 815 | transfers = self.status_frontend.recent_transfers() | 819 | transfers = self.status_frontend.recent_transfers() |
112 | 816 | expected = ('path1', 'path2', 'path3') | 820 | expected = ['path1', 'path2', 'path3'] |
113 | 817 | self.assertEqual(transfers, expected) | 821 | self.assertEqual(transfers, expected) |
114 | 818 | 822 | ||
115 | 819 | menu_data = self.listener.menu_data() | 823 | menu_data = self.listener.menu_data() |
117 | 820 | self.assertEqual(menu_data, ([], expected)) | 824 | self.assertEqual(menu_data, |
118 | 825 | {UPLOADING: [], RECENT_TRANSFERS: expected}) | ||
119 | 821 | 826 | ||
120 | 822 | def test_file_uploading(self): | 827 | def test_file_uploading(self): |
121 | 823 | """Check that it returns a list with the path, size, and progress.""" | 828 | """Check that it returns a list with the path, size, and progress.""" |
122 | @@ -827,7 +832,8 @@ | |||
123 | 827 | expected = [('testfile.txt', 0, 0)] | 832 | expected = [('testfile.txt', 0, 0)] |
124 | 828 | self.assertEqual(uploading, expected) | 833 | self.assertEqual(uploading, expected) |
125 | 829 | menu_data = self.listener.menu_data() | 834 | menu_data = self.listener.menu_data() |
127 | 830 | self.assertEqual(menu_data, (expected, ())) | 835 | self.assertEqual(menu_data, |
128 | 836 | {UPLOADING: expected, RECENT_TRANSFERS: []}) | ||
129 | 831 | 837 | ||
130 | 832 | fc.size = 1000 | 838 | fc.size = 1000 |
131 | 833 | fc.n_bytes_written = 200 | 839 | fc.n_bytes_written = 200 |
132 | @@ -840,7 +846,8 @@ | |||
133 | 840 | self.assertEqual(uploading, expected) | 846 | self.assertEqual(uploading, expected) |
134 | 841 | 847 | ||
135 | 842 | menu_data = self.listener.menu_data() | 848 | menu_data = self.listener.menu_data() |
137 | 843 | self.assertEqual(menu_data, (expected, ())) | 849 | self.assertEqual(menu_data, |
138 | 850 | {UPLOADING: expected, RECENT_TRANSFERS: []}) | ||
139 | 844 | 851 | ||
140 | 845 | def test_menu_data_full_response(self): | 852 | def test_menu_data_full_response(self): |
141 | 846 | """Check that listener.menu_data returns both uploading and recent.""" | 853 | """Check that listener.menu_data returns both uploading and recent.""" |
142 | @@ -854,9 +861,11 @@ | |||
143 | 854 | self.status_frontend.upload_started(fc) | 861 | self.status_frontend.upload_started(fc) |
144 | 855 | uploading = self.status_frontend.files_uploading() | 862 | uploading = self.status_frontend.files_uploading() |
145 | 856 | transfers = self.status_frontend.recent_transfers() | 863 | transfers = self.status_frontend.recent_transfers() |
147 | 857 | expected = ([('testfile.txt', 1000, 200)], ('path1',)) | 864 | expected = {UPLOADING: [('testfile.txt', 1000, 200)], |
148 | 865 | RECENT_TRANSFERS: ['path1']} | ||
149 | 858 | 866 | ||
151 | 859 | self.assertEqual((uploading, transfers), expected) | 867 | self.assertEqual( |
152 | 868 | {UPLOADING: uploading, RECENT_TRANSFERS: transfers}, expected) | ||
153 | 860 | 869 | ||
154 | 861 | def test_file_published(self): | 870 | def test_file_published(self): |
155 | 862 | """A file published event is processed.""" | 871 | """A file published event is processed.""" |
156 | 863 | 872 | ||
157 | === modified file 'ubuntuone/platform/ipc/ipc_client.py' | |||
158 | --- ubuntuone/platform/ipc/ipc_client.py 2012-05-22 14:28:56 +0000 | |||
159 | +++ ubuntuone/platform/ipc/ipc_client.py 2012-08-13 15:04:21 +0000 | |||
160 | @@ -197,6 +197,22 @@ | |||
161 | 197 | def current_uploads(self): | 197 | def current_uploads(self): |
162 | 198 | """Return a list of files with a upload in progress.""" | 198 | """Return a list of files with a upload in progress.""" |
163 | 199 | 199 | ||
164 | 200 | @remote | ||
165 | 201 | def sync_menu(self): | ||
166 | 202 | """ | ||
167 | 203 | This method returns a dictionary, with the following keys and values: | ||
168 | 204 | |||
169 | 205 | Key: 'recent-transfers' | ||
170 | 206 | Value: a list of strings (paths), each being the name of a file that | ||
171 | 207 | was recently transferred. | ||
172 | 208 | |||
173 | 209 | Key: 'uploading' | ||
174 | 210 | Value: a list of tuples, with each tuple having the following items: | ||
175 | 211 | * str: the path of a file that's currently being uploaded | ||
176 | 212 | * int: size of the file | ||
177 | 213 | * int: bytes written | ||
178 | 214 | """ | ||
179 | 215 | |||
180 | 200 | @signal | 216 | @signal |
181 | 201 | def on_content_queue_changed(self): | 217 | def on_content_queue_changed(self): |
182 | 202 | """Emit ContentQueueChanged.""" | 218 | """Emit ContentQueueChanged.""" |
183 | 203 | 219 | ||
184 | === modified file 'ubuntuone/platform/ipc/linux.py' | |||
185 | --- ubuntuone/platform/ipc/linux.py 2012-05-22 14:07:55 +0000 | |||
186 | +++ ubuntuone/platform/ipc/linux.py 2012-08-13 15:04:21 +0000 | |||
187 | @@ -38,6 +38,10 @@ | |||
188 | 38 | from xml.etree import ElementTree | 38 | from xml.etree import ElementTree |
189 | 39 | 39 | ||
190 | 40 | from ubuntuone.platform.launcher import UbuntuOneLauncher | 40 | from ubuntuone.platform.launcher import UbuntuOneLauncher |
191 | 41 | from ubuntuone.syncdaemon import ( | ||
192 | 42 | RECENT_TRANSFERS, | ||
193 | 43 | UPLOADING, | ||
194 | 44 | ) | ||
195 | 41 | 45 | ||
196 | 42 | # Disable the "Invalid Name" check here, as we have lots of DBus style names | 46 | # Disable the "Invalid Name" check here, as we have lots of DBus style names |
197 | 43 | # pylint: disable-msg=C0103 | 47 | # pylint: disable-msg=C0103 |
198 | @@ -173,6 +177,35 @@ | |||
199 | 173 | warnings.warn('Use "waiting" method instead.', DeprecationWarning) | 177 | warnings.warn('Use "waiting" method instead.', DeprecationWarning) |
200 | 174 | return self.service.status.waiting_content() | 178 | return self.service.status.waiting_content() |
201 | 175 | 179 | ||
202 | 180 | @dbus.service.method(DBUS_IFACE_STATUS_NAME, out_signature='a{sv}') | ||
203 | 181 | def sync_menu(self): | ||
204 | 182 | """ | ||
205 | 183 | This method returns a dictionary, with the following keys and values: | ||
206 | 184 | |||
207 | 185 | Key: 'recent-transfers' | ||
208 | 186 | Value: a list of strings (paths), each being the name of a file that | ||
209 | 187 | was recently transferred. | ||
210 | 188 | |||
211 | 189 | Key: 'uploading' | ||
212 | 190 | Value: a list of tuples, with each tuple having the following items: | ||
213 | 191 | * str: the path of a file that's currently being uploaded | ||
214 | 192 | * int: size of the file | ||
215 | 193 | * int: bytes written | ||
216 | 194 | """ | ||
217 | 195 | data = self.service.status.sync_menu() | ||
218 | 196 | uploading = data[UPLOADING] | ||
219 | 197 | transfers = data[RECENT_TRANSFERS] | ||
220 | 198 | upload_data = dbus.Array(signature="(sii)") | ||
221 | 199 | transfer_data = dbus.Array(signature="s") | ||
222 | 200 | for up in uploading: | ||
223 | 201 | upload_data.append(dbus.Struct(up, signature="sii")) | ||
224 | 202 | for transfer in transfers: | ||
225 | 203 | transfer_data.append(transfer) | ||
226 | 204 | result = dbus.Dictionary(signature="sv") | ||
227 | 205 | result[UPLOADING] = upload_data | ||
228 | 206 | result[RECENT_TRANSFERS] = transfer_data | ||
229 | 207 | return result | ||
230 | 208 | |||
231 | 176 | @dbus.service.signal(DBUS_IFACE_STATUS_NAME) | 209 | @dbus.service.signal(DBUS_IFACE_STATUS_NAME) |
232 | 177 | def DownloadStarted(self, path): | 210 | def DownloadStarted(self, path): |
233 | 178 | """Fire a signal to notify that a download has started.""" | 211 | """Fire a signal to notify that a download has started.""" |
234 | 179 | 212 | ||
235 | === modified file 'ubuntuone/platform/ipc/perspective_broker.py' | |||
236 | --- ubuntuone/platform/ipc/perspective_broker.py 2012-07-13 16:06:27 +0000 | |||
237 | +++ ubuntuone/platform/ipc/perspective_broker.py 2012-08-13 15:04:21 +0000 | |||
238 | @@ -231,6 +231,7 @@ | |||
239 | 231 | 'waiting', | 231 | 'waiting', |
240 | 232 | 'waiting_metadata', | 232 | 'waiting_metadata', |
241 | 233 | 'waiting_content', | 233 | 'waiting_content', |
242 | 234 | 'sync_menu', | ||
243 | 234 | ] | 235 | ] |
244 | 235 | 236 | ||
245 | 236 | signal_mapping = { | 237 | signal_mapping = { |
246 | @@ -291,6 +292,10 @@ | |||
247 | 291 | warnings.warn('Use "waiting" method instead.', DeprecationWarning) | 292 | warnings.warn('Use "waiting" method instead.', DeprecationWarning) |
248 | 292 | return self.service.status.waiting_content() | 293 | return self.service.status.waiting_content() |
249 | 293 | 294 | ||
250 | 295 | def sync_menu(self): | ||
251 | 296 | """Return the info necessary to construct the menu.""" | ||
252 | 297 | return self.service.status.sync_menu() | ||
253 | 298 | |||
254 | 294 | @signal | 299 | @signal |
255 | 295 | def DownloadStarted(self, path): | 300 | def DownloadStarted(self, path): |
256 | 296 | """Fire a signal to notify that a download has started.""" | 301 | """Fire a signal to notify that a download has started.""" |
257 | 297 | 302 | ||
258 | === modified file 'ubuntuone/platform/tools/__init__.py' | |||
259 | --- ubuntuone/platform/tools/__init__.py 2012-05-30 15:35:49 +0000 | |||
260 | +++ ubuntuone/platform/tools/__init__.py 2012-08-13 15:04:21 +0000 | |||
261 | @@ -326,6 +326,13 @@ | |||
262 | 326 | 326 | ||
263 | 327 | @defer.inlineCallbacks | 327 | @defer.inlineCallbacks |
264 | 328 | @log_call(logger.debug) | 328 | @log_call(logger.debug) |
265 | 329 | def sync_menu(self): | ||
266 | 330 | """Return a deferred that will be fired with the sync menu data.""" | ||
267 | 331 | results = yield self.proxy.call_method('status', 'sync_menu') | ||
268 | 332 | defer.returnValue(results) | ||
269 | 333 | |||
270 | 334 | @defer.inlineCallbacks | ||
271 | 335 | @log_call(logger.debug) | ||
272 | 329 | def accept_share(self, share_id): | 336 | def accept_share(self, share_id): |
273 | 330 | """Accept the share with id: share_id.""" | 337 | """Accept the share with id: share_id.""" |
274 | 331 | d = self.wait_for_signals(signal_ok='ShareAnswerResponse', | 338 | d = self.wait_for_signals(signal_ok='ShareAnswerResponse', |
275 | 332 | 339 | ||
276 | === modified file 'ubuntuone/status/aggregator.py' | |||
277 | --- ubuntuone/status/aggregator.py 2012-08-06 14:25:15 +0000 | |||
278 | +++ ubuntuone/status/aggregator.py 2012-08-13 15:04:21 +0000 | |||
279 | @@ -810,7 +810,7 @@ | |||
280 | 810 | 810 | ||
281 | 811 | def recent_transfers(self): | 811 | def recent_transfers(self): |
282 | 812 | """Return a tuple with the recent transfers paths.""" | 812 | """Return a tuple with the recent transfers paths.""" |
284 | 813 | return tuple(self.aggregator.recent_transfers) | 813 | return list(self.aggregator.recent_transfers) |
285 | 814 | 814 | ||
286 | 815 | def files_uploading(self): | 815 | def files_uploading(self): |
287 | 816 | """Return a list with the files being uploading.""" | 816 | """Return a list with the files being uploading.""" |
288 | 817 | 817 | ||
289 | === modified file 'ubuntuone/syncdaemon/__init__.py' | |||
290 | --- ubuntuone/syncdaemon/__init__.py 2012-04-09 20:07:05 +0000 | |||
291 | +++ ubuntuone/syncdaemon/__init__.py 2012-08-13 15:04:21 +0000 | |||
292 | @@ -36,3 +36,8 @@ | |||
293 | 36 | "volumes", | 36 | "volumes", |
294 | 37 | "generations", | 37 | "generations", |
295 | 38 | ]) | 38 | ]) |
296 | 39 | |||
297 | 40 | |||
298 | 41 | #Sync Menu data constants | ||
299 | 42 | RECENT_TRANSFERS = 'recent-transfers' | ||
300 | 43 | UPLOADING = 'uploading' | ||
301 | 39 | 44 | ||
302 | === modified file 'ubuntuone/syncdaemon/interaction_interfaces.py' | |||
303 | --- ubuntuone/syncdaemon/interaction_interfaces.py 2012-08-08 18:36:17 +0000 | |||
304 | +++ ubuntuone/syncdaemon/interaction_interfaces.py 2012-08-13 15:04:21 +0000 | |||
305 | @@ -302,6 +302,10 @@ | |||
306 | 302 | waiting_content.append(data) | 302 | waiting_content.append(data) |
307 | 303 | return waiting_content | 303 | return waiting_content |
308 | 304 | 304 | ||
309 | 305 | def sync_menu(self): | ||
310 | 306 | """Return the info necessary to construct the menu.""" | ||
311 | 307 | return self.main.status_listener.menu_data() | ||
312 | 308 | |||
313 | 305 | 309 | ||
314 | 306 | class SyncdaemonFileSystem(SyncdaemonObject): | 310 | class SyncdaemonFileSystem(SyncdaemonObject): |
315 | 307 | """An interface to the FileSystem Manager.""" | 311 | """An interface to the FileSystem Manager.""" |
316 | 308 | 312 | ||
317 | === modified file 'ubuntuone/syncdaemon/status_listener.py' | |||
318 | --- ubuntuone/syncdaemon/status_listener.py 2012-08-03 14:56:05 +0000 | |||
319 | +++ ubuntuone/syncdaemon/status_listener.py 2012-08-13 15:04:21 +0000 | |||
320 | @@ -31,7 +31,12 @@ | |||
321 | 31 | """Listener for event queue that updates the UI to show syncdaemon status.""" | 31 | """Listener for event queue that updates the UI to show syncdaemon status.""" |
322 | 32 | 32 | ||
323 | 33 | from ubuntuone.status.aggregator import StatusFrontend | 33 | from ubuntuone.status.aggregator import StatusFrontend |
325 | 34 | from ubuntuone.syncdaemon import action_queue, config | 34 | from ubuntuone.syncdaemon import ( |
326 | 35 | action_queue, | ||
327 | 36 | config, | ||
328 | 37 | RECENT_TRANSFERS, | ||
329 | 38 | UPLOADING, | ||
330 | 39 | ) | ||
331 | 35 | from ubuntuone.syncdaemon.interaction_interfaces import ( | 40 | from ubuntuone.syncdaemon.interaction_interfaces import ( |
332 | 36 | get_share_dict, get_udf_dict) | 41 | get_share_dict, get_udf_dict) |
333 | 37 | from ubuntuone.syncdaemon.volume_manager import UDF, Root | 42 | from ubuntuone.syncdaemon.volume_manager import UDF, Root |
334 | @@ -68,9 +73,10 @@ | |||
335 | 68 | 73 | ||
336 | 69 | def menu_data(self): | 74 | def menu_data(self): |
337 | 70 | """Return the info necessary to construct the sync menu.""" | 75 | """Return the info necessary to construct the sync menu.""" |
338 | 76 | uploading = self.status_frontend.files_uploading() | ||
339 | 71 | transfers = self.status_frontend.recent_transfers() | 77 | transfers = self.status_frontend.recent_transfers() |
342 | 72 | uploading = self.status_frontend.files_uploading() | 78 | data = {RECENT_TRANSFERS: transfers, UPLOADING: uploading} |
343 | 73 | return uploading, transfers | 79 | return data |
344 | 74 | 80 | ||
345 | 75 | def get_show_all_notifications(self): | 81 | def get_show_all_notifications(self): |
346 | 76 | """Get the value of show_all_notifications.""" | 82 | """Get the value of show_all_notifications.""" |
Please make constants out of the keys for the data dict ('recent-transfers' and 'uploading'), so that the strings are only defined once and use those constants through the branch. This makes it faster to catch mistakes.
Please provide detailed information on the keys, and very detailed info too on the dbus types of each of the possible values, of the dbus dictionary of variants returned by the method exposed on dbus. This should be done as a multiline docstring of the exported method.