Merge lp:~facundo/magicicada-client/remove-sync-menu into lp:magicicada-client
- remove-sync-menu
- Merge into trunk
Proposed by
Facundo Batista
Status: | Merged |
---|---|
Approved by: | Natalia Bidart |
Approved revision: | 1445 |
Merged at revision: | 1444 |
Proposed branch: | lp:~facundo/magicicada-client/remove-sync-menu |
Merge into: | lp:magicicada-client |
Diff against target: |
1535 lines (+23/-1209) 17 files modified
contrib/testing/testcase.py (+9/-18) setup.py (+0/-1) ubuntuone/clientdefs.py.in (+2/-11) ubuntuone/platform/ipc/ipc_client.py (+1/-16) ubuntuone/platform/ipc/linux.py (+1/-33) ubuntuone/platform/ipc/perspective_broker.py (+1/-5) ubuntuone/platform/sync_menu/__init__.py (+0/-41) ubuntuone/platform/sync_menu/common.py (+0/-41) ubuntuone/platform/sync_menu/linux.py (+0/-330) ubuntuone/platform/tests/ipc/test_external_interface.py (+2/-15) ubuntuone/platform/tests/sync_menu/__init__.py (+0/-27) ubuntuone/platform/tests/sync_menu/test_common.py (+0/-54) ubuntuone/platform/tests/sync_menu/test_linux.py (+0/-586) ubuntuone/platform/tests/test_tools.py (+5/-13) ubuntuone/platform/tools/__init__.py (+1/-7) ubuntuone/syncdaemon/__init__.py (+1/-7) ubuntuone/syncdaemon/interaction_interfaces.py (+0/-4) |
To merge this branch: | bzr merge lp:~facundo/magicicada-client/remove-sync-menu |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Natalia Bidart | Approve | ||
Review via email: mp+343773@code.launchpad.net |
Commit message
Remove SyncMenu traces - no more UI client except Magicicada own shiny thing.
Description of the change
To post a comment you must log in.
- 1444. By Facundo Batista
-
Removed more unused constants.
- 1445. By Facundo Batista
-
Merged trunk in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'contrib/testing/testcase.py' | |||
2 | --- contrib/testing/testcase.py 2018-03-14 21:01:56 +0000 | |||
3 | +++ contrib/testing/testcase.py 2018-04-24 23:14:39 +0000 | |||
4 | @@ -58,8 +58,6 @@ | |||
5 | 58 | main, | 58 | main, |
6 | 59 | local_rescan, | 59 | local_rescan, |
7 | 60 | tritcask, | 60 | tritcask, |
8 | 61 | RECENT_TRANSFERS, | ||
9 | 62 | UPLOADING, | ||
10 | 63 | ) | 61 | ) |
11 | 64 | from ubuntuone.syncdaemon import logger | 62 | from ubuntuone.syncdaemon import logger |
12 | 65 | from ubuntuone import platform | 63 | from ubuntuone import platform |
13 | @@ -78,6 +76,10 @@ | |||
14 | 78 | 'password': 'test_password'} | 76 | 'password': 'test_password'} |
15 | 79 | 77 | ||
16 | 80 | 78 | ||
17 | 79 | def NOOP(*a, **kw): | ||
18 | 80 | """Do nothing.""" | ||
19 | 81 | |||
20 | 82 | |||
21 | 81 | @contextlib.contextmanager | 83 | @contextlib.contextmanager |
22 | 82 | def environ(env_var, new_value): | 84 | def environ(env_var, new_value): |
23 | 83 | """context manager to replace/add an environ value""" | 85 | """context manager to replace/add an environ value""" |
24 | @@ -190,14 +192,6 @@ | |||
25 | 190 | node_is_with_queued_move = cleanup = get_public_files = disconnect | 192 | node_is_with_queued_move = cleanup = get_public_files = disconnect |
26 | 191 | 193 | ||
27 | 192 | 194 | ||
28 | 193 | class FakeStatusListener(object): | ||
29 | 194 | """A fake StatusListener.""" | ||
30 | 195 | |||
31 | 196 | def menu_data(self): | ||
32 | 197 | """Fake menu_data.""" | ||
33 | 198 | return {RECENT_TRANSFERS: [], UPLOADING: []} | ||
34 | 199 | |||
35 | 200 | |||
36 | 201 | class FakeMonitor(object): | 195 | class FakeMonitor(object): |
37 | 202 | """A fake FilesystemMonitor.""" | 196 | """A fake FilesystemMonitor.""" |
38 | 203 | 197 | ||
39 | @@ -259,8 +253,8 @@ | |||
40 | 259 | self.vm = volume_manager.VolumeManager(self) | 253 | self.vm = volume_manager.VolumeManager(self) |
41 | 260 | self.fs = fs_manager.FileSystemManager( | 254 | self.fs = fs_manager.FileSystemManager( |
42 | 261 | self.data_dir, self.partials_dir, self.vm, self.db) | 255 | self.data_dir, self.partials_dir, self.vm, self.db) |
45 | 262 | self.event_q = event_queue.EventQueue(self.fs, | 256 | self.event_q = event_queue.EventQueue( |
46 | 263 | monitor_class=self._monitor_class) | 257 | self.fs, monitor_class=self._monitor_class) |
47 | 264 | self.fs.register_eq(self.event_q) | 258 | self.fs.register_eq(self.event_q) |
48 | 265 | self.action_q = self._fake_AQ_class(self.event_q, self, | 259 | self.action_q = self._fake_AQ_class(self.event_q, self, |
49 | 266 | *self._fake_AQ_params) | 260 | *self._fake_AQ_params) |
50 | @@ -275,8 +269,6 @@ | |||
51 | 275 | self.lr = local_rescan.LocalRescan(self.vm, self.fs, | 269 | self.lr = local_rescan.LocalRescan(self.vm, self.fs, |
52 | 276 | self.event_q, self.action_q) | 270 | self.event_q, self.action_q) |
53 | 277 | 271 | ||
54 | 278 | self.status_listener = FakeStatusListener() | ||
55 | 279 | |||
56 | 280 | def _connect_aq(self, _): | 272 | def _connect_aq(self, _): |
57 | 281 | """Connect the fake action queue.""" | 273 | """Connect the fake action queue.""" |
58 | 282 | self.action_q.connect() | 274 | self.action_q.connect() |
59 | @@ -408,9 +400,8 @@ | |||
60 | 408 | self.patch(platform, "user_home", self.home_dir) | 400 | self.patch(platform, "user_home", self.home_dir) |
61 | 409 | 401 | ||
62 | 410 | # use the config from the branch | 402 | # use the config from the branch |
66 | 411 | new_get_config_files = lambda: [os.path.join(os.environ['ROOTDIR'], | 403 | self.patch(config, 'get_config_files', lambda: [ |
67 | 412 | 'data', 'syncdaemon.conf')] | 404 | os.path.join(os.environ['ROOTDIR'], 'data', 'syncdaemon.conf')]) |
65 | 413 | self.patch(config, 'get_config_files', new_get_config_files) | ||
68 | 414 | 405 | ||
69 | 415 | # fake a very basic config file with sane defaults for the tests | 406 | # fake a very basic config file with sane defaults for the tests |
70 | 416 | config_dir = self.mktemp('config') | 407 | config_dir = self.mktemp('config') |
71 | @@ -626,7 +617,7 @@ | |||
72 | 626 | try: | 617 | try: |
73 | 627 | result = super(FakedObject, self).__getattribute__(attr_name) | 618 | result = super(FakedObject, self).__getattribute__(attr_name) |
74 | 628 | except AttributeError: | 619 | except AttributeError: |
76 | 629 | result = lambda *a, **kw: None | 620 | result = NOOP |
77 | 630 | super(FakedObject, self).__setattr__(attr_name, result) | 621 | super(FakedObject, self).__setattr__(attr_name, result) |
78 | 631 | 622 | ||
79 | 632 | if attr_name == '_called': | 623 | if attr_name == '_called': |
80 | 633 | 624 | ||
81 | === modified file 'setup.py' | |||
82 | --- setup.py 2018-03-14 21:01:56 +0000 | |||
83 | +++ setup.py 2018-04-24 23:14:39 +0000 | |||
84 | @@ -71,7 +71,6 @@ | |||
85 | 71 | with open(fname, 'w') as out_file: | 71 | with open(fname, 'w') as out_file: |
86 | 72 | content = content.replace('@VERSION@', VERSION) | 72 | content = content.replace('@VERSION@', VERSION) |
87 | 73 | content = content.replace('@PROJECT_NAME@', PROJECT_NAME) | 73 | content = content.replace('@PROJECT_NAME@', PROJECT_NAME) |
88 | 74 | content = content.replace('@GETTEXT_PACKAGE@', PROJECT_NAME) | ||
89 | 75 | content = content.replace('@LOG_LEVEL@', LOG_LEVEL) | 74 | content = content.replace('@LOG_LEVEL@', LOG_LEVEL) |
90 | 76 | content = content.replace('@LOG_FILE_SIZE@', LOG_FILE_SIZE) | 75 | content = content.replace('@LOG_FILE_SIZE@', LOG_FILE_SIZE) |
91 | 77 | if prefix is not None: | 76 | if prefix is not None: |
92 | 78 | 77 | ||
93 | === modified file 'ubuntuone/clientdefs.py.in' | |||
94 | --- ubuntuone/clientdefs.py.in 2016-06-04 23:41:52 +0000 | |||
95 | +++ ubuntuone/clientdefs.py.in 2018-04-24 23:14:39 +0000 | |||
96 | @@ -1,8 +1,5 @@ | |||
97 | 1 | # ubuntuone.clientdefs - Configure-time definitions | ||
98 | 2 | # | ||
99 | 3 | # Author: David Planella <david.planella@ubuntu.com> | ||
100 | 4 | # | ||
101 | 5 | # Copyright 2009-2012 Canonical Ltd. | 1 | # Copyright 2009-2012 Canonical Ltd. |
102 | 2 | # Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros) | ||
103 | 6 | # | 3 | # |
104 | 7 | # This program is free software: you can redistribute it and/or modify it | 4 | # This program is free software: you can redistribute it and/or modify it |
105 | 8 | # under the terms of the GNU General Public License version 3, as published | 5 | # under the terms of the GNU General Public License version 3, as published |
106 | @@ -30,7 +27,6 @@ | |||
107 | 30 | # files in the program, then also delete it here. | 27 | # files in the program, then also delete it here. |
108 | 31 | """Configure-time definitions for the client.""" | 28 | """Configure-time definitions for the client.""" |
109 | 32 | 29 | ||
110 | 33 | import gettext | ||
111 | 34 | import os | 30 | import os |
112 | 35 | import platform | 31 | import platform |
113 | 36 | import urllib | 32 | import urllib |
114 | @@ -39,16 +35,11 @@ | |||
115 | 39 | VERSION = "@VERSION@" | 35 | VERSION = "@VERSION@" |
116 | 40 | LOCALEDIR = "@localedir@" | 36 | LOCALEDIR = "@localedir@" |
117 | 41 | LIBEXECDIR = "@libexecdir@" | 37 | LIBEXECDIR = "@libexecdir@" |
120 | 42 | GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@" | 38 | PROJECT_NAME = "@PROJECT_NAME@" |
119 | 43 | PROJECT_NAME = "@GETTEXT_PACKAGE@" | ||
121 | 44 | PROJECT_DIR = os.path.join('@prefix@', 'share', PROJECT_NAME) | 39 | PROJECT_DIR = os.path.join('@prefix@', 'share', PROJECT_NAME) |
122 | 45 | BIN_DIR = os.path.join('@prefix@', 'lib', PROJECT_NAME) | 40 | BIN_DIR = os.path.join('@prefix@', 'lib', PROJECT_NAME) |
123 | 46 | 41 | ||
124 | 47 | 42 | ||
125 | 48 | def Q_(string): | ||
126 | 49 | return gettext.dgettext(GETTEXT_PACKAGE, string) | ||
127 | 50 | |||
128 | 51 | |||
129 | 52 | def platform_data(): | 43 | def platform_data(): |
130 | 53 | result = {'platform': platform.system(), | 44 | result = {'platform': platform.system(), |
131 | 54 | 'platform_version': platform.release(), | 45 | 'platform_version': platform.release(), |
132 | 55 | 46 | ||
133 | === modified file 'ubuntuone/platform/ipc/ipc_client.py' | |||
134 | --- ubuntuone/platform/ipc/ipc_client.py 2016-09-17 01:06:23 +0000 | |||
135 | +++ ubuntuone/platform/ipc/ipc_client.py 2018-04-24 23:14:39 +0000 | |||
136 | @@ -1,6 +1,7 @@ | |||
137 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
138 | 2 | # | 2 | # |
139 | 3 | # Copyright 2011-2012 Canonical Ltd. | 3 | # Copyright 2011-2012 Canonical Ltd. |
140 | 4 | # Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros) | ||
141 | 4 | # | 5 | # |
142 | 5 | # This program is free software: you can redistribute it and/or modify it | 6 | # This program is free software: you can redistribute it and/or modify it |
143 | 6 | # under the terms of the GNU General Public License version 3, as published | 7 | # under the terms of the GNU General Public License version 3, as published |
144 | @@ -197,22 +198,6 @@ | |||
145 | 197 | def current_uploads(self): | 198 | def current_uploads(self): |
146 | 198 | """Return a list of files with a upload in progress.""" | 199 | """Return a list of files with a upload in progress.""" |
147 | 199 | 200 | ||
148 | 200 | @remote | ||
149 | 201 | def sync_menu(self): | ||
150 | 202 | """ | ||
151 | 203 | This method returns a dictionary, with the following keys and values: | ||
152 | 204 | |||
153 | 205 | Key: 'recent-transfers' | ||
154 | 206 | Value: a list of strings (paths), each being the name of a file that | ||
155 | 207 | was recently transferred. | ||
156 | 208 | |||
157 | 209 | Key: 'uploading' | ||
158 | 210 | Value: a list of tuples, with each tuple having the following items: | ||
159 | 211 | * str: the path of a file that's currently being uploaded | ||
160 | 212 | * int: size of the file | ||
161 | 213 | * int: bytes written | ||
162 | 214 | """ | ||
163 | 215 | |||
164 | 216 | @signal | 201 | @signal |
165 | 217 | def on_content_queue_changed(self): | 202 | def on_content_queue_changed(self): |
166 | 218 | """Emit ContentQueueChanged.""" | 203 | """Emit ContentQueueChanged.""" |
167 | 219 | 204 | ||
168 | === modified file 'ubuntuone/platform/ipc/linux.py' | |||
169 | --- ubuntuone/platform/ipc/linux.py 2016-09-17 01:06:23 +0000 | |||
170 | +++ ubuntuone/platform/ipc/linux.py 2018-04-24 23:14:39 +0000 | |||
171 | @@ -1,6 +1,7 @@ | |||
172 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
173 | 2 | # | 2 | # |
174 | 3 | # Copyright 2009-2012 Canonical Ltd. | 3 | # Copyright 2009-2012 Canonical Ltd. |
175 | 4 | # Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros) | ||
176 | 4 | # | 5 | # |
177 | 5 | # This program is free software: you can redistribute it and/or modify it | 6 | # This program is free software: you can redistribute it and/or modify it |
178 | 6 | # under the terms of the GNU General Public License version 3, as published | 7 | # under the terms of the GNU General Public License version 3, as published |
179 | @@ -38,10 +39,6 @@ | |||
180 | 38 | from xml.etree import ElementTree | 39 | from xml.etree import ElementTree |
181 | 39 | 40 | ||
182 | 40 | from ubuntuone.platform import launcher | 41 | from ubuntuone.platform import launcher |
183 | 41 | from ubuntuone.syncdaemon import ( | ||
184 | 42 | RECENT_TRANSFERS, | ||
185 | 43 | UPLOADING, | ||
186 | 44 | ) | ||
187 | 45 | 42 | ||
188 | 46 | # Disable the "Invalid Name" check here, as we have lots of DBus style names | 43 | # Disable the "Invalid Name" check here, as we have lots of DBus style names |
189 | 47 | 44 | ||
190 | @@ -176,35 +173,6 @@ | |||
191 | 176 | warnings.warn('Use "waiting" method instead.', DeprecationWarning) | 173 | warnings.warn('Use "waiting" method instead.', DeprecationWarning) |
192 | 177 | return self.service.status.waiting_content() | 174 | return self.service.status.waiting_content() |
193 | 178 | 175 | ||
194 | 179 | @dbus.service.method(DBUS_IFACE_STATUS_NAME, out_signature='a{sv}') | ||
195 | 180 | def sync_menu(self): | ||
196 | 181 | """ | ||
197 | 182 | This method returns a dictionary, with the following keys and values: | ||
198 | 183 | |||
199 | 184 | Key: 'recent-transfers' | ||
200 | 185 | Value: a list of strings (paths), each being the name of a file that | ||
201 | 186 | was recently transferred. | ||
202 | 187 | |||
203 | 188 | Key: 'uploading' | ||
204 | 189 | Value: a list of tuples, with each tuple having the following items: | ||
205 | 190 | * str: the path of a file that's currently being uploaded | ||
206 | 191 | * int: size of the file | ||
207 | 192 | * int: bytes written | ||
208 | 193 | """ | ||
209 | 194 | data = self.service.status.sync_menu() | ||
210 | 195 | uploading = data[UPLOADING] | ||
211 | 196 | transfers = data[RECENT_TRANSFERS] | ||
212 | 197 | upload_data = dbus.Array(signature="(sii)") | ||
213 | 198 | transfer_data = dbus.Array(signature="s") | ||
214 | 199 | for up in uploading: | ||
215 | 200 | upload_data.append(dbus.Struct(up, signature="sii")) | ||
216 | 201 | for transfer in transfers: | ||
217 | 202 | transfer_data.append(transfer) | ||
218 | 203 | result = dbus.Dictionary(signature="sv") | ||
219 | 204 | result[UPLOADING] = upload_data | ||
220 | 205 | result[RECENT_TRANSFERS] = transfer_data | ||
221 | 206 | return result | ||
222 | 207 | |||
223 | 208 | @dbus.service.signal(DBUS_IFACE_STATUS_NAME) | 176 | @dbus.service.signal(DBUS_IFACE_STATUS_NAME) |
224 | 209 | def DownloadStarted(self, path): | 177 | def DownloadStarted(self, path): |
225 | 210 | """Fire a signal to notify that a download has started.""" | 178 | """Fire a signal to notify that a download has started.""" |
226 | 211 | 179 | ||
227 | === modified file 'ubuntuone/platform/ipc/perspective_broker.py' | |||
228 | --- ubuntuone/platform/ipc/perspective_broker.py 2016-09-17 01:06:23 +0000 | |||
229 | +++ ubuntuone/platform/ipc/perspective_broker.py 2018-04-24 23:14:39 +0000 | |||
230 | @@ -1,6 +1,7 @@ | |||
231 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
232 | 2 | # | 2 | # |
233 | 3 | # Copyright 2011-2012 Canonical Ltd. | 3 | # Copyright 2011-2012 Canonical Ltd. |
234 | 4 | # Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros) | ||
235 | 4 | # | 5 | # |
236 | 5 | # This program is free software: you can redistribute it and/or modify it | 6 | # This program is free software: you can redistribute it and/or modify it |
237 | 6 | # under the terms of the GNU General Public License version 3, as published | 7 | # under the terms of the GNU General Public License version 3, as published |
238 | @@ -235,7 +236,6 @@ | |||
239 | 235 | 'waiting', | 236 | 'waiting', |
240 | 236 | 'waiting_metadata', | 237 | 'waiting_metadata', |
241 | 237 | 'waiting_content', | 238 | 'waiting_content', |
242 | 238 | 'sync_menu', | ||
243 | 239 | ] | 239 | ] |
244 | 240 | 240 | ||
245 | 241 | signal_mapping = { | 241 | signal_mapping = { |
246 | @@ -296,10 +296,6 @@ | |||
247 | 296 | warnings.warn('Use "waiting" method instead.', DeprecationWarning) | 296 | warnings.warn('Use "waiting" method instead.', DeprecationWarning) |
248 | 297 | return self.service.status.waiting_content() | 297 | return self.service.status.waiting_content() |
249 | 298 | 298 | ||
250 | 299 | def sync_menu(self): | ||
251 | 300 | """Return the info necessary to construct the menu.""" | ||
252 | 301 | return self.service.status.sync_menu() | ||
253 | 302 | |||
254 | 303 | @signal | 299 | @signal |
255 | 304 | def DownloadStarted(self, path): | 300 | def DownloadStarted(self, path): |
256 | 305 | """Fire a signal to notify that a download has started.""" | 301 | """Fire a signal to notify that a download has started.""" |
257 | 306 | 302 | ||
258 | === removed directory 'ubuntuone/platform/sync_menu' | |||
259 | === removed file 'ubuntuone/platform/sync_menu/__init__.py' | |||
260 | --- ubuntuone/platform/sync_menu/__init__.py 2012-09-18 16:28:28 +0000 | |||
261 | +++ ubuntuone/platform/sync_menu/__init__.py 1970-01-01 00:00:00 +0000 | |||
262 | @@ -1,41 +0,0 @@ | |||
263 | 1 | # -*- coding: utf-8 *-* | ||
264 | 2 | # | ||
265 | 3 | # Copyright 2012 Canonical Ltd. | ||
266 | 4 | # | ||
267 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
268 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
269 | 7 | # by the Free Software Foundation. | ||
270 | 8 | # | ||
271 | 9 | # This program is distributed in the hope that it will be useful, but | ||
272 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
273 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
274 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
275 | 13 | # | ||
276 | 14 | # You should have received a copy of the GNU General Public License along | ||
277 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
278 | 16 | # | ||
279 | 17 | # In addition, as a special exception, the copyright holders give | ||
280 | 18 | # permission to link the code of portions of this program with the | ||
281 | 19 | # OpenSSL library under certain conditions as described in each | ||
282 | 20 | # individual source file, and distribute linked combinations | ||
283 | 21 | # including the two. | ||
284 | 22 | # You must obey the GNU General Public License in all respects | ||
285 | 23 | # for all of the code used other than OpenSSL. If you modify | ||
286 | 24 | # file(s) with this exception, you may extend this exception to your | ||
287 | 25 | # version of the file(s), but you are not obligated to do so. If you | ||
288 | 26 | # do not wish to do so, delete this exception statement from your | ||
289 | 27 | # version. If you delete this exception statement from all source | ||
290 | 28 | # files in the program, then also delete it here. | ||
291 | 29 | """Use SyncMenu lib to integrate U1 with the Systray Sync Icon.""" | ||
292 | 30 | |||
293 | 31 | import sys | ||
294 | 32 | |||
295 | 33 | |||
296 | 34 | if sys.platform in ("win32", "darwin"): | ||
297 | 35 | from ubuntuone.platform.sync_menu import common | ||
298 | 36 | source = common | ||
299 | 37 | else: | ||
300 | 38 | from ubuntuone.platform.sync_menu import linux | ||
301 | 39 | source = linux | ||
302 | 40 | |||
303 | 41 | UbuntuOneSyncMenu = source.UbuntuOneSyncMenu | ||
304 | 42 | 0 | ||
305 | === removed file 'ubuntuone/platform/sync_menu/common.py' | |||
306 | --- ubuntuone/platform/sync_menu/common.py 2013-01-31 22:39:17 +0000 | |||
307 | +++ ubuntuone/platform/sync_menu/common.py 1970-01-01 00:00:00 +0000 | |||
308 | @@ -1,41 +0,0 @@ | |||
309 | 1 | # -*- coding: utf-8 *-* | ||
310 | 2 | # | ||
311 | 3 | # Copyright 2012 Canonical Ltd. | ||
312 | 4 | # | ||
313 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
314 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
315 | 7 | # by the Free Software Foundation. | ||
316 | 8 | # | ||
317 | 9 | # This program is distributed in the hope that it will be useful, but | ||
318 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
319 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
320 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
321 | 13 | # | ||
322 | 14 | # You should have received a copy of the GNU General Public License along | ||
323 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
324 | 16 | # | ||
325 | 17 | # In addition, as a special exception, the copyright holders give | ||
326 | 18 | # permission to link the code of portions of this program with the | ||
327 | 19 | # OpenSSL library under certain conditions as described in each | ||
328 | 20 | # individual source file, and distribute linked combinations | ||
329 | 21 | # including the two. | ||
330 | 22 | # You must obey the GNU General Public License in all respects | ||
331 | 23 | # for all of the code used other than OpenSSL. If you modify | ||
332 | 24 | # file(s) with this exception, you may extend this exception to your | ||
333 | 25 | # version of the file(s), but you are not obligated to do so. If you | ||
334 | 26 | # do not wish to do so, delete this exception statement from your | ||
335 | 27 | # version. If you delete this exception statement from all source | ||
336 | 28 | # files in the program, then also delete it here. | ||
337 | 29 | """Dummy implementation of sync_menu lib for win32 and darwin.""" | ||
338 | 30 | |||
339 | 31 | |||
340 | 32 | class UbuntuOneSyncMenu(object): | ||
341 | 33 | """Integrate U1 with the Ubuntu Sync Menu.""" | ||
342 | 34 | def __init__(self, *args, **kwargs): | ||
343 | 35 | """Match #args of linux syncmenu and do nothing.""" | ||
344 | 36 | |||
345 | 37 | def update_transfers(self, *args, **kwargs): | ||
346 | 38 | """Do nothing.""" | ||
347 | 39 | |||
348 | 40 | def sync_status_changed(self, *args, **kwargs): | ||
349 | 41 | """Do nothing.""" | ||
350 | 42 | 0 | ||
351 | === removed file 'ubuntuone/platform/sync_menu/linux.py' | |||
352 | --- ubuntuone/platform/sync_menu/linux.py 2018-03-08 19:39:13 +0000 | |||
353 | +++ ubuntuone/platform/sync_menu/linux.py 1970-01-01 00:00:00 +0000 | |||
354 | @@ -1,330 +0,0 @@ | |||
355 | 1 | # -*- coding: utf-8 *-* | ||
356 | 2 | # | ||
357 | 3 | # Copyright 2012-2013 Canonical Ltd. | ||
358 | 4 | # | ||
359 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
360 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
361 | 7 | # by the Free Software Foundation. | ||
362 | 8 | # | ||
363 | 9 | # This program is distributed in the hope that it will be useful, but | ||
364 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
365 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
366 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
367 | 13 | # | ||
368 | 14 | # You should have received a copy of the GNU General Public License along | ||
369 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
370 | 16 | # | ||
371 | 17 | # In addition, as a special exception, the copyright holders give | ||
372 | 18 | # permission to link the code of portions of this program with the | ||
373 | 19 | # OpenSSL library under certain conditions as described in each | ||
374 | 20 | # individual source file, and distribute linked combinations | ||
375 | 21 | # including the two. | ||
376 | 22 | # You must obey the GNU General Public License in all respects | ||
377 | 23 | # for all of the code used other than OpenSSL. If you modify | ||
378 | 24 | # file(s) with this exception, you may extend this exception to your | ||
379 | 25 | # version of the file(s), but you are not obligated to do so. If you | ||
380 | 26 | # do not wish to do so, delete this exception statement from your | ||
381 | 27 | # version. If you delete this exception statement from all source | ||
382 | 28 | # files in the program, then also delete it here. | ||
383 | 29 | """Use SyncMenu lib to integrate U1 with the Systray Sync Icon.""" | ||
384 | 30 | |||
385 | 31 | import gettext | ||
386 | 32 | import logging | ||
387 | 33 | import time | ||
388 | 34 | from twisted.python.util import OrderedDict | ||
389 | 35 | from operator import itemgetter | ||
390 | 36 | |||
391 | 37 | try: | ||
392 | 38 | from gi.repository import GLib as glib | ||
393 | 39 | from gi.repository import ( | ||
394 | 40 | Dbusmenu, | ||
395 | 41 | Gdk, | ||
396 | 42 | Gio, | ||
397 | 43 | SyncMenu, | ||
398 | 44 | ) | ||
399 | 45 | use_syncmenu = True | ||
400 | 46 | except ImportError: | ||
401 | 47 | use_syncmenu = False | ||
402 | 48 | |||
403 | 49 | from ubuntuone.clientdefs import GETTEXT_PACKAGE, NAME | ||
404 | 50 | from ubuntuone.platform.sync_menu.common import ( | ||
405 | 51 | UbuntuOneSyncMenu as DummySyncMenu, | ||
406 | 52 | ) | ||
407 | 53 | |||
408 | 54 | |||
409 | 55 | logger = logging.getLogger("ubuntuone.platform.SyncMenu") | ||
410 | 56 | |||
411 | 57 | |||
412 | 58 | def Q_(string): | ||
413 | 59 | return gettext.dgettext(GETTEXT_PACKAGE, string) | ||
414 | 60 | |||
415 | 61 | |||
416 | 62 | GET_HELP = Q_("Get Help on the Web") | ||
417 | 63 | GO_TO_WEB = Q_("Go to the main website") | ||
418 | 64 | MORE_STORAGE = Q_("Get More Space") | ||
419 | 65 | OPEN_U1 = Q_("Open") | ||
420 | 66 | OPEN_U1_FOLDER = Q_("Open the main folder") | ||
421 | 67 | SHARE_A_FILE = Q_("Share a File") | ||
422 | 68 | TRANSFERS = Q_("Current and Recent Transfers") | ||
423 | 69 | |||
424 | 70 | DELAY_BETWEEN_UPDATES = 3 | ||
425 | 71 | UBUNTUONE_LINK = u'https://one.ubuntu.com/' | ||
426 | 72 | DASHBOARD = UBUNTUONE_LINK + u'dashboard/' | ||
427 | 73 | HELP_LINK = UBUNTUONE_LINK + u'support/' | ||
428 | 74 | GET_STORAGE_LINK = UBUNTUONE_LINK + u'services/add-storage/' | ||
429 | 75 | CLIENT_COMMAND_LINE = 'ubuntuone-control-panel-qt' | ||
430 | 76 | CLIENT_DESKTOP_ID = 'ubuntuone-installer.desktop' | ||
431 | 77 | |||
432 | 78 | |||
433 | 79 | class UbuntuOneSyncMenuLinux(object): | ||
434 | 80 | """Integrate U1 with the Ubuntu Sync Menu.""" | ||
435 | 81 | |||
436 | 82 | def __init__(self, status, syncdaemon_service): | ||
437 | 83 | """Initialize menu.""" | ||
438 | 84 | self._syncdaemon_service = syncdaemon_service | ||
439 | 85 | self._connected = True | ||
440 | 86 | self.timer = None | ||
441 | 87 | self._ignore_status_event = False | ||
442 | 88 | self.next_update = time.time() | ||
443 | 89 | self.root_menu = Dbusmenu.Menuitem() | ||
444 | 90 | |||
445 | 91 | self.open_u1 = Dbusmenu.Menuitem() | ||
446 | 92 | self.open_u1.property_set(Dbusmenu.MENUITEM_PROP_LABEL, OPEN_U1) | ||
447 | 93 | self.open_u1_folder = Dbusmenu.Menuitem() | ||
448 | 94 | self.open_u1_folder.property_set( | ||
449 | 95 | Dbusmenu.MENUITEM_PROP_LABEL, OPEN_U1_FOLDER) | ||
450 | 96 | self.share_file = Dbusmenu.Menuitem() | ||
451 | 97 | self.share_file.property_set( | ||
452 | 98 | Dbusmenu.MENUITEM_PROP_LABEL, SHARE_A_FILE) | ||
453 | 99 | |||
454 | 100 | self.go_to_web = Dbusmenu.Menuitem() | ||
455 | 101 | self.go_to_web.property_set( | ||
456 | 102 | Dbusmenu.MENUITEM_PROP_LABEL, GO_TO_WEB) | ||
457 | 103 | |||
458 | 104 | self.transfers = TransfersMenu(status) | ||
459 | 105 | self.transfers.property_set( | ||
460 | 106 | Dbusmenu.MENUITEM_PROP_LABEL, TRANSFERS) | ||
461 | 107 | |||
462 | 108 | self.more_storage = Dbusmenu.Menuitem() | ||
463 | 109 | self.more_storage.property_set( | ||
464 | 110 | Dbusmenu.MENUITEM_PROP_LABEL, MORE_STORAGE) | ||
465 | 111 | |||
466 | 112 | self.get_help = Dbusmenu.Menuitem() | ||
467 | 113 | self.get_help.property_set( | ||
468 | 114 | Dbusmenu.MENUITEM_PROP_LABEL, GET_HELP) | ||
469 | 115 | |||
470 | 116 | # Connect signals | ||
471 | 117 | self.open_u1.connect( | ||
472 | 118 | Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.open_control_panel) | ||
473 | 119 | self.open_u1_folder.connect( | ||
474 | 120 | Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, | ||
475 | 121 | self.open_ubuntu_one_folder) | ||
476 | 122 | self.share_file.connect( | ||
477 | 123 | Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.open_share_file_tab) | ||
478 | 124 | self.go_to_web.connect( | ||
479 | 125 | Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.open_go_to_web) | ||
480 | 126 | self.get_help.connect( | ||
481 | 127 | Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.open_web_help) | ||
482 | 128 | self.more_storage.connect( | ||
483 | 129 | Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, | ||
484 | 130 | self.open_get_more_storage) | ||
485 | 131 | |||
486 | 132 | # Add items | ||
487 | 133 | self.root_menu.child_append(self.open_u1) | ||
488 | 134 | self.root_menu.child_append(self.open_u1_folder) | ||
489 | 135 | self.root_menu.child_append(self.share_file) | ||
490 | 136 | self.root_menu.child_append(self.go_to_web) | ||
491 | 137 | self.root_menu.child_append(self.transfers) | ||
492 | 138 | self.root_menu.child_append(self.more_storage) | ||
493 | 139 | self.root_menu.child_append(self.get_help) | ||
494 | 140 | |||
495 | 141 | self.server = Dbusmenu.Server() | ||
496 | 142 | self.server.set_root(self.root_menu) | ||
497 | 143 | self.app = SyncMenu.App.new(CLIENT_DESKTOP_ID) | ||
498 | 144 | self.app.set_menu(self.server) | ||
499 | 145 | self.app.connect("notify::paused", self.change_sync_status) | ||
500 | 146 | |||
501 | 147 | def sync_status_changed(self, status): | ||
502 | 148 | """Listen to the changes for the sync status.""" | ||
503 | 149 | if status != self._connected: | ||
504 | 150 | self._connected = status | ||
505 | 151 | self._ignore_status_event = True | ||
506 | 152 | self.app.set_paused(not self._connected) | ||
507 | 153 | |||
508 | 154 | def change_sync_status(self, *args): | ||
509 | 155 | """Triggered when the sync status is changed fromm the menu.""" | ||
510 | 156 | if self._ignore_status_event: | ||
511 | 157 | self._ignore_status_event = False | ||
512 | 158 | elif self._connected: | ||
513 | 159 | self._syncdaemon_service.disconnect() | ||
514 | 160 | self._connected = False | ||
515 | 161 | else: | ||
516 | 162 | self._syncdaemon_service.connect() | ||
517 | 163 | self._connected = True | ||
518 | 164 | |||
519 | 165 | def _get_launch_context(self, timestamp): | ||
520 | 166 | """Returns the launch context for the current display""" | ||
521 | 167 | dpy = Gdk.Display.get_default() | ||
522 | 168 | |||
523 | 169 | if dpy: | ||
524 | 170 | context = dpy.get_app_launch_context() | ||
525 | 171 | context.set_timestamp(timestamp) | ||
526 | 172 | return context | ||
527 | 173 | |||
528 | 174 | return None | ||
529 | 175 | |||
530 | 176 | def _open_uri(self, uri, timestamp=0): | ||
531 | 177 | """Open an uri Using the default handler and the action timestamp""" | ||
532 | 178 | try: | ||
533 | 179 | Gio.AppInfo.launch_default_for_uri( | ||
534 | 180 | uri, self._get_launch_context(timestamp)) | ||
535 | 181 | except glib.GError as e: | ||
536 | 182 | logger.warning('Failed to open the uri %s: %s.', uri, e) | ||
537 | 183 | |||
538 | 184 | def _open_control_panel_by_command_line(self, timestamp, args=''): | ||
539 | 185 | """Open the control panel by command line""" | ||
540 | 186 | flags = Gio.AppInfoCreateFlags.SUPPORTS_STARTUP_NOTIFICATION | ||
541 | 187 | command_line = CLIENT_COMMAND_LINE | ||
542 | 188 | if len(args): | ||
543 | 189 | command_line += ' ' + args | ||
544 | 190 | |||
545 | 191 | try: | ||
546 | 192 | app = Gio.AppInfo.create_from_commandline( | ||
547 | 193 | command_line, NAME, flags) | ||
548 | 194 | |||
549 | 195 | if app: | ||
550 | 196 | app.launch([], self._get_launch_context(timestamp)) | ||
551 | 197 | except glib.GError as e: | ||
552 | 198 | logger.warning('Failed to open the control panel: %s.' % e) | ||
553 | 199 | |||
554 | 200 | def open_control_panel(self, menuitem=None, timestamp=0): | ||
555 | 201 | """Open the Control Panel.""" | ||
556 | 202 | app = Gio.DesktopAppInfo.new(CLIENT_DESKTOP_ID) | ||
557 | 203 | |||
558 | 204 | if app: | ||
559 | 205 | try: | ||
560 | 206 | app.launch([], self._get_launch_context(timestamp)) | ||
561 | 207 | except glib.GError as e: | ||
562 | 208 | logger.warning('Failed to open the control panel: %s.' % e) | ||
563 | 209 | else: | ||
564 | 210 | self._open_control_panel_by_command_line(timestamp) | ||
565 | 211 | |||
566 | 212 | def open_ubuntu_one_folder(self, menuitem=None, timestamp=0): | ||
567 | 213 | """Open the folder.""" | ||
568 | 214 | self._open_uri( | ||
569 | 215 | "file://" + self._syncdaemon_service.get_rootdir(), timestamp) | ||
570 | 216 | |||
571 | 217 | def open_share_file_tab(self, menuitem=None, timestamp=0): | ||
572 | 218 | """Open the Control Panel in the Share Tab.""" | ||
573 | 219 | self._open_control_panel_by_command_line( | ||
574 | 220 | timestamp, "--switch-to share_links") | ||
575 | 221 | |||
576 | 222 | def open_go_to_web(self, menuitem=None, timestamp=0): | ||
577 | 223 | """Open the Help Page""" | ||
578 | 224 | self._open_uri(DASHBOARD, timestamp) | ||
579 | 225 | |||
580 | 226 | def open_web_help(self, menuitem=None, timestamp=0): | ||
581 | 227 | """Open the Help Page""" | ||
582 | 228 | self._open_uri(HELP_LINK, timestamp) | ||
583 | 229 | |||
584 | 230 | def open_get_more_storage(self, menuitem=None, timestamp=0): | ||
585 | 231 | """Open the Help Page""" | ||
586 | 232 | self._open_uri(GET_STORAGE_LINK, timestamp) | ||
587 | 233 | |||
588 | 234 | def _timeout(self, result): | ||
589 | 235 | """The aggregating timer has expired, so update the UI.""" | ||
590 | 236 | self.next_update = int(time.time()) + DELAY_BETWEEN_UPDATES | ||
591 | 237 | self.transfers.update_progress() | ||
592 | 238 | |||
593 | 239 | def update_transfers(self): | ||
594 | 240 | """Set up a timer if there isn't one ticking and update the ui. | ||
595 | 241 | |||
596 | 242 | NOOP. Left behind for API compatibility, will be removed later when | ||
597 | 243 | all interaction with old syncmeny and desktop GUIs go away. | ||
598 | 244 | """ | ||
599 | 245 | |||
600 | 246 | |||
601 | 247 | class TransfersMenu(Dbusmenu.Menuitem if use_syncmenu else object): | ||
602 | 248 | """Menu that handles the recent and current transfers.""" | ||
603 | 249 | |||
604 | 250 | def __init__(self, status_frontend): | ||
605 | 251 | super(TransfersMenu, self).__init__() | ||
606 | 252 | self.status_frontend = status_frontend | ||
607 | 253 | self.uploading = {} | ||
608 | 254 | self.previous_transfers = [] | ||
609 | 255 | self._transfers_items = {} | ||
610 | 256 | self._uploading_items = {} | ||
611 | 257 | self.separator = None | ||
612 | 258 | |||
613 | 259 | def update_progress(self): | ||
614 | 260 | """Update the list of recent transfers and current transfers.""" | ||
615 | 261 | recent_transfers = self.status_frontend.recent_transfers() | ||
616 | 262 | current_transfers = self.status_frontend.files_uploading() | ||
617 | 263 | current_transfers.sort(key=itemgetter(2)) | ||
618 | 264 | current_transfers.reverse() | ||
619 | 265 | uploading_data = OrderedDict() | ||
620 | 266 | for filename, size, written in current_transfers: | ||
621 | 267 | uploading_data[filename] = (size, written) | ||
622 | 268 | |||
623 | 269 | temp_transfers = {} | ||
624 | 270 | if recent_transfers != self.previous_transfers: | ||
625 | 271 | logger.debug("Update recent transfers with: %r", recent_transfers) | ||
626 | 272 | for item_transfer in self._transfers_items: | ||
627 | 273 | self.child_delete(self._transfers_items[item_transfer]) | ||
628 | 274 | for item in recent_transfers: | ||
629 | 275 | recent_file = Dbusmenu.Menuitem() | ||
630 | 276 | recent_file.property_set( | ||
631 | 277 | Dbusmenu.MENUITEM_PROP_LABEL, item.replace('_', '__')) | ||
632 | 278 | self.child_add_position(recent_file, 0) | ||
633 | 279 | temp_transfers[item] = recent_file | ||
634 | 280 | self._transfers_items = temp_transfers | ||
635 | 281 | |||
636 | 282 | if self.separator is None: | ||
637 | 283 | self.separator = Dbusmenu.Menuitem() | ||
638 | 284 | self.separator.property_set( | ||
639 | 285 | Dbusmenu.MENUITEM_PROP_TYPE, Dbusmenu.CLIENT_TYPES_SEPARATOR) | ||
640 | 286 | self.child_append(self.separator) | ||
641 | 287 | |||
642 | 288 | items_added = 0 | ||
643 | 289 | remove = [] | ||
644 | 290 | for item in self._uploading_items: | ||
645 | 291 | if item in uploading_data.keys(): | ||
646 | 292 | size, written = uploading_data[item] | ||
647 | 293 | percentage = written * 100 / size | ||
648 | 294 | upload_item = self._uploading_items[item] | ||
649 | 295 | upload_item.property_set_int( | ||
650 | 296 | SyncMenu.PROGRESS_MENUITEM_PROP_PERCENT_DONE, | ||
651 | 297 | percentage) | ||
652 | 298 | logger.debug( | ||
653 | 299 | "Current transfer %s progress update: %r", | ||
654 | 300 | item, percentage) | ||
655 | 301 | items_added += 1 | ||
656 | 302 | else: | ||
657 | 303 | self.child_delete(self._uploading_items[item]) | ||
658 | 304 | remove.append(item) | ||
659 | 305 | for item in remove: | ||
660 | 306 | self._uploading_items.pop(item) | ||
661 | 307 | if items_added < 5: | ||
662 | 308 | for item in uploading_data.keys(): | ||
663 | 309 | if item not in self._uploading_items and items_added < 5: | ||
664 | 310 | size, written = uploading_data[item] | ||
665 | 311 | percentage = written * 100 / size | ||
666 | 312 | uploading_file = Dbusmenu.Menuitem() | ||
667 | 313 | uploading_file.property_set( | ||
668 | 314 | Dbusmenu.MENUITEM_PROP_LABEL, item.replace('_', '__')) | ||
669 | 315 | uploading_file.property_set( | ||
670 | 316 | Dbusmenu.MENUITEM_PROP_TYPE, | ||
671 | 317 | SyncMenu.PROGRESS_MENUITEM_TYPE) | ||
672 | 318 | uploading_file.property_set_int( | ||
673 | 319 | SyncMenu.PROGRESS_MENUITEM_PROP_PERCENT_DONE, | ||
674 | 320 | percentage) | ||
675 | 321 | logger.debug("Current transfer %s created", item) | ||
676 | 322 | self.child_append(uploading_file) | ||
677 | 323 | self._uploading_items[item] = uploading_file | ||
678 | 324 | items_added += 1 | ||
679 | 325 | |||
680 | 326 | |||
681 | 327 | if use_syncmenu: | ||
682 | 328 | UbuntuOneSyncMenu = UbuntuOneSyncMenuLinux | ||
683 | 329 | else: | ||
684 | 330 | UbuntuOneSyncMenu = DummySyncMenu | ||
685 | 331 | 0 | ||
686 | === modified file 'ubuntuone/platform/tests/ipc/test_external_interface.py' | |||
687 | --- ubuntuone/platform/tests/ipc/test_external_interface.py 2016-09-17 01:06:23 +0000 | |||
688 | +++ ubuntuone/platform/tests/ipc/test_external_interface.py 2018-04-24 23:14:39 +0000 | |||
689 | @@ -1,6 +1,7 @@ | |||
690 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
691 | 2 | # | 2 | # |
692 | 3 | # Copyright 2011-2012 Canonical Ltd. | 3 | # Copyright 2011-2012 Canonical Ltd. |
693 | 4 | # Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros) | ||
694 | 4 | # | 5 | # |
695 | 5 | # This program is free software: you can redistribute it and/or modify it | 6 | # This program is free software: you can redistribute it and/or modify it |
696 | 6 | # under the terms of the GNU General Public License version 3, as published | 7 | # under the terms of the GNU General Public License version 3, as published |
697 | @@ -40,10 +41,6 @@ | |||
698 | 40 | StatusTestCase, | 41 | StatusTestCase, |
699 | 41 | SyncDaemonTestCase, | 42 | SyncDaemonTestCase, |
700 | 42 | ) | 43 | ) |
701 | 43 | from ubuntuone.syncdaemon import ( | ||
702 | 44 | RECENT_TRANSFERS, | ||
703 | 45 | UPLOADING, | ||
704 | 46 | ) | ||
705 | 47 | 44 | ||
706 | 48 | STR = 'something' | 45 | STR = 'something' |
707 | 49 | STR_STR_DICT = {'foo': 'bar'} | 46 | STR_STR_DICT = {'foo': 'bar'} |
708 | @@ -68,7 +65,7 @@ | |||
709 | 68 | ('ContentQueueChanged', ()), | 65 | ('ContentQueueChanged', ()), |
710 | 69 | ('MetaQueueChanged', ()), | 66 | ('MetaQueueChanged', ()), |
711 | 70 | ('RequestQueueAdded', (STR, STR, STR_STR_DICT)), | 67 | ('RequestQueueAdded', (STR, STR, STR_STR_DICT)), |
713 | 71 | ('RequestQueueRemoved', (STR, STR, STR_STR_DICT)), | 68 | ('RequestQueueRemoved', (STR, STR, STR_STR_DICT)), |
714 | 72 | ] | 69 | ] |
715 | 73 | 70 | ||
716 | 74 | @defer.inlineCallbacks | 71 | @defer.inlineCallbacks |
717 | @@ -136,16 +133,6 @@ | |||
718 | 136 | self.assert_remote_method( | 133 | self.assert_remote_method( |
719 | 137 | 'waiting_metadata', in_signature=None, out_signature='a(sa{ss})') | 134 | 'waiting_metadata', in_signature=None, out_signature='a(sa{ss})') |
720 | 138 | 135 | ||
721 | 139 | @defer.inlineCallbacks | ||
722 | 140 | def test_sync_menu(self): | ||
723 | 141 | """Test sync_menu.""" | ||
724 | 142 | result = {RECENT_TRANSFERS: [], UPLOADING: []} | ||
725 | 143 | method = 'sync_menu' | ||
726 | 144 | yield self.assert_method_called(self.service.status, | ||
727 | 145 | method, result) | ||
728 | 146 | self.assert_remote_method( | ||
729 | 147 | method, in_signature=None, out_signature='a{sv}') | ||
730 | 148 | |||
731 | 149 | 136 | ||
732 | 150 | class EventsTests(EventsTestCase): | 137 | class EventsTests(EventsTestCase): |
733 | 151 | """Basic tests for the Events exposed object.""" | 138 | """Basic tests for the Events exposed object.""" |
734 | 152 | 139 | ||
735 | === removed directory 'ubuntuone/platform/tests/sync_menu' | |||
736 | === removed file 'ubuntuone/platform/tests/sync_menu/__init__.py' | |||
737 | --- ubuntuone/platform/tests/sync_menu/__init__.py 2012-09-18 16:22:15 +0000 | |||
738 | +++ ubuntuone/platform/tests/sync_menu/__init__.py 1970-01-01 00:00:00 +0000 | |||
739 | @@ -1,27 +0,0 @@ | |||
740 | 1 | # Copyright 2012 Canonical Ltd. | ||
741 | 2 | # | ||
742 | 3 | # This program is free software: you can redistribute it and/or modify it | ||
743 | 4 | # under the terms of the GNU General Public License version 3, as published | ||
744 | 5 | # by the Free Software Foundation. | ||
745 | 6 | # | ||
746 | 7 | # This program is distributed in the hope that it will be useful, but | ||
747 | 8 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
748 | 9 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
749 | 10 | # PURPOSE. See the GNU General Public License for more details. | ||
750 | 11 | # | ||
751 | 12 | # You should have received a copy of the GNU General Public License along | ||
752 | 13 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
753 | 14 | # | ||
754 | 15 | # In addition, as a special exception, the copyright holders give | ||
755 | 16 | # permission to link the code of portions of this program with the | ||
756 | 17 | # OpenSSL library under certain conditions as described in each | ||
757 | 18 | # individual source file, and distribute linked combinations | ||
758 | 19 | # including the two. | ||
759 | 20 | # You must obey the GNU General Public License in all respects | ||
760 | 21 | # for all of the code used other than OpenSSL. If you modify | ||
761 | 22 | # file(s) with this exception, you may extend this exception to your | ||
762 | 23 | # version of the file(s), but you are not obligated to do so. If you | ||
763 | 24 | # do not wish to do so, delete this exception statement from your | ||
764 | 25 | # version. If you delete this exception statement from all source | ||
765 | 26 | # files in the program, then also delete it here. | ||
766 | 27 | """SyncMenu test code.""" | ||
767 | 28 | 0 | ||
768 | === removed file 'ubuntuone/platform/tests/sync_menu/test_common.py' | |||
769 | --- ubuntuone/platform/tests/sync_menu/test_common.py 2012-10-15 21:20:54 +0000 | |||
770 | +++ ubuntuone/platform/tests/sync_menu/test_common.py 1970-01-01 00:00:00 +0000 | |||
771 | @@ -1,54 +0,0 @@ | |||
772 | 1 | # -*- coding: utf-8 *-* | ||
773 | 2 | # | ||
774 | 3 | # Copyright 2012 Canonical Ltd. | ||
775 | 4 | # | ||
776 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
777 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
778 | 7 | # by the Free Software Foundation. | ||
779 | 8 | # | ||
780 | 9 | # This program is distributed in the hope that it will be useful, but | ||
781 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
782 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
783 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
784 | 13 | # | ||
785 | 14 | # You should have received a copy of the GNU General Public License along | ||
786 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
787 | 16 | # | ||
788 | 17 | # In addition, as a special exception, the copyright holders give | ||
789 | 18 | # permission to link the code of portions of this program with the | ||
790 | 19 | # OpenSSL library under certain conditions as described in each | ||
791 | 20 | # individual source file, and distribute linked combinations | ||
792 | 21 | # including the two. | ||
793 | 22 | # You must obey the GNU General Public License in all respects | ||
794 | 23 | # for all of the code used other than OpenSSL. If you modify | ||
795 | 24 | # file(s) with this exception, you may extend this exception to your | ||
796 | 25 | # version of the file(s), but you are not obligated to do so. If you | ||
797 | 26 | # do not wish to do so, delete this exception statement from your | ||
798 | 27 | # version. If you delete this exception statement from all source | ||
799 | 28 | # files in the program, then also delete it here. | ||
800 | 29 | """Test the common dummy Sync Menu implementation for win32/darwin.""" | ||
801 | 30 | |||
802 | 31 | from collections import Callable | ||
803 | 32 | |||
804 | 33 | from twisted.trial.unittest import TestCase | ||
805 | 34 | |||
806 | 35 | from ubuntuone.platform.sync_menu import common | ||
807 | 36 | |||
808 | 37 | |||
809 | 38 | class SyncMenuDummyTestCase(TestCase): | ||
810 | 39 | """Test the SyncMenu.""" | ||
811 | 40 | |||
812 | 41 | def test_dummy_support(self): | ||
813 | 42 | """Can we create a Dummy with the same #args as the real obj.""" | ||
814 | 43 | dummy = common.UbuntuOneSyncMenu(1, 2) | ||
815 | 44 | self.assertIsInstance(dummy, common.UbuntuOneSyncMenu) | ||
816 | 45 | |||
817 | 46 | def test_dummy_has_update_transfers(self): | ||
818 | 47 | """Check that the dummy has the proper methods required by the API.""" | ||
819 | 48 | dummy = common.UbuntuOneSyncMenu(1, 2) | ||
820 | 49 | self.assertIsInstance(dummy.update_transfers, Callable) | ||
821 | 50 | |||
822 | 51 | def test_dummy_has_sync_status_changed(self): | ||
823 | 52 | """Check that the dummy has the proper methods required by the API.""" | ||
824 | 53 | dummy = common.UbuntuOneSyncMenu(1, 2) | ||
825 | 54 | self.assertIsInstance(dummy.sync_status_changed, Callable) | ||
826 | 55 | 0 | ||
827 | === removed file 'ubuntuone/platform/tests/sync_menu/test_linux.py' | |||
828 | --- ubuntuone/platform/tests/sync_menu/test_linux.py 2016-09-17 01:06:23 +0000 | |||
829 | +++ ubuntuone/platform/tests/sync_menu/test_linux.py 1970-01-01 00:00:00 +0000 | |||
830 | @@ -1,586 +0,0 @@ | |||
831 | 1 | # -*- coding: utf-8 *-* | ||
832 | 2 | # | ||
833 | 3 | # Copyright 2012 Canonical Ltd. | ||
834 | 4 | # | ||
835 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
836 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
837 | 7 | # by the Free Software Foundation. | ||
838 | 8 | # | ||
839 | 9 | # This program is distributed in the hope that it will be useful, but | ||
840 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
841 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
842 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
843 | 13 | # | ||
844 | 14 | # You should have received a copy of the GNU General Public License along | ||
845 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
846 | 16 | # | ||
847 | 17 | # In addition, as a special exception, the copyright holders give | ||
848 | 18 | # permission to link the code of portions of this program with the | ||
849 | 19 | # OpenSSL library under certain conditions as described in each | ||
850 | 20 | # individual source file, and distribute linked combinations | ||
851 | 21 | # including the two. | ||
852 | 22 | # You must obey the GNU General Public License in all respects | ||
853 | 23 | # for all of the code used other than OpenSSL. If you modify | ||
854 | 24 | # file(s) with this exception, you may extend this exception to your | ||
855 | 25 | # version of the file(s), but you are not obligated to do so. If you | ||
856 | 26 | # do not wish to do so, delete this exception statement from your | ||
857 | 27 | # version. If you delete this exception statement from all source | ||
858 | 28 | # files in the program, then also delete it here. | ||
859 | 29 | """Test the Sync Menu.""" | ||
860 | 30 | |||
861 | 31 | import time | ||
862 | 32 | from collections import Callable | ||
863 | 33 | |||
864 | 34 | from twisted.internet import defer | ||
865 | 35 | from twisted.trial.unittest import TestCase | ||
866 | 36 | |||
867 | 37 | from ubuntuone.platform import sync_menu | ||
868 | 38 | from ubuntuone.platform.sync_menu import linux | ||
869 | 39 | |||
870 | 40 | |||
871 | 41 | def fake_call_later(*args): | ||
872 | 42 | """Fake reactor.callLater.""" | ||
873 | 43 | |||
874 | 44 | |||
875 | 45 | class FakeStatusFrontend(object): | ||
876 | 46 | """Fake StatusFrontend.""" | ||
877 | 47 | |||
878 | 48 | def __init__(self): | ||
879 | 49 | self.recent_transfers_data = [] | ||
880 | 50 | self.uploading_data = [] | ||
881 | 51 | |||
882 | 52 | def recent_transfers(self): | ||
883 | 53 | """Return the fake recent transfers files.""" | ||
884 | 54 | return self.recent_transfers_data | ||
885 | 55 | |||
886 | 56 | def files_uploading(self): | ||
887 | 57 | """Return the fake files being upload.""" | ||
888 | 58 | return self.uploading_data | ||
889 | 59 | |||
890 | 60 | |||
891 | 61 | class FakeAppLaunchContext(object): | ||
892 | 62 | def set_timestamp(self, timestamp): | ||
893 | 63 | self.timestamp = timestamp | ||
894 | 64 | |||
895 | 65 | |||
896 | 66 | class FakeGdkDisplay(object): | ||
897 | 67 | """Fake Gdk.Display""" | ||
898 | 68 | def get_app_launch_context(self): | ||
899 | 69 | return FakeAppLaunchContext() | ||
900 | 70 | |||
901 | 71 | |||
902 | 72 | class FakeNullGdk(object): | ||
903 | 73 | """Fake Gdk.Display with no default""" | ||
904 | 74 | @staticmethod | ||
905 | 75 | def get_default(): | ||
906 | 76 | return None | ||
907 | 77 | |||
908 | 78 | |||
909 | 79 | class FakeAppInfo(object): | ||
910 | 80 | """Fake Gio.AppInfo""" | ||
911 | 81 | instance = None | ||
912 | 82 | name = "" | ||
913 | 83 | desktop_id = "" | ||
914 | 84 | command_line = "" | ||
915 | 85 | opened_uri = "" | ||
916 | 86 | launched = True | ||
917 | 87 | context = None | ||
918 | 88 | files = [] | ||
919 | 89 | flags = 0 | ||
920 | 90 | |||
921 | 91 | def __new__(cls, *args, **kwargs): | ||
922 | 92 | cls.instance = super(FakeAppInfo, cls).__new__(cls, *args, **kwargs) | ||
923 | 93 | return cls.instance | ||
924 | 94 | |||
925 | 95 | def __init__(self, command_line="", name="", flags=0): | ||
926 | 96 | self.command_line = command_line | ||
927 | 97 | self.name = name | ||
928 | 98 | self.flags = flags | ||
929 | 99 | |||
930 | 100 | @classmethod | ||
931 | 101 | def launch_default_for_uri(cls, uri, context): | ||
932 | 102 | cls.opened_uri = uri | ||
933 | 103 | cls.context = context | ||
934 | 104 | |||
935 | 105 | @classmethod | ||
936 | 106 | def create_from_commandline(cls, command_line, name, flags): | ||
937 | 107 | cls.instance.__init__(command_line, name, flags) | ||
938 | 108 | return cls.instance | ||
939 | 109 | |||
940 | 110 | def launch(self, files, context): | ||
941 | 111 | self.launched = True | ||
942 | 112 | self.files = files | ||
943 | 113 | self.context = context | ||
944 | 114 | |||
945 | 115 | |||
946 | 116 | class FakeDesktopAppInfo(FakeAppInfo): | ||
947 | 117 | """Fake Gio.DestkopAppInfo""" | ||
948 | 118 | def __init__(self, desktop_id=""): | ||
949 | 119 | super(FakeDesktopAppInfo, self).__init__() | ||
950 | 120 | self.desktop_id = desktop_id | ||
951 | 121 | |||
952 | 122 | @classmethod | ||
953 | 123 | def new(cls, desktop_id): | ||
954 | 124 | cls.instance.__init__(desktop_id) | ||
955 | 125 | return cls.instance | ||
956 | 126 | |||
957 | 127 | |||
958 | 128 | class FakeSyncdaemonService(object): | ||
959 | 129 | """Fake SyncdaemonService.""" | ||
960 | 130 | |||
961 | 131 | def __init__(self): | ||
962 | 132 | self.connect_called = False | ||
963 | 133 | self.disconnect_called = False | ||
964 | 134 | self.fake_root_path = "/home/user/Magicicada" | ||
965 | 135 | |||
966 | 136 | def connect(self): | ||
967 | 137 | """Set connect to True.""" | ||
968 | 138 | self.connect_called = True | ||
969 | 139 | |||
970 | 140 | def disconnect(self): | ||
971 | 141 | """Set connect to True.""" | ||
972 | 142 | self.disconnect_called = True | ||
973 | 143 | |||
974 | 144 | def get_rootdir(self): | ||
975 | 145 | """Return a fake ubuntu one folder path.""" | ||
976 | 146 | return self.fake_root_path | ||
977 | 147 | |||
978 | 148 | |||
979 | 149 | class FakeSyncMenuApp(object): | ||
980 | 150 | """Fake SyncMenu.""" | ||
981 | 151 | |||
982 | 152 | data = {} | ||
983 | 153 | |||
984 | 154 | @classmethod | ||
985 | 155 | def new(cls, *args): | ||
986 | 156 | return FakeSyncMenuApp() | ||
987 | 157 | |||
988 | 158 | @classmethod | ||
989 | 159 | def clean(cls): | ||
990 | 160 | """Clear the values stored in data.""" | ||
991 | 161 | FakeSyncMenuApp.data = {} | ||
992 | 162 | |||
993 | 163 | def set_menu(self, server): | ||
994 | 164 | """Set the menu for SyncMenu App.""" | ||
995 | 165 | self.data['server'] = server | ||
996 | 166 | |||
997 | 167 | def connect(self, signal, callback): | ||
998 | 168 | """Fake connect.""" | ||
999 | 169 | self.data['connect'] = (signal, callback) | ||
1000 | 170 | |||
1001 | 171 | def set_paused(self, status): | ||
1002 | 172 | """Set the pause state.""" | ||
1003 | 173 | self.data['paused'] = status | ||
1004 | 174 | |||
1005 | 175 | |||
1006 | 176 | class SyncMenuDummyTestCase(TestCase): | ||
1007 | 177 | """Test the SyncMenu.""" | ||
1008 | 178 | |||
1009 | 179 | def test_dummy_support(self): | ||
1010 | 180 | """Check that the Dummy object can be created properly.""" | ||
1011 | 181 | dummy = linux.DummySyncMenu('random', 'args') | ||
1012 | 182 | self.assertIsInstance(dummy, linux.DummySyncMenu) | ||
1013 | 183 | |||
1014 | 184 | def test_dummy_has_update_transfers(self): | ||
1015 | 185 | """Check that the dummy has the proper methods required by the API.""" | ||
1016 | 186 | dummy = linux.DummySyncMenu('random', 'args') | ||
1017 | 187 | self.assertIsInstance(dummy.update_transfers, Callable) | ||
1018 | 188 | self.assertIsInstance(dummy.sync_status_changed, Callable) | ||
1019 | 189 | |||
1020 | 190 | |||
1021 | 191 | class SyncMenuTestCase(TestCase): | ||
1022 | 192 | """Test the SyncMenu.""" | ||
1023 | 193 | |||
1024 | 194 | skip = None if linux.use_syncmenu else "SyncMenu not installed." | ||
1025 | 195 | |||
1026 | 196 | @defer.inlineCallbacks | ||
1027 | 197 | def setUp(self): | ||
1028 | 198 | yield super(SyncMenuTestCase, self).setUp() | ||
1029 | 199 | self.patch(linux.SyncMenu, "App", FakeSyncMenuApp) | ||
1030 | 200 | self.patch(linux.Gdk.Display, "get_default", FakeGdkDisplay) | ||
1031 | 201 | FakeSyncMenuApp.clean() | ||
1032 | 202 | self.syncdaemon_service = FakeSyncdaemonService() | ||
1033 | 203 | self.status_frontend = FakeStatusFrontend() | ||
1034 | 204 | self._paused = False | ||
1035 | 205 | self.sync_menu = sync_menu.UbuntuOneSyncMenu( | ||
1036 | 206 | self.status_frontend, self.syncdaemon_service) | ||
1037 | 207 | |||
1038 | 208 | def test_init(self): | ||
1039 | 209 | """Check that the menu is properly initialized.""" | ||
1040 | 210 | self.assertIsInstance( | ||
1041 | 211 | FakeSyncMenuApp.data['server'], linux.Dbusmenu.Server) | ||
1042 | 212 | self.assertEqual( | ||
1043 | 213 | self.sync_menu.open_u1.get_parent(), self.sync_menu.root_menu) | ||
1044 | 214 | self.assertEqual( | ||
1045 | 215 | self.sync_menu.go_to_web.get_parent(), self.sync_menu.root_menu) | ||
1046 | 216 | self.assertEqual( | ||
1047 | 217 | self.sync_menu.more_storage.get_parent(), self.sync_menu.root_menu) | ||
1048 | 218 | self.assertEqual( | ||
1049 | 219 | self.sync_menu.get_help.get_parent(), self.sync_menu.root_menu) | ||
1050 | 220 | self.assertEqual( | ||
1051 | 221 | self.sync_menu.transfers.get_parent(), self.sync_menu.root_menu) | ||
1052 | 222 | self.assertEqual( | ||
1053 | 223 | self.sync_menu.open_u1_folder.get_parent(), | ||
1054 | 224 | self.sync_menu.root_menu) | ||
1055 | 225 | self.assertEqual( | ||
1056 | 226 | self.sync_menu.share_file.get_parent(), self.sync_menu.root_menu) | ||
1057 | 227 | |||
1058 | 228 | def get_prop(item): | ||
1059 | 229 | return item.property_get(linux.Dbusmenu.MENUITEM_PROP_LABEL) | ||
1060 | 230 | |||
1061 | 231 | self.assertEqual( | ||
1062 | 232 | get_prop(self.sync_menu.open_u1), linux.OPEN_U1) | ||
1063 | 233 | self.assertEqual( | ||
1064 | 234 | get_prop(self.sync_menu.open_u1_folder), linux.OPEN_U1_FOLDER) | ||
1065 | 235 | self.assertEqual( | ||
1066 | 236 | get_prop(self.sync_menu.share_file), linux.SHARE_A_FILE) | ||
1067 | 237 | self.assertEqual( | ||
1068 | 238 | get_prop(self.sync_menu.go_to_web), linux.GO_TO_WEB) | ||
1069 | 239 | self.assertEqual( | ||
1070 | 240 | get_prop(self.sync_menu.transfers), linux.TRANSFERS) | ||
1071 | 241 | self.assertEqual( | ||
1072 | 242 | get_prop(self.sync_menu.more_storage), linux.MORE_STORAGE) | ||
1073 | 243 | self.assertEqual( | ||
1074 | 244 | get_prop(self.sync_menu.get_help), linux.GET_HELP) | ||
1075 | 245 | |||
1076 | 246 | self.sync_menu.transfers.update_progress() | ||
1077 | 247 | self.assertIsInstance( | ||
1078 | 248 | self.sync_menu.transfers.separator, linux.Dbusmenu.Menuitem) | ||
1079 | 249 | |||
1080 | 250 | def test_get_launch_context_with_display(self): | ||
1081 | 251 | """Check that the proper context is returned.""" | ||
1082 | 252 | timestamp = time.time() | ||
1083 | 253 | context = self.sync_menu._get_launch_context(timestamp) | ||
1084 | 254 | self.assertEqual(timestamp, context.timestamp) | ||
1085 | 255 | |||
1086 | 256 | def test_get_launch_context_with_no_display(self): | ||
1087 | 257 | """Check that the proper context is returned.""" | ||
1088 | 258 | self.patch(linux.Gdk, "Display", FakeNullGdk) | ||
1089 | 259 | context = self.sync_menu._get_launch_context(time.time()) | ||
1090 | 260 | self.assertEqual(context, None) | ||
1091 | 261 | |||
1092 | 262 | def test_open_control_panel_by_command_line(self): | ||
1093 | 263 | """Check that the proper action is executed.""" | ||
1094 | 264 | appinfo = FakeAppInfo() | ||
1095 | 265 | self.patch(linux.Gio, "AppInfo", appinfo) | ||
1096 | 266 | timestamp = time.time() | ||
1097 | 267 | self.sync_menu._open_control_panel_by_command_line(timestamp) | ||
1098 | 268 | |||
1099 | 269 | self.assertEqual(appinfo.command_line, linux.CLIENT_COMMAND_LINE) | ||
1100 | 270 | self.assertEqual(appinfo.context.timestamp, timestamp) | ||
1101 | 271 | |||
1102 | 272 | def test_open_control_panel_by_command_line_with_arg(self): | ||
1103 | 273 | """Check that the proper action is executed.""" | ||
1104 | 274 | appinfo = FakeAppInfo() | ||
1105 | 275 | self.patch(linux.Gio, "AppInfo", appinfo) | ||
1106 | 276 | timestamp = time.time() | ||
1107 | 277 | arg = "--test-arg" | ||
1108 | 278 | self.sync_menu._open_control_panel_by_command_line(timestamp, arg) | ||
1109 | 279 | |||
1110 | 280 | self.assertEqual( | ||
1111 | 281 | appinfo.command_line, "%s %s" % (linux.CLIENT_COMMAND_LINE, arg)) | ||
1112 | 282 | self.assertEqual(appinfo.context.timestamp, timestamp) | ||
1113 | 283 | |||
1114 | 284 | def test_open_uri(self): | ||
1115 | 285 | """Check that the proper action is executed.""" | ||
1116 | 286 | appinfo = FakeAppInfo() | ||
1117 | 287 | self.patch(linux.Gio, "AppInfo", appinfo) | ||
1118 | 288 | timestamp = time.time() | ||
1119 | 289 | |||
1120 | 290 | self.sync_menu._open_uri(linux.UBUNTUONE_LINK, timestamp) | ||
1121 | 291 | self.assertEqual(appinfo.opened_uri, linux.UBUNTUONE_LINK) | ||
1122 | 292 | self.assertEqual(appinfo.context.timestamp, timestamp) | ||
1123 | 293 | |||
1124 | 294 | def test_open_u1(self): | ||
1125 | 295 | """Check that the proper action is executed.""" | ||
1126 | 296 | appinfo = FakeDesktopAppInfo() | ||
1127 | 297 | timestamp = time.time() | ||
1128 | 298 | self.patch(linux.Gio, "DesktopAppInfo", appinfo) | ||
1129 | 299 | |||
1130 | 300 | self.sync_menu.open_control_panel(timestamp=timestamp) | ||
1131 | 301 | self.assertEqual(appinfo.desktop_id, linux.CLIENT_DESKTOP_ID) | ||
1132 | 302 | self.assertTrue(appinfo.launched) | ||
1133 | 303 | self.assertEqual(appinfo.files, []) | ||
1134 | 304 | self.assertEqual(appinfo.context.timestamp, timestamp) | ||
1135 | 305 | |||
1136 | 306 | def test_open_share_tab(self): | ||
1137 | 307 | """Check that the proper action is executed.""" | ||
1138 | 308 | timestamp = time.time() | ||
1139 | 309 | data = [] | ||
1140 | 310 | |||
1141 | 311 | self.patch( | ||
1142 | 312 | self.sync_menu, "_open_control_panel_by_command_line", | ||
1143 | 313 | lambda t, a: data.append((t, a))) | ||
1144 | 314 | self.sync_menu.open_share_file_tab(timestamp=timestamp) | ||
1145 | 315 | self.assertEqual(data, [(timestamp, "--switch-to share_links")]) | ||
1146 | 316 | |||
1147 | 317 | def test_go_to_web(self): | ||
1148 | 318 | """Check that the proper action is executed.""" | ||
1149 | 319 | timestamp = time.time() | ||
1150 | 320 | data = [] | ||
1151 | 321 | |||
1152 | 322 | self.patch( | ||
1153 | 323 | self.sync_menu, "_open_uri", lambda u, t: data.append((t, u))) | ||
1154 | 324 | self.sync_menu.open_go_to_web(timestamp=timestamp) | ||
1155 | 325 | self.assertEqual(data, [(timestamp, linux.DASHBOARD)]) | ||
1156 | 326 | |||
1157 | 327 | def test_open_ubuntu_one_folder(self): | ||
1158 | 328 | """Check that the proper action is executed.""" | ||
1159 | 329 | timestamp = time.time() | ||
1160 | 330 | data = [] | ||
1161 | 331 | |||
1162 | 332 | self.patch( | ||
1163 | 333 | self.sync_menu, "_open_uri", lambda u, t: data.append((t, u))) | ||
1164 | 334 | self.sync_menu.open_ubuntu_one_folder(timestamp=timestamp) | ||
1165 | 335 | self.assertEqual( | ||
1166 | 336 | data, | ||
1167 | 337 | [(timestamp, "file://" + self.syncdaemon_service.fake_root_path)]) | ||
1168 | 338 | |||
1169 | 339 | def test_get_help(self): | ||
1170 | 340 | """Check that the proper action is executed.""" | ||
1171 | 341 | timestamp = time.time() | ||
1172 | 342 | data = [] | ||
1173 | 343 | |||
1174 | 344 | self.patch( | ||
1175 | 345 | self.sync_menu, "_open_uri", lambda u, t: data.append((t, u))) | ||
1176 | 346 | self.sync_menu.open_web_help(timestamp=timestamp) | ||
1177 | 347 | self.assertEqual(data, [(timestamp, linux.HELP_LINK)]) | ||
1178 | 348 | |||
1179 | 349 | def test_more_storage(self): | ||
1180 | 350 | """Check that the proper action is executed.""" | ||
1181 | 351 | timestamp = time.time() | ||
1182 | 352 | data = [] | ||
1183 | 353 | |||
1184 | 354 | self.patch( | ||
1185 | 355 | self.sync_menu, "_open_uri", lambda u, t: data.append((t, u))) | ||
1186 | 356 | self.sync_menu.open_get_more_storage(timestamp=timestamp) | ||
1187 | 357 | self.assertEqual(data, [(timestamp, linux.GET_STORAGE_LINK)]) | ||
1188 | 358 | |||
1189 | 359 | def test_empty_transfers(self): | ||
1190 | 360 | """Check that the Transfers menu is empty.""" | ||
1191 | 361 | self.assertEqual(self.sync_menu.transfers.get_children(), []) | ||
1192 | 362 | |||
1193 | 363 | def test_only_recent(self): | ||
1194 | 364 | """Check that only recent transfers items are loaded.""" | ||
1195 | 365 | data = ['file1', 'file2', 'file3'] | ||
1196 | 366 | self.status_frontend.recent_transfers_data = data | ||
1197 | 367 | self.sync_menu.transfers.update_progress() | ||
1198 | 368 | children = self.sync_menu.transfers.get_children() | ||
1199 | 369 | self.assertEqual(len(children), 4) | ||
1200 | 370 | data.reverse() | ||
1201 | 371 | for itemM, itemD in zip(children, data): | ||
1202 | 372 | self.assertEqual( | ||
1203 | 373 | itemM.property_get(linux.Dbusmenu.MENUITEM_PROP_LABEL), itemD) | ||
1204 | 374 | |||
1205 | 375 | def test_only_progress(self): | ||
1206 | 376 | """Check that only progress items are loaded.""" | ||
1207 | 377 | data = [ | ||
1208 | 378 | ('file1', 3000, 400), | ||
1209 | 379 | ('file2', 2000, 100), | ||
1210 | 380 | ('file3', 5000, 4600)] | ||
1211 | 381 | uploading_data = {} | ||
1212 | 382 | for filename, size, written in data: | ||
1213 | 383 | uploading_data[filename] = (size, written) | ||
1214 | 384 | self.status_frontend.uploading_data = data | ||
1215 | 385 | self.sync_menu.transfers.update_progress() | ||
1216 | 386 | children = self.sync_menu.transfers.get_children() | ||
1217 | 387 | self.assertEqual(len(children), 4) | ||
1218 | 388 | data.reverse() | ||
1219 | 389 | for item in children: | ||
1220 | 390 | text = item.property_get(linux.Dbusmenu.MENUITEM_PROP_LABEL) | ||
1221 | 391 | if text is None: | ||
1222 | 392 | continue | ||
1223 | 393 | self.assertIn(text, uploading_data) | ||
1224 | 394 | size, written = uploading_data[text] | ||
1225 | 395 | percentage = written * 100 / size | ||
1226 | 396 | self.assertEqual(item.property_get_int( | ||
1227 | 397 | linux.SyncMenu.PROGRESS_MENUITEM_PROP_PERCENT_DONE), | ||
1228 | 398 | percentage) | ||
1229 | 399 | |||
1230 | 400 | def test_full_transfers(self): | ||
1231 | 401 | """Check that the transfers menu contains the maximum transfers.""" | ||
1232 | 402 | # The api of recent transfers always returns a maximum of 5 items | ||
1233 | 403 | data_recent = ['file1', 'file2', 'file3', 'file4', 'file5'] | ||
1234 | 404 | self.status_frontend.recent_transfers_data = \ | ||
1235 | 405 | data_recent | ||
1236 | 406 | self.sync_menu.transfers.update_progress() | ||
1237 | 407 | children = self.sync_menu.transfers.get_children() | ||
1238 | 408 | self.assertEqual(len(children), 6) | ||
1239 | 409 | data_recent.reverse() | ||
1240 | 410 | for itemM, itemD in zip(children, data_recent): | ||
1241 | 411 | self.assertEqual(itemM.property_get( | ||
1242 | 412 | linux.Dbusmenu.MENUITEM_PROP_LABEL), itemD) | ||
1243 | 413 | |||
1244 | 414 | data_current = [ | ||
1245 | 415 | ('file0', 1200, 600), | ||
1246 | 416 | ('file1', 3000, 400), | ||
1247 | 417 | ('file2', 2000, 100), | ||
1248 | 418 | ('file3', 2500, 150), | ||
1249 | 419 | ('file4', 1000, 600), | ||
1250 | 420 | ('file5', 5000, 4600)] | ||
1251 | 421 | uploading_data = {} | ||
1252 | 422 | for filename, size, written in data_current: | ||
1253 | 423 | uploading_data[filename] = (size, written) | ||
1254 | 424 | self.status_frontend.uploading_data = data_current | ||
1255 | 425 | self.sync_menu.transfers.update_progress() | ||
1256 | 426 | children = self.sync_menu.transfers.get_children() | ||
1257 | 427 | # The menu should only show 5 current transfers. | ||
1258 | 428 | self.assertEqual(len(children), 11) | ||
1259 | 429 | data_current.reverse() | ||
1260 | 430 | for item in children[6:]: | ||
1261 | 431 | text = item.property_get(linux.Dbusmenu.MENUITEM_PROP_LABEL) | ||
1262 | 432 | self.assertIn(text, uploading_data) | ||
1263 | 433 | size, written = uploading_data[text] | ||
1264 | 434 | percentage = written * 100 / size | ||
1265 | 435 | self.assertEqual(item.property_get_int( | ||
1266 | 436 | linux.SyncMenu.PROGRESS_MENUITEM_PROP_PERCENT_DONE), | ||
1267 | 437 | percentage) | ||
1268 | 438 | |||
1269 | 439 | def test_mnemonics_labels(self): | ||
1270 | 440 | """Check that the transfers menu sanitizes the underscores.""" | ||
1271 | 441 | data_recent = ['file_1', 'file__2'] | ||
1272 | 442 | self.status_frontend.recent_transfers_data = \ | ||
1273 | 443 | data_recent | ||
1274 | 444 | self.sync_menu.transfers.update_progress() | ||
1275 | 445 | children = self.sync_menu.transfers.get_children() | ||
1276 | 446 | data_recent.reverse() | ||
1277 | 447 | for itemM, itemD in zip(children, data_recent): | ||
1278 | 448 | self.assertEqual(itemM.property_get( | ||
1279 | 449 | linux.Dbusmenu.MENUITEM_PROP_LABEL), itemD.replace('_', '__')) | ||
1280 | 450 | |||
1281 | 451 | def test_update_transfers(self): | ||
1282 | 452 | """Check that everything is ok when updating the transfers value.""" | ||
1283 | 453 | data_current = [ | ||
1284 | 454 | ('file0', 1200, 600), | ||
1285 | 455 | ('file1', 3000, 400), | ||
1286 | 456 | ('file4', 1000, 600), | ||
1287 | 457 | ('file5', 5000, 4600)] | ||
1288 | 458 | uploading_data = {} | ||
1289 | 459 | for filename, size, written in data_current: | ||
1290 | 460 | uploading_data[filename] = (size, written) | ||
1291 | 461 | self.status_frontend.uploading_data = data_current | ||
1292 | 462 | self.sync_menu.transfers.update_progress() | ||
1293 | 463 | children = self.sync_menu.transfers.get_children() | ||
1294 | 464 | # The menu should only show 5 current transfers. | ||
1295 | 465 | self.assertEqual(len(children), 5) | ||
1296 | 466 | data_current.reverse() | ||
1297 | 467 | for item in children: | ||
1298 | 468 | text = item.property_get(linux.Dbusmenu.MENUITEM_PROP_LABEL) | ||
1299 | 469 | if text is None: | ||
1300 | 470 | continue | ||
1301 | 471 | self.assertIn(text, uploading_data) | ||
1302 | 472 | size, written = uploading_data[text] | ||
1303 | 473 | percentage = written * 100 / size | ||
1304 | 474 | self.assertEqual(item.property_get_int( | ||
1305 | 475 | linux.SyncMenu.PROGRESS_MENUITEM_PROP_PERCENT_DONE), | ||
1306 | 476 | percentage) | ||
1307 | 477 | |||
1308 | 478 | data_recent = ['file5'] | ||
1309 | 479 | self.status_frontend.recent_transfers_data = data_recent | ||
1310 | 480 | self.sync_menu.transfers.update_progress() | ||
1311 | 481 | children = self.sync_menu.transfers.get_children() | ||
1312 | 482 | self.assertEqual(len(children), 6) | ||
1313 | 483 | data_recent.reverse() | ||
1314 | 484 | for itemM, itemD in zip(children, data_recent): | ||
1315 | 485 | self.assertEqual(itemM.property_get( | ||
1316 | 486 | linux.Dbusmenu.MENUITEM_PROP_LABEL), itemD) | ||
1317 | 487 | |||
1318 | 488 | data_current = [ | ||
1319 | 489 | ('file0', 1200, 700), | ||
1320 | 490 | ('file1', 3000, 600), | ||
1321 | 491 | ('file4', 1000, 800)] | ||
1322 | 492 | uploading_data = {} | ||
1323 | 493 | for filename, size, written in data_current: | ||
1324 | 494 | uploading_data[filename] = (size, written) | ||
1325 | 495 | self.status_frontend.uploading_data = data_current | ||
1326 | 496 | self.sync_menu.transfers.update_progress() | ||
1327 | 497 | children = self.sync_menu.transfers.get_children() | ||
1328 | 498 | # The menu should only show 5 current transfers. | ||
1329 | 499 | self.assertEqual(len(children), 5) | ||
1330 | 500 | data_current.reverse() | ||
1331 | 501 | for item in children[6:]: | ||
1332 | 502 | text = item.property_get(linux.Dbusmenu.MENUITEM_PROP_LABEL) | ||
1333 | 503 | self.assertIn(text, uploading_data) | ||
1334 | 504 | size, written = uploading_data[text] | ||
1335 | 505 | percentage = written * 100 / size | ||
1336 | 506 | self.assertEqual(item.property_get_int( | ||
1337 | 507 | linux.SyncMenu.PROGRESS_MENUITEM_PROP_PERCENT_DONE), | ||
1338 | 508 | percentage) | ||
1339 | 509 | |||
1340 | 510 | def test_transfers_order(self): | ||
1341 | 511 | """Check that the proper transfers are shown first.""" | ||
1342 | 512 | data_current = [ | ||
1343 | 513 | ('file0', 1200, 610), | ||
1344 | 514 | ('file1', 3000, 400), | ||
1345 | 515 | ('file2', 2000, 100), | ||
1346 | 516 | ('file3', 2500, 150), | ||
1347 | 517 | ('file4', 2500, 950), | ||
1348 | 518 | ('file5', 3500, 550), | ||
1349 | 519 | ('file6', 1000, 600), | ||
1350 | 520 | ('file7', 5000, 4600)] | ||
1351 | 521 | expected = [ | ||
1352 | 522 | ('file7', 5000, 4600), | ||
1353 | 523 | ('file4', 2500, 950), | ||
1354 | 524 | ('file0', 1200, 610), | ||
1355 | 525 | ('file6', 1000, 600), | ||
1356 | 526 | ('file5', 3500, 550)] | ||
1357 | 527 | self.status_frontend.uploading_data = data_current | ||
1358 | 528 | self.sync_menu.transfers.update_progress() | ||
1359 | 529 | children = self.sync_menu.transfers.get_children() | ||
1360 | 530 | # The menu should only show 5 current transfers and a separator item. | ||
1361 | 531 | self.assertEqual(len(children), 6) | ||
1362 | 532 | i = 0 | ||
1363 | 533 | for item in children: | ||
1364 | 534 | text = item.property_get(linux.Dbusmenu.MENUITEM_PROP_LABEL) | ||
1365 | 535 | if text is None: | ||
1366 | 536 | continue | ||
1367 | 537 | percentage = item.property_get_int( | ||
1368 | 538 | linux.SyncMenu.PROGRESS_MENUITEM_PROP_PERCENT_DONE) | ||
1369 | 539 | name, size, written = expected[i] | ||
1370 | 540 | i += 1 | ||
1371 | 541 | percentage_expected = written * 100 / size | ||
1372 | 542 | self.assertEqual(text, name) | ||
1373 | 543 | self.assertEqual(percentage, percentage_expected) | ||
1374 | 544 | |||
1375 | 545 | def test_update_transfers_delay(self): | ||
1376 | 546 | """Check that the timer is being handle properly.""" | ||
1377 | 547 | self.sync_menu.next_update = time.time() | ||
1378 | 548 | self.sync_menu.update_transfers() | ||
1379 | 549 | self.sync_menu.timer = None | ||
1380 | 550 | self.sync_menu.next_update = time.time() * 2 | ||
1381 | 551 | self.sync_menu.update_transfers() | ||
1382 | 552 | self.assertEqual(self.sync_menu.timer.delay, 3) | ||
1383 | 553 | |||
1384 | 554 | def test_status_change_from_menu(self): | ||
1385 | 555 | """Check the behavior when the status is changed from the menu.""" | ||
1386 | 556 | self.sync_menu.change_sync_status() | ||
1387 | 557 | self.assertFalse(self.sync_menu._connected) | ||
1388 | 558 | self.assertFalse(self.sync_menu._ignore_status_event) | ||
1389 | 559 | self.assertFalse(self.sync_menu._syncdaemon_service.connect_called) | ||
1390 | 560 | self.assertTrue(self.sync_menu._syncdaemon_service.disconnect_called) | ||
1391 | 561 | |||
1392 | 562 | self.sync_menu._syncdaemon_service.disconnect_called = False | ||
1393 | 563 | self.sync_menu.change_sync_status() | ||
1394 | 564 | self.assertTrue(self.sync_menu._connected) | ||
1395 | 565 | self.assertFalse(self.sync_menu._ignore_status_event) | ||
1396 | 566 | self.assertTrue(self.sync_menu._syncdaemon_service.connect_called) | ||
1397 | 567 | self.assertFalse(self.sync_menu._syncdaemon_service.disconnect_called) | ||
1398 | 568 | |||
1399 | 569 | def test_ignore_status(self): | ||
1400 | 570 | """Check that neither connect or disconnect are called.""" | ||
1401 | 571 | self.sync_menu._ignore_status_event = True | ||
1402 | 572 | self.assertTrue(self.sync_menu._ignore_status_event) | ||
1403 | 573 | self.sync_menu.change_sync_status() | ||
1404 | 574 | self.assertTrue(self.sync_menu._connected) | ||
1405 | 575 | self.assertFalse(self.sync_menu._ignore_status_event) | ||
1406 | 576 | self.assertFalse(self.sync_menu._syncdaemon_service.connect_called) | ||
1407 | 577 | self.assertFalse(self.sync_menu._syncdaemon_service.disconnect_called) | ||
1408 | 578 | |||
1409 | 579 | def test_sync_status_changed(self): | ||
1410 | 580 | """Check sync_status_changed behavior.""" | ||
1411 | 581 | self.sync_menu.sync_status_changed(True) | ||
1412 | 582 | self.assertNotIn('paused', self.sync_menu.app.data) | ||
1413 | 583 | self.sync_menu.sync_status_changed(False) | ||
1414 | 584 | self.assertFalse(self.sync_menu._connected) | ||
1415 | 585 | self.assertTrue(self.sync_menu._ignore_status_event) | ||
1416 | 586 | self.assertTrue(self.sync_menu.app.data['paused']) | ||
1417 | 587 | 0 | ||
1418 | === modified file 'ubuntuone/platform/tests/test_tools.py' | |||
1419 | --- ubuntuone/platform/tests/test_tools.py 2016-09-17 01:06:23 +0000 | |||
1420 | +++ ubuntuone/platform/tests/test_tools.py 2018-04-24 23:14:39 +0000 | |||
1421 | @@ -1,6 +1,7 @@ | |||
1422 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
1423 | 2 | # | 2 | # |
1424 | 3 | # Copyright 2009-2012 Canonical Ltd. | 3 | # Copyright 2009-2012 Canonical Ltd. |
1425 | 4 | # Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros) | ||
1426 | 4 | # | 5 | # |
1427 | 5 | # This program is free software: you can redistribute it and/or modify it | 6 | # This program is free software: you can redistribute it and/or modify it |
1428 | 6 | # under the terms of the GNU General Public License version 3, as published | 7 | # under the terms of the GNU General Public License version 3, as published |
1429 | @@ -44,8 +45,6 @@ | |||
1430 | 44 | interaction_interfaces, | 45 | interaction_interfaces, |
1431 | 45 | states, | 46 | states, |
1432 | 46 | volume_manager, | 47 | volume_manager, |
1433 | 47 | RECENT_TRANSFERS, | ||
1434 | 48 | UPLOADING, | ||
1435 | 49 | ) | 48 | ) |
1436 | 50 | from ubuntuone.platform import tools | 49 | from ubuntuone.platform import tools |
1437 | 51 | from ubuntuone.platform.tests import IPCTestCase | 50 | from ubuntuone.platform.tests import IPCTestCase |
1438 | @@ -253,13 +252,6 @@ | |||
1439 | 253 | self.assertEqual('share_id', result['volume_id']) | 252 | self.assertEqual('share_id', result['volume_id']) |
1440 | 254 | self.assertEqual(False, self.main.vm.shares['share_id'].accepted) | 253 | self.assertEqual(False, self.main.vm.shares['share_id'].accepted) |
1441 | 255 | 254 | ||
1442 | 256 | @defer.inlineCallbacks | ||
1443 | 257 | def test_sync_menu(self): | ||
1444 | 258 | """Test accept_share method.""" | ||
1445 | 259 | result = yield self.tool.sync_menu() | ||
1446 | 260 | self.assertIn(RECENT_TRANSFERS, result) | ||
1447 | 261 | self.assertIn(UPLOADING, result) | ||
1448 | 262 | |||
1449 | 263 | 255 | ||
1450 | 264 | class TestWaitForSignals(TestToolsBase): | 256 | class TestWaitForSignals(TestToolsBase): |
1451 | 265 | """Test case for the wait_for_signals method from SyncDaemonTool.""" | 257 | """Test case for the wait_for_signals method from SyncDaemonTool.""" |
1452 | @@ -496,8 +488,8 @@ | |||
1453 | 496 | """Test SyncDaemonTool.waiting_metadata.""" | 488 | """Test SyncDaemonTool.waiting_metadata.""" |
1454 | 497 | # inject the fake data | 489 | # inject the fake data |
1455 | 498 | self.action_q.queue.waiting.extend([ | 490 | self.action_q.queue.waiting.extend([ |
1458 | 499 | FakeCommand("node_a_foo", "node_a_bar", path='path'), | 491 | FakeCommand("node_a_foo", "node_a_bar", path='path'), |
1459 | 500 | FakeCommand("node_b_foo", "node_b_bar")]) | 492 | FakeCommand("node_b_foo", "node_b_bar")]) |
1460 | 501 | result = yield self.tool.waiting_metadata() | 493 | result = yield self.tool.waiting_metadata() |
1461 | 502 | 494 | ||
1462 | 503 | self.assertEqual(2, len(result)) | 495 | self.assertEqual(2, len(result)) |
1463 | @@ -521,8 +513,8 @@ | |||
1464 | 521 | 513 | ||
1465 | 522 | # inject the fake data | 514 | # inject the fake data |
1466 | 523 | self.action_q.queue.waiting.extend([ | 515 | self.action_q.queue.waiting.extend([ |
1469 | 524 | FakeContentCommand("", "node_id", path='/some/path'), | 516 | FakeContentCommand("", "node_id", path='/some/path'), |
1470 | 525 | FakeContentCommand("", "node_id_1", path='/other/path')]) | 517 | FakeContentCommand("", "node_id_1", path='/other/path')]) |
1471 | 526 | 518 | ||
1472 | 527 | result = yield self.tool.waiting_content() | 519 | result = yield self.tool.waiting_content() |
1473 | 528 | 520 | ||
1474 | 529 | 521 | ||
1475 | === modified file 'ubuntuone/platform/tools/__init__.py' | |||
1476 | --- ubuntuone/platform/tools/__init__.py 2018-03-08 19:39:13 +0000 | |||
1477 | +++ ubuntuone/platform/tools/__init__.py 2018-04-24 23:14:39 +0000 | |||
1478 | @@ -1,6 +1,7 @@ | |||
1479 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
1480 | 2 | # | 2 | # |
1481 | 3 | # Copyright 2009-2012 Canonical Ltd. | 3 | # Copyright 2009-2012 Canonical Ltd. |
1482 | 4 | # Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros) | ||
1483 | 4 | # | 5 | # |
1484 | 5 | # This program is free software: you can redistribute it and/or modify it | 6 | # This program is free software: you can redistribute it and/or modify it |
1485 | 6 | # under the terms of the GNU General Public License version 3, as published | 7 | # under the terms of the GNU General Public License version 3, as published |
1486 | @@ -269,13 +270,6 @@ | |||
1487 | 269 | 270 | ||
1488 | 270 | @defer.inlineCallbacks | 271 | @defer.inlineCallbacks |
1489 | 271 | @log_call(logger.debug) | 272 | @log_call(logger.debug) |
1490 | 272 | def sync_menu(self): | ||
1491 | 273 | """Return a deferred that will be fired with the sync menu data.""" | ||
1492 | 274 | results = yield self.proxy.call_method('status', 'sync_menu') | ||
1493 | 275 | defer.returnValue(results) | ||
1494 | 276 | |||
1495 | 277 | @defer.inlineCallbacks | ||
1496 | 278 | @log_call(logger.debug) | ||
1497 | 279 | def accept_share(self, share_id): | 273 | def accept_share(self, share_id): |
1498 | 280 | """Accept the share with id: share_id.""" | 274 | """Accept the share with id: share_id.""" |
1499 | 281 | d = self.wait_for_signals( | 275 | d = self.wait_for_signals( |
1500 | 282 | 276 | ||
1501 | === modified file 'ubuntuone/syncdaemon/__init__.py' | |||
1502 | --- ubuntuone/syncdaemon/__init__.py 2016-05-30 13:03:37 +0000 | |||
1503 | +++ ubuntuone/syncdaemon/__init__.py 2018-04-24 23:14:39 +0000 | |||
1504 | @@ -1,5 +1,5 @@ | |||
1505 | 1 | # Copyright 2009-2012 Canonical Ltd. | 1 | # Copyright 2009-2012 Canonical Ltd. |
1507 | 2 | # Copyright 2015-2016 Chicharreros (https://launchpad.net/~chicharreros) | 2 | # Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros) |
1508 | 3 | # | 3 | # |
1509 | 4 | # This program is free software: you can redistribute it and/or modify it | 4 | # This program is free software: you can redistribute it and/or modify it |
1510 | 5 | # under the terms of the GNU General Public License version 3, as published | 5 | # under the terms of the GNU General Public License version 3, as published |
1511 | @@ -31,9 +31,3 @@ | |||
1512 | 31 | REQUIRED_CAPS = frozenset( | 31 | REQUIRED_CAPS = frozenset( |
1513 | 32 | ["no-content", "account-info", "resumable-uploads", "fix462230", "volumes", | 32 | ["no-content", "account-info", "resumable-uploads", "fix462230", "volumes", |
1514 | 33 | "generations"]) | 33 | "generations"]) |
1515 | 34 | |||
1516 | 35 | |||
1517 | 36 | # Sync Menu data constants | ||
1518 | 37 | RECENT_TRANSFERS = 'recent-transfers' | ||
1519 | 38 | UPLOADING = 'uploading' | ||
1520 | 39 | DOWNLOADING = 'downloading' | ||
1521 | 40 | 34 | ||
1522 | === modified file 'ubuntuone/syncdaemon/interaction_interfaces.py' | |||
1523 | --- ubuntuone/syncdaemon/interaction_interfaces.py 2018-04-14 23:34:20 +0000 | |||
1524 | +++ ubuntuone/syncdaemon/interaction_interfaces.py 2018-04-24 23:14:39 +0000 | |||
1525 | @@ -304,10 +304,6 @@ | |||
1526 | 304 | waiting_content.append(data) | 304 | waiting_content.append(data) |
1527 | 305 | return waiting_content | 305 | return waiting_content |
1528 | 306 | 306 | ||
1529 | 307 | def sync_menu(self): | ||
1530 | 308 | """Return the info necessary to construct the menu.""" | ||
1531 | 309 | return self.main.status_listener.menu_data() | ||
1532 | 310 | |||
1533 | 311 | 307 | ||
1534 | 312 | class SyncdaemonFileSystem(SyncdaemonObject): | 308 | class SyncdaemonFileSystem(SyncdaemonObject): |
1535 | 313 | """An interface to the FileSystem Manager.""" | 309 | """An interface to the FileSystem Manager.""" |
+1