Merge lp:~dobey/ubuntuone-installer/update-3-0 into lp:ubuntuone-installer/stable-3-0
- update-3-0
- Merge into stable-3-0
Status: | Merged |
---|---|
Approved by: | dobey |
Approved revision: | 36 |
Merged at revision: | 40 |
Proposed branch: | lp:~dobey/ubuntuone-installer/update-3-0 |
Merge into: | lp:ubuntuone-installer/stable-3-0 |
Diff against target: |
282 lines (+99/-55) 3 files modified
data/u1logo.svg (+19/-0) ubuntuone/installer/gui.py (+60/-51) ubuntuone/installer/tests/test_gui.py (+20/-4) |
To merge this branch: | bzr merge lp:~dobey/ubuntuone-installer/update-3-0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Roberto Alsina (community) | Approve | ||
Diego Sarmentero (community) | Approve | ||
Review via email: mp+110590@code.launchpad.net |
Commit message
Replace the logo with an SVG with better proportions
Fix spacing issues
Add handling of errors for cache update and install
Add a page for displaying error information, and to try again or cancel
Update the entire cache, not only the PPA cache that we aren't adding
Remove the code to add the stable PPA as it is unneeded/unused
Description of the change
Roberto Alsina (ralsina) : | # |
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~dobey/ubuntuone-installer/update-3-0 into lp:ubuntuone-installer/stable-3-0 failed. Below is the output from the failed tests.
Traceback (most recent call last):
File "/usr/bin/u1trial", line 337, in <module>
main()
File "/usr/bin/u1trial", line 317, in main
suite = trial_runner.
File "/usr/bin/u1trial", line 196, in get_suite
config[
File "/usr/bin/u1trial", line 180, in _collect_tests
module_suite = self._load_
File "/usr/bin/u1trial", line 120, in _load_unittest
module = __import__(modpath, None, None, [""])
File "/mnt/tarmac/
from ubuntuone.installer import gui
File "/mnt/tarmac/
import aptdaemon.
ImportError: No module named aptdaemon.
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~dobey/ubuntuone-installer/update-3-0 into lp:ubuntuone-installer/stable-3-0 failed. Below is the output from the failed tests.
ubuntuone.
DBusTestCase
runTest ... [OK]
ubuntuone.
GUITestCase
test_error_page ... Traceback (most recent call last):
File "/usr/lib/
result = g.send(result)
File "/mnt/tarmac/
self.dlg = gui.Window()
File "/mnt/tarmac/
self.
File "/mnt/tarmac/
path, 320, 240, True)
File "/usr/lib/
return info.invoke(cls, *args, **kwargs)
gi._glib.GError: Unrecognized image file format
[ERROR]
test_
File "/usr/lib/
result = g.send(result)
File "/mnt/tarmac/
self.dlg = gui.Window()
File "/mnt/tarmac/
self.
File "/mnt/tarmac/
path, 320, 240, True)
File "/usr/lib/
return info.invoke(cls, *args, **kwargs)
gi._glib.GError: Unrecognized image file format
[ERROR]
test_
File "/usr/lib/
result = g.send(result)
File "/mnt/tarmac/
self.dlg = gui.Window()
File "/mnt/tarmac/
self.
File "/mnt/tarmac/
path, 320, 240, True)
File "/usr/lib/
return info.invoke(cls, *args, **kwargs)
gi._glib.GError: Unrecognized image file format
[ERROR]
test_
File "/usr/lib/
result = g.send(result)
File "/mnt/tarmac/
self.dlg = gui.Window()
File "/mnt/tarmac/
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~dobey/ubuntuone-installer/update-3-0 into lp:ubuntuone-installer/stable-3-0 failed. Below is the output from the failed tests.
ubuntuone.
DBusTestCase
runTest ... [OK]
ubuntuone.
GUITestCase
test_error_page ... Traceback (most recent call last):
File "/usr/lib/
result = g.send(result)
File "/mnt/tarmac/
self.dlg = gui.Window()
File "/mnt/tarmac/
self.
File "/mnt/tarmac/
path, 320, 240, True)
File "/usr/lib/
return info.invoke(cls, *args, **kwargs)
gi._glib.GError: Unrecognized image file format
[ERROR]
test_
File "/usr/lib/
result = g.send(result)
File "/mnt/tarmac/
self.dlg = gui.Window()
File "/mnt/tarmac/
self.
File "/mnt/tarmac/
path, 320, 240, True)
File "/usr/lib/
return info.invoke(cls, *args, **kwargs)
gi._glib.GError: Unrecognized image file format
[ERROR]
test_
File "/usr/lib/
result = g.send(result)
File "/mnt/tarmac/
self.dlg = gui.Window()
File "/mnt/tarmac/
self.
File "/mnt/tarmac/
path, 320, 240, True)
File "/usr/lib/
return info.invoke(cls, *args, **kwargs)
gi._glib.GError: Unrecognized image file format
[ERROR]
test_
File "/usr/lib/
result = g.send(result)
File "/mnt/tarmac/
self.dlg = gui.Window()
File "/mnt/tarmac/
Preview Diff
1 | === removed file 'data/u1logo.png' |
2 | Binary files data/u1logo.png 2011-08-24 17:27:17 +0000 and data/u1logo.png 1970-01-01 00:00:00 +0000 differ |
3 | === added file 'data/u1logo.svg' |
4 | --- data/u1logo.svg 1970-01-01 00:00:00 +0000 |
5 | +++ data/u1logo.svg 2012-06-15 18:18:58 +0000 |
6 | @@ -0,0 +1,19 @@ |
7 | +<?xml version="1.0" encoding="UTF-8"?> |
8 | +<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> |
9 | +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> |
10 | +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="122.084px" height="49.5px" viewBox="0 0 122.084 49.5" enable-background="new 0 0 122.084 49.5" xml:space="preserve"> |
11 | +<g> |
12 | + <g> |
13 | + <path fill="#DD4814" d="M23.649,7.29v30.984H13.5V17.713H8.673L14.228,7.29H1.362v22.837c0,2.77,0.288,5.282,0.863,7.551 c0.573,2.269,1.514,4.239,2.813,5.906c1.301,1.666,3.032,2.959,5.164,3.873c2.14,0.913,5.038,1.368,8.164,1.368 c3.6,0,6.915-0.236,9.647-0.699c2.743-0.471,5.087-0.914,6.756-1.333V7.29H23.649z"/> |
14 | + <path fill="#DD4814" d="M53.901,20.038c-1.087,0.273-2.927,0.656-5.254,0.656c-4.04,0-5.48-2.496-5.48-6.033V7.29h2.349v6.866 c0,3.205,0.989,4.464,3.387,4.464c0.986,0,2.322-0.123,2.651-0.249V7.29h2.348V20.038z"/> |
15 | + <path fill="#DD4814" d="M82.605,20.038c-1.084,0.273-2.935,0.656-5.256,0.656c-4.037,0-5.48-2.496-5.48-6.033V7.29h2.351v6.866 c0,3.205,0.985,4.464,3.382,4.464c0.988,0,2.328-0.123,2.657-0.249V7.29h2.346V20.038z"/> |
16 | + <path fill="#DD4814" d="M120.8,20.038c-1.084,0.273-2.934,0.656-5.256,0.656c-4.037,0-5.479-2.496-5.479-6.033V7.29h2.348v6.866 c0,3.205,0.986,4.464,3.388,4.464c0.984,0,2.321-0.123,2.645-0.249V7.29h2.355V20.038z"/> |
17 | + <path fill="#DD4814" d="M59.844,7.871c0.58-0.379,1.864-0.886,3.376-0.886c3.771,0,5.968,2.832,5.968,6.873 c0,4.249-2.625,6.873-6.646,6.873c-2.198,0-3.966-0.379-5.056-0.681V1.229l2.356-0.404V7.871z M59.844,18.377 c0.473,0.132,1.386,0.283,2.673,0.283c2.529,0,4.22-1.742,4.22-4.802c0-2.726-1.09-4.798-3.816-4.798 c-1.283,0-2.497,0.53-3.077,1.01V18.377z"/> |
18 | + <path fill="#DD4814" d="M86.206,7.663c1.083-0.27,2.93-0.656,5.245-0.656c4.16,0,5.469,2.472,5.469,6.024v7.357h-2.347v-6.85 c0-3.25-0.882-4.458-3.376-4.458c-1.011,0-2.294,0.173-2.65,0.248v11.06h-2.341V7.663z"/> |
19 | + <path fill="#DD4814" d="M102.581,7.293h5.095v1.965h-5.095v6.048c0,2.627,0.854,3.301,2.469,3.301c1.407,0,2.34-0.454,2.665-0.581 l0.454,1.941c-0.475,0.229-1.809,0.701-3.326,0.701c-3.523,0-4.607-1.833-4.607-5.335V3.641l2.346-0.405V7.293z"/> |
20 | + <path fill="#333333" d="M57.622,25.197c1.093-0.276,2.953-0.656,5.299-0.656c4.206,0,5.522,2.49,5.522,6.083v7.44h-2.372v-6.93 c0-3.284-0.884-4.511-3.413-4.511c-1.012,0-2.313,0.181-2.667,0.255v11.187h-2.37V25.197z"/> |
21 | + <path fill="#333333" d="M70.471,31.42c0-4.607,2.975-6.86,6.005-6.86c3.511,0,5.488,2.151,5.488,6.63c0,0.199,0,0.55-0.018,0.83 h-9.044c0.196,2.71,1.551,4.137,4.456,4.137c1.627,0,2.804-0.352,3.382-0.628l0.326,1.953c-0.576,0.301-2.161,0.73-3.961,0.73 C72.577,38.212,70.471,35.331,70.471,31.42L70.471,31.42z M79.54,30.145c0.018-2.106-1.182-3.607-3.08-3.607 c-2.159,0-3.308,1.801-3.513,3.607H79.54z"/> |
22 | + <path fill="#333333" d="M55.308,31.389c0,4.115-2.628,6.844-6.189,6.844c-3.557,0-6.186-2.729-6.186-6.844 c0-4.1,2.629-6.829,6.186-6.829C52.68,24.56,55.308,27.29,55.308,31.389L55.308,31.389z M52.877,31.389 c0-2.923-1.478-4.78-3.758-4.78c-2.276,0-3.752,1.857-3.752,4.78c0,2.938,1.476,4.787,3.752,4.787 C51.399,36.176,52.877,34.327,52.877,31.389z"/> |
23 | + </g> |
24 | +</g> |
25 | +</svg> |
26 | \ No newline at end of file |
27 | |
28 | === modified file 'ubuntuone/installer/gui.py' |
29 | --- ubuntuone/installer/gui.py 2012-03-13 20:24:31 +0000 |
30 | +++ ubuntuone/installer/gui.py 2012-06-15 18:18:58 +0000 |
31 | @@ -20,6 +20,7 @@ |
32 | import gettext |
33 | import os |
34 | |
35 | +from aptdaemon.enums import EXIT_SUCCESS |
36 | from gi.repository import Gtk, GObject, GLib, Gdk, GdkPixbuf, Pango |
37 | from ubuntuone.installer import (CLIENT_SHELL_PACKAGE, |
38 | CONTROL_PANEL_COMMAND, |
39 | @@ -109,12 +110,12 @@ |
40 | self.set_position(Gtk.WindowPosition.CENTER) |
41 | |
42 | vbox = Gtk.VBox() |
43 | + vbox.set_border_width(12) |
44 | vbox.set_spacing(24) |
45 | self.add(vbox) |
46 | vbox.show() |
47 | |
48 | self.__header = Gtk.HBox() |
49 | - self.__header.set_border_width(12) |
50 | self.__header.set_spacing(64) |
51 | vbox.pack_start(self.__header, False, False, 0) |
52 | self.__header.show() |
53 | @@ -142,7 +143,7 @@ |
54 | self.__header.pack_end(self.__hlogo, False, False, 0) |
55 | self.__hlogo.show() |
56 | |
57 | - logo = self.__find_data_file('u1logo.png') |
58 | + logo = self.__find_data_file('u1logo.svg') |
59 | if logo: |
60 | self.__hlogo.set_from_file(logo) |
61 | |
62 | @@ -163,11 +164,19 @@ |
63 | self.__notebook.append_page(self.__progress_page, None) |
64 | self.__progress_page.show() |
65 | |
66 | + # Label widget for error text |
67 | + self.__err_label = Gtk.Label('') |
68 | + self.__err_label.set_ellipsize(Pango.EllipsizeMode.MIDDLE) |
69 | + self.__err_label.set_line_wrap(True) |
70 | + |
71 | + self.__error_page = self.__construct_error_page() |
72 | + self.__notebook.append_page(self.__error_page, None) |
73 | + self.__error_page.show() |
74 | + |
75 | vbox.pack_start(self.__notebook, False, False, 0) |
76 | self.__notebook.show() |
77 | |
78 | self.__action_area = Gtk.HButtonBox() |
79 | - self.__action_area.set_border_width(12) |
80 | self.__action_area.set_spacing(12) |
81 | self.__action_area.set_layout(Gtk.ButtonBoxStyle.END) |
82 | vbox.pack_end(self.__action_area, False, True, 0) |
83 | @@ -181,13 +190,20 @@ |
84 | |
85 | self.__main_button = Gtk.Button.new_with_mnemonic(_(u'I_nstall')) |
86 | self.__main_button.set_image(Gtk.Image.new_from_stock( |
87 | - Gtk.STOCK_OK, Gtk.IconSize.BUTTON)) |
88 | + Gtk.STOCK_EXECUTE, Gtk.IconSize.BUTTON)) |
89 | self.__main_button.connect('clicked', lambda x: self.emit( |
90 | 'response', Gtk.ResponseType.OK)) |
91 | self.__action_area.add(self.__main_button) |
92 | self.__main_button.grab_focus() |
93 | self.__main_button.show() |
94 | |
95 | + # Button for error conditions |
96 | + self.__close_button = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE) |
97 | + self.__close_button.connect('clicked', lambda x: self.emit( |
98 | + 'response', Gtk.ResponseType.CANCEL)) |
99 | + self.__action_area.add(self.__close_button) |
100 | + |
101 | + # Button for the external link |
102 | self.__lm_button = Gtk.LinkButton.new_with_label( |
103 | 'https://one.ubuntu.com/', _(u'Learn more')) |
104 | self.__action_area.add(self.__lm_button) |
105 | @@ -246,7 +262,6 @@ |
106 | def __construct_info_page(self): |
107 | """Build the initial info page.""" |
108 | page = Gtk.HBox() |
109 | - page.set_border_width(6) |
110 | page.set_spacing(12) |
111 | page.show() |
112 | |
113 | @@ -259,7 +274,7 @@ |
114 | table = Gtk.Table(5, 2, False) |
115 | table.set_row_spacings(6) |
116 | table.set_col_spacings(12) |
117 | - page.pack_start(table, True, True, 24) |
118 | + page.pack_start(table, True, True, 0) |
119 | table.show() |
120 | |
121 | image = Gtk.Image() |
122 | @@ -322,7 +337,6 @@ |
123 | def __construct_progress_page(self): |
124 | """Build the install progress page.""" |
125 | page = Gtk.VBox() |
126 | - page.set_border_width(24) |
127 | page.set_spacing(6) |
128 | page.show() |
129 | |
130 | @@ -336,42 +350,44 @@ |
131 | |
132 | return page |
133 | |
134 | - def __get_series(self): |
135 | - """Get the series we're running on.""" |
136 | - on_ubuntu = False |
137 | - series = None |
138 | - |
139 | - def get_value(keypair): |
140 | - return keypair.split('=')[1].strip() |
141 | - |
142 | - try: |
143 | - with open('/etc/lsb-release', 'r') as f: |
144 | - for line in f.readlines(): |
145 | - if line.startswith('DISTRIB_ID'): |
146 | - on_ubuntu = get_value(line) == u'Ubuntu' |
147 | - if line.startswith('DISTRIB_CODENAME'): |
148 | - series = get_value(line) |
149 | - if not on_ubuntu or series is None: |
150 | - raise UnsupportedDistribution( |
151 | - 'This distribution is not supported by Ubuntu One.') |
152 | - except (OSError, IOError, UnsupportedDistribution), error: |
153 | - self.__got_error(error) |
154 | - |
155 | - return series |
156 | + def __construct_error_page(self): |
157 | + """A page for showing errors to the user.""" |
158 | + page = Gtk.HBox() |
159 | + page.set_spacing(12) |
160 | + page.show() |
161 | + |
162 | + image = Gtk.Image.new_from_stock(Gtk.STOCK_DIALOG_ERROR, |
163 | + Gtk.IconSize.DIALOG) |
164 | + image.set_alignment(0.5, 0.0) |
165 | + page.pack_start(image, False, False, 0) |
166 | + image.show() |
167 | + |
168 | + # Align and pack the error label |
169 | + self.__err_label.set_alignment(0.0, 0.0) |
170 | + page.pack_start(self.__err_label, True, True, 0) |
171 | + self.__err_label.show() |
172 | + |
173 | + return page |
174 | |
175 | def __got_error(self, error): |
176 | """Got an error trying to set up Ubuntu One.""" |
177 | - print error |
178 | - Gtk.main_quit() |
179 | + self.__cancel_button.hide() |
180 | + self.__main_button.show() |
181 | + self.__close_button.show() |
182 | + self.__err_label.set_text(error) |
183 | + self.__notebook.set_current_page(2) |
184 | |
185 | @inline_callbacks |
186 | def __install_u1(self, *args, **kwargs): |
187 | """Install the packages.""" |
188 | self.__apt_progress.set_fraction(0.0) |
189 | |
190 | - def finished(*args, **kwargs): |
191 | - GLib.spawn_command_line_async(CONTROL_PANEL_COMMAND) |
192 | - Gtk.main_quit() |
193 | + def finished(transaction, exit_status, *args, **kwargs): |
194 | + if exit_status != EXIT_SUCCESS: |
195 | + self.__got_error(transaction.error_details) |
196 | + else: |
197 | + GLib.spawn_command_line_async(CONTROL_PANEL_COMMAND) |
198 | + Gtk.main_quit() |
199 | |
200 | transaction = yield self.client.install_packages( |
201 | package_names=self.__get_package_list()) |
202 | @@ -383,23 +399,15 @@ |
203 | def __update_cache(self, *args, **kwargs): |
204 | """Update the cache.""" |
205 | self.__apt_progress.set_fraction(0.0) |
206 | - transaction = yield self.client.update_cache( |
207 | - sources_list='ubuntuone-stable-ppa.list') |
208 | - transaction.connect('finished', self.__install_u1) |
209 | - self.__apt_progress.set_transaction(transaction) |
210 | - transaction.run() |
211 | - |
212 | - @inline_callbacks |
213 | - def __add_stable_ppa(self): |
214 | - """Add the Ubuntu One 'stable' PPA to apt.""" |
215 | - transaction = yield self.client.add_repository( |
216 | - src_type='deb', |
217 | - uri='http://ppa.launchpad.net/ubuntuone/stable/ubuntu', |
218 | - dist=self.__get_series(), |
219 | - comps=['main'], |
220 | - comment='added by Ubuntu One installer', |
221 | - sourcesfile='ubuntuone-stable-ppa.list') |
222 | - transaction.connect('finished', self.__update_cache) |
223 | + |
224 | + def finished(transaction, exit_status, *args, **kwargs): |
225 | + if exit_status != EXIT_SUCCESS: |
226 | + self.__got_error(transaction.error_details) |
227 | + else: |
228 | + self.__install_u1() |
229 | + |
230 | + transaction = yield self.client.update_cache() |
231 | + transaction.connect('finished', finished) |
232 | self.__apt_progress.set_transaction(transaction) |
233 | transaction.run() |
234 | |
235 | @@ -408,6 +416,7 @@ |
236 | # Hide the buttons |
237 | self.__cancel_button.hide() |
238 | self.__main_button.hide() |
239 | + self.__close_button.hide() |
240 | |
241 | # Switch to the progress page |
242 | self.__notebook.set_current_page(1) |
243 | |
244 | === modified file 'ubuntuone/installer/tests/test_gui.py' |
245 | --- ubuntuone/installer/tests/test_gui.py 2012-02-17 16:01:23 +0000 |
246 | +++ ubuntuone/installer/tests/test_gui.py 2012-06-15 18:18:58 +0000 |
247 | @@ -38,15 +38,31 @@ |
248 | |
249 | def test_page_switched(self): |
250 | """Test the page switching.""" |
251 | - #self.assertEquals(self.dlg.active_page, 0) |
252 | + #self.assertEqual(self.dlg.active_page, 0) |
253 | self.dlg.response(Gtk.ResponseType.OK) |
254 | - self.assertEquals(self.dlg.active_page, 1) |
255 | + self.assertEqual(self.dlg.active_page, 1) |
256 | |
257 | def test_initial_page(self): |
258 | """Test the initial info page.""" |
259 | - self.assertEquals(self.dlg.active_page, 0) |
260 | + self.assertEqual(self.dlg.active_page, 0) |
261 | |
262 | def test_progress_page(self): |
263 | """Test the install progresss page.""" |
264 | self.dlg.response(Gtk.ResponseType.OK) |
265 | - self.assertEquals(self.dlg.active_page, 1) |
266 | + self.assertEqual(self.dlg.active_page, 1) |
267 | + |
268 | + def test_error_page(self): |
269 | + """Test the error page.""" |
270 | + error = u'Just an error.' |
271 | + self.dlg._Window__got_error(error) |
272 | + self.assertEqual(self.dlg.active_page, 2) |
273 | + self.assertEqual(error, self.dlg._Window__err_label.get_text()) |
274 | + |
275 | + def test_update_cache(self): |
276 | + """Test that updating cache succeeds.""" |
277 | + test_update_cache.skip = 'Need to test that cache update works.' |
278 | + |
279 | + def test_update_cache_without_network(self): |
280 | + """Test that updating cache fails cleanly without network.""" |
281 | + test_update_cache_without_network.skip = \ |
282 | + 'Need to test that we do the right thing on cache update failure.' |
+1