Merge lp:~nataliabidart/ubuntuone-client/stable-3-0-update-2.99.92 into lp:ubuntuone-client/stable-3-0

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 1181
Merged at revision: 1180
Proposed branch: lp:~nataliabidart/ubuntuone-client/stable-3-0-update-2.99.92
Merge into: lp:ubuntuone-client/stable-3-0
Diff against target: 557 lines (+194/-26)
19 files modified
bin/u1sdtool (+7/-1)
tests/platform/linux/test_notification.py (+6/-6)
tests/platform/test_external_interface.py (+2/-0)
tests/platform/test_tools.py (+29/-5)
tests/proxy/test_tunnel_server.py (+33/-0)
tests/syncdaemon/test_interaction_interfaces.py (+18/-0)
tests/syncdaemon/test_tunnel_runner.py (+9/-0)
tests/syncdaemon/test_vm.py (+27/-0)
ubuntuone/platform/linux/dbus_interface.py (+4/-0)
ubuntuone/platform/linux/notification.py (+1/-1)
ubuntuone/platform/tools/__init__.py (+11/-7)
ubuntuone/platform/tools/windows.py (+1/-0)
ubuntuone/platform/windows/ipc.py (+5/-0)
ubuntuone/platform/windows/ipc_client.py (+9/-1)
ubuntuone/proxy/tunnel_server.py (+10/-2)
ubuntuone/syncdaemon/event_queue.py (+1/-1)
ubuntuone/syncdaemon/interaction_interfaces.py (+11/-0)
ubuntuone/syncdaemon/tunnel_runner.py (+7/-2)
ubuntuone/syncdaemon/volume_manager.py (+3/-0)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-client/stable-3-0-update-2.99.92
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Review via email: mp+100600@code.launchpad.net

Commit message

- Updating from trunk up to revno 1222:

[ Alejandro J. Cura <email address hidden> ]
  - Do not use the Qt Dbus mainloop on Windows (LP: #969150).
  - Force using the system proxy on Windows (LP: #969157).

[ Diego Sarmentero <email address hidden> ]
  - Converting abspath to unicode (LP: #917222).

[ Natalia B. Bidart <email address hidden> ]
  - Fixed typo and added a missing test for validate_path in
    SyncDaemonTool (LP: #968637).

[ Natalia B. Bidart <email address hidden>,
  Brian Curtin <email address hidden> ]
  - Emit a notification when volumes are ready after a server rescan,
    allowing clients to follow and update their information accordingly
    (LP: #851810).

[ Rodney Dawes <email address hidden> ]
  - Use set_hint_int32 for the boolean transient hint instead of set_hint
    (LP: #961342).

To post a comment you must log in.
Revision history for this message
Alejandro J. Cura (alecu) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/u1sdtool'
2--- bin/u1sdtool 2012-03-13 16:56:05 +0000
3+++ bin/u1sdtool 2012-04-03 13:00:34 +0000
4@@ -155,7 +155,13 @@
5 d.addCallback(lambda info: show_public_file_info(info, out))
6 d.addErrback(lambda failure: show_error(failure, out))
7 elif options.path_info:
8- path = os.path.abspath(options.path_info)
9+ try:
10+ path = options.path_info.decode(sys.getfilesystemencoding())
11+ except (UnicodeDecodeError, UnicodeEncodeError):
12+ parser.error('PATH %r could not be decoded using the filesystem '
13+ 'encoding %r.' % (
14+ options.path_info, sys.getfilesystemencoding()))
15+ path = os.path.abspath(path)
16 if not os.path.exists(path):
17 parser.error("PATH: '%s' don't exists" % path)
18 d = sync_daemon_tool.get_metadata(path)
19
20=== modified file 'tests/platform/linux/test_notification.py'
21--- tests/platform/linux/test_notification.py 2012-03-09 19:27:03 +0000
22+++ tests/platform/linux/test_notification.py 2012-04-03 13:00:34 +0000
23@@ -73,7 +73,7 @@
24 self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)
25 mock_notification = self.mocker.mock()
26 self.mocker.result(mock_notification)
27- mock_notification.set_hint('transient', True)
28+ mock_notification.set_hint_int32('transient', int(True))
29 mock_notification.show()
30 self.mocker.replay()
31 Notification(FAKE_APP_NAME).send_notification(FAKE_TITLE, FAKE_MESSAGE)
32@@ -83,11 +83,11 @@
33 self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)
34 mock_notification = self.mocker.mock()
35 self.mocker.result(mock_notification)
36- mock_notification.set_hint('transient', True)
37+ mock_notification.set_hint_int32('transient', int(True))
38 mock_notification.show()
39 mock_notification.update(
40 FAKE_TITLE + '2', FAKE_MESSAGE + '2', ICON_NAME)
41- mock_notification.set_hint('transient', True)
42+ mock_notification.set_hint_int32('transient', int(True))
43 mock_notification.show()
44 self.mocker.replay()
45 notifier = Notification(FAKE_APP_NAME)
46@@ -99,7 +99,7 @@
47 self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, FAKE_ICON)
48 mock_notification = self.mocker.mock()
49 self.mocker.result(mock_notification)
50- mock_notification.set_hint('transient', True)
51+ mock_notification.set_hint_int32('transient', int(True))
52 mock_notification.show()
53 self.mocker.replay()
54 Notification(FAKE_APP_NAME).send_notification(
55@@ -111,11 +111,11 @@
56 mock_notification = self.mocker.mock()
57 self.mocker.result(mock_notification)
58 mock_notification.set_hint_string('x-canonical-append', '')
59- mock_notification.set_hint('transient', True)
60+ mock_notification.set_hint_int32('transient', int(True))
61 mock_notification.show()
62 mock_notification.update(FAKE_TITLE, FAKE_APPENDAGE, ICON_NAME)
63 mock_notification.set_hint_string('x-canonical-append', '')
64- mock_notification.set_hint('transient', True)
65+ mock_notification.set_hint_int32('transient', int(True))
66 mock_notification.show()
67 self.mocker.replay()
68 notifier = Notification(FAKE_APP_NAME)
69
70=== modified file 'tests/platform/test_external_interface.py'
71--- tests/platform/test_external_interface.py 2012-02-03 14:29:52 +0000
72+++ tests/platform/test_external_interface.py 2012-04-03 13:00:34 +0000
73@@ -31,6 +31,7 @@
74
75 STR = 'something'
76 STR_STR_DICT = {'foo': 'bar'}
77+STR_LST_DICT = [STR_STR_DICT]
78
79
80 class StatusTests(StatusTestCase):
81@@ -146,6 +147,7 @@
82 signal_mapping = [
83 ('RootMismatch', (STR, STR)),
84 ('QuotaExceeded', (STR_STR_DICT,)),
85+ ('VolumesChanged', (STR_LST_DICT,)),
86 ]
87
88 @defer.inlineCallbacks
89
90=== modified file 'tests/platform/test_tools.py'
91--- tests/platform/test_tools.py 2012-01-17 20:00:44 +0000
92+++ tests/platform/test_tools.py 2012-04-03 13:00:34 +0000
93@@ -624,6 +624,12 @@
94 "UDF %s is subscribed" % udf.id)
95
96 @defer.inlineCallbacks
97+ def test_validate_path(self):
98+ """Test for Folders.validate_path."""
99+ result = yield self.tool.validate_path(self.root_dir)
100+ self.assertFalse(result)
101+
102+ @defer.inlineCallbacks
103 def test_subscribe_share(self):
104 """Test for Shares.subscribe."""
105 share = self._create_share(accepted=True, subscribed=False)
106@@ -898,11 +904,29 @@
107 @defer.inlineCallbacks
108 def test_refresh_volumes(self):
109 """Test for refresh_volumes method."""
110- d = defer.Deferred()
111- self.patch(self.main.action_q, 'list_volumes',
112- lambda: d.callback(True))
113- yield self.tool.refresh_volumes()
114- yield d
115+ udf = self._create_udf()
116+ yield self.main.vm.add_udf(udf)
117+
118+ share = self._create_share()
119+ yield self.main.vm.add_share(share)
120+
121+ volumes = list(self.main.vm.get_volumes(all_volumes=True))
122+
123+ def volumes_changed():
124+ """Fake volumes_changed."""
125+ self.main.event_q.push('VM_VOLUMES_CHANGED', volumes=volumes)
126+
127+ self.patch(self.main.vm, 'refresh_volumes', volumes_changed)
128+ result = yield self.tool.refresh_volumes()
129+
130+ str_volumes = []
131+ for volume in volumes:
132+ if isinstance(volume, volume_manager.UDF):
133+ str_vol = interaction_interfaces.get_udf_dict(volume)
134+ else:
135+ str_vol = interaction_interfaces.get_share_dict(volume)
136+ str_volumes.append(str_vol)
137+ self.assertEqual(result, str_volumes)
138
139 @defer.inlineCallbacks
140 def test_rescan_from_scratch(self):
141
142=== modified file 'tests/proxy/test_tunnel_server.py'
143--- tests/proxy/test_tunnel_server.py 2012-03-24 00:10:25 +0000
144+++ tests/proxy/test_tunnel_server.py 2012-04-03 13:00:34 +0000
145@@ -549,6 +549,7 @@
146 class FakeNetworkProxyFactoryClass(object):
147 """A fake QNetworkProxyFactory."""
148 last_query = None
149+ use_system = False
150
151 def __init__(self, enabled):
152 """Initialize this fake instance."""
153@@ -561,6 +562,16 @@
154 """Return the proxy type configured."""
155 return self.proxy_type
156
157+ @classmethod
158+ def setUseSystemConfiguration(cls, new_value):
159+ """Save the system configuration requested."""
160+ cls.use_system = new_value
161+
162+ @classmethod
163+ def useSystemConfiguration(cls):
164+ """Is the system configured for proxies?"""
165+ return cls.use_system
166+
167 def systemProxyForQuery(self, query):
168 """A list of proxies, but only type() will be called on the first."""
169 return [self]
170@@ -610,6 +621,7 @@
171 self.patch(tunnel_server, "QNetworkProxyFactory", fake_netproxfact)
172 self._assert_proxy_enabled("windows 1.0")
173 self.assertEqual(len(self.app_proxy), 0)
174+ self.assertTrue(fake_netproxfact.useSystemConfiguration())
175
176 def test_platform_other_disabled(self):
177 """Tests for any other platform with proxies disabled."""
178@@ -617,6 +629,7 @@
179 self.patch(tunnel_server, "QNetworkProxyFactory", fake_netproxfact)
180 self._assert_proxy_disabled("windows 1.0")
181 self.assertEqual(len(self.app_proxy), 0)
182+ self.assertTrue(fake_netproxfact.useSystemConfiguration())
183
184
185 class FakeQCoreApp(object):
186@@ -683,3 +696,23 @@
187 tunnel_server.main(["example.com", "443"])
188 self.assertIn("Proxy not enabled.", self.fake_stdout.getvalue())
189 self.assertEqual(FakeQCoreApp.fake_instance, None)
190+
191+ def test_qtdbus_installed_on_linux(self):
192+ """The QtDbus mainloop is installed."""
193+ self.patch(tunnel_server.sys, "platform", "linux123")
194+ installed = []
195+ self.patch(tunnel_server, "install_qt_dbus",
196+ lambda: installed.append(None))
197+ self.proxies_enabled = True
198+ tunnel_server.main(["example.com", "443"])
199+ self.assertEqual(len(installed), 1)
200+
201+ def test_qtdbus_not_installed_on_windows(self):
202+ """The QtDbus mainloop is installed."""
203+ self.patch(tunnel_server.sys, "platform", "win98")
204+ installed = []
205+ self.patch(tunnel_server, "install_qt_dbus",
206+ lambda: installed.append(None))
207+ self.proxies_enabled = True
208+ tunnel_server.main(["example.com", "443"])
209+ self.assertEqual(len(installed), 0)
210
211=== modified file 'tests/syncdaemon/test_interaction_interfaces.py'
212--- tests/syncdaemon/test_interaction_interfaces.py 2012-03-01 19:08:12 +0000
213+++ tests/syncdaemon/test_interaction_interfaces.py 2012-04-03 13:00:34 +0000
214@@ -1750,6 +1750,24 @@
215 self.assertEqual(error, error_msg)
216
217 @defer.inlineCallbacks
218+ def test_handle_VM_VOLUMES_CHANGED(self):
219+ """Test the handle_VM_VOLUMES_CHANGED method."""
220+ share = self._create_share(accepted=True)
221+ udf = self._create_udf()
222+ volumes = [share, udf, self.main.vm.root]
223+ d = defer.Deferred()
224+ self.patch(self.sd_obj.interface.sync_daemon, 'VolumesChanged',
225+ d.callback)
226+
227+ self.main.event_q.push('VM_VOLUMES_CHANGED', volumes=volumes)
228+
229+ info = yield d
230+
231+ str_volumes = sorted((get_share_dict(share), get_udf_dict(udf),
232+ get_share_dict(self.main.vm.root)))
233+ self.assertEqual(str_volumes, sorted(info))
234+
235+ @defer.inlineCallbacks
236 def test_handle_VM_VOLUME_DELETED_folder(self):
237 """Test the handle_VM_VOLUME_DELETED method for a folder."""
238 udf = self._create_udf()
239
240=== modified file 'tests/syncdaemon/test_tunnel_runner.py'
241--- tests/syncdaemon/test_tunnel_runner.py 2012-03-27 03:41:06 +0000
242+++ tests/syncdaemon/test_tunnel_runner.py 2012-04-03 13:00:34 +0000
243@@ -179,3 +179,12 @@
244 self.addCleanup(delattr, sys, "frozen")
245 self.assertEqual(os.path.dirname(self.tr.get_process_path()),
246 os.path.dirname(sys.executable))
247+
248+ def test_start_process_win_devel(self):
249+ """Test the windows devel case."""
250+ fake_python = r"c:\python99\python.exe"
251+ self.patch(sys, "platform", "win98")
252+ self.patch(tunnel_runner.procutils, "which", lambda _: [fake_python])
253+ tunnel_runner.TunnelRunner("fs-1.one.ubuntu.com", 443)
254+ args, kwargs = self.spawned[1]
255+ self.assertEqual(args[1], fake_python)
256
257=== modified file 'tests/syncdaemon/test_vm.py'
258--- tests/syncdaemon/test_vm.py 2012-02-09 23:32:10 +0000
259+++ tests/syncdaemon/test_vm.py 2012-04-03 13:00:34 +0000
260@@ -1893,6 +1893,27 @@
261 """Test handle_AQ_LIST_VOLUMES event with an inactive udf."""
262 yield self._test_handle_AQ_LIST_VOLUMES_udf(False)
263
264+ @defer.inlineCallbacks
265+ def test_handle_AQ_LIST_VOLUMES_emits_volumes_changed(self):
266+ """When handling a new volume list, VM_VOLUMES_CHANGED is pushed."""
267+ share = self._create_share_volume()
268+ udf = self._create_udf_volume()
269+ root_volume = volumes.RootVolume(uuid.uuid4(), 17, 10)
270+ response = [share, udf, root_volume]
271+
272+ udf_created_d = defer.Deferred()
273+ self._listen_for('VM_UDF_CREATED', udf_created_d.callback)
274+
275+ volumes_changed_d = defer.Deferred()
276+ self._listen_for('VM_VOLUMES_CHANGED', volumes_changed_d.callback)
277+
278+ self.vm.handle_AQ_LIST_VOLUMES(response)
279+
280+ yield udf_created_d
281+ actual = yield volumes_changed_d
282+ expected = {'volumes': list(self.vm.get_volumes(all_volumes=True))}
283+ self.assertEqual(expected, actual)
284+
285
286 class VolumeManagerOperationsTests(BaseVolumeManagerTests):
287 """Test UDF/Volumes operations."""
288@@ -3104,12 +3125,18 @@
289 vol_rescan_d.callback) # autosubscribe is False
290 server_rescan_d = defer.Deferred()
291 self._listen_for('SYS_SERVER_RESCAN_DONE', server_rescan_d.callback)
292+ volumes_changed_d = defer.Deferred()
293+ self._listen_for('VM_VOLUMES_CHANGED', volumes_changed_d.callback)
294 yield self.vm.server_rescan()
295 yield server_rescan_d
296 events = yield vol_rescan_d
297+ vols = yield volumes_changed_d
298
299 self.assertEqual({'generation': 1, 'volume_id': ''}, events)
300
301+ expected = list(self.vm.get_volumes(all_volumes=True))
302+ self.assertEqual({'volumes' : expected}, vols)
303+
304 @defer.inlineCallbacks
305 def test_server_rescan_with_share_autosubscribe(self):
306 """Test the server_rescan method."""
307
308=== modified file 'ubuntuone/platform/linux/dbus_interface.py'
309--- ubuntuone/platform/linux/dbus_interface.py 2012-02-18 16:13:04 +0000
310+++ ubuntuone/platform/linux/dbus_interface.py 2012-04-03 13:00:34 +0000
311@@ -326,6 +326,10 @@
312 def QuotaExceeded(self, volume_dict):
313 """QuotaExceeded signal, the user ran out of space."""
314
315+ @dbus.service.signal(DBUS_IFACE_SYNC_NAME, signature='aa{ss}')
316+ def VolumesChanged(self, volumes):
317+ """Volumes list changed."""
318+
319
320 class FileSystem(DBusExposedObject):
321 """An interface to the FileSystem Manager."""
322
323=== modified file 'ubuntuone/platform/linux/notification.py'
324--- ubuntuone/platform/linux/notification.py 2012-03-09 19:27:03 +0000
325+++ ubuntuone/platform/linux/notification.py 2012-04-03 13:00:34 +0000
326@@ -72,5 +72,5 @@
327 if append:
328 self.notification.set_hint_string('x-canonical-append', '')
329
330- self.notification.set_hint('transient', True)
331+ self.notification.set_hint_int32('transient', int(True))
332 self.notification.show()
333
334=== modified file 'ubuntuone/platform/tools/__init__.py'
335--- ubuntuone/platform/tools/__init__.py 2012-02-03 14:29:52 +0000
336+++ ubuntuone/platform/tools/__init__.py 2012-04-03 13:00:34 +0000
337@@ -1,9 +1,6 @@
338 # -*- coding: utf-8 -*-
339 #
340-# Authors: Guillermo Gonzalez <guillermo.gonzalez@canonical.com>
341-# Natalia B. Bidart <natalia.bidart@canonical.com>
342-#
343-# Copyright 2009-2011 Canonical Ltd.
344+# Copyright 2009-2012 Canonical Ltd.
345 #
346 # This program is free software: you can redistribute it and/or modify it
347 # under the terms of the GNU General Public License version 3, as published
348@@ -64,7 +61,7 @@
349 """Converts a dict returned by the IPC client to a dict of strings."""
350 str_dict = {}
351 for key in a_dict:
352- str_dict[key] = unicode(a_dict[key])
353+ str_dict[unicode(key)] = unicode(a_dict[key])
354 return str_dict
355
356 def shutdown(self):
357@@ -443,7 +440,7 @@
358 @log_call(logger.debug)
359 def validate_path(self, path):
360 """Return True if the path is valid for a folder."""
361- result = yield self.proxy.call_method('folders', 'validate', path)
362+ result = yield self.proxy.call_method('folders', 'validate_path', path)
363 self.log.debug('valid: %r', result)
364 defer.returnValue(result)
365
366@@ -642,10 +639,17 @@
367 """Enable/disable udf_autosubscribe."""
368 return self.enable_setting('udf_autosubscribe', enabled)
369
370+ @defer.inlineCallbacks
371 @log_call(logger.debug)
372 def refresh_volumes(self):
373 """Request the volumes list to the server."""
374- return self.proxy.call_method('folders', 'refresh_volumes')
375+ d = self.wait_for_signals('VolumesChanged')
376+ self.proxy.call_method('folders', 'refresh_volumes')
377+
378+ (results,) = yield d
379+
380+ volumes_info = [self._get_dict(r) for r in results]
381+ defer.returnValue(volumes_info)
382
383 @log_call(logger.debug)
384 def rescan_from_scratch(self, volume_id):
385
386=== modified file 'ubuntuone/platform/tools/windows.py'
387--- ubuntuone/platform/tools/windows.py 2011-11-30 14:53:56 +0000
388+++ ubuntuone/platform/tools/windows.py 2012-04-03 13:00:34 +0000
389@@ -88,6 +88,7 @@
390 'ShareUnSubscribed': ('shares', 'on_share_unsubscribed_cb'),
391 'ShareUnSubscribeError': ('shares', 'on_share_unsubscribe_error_cb'),
392 'StatusChanged': ('status', 'on_status_changed_cb'),
393+ 'VolumesChanged': ('sync_daemon', 'on_volumes_changed_cb'),
394 }
395
396 # All methods and instance variables that should not be handled by
397
398=== modified file 'ubuntuone/platform/windows/ipc.py'
399--- ubuntuone/platform/windows/ipc.py 2012-02-18 16:13:04 +0000
400+++ ubuntuone/platform/windows/ipc.py 2012-04-03 13:00:34 +0000
401@@ -382,6 +382,7 @@
402 signal_mapping = {
403 'RootMismatch': 'on_root_mismatch',
404 'QuotaExceeded': 'on_quota_exceeded',
405+ 'VolumesChanged': 'on_volumes_changed',
406 }
407
408 def connect(self):
409@@ -439,6 +440,10 @@
410 def QuotaExceeded(self, volume_dict):
411 """QuotaExceeded signal, the user ran out of space."""
412
413+ @signal
414+ def VolumesChanged(self, volumes):
415+ """Volumes list has changed."""
416+
417
418 class FileSystem(IPCExposedObject):
419 """An interface to the FileSystem Manager."""
420
421=== modified file 'ubuntuone/platform/windows/ipc_client.py'
422--- ubuntuone/platform/windows/ipc_client.py 2012-02-03 14:29:52 +0000
423+++ ubuntuone/platform/windows/ipc_client.py 2012-04-03 13:00:34 +0000
424@@ -253,7 +253,11 @@
425 __metaclass__ = RemoteMeta
426
427 # calls that will be accessible remotely
428- signal_handlers = ['on_root_mismatch', 'on_quota_exceeded']
429+ signal_handlers = [
430+ 'on_root_mismatch',
431+ 'on_quota_exceeded',
432+ 'on_volumes_changed',
433+ ]
434
435 @remote
436 def connect(self):
437@@ -301,6 +305,10 @@
438 def on_quota_exceeded(self, volume_dict):
439 """Emit QuotaExceeded signal."""
440
441+ @signal
442+ def on_volumes_changed(self, volumes):
443+ """Emit VolumesChanged signal."""
444+
445
446 class FileSystemClient(RemoteClient):
447 """An ipc interface to the FileSystem Manager."""
448
449=== modified file 'ubuntuone/proxy/tunnel_server.py'
450--- ubuntuone/proxy/tunnel_server.py 2012-03-24 00:10:25 +0000
451+++ ubuntuone/proxy/tunnel_server.py 2012-04-03 13:00:34 +0000
452@@ -353,19 +353,27 @@
453 logger.info("Proxy is disabled.")
454 return enabled
455 else:
456+ QNetworkProxyFactory.setUseSystemConfiguration(True)
457 query = QNetworkProxyQuery(host, port)
458 proxies = QNetworkProxyFactory.systemProxyForQuery(query)
459 return len(proxies) and proxies[0].type() != QNetworkProxy.DefaultProxy
460
461
462+def install_qt_dbus():
463+ """Import and install the qt+dbus integration."""
464+ from dbus.mainloop.qt import DBusQtMainLoop
465+ DBusQtMainLoop(set_as_default=True)
466+
467+
468 def main(argv):
469 """The main function for the tunnel server."""
470 if not check_proxy_enabled(*argv[1:]):
471 sys.stdout.write("Proxy not enabled.")
472 sys.stdout.flush()
473 else:
474- from dbus.mainloop.qt import DBusQtMainLoop
475- DBusQtMainLoop(set_as_default=True)
476+ if sys.platform.startswith("linux"):
477+ install_qt_dbus()
478+
479 app = QCoreApplication(argv)
480 cookie = str(uuid.uuid4())
481 tunnel_server = TunnelServer(cookie)
482
483=== modified file 'ubuntuone/syncdaemon/event_queue.py'
484--- ubuntuone/syncdaemon/event_queue.py 2011-10-14 20:02:23 +0000
485+++ ubuntuone/syncdaemon/event_queue.py 2012-04-03 13:00:34 +0000
486@@ -160,7 +160,7 @@
487 'VM_VOLUME_DELETED': ('volume',),
488 'VM_VOLUME_DELETE_ERROR': ('volume_id', 'error'),
489 'VM_SHARE_CHANGED': ('share_id',),
490-
491+ 'VM_VOLUMES_CHANGED': ('volumes',),
492 }
493
494 DEFAULT_HANDLER = "handle_default" # receives (event_name, **kwargs)
495
496=== modified file 'ubuntuone/syncdaemon/interaction_interfaces.py'
497--- ubuntuone/syncdaemon/interaction_interfaces.py 2012-03-19 13:20:36 +0000
498+++ ubuntuone/syncdaemon/interaction_interfaces.py 2012-04-03 13:00:34 +0000
499@@ -1039,6 +1039,17 @@
500 self.interface.shares.ShareChanged(get_share_dict(share))
501
502 @log_call(logger.debug)
503+ def handle_VM_VOLUMES_CHANGED(self, volumes):
504+ """Handle VM_VOLUMES_CHANGED event, emit VolumeChanged signal."""
505+ str_volumes = []
506+ for volume in volumes:
507+ if isinstance(volume, UDF):
508+ str_volumes.append(get_udf_dict(volume))
509+ else:
510+ str_volumes.append(get_share_dict(volume))
511+ self.interface.sync_daemon.VolumesChanged(str_volumes)
512+
513+ @log_call(logger.debug)
514 def handle_AQ_CHANGE_PUBLIC_ACCESS_OK(self, share_id, node_id,
515 is_public, public_url):
516 """Handle the AQ_CHANGE_PUBLIC_ACCESS_OK event."""
517
518=== modified file 'ubuntuone/syncdaemon/tunnel_runner.py'
519--- ubuntuone/syncdaemon/tunnel_runner.py 2012-03-27 03:41:06 +0000
520+++ ubuntuone/syncdaemon/tunnel_runner.py 2012-04-03 13:00:34 +0000
521@@ -21,6 +21,7 @@
522 from os import path
523
524 from twisted.internet import defer, reactor
525+from twisted.python import procutils
526
527 from ubuntuone.platform.constants import TUNNEL_EXECUTABLE
528
529@@ -48,8 +49,12 @@
530 from ubuntuone.proxy.tunnel_client import TunnelProcessProtocol
531 protocol = TunnelProcessProtocol(self.client_d)
532 process_path = self.get_process_path()
533- args = [TUNNEL_EXECUTABLE, host, str(port)]
534- self.process_transport = reactor.spawnProcess(protocol, process_path,
535+ args = [process_path, host, str(port)]
536+ if sys.platform.startswith("win") and not process_path.endswith("exe"):
537+ python_exe = procutils.which("python.exe")
538+ if python_exe:
539+ args.insert(0, python_exe[0])
540+ self.process_transport = reactor.spawnProcess(protocol, args[0],
541 env=None, args=args)
542 reactor.addSystemEventTrigger("before", "shutdown", self.stop)
543
544
545=== modified file 'ubuntuone/syncdaemon/volume_manager.py'
546--- ubuntuone/syncdaemon/volume_manager.py 2012-02-09 23:32:10 +0000
547+++ ubuntuone/syncdaemon/volume_manager.py 2012-04-03 13:00:34 +0000
548@@ -636,6 +636,9 @@
549 # update the free_bytes on the volume
550 self.update_free_space(volume_id, new_volume.free_bytes)
551
552+ volumes = list(self.get_volumes(all_volumes=True))
553+ events.append(("VM_VOLUMES_CHANGED", dict(volumes=volumes)))
554+
555 # push the collected events
556 for event in events:
557 self.m.event_q.push(event[0], **event[1])

Subscribers

People subscribed via source and target branches