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

Proposed by dobey
Status: Merged
Approved by: dobey
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
data/qt/images.qrc (+4/-0)
data/qt/ubuntuone-rtl.qss (+27/-0)
data/qt/ubuntuone.qss (+0/-7)
ubuntuone/controlpanel/backend.py (+6/-1)
ubuntuone/controlpanel/gui/qt/filesyncstatus.py (+2/-0)
ubuntuone/controlpanel/gui/qt/folders.py (+10/-1)
ubuntuone/controlpanel/gui/qt/main/__init__.py (+4/-1)
ubuntuone/controlpanel/gui/qt/main/tests/test_main.py (+4/-0)
ubuntuone/controlpanel/gui/qt/systray.py (+1/-0)
ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py (+15/-0)
ubuntuone/controlpanel/gui/qt/tests/test_folders.py (+29/-2)
ubuntuone/controlpanel/gui/qt/tests/test_systray.py (+12/-0)
ubuntuone/controlpanel/tests/test_backend.py (+8/-0)
To merge this branch: bzr merge lp:~dobey/ubuntuone-control-panel/sru-backports
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
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.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Revision history for this message
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

Revision history for this message
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

Revision history for this message
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'data/external_icon_dark_grey-rtl.png'
0Binary 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 differ0Binary 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
=== added file 'data/external_icon_orange-rtl.png'
1Binary 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 differ1Binary 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
=== added file 'data/external_icon_white-rtl.png'
2Binary 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 differ2Binary 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
=== modified file 'data/qt/images.qrc'
--- data/qt/images.qrc 2012-03-22 16:44:35 +0000
+++ data/qt/images.qrc 2012-05-18 17:20:24 +0000
@@ -5,6 +5,9 @@
5 <file>../external_icon_dark_grey.png</file>5 <file>../external_icon_dark_grey.png</file>
6 <file>../external_icon_orange.png</file>6 <file>../external_icon_orange.png</file>
7 <file>../external_icon_white.png</file>7 <file>../external_icon_white.png</file>
8 <file>../external_icon_dark_grey-rtl.png</file>
9 <file>../external_icon_orange-rtl.png</file>
10 <file>../external_icon_white-rtl.png</file>
8 <file>../icon.png</file>11 <file>../icon.png</file>
9 <file>../folder.png</file>12 <file>../folder.png</file>
10 <file>../logo.png</file>13 <file>../logo.png</file>
@@ -24,6 +27,7 @@
24 <file>../Ubuntu-R.ttf</file>27 <file>../Ubuntu-R.ttf</file>
25 <file>../Ubuntu-B.ttf</file>28 <file>../Ubuntu-B.ttf</file>
26 <file>ubuntuone.qss</file>29 <file>ubuntuone.qss</file>
30 <file>ubuntuone-rtl.qss</file>
27 <file>linux.qss</file>31 <file>linux.qss</file>
28 <file>windows.qss</file>32 <file>windows.qss</file>
29 </qresource>33 </qresource>
3034
=== added file 'data/qt/ubuntuone-rtl.qss'
--- data/qt/ubuntuone-rtl.qss 1970-01-01 00:00:00 +0000
+++ data/qt/ubuntuone-rtl.qss 2012-05-18 17:20:24 +0000
@@ -0,0 +1,27 @@
1GoToWebButton#help_button {
2 background-image: url(:/external_icon_dark_grey-rtl.png);
3 background-position: left;
4}
5
6GoToWebButton#share_publish_button {
7 background-image: url(:/external_icon_orange-rtl.png);
8 background-position: left;
9}
10
11GoToWebButton#edit_profile_button,
12GoToWebButton#edit_services_button,
13GoToWebButton#get_more_space_button {
14 background-image: url(:/external_icon_white-rtl.png);
15 background-position: left;
16}
17
18QTabWidget::pane {
19 border-top-left-radius: 5px;
20 border-top-right-radius: 0px;
21}
22
23QFrame#frame_status,
24QFrame#frame_storage {
25 border-right-width: 1px;
26 border-left-width: 0px;
27}
028
=== modified file 'data/qt/ubuntuone.qss'
--- data/qt/ubuntuone.qss 2012-03-27 14:32:09 +0000
+++ data/qt/ubuntuone.qss 2012-05-18 17:20:24 +0000
@@ -338,13 +338,6 @@
338 background-color: white;338 background-color: white;
339}339}
340340
341QSpinBox:focus {
342 border: 2px solid #dd4814;
343 border-radius: 5px;
344 padding: 0px;
345}
346
347
348QTreeWidget::item:selected {341QTreeWidget::item:selected {
349 background: #fcece7;342 background: #fcece7;
350 color: black;343 color: black;
351344
=== modified file 'ubuntuone/controlpanel/backend.py'
--- ubuntuone/controlpanel/backend.py 2012-03-29 21:41:54 +0000
+++ ubuntuone/controlpanel/backend.py 2012-05-18 17:20:24 +0000
@@ -16,6 +16,7 @@
1616
17"""A backend for the Ubuntu One Control Panel."""17"""A backend for the Ubuntu One Control Panel."""
1818
19import collections
19import operator20import operator
20import os21import os
2122
@@ -152,9 +153,13 @@
152 FILE_SYNC_UNKNOWN153 FILE_SYNC_UNKNOWN
153 * MSG_KEY: a non translatable but human readable string of the status.154 * MSG_KEY: a non translatable but human readable string of the status.
154155
156 Return None if we receive and invalid type in status.
157
155 """158 """
156 logger.debug('sync status: %r', status)159 logger.debug('sync status: %r', status)
157 if not status:160 if not isinstance(status, collections.Mapping):
161 return None
162 elif not status:
158 self.file_sync_disabled = True163 self.file_sync_disabled = True
159 return self.STATUS_DISABLED164 return self.STATUS_DISABLED
160165
161166
=== modified file 'ubuntuone/controlpanel/gui/qt/filesyncstatus.py'
--- ubuntuone/controlpanel/gui/qt/filesyncstatus.py 2012-03-02 13:53:24 +0000
+++ ubuntuone/controlpanel/gui/qt/filesyncstatus.py 2012-05-18 17:20:24 +0000
@@ -139,6 +139,8 @@
139 @log_call(logger.debug)139 @log_call(logger.debug)
140 def process_info(self, status):140 def process_info(self, status):
141 """Match status with signals."""141 """Match status with signals."""
142 if status is None:
143 return
142 try:144 try:
143 status_key = status[backend.STATUS_KEY]145 status_key = status[backend.STATUS_KEY]
144 data = FILE_SYNC_STATUS[status_key]146 data = FILE_SYNC_STATUS[status_key]
145147
=== modified file 'ubuntuone/controlpanel/gui/qt/folders.py'
--- ubuntuone/controlpanel/gui/qt/folders.py 2012-04-02 17:41:54 +0000
+++ ubuntuone/controlpanel/gui/qt/folders.py 2012-05-18 17:20:24 +0000
@@ -20,6 +20,7 @@
2020
21import os21import os
22import Queue22import Queue
23import sys
23import threading24import threading
2425
25from PyQt4 import QtGui, QtCore26from PyQt4 import QtGui, QtCore
@@ -347,9 +348,17 @@
347 """A thread that calculates, in the background, the size of a folder."""348 """A thread that calculates, in the background, the size of a folder."""
348349
349 def __init__(self, path_name, queue):350 def __init__(self, path_name, queue):
350 self.path_name = path_name
351 self.queue = queue351 self.queue = queue
352 self._stop = False352 self._stop = False
353 # This makes os.walk use the "bytes" version, which doesn't
354 # break with invalid unicode paths.
355 # This will only work for unicode locales (ex: LANG=es_ES.UTF-8)
356 # and will falback to as before for C and non-unicode locales.
357 try:
358 self.path_name = path_name.encode(sys.getfilesystemencoding())
359 except (UnicodeEncodeError, UnicodeDecodeError):
360 # Should never happen (haha)
361 self.path_name = path_name
353362
354 super(CalculateSize, self).__init__()363 super(CalculateSize, self).__init__()
355364
356365
=== modified file 'ubuntuone/controlpanel/gui/qt/main/__init__.py'
--- ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-04-25 14:31:36 +0000
+++ ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-05-18 17:20:24 +0000
@@ -89,7 +89,10 @@
89 source.main(app)89 source.main(app)
9090
91 data = []91 data = []
92 for qss_name in (":/ubuntuone.qss", source.PLATFORM_QSS):92 qss_files = [":/ubuntuone.qss", source.PLATFORM_QSS]
93 if app.isRightToLeft():
94 qss_files.append(":/ubuntuone-rtl.qss")
95 for qss_name in qss_files:
93 qss = QtCore.QResource(qss_name)96 qss = QtCore.QResource(qss_name)
94 data.append(unicode(qss.data()))97 data.append(unicode(qss.data()))
95 app.setStyleSheet('\n'.join(data))98 app.setStyleSheet('\n'.join(data))
9699
=== modified file 'ubuntuone/controlpanel/gui/qt/main/tests/test_main.py'
--- ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-04-25 14:31:36 +0000
+++ ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-05-18 17:20:24 +0000
@@ -62,6 +62,10 @@
62 def installTranslator(self, translator):62 def installTranslator(self, translator):
63 """Fake installTranslator."""63 """Fake installTranslator."""
64 self.translator = translator64 self.translator = translator
65
66 def isRightToLeft(self):
67 """Fake isRightToLeft."""
68 return False
65 # pylint: enable=C010369 # pylint: enable=C0103
6670
67 def arguments(self):71 def arguments(self):
6872
=== modified file 'ubuntuone/controlpanel/gui/qt/systray.py'
--- ubuntuone/controlpanel/gui/qt/systray.py 2012-03-02 13:53:24 +0000
+++ ubuntuone/controlpanel/gui/qt/systray.py 2012-05-18 17:20:24 +0000
@@ -60,6 +60,7 @@
60 # pylint: enable=W040460 # pylint: enable=W0404
61 self.window = MainWindow(close_callback=self.delete_window)61 self.window = MainWindow(close_callback=self.delete_window)
62 self.window.show()62 self.window.show()
63 self.window.activateWindow()
6364
64 def delete_window(self):65 def delete_window(self):
65 """Close and remove the main window."""66 """Close and remove the main window."""
6667
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py 2012-03-12 16:36:06 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py 2012-05-18 17:20:24 +0000
@@ -93,6 +93,21 @@
93 self.assertIsInstance(self.ui.backend,93 self.assertIsInstance(self.ui.backend,
94 backend.ControlBackend)94 backend.ControlBackend)
9595
96 def test_process_info_invalid_status(self):
97 """File sync status invalid, ignore event."""
98 status = {backend.STATUS_KEY: backend.FILE_SYNC_STARTING,
99 backend.MSG_KEY: gui.FILE_SYNC_STARTING,
100 'icon': backend.FILE_SYNC_STARTING}
101 self.ui.process_info(status)
102 self.ui.process_info(3)
103
104 actual_icon = self.ui.ui.sync_status_icon.pixmap()
105 pixmap_name = gui.icon_name_from_status(backend.FILE_SYNC_STARTING)
106 expected_icon = gui.pixmap_from_name(pixmap_name)
107 self.assertEqualPixmaps(expected_icon, actual_icon)
108 actual_text = unicode(self.ui.ui.sync_status_label.text())
109 self.assertEqual(gui.FILE_SYNC_STARTING, actual_text)
110
96 def test_process_info_changed(self):111 def test_process_info_changed(self):
97 """Backend's file sync status changed callback is connected."""112 """Backend's file sync status changed callback is connected."""
98 self.assertEqual(self.ui.backend.status_changed_handler,113 self.assertEqual(self.ui.backend.status_changed_handler,
99114
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_folders.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-29 17:35:30 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-05-18 17:20:24 +0000
@@ -22,6 +22,7 @@
22import os22import os
23import Queue23import Queue
24import shutil24import shutil
25import sys
2526
26from PyQt4 import QtGui27from PyQt4 import QtGui
27from twisted.internet import defer28from twisted.internet import defer
@@ -675,7 +676,7 @@
675676
676 @defer.inlineCallbacks677 @defer.inlineCallbacks
677 def setUp(self):678 def setUp(self):
678 self.path = 'not-existing-dir'679 self.path = u'not-existing-dir'
679 self.expected_size = self.build_test_dir(self.path)680 self.expected_size = self.build_test_dir(self.path)
680 self.queue = Queue.Queue()681 self.queue = Queue.Queue()
681 yield super(BaseLocalFoldersTestCase, self).setUp()682 yield super(BaseLocalFoldersTestCase, self).setUp()
@@ -685,7 +686,8 @@
685 assert not os.path.exists(dir_path)686 assert not os.path.exists(dir_path)
686687
687 os.makedirs(dir_path)688 os.makedirs(dir_path)
688 self.addCleanup(shutil.rmtree, dir_path)689 self.addCleanup(shutil.rmtree,
690 dir_path.encode(sys.getfilesystemencoding()))
689691
690 total_size = 0692 total_size = 0
691693
@@ -775,6 +777,31 @@
775 self.started = True777 self.started = True
776778
777779
780class CalculateSizeWithInvalidPath(CalculateSizeTestCase):
781 """Test suite for the CalculateSize thread implementation."""
782
783 def build_test_dir(self, dir_path):
784 """Build a testing directory hierarchy."""
785 total_size = super(CalculateSizeWithInvalidPath,
786 self).build_test_dir(dir_path)
787 # Have to crete as bytes because it's an invalid path
788 a_file = os.path.join(dir_path.encode(sys.getfilesystemencoding()),
789 '\xe7\xa7')
790 with open(a_file, 'wb') as f:
791 f.write('y' * 5000)
792 total_size += os.path.getsize(a_file)
793 return total_size
794
795 def test_run(self):
796 """The run() method calculates the size for the given path."""
797 self.ui.run()
798
799 path, size = self.queue.get(block=True, timeout=0.5)
800
801 self.assertEqual(path, self.path)
802 self.assertEqual(size, self.expected_size)
803
804
778class FolderItemTestCase(BaseLocalFoldersTestCase):805class FolderItemTestCase(BaseLocalFoldersTestCase):
779 """Test suite for the FolderItem widget."""806 """Test suite for the FolderItem widget."""
780807
781808
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_systray.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_systray.py 2012-02-06 21:10:10 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_systray.py 2012-05-18 17:20:24 +0000
@@ -100,6 +100,18 @@
100 self.assertEqual(tray.window, window)100 self.assertEqual(tray.window, window)
101 self.assertTrue(tray.window.isVisible())101 self.assertTrue(tray.window.isVisible())
102102
103 def test_restore_window_minimized(self):
104 """Test the restore window option in the menu, with a min. window."""
105 tray = systray.TrayIcon()
106 window = FakeMainWindow()
107 # This cannot be tested with the real activateWindow
108 # because the un-minimization is done by the WM, so
109 # it has a small delay, and it fails.
110 self.patch(window, "activateWindow", self._set_called)
111 tray.window = window
112 tray.restore.trigger()
113 self.assertEqual(self._called, ((), {}))
114
103 def test_delete_window(self):115 def test_delete_window(self):
104 """Test deleting an existing window."""116 """Test deleting an existing window."""
105 tray = systray.TrayIcon()117 tray = systray.TrayIcon()
106118
=== modified file 'ubuntuone/controlpanel/tests/test_backend.py'
--- ubuntuone/controlpanel/tests/test_backend.py 2012-03-29 21:37:22 +0000
+++ ubuntuone/controlpanel/tests/test_backend.py 2012-05-18 17:20:24 +0000
@@ -1370,6 +1370,14 @@
1370 expected_status = self.be._process_file_sync_status(status)1370 expected_status = self.be._process_file_sync_status(status)
1371 self.assertEqual(self._called, ((expected_status,), {}))1371 self.assertEqual(self._called, ((expected_status,), {}))
13721372
1373 def test_invalid_status_type(self):
1374 """Check that the method return None with invalid types."""
1375 self.be.status_changed_handler = self._set_called
1376 status = 3
1377 self.be.sd_client.status_changed_handler(status)
1378
1379 self.assertEqual(self._called, ((None,), {}))
1380
13731381
1374class BackendSyncStatusIfDisabledTestCase(BackendSyncStatusTestCase):1382class BackendSyncStatusIfDisabledTestCase(BackendSyncStatusTestCase):
1375 """Syncdaemon state for the backend when file sync is disabled."""1383 """Syncdaemon state for the backend when file sync is disabled."""

Subscribers

People subscribed via source and target branches

to all changes: