Merge lp:~alecu/ubuntuone-client/status-changed into lp:ubuntuone-client

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 1058
Merged at revision: 1054
Proposed branch: lp:~alecu/ubuntuone-client/status-changed
Merge into: lp:ubuntuone-client
Diff against target: 130 lines (+30/-6)
5 files modified
tests/platform/windows/test_ipc.py (+9/-3)
tests/platform/windows/test_tools.py (+11/-0)
ubuntuone/platform/windows/ipc.py (+5/-3)
ubuntuone/platform/windows/tools.py (+4/-0)
ubuntuone/syncdaemon/interaction_interfaces.py (+1/-0)
To merge this branch: bzr merge lp:~alecu/ubuntuone-client/status-changed
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Natalia Bidart (community) Approve
Review via email: mp+68116@code.launchpad.net

Commit message

Connect the signal for status changed (LP: #806655)

Description of the change

Connect the signal for status changed (LP: #806655)

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks great!

review: Approve
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/platform/windows/test_ipc.py'
--- tests/platform/windows/test_ipc.py 2011-07-13 19:55:31 +0000
+++ tests/platform/windows/test_ipc.py 2011-07-15 17:38:24 +0000
@@ -3049,7 +3049,8 @@
3049 self.action_queue = self.mocker.mock()3049 self.action_queue = self.mocker.mock()
3050 self.fs_manager = self.mocker.mock()3050 self.fs_manager = self.mocker.mock()
3051 self.volume_manager = self.mocker.mock()3051 self.volume_manager = self.mocker.mock()
3052 self.ipc_root = IPCRoot(self.main)3052 self.ipc_interface = self.mocker.mock()
3053 self.ipc_root = IPCRoot(self.ipc_interface, self.main)
3053 self.server_factory = SaveProtocolServerFactory(self.ipc_root)3054 self.server_factory = SaveProtocolServerFactory(self.ipc_root)
3054 self.listener = ipc_server_listen(self.server_factory)3055 self.listener = ipc_server_listen(self.server_factory)
3055 self.client_factory = PBClientFactory()3056 self.client_factory = PBClientFactory()
@@ -3235,9 +3236,10 @@
3235class FakeIPCRoot(object, ipc.Root):3236class FakeIPCRoot(object, ipc.Root):
3236 """A Fake IPC Root."""3237 """A Fake IPC Root."""
32373238
3238 def __init__(self, *args, **kwargs):3239 def __init__(self, ipc_interface, *args, **kwargs):
3239 """Initialize this fake instance."""3240 """Initialize this fake instance."""
3240 # This empty method is needed to override the default constructor3241 # just save the ipc_interface
3242 self.ipc_interface = ipc_interface
32413243
32423244
3243class RandomException(Exception):3245class RandomException(Exception):
@@ -3316,6 +3318,10 @@
33163318
3317 cmt_class = FakeCredentialsManagementTool3319 cmt_class = FakeCredentialsManagementTool
33183320
3321 def test_ipc_root_created_ok(self):
3322 """The IPCRoot is passed the IPCInterface."""
3323 self.assertEqual(self.ipc.root.ipc_interface, self.ipc)
3324
3319 @defer.inlineCallbacks3325 @defer.inlineCallbacks
3320 def test_connect(self):3326 def test_connect(self):
3321 """Test the connect method."""3327 """Test the connect method."""
33223328
=== modified file 'tests/platform/windows/test_tools.py'
--- tests/platform/windows/test_tools.py 2011-07-06 16:32:37 +0000
+++ tests/platform/windows/test_tools.py 2011-07-15 17:38:24 +0000
@@ -137,6 +137,8 @@
137 self.server_factory = SaveProtocolServerFactory(self.syncdaemon_root)137 self.server_factory = SaveProtocolServerFactory(self.syncdaemon_root)
138 # pylint: disable=E1101138 # pylint: disable=E1101
139 self.patch(ipc, "HOST_PORT", TEST_TOOLS_HOST_PORT)139 self.patch(ipc, "HOST_PORT", TEST_TOOLS_HOST_PORT)
140 self.patch(ipc.ActivationClient, "get_active_port",
141 lambda _: defer.succeed(TEST_TOOLS_HOST_PORT[1]))
140 self.listener = ipc_server_listen(self.server_factory)142 self.listener = ipc_server_listen(self.server_factory)
141 self.sdtool = SyncDaemonTool()143 self.sdtool = SyncDaemonTool()
142144
@@ -1099,6 +1101,15 @@
1099 # pylint: enable=E11011101 # pylint: enable=E1101
1100 return d1102 return d
11011103
1104 @defer.inlineCallbacks
1105 def test_set_status_changed_handler(self):
1106 """The status handler is changed."""
1107 test_handler = object()
1108 sdtool = yield self._connect()
1109 yield sdtool.set_status_changed_handler(test_handler)
1110 self.assertEqual(sdtool.client.status.on_status_changed_cb,
1111 test_handler)
1112
1102 def test_start(self):1113 def test_start(self):
1103 """Test that we can indeed start the process."""1114 """Test that we can indeed start the process."""
1104 cmd = 'notepad'1115 cmd = 'notepad'
11051116
=== modified file 'ubuntuone/platform/windows/ipc.py'
--- ubuntuone/platform/windows/ipc.py 2011-07-13 19:55:31 +0000
+++ ubuntuone/platform/windows/ipc.py 2011-07-15 17:38:24 +0000
@@ -157,6 +157,7 @@
157157
158 def emit_signal(self, signal_name, *args, **kwargs):158 def emit_signal(self, signal_name, *args, **kwargs):
159 """Emit the given signal to the clients."""159 """Emit the given signal to the clients."""
160 logger.debug("emitting %r to all connected clients.", signal_name)
160 for current_client in self.clients:161 for current_client in self.clients:
161 try:162 try:
162 d = current_client.callRemote(signal_name, *args, **kwargs)163 d = current_client.callRemote(signal_name, *args, **kwargs)
@@ -956,7 +957,8 @@
956 'get_folders',957 'get_folders',
957 'get_public_files']958 'get_public_files']
958959
959 def __init__(self, main, send_events=False, all_events=AllEventsSender):960 def __init__(self, ipc_interface, main, send_events=False,
961 all_events=AllEventsSender):
960 """Create a new instance that will expose the objects."""962 """Create a new instance that will expose the objects."""
961 super(IPCRoot, self).__init__()963 super(IPCRoot, self).__init__()
962 self.main = main964 self.main = main
@@ -975,7 +977,7 @@
975 self.all_events_sender = all_events(self.events)977 self.all_events_sender = all_events(self.events)
976 self.event_queue.subscribe(self.all_events_sender)978 self.event_queue.subscribe(self.all_events_sender)
977979
978 self.sync = SyncDaemon(self, self.main, self.volume_manager,980 self.sync = SyncDaemon(ipc_interface, self.main, self.volume_manager,
979 self.action_queue)981 self.action_queue)
980 self.fs = FileSystem(self.fs_manager, self.action_queue)982 self.fs = FileSystem(self.fs_manager, self.action_queue)
981 self.shares = Shares(self.fs_manager, self.volume_manager)983 self.shares = Shares(self.fs_manager, self.volume_manager)
@@ -1027,7 +1029,7 @@
1027 specified bus.1029 specified bus.
1028 """1030 """
1029 super(IPCInterface, self).__init__()1031 super(IPCInterface, self).__init__()
1030 self.root = IPCRoot(main, send_events)1032 self.root = IPCRoot(self, main, send_events)
1031 self.listener = ipc_server_listen(PBServerFactory(self.root))1033 self.listener = ipc_server_listen(PBServerFactory(self.root))
1032 self.main = main1034 self.main = main
10331035
10341036
=== modified file 'ubuntuone/platform/windows/tools.py'
--- ubuntuone/platform/windows/tools.py 2011-07-12 04:37:51 +0000
+++ ubuntuone/platform/windows/tools.py 2011-07-15 17:38:24 +0000
@@ -566,3 +566,7 @@
566 """Return the shares link directory."""566 """Return the shares link directory."""
567 return self.client.sync_daemon.get_sharesdir_link()567 return self.client.sync_daemon.get_sharesdir_link()
568568
569 def set_status_changed_handler(self, handler):
570 """Set the status changed handler."""
571 self.client.status.on_status_changed_cb = handler
572 return defer.succeed(None)
569573
=== modified file 'ubuntuone/syncdaemon/interaction_interfaces.py'
--- ubuntuone/syncdaemon/interaction_interfaces.py 2011-06-28 15:55:19 +0000
+++ ubuntuone/syncdaemon/interaction_interfaces.py 2011-07-15 17:38:24 +0000
@@ -929,6 +929,7 @@
929929
930 def handle_SYS_STATE_CHANGED(self, state):930 def handle_SYS_STATE_CHANGED(self, state):
931 """Handle SYS_STATE_CHANGED."""931 """Handle SYS_STATE_CHANGED."""
932 logger.debug('emitting state changed: %r', state)
932 self.interface.status.emit_status_changed(state)933 self.interface.status.emit_status_changed(state)
933934
934 def handle_SV_FREE_SPACE(self, share_id, free_bytes):935 def handle_SV_FREE_SPACE(self, share_id, free_bytes):

Subscribers

People subscribed via source and target branches