Merge lp:~ralsina/ubuntuone-control-panel/udf-path-is-not-empty into lp:ubuntuone-control-panel

Proposed by Roberto Alsina
Status: Merged
Approved by: Natalia Bidart
Approved revision: 210
Merged at revision: 208
Proposed branch: lp:~ralsina/ubuntuone-control-panel/udf-path-is-not-empty
Merge into: lp:ubuntuone-control-panel
Diff against target: 44 lines (+9/-3)
3 files modified
ubuntuone/controlpanel/gui/qt/addfolder.py (+4/-2)
ubuntuone/controlpanel/gui/qt/tests/__init__.py (+1/-0)
ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py (+4/-1)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-control-panel/udf-path-is-not-empty
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+73102@code.launchpad.net

Commit message

Don't use a native file dialog, because of a Qt bug libraries can be selected and they are not folders (LP: #835013).

Description of the change

Don't use a native file dialog, because of a Qt bug.

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

The test suite for QT is failing (command used was ./run-tests -qt):

FAILED (skips=2, failures=7, errors=8, successes=575)

review: Needs Fixing
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Since you're referencing a bug in the comment (which is great), please use this notation so we can click on the bug while browsing the code: "LP: #835013". Thanks

207. By Roberto Alsina

Improve FakedFileDialog so more tests pass

208. By Roberto Alsina

fix test

209. By Roberto Alsina

use correct notation for bug

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

> Since you're referencing a bug in the comment (which is great), please use
> this notation so we can click on the bug while browsing the code: "LP:
> #835013". Thanks

Fixed in revno 209

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

> The test suite for QT is failing (command used was ./run-tests -qt):
>
> FAILED (skips=2, failures=7, errors=8, successes=575)

Fixed in revno 209

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

Simple fix: please replace this 'options': 4 by 'options': gui.QtGui.QFileDialog.DontUseNativeDialog. Thanks!

review: Approve
210. By Roberto Alsina

no magic number 4

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/gui/qt/addfolder.py'
2--- ubuntuone/controlpanel/gui/qt/addfolder.py 2011-06-29 13:06:15 +0000
3+++ ubuntuone/controlpanel/gui/qt/addfolder.py 2011-08-29 13:30:28 +0000
4@@ -55,8 +55,10 @@
5 @defer.inlineCallbacks
6 def on_clicked(self):
7 """The 'Sync another folder' button was clicked."""
8- folder = QtGui.QFileDialog.getExistingDirectory(parent=self)
9- folder = unicode(folder)
10+ # The options argument is because of LP: #835013
11+ folder = QtGui.QFileDialog.getExistingDirectory(
12+ parent=self, options=QtGui.QFileDialog.DontUseNativeDialog)
13+ folder = unicode(QtCore.QDir.toNativeSeparators(folder))
14 logger.debug('on_add_folder_button_clicked: user requested folder '
15 'creation for path %r', folder)
16 if folder == '':
17
18=== modified file 'ubuntuone/controlpanel/gui/qt/tests/__init__.py'
19--- ubuntuone/controlpanel/gui/qt/tests/__init__.py 2011-08-26 17:16:16 +0000
20+++ ubuntuone/controlpanel/gui/qt/tests/__init__.py 2011-08-29 13:30:28 +0000
21@@ -154,6 +154,7 @@
22 """Fake a file chooser dialog."""
23
24 response = args = kwargs = None
25+ DontUseNativeDialog = 4
26
27 # Invalid name "getExistingDirectory"
28 # pylint: disable=C0103
29
30=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py'
31--- ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py 2011-07-20 16:31:52 +0000
32+++ ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py 2011-08-29 13:30:28 +0000
33@@ -92,7 +92,10 @@
34 yield self.ui.click()
35
36 self.assertEqual(FakedFileDialog.args, ())
37- self.assertEqual(FakedFileDialog.kwargs, {'parent': self.ui})
38+ self.assertEqual(FakedFileDialog.kwargs, {
39+ 'options': gui.QtGui.QFileDialog.DontUseNativeDialog,
40+ 'parent': self.ui,
41+ })
42
43 @defer.inlineCallbacks
44 def test_does_nothing_if_user_closes_file_chooser(self):

Subscribers

People subscribed via source and target branches