Merge lp:~ralsina/ubuntuone-windows-installer/start-dashboard into lp:ubuntuone-windows-installer

Proposed by Roberto Alsina
Status: Merged
Approved by: Roberto Alsina
Approved revision: 21
Merged at revision: 24
Proposed branch: lp:~ralsina/ubuntuone-windows-installer/start-dashboard
Merge into: lp:ubuntuone-windows-installer
Diff against target: 60 lines (+26/-1)
2 files modified
ubuntuone_installer/gui/qt/gui.py (+11/-1)
ubuntuone_installer/gui/qt/tests/test_gui.py (+15/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-windows-installer/start-dashboard
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve
Review via email: mp+68140@code.launchpad.net

Commit message

If on windows and frozen, assume the control panel is on the same folder as the wizard.

Description of the change

If on windows and frozen, assume the control panel is on the same folder as the wizard.

To test IRL (not trivial, I know ;-):

* Build a bundle with this branch and trunk from controlpanel and sso.
  You can do this using lp:~ralsina/ubuntuone-windows-installer/fix_809873
  instructions in scripts/README
* Run the wizard
* Click on "start dashboard"
* It should start

Or you can just read the code and/or trust the tests ;-)

To post a comment you must log in.
21. By Roberto Alsina

merge trunk

Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

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-07-28 18:24:58 +0000
3+++ ubuntuone_installer/gui/qt/gui.py 2011-08-02 14:14:50 +0000
4@@ -19,7 +19,9 @@
5
6 """The user interface for the Ubuntu One Installer."""
7
8+import os
9 import subprocess
10+import sys
11
12 import gettext
13
14@@ -459,7 +461,15 @@
15 """The main window is being closed, call any custom callback."""
16 # Finished, not cancelled
17 if result == 1: # Cancelled
18- subprocess.Popen(["ubuntuone-control-panel-qt", ])
19+ # If we are in windows and "frozen", assume it's in
20+ # the same folder as this .exe
21+ if sys.platform == "win32" and hasattr(sys, "frozen"):
22+ cp_path = os.path.join(os.path.dirname(
23+ os.path.abspath(sys.executable)),
24+ "ubuntuone-control-panel-qt.exe")
25+ else:
26+ cp_path = "ubuntuone-control-panel-qt"
27+ subprocess.Popen([cp_path, ])
28 elif self.currentId() != self.CONGRATULATIONS_PAGE:
29 if AreYouSure(self).exec_():
30 return
31
32=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
33--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-07-27 15:09:28 +0000
34+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-08-02 14:14:50 +0000
35@@ -200,10 +200,25 @@
36 """Calling done with result=1, the control panel should be called."""
37 gui.AreYouSure.result = 0
38 self.patch(gui.subprocess, "Popen", self._set_called)
39+ # If it's frozen this test fails because the path
40+ # depends on the location of the exe
41+ if hasattr(gui.sys, "frozen"):
42+ delattr(gui.sys, "frozen")
43 self.ui.done(result=1)
44 self.assertEqual(self._called,
45 ((['ubuntuone-control-panel-qt'],), {}))
46
47+ def test_start_control_panel_frozen(self):
48+ """When frozen, the control-panel has a path."""
49+ gui.AreYouSure.result = 0
50+ help(self.patch)
51+ # I can't patch sys because frozen is not there by default
52+ gui.sys.frozen = True
53+ self.patch(gui.subprocess, "Popen", self._set_called)
54+ self.ui.done(result=1)
55+ self.assertTrue(os.sep in self._called[0][0][0])
56+ self.assertTrue('ubuntuone-control-panel-qt' in self._called[0][0][0])
57+
58 def test_not_start_control_panel_on_cancel(self):
59 """Called done with result=0, control panel should NOT be called."""
60 gui.AreYouSure.result = 0

Subscribers

People subscribed via source and target branches