Merge lp:~alecu/ubuntuone-control-panel/use-status-changed into lp:ubuntuone-control-panel

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Roberto Alsina
Approved revision: 185
Merged at revision: 187
Proposed branch: lp:~alecu/ubuntuone-control-panel/use-status-changed
Merge into: lp:ubuntuone-control-panel
Diff against target: 89 lines (+22/-2)
4 files modified
ubuntuone/controlpanel/backend.py (+1/-0)
ubuntuone/controlpanel/gui/qt/filesyncstatus.py (+1/-1)
ubuntuone/controlpanel/sd_client/__init__.py (+5/-0)
ubuntuone/controlpanel/tests/test_sd_client.py (+15/-1)
To merge this branch: bzr merge lp:~alecu/ubuntuone-control-panel/use-status-changed
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Natalia Bidart (community) Approve
Review via email: mp+68117@code.launchpad.net

Commit message

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

Description of the change

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

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

Can you please replace

if not sys.platform.startswith("linux"):

with the decorator from devtools for skip a test in a given os.

Also,

ubuntuone/controlpanel/sd_client/__init__.py:238:5: E301 expected 1 blank line, found 0

review: Needs Fixing
184. By Alejandro J. Cura

fixed review comments

185. By Alejandro J. Cura

and now a lint fix

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Thanks! It 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
1=== modified file 'ubuntuone/controlpanel/backend.py'
2--- ubuntuone/controlpanel/backend.py 2011-06-29 18:15:57 +0000
3+++ ubuntuone/controlpanel/backend.py 2011-07-15 21:48:38 +0000
4@@ -144,6 +144,7 @@
5 * MSG_KEY: a non translatable but human readable string of the status.
6
7 """
8+ logger.debug('sync status: %r', status)
9 if not status:
10 self.file_sync_disabled = True
11 return self.STATUS_DISABLED
12
13=== modified file 'ubuntuone/controlpanel/gui/qt/filesyncstatus.py'
14--- ubuntuone/controlpanel/gui/qt/filesyncstatus.py 2011-07-14 17:57:17 +0000
15+++ ubuntuone/controlpanel/gui/qt/filesyncstatus.py 2011-07-15 21:48:38 +0000
16@@ -118,7 +118,6 @@
17
18 self._backend_method = None
19 self.backend = backend.ControlBackend()
20- self.backend.status_changed_handler = self.process_info
21
22 logger.debug('%s: started.', self.__class__.__name__)
23
24@@ -135,6 +134,7 @@
25 """Load specific tab info."""
26 info = yield self.backend.file_sync_status()
27 self.process_info(info)
28+ self.backend.status_changed_handler = self.process_info
29
30 @log_call(logger.debug)
31 def process_info(self, status):
32
33=== modified file 'ubuntuone/controlpanel/sd_client/__init__.py'
34--- ubuntuone/controlpanel/sd_client/__init__.py 2011-06-29 19:11:15 +0000
35+++ ubuntuone/controlpanel/sd_client/__init__.py 2011-07-15 21:48:38 +0000
36@@ -234,3 +234,8 @@
37 if sys.platform.startswith("linux"):
38 from ubuntuone.controlpanel.sd_client.linux \
39 import set_status_changed_handler
40+else:
41+
42+ def set_status_changed_handler(handler):
43+ """Set the status handler function."""
44+ return get_syncdaemon_tool().set_status_changed_handler(handler)
45
46=== modified file 'ubuntuone/controlpanel/tests/test_sd_client.py'
47--- ubuntuone/controlpanel/tests/test_sd_client.py 2011-06-29 19:01:50 +0000
48+++ ubuntuone/controlpanel/tests/test_sd_client.py 2011-07-15 21:48:38 +0000
49@@ -19,11 +19,12 @@
50
51 """Tests for the service when accessing SyncDaemon."""
52
53+import os
54 import uuid
55-import os
56
57 from twisted.internet import defer
58 from twisted.internet.defer import inlineCallbacks, returnValue
59+from ubuntuone.devtools.testcase import skipIfNotOS
60 # No name 'tools' in module 'ubuntuone.platform'
61 # pylint: disable=E0611
62 from ubuntuone.platform import tools
63@@ -310,6 +311,10 @@
64 """Return the shares link directory."""
65 return self.shares_dir_link
66
67+ def set_status_changed_handler(self, handler):
68+ """Set the handler for the status changed signal."""
69+ self.called['status_changed_handler'] = handler
70+
71
72 class BaseTestCase(TestCase):
73 """Test for the syncdaemon client methods."""
74@@ -688,6 +693,15 @@
75
76 self.assertEqual(FakedSyncDaemonTool.called['quit'], None)
77
78+ @skipIfNotOS('win32', 'The tested function is only defined on windows')
79+ @inlineCallbacks
80+ def test_set_status_changed_handler(self):
81+ """Connect a handler to the status changed signal."""
82+ sample_handler = object()
83+ yield sd_client.set_status_changed_handler(sample_handler)
84+ self.assertEqual(sample_handler,
85+ FakedSyncDaemonTool.called['status_changed_handler'])
86+
87
88 class BasicTestCase(BaseTestCase):
89 """Test for the basic syncdaemon client methods."""

Subscribers

People subscribed via source and target branches