Merge lp:~diegosarmentero/ubuntuone-windows-installer/close-on-license-again into lp:ubuntuone-windows-installer

Proposed by Diego Sarmentero
Status: Merged
Approved by: Roberto Alsina
Approved revision: 78
Merged at revision: 80
Proposed branch: lp:~diegosarmentero/ubuntuone-windows-installer/close-on-license-again
Merge into: lp:ubuntuone-windows-installer
Diff against target: 43 lines (+6/-6)
2 files modified
ubuntuone_installer/gui/qt/gui.py (+2/-2)
ubuntuone_installer/gui/qt/tests/test_gui.py (+4/-4)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-windows-installer/close-on-license-again
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Manuel de la Peña (community) Approve
Review via email: mp+78596@code.launchpad.net

Commit message

Fixed: Wizard is not closed on license agreement screen (LP: #835167).

Description of the change

Fixed: Wizard is not closed on license agreement screen (LP: #835167).

To post a comment you must log in.
Revision history for this message
Manuel de la Peña (mandel) wrote :

What happened here is that the return value of the dialog changed. I think that the best way to approach this would be to have a couple of constants against the ones we can compare. For example:

if AreYouSure(self).exec_() == AreYouSure(self).YES:
    print 'You are sure!'

That way if the value returned changed the code is still valid and the reponsability of ensuring that the dialog works in on the dialog developer and not the user.

review: Needs Fixing
Revision history for this message
Manuel de la Peña (mandel) wrote :

> What happened here is that the return value of the dialog changed. I think
> that the best way to approach this would be to have a couple of constants
> against the ones we can compare. For example:
>
> if AreYouSure(self).exec_() == AreYouSure.YES:
> print 'You are sure!'
>
> That way if the value returned changed the code is still valid and the
> reponsability of ensuring that the dialog works in on the dialog developer and
> not the user.

Remove the (self), sorry for the typo, stupid copy and paste :P

78. By Diego Sarmentero

Improved AreYouSure result comparison.

Revision history for this message
Manuel de la Peña (mandel) wrote :

Much nicer!!!

review: Approve
Revision history for this message
Roberto Alsina (ralsina) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone_installer/gui/qt/gui.py'
2--- ubuntuone_installer/gui/qt/gui.py 2011-09-29 13:26:44 +0000
3+++ ubuntuone_installer/gui/qt/gui.py 2011-10-07 17:42:17 +0000
4@@ -455,12 +455,12 @@
5 if result == 1: # Cancelled
6 qt.utils.start_control_panel()
7 elif self.currentId() == self.LICENSE_PAGE:
8- if not AreYouSure(self).exec_():
9+ if AreYouSure(self).exec_() == QtGui.QDialog.Accepted:
10 qt.utils.uninstall_application()
11 else:
12 return
13 elif self.currentId() != self.CONGRATULATIONS_PAGE:
14- if not AreYouSure(self).exec_():
15+ if AreYouSure(self).exec_() == QtGui.QDialog.Rejected:
16 return
17 if self.close_callback is not None:
18 self.close_callback()
19
20=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
21--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-29 13:26:44 +0000
22+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-10-07 17:42:17 +0000
23@@ -220,8 +220,8 @@
24 self.ui.restart()
25 self.ui.show()
26 self.addCleanup(self.ui.hide)
27- gui.AreYouSure.result = 0
28- self.patch(utils, "uninstall_application", self._set_called)
29+ gui.AreYouSure.result = 1
30+ self.patch(gui.qt.utils, "uninstall_application", self._set_called)
31 self.ui.done(result=0)
32 self.assertTrue(self._called)
33
34@@ -231,8 +231,8 @@
35 self.ui.restart()
36 self.ui.show()
37 self.addCleanup(self.ui.hide)
38- gui.AreYouSure.result = 0
39- self.patch(utils, "uninstall_application", self._set_called)
40+ gui.AreYouSure.result = 1
41+ self.patch(gui.qt.utils, "uninstall_application", self._set_called)
42 self.ui.done(result=0)
43 self.assertTrue(self._called)
44

Subscribers

People subscribed via source and target branches