Merge lp:~diegosarmentero/ubuntuone-control-panel/refactor-sync-status into lp:ubuntuone-control-panel

Proposed by Diego Sarmentero on 2012-08-08
Status: Merged
Approved by: Diego Sarmentero on 2012-08-14
Approved revision: 341
Merged at revision: 341
Proposed branch: lp:~diegosarmentero/ubuntuone-control-panel/refactor-sync-status
Merge into: lp:ubuntuone-control-panel
Diff against target: 457 lines (+143/-106)
7 files modified
ubuntuone/controlpanel/backend.py (+7/-0)
ubuntuone/controlpanel/gui/__init__.py (+8/-0)
ubuntuone/controlpanel/gui/qt/__init__.py (+78/-0)
ubuntuone/controlpanel/gui/qt/filesyncstatus.py (+4/-77)
ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py (+30/-29)
ubuntuone/controlpanel/sd_client/__init__.py (+4/-0)
ubuntuone/controlpanel/tests/test_backend.py (+12/-0)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-control-panel/refactor-sync-status
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve on 2012-08-10
Brian Curtin (community) 2012-08-08 Approve on 2012-08-09
Review via email: mp+118809@code.launchpad.net

Commit Message

- Refactoring some sync status info to be able to use those functions and constants from the sync menu too (LP: #1034542).

Description of the Change

For u1lint you should set the PYTHONPATH including this branch: lp:~diegosarmentero/ubuntuone-client/ipcmenu

To post a comment you must log in.
Brian Curtin (brian.curtin) wrote :

Looks reasonable to me.

review: Approve
Roberto Alsina (ralsina) wrote :

+1 with the promise that those string constants are used in a following branch.

review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (144.4 KiB)

The attempt to merge lp:~diegosarmentero/ubuntuone-control-panel/refactor-sync-status into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.

*** Running DBus test suite ***
ubuntuone.controlpanel.dbustests.test_dbus_service
  BaseTestCase
    runTest ... [OK]
  DBusServiceMainTestCase
    test_dbus_service_cant_register ... Control panel backend already running.
                                   [OK]
    test_dbus_service_main ... [OK]
  DBusServiceTestCase
    test_cant_register_twice ... [SKIPPED]
    test_dbus_busname_created ... [OK]
    test_error_handler_default ... [OK]
    test_error_handler_with_exception ... [OK]
    test_error_handler_with_failure ... [OK]
    test_error_handler_with_non_string_dict ... [OK]
    test_error_handler_with_string_dict ... [OK]
    test_register_service ... [OK]
  FileSyncTestCase
    test_file_sync_status_changed ... [OK]
    test_file_sync_status_disabled ... [OK]
    test_file_sync_status_disconnected ... [OK]
    test_file_sync_status_error ... [OK]
    test_file_sync_status_idle ... [OK]
    test_file_sync_status_starting ... [OK]
    test_file_sync_status_stopped ... [OK]
    test_file_sync_status_syncing ... [OK]
    test_file_sync_status_unknown ... [OK]
    test_status_changed_handler ... [OK]
    test_status_changed_handler_after_status_requested ... [OK]
    test_status_changed_handler_after_status_requested_twice ... [OK]
  OperationsAuthErrorTestCase
    test_account_info_returned ... [OK]
    test_change_device_settings ... [OK]
    test_change_replication_settings ... [OK]
    test_change_volume_settings ... [OK]
    test_connect_files ... [OK]
    test_devices_info_returned ... [OK]
    test_disable_files ... [OK]
    test_disconnect_files ... [OK]
    test_enable_files ... [OK]
    test_remove_device ... [OK]
    test_replications_info ... [OK]
    test_restart_files ... [...

Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (144.4 KiB)

The attempt to merge lp:~diegosarmentero/ubuntuone-control-panel/refactor-sync-status into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.

*** Running DBus test suite ***
ubuntuone.controlpanel.dbustests.test_dbus_service
  BaseTestCase
    runTest ... [OK]
  DBusServiceMainTestCase
    test_dbus_service_cant_register ... Control panel backend already running.
                                   [OK]
    test_dbus_service_main ... [OK]
  DBusServiceTestCase
    test_cant_register_twice ... [SKIPPED]
    test_dbus_busname_created ... [OK]
    test_error_handler_default ... [OK]
    test_error_handler_with_exception ... [OK]
    test_error_handler_with_failure ... [OK]
    test_error_handler_with_non_string_dict ... [OK]
    test_error_handler_with_string_dict ... [OK]
    test_register_service ... [OK]
  FileSyncTestCase
    test_file_sync_status_changed ... [OK]
    test_file_sync_status_disabled ... [OK]
    test_file_sync_status_disconnected ... [OK]
    test_file_sync_status_error ... [OK]
    test_file_sync_status_idle ... [OK]
    test_file_sync_status_starting ... [OK]
    test_file_sync_status_stopped ... [OK]
    test_file_sync_status_syncing ... [OK]
    test_file_sync_status_unknown ... [OK]
    test_status_changed_handler ... [OK]
    test_status_changed_handler_after_status_requested ... [OK]
    test_status_changed_handler_after_status_requested_twice ... [OK]
  OperationsAuthErrorTestCase
    test_account_info_returned ... [OK]
    test_change_device_settings ... [OK]
    test_change_replication_settings ... [OK]
    test_change_volume_settings ... [OK]
    test_connect_files ... [OK]
    test_devices_info_returned ... [OK]
    test_disable_files ... [OK]
    test_disconnect_files ... [OK]
    test_enable_files ... [OK]
    test_remove_device ... [OK]
    test_replications_info ... [OK]
    test_restart_files ... [...

Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (144.4 KiB)

The attempt to merge lp:~diegosarmentero/ubuntuone-control-panel/refactor-sync-status into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.

*** Running DBus test suite ***
ubuntuone.controlpanel.dbustests.test_dbus_service
  BaseTestCase
    runTest ... [OK]
  DBusServiceMainTestCase
    test_dbus_service_cant_register ... Control panel backend already running.
                                   [OK]
    test_dbus_service_main ... [OK]
  DBusServiceTestCase
    test_cant_register_twice ... [SKIPPED]
    test_dbus_busname_created ... [OK]
    test_error_handler_default ... [OK]
    test_error_handler_with_exception ... [OK]
    test_error_handler_with_failure ... [OK]
    test_error_handler_with_non_string_dict ... [OK]
    test_error_handler_with_string_dict ... [OK]
    test_register_service ... [OK]
  FileSyncTestCase
    test_file_sync_status_changed ... [OK]
    test_file_sync_status_disabled ... [OK]
    test_file_sync_status_disconnected ... [OK]
    test_file_sync_status_error ... [OK]
    test_file_sync_status_idle ... [OK]
    test_file_sync_status_starting ... [OK]
    test_file_sync_status_stopped ... [OK]
    test_file_sync_status_syncing ... [OK]
    test_file_sync_status_unknown ... [OK]
    test_status_changed_handler ... [OK]
    test_status_changed_handler_after_status_requested ... [OK]
    test_status_changed_handler_after_status_requested_twice ... [OK]
  OperationsAuthErrorTestCase
    test_account_info_returned ... [OK]
    test_change_device_settings ... [OK]
    test_change_replication_settings ... [OK]
    test_change_volume_settings ... [OK]
    test_connect_files ... [OK]
    test_devices_info_returned ... [OK]
    test_disable_files ... [OK]
    test_disconnect_files ... [OK]
    test_enable_files ... [OK]
    test_remove_device ... [OK]
    test_replications_info ... [OK]
    test_restart_files ... [...

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 2012-06-22 14:42:29 +0000
3+++ ubuntuone/controlpanel/backend.py 2012-08-08 18:47:18 +0000
4@@ -821,6 +821,13 @@
5 yield self.change_file_sync_settings(self.DEFAULT_FILE_SYNC_SETTINGS)
6
7 @log_call(logger.info)
8+ @inlineCallbacks
9+ def sync_menu(self):
10+ """Obtain the data to create the sync menu."""
11+ result = yield self.sd_client.sync_menu()
12+ returnValue(result)
13+
14+ @log_call(logger.info)
15 def shutdown(self):
16 """Stop this service."""
17 # do any other needed cleanup
18
19=== modified file 'ubuntuone/controlpanel/gui/__init__.py'
20--- ubuntuone/controlpanel/gui/__init__.py 2012-08-06 20:15:30 +0000
21+++ ubuntuone/controlpanel/gui/__init__.py 2012-08-08 18:47:18 +0000
22@@ -66,6 +66,7 @@
23 FILE_URI_PREFIX = u'file://'
24
25 CONTACTS_LINK = UBUNTUONE_LINK
26+DASHBOARD = UBUNTUONE_LINK + u'dashboard/'
27 EDIT_ACCOUNT_LINK = UBUNTUONE_LINK + u'account/'
28 EDIT_DEVICES_LINK = EDIT_ACCOUNT_LINK + u'machines/'
29 EDIT_PROFILE_LINK = u'https://login.ubuntu.com/'
30@@ -176,6 +177,8 @@
31 GET_HELP_ONLINE = _('Get help online')
32 GET_MORE_STORAGE = _('Get more storage')
33 GREETING = _('Hi %(user_display_name)s')
34+GO_TO_WEB = _('Go to the Website')
35+IN_PROGRESS = _('In Progress')
36 INSTALL = _('Install')
37 INSTALL_PACKAGE = _('You need to install the package <i>%(package_name)s'
38 '</i> in order to enable more sync services.')
39@@ -215,11 +218,14 @@
40 NO_DEVICES = _('No devices to show.')
41 NO_FOLDERS = _('No folders to show.')
42 NO_PAIRING_RECORD = _('There is no Ubuntu One pairing record.')
43+OPEN_UBUNTU_ONE = _('Open Ubuntu One')
44+OPEN_UBUNTU_ONE_FOLDER = _('Open the Ubuntu One Folder')
45 PERCENTAGE_LABEL = _('%(percentage)s used')
46 PLEASE_WAIT = _('Please wait')
47 PROFILE_LABEL = _('Personal details')
48 QUOTA_LABEL = _('Using %(used)s of %(total)s (%(percentage).0f%%)')
49 REMOVE_BUTTON = _('Remove')
50+RECENT_TRANSFERS = _('Recent Transfers')
51 RESTORE_LABEL = _('Restore')
52 SELECT_FOLDERS = _('Select sync folders')
53 SERVICES_BUTTON_TOOLTIP = _('Manage the sync services')
54@@ -239,12 +245,14 @@
55 'to this computer')
56 SETTINGS_SYNC_ALL_SHARES = _('Automatically sync all folders shared with me '
57 'to this computer')
58+SHARE_A_FILE = _('Share a File')
59 SHARES_BUTTON_TOOLTIP = _('Manage the shares offered to others')
60 SHARES_TITLE = _('Manage permissions for shares made to other users.')
61 SIGN_IN = _('Sign in')
62 SUCCESS_INSTALL = _('<i>%(package_name)s</i> was successfully installed')
63 SYNC_STREAM_SHARE = _('Sync, stream, share')
64 TALK_TO_US = _('Talk to us')
65+TRANSFERS = _('Current and Recent Transfers')
66 VALUE_ERROR = _('Value could not be retrieved.')
67 UNKNOWN_ERROR = _('Unknown error')
68 USAGE_LABEL = _('%(used)s of %(total)s')
69
70=== modified file 'ubuntuone/controlpanel/gui/qt/__init__.py'
71--- ubuntuone/controlpanel/gui/qt/__init__.py 2012-04-17 18:08:45 +0000
72+++ ubuntuone/controlpanel/gui/qt/__init__.py 2012-08-08 18:47:18 +0000
73@@ -24,13 +24,91 @@
74 from PyQt4 import QtGui, QtCore
75 from twisted.internet import defer
76
77+from ubuntuone.controlpanel import backend
78 from ubuntuone.controlpanel.gui import (
79+ ERROR_COLOR,
80+ FILE_SYNC_CONNECT,
81+ FILE_SYNC_CONNECT_TOOLTIP,
82+ FILE_SYNC_DISABLED,
83+ FILE_SYNC_DISCONNECT,
84+ FILE_SYNC_DISCONNECT_TOOLTIP,
85+ FILE_SYNC_DISCONNECTED,
86+ FILE_SYNC_ENABLE,
87+ FILE_SYNC_ENABLE_TOOLTIP,
88+ FILE_SYNC_ERROR,
89+ FILE_SYNC_IDLE,
90+ FILE_SYNC_RESTART,
91+ FILE_SYNC_RESTART_TOOLTIP,
92+ FILE_SYNC_START,
93+ FILE_SYNC_START_TOOLTIP,
94+ FILE_SYNC_STARTING,
95+ FILE_SYNC_STOP,
96+ FILE_SYNC_STOP_TOOLTIP,
97+ FILE_SYNC_STOPPED,
98+ FILE_SYNC_SYNCING,
99 FILE_URI_PREFIX,
100 GENERAL_ERROR_TITLE,
101 GENERAL_ERROR_MSG,
102 )
103
104
105+WARNING_MARKUP = '<font color="%s"><b>%%s</b></font>' % ERROR_COLOR
106+DISCONNECTED_ICON = 'sync_status_disconnected'
107+ERROR_ICON = 'sync_status_alert'
108+IDLE_ICON = 'sync_status_sync_done'
109+SYNCING_ICON = 'sync_status_syncing'
110+
111+
112+FILE_SYNC_STATUS = {
113+ backend.FILE_SYNC_DISABLED:
114+ {'msg': FILE_SYNC_DISABLED, 'action': FILE_SYNC_ENABLE,
115+ 'backend_method': 'enable_files',
116+ 'icon': ERROR_ICON,
117+ 'tooltip': FILE_SYNC_ENABLE_TOOLTIP},
118+ backend.FILE_SYNC_DISCONNECTED:
119+ {'msg': FILE_SYNC_DISCONNECTED, 'action': FILE_SYNC_CONNECT,
120+ 'backend_method': 'connect_files',
121+ 'icon': DISCONNECTED_ICON,
122+ 'tooltip': FILE_SYNC_CONNECT_TOOLTIP},
123+ backend.FILE_SYNC_ERROR:
124+ {'msg': WARNING_MARKUP % FILE_SYNC_ERROR, 'action': FILE_SYNC_RESTART,
125+ 'backend_method': 'restart_files',
126+ 'icon': ERROR_ICON,
127+ 'tooltip': FILE_SYNC_RESTART_TOOLTIP},
128+ backend.FILE_SYNC_IDLE:
129+ {'msg': FILE_SYNC_IDLE, 'action': FILE_SYNC_DISCONNECT,
130+ 'backend_method': 'disconnect_files',
131+ 'icon': IDLE_ICON,
132+ 'tooltip': FILE_SYNC_DISCONNECT_TOOLTIP},
133+ backend.FILE_SYNC_STARTING:
134+ {'msg': FILE_SYNC_STARTING, 'action': FILE_SYNC_STOP,
135+ 'backend_method': 'stop_files',
136+ 'icon': SYNCING_ICON,
137+ 'tooltip': FILE_SYNC_STOP_TOOLTIP},
138+ backend.FILE_SYNC_STOPPED:
139+ {'msg': FILE_SYNC_STOPPED, 'action': FILE_SYNC_START,
140+ 'backend_method': 'start_files',
141+ 'icon': ERROR_ICON,
142+ 'tooltip': FILE_SYNC_START_TOOLTIP},
143+ backend.FILE_SYNC_SYNCING:
144+ {'msg': FILE_SYNC_SYNCING, 'action': FILE_SYNC_DISCONNECT,
145+ 'backend_method': 'disconnect_files',
146+ 'icon': SYNCING_ICON,
147+ 'tooltip': FILE_SYNC_DISCONNECT_TOOLTIP},
148+ backend.FILE_SYNC_UNKNOWN:
149+ {'msg': WARNING_MARKUP % FILE_SYNC_ERROR, 'action': FILE_SYNC_RESTART,
150+ 'backend_method': 'restart_files',
151+ 'icon': ERROR_ICON,
152+ 'tooltip': FILE_SYNC_RESTART_TOOLTIP},
153+}
154+
155+
156+def icon_name_from_status(status_key):
157+ """Get the icon name for the status."""
158+ icon_name = FILE_SYNC_STATUS[status_key]['icon']
159+ return icon_name
160+
161+
162 def force_wordwrap(widget, size, text):
163 """Set the text to the widget after word wrapping it."""
164 font_metrics = QtGui.QFontMetrics(widget.font())
165
166=== modified file 'ubuntuone/controlpanel/gui/qt/filesyncstatus.py'
167--- ubuntuone/controlpanel/gui/qt/filesyncstatus.py 2012-05-10 21:01:30 +0000
168+++ ubuntuone/controlpanel/gui/qt/filesyncstatus.py 2012-08-08 18:47:18 +0000
169@@ -22,92 +22,19 @@
170 from ubuntuone.controlpanel import backend, cache
171 from ubuntuone.controlpanel.logger import setup_logging, log_call
172 from ubuntuone.controlpanel.gui import (
173- ERROR_COLOR,
174- FILE_SYNC_CONNECT,
175- FILE_SYNC_CONNECT_TOOLTIP,
176- FILE_SYNC_DISABLED,
177- FILE_SYNC_DISCONNECT,
178- FILE_SYNC_DISCONNECT_TOOLTIP,
179- FILE_SYNC_DISCONNECTED,
180- FILE_SYNC_ENABLE,
181- FILE_SYNC_ENABLE_TOOLTIP,
182- FILE_SYNC_ERROR,
183- FILE_SYNC_IDLE,
184- FILE_SYNC_RESTART,
185- FILE_SYNC_RESTART_TOOLTIP,
186- FILE_SYNC_START,
187- FILE_SYNC_START_TOOLTIP,
188- FILE_SYNC_STARTING,
189- FILE_SYNC_STOP,
190- FILE_SYNC_STOP_TOOLTIP,
191- FILE_SYNC_STOPPED,
192- FILE_SYNC_SYNCING,
193 LOADING,
194 PLEASE_WAIT,
195 )
196-from ubuntuone.controlpanel.gui.qt import pixmap_from_name
197+from ubuntuone.controlpanel.gui.qt import (
198+ FILE_SYNC_STATUS,
199+ pixmap_from_name,
200+)
201 from ubuntuone.controlpanel.gui.qt.ui import filesyncstatus_ui
202
203
204 logger = setup_logging('qt.filesyncstatus')
205
206
207-WARNING_MARKUP = '<font color="%s"><b>%%s</b></font>' % ERROR_COLOR
208-DISCONNECTED_ICON = 'sync_status_disconnected'
209-ERROR_ICON = 'sync_status_alert'
210-IDLE_ICON = 'sync_status_sync_done'
211-SYNCING_ICON = 'sync_status_syncing'
212-
213-FILE_SYNC_STATUS = {
214- backend.FILE_SYNC_DISABLED:
215- {'msg': FILE_SYNC_DISABLED, 'action': FILE_SYNC_ENABLE,
216- 'backend_method': 'enable_files',
217- 'icon': ERROR_ICON,
218- 'tooltip': FILE_SYNC_ENABLE_TOOLTIP},
219- backend.FILE_SYNC_DISCONNECTED:
220- {'msg': FILE_SYNC_DISCONNECTED, 'action': FILE_SYNC_CONNECT,
221- 'backend_method': 'connect_files',
222- 'icon': DISCONNECTED_ICON,
223- 'tooltip': FILE_SYNC_CONNECT_TOOLTIP},
224- backend.FILE_SYNC_ERROR:
225- {'msg': WARNING_MARKUP % FILE_SYNC_ERROR, 'action': FILE_SYNC_RESTART,
226- 'backend_method': 'restart_files',
227- 'icon': ERROR_ICON,
228- 'tooltip': FILE_SYNC_RESTART_TOOLTIP},
229- backend.FILE_SYNC_IDLE:
230- {'msg': FILE_SYNC_IDLE, 'action': FILE_SYNC_DISCONNECT,
231- 'backend_method': 'disconnect_files',
232- 'icon': IDLE_ICON,
233- 'tooltip': FILE_SYNC_DISCONNECT_TOOLTIP},
234- backend.FILE_SYNC_STARTING:
235- {'msg': FILE_SYNC_STARTING, 'action': FILE_SYNC_STOP,
236- 'backend_method': 'stop_files',
237- 'icon': SYNCING_ICON,
238- 'tooltip': FILE_SYNC_STOP_TOOLTIP},
239- backend.FILE_SYNC_STOPPED:
240- {'msg': FILE_SYNC_STOPPED, 'action': FILE_SYNC_START,
241- 'backend_method': 'start_files',
242- 'icon': ERROR_ICON,
243- 'tooltip': FILE_SYNC_START_TOOLTIP},
244- backend.FILE_SYNC_SYNCING:
245- {'msg': FILE_SYNC_SYNCING, 'action': FILE_SYNC_DISCONNECT,
246- 'backend_method': 'disconnect_files',
247- 'icon': SYNCING_ICON,
248- 'tooltip': FILE_SYNC_DISCONNECT_TOOLTIP},
249- backend.FILE_SYNC_UNKNOWN:
250- {'msg': WARNING_MARKUP % FILE_SYNC_ERROR, 'action': FILE_SYNC_RESTART,
251- 'backend_method': 'restart_files',
252- 'icon': ERROR_ICON,
253- 'tooltip': FILE_SYNC_RESTART_TOOLTIP},
254-}
255-
256-
257-def icon_name_from_status(status_key):
258- """Get the icon name for the status."""
259- icon_name = FILE_SYNC_STATUS[status_key]['icon']
260- return icon_name
261-
262-
263 class FileSyncStatus(cache.Cache, QtGui.QWidget):
264 """The FileSyncStatus widget"""
265
266
267=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py'
268--- ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py 2012-05-10 21:01:30 +0000
269+++ ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py 2012-08-08 18:47:18 +0000
270@@ -22,6 +22,7 @@
271 LOADING,
272 PLEASE_WAIT,
273 )
274+from ubuntuone.controlpanel.gui import qt
275 from ubuntuone.controlpanel.gui.qt import filesyncstatus as gui
276 from ubuntuone.controlpanel.gui.qt.tests import BaseTestCase
277
278@@ -64,7 +65,7 @@
279 self.assertEqual(expected_text, actual_text)
280
281 actual_icon = self.ui.ui.sync_status_icon.pixmap()
282- pixmap_name = gui.icon_name_from_status(status_bd)
283+ pixmap_name = qt.icon_name_from_status(status_bd)
284 expected_icon = gui.pixmap_from_name(pixmap_name)
285 self.assertEqualPixmaps(expected_icon, actual_icon)
286
287@@ -73,7 +74,7 @@
288 action)
289
290 is_default = self.ui.ui.sync_status_button.isDefault()
291- expected_default = (action == gui.FILE_SYNC_CONNECT)
292+ expected_default = (action == qt.FILE_SYNC_CONNECT)
293 self.assertEqual(expected_default, is_default)
294
295 self.ui.ui.sync_status_button.click()
296@@ -96,17 +97,17 @@
297 def test_process_info_invalid_status(self):
298 """File sync status invalid, ignore event."""
299 status = {backend.STATUS_KEY: backend.FILE_SYNC_STARTING,
300- backend.MSG_KEY: gui.FILE_SYNC_STARTING,
301+ backend.MSG_KEY: qt.FILE_SYNC_STARTING,
302 'icon': backend.FILE_SYNC_STARTING}
303 self.ui.process_info(status)
304 self.ui.process_info(3)
305
306 actual_icon = self.ui.ui.sync_status_icon.pixmap()
307- pixmap_name = gui.icon_name_from_status(backend.FILE_SYNC_STARTING)
308+ pixmap_name = qt.icon_name_from_status(backend.FILE_SYNC_STARTING)
309 expected_icon = gui.pixmap_from_name(pixmap_name)
310 self.assertEqualPixmaps(expected_icon, actual_icon)
311 actual_text = unicode(self.ui.ui.sync_status_label.text())
312- self.assertEqual(gui.FILE_SYNC_STARTING, actual_text)
313+ self.assertEqual(qt.FILE_SYNC_STARTING, actual_text)
314
315 def test_process_info_changed(self):
316 """Backend's file sync status changed callback is connected."""
317@@ -120,70 +121,70 @@
318 def test_process_info_disabled(self):
319 """File sync status disabled update the label."""
320 self.assert_status_correct(status_bd=backend.FILE_SYNC_DISABLED,
321- status_ui=gui.FILE_SYNC_DISABLED,
322- action=gui.FILE_SYNC_ENABLE,
323+ status_ui=qt.FILE_SYNC_DISABLED,
324+ action=qt.FILE_SYNC_ENABLE,
325 callback='enable_files',
326- tooltip=gui.FILE_SYNC_ENABLE_TOOLTIP)
327+ tooltip=qt.FILE_SYNC_ENABLE_TOOLTIP)
328
329 def test_process_info_disconnected(self):
330 """File sync status disconnected update the label."""
331 self.assert_status_correct(status_bd=backend.FILE_SYNC_DISCONNECTED,
332- status_ui=gui.FILE_SYNC_DISCONNECTED,
333- action=gui.FILE_SYNC_CONNECT,
334+ status_ui=qt.FILE_SYNC_DISCONNECTED,
335+ action=qt.FILE_SYNC_CONNECT,
336 callback='connect_files',
337- tooltip=gui.FILE_SYNC_CONNECT_TOOLTIP)
338+ tooltip=qt.FILE_SYNC_CONNECT_TOOLTIP)
339
340 def test_process_info_error(self):
341 """File sync status error update the label."""
342- msg = gui.WARNING_MARKUP % gui.FILE_SYNC_ERROR
343+ msg = qt.WARNING_MARKUP % qt.FILE_SYNC_ERROR
344 self.assert_status_correct(status_bd=backend.FILE_SYNC_ERROR,
345 status_ui=msg,
346 msg_bd='what an error!',
347- action=gui.FILE_SYNC_RESTART,
348+ action=qt.FILE_SYNC_RESTART,
349 callback='restart_files',
350- tooltip=gui.FILE_SYNC_RESTART_TOOLTIP)
351+ tooltip=qt.FILE_SYNC_RESTART_TOOLTIP)
352
353 def test_process_info_idle(self):
354 """File sync status idle update the label."""
355 self.assert_status_correct(status_bd=backend.FILE_SYNC_IDLE,
356- status_ui=gui.FILE_SYNC_IDLE,
357- action=gui.FILE_SYNC_DISCONNECT,
358+ status_ui=qt.FILE_SYNC_IDLE,
359+ action=qt.FILE_SYNC_DISCONNECT,
360 callback='disconnect_files',
361- tooltip=gui.FILE_SYNC_DISCONNECT_TOOLTIP)
362+ tooltip=qt.FILE_SYNC_DISCONNECT_TOOLTIP)
363
364 def test_process_info_starting(self):
365 """File sync status starting update the label."""
366 self.assert_status_correct(status_bd=backend.FILE_SYNC_STARTING,
367- status_ui=gui.FILE_SYNC_STARTING,
368- action=gui.FILE_SYNC_STOP,
369+ status_ui=qt.FILE_SYNC_STARTING,
370+ action=qt.FILE_SYNC_STOP,
371 callback='stop_files',
372- tooltip=gui.FILE_SYNC_STOP_TOOLTIP)
373+ tooltip=qt.FILE_SYNC_STOP_TOOLTIP)
374
375 def test_process_info_stopped(self):
376 """File sync status stopped update the label."""
377 self.assert_status_correct(status_bd=backend.FILE_SYNC_STOPPED,
378- status_ui=gui.FILE_SYNC_STOPPED,
379- action=gui.FILE_SYNC_START,
380+ status_ui=qt.FILE_SYNC_STOPPED,
381+ action=qt.FILE_SYNC_START,
382 callback='start_files',
383- tooltip=gui.FILE_SYNC_START_TOOLTIP)
384+ tooltip=qt.FILE_SYNC_START_TOOLTIP)
385
386 def test_process_info_syncing(self):
387 """File sync status syncing update the label."""
388 self.assert_status_correct(status_bd=backend.FILE_SYNC_SYNCING,
389- status_ui=gui.FILE_SYNC_SYNCING,
390- action=gui.FILE_SYNC_DISCONNECT,
391+ status_ui=qt.FILE_SYNC_SYNCING,
392+ action=qt.FILE_SYNC_DISCONNECT,
393 callback='disconnect_files',
394- tooltip=gui.FILE_SYNC_DISCONNECT_TOOLTIP)
395+ tooltip=qt.FILE_SYNC_DISCONNECT_TOOLTIP)
396
397 def test_process_info_unknown(self):
398 """File sync status unknown update the label."""
399- msg = gui.WARNING_MARKUP % gui.FILE_SYNC_ERROR
400+ msg = qt.WARNING_MARKUP % qt.FILE_SYNC_ERROR
401 self.assert_status_correct(status_bd=backend.FILE_SYNC_UNKNOWN,
402 status_ui=msg,
403 msg_bd='yadda oops',
404- action=gui.FILE_SYNC_RESTART,
405+ action=qt.FILE_SYNC_RESTART,
406 callback='restart_files',
407- tooltip=gui.FILE_SYNC_RESTART_TOOLTIP)
408+ tooltip=qt.FILE_SYNC_RESTART_TOOLTIP)
409
410 def test_on_sync_status_button_clicked(self):
411 """Check the labels and icon when the button is pressed."""
412
413=== modified file 'ubuntuone/controlpanel/sd_client/__init__.py'
414--- ubuntuone/controlpanel/sd_client/__init__.py 2012-03-29 21:37:22 +0000
415+++ ubuntuone/controlpanel/sd_client/__init__.py 2012-08-08 18:47:18 +0000
416@@ -205,3 +205,7 @@
417 def refresh_volumes(self):
418 """Refresh the volumes information from syncdaemon."""
419 return self.proxy.refresh_volumes()
420+
421+ def sync_menu(self):
422+ """Get the sync menu data from syncdaemon."""
423+ return self.proxy.sync_menu()
424
425=== modified file 'ubuntuone/controlpanel/tests/test_backend.py'
426--- ubuntuone/controlpanel/tests/test_backend.py 2012-05-11 13:30:34 +0000
427+++ ubuntuone/controlpanel/tests/test_backend.py 2012-08-08 18:47:18 +0000
428@@ -167,6 +167,7 @@
429 self.shares = []
430 self.folders = []
431 self.volumes_refreshed = False
432+ self.menu_data = {'recent-transfers': (), 'uploading': ()}
433
434 def get_throttling_limits(self):
435 """Return the sample speed limits."""
436@@ -326,6 +327,10 @@
437 self.volumes_refreshed = True
438 return defer.succeed(None)
439
440+ def sync_menu(self):
441+ """Return the sync menu data."""
442+ return self.menu_data
443+
444
445 class MockReplicationClient(CallRecorder):
446 """A mock replication_client module."""
447@@ -1697,3 +1702,10 @@
448
449 result = yield self.be.file_sync_settings_info()
450 self.assertEqual(self.default_settings, result)
451+
452+ @inlineCallbacks
453+ def test_sync_menu(self):
454+ """Check that we get the right data to create the menu."""
455+ result = yield self.be.sync_menu()
456+ expected = {'recent-transfers': (), 'uploading': ()}
457+ self.assertEqual(result, expected)

Subscribers

People subscribed via source and target branches