Merge lp:~nataliabidart/ubuntuone-control-panel/stable-3-0-update-2.99.3 into lp:ubuntuone-control-panel/stable-3-0

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 247
Merged at revision: 246
Proposed branch: lp:~nataliabidart/ubuntuone-control-panel/stable-3-0-update-2.99.3
Merge into: lp:ubuntuone-control-panel/stable-3-0
Diff against target: 518 lines (+131/-77)
17 files modified
run-tests.bat (+40/-35)
setup.py (+2/-1)
ubuntuone/controlpanel/backend.py (+16/-6)
ubuntuone/controlpanel/dbus_service.py (+5/-10)
ubuntuone/controlpanel/gui/gtk/gui.py (+2/-0)
ubuntuone/controlpanel/gui/gtk/tests/test_widgets.py (+4/-0)
ubuntuone/controlpanel/gui/gtk/widgets.py (+3/-0)
ubuntuone/controlpanel/gui/qt/addfolder.py (+3/-5)
ubuntuone/controlpanel/gui/qt/main/__init__.py (+4/-0)
ubuntuone/controlpanel/gui/qt/main/linux.py (+0/-5)
ubuntuone/controlpanel/gui/qt/main/windows.py (+1/-7)
ubuntuone/controlpanel/gui/qt/tests/__init__.py (+4/-0)
ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py (+2/-1)
ubuntuone/controlpanel/gui/qt/uniqueapp/__init__.py (+2/-2)
ubuntuone/controlpanel/sd_client/__init__.py (+4/-0)
ubuntuone/controlpanel/tests/test_backend.py (+28/-2)
ubuntuone/controlpanel/tests/test_sd_client.py (+11/-3)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-control-panel/stable-3-0-update-2.99.3
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+90964@code.launchpad.net

Commit message

[ Roberto Alsina <email address hidden>
  - Use uncompressed resources and the same qss loading code in both platforms
  to avoid future inconsistencies (LP: #917322).

[ Diego Sarmentero <email address hidden> ]
  - Folder list no longer shows garbage for user homes non-ascii
    (LP: #851356).

[ Natalia B. Bidart <email address hidden> ]
  - Fix lint issues (LP: #920640).

[ Manuel de la Pena <email address hidden> ]
  - Adds the possibility to skip the lint checks on windows when passing the
  /skip-lint parameter to run-tests.bat (LP: #918248).

To post a comment you must log in.
247. By Natalia Bidart

Attaching bug numbers.

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

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'run-tests.bat'
--- run-tests.bat 2011-12-27 18:48:44 +0000
+++ run-tests.bat 2012-01-31 21:52:23 +0000
@@ -1,37 +1,42 @@
1:: Author: Natalia B. Bidart <natalia.bidart@canonical.com>1:: Copyright 2011-12 Canonical Ltd.
2::2::
3:: Copyright 2011 Canonical Ltd.3:: This program is free software: you can redistribute it and/or modify it
4::4:: under the terms of the GNU General Public License version 3, as published
5:: This program is free software: you can redistribute it and/or modify it5:: by the Free Software Foundation.
6:: under the terms of the GNU General Public License version 3, as published6::
7:: by the Free Software Foundation.7:: This program is distributed in the hope that it will be useful, but
8::8:: WITHOUT ANY WARRANTY; without even the implied warranties of
9:: This program is distributed in the hope that it will be useful, but9:: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
10:: WITHOUT ANY WARRANTY; without even the implied warranties of10:: PURPOSE. See the GNU General Public License for more details.
11:: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR11::
12:: PURPOSE. See the GNU General Public License for more details.12:: You should have received a copy of the GNU General Public License along
13::13:: with this program. If not, see <http://www.gnu.org/licenses/>.
14:: You should have received a copy of the GNU General Public License along14
15:: with this program. If not, see <http://www.gnu.org/licenses/>.15:: call setup.py build so that the qt uic is called
1616
17:: call setup.py build so that the qt uic is called17@ECHO off
1818
19@ECHO off19SET MODULE="ubuntuone"
2020SET PYTHONEXEPATH="C:\Python27"
21SET MODULE="ubuntuone"21SET IGNORE_PATHS="ubuntuone\controlpanel\gui\gtk, ubuntuone\controlpanel\dbustests"
22SET PYTHONEXEPATH="C:\Python27"
23SET IGNORE_PATHS="ubuntuone\controlpanel\gui\gtk, ubuntuone\controlpanel\dbustests"
24SET IGNORE_MODULES="test_linux.py, test_libsoup.py"22SET IGNORE_MODULES="test_linux.py, test_libsoup.py"
2523
26"%PYTHONEXEPATH%\python.exe" setup.py build24SET SKIPLINT=0
27ECHO Running tests25:: lets check if we pass the /skip-lint param, if we did we remember and use shift
28:: execute the tests with a number of ignored linux only modules26if "%1" == "/skip-lint" SET SKIPLINT=1
29"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" --reactor=qt4 --gui -p %IGNORE_PATHS% -i %IGNORE_MODULES% %MODULE%27
30:: Clean the build from the setupt.py28"%PYTHONEXEPATH%\python.exe" setup.py build
31ECHO Cleaning the generated code before running the style checks...29ECHO Running tests
32"%PYTHONEXEPATH%\python.exe" setup.py clean30:: execute the tests with a number of ignored linux only modules
33ECHO Performing style checks...31"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" --reactor=qt4 --gui -p %IGNORE_PATHS% -i %IGNORE_MODULES% %MODULE%
34"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1lint" --ignore ubuntuone\controlpanel\gui\qt\ui "%MODULE%"32:: Clean the build from the setupt.py
35"%PYTHONEXEPATH%\Scripts\pep8.exe" --exclude ".svn,CVS,.bzr,.hg,.git,*_ui.py,*_rc.py" --repeat . bin\*33ECHO Cleaning the generated code
36:: Delete the temp folders34"%PYTHONEXEPATH%\python.exe" setup.py clean
37RMDIR /s /q _trial_temp35
36IF %SKIPLINT% == 1 GOTO :CLEAN
37ECHO Performing style checks...
38"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1lint" --ignore ubuntuone\controlpanel\gui\qt\ui "%MODULE%"
39"%PYTHONEXEPATH%\Scripts\pep8.exe" --exclude ".svn,CVS,.bzr,.hg,.git,*_ui.py,*_rc.py" --repeat . bin\*
40:CLEAN
41:: Delete the temp folders
42RMDIR /s /q _trial_temp
3843
=== modified file 'setup.py'
--- setup.py 2012-01-03 18:06:05 +0000
+++ setup.py 2012-01-31 21:52:23 +0000
@@ -116,7 +116,8 @@
116 path = os.getenv('PATH')116 path = os.getenv('PATH')
117 os.putenv('PATH', path + os.path.pathsep + os.path.join(117 os.putenv('PATH', path + os.path.pathsep + os.path.join(
118 os.path.dirname(PyQt4.__file__), 'bin'))118 os.path.dirname(PyQt4.__file__), 'bin'))
119 if os.system('pyrcc4 "%s" -o "%s"' % (qrc_file, py_file)) > 0:119 if os.system('pyrcc4 -no-compress "%s" -o "%s"' %
120 (qrc_file, py_file)) > 0:
120 self.warn('Unable to generate python module {py_file}'121 self.warn('Unable to generate python module {py_file}'
121 ' for resource file {qrc_file}'.format(122 ' for resource file {qrc_file}'.format(
122 py_file=py_file, qrc_file=qrc_file))123 py_file=py_file, qrc_file=qrc_file))
123124
=== modified file 'ubuntuone/controlpanel/backend.py'
--- ubuntuone/controlpanel/backend.py 2011-09-16 16:38:43 +0000
+++ ubuntuone/controlpanel/backend.py 2012-01-31 21:52:23 +0000
@@ -139,6 +139,10 @@
139139
140 logger.info('ControlBackend: instance started.')140 logger.info('ControlBackend: instance started.')
141141
142 def get_home_dir(self):
143 """Return a defer with the home_dir from ubuntu one client."""
144 return self.sd_client.get_home_dir()
145
142 def _process_file_sync_status(self, status):146 def _process_file_sync_status(self, status):
143 """Process raw file sync status into custom format.147 """Process raw file sync status into custom format.
144148
@@ -289,11 +293,15 @@
289293
290 returnValue(local_device)294 returnValue(local_device)
291295
296 @inlineCallbacks
292 def _process_path(self, path):297 def _process_path(self, path):
293 """Trim 'path' so the '~' is removed."""298 """Trim 'path' so the '~' is removed."""
294 home = os.path.expanduser('~')299 home_dir = yield self.get_home_dir()
295 result = path.replace(os.path.join(home, ''), '')300 if not home_dir.endswith(os.path.sep):
296 return result301 home_dir += os.path.sep
302 if path.startswith(home_dir):
303 path = path[len(home_dir):]
304 returnValue(path)
297305
298 @inlineCallbacks306 @inlineCallbacks
299 def get_credentials(self):307 def get_credentials(self):
@@ -578,9 +586,10 @@
578 folders = yield self.sd_client.get_folders()586 folders = yield self.sd_client.get_folders()
579 shares = yield self.sd_client.get_shares()587 shares = yield self.sd_client.get_shares()
580588
589 display_name = yield self._process_path(root_dir)
581 root_volume = {u'volume_id': u'', u'path': root_dir,590 root_volume = {u'volume_id': u'', u'path': root_dir,
582 u'subscribed': True, u'type': self.ROOT_TYPE,591 u'subscribed': True, u'type': self.ROOT_TYPE,
583 u'display_name': self._process_path(root_dir)}592 u'display_name': display_name}
584 self._volumes[u''] = root_volume593 self._volumes[u''] = root_volume
585594
586 # group shares by the offering user595 # group shares by the offering user
@@ -618,7 +627,8 @@
618 logger.warning('volumes_info: udf %r already in the volumes '627 logger.warning('volumes_info: udf %r already in the volumes '
619 'list (%r).', vid, self._volumes[vid])628 'list (%r).', vid, self._volumes[vid])
620 folder[u'subscribed'] = bool(folder[u'subscribed'])629 folder[u'subscribed'] = bool(folder[u'subscribed'])
621 folder[u'display_name'] = self._process_path(folder[u'path'])630 display_name = yield self._process_path(folder[u'path'])
631 folder[u'display_name'] = display_name
622 self._volumes[vid] = folder632 self._volumes[vid] = folder
623633
624 folders.sort(key=operator.itemgetter('path'))634 folders.sort(key=operator.itemgetter('path'))
@@ -678,7 +688,7 @@
678 @inlineCallbacks688 @inlineCallbacks
679 def validate_path_for_folder(self, folder_path):689 def validate_path_for_folder(self, folder_path):
680 """Validate 'folder_path' for folder creation."""690 """Validate 'folder_path' for folder creation."""
681 user_home = os.path.expanduser('~')691 user_home = yield self.get_home_dir()
682 folder_path = append_path_sep(folder_path)692 folder_path = append_path_sep(folder_path)
683693
684 # handle folder_path not within '~' or links694 # handle folder_path not within '~' or links
685695
=== modified file 'ubuntuone/controlpanel/dbus_service.py'
--- ubuntuone/controlpanel/dbus_service.py 2011-09-14 19:08:52 +0000
+++ ubuntuone/controlpanel/dbus_service.py 2012-01-31 21:52:23 +0000
@@ -1,9 +1,6 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2
3# Authors: Alejandro J. Cura <alecu@canonical.com>
4# Authors: Natalia B. Bidart <nataliabidart@canonical.com>
5#2#
6# Copyright 2010 Canonical Ltd.3# Copyright 2010-2012 Canonical Ltd.
7#4#
8# This program is free software: you can redistribute it and/or modify it5# This program is free software: you can redistribute it and/or modify it
9# under the terms of the GNU General Public License version 3, as published6# under the terms of the GNU General Public License version 3, as published
@@ -23,14 +20,12 @@
23import sys20import sys
2421
25import dbus.service22import dbus.service
26# pylint: disable=E061123# pylint: disable=E0611,W0404
27# pylint: disable=W0404
28if 'gobject' in sys.modules:24if 'gobject' in sys.modules:
29 import gobject as GObject25 import gobject as GObject
30else:26else:
31 from gi.repository import GObject27 from gi.repository import GObject
32# pylint: enable=W040428# pylint: enable=E0611,W0404
33# pylint: enable=E0611
3429
35from dbus.mainloop.glib import DBusGMainLoop30from dbus.mainloop.glib import DBusGMainLoop
36from dbus.service import method, signal31from dbus.service import method, signal
@@ -156,6 +151,8 @@
156class ControlPanelBackend(dbus.service.Object):151class ControlPanelBackend(dbus.service.Object):
157 """Export the Control Panel backend thru DBus."""152 """Export the Control Panel backend thru DBus."""
158153
154 # pylint: disable=C0103,E1002
155
159 def __init__(self, backend, *args, **kwargs):156 def __init__(self, backend, *args, **kwargs):
160 """Create this instance of the backend."""157 """Create this instance of the backend."""
161 super(ControlPanelBackend, self).__init__(*args, **kwargs)158 super(ControlPanelBackend, self).__init__(*args, **kwargs)
@@ -164,8 +161,6 @@
164 logger.debug('ControlPanelBackend: created with %r, %r.',161 logger.debug('ControlPanelBackend: created with %r, %r.',
165 args, kwargs)162 args, kwargs)
166163
167 # pylint: disable=C0103
168
169 @log_call(logger.error)164 @log_call(logger.error)
170 @signal(dbus_interface=DBUS_PREFERENCES_IFACE, signature="a{ss}")165 @signal(dbus_interface=DBUS_PREFERENCES_IFACE, signature="a{ss}")
171 def UnauthorizedError(self, error):166 def UnauthorizedError(self, error):
172167
=== modified file 'ubuntuone/controlpanel/gui/gtk/gui.py'
--- ubuntuone/controlpanel/gui/gtk/gui.py 2011-09-19 18:13:28 +0000
+++ ubuntuone/controlpanel/gui/gtk/gui.py 2012-01-31 21:52:23 +0000
@@ -840,6 +840,8 @@
840 else:840 else:
841 self.on_success()841 self.on_success()
842842
843 # Class 'style' has no 'bg' member
844 # pylint: disable=E1101
843 odd_row_color = self.message.style.bg[gtk.STATE_NORMAL]845 odd_row_color = self.message.style.bg[gtk.STATE_NORMAL]
844 for i, device_info in enumerate(info):846 for i, device_info in enumerate(info):
845 device = Device(confirm_remove_dialog=self.confirm_remove_dialog)847 device = Device(confirm_remove_dialog=self.confirm_remove_dialog)
846848
=== modified file 'ubuntuone/controlpanel/gui/gtk/tests/test_widgets.py'
--- ubuntuone/controlpanel/gui/gtk/tests/test_widgets.py 2011-10-24 21:48:27 +0000
+++ ubuntuone/controlpanel/gui/gtk/tests/test_widgets.py 2012-01-31 21:52:23 +0000
@@ -24,6 +24,10 @@
24from ubuntuone.controlpanel.gui.gtk import widgets24from ubuntuone.controlpanel.gui.gtk import widgets
2525
2626
27# Class 'style' has no 'fg' member
28# pylint: disable=E1101
29
30
27class LoadingTestCase(TestCase):31class LoadingTestCase(TestCase):
28 """Test suite for the Loading widget (a spinner plus a label)."""32 """Test suite for the Loading widget (a spinner plus a label)."""
2933
3034
=== modified file 'ubuntuone/controlpanel/gui/gtk/widgets.py'
--- ubuntuone/controlpanel/gui/gtk/widgets.py 2011-04-11 17:30:04 +0000
+++ ubuntuone/controlpanel/gui/gtk/widgets.py 2012-01-31 21:52:23 +0000
@@ -130,6 +130,9 @@
130 # Invalid name, Missing docstring, do not list fix-mes130 # Invalid name, Missing docstring, do not list fix-mes
131 # pylint: disable=C0103,C0111,W0511131 # pylint: disable=C0103,C0111,W0511
132132
133 # Class 'style' has no 'attach', 'set_background', 'paint_flat_box' member
134 # pylint: disable=E1101
135
133 __gsignals__ = {136 __gsignals__ = {
134 "damage_event": "override",137 "damage_event": "override",
135 }138 }
136139
=== modified file 'ubuntuone/controlpanel/gui/qt/addfolder.py'
--- ubuntuone/controlpanel/gui/qt/addfolder.py 2011-12-26 19:45:13 +0000
+++ ubuntuone/controlpanel/gui/qt/addfolder.py 2012-01-31 21:52:23 +0000
@@ -20,8 +20,6 @@
2020
21from __future__ import division21from __future__ import division
2222
23import os
24
25from PyQt4 import QtGui, QtCore23from PyQt4 import QtGui, QtCore
26from twisted.internet import defer24from twisted.internet import defer
2725
@@ -56,8 +54,9 @@
56 def on_clicked(self):54 def on_clicked(self):
57 """The 'Sync another folder' button was clicked."""55 """The 'Sync another folder' button was clicked."""
58 # The options argument is because of LP: #83501356 # The options argument is because of LP: #835013
57 home_dir = yield self.backend.get_home_dir()
59 folder = QtGui.QFileDialog.getExistingDirectory(58 folder = QtGui.QFileDialog.getExistingDirectory(
60 parent=self, directory=os.path.expanduser('~'),59 parent=self, directory=home_dir,
61 options=QtGui.QFileDialog.DontUseNativeDialog)60 options=QtGui.QFileDialog.DontUseNativeDialog)
62 folder = unicode(QtCore.QDir.toNativeSeparators(folder))61 folder = unicode(QtCore.QDir.toNativeSeparators(folder))
63 logger.debug('on_add_folder_button_clicked: user requested folder '62 logger.debug('on_add_folder_button_clicked: user requested folder '
@@ -68,9 +67,8 @@
6867
69 is_valid = yield self.backend.validate_path_for_folder(folder)68 is_valid = yield self.backend.validate_path_for_folder(folder)
70 if not is_valid:69 if not is_valid:
71 user_home = os.path.expanduser('~')
72 text = FOLDER_INVALID_PATH % {'folder_path': folder,70 text = FOLDER_INVALID_PATH % {'folder_path': folder,
73 'home_folder': user_home}71 'home_folder': home_dir}
74 QtGui.QMessageBox.warning(self, '', text, CLOSE)72 QtGui.QMessageBox.warning(self, '', text, CLOSE)
75 return73 return
7674
7775
=== modified file 'ubuntuone/controlpanel/gui/qt/main/__init__.py'
--- ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-01-04 11:43:14 +0000
+++ ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-01-31 21:52:23 +0000
@@ -18,6 +18,8 @@
1818
19import sys19import sys
2020
21from PyQt4 import QtCore
22
21# Module used to include the resources into this file23# Module used to include the resources into this file
22# Unused import images_rc, pylint: disable=W061124# Unused import images_rc, pylint: disable=W0611
23from ubuntuone.controlpanel.gui.qt.ui import images_rc25from ubuntuone.controlpanel.gui.qt.ui import images_rc
@@ -42,6 +44,8 @@
42 # The main loop MUST be initialized before importing the reactor44 # The main loop MUST be initialized before importing the reactor
43 app = UniqueApplication(sys.argv, "ubuntuone-control-panel")45 app = UniqueApplication(sys.argv, "ubuntuone-control-panel")
44 source.main(app)46 source.main(app)
47 qss = QtCore.QResource(":/ubuntuone.qss")
48 app.setStyleSheet(qss.data())
4549
46 # Reimport 'qt4reactor', 'reactor', 'start', pylint: disable=W0404, F040150 # Reimport 'qt4reactor', 'reactor', 'start', pylint: disable=W0404, F0401
47 import qt4reactor51 import qt4reactor
4852
=== modified file 'ubuntuone/controlpanel/gui/qt/main/linux.py'
--- ubuntuone/controlpanel/gui/qt/main/linux.py 2011-11-11 19:27:07 +0000
+++ ubuntuone/controlpanel/gui/qt/main/linux.py 2012-01-31 21:52:23 +0000
@@ -17,14 +17,9 @@
17"""Main method to be used on linux."""17"""Main method to be used on linux."""
1818
19from dbus.mainloop.qt import DBusQtMainLoop19from dbus.mainloop.qt import DBusQtMainLoop
20from PyQt4 import QtCore
2120
2221
23def main(app):22def main(app):
24 """Apply style sheet."""23 """Apply style sheet."""
25 # The DBus main loop MUST be initialized before importing the reactor24 # The DBus main loop MUST be initialized before importing the reactor
26 DBusQtMainLoop(set_as_default=True)25 DBusQtMainLoop(set_as_default=True)
27
28 # Apply Style Sheet -- The linux version may be different
29 qss = QtCore.QResource(":/ubuntuone.qss")
30 app.setStyleSheet(qss.data())
3126
=== modified file 'ubuntuone/controlpanel/gui/qt/main/windows.py'
--- ubuntuone/controlpanel/gui/qt/main/windows.py 2011-11-11 19:40:10 +0000
+++ ubuntuone/controlpanel/gui/qt/main/windows.py 2012-01-31 21:52:23 +0000
@@ -16,7 +16,7 @@
1616
17"""Main method to be used on windows."""17"""Main method to be used on windows."""
1818
19from PyQt4 import QtGui, QtCore19from PyQt4 import QtGui
2020
2121
22def main(app):22def main(app):
@@ -24,9 +24,3 @@
24 # Apply font to the entire application24 # Apply font to the entire application
25 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-R.ttf')25 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-R.ttf')
26 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-B.ttf')26 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-B.ttf')
27
28 # Apply Style Sheet -- The windows version may be different
29 qss_file = QtCore.QFile(":/ubuntuone.qss")
30 qss_file.open(QtCore.QFile.ReadOnly)
31 stylesheet = QtCore.QLatin1String(qss_file.readAll())
32 app.setStyleSheet(stylesheet)
3327
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/__init__.py'
--- ubuntuone/controlpanel/gui/qt/tests/__init__.py 2011-10-24 21:48:27 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/__init__.py 2012-01-31 21:52:23 +0000
@@ -127,6 +127,10 @@
127 self._called['get_credentials'] = ((), {})127 self._called['get_credentials'] = ((), {})
128 return TOKEN128 return TOKEN
129129
130 def get_home_dir(self):
131 """Fake home return."""
132 return USER_HOME
133
130134
131class CrashyBackendException(Exception):135class CrashyBackendException(Exception):
132 """A faked backend crash."""136 """A faked backend crash."""
133137
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py 2011-12-26 19:45:13 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py 2012-01-31 21:52:23 +0000
@@ -80,10 +80,11 @@
80 """When adding a new folder, the proper file chooser is raised."""80 """When adding a new folder, the proper file chooser is raised."""
81 yield self.ui.click()81 yield self.ui.click()
8282
83 home_dir = yield self.ui.backend.get_home_dir()
83 self.assertEqual(FakedFileDialog.args, ())84 self.assertEqual(FakedFileDialog.args, ())
84 self.assertEqual(FakedFileDialog.kwargs, {85 self.assertEqual(FakedFileDialog.kwargs, {
85 'options': gui.QtGui.QFileDialog.DontUseNativeDialog,86 'options': gui.QtGui.QFileDialog.DontUseNativeDialog,
86 'directory': os.path.expanduser('~'),87 'directory': home_dir,
87 'parent': self.ui,88 'parent': self.ui,
88 })89 })
8990
9091
=== modified file 'ubuntuone/controlpanel/gui/qt/uniqueapp/__init__.py'
--- ubuntuone/controlpanel/gui/qt/uniqueapp/__init__.py 2012-01-02 14:29:16 +0000
+++ ubuntuone/controlpanel/gui/qt/uniqueapp/__init__.py 2012-01-31 21:52:23 +0000
@@ -20,9 +20,9 @@
20import sys20import sys
2121
22if sys.platform == "win32":22if sys.platform == "win32":
23 import windows as platform23 from ubuntuone.controlpanel.gui.qt.uniqueapp import windows as platform
24else:24else:
25 import linux as platform25 from ubuntuone.controlpanel.gui.qt.uniqueapp import linux as platform
2626
27#pylint: disable=C010327#pylint: disable=C0103
28UniqueApplication = platform.UniqueApplication28UniqueApplication = platform.UniqueApplication
2929
=== modified file 'ubuntuone/controlpanel/sd_client/__init__.py'
--- ubuntuone/controlpanel/sd_client/__init__.py 2011-08-24 19:56:19 +0000
+++ ubuntuone/controlpanel/sd_client/__init__.py 2012-01-31 21:52:23 +0000
@@ -108,6 +108,10 @@
108 """Disable udf_autosubscribe in the syncdaemon."""108 """Disable udf_autosubscribe in the syncdaemon."""
109 return self.proxy.enable_udf_autosubscribe(False)109 return self.proxy.enable_udf_autosubscribe(False)
110110
111 def get_home_dir(self):
112 """Retrieve the root information from syncdaemon."""
113 return self.proxy.get_home_dir()
114
111 def get_root_dir(self):115 def get_root_dir(self):
112 """Retrieve the root information from syncdaemon."""116 """Retrieve the root information from syncdaemon."""
113 return self.proxy.get_root_dir()117 return self.proxy.get_root_dir()
114118
=== modified file 'ubuntuone/controlpanel/tests/test_backend.py'
--- ubuntuone/controlpanel/tests/test_backend.py 2011-10-24 21:48:27 +0000
+++ ubuntuone/controlpanel/tests/test_backend.py 2012-01-31 21:52:23 +0000
@@ -248,6 +248,10 @@
248 """Stop the file_sync service."""248 """Stop the file_sync service."""
249 self.actions.append('stop')249 self.actions.append('stop')
250250
251 def get_home_dir(self):
252 """Grab the home dir."""
253 return USER_HOME
254
251 def get_root_dir(self):255 def get_root_dir(self):
252 """Grab the root dir."""256 """Grab the root dir."""
253 return ROOT_PATH257 return ROOT_PATH
@@ -784,10 +788,11 @@
784 self.be.wc.results[QUOTA_API] = SAMPLE_QUOTA_JSON788 self.be.wc.results[QUOTA_API] = SAMPLE_QUOTA_JSON
785789
786 # root dir info790 # root dir info
791 display_name = yield self.be._process_path(ROOT_PATH)
787 self.root_volume = {792 self.root_volume = {
788 u'volume_id': u'', u'path': ROOT_PATH, u'subscribed': True,793 u'volume_id': u'', u'path': ROOT_PATH, u'subscribed': True,
789 u'type': self.be.ROOT_TYPE,794 u'type': self.be.ROOT_TYPE,
790 u'display_name': self.be._process_path(ROOT_PATH),795 u'display_name': display_name,
791 }796 }
792797
793 @inlineCallbacks798 @inlineCallbacks
@@ -831,7 +836,8 @@
831 folder = folder.copy()836 folder = folder.copy()
832 folder[u'type'] = self.be.FOLDER_TYPE837 folder[u'type'] = self.be.FOLDER_TYPE
833 folder[u'subscribed'] = bool(folder[u'subscribed'])838 folder[u'subscribed'] = bool(folder[u'subscribed'])
834 folder[u'display_name'] = self.be._process_path(folder[u'path'])839 display_name = yield self.be._process_path(folder[u'path'])
840 folder[u'display_name'] = display_name
835 folders.append(folder)841 folders.append(folder)
836842
837 # sort folders by path843 # sort folders by path
@@ -863,6 +869,26 @@
863 self.assertEqual(result, expected)869 self.assertEqual(result, expected)
864870
865 @inlineCallbacks871 @inlineCallbacks
872 def test_volumes_info_process_path(self):
873 """The volumes_info method exercises its callback."""
874 root_path = USER_HOME + os.path.sep + 'My Ubuntu' + USER_HOME
875 self.patch(self.be.sd_client, 'get_root_dir', lambda: root_path)
876 for item in SAMPLE_FOLDERS:
877 path = item[u'path']
878 path = path[len(USER_HOME) + 1:]
879 item[u'path'] = os.path.join(root_path, path)
880 self.patch(self.be.sd_client, 'shares', SAMPLE_SHARES)
881 self.patch(self.be.sd_client, 'folders', SAMPLE_FOLDERS)
882
883 yield self.be.volumes_info()
884 for item in SAMPLE_FOLDERS:
885 key = item[u'volume_id']
886 folder = self.be._volumes[key]
887 display_name = folder['display_name']
888 prefix = 'My Ubuntu' + USER_HOME
889 self.assertTrue(display_name.startswith(prefix))
890
891 @inlineCallbacks
866 def test_volumes_info_without_storage_info(self):892 def test_volumes_info_without_storage_info(self):
867 """The volumes_info method exercises its callback."""893 """The volumes_info method exercises its callback."""
868 self.patch(self.be.sd_client, 'shares', SAMPLE_SHARES)894 self.patch(self.be.sd_client, 'shares', SAMPLE_SHARES)
869895
=== modified file 'ubuntuone/controlpanel/tests/test_sd_client.py'
--- ubuntuone/controlpanel/tests/test_sd_client.py 2011-11-21 13:32:44 +0000
+++ ubuntuone/controlpanel/tests/test_sd_client.py 2012-01-31 21:52:23 +0000
@@ -34,6 +34,9 @@
34from ubuntuone.controlpanel import sd_client34from ubuntuone.controlpanel import sd_client
35from ubuntuone.controlpanel.tests import TestCase35from ubuntuone.controlpanel.tests import TestCase
3636
37# Instance of 'SyncDaemonTool' has no 'foo' member
38# pylint: disable=E1101
39
3740
38SAMPLE_LIMITS = {'upload': 999, 'download': 838}41SAMPLE_LIMITS = {'upload': 999, 'download': 838}
3942
@@ -66,9 +69,10 @@
66 called = {}69 called = {}
67 shares = {}70 shares = {}
68 folders = {}71 folders = {}
69 root_dir = os.path.expanduser('~/Ubuntu One')72 home_dir = u'/home/ñandu úser'
70 shares_dir = os.path.expanduser('~/.cache/ubuntuone/shares')73 root_dir = os.path.join(home_dir, u'Ubuntu One')
71 shares_dir_link = os.path.join(root_dir, 'Shared With Me')74 shares_dir = os.path.join(home_dir, u'.cache/ubuntuone/shares')
75 shares_dir_link = os.path.join(root_dir, u'Shared With Me')
7276
73 @classmethod77 @classmethod
74 def create_share(cls, name, accepted=False, subscribed=False):78 def create_share(cls, name, accepted=False, subscribed=False):
@@ -299,6 +303,10 @@
299 """Request a rescan from scratch for volume_id."""303 """Request a rescan from scratch for volume_id."""
300 self.called['rescan_from_scratch'] = volume_id304 self.called['rescan_from_scratch'] = volume_id
301305
306 def get_home_dir(self):
307 """Return the root directory."""
308 return self.home_dir
309
302 def get_root_dir(self):310 def get_root_dir(self):
303 """Return the root directory."""311 """Return the root directory."""
304 return self.root_dir312 return self.root_dir

Subscribers

People subscribed via source and target branches