Merge lp:~nataliabidart/ubuntuone-control-panel/stable-3-0-update-2.99.3 into lp:ubuntuone-control-panel/stable-3-0
- stable-3-0-update-2.99.3
- Merge into 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 | ||||||||||||||||
Related bugs: |
|
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).
Description of the change
To post a comment you must log in.
- 247. By Natalia Bidart
-
Attaching bug numbers.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'run-tests.bat' | |||
2 | --- run-tests.bat 2011-12-27 18:48:44 +0000 | |||
3 | +++ run-tests.bat 2012-01-31 21:52:23 +0000 | |||
4 | @@ -1,37 +1,42 @@ | |||
28 | 1 | :: Author: Natalia B. Bidart <natalia.bidart@canonical.com> | 1 | :: Copyright 2011-12 Canonical Ltd. |
29 | 2 | :: | 2 | :: |
30 | 3 | :: Copyright 2011 Canonical Ltd. | 3 | :: This program is free software: you can redistribute it and/or modify it |
31 | 4 | :: | 4 | :: under the terms of the GNU General Public License version 3, as published |
32 | 5 | :: This program is free software: you can redistribute it and/or modify it | 5 | :: by the Free Software Foundation. |
33 | 6 | :: under the terms of the GNU General Public License version 3, as published | 6 | :: |
34 | 7 | :: by the Free Software Foundation. | 7 | :: This program is distributed in the hope that it will be useful, but |
35 | 8 | :: | 8 | :: WITHOUT ANY WARRANTY; without even the implied warranties of |
36 | 9 | :: This program is distributed in the hope that it will be useful, but | 9 | :: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
37 | 10 | :: WITHOUT ANY WARRANTY; without even the implied warranties of | 10 | :: PURPOSE. See the GNU General Public License for more details. |
38 | 11 | :: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | 11 | :: |
39 | 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 |
40 | 13 | :: | 13 | :: with this program. If not, see <http://www.gnu.org/licenses/>. |
41 | 14 | :: You should have received a copy of the GNU General Public License along | 14 | |
42 | 15 | :: with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | :: call setup.py build so that the qt uic is called |
43 | 16 | 16 | ||
44 | 17 | :: call setup.py build so that the qt uic is called | 17 | @ECHO off |
45 | 18 | 18 | ||
46 | 19 | @ECHO off | 19 | SET MODULE="ubuntuone" |
47 | 20 | 20 | SET PYTHONEXEPATH="C:\Python27" | |
48 | 21 | SET MODULE="ubuntuone" | 21 | SET IGNORE_PATHS="ubuntuone\controlpanel\gui\gtk, ubuntuone\controlpanel\dbustests" |
26 | 22 | SET PYTHONEXEPATH="C:\Python27" | ||
27 | 23 | SET IGNORE_PATHS="ubuntuone\controlpanel\gui\gtk, ubuntuone\controlpanel\dbustests" | ||
49 | 24 | SET IGNORE_MODULES="test_linux.py, test_libsoup.py" | 22 | SET IGNORE_MODULES="test_linux.py, test_libsoup.py" |
50 | 25 | 23 | ||
63 | 26 | "%PYTHONEXEPATH%\python.exe" setup.py build | 24 | SET SKIPLINT=0 |
64 | 27 | ECHO Running tests | 25 | :: lets check if we pass the /skip-lint param, if we did we remember and use shift |
65 | 28 | :: execute the tests with a number of ignored linux only modules | 26 | if "%1" == "/skip-lint" SET SKIPLINT=1 |
66 | 29 | "%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" --reactor=qt4 --gui -p %IGNORE_PATHS% -i %IGNORE_MODULES% %MODULE% | 27 | |
67 | 30 | :: Clean the build from the setupt.py | 28 | "%PYTHONEXEPATH%\python.exe" setup.py build |
68 | 31 | ECHO Cleaning the generated code before running the style checks... | 29 | ECHO Running tests |
69 | 32 | "%PYTHONEXEPATH%\python.exe" setup.py clean | 30 | :: execute the tests with a number of ignored linux only modules |
70 | 33 | ECHO Performing style checks... | 31 | "%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" --reactor=qt4 --gui -p %IGNORE_PATHS% -i %IGNORE_MODULES% %MODULE% |
71 | 34 | "%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1lint" --ignore ubuntuone\controlpanel\gui\qt\ui "%MODULE%" | 32 | :: Clean the build from the setupt.py |
72 | 35 | "%PYTHONEXEPATH%\Scripts\pep8.exe" --exclude ".svn,CVS,.bzr,.hg,.git,*_ui.py,*_rc.py" --repeat . bin\* | 33 | ECHO Cleaning the generated code |
73 | 36 | :: Delete the temp folders | 34 | "%PYTHONEXEPATH%\python.exe" setup.py clean |
74 | 37 | RMDIR /s /q _trial_temp | 35 | |
75 | 36 | IF %SKIPLINT% == 1 GOTO :CLEAN | ||
76 | 37 | ECHO Performing style checks... | ||
77 | 38 | "%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1lint" --ignore ubuntuone\controlpanel\gui\qt\ui "%MODULE%" | ||
78 | 39 | "%PYTHONEXEPATH%\Scripts\pep8.exe" --exclude ".svn,CVS,.bzr,.hg,.git,*_ui.py,*_rc.py" --repeat . bin\* | ||
79 | 40 | :CLEAN | ||
80 | 41 | :: Delete the temp folders | ||
81 | 42 | RMDIR /s /q _trial_temp | ||
82 | 38 | 43 | ||
83 | === modified file 'setup.py' | |||
84 | --- setup.py 2012-01-03 18:06:05 +0000 | |||
85 | +++ setup.py 2012-01-31 21:52:23 +0000 | |||
86 | @@ -116,7 +116,8 @@ | |||
87 | 116 | path = os.getenv('PATH') | 116 | path = os.getenv('PATH') |
88 | 117 | os.putenv('PATH', path + os.path.pathsep + os.path.join( | 117 | os.putenv('PATH', path + os.path.pathsep + os.path.join( |
89 | 118 | os.path.dirname(PyQt4.__file__), 'bin')) | 118 | os.path.dirname(PyQt4.__file__), 'bin')) |
91 | 119 | if os.system('pyrcc4 "%s" -o "%s"' % (qrc_file, py_file)) > 0: | 119 | if os.system('pyrcc4 -no-compress "%s" -o "%s"' % |
92 | 120 | (qrc_file, py_file)) > 0: | ||
93 | 120 | self.warn('Unable to generate python module {py_file}' | 121 | self.warn('Unable to generate python module {py_file}' |
94 | 121 | ' for resource file {qrc_file}'.format( | 122 | ' for resource file {qrc_file}'.format( |
95 | 122 | py_file=py_file, qrc_file=qrc_file)) | 123 | py_file=py_file, qrc_file=qrc_file)) |
96 | 123 | 124 | ||
97 | === modified file 'ubuntuone/controlpanel/backend.py' | |||
98 | --- ubuntuone/controlpanel/backend.py 2011-09-16 16:38:43 +0000 | |||
99 | +++ ubuntuone/controlpanel/backend.py 2012-01-31 21:52:23 +0000 | |||
100 | @@ -139,6 +139,10 @@ | |||
101 | 139 | 139 | ||
102 | 140 | logger.info('ControlBackend: instance started.') | 140 | logger.info('ControlBackend: instance started.') |
103 | 141 | 141 | ||
104 | 142 | def get_home_dir(self): | ||
105 | 143 | """Return a defer with the home_dir from ubuntu one client.""" | ||
106 | 144 | return self.sd_client.get_home_dir() | ||
107 | 145 | |||
108 | 142 | def _process_file_sync_status(self, status): | 146 | def _process_file_sync_status(self, status): |
109 | 143 | """Process raw file sync status into custom format. | 147 | """Process raw file sync status into custom format. |
110 | 144 | 148 | ||
111 | @@ -289,11 +293,15 @@ | |||
112 | 289 | 293 | ||
113 | 290 | returnValue(local_device) | 294 | returnValue(local_device) |
114 | 291 | 295 | ||
115 | 296 | @inlineCallbacks | ||
116 | 292 | def _process_path(self, path): | 297 | def _process_path(self, path): |
117 | 293 | """Trim 'path' so the '~' is removed.""" | 298 | """Trim 'path' so the '~' is removed.""" |
121 | 294 | home = os.path.expanduser('~') | 299 | home_dir = yield self.get_home_dir() |
122 | 295 | result = path.replace(os.path.join(home, ''), '') | 300 | if not home_dir.endswith(os.path.sep): |
123 | 296 | return result | 301 | home_dir += os.path.sep |
124 | 302 | if path.startswith(home_dir): | ||
125 | 303 | path = path[len(home_dir):] | ||
126 | 304 | returnValue(path) | ||
127 | 297 | 305 | ||
128 | 298 | @inlineCallbacks | 306 | @inlineCallbacks |
129 | 299 | def get_credentials(self): | 307 | def get_credentials(self): |
130 | @@ -578,9 +586,10 @@ | |||
131 | 578 | folders = yield self.sd_client.get_folders() | 586 | folders = yield self.sd_client.get_folders() |
132 | 579 | shares = yield self.sd_client.get_shares() | 587 | shares = yield self.sd_client.get_shares() |
133 | 580 | 588 | ||
134 | 589 | display_name = yield self._process_path(root_dir) | ||
135 | 581 | root_volume = {u'volume_id': u'', u'path': root_dir, | 590 | root_volume = {u'volume_id': u'', u'path': root_dir, |
136 | 582 | u'subscribed': True, u'type': self.ROOT_TYPE, | 591 | u'subscribed': True, u'type': self.ROOT_TYPE, |
138 | 583 | u'display_name': self._process_path(root_dir)} | 592 | u'display_name': display_name} |
139 | 584 | self._volumes[u''] = root_volume | 593 | self._volumes[u''] = root_volume |
140 | 585 | 594 | ||
141 | 586 | # group shares by the offering user | 595 | # group shares by the offering user |
142 | @@ -618,7 +627,8 @@ | |||
143 | 618 | logger.warning('volumes_info: udf %r already in the volumes ' | 627 | logger.warning('volumes_info: udf %r already in the volumes ' |
144 | 619 | 'list (%r).', vid, self._volumes[vid]) | 628 | 'list (%r).', vid, self._volumes[vid]) |
145 | 620 | folder[u'subscribed'] = bool(folder[u'subscribed']) | 629 | folder[u'subscribed'] = bool(folder[u'subscribed']) |
147 | 621 | folder[u'display_name'] = self._process_path(folder[u'path']) | 630 | display_name = yield self._process_path(folder[u'path']) |
148 | 631 | folder[u'display_name'] = display_name | ||
149 | 622 | self._volumes[vid] = folder | 632 | self._volumes[vid] = folder |
150 | 623 | 633 | ||
151 | 624 | folders.sort(key=operator.itemgetter('path')) | 634 | folders.sort(key=operator.itemgetter('path')) |
152 | @@ -678,7 +688,7 @@ | |||
153 | 678 | @inlineCallbacks | 688 | @inlineCallbacks |
154 | 679 | def validate_path_for_folder(self, folder_path): | 689 | def validate_path_for_folder(self, folder_path): |
155 | 680 | """Validate 'folder_path' for folder creation.""" | 690 | """Validate 'folder_path' for folder creation.""" |
157 | 681 | user_home = os.path.expanduser('~') | 691 | user_home = yield self.get_home_dir() |
158 | 682 | folder_path = append_path_sep(folder_path) | 692 | folder_path = append_path_sep(folder_path) |
159 | 683 | 693 | ||
160 | 684 | # handle folder_path not within '~' or links | 694 | # handle folder_path not within '~' or links |
161 | 685 | 695 | ||
162 | === modified file 'ubuntuone/controlpanel/dbus_service.py' | |||
163 | --- ubuntuone/controlpanel/dbus_service.py 2011-09-14 19:08:52 +0000 | |||
164 | +++ ubuntuone/controlpanel/dbus_service.py 2012-01-31 21:52:23 +0000 | |||
165 | @@ -1,9 +1,6 @@ | |||
166 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
167 | 2 | |||
168 | 3 | # Authors: Alejandro J. Cura <alecu@canonical.com> | ||
169 | 4 | # Authors: Natalia B. Bidart <nataliabidart@canonical.com> | ||
170 | 5 | # | 2 | # |
172 | 6 | # Copyright 2010 Canonical Ltd. | 3 | # Copyright 2010-2012 Canonical Ltd. |
173 | 7 | # | 4 | # |
174 | 8 | # This program is free software: you can redistribute it and/or modify it | 5 | # This program is free software: you can redistribute it and/or modify it |
175 | 9 | # under the terms of the GNU General Public License version 3, as published | 6 | # under the terms of the GNU General Public License version 3, as published |
176 | @@ -23,14 +20,12 @@ | |||
177 | 23 | import sys | 20 | import sys |
178 | 24 | 21 | ||
179 | 25 | import dbus.service | 22 | import dbus.service |
182 | 26 | # pylint: disable=E0611 | 23 | # pylint: disable=E0611,W0404 |
181 | 27 | # pylint: disable=W0404 | ||
183 | 28 | if 'gobject' in sys.modules: | 24 | if 'gobject' in sys.modules: |
184 | 29 | import gobject as GObject | 25 | import gobject as GObject |
185 | 30 | else: | 26 | else: |
186 | 31 | from gi.repository import GObject | 27 | from gi.repository import GObject |
189 | 32 | # pylint: enable=W0404 | 28 | # pylint: enable=E0611,W0404 |
188 | 33 | # pylint: enable=E0611 | ||
190 | 34 | 29 | ||
191 | 35 | from dbus.mainloop.glib import DBusGMainLoop | 30 | from dbus.mainloop.glib import DBusGMainLoop |
192 | 36 | from dbus.service import method, signal | 31 | from dbus.service import method, signal |
193 | @@ -156,6 +151,8 @@ | |||
194 | 156 | class ControlPanelBackend(dbus.service.Object): | 151 | class ControlPanelBackend(dbus.service.Object): |
195 | 157 | """Export the Control Panel backend thru DBus.""" | 152 | """Export the Control Panel backend thru DBus.""" |
196 | 158 | 153 | ||
197 | 154 | # pylint: disable=C0103,E1002 | ||
198 | 155 | |||
199 | 159 | def __init__(self, backend, *args, **kwargs): | 156 | def __init__(self, backend, *args, **kwargs): |
200 | 160 | """Create this instance of the backend.""" | 157 | """Create this instance of the backend.""" |
201 | 161 | super(ControlPanelBackend, self).__init__(*args, **kwargs) | 158 | super(ControlPanelBackend, self).__init__(*args, **kwargs) |
202 | @@ -164,8 +161,6 @@ | |||
203 | 164 | logger.debug('ControlPanelBackend: created with %r, %r.', | 161 | logger.debug('ControlPanelBackend: created with %r, %r.', |
204 | 165 | args, kwargs) | 162 | args, kwargs) |
205 | 166 | 163 | ||
206 | 167 | # pylint: disable=C0103 | ||
207 | 168 | |||
208 | 169 | @log_call(logger.error) | 164 | @log_call(logger.error) |
209 | 170 | @signal(dbus_interface=DBUS_PREFERENCES_IFACE, signature="a{ss}") | 165 | @signal(dbus_interface=DBUS_PREFERENCES_IFACE, signature="a{ss}") |
210 | 171 | def UnauthorizedError(self, error): | 166 | def UnauthorizedError(self, error): |
211 | 172 | 167 | ||
212 | === modified file 'ubuntuone/controlpanel/gui/gtk/gui.py' | |||
213 | --- ubuntuone/controlpanel/gui/gtk/gui.py 2011-09-19 18:13:28 +0000 | |||
214 | +++ ubuntuone/controlpanel/gui/gtk/gui.py 2012-01-31 21:52:23 +0000 | |||
215 | @@ -840,6 +840,8 @@ | |||
216 | 840 | else: | 840 | else: |
217 | 841 | self.on_success() | 841 | self.on_success() |
218 | 842 | 842 | ||
219 | 843 | # Class 'style' has no 'bg' member | ||
220 | 844 | # pylint: disable=E1101 | ||
221 | 843 | odd_row_color = self.message.style.bg[gtk.STATE_NORMAL] | 845 | odd_row_color = self.message.style.bg[gtk.STATE_NORMAL] |
222 | 844 | for i, device_info in enumerate(info): | 846 | for i, device_info in enumerate(info): |
223 | 845 | device = Device(confirm_remove_dialog=self.confirm_remove_dialog) | 847 | device = Device(confirm_remove_dialog=self.confirm_remove_dialog) |
224 | 846 | 848 | ||
225 | === modified file 'ubuntuone/controlpanel/gui/gtk/tests/test_widgets.py' | |||
226 | --- ubuntuone/controlpanel/gui/gtk/tests/test_widgets.py 2011-10-24 21:48:27 +0000 | |||
227 | +++ ubuntuone/controlpanel/gui/gtk/tests/test_widgets.py 2012-01-31 21:52:23 +0000 | |||
228 | @@ -24,6 +24,10 @@ | |||
229 | 24 | from ubuntuone.controlpanel.gui.gtk import widgets | 24 | from ubuntuone.controlpanel.gui.gtk import widgets |
230 | 25 | 25 | ||
231 | 26 | 26 | ||
232 | 27 | # Class 'style' has no 'fg' member | ||
233 | 28 | # pylint: disable=E1101 | ||
234 | 29 | |||
235 | 30 | |||
236 | 27 | class LoadingTestCase(TestCase): | 31 | class LoadingTestCase(TestCase): |
237 | 28 | """Test suite for the Loading widget (a spinner plus a label).""" | 32 | """Test suite for the Loading widget (a spinner plus a label).""" |
238 | 29 | 33 | ||
239 | 30 | 34 | ||
240 | === modified file 'ubuntuone/controlpanel/gui/gtk/widgets.py' | |||
241 | --- ubuntuone/controlpanel/gui/gtk/widgets.py 2011-04-11 17:30:04 +0000 | |||
242 | +++ ubuntuone/controlpanel/gui/gtk/widgets.py 2012-01-31 21:52:23 +0000 | |||
243 | @@ -130,6 +130,9 @@ | |||
244 | 130 | # Invalid name, Missing docstring, do not list fix-mes | 130 | # Invalid name, Missing docstring, do not list fix-mes |
245 | 131 | # pylint: disable=C0103,C0111,W0511 | 131 | # pylint: disable=C0103,C0111,W0511 |
246 | 132 | 132 | ||
247 | 133 | # Class 'style' has no 'attach', 'set_background', 'paint_flat_box' member | ||
248 | 134 | # pylint: disable=E1101 | ||
249 | 135 | |||
250 | 133 | __gsignals__ = { | 136 | __gsignals__ = { |
251 | 134 | "damage_event": "override", | 137 | "damage_event": "override", |
252 | 135 | } | 138 | } |
253 | 136 | 139 | ||
254 | === modified file 'ubuntuone/controlpanel/gui/qt/addfolder.py' | |||
255 | --- ubuntuone/controlpanel/gui/qt/addfolder.py 2011-12-26 19:45:13 +0000 | |||
256 | +++ ubuntuone/controlpanel/gui/qt/addfolder.py 2012-01-31 21:52:23 +0000 | |||
257 | @@ -20,8 +20,6 @@ | |||
258 | 20 | 20 | ||
259 | 21 | from __future__ import division | 21 | from __future__ import division |
260 | 22 | 22 | ||
261 | 23 | import os | ||
262 | 24 | |||
263 | 25 | from PyQt4 import QtGui, QtCore | 23 | from PyQt4 import QtGui, QtCore |
264 | 26 | from twisted.internet import defer | 24 | from twisted.internet import defer |
265 | 27 | 25 | ||
266 | @@ -56,8 +54,9 @@ | |||
267 | 56 | def on_clicked(self): | 54 | def on_clicked(self): |
268 | 57 | """The 'Sync another folder' button was clicked.""" | 55 | """The 'Sync another folder' button was clicked.""" |
269 | 58 | # The options argument is because of LP: #835013 | 56 | # The options argument is because of LP: #835013 |
270 | 57 | home_dir = yield self.backend.get_home_dir() | ||
271 | 59 | folder = QtGui.QFileDialog.getExistingDirectory( | 58 | folder = QtGui.QFileDialog.getExistingDirectory( |
273 | 60 | parent=self, directory=os.path.expanduser('~'), | 59 | parent=self, directory=home_dir, |
274 | 61 | options=QtGui.QFileDialog.DontUseNativeDialog) | 60 | options=QtGui.QFileDialog.DontUseNativeDialog) |
275 | 62 | folder = unicode(QtCore.QDir.toNativeSeparators(folder)) | 61 | folder = unicode(QtCore.QDir.toNativeSeparators(folder)) |
276 | 63 | logger.debug('on_add_folder_button_clicked: user requested folder ' | 62 | logger.debug('on_add_folder_button_clicked: user requested folder ' |
277 | @@ -68,9 +67,8 @@ | |||
278 | 68 | 67 | ||
279 | 69 | is_valid = yield self.backend.validate_path_for_folder(folder) | 68 | is_valid = yield self.backend.validate_path_for_folder(folder) |
280 | 70 | if not is_valid: | 69 | if not is_valid: |
281 | 71 | user_home = os.path.expanduser('~') | ||
282 | 72 | text = FOLDER_INVALID_PATH % {'folder_path': folder, | 70 | text = FOLDER_INVALID_PATH % {'folder_path': folder, |
284 | 73 | 'home_folder': user_home} | 71 | 'home_folder': home_dir} |
285 | 74 | QtGui.QMessageBox.warning(self, '', text, CLOSE) | 72 | QtGui.QMessageBox.warning(self, '', text, CLOSE) |
286 | 75 | return | 73 | return |
287 | 76 | 74 | ||
288 | 77 | 75 | ||
289 | === modified file 'ubuntuone/controlpanel/gui/qt/main/__init__.py' | |||
290 | --- ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-01-04 11:43:14 +0000 | |||
291 | +++ ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-01-31 21:52:23 +0000 | |||
292 | @@ -18,6 +18,8 @@ | |||
293 | 18 | 18 | ||
294 | 19 | import sys | 19 | import sys |
295 | 20 | 20 | ||
296 | 21 | from PyQt4 import QtCore | ||
297 | 22 | |||
298 | 21 | # Module used to include the resources into this file | 23 | # Module used to include the resources into this file |
299 | 22 | # Unused import images_rc, pylint: disable=W0611 | 24 | # Unused import images_rc, pylint: disable=W0611 |
300 | 23 | from ubuntuone.controlpanel.gui.qt.ui import images_rc | 25 | from ubuntuone.controlpanel.gui.qt.ui import images_rc |
301 | @@ -42,6 +44,8 @@ | |||
302 | 42 | # The main loop MUST be initialized before importing the reactor | 44 | # The main loop MUST be initialized before importing the reactor |
303 | 43 | app = UniqueApplication(sys.argv, "ubuntuone-control-panel") | 45 | app = UniqueApplication(sys.argv, "ubuntuone-control-panel") |
304 | 44 | source.main(app) | 46 | source.main(app) |
305 | 47 | qss = QtCore.QResource(":/ubuntuone.qss") | ||
306 | 48 | app.setStyleSheet(qss.data()) | ||
307 | 45 | 49 | ||
308 | 46 | # Reimport 'qt4reactor', 'reactor', 'start', pylint: disable=W0404, F0401 | 50 | # Reimport 'qt4reactor', 'reactor', 'start', pylint: disable=W0404, F0401 |
309 | 47 | import qt4reactor | 51 | import qt4reactor |
310 | 48 | 52 | ||
311 | === modified file 'ubuntuone/controlpanel/gui/qt/main/linux.py' | |||
312 | --- ubuntuone/controlpanel/gui/qt/main/linux.py 2011-11-11 19:27:07 +0000 | |||
313 | +++ ubuntuone/controlpanel/gui/qt/main/linux.py 2012-01-31 21:52:23 +0000 | |||
314 | @@ -17,14 +17,9 @@ | |||
315 | 17 | """Main method to be used on linux.""" | 17 | """Main method to be used on linux.""" |
316 | 18 | 18 | ||
317 | 19 | from dbus.mainloop.qt import DBusQtMainLoop | 19 | from dbus.mainloop.qt import DBusQtMainLoop |
318 | 20 | from PyQt4 import QtCore | ||
319 | 21 | 20 | ||
320 | 22 | 21 | ||
321 | 23 | def main(app): | 22 | def main(app): |
322 | 24 | """Apply style sheet.""" | 23 | """Apply style sheet.""" |
323 | 25 | # The DBus main loop MUST be initialized before importing the reactor | 24 | # The DBus main loop MUST be initialized before importing the reactor |
324 | 26 | DBusQtMainLoop(set_as_default=True) | 25 | DBusQtMainLoop(set_as_default=True) |
325 | 27 | |||
326 | 28 | # Apply Style Sheet -- The linux version may be different | ||
327 | 29 | qss = QtCore.QResource(":/ubuntuone.qss") | ||
328 | 30 | app.setStyleSheet(qss.data()) | ||
329 | 31 | 26 | ||
330 | === modified file 'ubuntuone/controlpanel/gui/qt/main/windows.py' | |||
331 | --- ubuntuone/controlpanel/gui/qt/main/windows.py 2011-11-11 19:40:10 +0000 | |||
332 | +++ ubuntuone/controlpanel/gui/qt/main/windows.py 2012-01-31 21:52:23 +0000 | |||
333 | @@ -16,7 +16,7 @@ | |||
334 | 16 | 16 | ||
335 | 17 | """Main method to be used on windows.""" | 17 | """Main method to be used on windows.""" |
336 | 18 | 18 | ||
338 | 19 | from PyQt4 import QtGui, QtCore | 19 | from PyQt4 import QtGui |
339 | 20 | 20 | ||
340 | 21 | 21 | ||
341 | 22 | def main(app): | 22 | def main(app): |
342 | @@ -24,9 +24,3 @@ | |||
343 | 24 | # Apply font to the entire application | 24 | # Apply font to the entire application |
344 | 25 | QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-R.ttf') | 25 | QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-R.ttf') |
345 | 26 | QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-B.ttf') | 26 | QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-B.ttf') |
346 | 27 | |||
347 | 28 | # Apply Style Sheet -- The windows version may be different | ||
348 | 29 | qss_file = QtCore.QFile(":/ubuntuone.qss") | ||
349 | 30 | qss_file.open(QtCore.QFile.ReadOnly) | ||
350 | 31 | stylesheet = QtCore.QLatin1String(qss_file.readAll()) | ||
351 | 32 | app.setStyleSheet(stylesheet) | ||
352 | 33 | 27 | ||
353 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/__init__.py' | |||
354 | --- ubuntuone/controlpanel/gui/qt/tests/__init__.py 2011-10-24 21:48:27 +0000 | |||
355 | +++ ubuntuone/controlpanel/gui/qt/tests/__init__.py 2012-01-31 21:52:23 +0000 | |||
356 | @@ -127,6 +127,10 @@ | |||
357 | 127 | self._called['get_credentials'] = ((), {}) | 127 | self._called['get_credentials'] = ((), {}) |
358 | 128 | return TOKEN | 128 | return TOKEN |
359 | 129 | 129 | ||
360 | 130 | def get_home_dir(self): | ||
361 | 131 | """Fake home return.""" | ||
362 | 132 | return USER_HOME | ||
363 | 133 | |||
364 | 130 | 134 | ||
365 | 131 | class CrashyBackendException(Exception): | 135 | class CrashyBackendException(Exception): |
366 | 132 | """A faked backend crash.""" | 136 | """A faked backend crash.""" |
367 | 133 | 137 | ||
368 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py' | |||
369 | --- ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py 2011-12-26 19:45:13 +0000 | |||
370 | +++ ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py 2012-01-31 21:52:23 +0000 | |||
371 | @@ -80,10 +80,11 @@ | |||
372 | 80 | """When adding a new folder, the proper file chooser is raised.""" | 80 | """When adding a new folder, the proper file chooser is raised.""" |
373 | 81 | yield self.ui.click() | 81 | yield self.ui.click() |
374 | 82 | 82 | ||
375 | 83 | home_dir = yield self.ui.backend.get_home_dir() | ||
376 | 83 | self.assertEqual(FakedFileDialog.args, ()) | 84 | self.assertEqual(FakedFileDialog.args, ()) |
377 | 84 | self.assertEqual(FakedFileDialog.kwargs, { | 85 | self.assertEqual(FakedFileDialog.kwargs, { |
378 | 85 | 'options': gui.QtGui.QFileDialog.DontUseNativeDialog, | 86 | 'options': gui.QtGui.QFileDialog.DontUseNativeDialog, |
380 | 86 | 'directory': os.path.expanduser('~'), | 87 | 'directory': home_dir, |
381 | 87 | 'parent': self.ui, | 88 | 'parent': self.ui, |
382 | 88 | }) | 89 | }) |
383 | 89 | 90 | ||
384 | 90 | 91 | ||
385 | === modified file 'ubuntuone/controlpanel/gui/qt/uniqueapp/__init__.py' | |||
386 | --- ubuntuone/controlpanel/gui/qt/uniqueapp/__init__.py 2012-01-02 14:29:16 +0000 | |||
387 | +++ ubuntuone/controlpanel/gui/qt/uniqueapp/__init__.py 2012-01-31 21:52:23 +0000 | |||
388 | @@ -20,9 +20,9 @@ | |||
389 | 20 | import sys | 20 | import sys |
390 | 21 | 21 | ||
391 | 22 | if sys.platform == "win32": | 22 | if sys.platform == "win32": |
393 | 23 | import windows as platform | 23 | from ubuntuone.controlpanel.gui.qt.uniqueapp import windows as platform |
394 | 24 | else: | 24 | else: |
396 | 25 | import linux as platform | 25 | from ubuntuone.controlpanel.gui.qt.uniqueapp import linux as platform |
397 | 26 | 26 | ||
398 | 27 | #pylint: disable=C0103 | 27 | #pylint: disable=C0103 |
399 | 28 | UniqueApplication = platform.UniqueApplication | 28 | UniqueApplication = platform.UniqueApplication |
400 | 29 | 29 | ||
401 | === modified file 'ubuntuone/controlpanel/sd_client/__init__.py' | |||
402 | --- ubuntuone/controlpanel/sd_client/__init__.py 2011-08-24 19:56:19 +0000 | |||
403 | +++ ubuntuone/controlpanel/sd_client/__init__.py 2012-01-31 21:52:23 +0000 | |||
404 | @@ -108,6 +108,10 @@ | |||
405 | 108 | """Disable udf_autosubscribe in the syncdaemon.""" | 108 | """Disable udf_autosubscribe in the syncdaemon.""" |
406 | 109 | return self.proxy.enable_udf_autosubscribe(False) | 109 | return self.proxy.enable_udf_autosubscribe(False) |
407 | 110 | 110 | ||
408 | 111 | def get_home_dir(self): | ||
409 | 112 | """Retrieve the root information from syncdaemon.""" | ||
410 | 113 | return self.proxy.get_home_dir() | ||
411 | 114 | |||
412 | 111 | def get_root_dir(self): | 115 | def get_root_dir(self): |
413 | 112 | """Retrieve the root information from syncdaemon.""" | 116 | """Retrieve the root information from syncdaemon.""" |
414 | 113 | return self.proxy.get_root_dir() | 117 | return self.proxy.get_root_dir() |
415 | 114 | 118 | ||
416 | === modified file 'ubuntuone/controlpanel/tests/test_backend.py' | |||
417 | --- ubuntuone/controlpanel/tests/test_backend.py 2011-10-24 21:48:27 +0000 | |||
418 | +++ ubuntuone/controlpanel/tests/test_backend.py 2012-01-31 21:52:23 +0000 | |||
419 | @@ -248,6 +248,10 @@ | |||
420 | 248 | """Stop the file_sync service.""" | 248 | """Stop the file_sync service.""" |
421 | 249 | self.actions.append('stop') | 249 | self.actions.append('stop') |
422 | 250 | 250 | ||
423 | 251 | def get_home_dir(self): | ||
424 | 252 | """Grab the home dir.""" | ||
425 | 253 | return USER_HOME | ||
426 | 254 | |||
427 | 251 | def get_root_dir(self): | 255 | def get_root_dir(self): |
428 | 252 | """Grab the root dir.""" | 256 | """Grab the root dir.""" |
429 | 253 | return ROOT_PATH | 257 | return ROOT_PATH |
430 | @@ -784,10 +788,11 @@ | |||
431 | 784 | self.be.wc.results[QUOTA_API] = SAMPLE_QUOTA_JSON | 788 | self.be.wc.results[QUOTA_API] = SAMPLE_QUOTA_JSON |
432 | 785 | 789 | ||
433 | 786 | # root dir info | 790 | # root dir info |
434 | 791 | display_name = yield self.be._process_path(ROOT_PATH) | ||
435 | 787 | self.root_volume = { | 792 | self.root_volume = { |
436 | 788 | u'volume_id': u'', u'path': ROOT_PATH, u'subscribed': True, | 793 | u'volume_id': u'', u'path': ROOT_PATH, u'subscribed': True, |
437 | 789 | u'type': self.be.ROOT_TYPE, | 794 | u'type': self.be.ROOT_TYPE, |
439 | 790 | u'display_name': self.be._process_path(ROOT_PATH), | 795 | u'display_name': display_name, |
440 | 791 | } | 796 | } |
441 | 792 | 797 | ||
442 | 793 | @inlineCallbacks | 798 | @inlineCallbacks |
443 | @@ -831,7 +836,8 @@ | |||
444 | 831 | folder = folder.copy() | 836 | folder = folder.copy() |
445 | 832 | folder[u'type'] = self.be.FOLDER_TYPE | 837 | folder[u'type'] = self.be.FOLDER_TYPE |
446 | 833 | folder[u'subscribed'] = bool(folder[u'subscribed']) | 838 | folder[u'subscribed'] = bool(folder[u'subscribed']) |
448 | 834 | folder[u'display_name'] = self.be._process_path(folder[u'path']) | 839 | display_name = yield self.be._process_path(folder[u'path']) |
449 | 840 | folder[u'display_name'] = display_name | ||
450 | 835 | folders.append(folder) | 841 | folders.append(folder) |
451 | 836 | 842 | ||
452 | 837 | # sort folders by path | 843 | # sort folders by path |
453 | @@ -863,6 +869,26 @@ | |||
454 | 863 | self.assertEqual(result, expected) | 869 | self.assertEqual(result, expected) |
455 | 864 | 870 | ||
456 | 865 | @inlineCallbacks | 871 | @inlineCallbacks |
457 | 872 | def test_volumes_info_process_path(self): | ||
458 | 873 | """The volumes_info method exercises its callback.""" | ||
459 | 874 | root_path = USER_HOME + os.path.sep + 'My Ubuntu' + USER_HOME | ||
460 | 875 | self.patch(self.be.sd_client, 'get_root_dir', lambda: root_path) | ||
461 | 876 | for item in SAMPLE_FOLDERS: | ||
462 | 877 | path = item[u'path'] | ||
463 | 878 | path = path[len(USER_HOME) + 1:] | ||
464 | 879 | item[u'path'] = os.path.join(root_path, path) | ||
465 | 880 | self.patch(self.be.sd_client, 'shares', SAMPLE_SHARES) | ||
466 | 881 | self.patch(self.be.sd_client, 'folders', SAMPLE_FOLDERS) | ||
467 | 882 | |||
468 | 883 | yield self.be.volumes_info() | ||
469 | 884 | for item in SAMPLE_FOLDERS: | ||
470 | 885 | key = item[u'volume_id'] | ||
471 | 886 | folder = self.be._volumes[key] | ||
472 | 887 | display_name = folder['display_name'] | ||
473 | 888 | prefix = 'My Ubuntu' + USER_HOME | ||
474 | 889 | self.assertTrue(display_name.startswith(prefix)) | ||
475 | 890 | |||
476 | 891 | @inlineCallbacks | ||
477 | 866 | def test_volumes_info_without_storage_info(self): | 892 | def test_volumes_info_without_storage_info(self): |
478 | 867 | """The volumes_info method exercises its callback.""" | 893 | """The volumes_info method exercises its callback.""" |
479 | 868 | self.patch(self.be.sd_client, 'shares', SAMPLE_SHARES) | 894 | self.patch(self.be.sd_client, 'shares', SAMPLE_SHARES) |
480 | 869 | 895 | ||
481 | === modified file 'ubuntuone/controlpanel/tests/test_sd_client.py' | |||
482 | --- ubuntuone/controlpanel/tests/test_sd_client.py 2011-11-21 13:32:44 +0000 | |||
483 | +++ ubuntuone/controlpanel/tests/test_sd_client.py 2012-01-31 21:52:23 +0000 | |||
484 | @@ -34,6 +34,9 @@ | |||
485 | 34 | from ubuntuone.controlpanel import sd_client | 34 | from ubuntuone.controlpanel import sd_client |
486 | 35 | from ubuntuone.controlpanel.tests import TestCase | 35 | from ubuntuone.controlpanel.tests import TestCase |
487 | 36 | 36 | ||
488 | 37 | # Instance of 'SyncDaemonTool' has no 'foo' member | ||
489 | 38 | # pylint: disable=E1101 | ||
490 | 39 | |||
491 | 37 | 40 | ||
492 | 38 | SAMPLE_LIMITS = {'upload': 999, 'download': 838} | 41 | SAMPLE_LIMITS = {'upload': 999, 'download': 838} |
493 | 39 | 42 | ||
494 | @@ -66,9 +69,10 @@ | |||
495 | 66 | called = {} | 69 | called = {} |
496 | 67 | shares = {} | 70 | shares = {} |
497 | 68 | folders = {} | 71 | folders = {} |
501 | 69 | root_dir = os.path.expanduser('~/Ubuntu One') | 72 | home_dir = u'/home/ñandu úser' |
502 | 70 | shares_dir = os.path.expanduser('~/.cache/ubuntuone/shares') | 73 | root_dir = os.path.join(home_dir, u'Ubuntu One') |
503 | 71 | shares_dir_link = os.path.join(root_dir, 'Shared With Me') | 74 | shares_dir = os.path.join(home_dir, u'.cache/ubuntuone/shares') |
504 | 75 | shares_dir_link = os.path.join(root_dir, u'Shared With Me') | ||
505 | 72 | 76 | ||
506 | 73 | @classmethod | 77 | @classmethod |
507 | 74 | def create_share(cls, name, accepted=False, subscribed=False): | 78 | def create_share(cls, name, accepted=False, subscribed=False): |
508 | @@ -299,6 +303,10 @@ | |||
509 | 299 | """Request a rescan from scratch for volume_id.""" | 303 | """Request a rescan from scratch for volume_id.""" |
510 | 300 | self.called['rescan_from_scratch'] = volume_id | 304 | self.called['rescan_from_scratch'] = volume_id |
511 | 301 | 305 | ||
512 | 306 | def get_home_dir(self): | ||
513 | 307 | """Return the root directory.""" | ||
514 | 308 | return self.home_dir | ||
515 | 309 | |||
516 | 302 | def get_root_dir(self): | 310 | def get_root_dir(self): |
517 | 303 | """Return the root directory.""" | 311 | """Return the root directory.""" |
518 | 304 | return self.root_dir | 312 | return self.root_dir |
Looks good!