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
=== modified file 'bin/u1sdtool'
--- bin/u1sdtool 2012-03-13 16:56:05 +0000
+++ bin/u1sdtool 2012-04-03 13:00:34 +0000
@@ -155,7 +155,13 @@
155 d.addCallback(lambda info: show_public_file_info(info, out))155 d.addCallback(lambda info: show_public_file_info(info, out))
156 d.addErrback(lambda failure: show_error(failure, out))156 d.addErrback(lambda failure: show_error(failure, out))
157 elif options.path_info:157 elif options.path_info:
158 path = os.path.abspath(options.path_info)158 try:
159 path = options.path_info.decode(sys.getfilesystemencoding())
160 except (UnicodeDecodeError, UnicodeEncodeError):
161 parser.error('PATH %r could not be decoded using the filesystem '
162 'encoding %r.' % (
163 options.path_info, sys.getfilesystemencoding()))
164 path = os.path.abspath(path)
159 if not os.path.exists(path):165 if not os.path.exists(path):
160 parser.error("PATH: '%s' don't exists" % path)166 parser.error("PATH: '%s' don't exists" % path)
161 d = sync_daemon_tool.get_metadata(path)167 d = sync_daemon_tool.get_metadata(path)
162168
=== modified file 'tests/platform/linux/test_notification.py'
--- tests/platform/linux/test_notification.py 2012-03-09 19:27:03 +0000
+++ tests/platform/linux/test_notification.py 2012-04-03 13:00:34 +0000
@@ -73,7 +73,7 @@
73 self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)73 self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)
74 mock_notification = self.mocker.mock()74 mock_notification = self.mocker.mock()
75 self.mocker.result(mock_notification)75 self.mocker.result(mock_notification)
76 mock_notification.set_hint('transient', True)76 mock_notification.set_hint_int32('transient', int(True))
77 mock_notification.show()77 mock_notification.show()
78 self.mocker.replay()78 self.mocker.replay()
79 Notification(FAKE_APP_NAME).send_notification(FAKE_TITLE, FAKE_MESSAGE)79 Notification(FAKE_APP_NAME).send_notification(FAKE_TITLE, FAKE_MESSAGE)
@@ -83,11 +83,11 @@
83 self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)83 self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, ICON_NAME)
84 mock_notification = self.mocker.mock()84 mock_notification = self.mocker.mock()
85 self.mocker.result(mock_notification)85 self.mocker.result(mock_notification)
86 mock_notification.set_hint('transient', True)86 mock_notification.set_hint_int32('transient', int(True))
87 mock_notification.show()87 mock_notification.show()
88 mock_notification.update(88 mock_notification.update(
89 FAKE_TITLE + '2', FAKE_MESSAGE + '2', ICON_NAME)89 FAKE_TITLE + '2', FAKE_MESSAGE + '2', ICON_NAME)
90 mock_notification.set_hint('transient', True)90 mock_notification.set_hint_int32('transient', int(True))
91 mock_notification.show()91 mock_notification.show()
92 self.mocker.replay()92 self.mocker.replay()
93 notifier = Notification(FAKE_APP_NAME)93 notifier = Notification(FAKE_APP_NAME)
@@ -99,7 +99,7 @@
99 self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, FAKE_ICON)99 self._set_up_mock_notify(FAKE_TITLE, FAKE_MESSAGE, FAKE_ICON)
100 mock_notification = self.mocker.mock()100 mock_notification = self.mocker.mock()
101 self.mocker.result(mock_notification)101 self.mocker.result(mock_notification)
102 mock_notification.set_hint('transient', True)102 mock_notification.set_hint_int32('transient', int(True))
103 mock_notification.show()103 mock_notification.show()
104 self.mocker.replay()104 self.mocker.replay()
105 Notification(FAKE_APP_NAME).send_notification(105 Notification(FAKE_APP_NAME).send_notification(
@@ -111,11 +111,11 @@
111 mock_notification = self.mocker.mock()111 mock_notification = self.mocker.mock()
112 self.mocker.result(mock_notification)112 self.mocker.result(mock_notification)
113 mock_notification.set_hint_string('x-canonical-append', '')113 mock_notification.set_hint_string('x-canonical-append', '')
114 mock_notification.set_hint('transient', True)114 mock_notification.set_hint_int32('transient', int(True))
115 mock_notification.show()115 mock_notification.show()
116 mock_notification.update(FAKE_TITLE, FAKE_APPENDAGE, ICON_NAME)116 mock_notification.update(FAKE_TITLE, FAKE_APPENDAGE, ICON_NAME)
117 mock_notification.set_hint_string('x-canonical-append', '')117 mock_notification.set_hint_string('x-canonical-append', '')
118 mock_notification.set_hint('transient', True)118 mock_notification.set_hint_int32('transient', int(True))
119 mock_notification.show()119 mock_notification.show()
120 self.mocker.replay()120 self.mocker.replay()
121 notifier = Notification(FAKE_APP_NAME)121 notifier = Notification(FAKE_APP_NAME)
122122
=== modified file 'tests/platform/test_external_interface.py'
--- tests/platform/test_external_interface.py 2012-02-03 14:29:52 +0000
+++ tests/platform/test_external_interface.py 2012-04-03 13:00:34 +0000
@@ -31,6 +31,7 @@
3131
32STR = 'something'32STR = 'something'
33STR_STR_DICT = {'foo': 'bar'}33STR_STR_DICT = {'foo': 'bar'}
34STR_LST_DICT = [STR_STR_DICT]
3435
3536
36class StatusTests(StatusTestCase):37class StatusTests(StatusTestCase):
@@ -146,6 +147,7 @@
146 signal_mapping = [147 signal_mapping = [
147 ('RootMismatch', (STR, STR)),148 ('RootMismatch', (STR, STR)),
148 ('QuotaExceeded', (STR_STR_DICT,)),149 ('QuotaExceeded', (STR_STR_DICT,)),
150 ('VolumesChanged', (STR_LST_DICT,)),
149 ]151 ]
150152
151 @defer.inlineCallbacks153 @defer.inlineCallbacks
152154
=== modified file 'tests/platform/test_tools.py'
--- tests/platform/test_tools.py 2012-01-17 20:00:44 +0000
+++ tests/platform/test_tools.py 2012-04-03 13:00:34 +0000
@@ -624,6 +624,12 @@
624 "UDF %s is subscribed" % udf.id)624 "UDF %s is subscribed" % udf.id)
625625
626 @defer.inlineCallbacks626 @defer.inlineCallbacks
627 def test_validate_path(self):
628 """Test for Folders.validate_path."""
629 result = yield self.tool.validate_path(self.root_dir)
630 self.assertFalse(result)
631
632 @defer.inlineCallbacks
627 def test_subscribe_share(self):633 def test_subscribe_share(self):
628 """Test for Shares.subscribe."""634 """Test for Shares.subscribe."""
629 share = self._create_share(accepted=True, subscribed=False)635 share = self._create_share(accepted=True, subscribed=False)
@@ -898,11 +904,29 @@
898 @defer.inlineCallbacks904 @defer.inlineCallbacks
899 def test_refresh_volumes(self):905 def test_refresh_volumes(self):
900 """Test for refresh_volumes method."""906 """Test for refresh_volumes method."""
901 d = defer.Deferred()907 udf = self._create_udf()
902 self.patch(self.main.action_q, 'list_volumes',908 yield self.main.vm.add_udf(udf)
903 lambda: d.callback(True))909
904 yield self.tool.refresh_volumes()910 share = self._create_share()
905 yield d911 yield self.main.vm.add_share(share)
912
913 volumes = list(self.main.vm.get_volumes(all_volumes=True))
914
915 def volumes_changed():
916 """Fake volumes_changed."""
917 self.main.event_q.push('VM_VOLUMES_CHANGED', volumes=volumes)
918
919 self.patch(self.main.vm, 'refresh_volumes', volumes_changed)
920 result = yield self.tool.refresh_volumes()
921
922 str_volumes = []
923 for volume in volumes:
924 if isinstance(volume, volume_manager.UDF):
925 str_vol = interaction_interfaces.get_udf_dict(volume)
926 else:
927 str_vol = interaction_interfaces.get_share_dict(volume)
928 str_volumes.append(str_vol)
929 self.assertEqual(result, str_volumes)
906930
907 @defer.inlineCallbacks931 @defer.inlineCallbacks
908 def test_rescan_from_scratch(self):932 def test_rescan_from_scratch(self):
909933
=== modified file 'tests/proxy/test_tunnel_server.py'
--- tests/proxy/test_tunnel_server.py 2012-03-24 00:10:25 +0000
+++ tests/proxy/test_tunnel_server.py 2012-04-03 13:00:34 +0000
@@ -549,6 +549,7 @@
549class FakeNetworkProxyFactoryClass(object):549class FakeNetworkProxyFactoryClass(object):
550 """A fake QNetworkProxyFactory."""550 """A fake QNetworkProxyFactory."""
551 last_query = None551 last_query = None
552 use_system = False
552553
553 def __init__(self, enabled):554 def __init__(self, enabled):
554 """Initialize this fake instance."""555 """Initialize this fake instance."""
@@ -561,6 +562,16 @@
561 """Return the proxy type configured."""562 """Return the proxy type configured."""
562 return self.proxy_type563 return self.proxy_type
563564
565 @classmethod
566 def setUseSystemConfiguration(cls, new_value):
567 """Save the system configuration requested."""
568 cls.use_system = new_value
569
570 @classmethod
571 def useSystemConfiguration(cls):
572 """Is the system configured for proxies?"""
573 return cls.use_system
574
564 def systemProxyForQuery(self, query):575 def systemProxyForQuery(self, query):
565 """A list of proxies, but only type() will be called on the first."""576 """A list of proxies, but only type() will be called on the first."""
566 return [self]577 return [self]
@@ -610,6 +621,7 @@
610 self.patch(tunnel_server, "QNetworkProxyFactory", fake_netproxfact)621 self.patch(tunnel_server, "QNetworkProxyFactory", fake_netproxfact)
611 self._assert_proxy_enabled("windows 1.0")622 self._assert_proxy_enabled("windows 1.0")
612 self.assertEqual(len(self.app_proxy), 0)623 self.assertEqual(len(self.app_proxy), 0)
624 self.assertTrue(fake_netproxfact.useSystemConfiguration())
613625
614 def test_platform_other_disabled(self):626 def test_platform_other_disabled(self):
615 """Tests for any other platform with proxies disabled."""627 """Tests for any other platform with proxies disabled."""
@@ -617,6 +629,7 @@
617 self.patch(tunnel_server, "QNetworkProxyFactory", fake_netproxfact)629 self.patch(tunnel_server, "QNetworkProxyFactory", fake_netproxfact)
618 self._assert_proxy_disabled("windows 1.0")630 self._assert_proxy_disabled("windows 1.0")
619 self.assertEqual(len(self.app_proxy), 0)631 self.assertEqual(len(self.app_proxy), 0)
632 self.assertTrue(fake_netproxfact.useSystemConfiguration())
620633
621634
622class FakeQCoreApp(object):635class FakeQCoreApp(object):
@@ -683,3 +696,23 @@
683 tunnel_server.main(["example.com", "443"])696 tunnel_server.main(["example.com", "443"])
684 self.assertIn("Proxy not enabled.", self.fake_stdout.getvalue())697 self.assertIn("Proxy not enabled.", self.fake_stdout.getvalue())
685 self.assertEqual(FakeQCoreApp.fake_instance, None)698 self.assertEqual(FakeQCoreApp.fake_instance, None)
699
700 def test_qtdbus_installed_on_linux(self):
701 """The QtDbus mainloop is installed."""
702 self.patch(tunnel_server.sys, "platform", "linux123")
703 installed = []
704 self.patch(tunnel_server, "install_qt_dbus",
705 lambda: installed.append(None))
706 self.proxies_enabled = True
707 tunnel_server.main(["example.com", "443"])
708 self.assertEqual(len(installed), 1)
709
710 def test_qtdbus_not_installed_on_windows(self):
711 """The QtDbus mainloop is installed."""
712 self.patch(tunnel_server.sys, "platform", "win98")
713 installed = []
714 self.patch(tunnel_server, "install_qt_dbus",
715 lambda: installed.append(None))
716 self.proxies_enabled = True
717 tunnel_server.main(["example.com", "443"])
718 self.assertEqual(len(installed), 0)
686719
=== modified file 'tests/syncdaemon/test_interaction_interfaces.py'
--- tests/syncdaemon/test_interaction_interfaces.py 2012-03-01 19:08:12 +0000
+++ tests/syncdaemon/test_interaction_interfaces.py 2012-04-03 13:00:34 +0000
@@ -1750,6 +1750,24 @@
1750 self.assertEqual(error, error_msg)1750 self.assertEqual(error, error_msg)
17511751
1752 @defer.inlineCallbacks1752 @defer.inlineCallbacks
1753 def test_handle_VM_VOLUMES_CHANGED(self):
1754 """Test the handle_VM_VOLUMES_CHANGED method."""
1755 share = self._create_share(accepted=True)
1756 udf = self._create_udf()
1757 volumes = [share, udf, self.main.vm.root]
1758 d = defer.Deferred()
1759 self.patch(self.sd_obj.interface.sync_daemon, 'VolumesChanged',
1760 d.callback)
1761
1762 self.main.event_q.push('VM_VOLUMES_CHANGED', volumes=volumes)
1763
1764 info = yield d
1765
1766 str_volumes = sorted((get_share_dict(share), get_udf_dict(udf),
1767 get_share_dict(self.main.vm.root)))
1768 self.assertEqual(str_volumes, sorted(info))
1769
1770 @defer.inlineCallbacks
1753 def test_handle_VM_VOLUME_DELETED_folder(self):1771 def test_handle_VM_VOLUME_DELETED_folder(self):
1754 """Test the handle_VM_VOLUME_DELETED method for a folder."""1772 """Test the handle_VM_VOLUME_DELETED method for a folder."""
1755 udf = self._create_udf()1773 udf = self._create_udf()
17561774
=== modified file 'tests/syncdaemon/test_tunnel_runner.py'
--- tests/syncdaemon/test_tunnel_runner.py 2012-03-27 03:41:06 +0000
+++ tests/syncdaemon/test_tunnel_runner.py 2012-04-03 13:00:34 +0000
@@ -179,3 +179,12 @@
179 self.addCleanup(delattr, sys, "frozen")179 self.addCleanup(delattr, sys, "frozen")
180 self.assertEqual(os.path.dirname(self.tr.get_process_path()),180 self.assertEqual(os.path.dirname(self.tr.get_process_path()),
181 os.path.dirname(sys.executable))181 os.path.dirname(sys.executable))
182
183 def test_start_process_win_devel(self):
184 """Test the windows devel case."""
185 fake_python = r"c:\python99\python.exe"
186 self.patch(sys, "platform", "win98")
187 self.patch(tunnel_runner.procutils, "which", lambda _: [fake_python])
188 tunnel_runner.TunnelRunner("fs-1.one.ubuntu.com", 443)
189 args, kwargs = self.spawned[1]
190 self.assertEqual(args[1], fake_python)
182191
=== modified file 'tests/syncdaemon/test_vm.py'
--- tests/syncdaemon/test_vm.py 2012-02-09 23:32:10 +0000
+++ tests/syncdaemon/test_vm.py 2012-04-03 13:00:34 +0000
@@ -1893,6 +1893,27 @@
1893 """Test handle_AQ_LIST_VOLUMES event with an inactive udf."""1893 """Test handle_AQ_LIST_VOLUMES event with an inactive udf."""
1894 yield self._test_handle_AQ_LIST_VOLUMES_udf(False)1894 yield self._test_handle_AQ_LIST_VOLUMES_udf(False)
18951895
1896 @defer.inlineCallbacks
1897 def test_handle_AQ_LIST_VOLUMES_emits_volumes_changed(self):
1898 """When handling a new volume list, VM_VOLUMES_CHANGED is pushed."""
1899 share = self._create_share_volume()
1900 udf = self._create_udf_volume()
1901 root_volume = volumes.RootVolume(uuid.uuid4(), 17, 10)
1902 response = [share, udf, root_volume]
1903
1904 udf_created_d = defer.Deferred()
1905 self._listen_for('VM_UDF_CREATED', udf_created_d.callback)
1906
1907 volumes_changed_d = defer.Deferred()
1908 self._listen_for('VM_VOLUMES_CHANGED', volumes_changed_d.callback)
1909
1910 self.vm.handle_AQ_LIST_VOLUMES(response)
1911
1912 yield udf_created_d
1913 actual = yield volumes_changed_d
1914 expected = {'volumes': list(self.vm.get_volumes(all_volumes=True))}
1915 self.assertEqual(expected, actual)
1916
18961917
1897class VolumeManagerOperationsTests(BaseVolumeManagerTests):1918class VolumeManagerOperationsTests(BaseVolumeManagerTests):
1898 """Test UDF/Volumes operations."""1919 """Test UDF/Volumes operations."""
@@ -3104,12 +3125,18 @@
3104 vol_rescan_d.callback) # autosubscribe is False3125 vol_rescan_d.callback) # autosubscribe is False
3105 server_rescan_d = defer.Deferred()3126 server_rescan_d = defer.Deferred()
3106 self._listen_for('SYS_SERVER_RESCAN_DONE', server_rescan_d.callback)3127 self._listen_for('SYS_SERVER_RESCAN_DONE', server_rescan_d.callback)
3128 volumes_changed_d = defer.Deferred()
3129 self._listen_for('VM_VOLUMES_CHANGED', volumes_changed_d.callback)
3107 yield self.vm.server_rescan()3130 yield self.vm.server_rescan()
3108 yield server_rescan_d3131 yield server_rescan_d
3109 events = yield vol_rescan_d3132 events = yield vol_rescan_d
3133 vols = yield volumes_changed_d
31103134
3111 self.assertEqual({'generation': 1, 'volume_id': ''}, events)3135 self.assertEqual({'generation': 1, 'volume_id': ''}, events)
31123136
3137 expected = list(self.vm.get_volumes(all_volumes=True))
3138 self.assertEqual({'volumes' : expected}, vols)
3139
3113 @defer.inlineCallbacks3140 @defer.inlineCallbacks
3114 def test_server_rescan_with_share_autosubscribe(self):3141 def test_server_rescan_with_share_autosubscribe(self):
3115 """Test the server_rescan method."""3142 """Test the server_rescan method."""
31163143
=== modified file 'ubuntuone/platform/linux/dbus_interface.py'
--- ubuntuone/platform/linux/dbus_interface.py 2012-02-18 16:13:04 +0000
+++ ubuntuone/platform/linux/dbus_interface.py 2012-04-03 13:00:34 +0000
@@ -326,6 +326,10 @@
326 def QuotaExceeded(self, volume_dict):326 def QuotaExceeded(self, volume_dict):
327 """QuotaExceeded signal, the user ran out of space."""327 """QuotaExceeded signal, the user ran out of space."""
328328
329 @dbus.service.signal(DBUS_IFACE_SYNC_NAME, signature='aa{ss}')
330 def VolumesChanged(self, volumes):
331 """Volumes list changed."""
332
329333
330class FileSystem(DBusExposedObject):334class FileSystem(DBusExposedObject):
331 """An interface to the FileSystem Manager."""335 """An interface to the FileSystem Manager."""
332336
=== modified file 'ubuntuone/platform/linux/notification.py'
--- ubuntuone/platform/linux/notification.py 2012-03-09 19:27:03 +0000
+++ ubuntuone/platform/linux/notification.py 2012-04-03 13:00:34 +0000
@@ -72,5 +72,5 @@
72 if append:72 if append:
73 self.notification.set_hint_string('x-canonical-append', '')73 self.notification.set_hint_string('x-canonical-append', '')
7474
75 self.notification.set_hint('transient', True)75 self.notification.set_hint_int32('transient', int(True))
76 self.notification.show()76 self.notification.show()
7777
=== modified file 'ubuntuone/platform/tools/__init__.py'
--- ubuntuone/platform/tools/__init__.py 2012-02-03 14:29:52 +0000
+++ ubuntuone/platform/tools/__init__.py 2012-04-03 13:00:34 +0000
@@ -1,9 +1,6 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2#2#
3# Authors: Guillermo Gonzalez <guillermo.gonzalez@canonical.com>3# Copyright 2009-2012 Canonical Ltd.
4# Natalia B. Bidart <natalia.bidart@canonical.com>
5#
6# Copyright 2009-2011 Canonical Ltd.
7#4#
8# This program is free software: you can redistribute it and/or modify it5# This program is free software: you can redistribute it and/or modify it
9# under the terms of the GNU General Public License version 3, as published6# under the terms of the GNU General Public License version 3, as published
@@ -64,7 +61,7 @@
64 """Converts a dict returned by the IPC client to a dict of strings."""61 """Converts a dict returned by the IPC client to a dict of strings."""
65 str_dict = {}62 str_dict = {}
66 for key in a_dict:63 for key in a_dict:
67 str_dict[key] = unicode(a_dict[key])64 str_dict[unicode(key)] = unicode(a_dict[key])
68 return str_dict65 return str_dict
6966
70 def shutdown(self):67 def shutdown(self):
@@ -443,7 +440,7 @@
443 @log_call(logger.debug)440 @log_call(logger.debug)
444 def validate_path(self, path):441 def validate_path(self, path):
445 """Return True if the path is valid for a folder."""442 """Return True if the path is valid for a folder."""
446 result = yield self.proxy.call_method('folders', 'validate', path)443 result = yield self.proxy.call_method('folders', 'validate_path', path)
447 self.log.debug('valid: %r', result)444 self.log.debug('valid: %r', result)
448 defer.returnValue(result)445 defer.returnValue(result)
449446
@@ -642,10 +639,17 @@
642 """Enable/disable udf_autosubscribe."""639 """Enable/disable udf_autosubscribe."""
643 return self.enable_setting('udf_autosubscribe', enabled)640 return self.enable_setting('udf_autosubscribe', enabled)
644641
642 @defer.inlineCallbacks
645 @log_call(logger.debug)643 @log_call(logger.debug)
646 def refresh_volumes(self):644 def refresh_volumes(self):
647 """Request the volumes list to the server."""645 """Request the volumes list to the server."""
648 return self.proxy.call_method('folders', 'refresh_volumes')646 d = self.wait_for_signals('VolumesChanged')
647 self.proxy.call_method('folders', 'refresh_volumes')
648
649 (results,) = yield d
650
651 volumes_info = [self._get_dict(r) for r in results]
652 defer.returnValue(volumes_info)
649653
650 @log_call(logger.debug)654 @log_call(logger.debug)
651 def rescan_from_scratch(self, volume_id):655 def rescan_from_scratch(self, volume_id):
652656
=== modified file 'ubuntuone/platform/tools/windows.py'
--- ubuntuone/platform/tools/windows.py 2011-11-30 14:53:56 +0000
+++ ubuntuone/platform/tools/windows.py 2012-04-03 13:00:34 +0000
@@ -88,6 +88,7 @@
88 'ShareUnSubscribed': ('shares', 'on_share_unsubscribed_cb'),88 'ShareUnSubscribed': ('shares', 'on_share_unsubscribed_cb'),
89 'ShareUnSubscribeError': ('shares', 'on_share_unsubscribe_error_cb'),89 'ShareUnSubscribeError': ('shares', 'on_share_unsubscribe_error_cb'),
90 'StatusChanged': ('status', 'on_status_changed_cb'),90 'StatusChanged': ('status', 'on_status_changed_cb'),
91 'VolumesChanged': ('sync_daemon', 'on_volumes_changed_cb'),
91 }92 }
9293
93 # All methods and instance variables that should not be handled by94 # All methods and instance variables that should not be handled by
9495
=== modified file 'ubuntuone/platform/windows/ipc.py'
--- ubuntuone/platform/windows/ipc.py 2012-02-18 16:13:04 +0000
+++ ubuntuone/platform/windows/ipc.py 2012-04-03 13:00:34 +0000
@@ -382,6 +382,7 @@
382 signal_mapping = {382 signal_mapping = {
383 'RootMismatch': 'on_root_mismatch',383 'RootMismatch': 'on_root_mismatch',
384 'QuotaExceeded': 'on_quota_exceeded',384 'QuotaExceeded': 'on_quota_exceeded',
385 'VolumesChanged': 'on_volumes_changed',
385 }386 }
386387
387 def connect(self):388 def connect(self):
@@ -439,6 +440,10 @@
439 def QuotaExceeded(self, volume_dict):440 def QuotaExceeded(self, volume_dict):
440 """QuotaExceeded signal, the user ran out of space."""441 """QuotaExceeded signal, the user ran out of space."""
441442
443 @signal
444 def VolumesChanged(self, volumes):
445 """Volumes list has changed."""
446
442447
443class FileSystem(IPCExposedObject):448class FileSystem(IPCExposedObject):
444 """An interface to the FileSystem Manager."""449 """An interface to the FileSystem Manager."""
445450
=== modified file 'ubuntuone/platform/windows/ipc_client.py'
--- ubuntuone/platform/windows/ipc_client.py 2012-02-03 14:29:52 +0000
+++ ubuntuone/platform/windows/ipc_client.py 2012-04-03 13:00:34 +0000
@@ -253,7 +253,11 @@
253 __metaclass__ = RemoteMeta253 __metaclass__ = RemoteMeta
254254
255 # calls that will be accessible remotely255 # calls that will be accessible remotely
256 signal_handlers = ['on_root_mismatch', 'on_quota_exceeded']256 signal_handlers = [
257 'on_root_mismatch',
258 'on_quota_exceeded',
259 'on_volumes_changed',
260 ]
257261
258 @remote262 @remote
259 def connect(self):263 def connect(self):
@@ -301,6 +305,10 @@
301 def on_quota_exceeded(self, volume_dict):305 def on_quota_exceeded(self, volume_dict):
302 """Emit QuotaExceeded signal."""306 """Emit QuotaExceeded signal."""
303307
308 @signal
309 def on_volumes_changed(self, volumes):
310 """Emit VolumesChanged signal."""
311
304312
305class FileSystemClient(RemoteClient):313class FileSystemClient(RemoteClient):
306 """An ipc interface to the FileSystem Manager."""314 """An ipc interface to the FileSystem Manager."""
307315
=== modified file 'ubuntuone/proxy/tunnel_server.py'
--- ubuntuone/proxy/tunnel_server.py 2012-03-24 00:10:25 +0000
+++ ubuntuone/proxy/tunnel_server.py 2012-04-03 13:00:34 +0000
@@ -353,19 +353,27 @@
353 logger.info("Proxy is disabled.")353 logger.info("Proxy is disabled.")
354 return enabled354 return enabled
355 else:355 else:
356 QNetworkProxyFactory.setUseSystemConfiguration(True)
356 query = QNetworkProxyQuery(host, port)357 query = QNetworkProxyQuery(host, port)
357 proxies = QNetworkProxyFactory.systemProxyForQuery(query)358 proxies = QNetworkProxyFactory.systemProxyForQuery(query)
358 return len(proxies) and proxies[0].type() != QNetworkProxy.DefaultProxy359 return len(proxies) and proxies[0].type() != QNetworkProxy.DefaultProxy
359360
360361
362def install_qt_dbus():
363 """Import and install the qt+dbus integration."""
364 from dbus.mainloop.qt import DBusQtMainLoop
365 DBusQtMainLoop(set_as_default=True)
366
367
361def main(argv):368def main(argv):
362 """The main function for the tunnel server."""369 """The main function for the tunnel server."""
363 if not check_proxy_enabled(*argv[1:]):370 if not check_proxy_enabled(*argv[1:]):
364 sys.stdout.write("Proxy not enabled.")371 sys.stdout.write("Proxy not enabled.")
365 sys.stdout.flush()372 sys.stdout.flush()
366 else:373 else:
367 from dbus.mainloop.qt import DBusQtMainLoop374 if sys.platform.startswith("linux"):
368 DBusQtMainLoop(set_as_default=True)375 install_qt_dbus()
376
369 app = QCoreApplication(argv)377 app = QCoreApplication(argv)
370 cookie = str(uuid.uuid4())378 cookie = str(uuid.uuid4())
371 tunnel_server = TunnelServer(cookie)379 tunnel_server = TunnelServer(cookie)
372380
=== modified file 'ubuntuone/syncdaemon/event_queue.py'
--- ubuntuone/syncdaemon/event_queue.py 2011-10-14 20:02:23 +0000
+++ ubuntuone/syncdaemon/event_queue.py 2012-04-03 13:00:34 +0000
@@ -160,7 +160,7 @@
160 'VM_VOLUME_DELETED': ('volume',),160 'VM_VOLUME_DELETED': ('volume',),
161 'VM_VOLUME_DELETE_ERROR': ('volume_id', 'error'),161 'VM_VOLUME_DELETE_ERROR': ('volume_id', 'error'),
162 'VM_SHARE_CHANGED': ('share_id',),162 'VM_SHARE_CHANGED': ('share_id',),
163163 'VM_VOLUMES_CHANGED': ('volumes',),
164}164}
165165
166DEFAULT_HANDLER = "handle_default" # receives (event_name, **kwargs)166DEFAULT_HANDLER = "handle_default" # receives (event_name, **kwargs)
167167
=== modified file 'ubuntuone/syncdaemon/interaction_interfaces.py'
--- ubuntuone/syncdaemon/interaction_interfaces.py 2012-03-19 13:20:36 +0000
+++ ubuntuone/syncdaemon/interaction_interfaces.py 2012-04-03 13:00:34 +0000
@@ -1039,6 +1039,17 @@
1039 self.interface.shares.ShareChanged(get_share_dict(share))1039 self.interface.shares.ShareChanged(get_share_dict(share))
10401040
1041 @log_call(logger.debug)1041 @log_call(logger.debug)
1042 def handle_VM_VOLUMES_CHANGED(self, volumes):
1043 """Handle VM_VOLUMES_CHANGED event, emit VolumeChanged signal."""
1044 str_volumes = []
1045 for volume in volumes:
1046 if isinstance(volume, UDF):
1047 str_volumes.append(get_udf_dict(volume))
1048 else:
1049 str_volumes.append(get_share_dict(volume))
1050 self.interface.sync_daemon.VolumesChanged(str_volumes)
1051
1052 @log_call(logger.debug)
1042 def handle_AQ_CHANGE_PUBLIC_ACCESS_OK(self, share_id, node_id,1053 def handle_AQ_CHANGE_PUBLIC_ACCESS_OK(self, share_id, node_id,
1043 is_public, public_url):1054 is_public, public_url):
1044 """Handle the AQ_CHANGE_PUBLIC_ACCESS_OK event."""1055 """Handle the AQ_CHANGE_PUBLIC_ACCESS_OK event."""
10451056
=== modified file 'ubuntuone/syncdaemon/tunnel_runner.py'
--- ubuntuone/syncdaemon/tunnel_runner.py 2012-03-27 03:41:06 +0000
+++ ubuntuone/syncdaemon/tunnel_runner.py 2012-04-03 13:00:34 +0000
@@ -21,6 +21,7 @@
21from os import path21from os import path
2222
23from twisted.internet import defer, reactor23from twisted.internet import defer, reactor
24from twisted.python import procutils
2425
25from ubuntuone.platform.constants import TUNNEL_EXECUTABLE26from ubuntuone.platform.constants import TUNNEL_EXECUTABLE
2627
@@ -48,8 +49,12 @@
48 from ubuntuone.proxy.tunnel_client import TunnelProcessProtocol49 from ubuntuone.proxy.tunnel_client import TunnelProcessProtocol
49 protocol = TunnelProcessProtocol(self.client_d)50 protocol = TunnelProcessProtocol(self.client_d)
50 process_path = self.get_process_path()51 process_path = self.get_process_path()
51 args = [TUNNEL_EXECUTABLE, host, str(port)]52 args = [process_path, host, str(port)]
52 self.process_transport = reactor.spawnProcess(protocol, process_path,53 if sys.platform.startswith("win") and not process_path.endswith("exe"):
54 python_exe = procutils.which("python.exe")
55 if python_exe:
56 args.insert(0, python_exe[0])
57 self.process_transport = reactor.spawnProcess(protocol, args[0],
53 env=None, args=args)58 env=None, args=args)
54 reactor.addSystemEventTrigger("before", "shutdown", self.stop)59 reactor.addSystemEventTrigger("before", "shutdown", self.stop)
5560
5661
=== modified file 'ubuntuone/syncdaemon/volume_manager.py'
--- ubuntuone/syncdaemon/volume_manager.py 2012-02-09 23:32:10 +0000
+++ ubuntuone/syncdaemon/volume_manager.py 2012-04-03 13:00:34 +0000
@@ -636,6 +636,9 @@
636 # update the free_bytes on the volume636 # update the free_bytes on the volume
637 self.update_free_space(volume_id, new_volume.free_bytes)637 self.update_free_space(volume_id, new_volume.free_bytes)
638638
639 volumes = list(self.get_volumes(all_volumes=True))
640 events.append(("VM_VOLUMES_CHANGED", dict(volumes=volumes)))
641
639 # push the collected events642 # push the collected events
640 for event in events:643 for event in events:
641 self.m.event_q.push(event[0], **event[1])644 self.m.event_q.push(event[0], **event[1])

Subscribers

People subscribed via source and target branches