Merge lp:~xnox/ubiquity/xenial-proposed into lp:~ubuntu-installer/ubiquity/xenial-proposed

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 6456
Proposed branch: lp:~xnox/ubiquity/xenial-proposed
Merge into: lp:~ubuntu-installer/ubiquity/xenial-proposed
Diff against target: 419 lines (+103/-109)
8 files modified
d-i/manifest (+1/-1)
d-i/update-control (+1/-0)
debian/changelog (+8/-0)
debian/control (+2/-2)
tests/test_wireless.py (+1/-18)
ubiquity/frontend/gtk_components/nmwidgets.py (+83/-77)
ubiquity/frontend/kde_components/nmwidgets.py (+7/-1)
ubiquity/plugins/ubi-wireless.py (+0/-10)
To merge this branch: bzr merge lp:~xnox/ubiquity/xenial-proposed
Reviewer Review Type Date Requested Status
Ubuntu Installer Team Pending
Review via email: mp+332864@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

With fixed up network-manager-applet this works fine. Uploading to proposed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'd-i/manifest'
2--- d-i/manifest 2017-07-24 15:35:47 +0000
3+++ d-i/manifest 2017-10-26 13:58:07 +0000
4@@ -3,7 +3,7 @@
5 bterm-unifont 1.4
6 choose-mirror 2.65ubuntu6
7 clock-setup 0.126ubuntu1
8-console-setup 1.108ubuntu15.3
9+console-setup 1.108ubuntu15.4
10 debian-installer-utils 1.113ubuntu1
11 flash-kernel 3.0~rc.4ubuntu62.2
12 grub-installer 1.128ubuntu5.1
13
14=== modified file 'd-i/update-control'
15--- d-i/update-control 2016-03-15 14:18:44 +0000
16+++ d-i/update-control 2017-10-26 13:58:07 +0000
17@@ -39,6 +39,7 @@
18 'dh-di (>= 3)',
19 'dh-systemd',
20 'dpkg-dev (>= 1.14.4)',
21+ 'gir1.2-nma-1.0',
22 'gir1.2-soup-2.4',
23 'gir1.2-timezonemap-1.0',
24 'gir1.2-webkit2-4.0',
25
26=== modified file 'debian/changelog'
27--- debian/changelog 2017-07-24 15:37:02 +0000
28+++ debian/changelog 2017-10-26 13:58:07 +0000
29@@ -1,3 +1,11 @@
30+ubiquity (2.21.63.5) UNRELEASED; urgency=medium
31+
32+ * Cherry-pick support for WPA2 Enterprise. LP: #1107935
33+ * Automatic update of included source packages: console-setup
34+ 1.108ubuntu15.4.
35+
36+ -- Dimitri John Ledkov <xnox@ubuntu.com> Thu, 26 Oct 2017 12:25:06 +0100
37+
38 ubiquity (2.21.63.4) xenial; urgency=medium
39
40 * src/panel/panel.c: set stricter size/extend rules for the panel so that it
41
42=== modified file 'debian/control'
43--- debian/control 2016-03-15 14:18:44 +0000
44+++ debian/control 2017-10-26 13:58:07 +0000
45@@ -3,7 +3,7 @@
46 Priority: optional
47 Maintainer: Ubuntu Installer Team <ubuntu-installer@lists.ubuntu.com>
48 Uploaders: Colin Watson <cjwatson@ubuntu.com>, Evan Dandrea <ev@ubuntu.com>
49-Build-Depends: adwaita-icon-theme, apt, autopoint, bf-utf-source, check, dctrl-tools, debconf (>= 1.5.43), debconf-utils, debhelper (>= 9), devio, dh-autoreconf, dh-di (>= 3), dh-systemd, dpkg-dev (>= 1.15.7), gir1.2-soup-2.4, gir1.2-timezonemap-1.0, gir1.2-webkit2-4.0, gir1.2-xkl-1.0, gobject-introspection, imagemagick, intltool (>= 0.40.0), intltool-debian (>= 0.30+20040212), iso-codes, isoquery, keymapper (>= 0.5.3-7), libbogl-dev, libcairo2-dev, libdebconfclient0-dev (>= 0.68), libdebian-installer4-dev (>= 0.76), libgirepository1.0-dev, libglib2.0-dev, libgtk-3-dev, libido3-0.1-dev, libindicator3-dev, libiw-dev (>= 27+28pre9), liblocale-gettext-perl, libparted-dev (>= 2.2), librsvg2-bin, libsubunit-dev, locales, pep8, pkg-config, po-debconf (>= 1.0), pyflakes3 (>= 0.7.2), python-gi-dev, python-scour, python3-all (>= 3.1), python3-apt (>= 0.7.100.3~), python3-cairo, python3-dbus, python3-gi, python3-gi-cairo, python3-icu (>= 1.0), python3-mock (>= 0.7.0), python3-pam, tzdata, ubuntu-artwork, udev, wget, xkb-data (>= 0.9), xkb-data-i18n, xvfb
50+Build-Depends: adwaita-icon-theme, apt, autopoint, bf-utf-source, check, dctrl-tools, debconf (>= 1.5.43), debconf-utils, debhelper (>= 9), devio, dh-autoreconf, dh-di (>= 3), dh-systemd, dpkg-dev (>= 1.15.7), gir1.2-nma-1.0, gir1.2-soup-2.4, gir1.2-timezonemap-1.0, gir1.2-webkit2-4.0, gir1.2-xkl-1.0, gobject-introspection, imagemagick, intltool (>= 0.40.0), intltool-debian (>= 0.30+20040212), iso-codes, isoquery, keymapper (>= 0.5.3-7), libbogl-dev, libcairo2-dev, libdebconfclient0-dev (>= 0.68), libdebian-installer4-dev (>= 0.76), libgirepository1.0-dev, libglib2.0-dev, libgtk-3-dev, libido3-0.1-dev, libindicator3-dev, libiw-dev (>= 27+28pre9), liblocale-gettext-perl, libparted-dev (>= 2.2), librsvg2-bin, libsubunit-dev, locales, pep8, pkg-config, po-debconf (>= 1.0), pyflakes3 (>= 0.7.2), python-gi-dev, python-scour, python3-all (>= 3.1), python3-apt (>= 0.7.100.3~), python3-cairo, python3-dbus, python3-gi, python3-gi-cairo, python3-icu (>= 1.0), python3-mock (>= 0.7.0), python3-pam, tzdata, ubuntu-artwork, udev, wget, xkb-data (>= 0.9), xkb-data-i18n, xvfb
51 Standards-Version: 3.9.4
52 X-Python3-Version: >= 3.1
53 XS-Testsuite: autopkgtest
54@@ -45,7 +45,7 @@
55 Package: ubiquity-frontend-gtk
56 Architecture: amd64 arm64 armhf i386 powerpc ppc64el
57 Pre-Depends: ${misc:Pre-Depends}
58-Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, ubiquity (= ${binary:Version}), python3-dbus, gir1.2-gtk-3.0, gir1.2-pango-1.0, gir1.2-soup-2.4, gir1.2-vte-2.91, gir1.2-webkit2-4.0, iso-codes, metacity | marco | xfwm4 | matchbox-window-manager | lubuntu-default-settings | openbox | gnome-shell, gir1.2-xkl-1.0, gir1.2-timezonemap-1.0, python3-gi, python3-cairo, python3-gi-cairo, gir1.2-appindicator3-0.1, busybox-static | busybox
59+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, ubiquity (= ${binary:Version}), python3-dbus, gir1.2-gtk-3.0, gir1.2-nma-1.0, gir1.2-pango-1.0, gir1.2-soup-2.4, gir1.2-vte-2.91, gir1.2-webkit2-4.0, iso-codes, metacity | marco | xfwm4 | matchbox-window-manager | lubuntu-default-settings | openbox | gnome-shell, gir1.2-xkl-1.0, gir1.2-timezonemap-1.0, python3-gi, python3-cairo, python3-gi-cairo, gir1.2-appindicator3-0.1, busybox-static | busybox
60 Suggests: gnome-control-center | feh
61 Conflicts: ubuntu-express-frontend-gtk, espresso-frontend-gtk, ubiquity (<< 2.4.3)
62 Replaces: ubuntu-express-frontend-gtk, espresso-frontend-gtk, ubiquity (<< 2.4.3)
63
64=== modified file 'tests/test_wireless.py'
65--- tests/test_wireless.py 2012-07-16 14:29:13 +0000
66+++ tests/test_wireless.py 2017-10-26 13:58:07 +0000
67@@ -4,7 +4,7 @@
68
69 import mock
70
71-from ubiquity import gtkwidgets, nm, plugin_manager
72+from ubiquity import nm, plugin_manager
73
74
75 class WirelessTests(unittest.TestCase):
76@@ -22,20 +22,3 @@
77 self.manager = self.nmwidget.view.wifi_model
78 self.model = self.manager.model
79 self.manager.passphrases_cache = {}
80-
81- @mock.patch('ubiquity.nm.NetworkManager.is_connected')
82- def test_secure_ap_can_enter_password(self, is_connected):
83- is_connected.return_value = False
84- iterator = self.model.append(None, ['/foo', 'Intel', 'Wireless'])
85- iterator_insecure = self.model.append(iterator, ['Insecure', False, 0])
86- iterator_secure = self.model.append(iterator, ['Secure', True, 0])
87- gtkwidgets.refresh()
88- self.assertFalse(self.nmwidget.hbox.get_sensitive())
89- self.nmwidget.view.set_cursor(
90- self.model.get_path(iterator_secure), None, False)
91- gtkwidgets.refresh()
92- self.assertTrue(self.nmwidget.hbox.get_sensitive())
93- self.nmwidget.view.set_cursor(
94- self.model.get_path(iterator_insecure), None, False)
95- gtkwidgets.refresh()
96- self.assertFalse(self.nmwidget.hbox.get_sensitive())
97
98=== modified file 'ubiquity/frontend/gtk_components/nmwidgets.py'
99--- ubiquity/frontend/gtk_components/nmwidgets.py 2014-06-30 13:09:16 +0000
100+++ ubiquity/frontend/gtk_components/nmwidgets.py 2017-10-26 13:58:07 +0000
101@@ -1,11 +1,10 @@
102-import string
103-
104 from dbus.mainloop.glib import DBusGMainLoop
105 DBusGMainLoop(set_as_default=True)
106
107 from gi.repository import Gtk, GObject, GLib
108+from gi.repository import NM, NMA
109
110-from ubiquity.nm import QueuedCaller, NetworkStore, NetworkManager
111+from ubiquity.nm import decode_ssid, QueuedCaller, NetworkStore, NetworkManager
112
113
114 class GLibQueuedCaller(QueuedCaller):
115@@ -92,9 +91,8 @@
116 class NetworkManagerTreeView(Gtk.TreeView):
117 __gtype_name__ = 'NetworkManagerTreeView'
118
119- def __init__(self, password_entry=None, state_changed=None):
120+ def __init__(self, state_changed=None):
121 Gtk.TreeView.__init__(self)
122- self.password_entry = password_entry
123 self.configure_icons()
124 model = GtkNetworkStore()
125 model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
126@@ -102,6 +100,10 @@
127 self.wifi_model = NetworkManager(model,
128 GLibQueuedCaller,
129 state_changed)
130+
131+ self.nm_client = None
132+ self.nm_connection = None
133+
134 self.set_model(model)
135
136 ssid_column = Gtk.TreeViewColumn('')
137@@ -157,17 +159,21 @@
138 self.expand_row(path, False)
139 i = model.iter_next(i)
140
141+ def row_activated(self, unused, path, column):
142+ self.connect_to_selection()
143+
144 def get_state(self):
145 return self.wifi_model.get_state()
146
147 def disconnect_from_ap(self):
148- self.wifi_model.disconnect_from_ap()
149+ if self.nm_connection:
150+ if not self.nm_client:
151+ self.nm_client = NM.Client.new()
152
153- def row_activated(self, unused, path, column):
154- passphrase = None
155- if self.password_entry:
156- passphrase = self.password_entry.get_text()
157- self.connect_to_selection(passphrase)
158+ self.nm_client.deactivate_connection(self.nm_connection)
159+ self.nm_connection = None
160+ else:
161+ self.wifi_model.disconnect_from_ap()
162
163 def configure_icons(self):
164 it = Gtk.IconTheme()
165@@ -220,13 +226,6 @@
166 else:
167 cell.set_property('text', ssid)
168
169- def get_passphrase(self, ssid):
170- try:
171- cached = self.wifi_model.passphrases_cache[ssid]
172- except KeyError:
173- return ''
174- return cached
175-
176 def is_row_an_ap(self):
177 model, iterator = self.get_selection().get_selected()
178 if iterator is None:
179@@ -244,12 +243,72 @@
180 else:
181 return False
182
183- def connect_to_selection(self, passphrase):
184+ def find_ap(self, device, ssid):
185+ for ap in device.get_access_points():
186+ ap_ssid = ap.get_ssid()
187+ if ap_ssid and decode_ssid(ap_ssid.get_data()) == ssid:
188+ return ap
189+ return None
190+
191+ def connect_cb(self, client, result, user_data):
192+ self.nm_connection = client.add_and_activate_connection_finish(result)
193+
194+ def connect_dialog_cb(self, dialog, response):
195+ if response == Gtk.ResponseType.OK:
196+ connection, device, ap = dialog.get_connection()
197+
198+ if not self.nm_client:
199+ self.nm_client = NM.Client.new()
200+
201+ self.nm_client.add_and_activate_connection_async(
202+ connection, device, None, None, self.connect_cb, None
203+ )
204+ dialog.hide()
205+
206+ def connect_to_selection(self):
207 model, iterator = self.get_selection().get_selected()
208- ssid = model[iterator][0]
209+ if iterator is None:
210+ return
211 parent = model.iter_parent(iterator)
212 if parent:
213- self.wifi_model.connect_to_ap(model[parent][0], ssid, passphrase)
214+ try:
215+ devid = model[parent][0]
216+ ssid = model[iterator][0]
217+ if model[iterator][1]:
218+ if not self.nm_client:
219+ self.nm_client = NM.Client.new()
220+
221+ device = self.nm_client.get_device_by_path(devid)
222+ ap = self.find_ap(device, ssid)
223+
224+ connection = NM.SimpleConnection()
225+ connection.add_setting(NM.SettingConnection(
226+ uuid=NM.utils_uuid_generate()
227+ ))
228+ connection.add_setting(NM.SettingWireless(
229+ ssid=ap.get_property("ssid")
230+ ))
231+
232+ dialog = NMA.WifiDialog.new(
233+ self.nm_client,
234+ connection,
235+ device,
236+ ap,
237+ False
238+ )
239+ dialog.connect("response", self.connect_dialog_cb)
240+ dialog.run()
241+ else:
242+ self.wifi_model.connect_to_ap(devid, ssid)
243+ except Exception as e:
244+ dialog = Gtk.MessageDialog(
245+ None, Gtk.DialogFlags.MODAL,
246+ Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE,
247+ "Failed to connect to wireless network"
248+ )
249+ dialog.format_secondary_text("{}".format(e))
250+ dialog.run()
251+ dialog.hide()
252
253 GObject.type_register(NetworkManagerTreeView)
254
255@@ -261,44 +320,23 @@
256 GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE,
257 (GObject.TYPE_UINT,)),
258 'selection_changed': (
259- GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ()),
260- 'pw_validated': (
261- GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE,
262- (GObject.TYPE_BOOLEAN,))}
263+ GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ())}
264
265 def __init__(self):
266 Gtk.Box.__init__(self)
267 self.set_orientation(Gtk.Orientation.VERTICAL)
268 self.set_spacing(12)
269- self.password_entry = Gtk.Entry()
270- self.view = NetworkManagerTreeView(self.password_entry,
271- self.state_changed)
272+ self.view = NetworkManagerTreeView(self.state_changed)
273 scrolled_window = Gtk.ScrolledWindow()
274 scrolled_window.set_policy(
275 Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
276 scrolled_window.set_shadow_type(Gtk.ShadowType.IN)
277 scrolled_window.add(self.view)
278 self.pack_start(scrolled_window, True, True, 0)
279- self.hbox = Gtk.Box(spacing=6)
280- self.pack_start(self.hbox, False, True, 0)
281- self.password_label = Gtk.Label(label='Password:')
282- self.password_entry.set_visibility(False)
283- self.password_entry.connect('activate', self.connect_to_ap)
284- self.password_entry.connect('changed', self.password_entry_changed)
285- self.display_password = Gtk.CheckButton(label='Display password')
286- self.display_password.connect('toggled', self.display_password_toggled)
287- self.hbox.pack_start(self.password_label, False, True, 0)
288- self.hbox.pack_start(self.password_entry, True, True, 0)
289- self.hbox.pack_start(self.display_password, False, True, 0)
290- self.hbox.set_sensitive(False)
291 self.selection = self.view.get_selection()
292 self.selection.connect('changed', self.changed)
293 self.show_all()
294
295- def translate(self, password_label_text, display_password_text):
296- self.password_label.set_label(password_label_text)
297- self.display_password.set_label(display_password_text)
298-
299 def get_state(self):
300 return self.view.get_state()
301
302@@ -314,48 +352,16 @@
303 def state_changed(self, state):
304 self.emit('connection', state)
305
306- def password_is_valid(self):
307- passphrase = self.password_entry.get_text()
308- if len(passphrase) >= 8 and len(passphrase) < 64:
309- return True
310- if len(passphrase) == 64:
311- for c in passphrase:
312- if c not in string.hexdigits:
313- return False
314- return True
315- else:
316- return False
317-
318 def connect_to_ap(self, *args):
319- if self.password_is_valid():
320- passphrase = self.password_entry.get_text()
321- self.view.connect_to_selection(passphrase)
322+ self.view.connect_to_selection()
323
324 def disconnect_from_ap(self):
325 self.view.disconnect_from_ap()
326
327- def password_entry_changed(self, *args):
328- self.emit('pw_validated', self.password_is_valid())
329-
330- def display_password_toggled(self, *args):
331- self.password_entry.set_visibility(self.display_password.get_active())
332-
333 def changed(self, selection):
334 iterator = selection.get_selected()[1]
335 if not iterator:
336 return
337- row = selection.get_tree_view().get_model()[iterator]
338- secure = row[1]
339- ssid = row[0]
340- if secure:
341- self.hbox.set_sensitive(True)
342- passphrase = self.view.get_passphrase(ssid)
343- self.password_entry.set_text(passphrase)
344- self.emit('pw_validated', False)
345- else:
346- self.hbox.set_sensitive(False)
347- self.password_entry.set_text('')
348- self.emit('pw_validated', True)
349 self.emit('selection_changed')
350
351 GObject.type_register(NetworkManagerWidget)
352
353=== modified file 'ubiquity/frontend/kde_components/nmwidgets.py'
354--- ubiquity/frontend/kde_components/nmwidgets.py 2015-08-31 16:30:49 +0000
355+++ ubiquity/frontend/kde_components/nmwidgets.py 2017-10-26 13:58:07 +0000
356@@ -268,7 +268,13 @@
357
358 def connect_to_selection(self, passphrase):
359 devid, ssid = self._get_selected_row_ids()
360- self.wifi_model.connect_to_ap(devid, ssid, passphrase)
361+ try:
362+ self.wifi_model.connect_to_ap(devid, ssid, passphrase)
363+ except Exception as e:
364+ dialog = QtGui.QMessageBox()
365+ dialog.setWindowTitle("Failed to connect to wireless network")
366+ dialog.setText("{}".format(e))
367+ dialog.exec_()
368
369 def get_cached_passphrase(self):
370 index = self.currentIndex()
371
372=== modified file 'ubiquity/plugins/ubi-wireless.py'
373--- ubiquity/plugins/ubi-wireless.py 2014-06-30 13:09:16 +0000
374+++ ubiquity/plugins/ubi-wireless.py 2017-10-26 13:58:07 +0000
375@@ -83,7 +83,6 @@
376 self.nmwidget = builder.get_object('nmwidget')
377 self.nmwidget.connect('connection', self.state_changed)
378 self.nmwidget.connect('selection_changed', self.selection_changed)
379- self.nmwidget.connect('pw_validated', self.pw_validated)
380 self.no_wireless = builder.get_object('no_wireless')
381 self.use_wireless = builder.get_object('use_wireless')
382 self.use_wireless.connect('toggled', self.wireless_toggled)
383@@ -98,10 +97,6 @@
384
385 def plugin_translate(self, lang):
386 get_s = self.controller.get_string
387- label_text = get_s('ubiquity/text/wireless_password_label')
388- display_text = get_s('ubiquity/text/wireless_display_password')
389- self.nmwidget.translate(label_text, display_text)
390-
391 self.connect_text = get_s('ubiquity/text/connect', lang)
392 self.stop_text = get_s('ubiquity/text/stop', lang)
393 frontend = self.controller._wizard
394@@ -140,7 +135,6 @@
395 frontend.connecting_spinner.stop()
396 frontend.connecting_label.hide()
397 frontend.translate_widget(frontend.next)
398- self.nmwidget.hbox.set_sensitive(False)
399 self.next_normal = True
400 self.controller.allow_go_forward(True)
401
402@@ -178,7 +172,6 @@
403 frontend.connecting_spinner.hide()
404 frontend.connecting_spinner.stop()
405 frontend.connecting_label.hide()
406- self.controller.allow_go_forward(True)
407
408 frontend.translate_widget(frontend.back)
409 self.back_normal = True
410@@ -195,9 +188,6 @@
411 frontend.back.set_sensitive(True)
412 self.selection_changed(None)
413
414- def pw_validated(self, unused, validated):
415- self.controller.allow_go_forward(validated)
416-
417
418 class PageKde(WirelessPageBase):
419 plugin_breadcrumb = 'ubiquity/text/breadcrumb_wireless'

Subscribers

People subscribed via source and target branches