Ubuntu One Control Panel

Merge lp:~dobey/ubuntuone-control-panel/sru-backports into lp:ubuntuone-control-panel/stable-3-0

Proposed by Rodney Dawes on 2012-05-18
Status: Merged
Approved by: Rodney Dawes on 2012-05-18
Approved revision: 266
Merged at revision: 262
Proposed branch: lp:~dobey/ubuntuone-control-panel/sru-backports
Merge into: lp:ubuntuone-control-panel/stable-3-0
Diff against target: 322 lines (+122/-12) 13 files modified
To merge this branch: bzr merge lp:~dobey/ubuntuone-control-panel/sru-backports
Reviewer Review Type Date Requested Status
Roberto Alsina 2012-05-18 Approve on 2012-05-18
Review via email: mp+106431@code.launchpad.net

Commit Message

[Roberto Alsina]

    - Unstyled the spinboxes (Partially fixes LP:966283).
    - Reverse styling for web buttons in RTL locales (Fixes LP:983665).
    - Restore minimized windows from the tray (Fixes LP:865688).
    - Made CalculateSize use bytes when calling os.walk (Fixes LP:959447).

[Diego Sarmentero]

    - Checking that we are receiving the right argument type, or ignore it if it's not valid (LP: #995146).

To post a comment you must log in.
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~dobey/ubuntuone-control-panel/sru-backports into lp:ubuntuone-control-panel/stable-3-0 failed. Below is the output from the failed tests.

*** Running test suite for ubuntuone/controlpanel ***

Traceback (most recent call last):
  File "/usr/bin/u1trial", line 337, in <module>
    main()
  File "/usr/bin/u1trial", line 317, in main
    suite = trial_runner.get_suite(config)
  File "/usr/bin/u1trial", line 196, in get_suite
    config['ignore-paths']))
  File "/usr/bin/u1trial", line 180, in _collect_tests
    module_suite = self._load_unittest(filepath)
  File "/usr/bin/u1trial", line 120, in _load_unittest
    module = __import__(modpath, None, None, [""])
  File "/mnt/tarmac/cache/ubuntuone-control-panel/stable-3-0/ubuntuone/controlpanel/tests/test_web_client.py", line 24, in <module>
    from ubuntu_sso.utils.webclient.tests import BaseMockWebServer
ImportError: cannot import name BaseMockWebServer

Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~dobey/ubuntuone-control-panel/sru-backports into lp:ubuntuone-control-panel/stable-3-0 failed. Below is the output from the failed tests.

*** Running test suite for ubuntuone/controlpanel ***

Traceback (most recent call last):
  File "/usr/bin/u1trial", line 337, in <module>
    main()
  File "/usr/bin/u1trial", line 317, in main
    suite = trial_runner.get_suite(config)
  File "/usr/bin/u1trial", line 196, in get_suite
    config['ignore-paths']))
  File "/usr/bin/u1trial", line 180, in _collect_tests
    module_suite = self._load_unittest(filepath)
  File "/usr/bin/u1trial", line 120, in _load_unittest
    module = __import__(modpath, None, None, [""])
  File "/mnt/tarmac/cache/ubuntuone-control-panel/stable-3-0/ubuntuone/controlpanel/tests/__init__.py", line 28, in <module>
    from ubuntuone.controlpanel.backend import (
  File "/mnt/tarmac/cache/ubuntuone-control-panel/stable-3-0/ubuntuone/controlpanel/backend.py", line 27, in <module>
    from ubuntuone.platform.credentials import CredentialsManagementTool
ImportError: No module named platform.credentials

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

The attempt to merge lp:~dobey/ubuntuone-control-panel/sru-backports into lp:ubuntuone-control-panel/stable-3-0 failed. Below is the output from the failed tests.

*** Running test suite for ubuntuone/controlpanel ***
ubuntuone.controlpanel.tests.test_replication_client
  ReplicationsTestCase
    test_exclude ... [OK]
    test_exclude_name_in_exclusions ... [OK]
    test_exclude_name_not_in_replications ... [OK]
    test_get_exclusions ... [OK]
    test_get_replications ... [OK]
    test_no_pairing_record ... [OK]
    test_replicate ... [OK]
    test_replicate_name_not_in_exclusions ... [OK]
    test_replicate_name_not_in_replications ... [OK]
ubuntuone.controlpanel.tests
  TestCase
    runTest ... [OK]
ubuntuone.controlpanel.tests.test_sd_client
  AutoconnectTestCase
    test_disable ... [OK]
    test_disable_throws_an_error ... [OK]
    test_enable ... [OK]
    test_enable_throws_an_error ... [OK]
    test_get_value ... [OK]
    test_get_value_throws_an_error ... [OK]
  BaseTestCase
    runTest ... [OK]
  BasicTestCase
    test_get_current_status ... [OK]
    test_get_current_status_error ... [OK]
    test_get_root_dir ... [OK]
    test_get_shares_dir ... [OK]
    test_get_shares_dir_link ... [OK]
  FileSyncTestCase
    test_connect_file_sync ... [OK]
    test_disable_file_sync ... [OK]
    test_disconnect_file_sync ... [OK]
    test_enable_file_sync ... [OK]
    test_file_sync_enabled ... [OK]
    test_set_status_changed_handler ... [OK]
    test_start_file_sync ... [OK]
    test_stop_file_sync ... [OK]
  FoldersTestCase
    test_create_folder ... [OK]
    test_create_folder_error ... [OK]
    test_get_folders ... [OK]
    test_get_folders_error ... [OK]
    test_sub...

Preview Diff

1=== added file 'data/external_icon_dark_grey-rtl.png'
2Binary files data/external_icon_dark_grey-rtl.png 1970-01-01 00:00:00 +0000 and data/external_icon_dark_grey-rtl.png 2012-05-18 17:20:24 +0000 differ
3=== added file 'data/external_icon_orange-rtl.png'
4Binary files data/external_icon_orange-rtl.png 1970-01-01 00:00:00 +0000 and data/external_icon_orange-rtl.png 2012-05-18 17:20:24 +0000 differ
5=== added file 'data/external_icon_white-rtl.png'
6Binary files data/external_icon_white-rtl.png 1970-01-01 00:00:00 +0000 and data/external_icon_white-rtl.png 2012-05-18 17:20:24 +0000 differ
7=== modified file 'data/qt/images.qrc'
8--- data/qt/images.qrc 2012-03-22 16:44:35 +0000
9+++ data/qt/images.qrc 2012-05-18 17:20:24 +0000
10@@ -5,6 +5,9 @@
11 <file>../external_icon_dark_grey.png</file>
12 <file>../external_icon_orange.png</file>
13 <file>../external_icon_white.png</file>
14+ <file>../external_icon_dark_grey-rtl.png</file>
15+ <file>../external_icon_orange-rtl.png</file>
16+ <file>../external_icon_white-rtl.png</file>
17 <file>../icon.png</file>
18 <file>../folder.png</file>
19 <file>../logo.png</file>
20@@ -24,6 +27,7 @@
21 <file>../Ubuntu-R.ttf</file>
22 <file>../Ubuntu-B.ttf</file>
23 <file>ubuntuone.qss</file>
24+ <file>ubuntuone-rtl.qss</file>
25 <file>linux.qss</file>
26 <file>windows.qss</file>
27 </qresource>
28
29=== added file 'data/qt/ubuntuone-rtl.qss'
30--- data/qt/ubuntuone-rtl.qss 1970-01-01 00:00:00 +0000
31+++ data/qt/ubuntuone-rtl.qss 2012-05-18 17:20:24 +0000
32@@ -0,0 +1,27 @@
33+GoToWebButton#help_button {
34+ background-image: url(:/external_icon_dark_grey-rtl.png);
35+ background-position: left;
36+}
37+
38+GoToWebButton#share_publish_button {
39+ background-image: url(:/external_icon_orange-rtl.png);
40+ background-position: left;
41+}
42+
43+GoToWebButton#edit_profile_button,
44+GoToWebButton#edit_services_button,
45+GoToWebButton#get_more_space_button {
46+ background-image: url(:/external_icon_white-rtl.png);
47+ background-position: left;
48+}
49+
50+QTabWidget::pane {
51+ border-top-left-radius: 5px;
52+ border-top-right-radius: 0px;
53+}
54+
55+QFrame#frame_status,
56+QFrame#frame_storage {
57+ border-right-width: 1px;
58+ border-left-width: 0px;
59+}
60
61=== modified file 'data/qt/ubuntuone.qss'
62--- data/qt/ubuntuone.qss 2012-03-27 14:32:09 +0000
63+++ data/qt/ubuntuone.qss 2012-05-18 17:20:24 +0000
64@@ -338,13 +338,6 @@
65 background-color: white;
66 }
67
68-QSpinBox:focus {
69- border: 2px solid #dd4814;
70- border-radius: 5px;
71- padding: 0px;
72-}
73-
74-
75 QTreeWidget::item:selected {
76 background: #fcece7;
77 color: black;
78
79=== modified file 'ubuntuone/controlpanel/backend.py'
80--- ubuntuone/controlpanel/backend.py 2012-03-29 21:41:54 +0000
81+++ ubuntuone/controlpanel/backend.py 2012-05-18 17:20:24 +0000
82@@ -16,6 +16,7 @@
83
84 """A backend for the Ubuntu One Control Panel."""
85
86+import collections
87 import operator
88 import os
89
90@@ -152,9 +153,13 @@
91 FILE_SYNC_UNKNOWN
92 * MSG_KEY: a non translatable but human readable string of the status.
93
94+ Return None if we receive and invalid type in status.
95+
96 """
97 logger.debug('sync status: %r', status)
98- if not status:
99+ if not isinstance(status, collections.Mapping):
100+ return None
101+ elif not status:
102 self.file_sync_disabled = True
103 return self.STATUS_DISABLED
104
105
106=== modified file 'ubuntuone/controlpanel/gui/qt/filesyncstatus.py'
107--- ubuntuone/controlpanel/gui/qt/filesyncstatus.py 2012-03-02 13:53:24 +0000
108+++ ubuntuone/controlpanel/gui/qt/filesyncstatus.py 2012-05-18 17:20:24 +0000
109@@ -139,6 +139,8 @@
110 @log_call(logger.debug)
111 def process_info(self, status):
112 """Match status with signals."""
113+ if status is None:
114+ return
115 try:
116 status_key = status[backend.STATUS_KEY]
117 data = FILE_SYNC_STATUS[status_key]
118
119=== modified file 'ubuntuone/controlpanel/gui/qt/folders.py'
120--- ubuntuone/controlpanel/gui/qt/folders.py 2012-04-02 17:41:54 +0000
121+++ ubuntuone/controlpanel/gui/qt/folders.py 2012-05-18 17:20:24 +0000
122@@ -20,6 +20,7 @@
123
124 import os
125 import Queue
126+import sys
127 import threading
128
129 from PyQt4 import QtGui, QtCore
130@@ -347,9 +348,17 @@
131 """A thread that calculates, in the background, the size of a folder."""
132
133 def __init__(self, path_name, queue):
134- self.path_name = path_name
135 self.queue = queue
136 self._stop = False
137+ # This makes os.walk use the "bytes" version, which doesn't
138+ # break with invalid unicode paths.
139+ # This will only work for unicode locales (ex: LANG=es_ES.UTF-8)
140+ # and will falback to as before for C and non-unicode locales.
141+ try:
142+ self.path_name = path_name.encode(sys.getfilesystemencoding())
143+ except (UnicodeEncodeError, UnicodeDecodeError):
144+ # Should never happen (haha)
145+ self.path_name = path_name
146
147 super(CalculateSize, self).__init__()
148
149
150=== modified file 'ubuntuone/controlpanel/gui/qt/main/__init__.py'
151--- ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-04-25 14:31:36 +0000
152+++ ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-05-18 17:20:24 +0000
153@@ -89,7 +89,10 @@
154 source.main(app)
155
156 data = []
157- for qss_name in (":/ubuntuone.qss", source.PLATFORM_QSS):
158+ qss_files = [":/ubuntuone.qss", source.PLATFORM_QSS]
159+ if app.isRightToLeft():
160+ qss_files.append(":/ubuntuone-rtl.qss")
161+ for qss_name in qss_files:
162 qss = QtCore.QResource(qss_name)
163 data.append(unicode(qss.data()))
164 app.setStyleSheet('\n'.join(data))
165
166=== modified file 'ubuntuone/controlpanel/gui/qt/main/tests/test_main.py'
167--- ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-04-25 14:31:36 +0000
168+++ ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-05-18 17:20:24 +0000
169@@ -62,6 +62,10 @@
170 def installTranslator(self, translator):
171 """Fake installTranslator."""
172 self.translator = translator
173+
174+ def isRightToLeft(self):
175+ """Fake isRightToLeft."""
176+ return False
177 # pylint: enable=C0103
178
179 def arguments(self):
180
181=== modified file 'ubuntuone/controlpanel/gui/qt/systray.py'
182--- ubuntuone/controlpanel/gui/qt/systray.py 2012-03-02 13:53:24 +0000
183+++ ubuntuone/controlpanel/gui/qt/systray.py 2012-05-18 17:20:24 +0000
184@@ -60,6 +60,7 @@
185 # pylint: enable=W0404
186 self.window = MainWindow(close_callback=self.delete_window)
187 self.window.show()
188+ self.window.activateWindow()
189
190 def delete_window(self):
191 """Close and remove the main window."""
192
193=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py'
194--- ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py 2012-03-12 16:36:06 +0000
195+++ ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py 2012-05-18 17:20:24 +0000
196@@ -93,6 +93,21 @@
197 self.assertIsInstance(self.ui.backend,
198 backend.ControlBackend)
199
200+ def test_process_info_invalid_status(self):
201+ """File sync status invalid, ignore event."""
202+ status = {backend.STATUS_KEY: backend.FILE_SYNC_STARTING,
203+ backend.MSG_KEY: gui.FILE_SYNC_STARTING,
204+ 'icon': backend.FILE_SYNC_STARTING}
205+ self.ui.process_info(status)
206+ self.ui.process_info(3)
207+
208+ actual_icon = self.ui.ui.sync_status_icon.pixmap()
209+ pixmap_name = gui.icon_name_from_status(backend.FILE_SYNC_STARTING)
210+ expected_icon = gui.pixmap_from_name(pixmap_name)
211+ self.assertEqualPixmaps(expected_icon, actual_icon)
212+ actual_text = unicode(self.ui.ui.sync_status_label.text())
213+ self.assertEqual(gui.FILE_SYNC_STARTING, actual_text)
214+
215 def test_process_info_changed(self):
216 """Backend's file sync status changed callback is connected."""
217 self.assertEqual(self.ui.backend.status_changed_handler,
218
219=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_folders.py'
220--- ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-29 17:35:30 +0000
221+++ ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-05-18 17:20:24 +0000
222@@ -22,6 +22,7 @@
223 import os
224 import Queue
225 import shutil
226+import sys
227
228 from PyQt4 import QtGui
229 from twisted.internet import defer
230@@ -675,7 +676,7 @@
231
232 @defer.inlineCallbacks
233 def setUp(self):
234- self.path = 'not-existing-dir'
235+ self.path = u'not-existing-dir'
236 self.expected_size = self.build_test_dir(self.path)
237 self.queue = Queue.Queue()
238 yield super(BaseLocalFoldersTestCase, self).setUp()
239@@ -685,7 +686,8 @@
240 assert not os.path.exists(dir_path)
241
242 os.makedirs(dir_path)
243- self.addCleanup(shutil.rmtree, dir_path)
244+ self.addCleanup(shutil.rmtree,
245+ dir_path.encode(sys.getfilesystemencoding()))
246
247 total_size = 0
248
249@@ -775,6 +777,31 @@
250 self.started = True
251
252
253+class CalculateSizeWithInvalidPath(CalculateSizeTestCase):
254+ """Test suite for the CalculateSize thread implementation."""
255+
256+ def build_test_dir(self, dir_path):
257+ """Build a testing directory hierarchy."""
258+ total_size = super(CalculateSizeWithInvalidPath,
259+ self).build_test_dir(dir_path)
260+ # Have to crete as bytes because it's an invalid path
261+ a_file = os.path.join(dir_path.encode(sys.getfilesystemencoding()),
262+ '\xe7\xa7')
263+ with open(a_file, 'wb') as f:
264+ f.write('y' * 5000)
265+ total_size += os.path.getsize(a_file)
266+ return total_size
267+
268+ def test_run(self):
269+ """The run() method calculates the size for the given path."""
270+ self.ui.run()
271+
272+ path, size = self.queue.get(block=True, timeout=0.5)
273+
274+ self.assertEqual(path, self.path)
275+ self.assertEqual(size, self.expected_size)
276+
277+
278 class FolderItemTestCase(BaseLocalFoldersTestCase):
279 """Test suite for the FolderItem widget."""
280
281
282=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_systray.py'
283--- ubuntuone/controlpanel/gui/qt/tests/test_systray.py 2012-02-06 21:10:10 +0000
284+++ ubuntuone/controlpanel/gui/qt/tests/test_systray.py 2012-05-18 17:20:24 +0000
285@@ -100,6 +100,18 @@
286 self.assertEqual(tray.window, window)
287 self.assertTrue(tray.window.isVisible())
288
289+ def test_restore_window_minimized(self):
290+ """Test the restore window option in the menu, with a min. window."""
291+ tray = systray.TrayIcon()
292+ window = FakeMainWindow()
293+ # This cannot be tested with the real activateWindow
294+ # because the un-minimization is done by the WM, so
295+ # it has a small delay, and it fails.
296+ self.patch(window, "activateWindow", self._set_called)
297+ tray.window = window
298+ tray.restore.trigger()
299+ self.assertEqual(self._called, ((), {}))
300+
301 def test_delete_window(self):
302 """Test deleting an existing window."""
303 tray = systray.TrayIcon()
304
305=== modified file 'ubuntuone/controlpanel/tests/test_backend.py'
306--- ubuntuone/controlpanel/tests/test_backend.py 2012-03-29 21:37:22 +0000
307+++ ubuntuone/controlpanel/tests/test_backend.py 2012-05-18 17:20:24 +0000
308@@ -1370,6 +1370,14 @@
309 expected_status = self.be._process_file_sync_status(status)
310 self.assertEqual(self._called, ((expected_status,), {}))
311
312+ def test_invalid_status_type(self):
313+ """Check that the method return None with invalid types."""
314+ self.be.status_changed_handler = self._set_called
315+ status = 3
316+ self.be.sd_client.status_changed_handler(status)
317+
318+ self.assertEqual(self._called, ((None,), {}))
319+
320
321 class BackendSyncStatusIfDisabledTestCase(BackendSyncStatusTestCase):
322 """Syncdaemon state for the backend when file sync is disabled."""

Subscribers

People subscribed via source and target branches