Merge lp:~system76-dev/ubiquity/trunk into lp:ubiquity
- trunk
- Merge into trunk
Proposed by
Jeremy Soller
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 6540 | ||||
Proposed branch: | lp:~system76-dev/ubiquity/trunk | ||||
Merge into: | lp:ubiquity | ||||
Diff against target: |
419 lines (+103/-110) 7 files modified
d-i/manifest (+5/-3) debian/changelog (+6/-0) debian/control (+1/-1) 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:~system76-dev/ubiquity/trunk | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mathieu Trudel-Lapierre | Needs Information | ||
Review via email: mp+319142@code.launchpad.net |
Commit message
Description of the change
- Add WPA-2 enterprise support using libnm-gtk
- Remove password box from GTK installer, using libnm-gtk for any secure connections
This patch to `libnm-gtk` must also be applied: https:/
To post a comment you must log in.
lp:~system76-dev/ubiquity/trunk
updated
- 6525. By Jeremy Soller
-
Switch to using libnma
- 6526. By Jeremy Soller
-
Fixes for use of libnma
- 6527. By Jeremy Soller
-
Change RemoteConnection to SimpleConnection
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote : | # |
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote : | # |
How did you test this? I've built this in my PPA, and installing it on a live session leads to ubiquity not starting the wireless panel at all (I expected it to still show a list of wireless networks).
review:
Needs Information
lp:~system76-dev/ubiquity/trunk
updated
- 6528. By Jeremy Soller
-
Merge
- 6529. By Jeremy Soller
-
Update changelog
Revision history for this message
Jeremy Soller (jackpot51) wrote : | # |
cyphermox, the wireless network page is skipped if you are connected to a wired network.
lp:~system76-dev/ubiquity/trunk
updated
- 6530. By Jeremy Soller
-
Merge
- 6531. By Jeremy Soller
-
Update changelog
- 6532. By Jeremy Soller
-
Revert manifest to zesty versions
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-04-07 14:17:15 +0000 | |||
3 | +++ d-i/manifest 2017-06-22 16:34:36 +0000 | |||
4 | @@ -1,15 +1,15 @@ | |||
5 | 1 | apt-setup 1:0.104ubuntu5 | 1 | apt-setup 1:0.104ubuntu5 |
6 | 2 | base-installer 1.158ubuntu4 | 2 | base-installer 1.158ubuntu4 |
7 | 3 | bterm-unifont 1.4 | 3 | bterm-unifont 1.4 |
9 | 4 | choose-mirror 2.78ubuntu1 | 4 | choose-mirror 2.75ubuntu1 |
10 | 5 | clock-setup 0.131ubuntu1 | 5 | clock-setup 0.131ubuntu1 |
11 | 6 | console-setup 1.142ubuntu5 | 6 | console-setup 1.142ubuntu5 |
12 | 7 | debian-installer-utils 1.113ubuntu1 | 7 | debian-installer-utils 1.113ubuntu1 |
13 | 8 | flash-kernel 3.0~rc.4ubuntu65 | 8 | flash-kernel 3.0~rc.4ubuntu65 |
14 | 9 | grub-installer 1.128ubuntu7 | 9 | grub-installer 1.128ubuntu7 |
16 | 10 | hw-detect 1.117ubuntu4 | 10 | hw-detect 1.117ubuntu3 |
17 | 11 | localechooser 2.65ubuntu4 | 11 | localechooser 2.65ubuntu4 |
19 | 12 | netcfg 1.138ubuntu5 | 12 | netcfg 1.138ubuntu4 |
20 | 13 | partconf 1.50 | 13 | partconf 1.50 |
21 | 14 | partman-auto 134ubuntu6 | 14 | partman-auto 134ubuntu6 |
22 | 15 | partman-auto-crypto 22ubuntu1 | 15 | partman-auto-crypto 22ubuntu1 |
23 | @@ -24,6 +24,7 @@ | |||
24 | 24 | partman-ext3 86ubuntu1 | 24 | partman-ext3 86ubuntu1 |
25 | 25 | partman-jfs 47 | 25 | partman-jfs 47 |
26 | 26 | partman-lvm 113 | 26 | partman-lvm 113 |
27 | 27 | partman-newworld 34 | ||
28 | 27 | partman-partitioning 114ubuntu2 | 28 | partman-partitioning 114ubuntu2 |
29 | 28 | partman-swapfile 1 | 29 | partman-swapfile 1 |
30 | 29 | partman-target 98ubuntu1 | 30 | partman-target 98ubuntu1 |
31 | @@ -32,3 +33,4 @@ | |||
32 | 32 | preseed 1.71ubuntu4 | 33 | preseed 1.71ubuntu4 |
33 | 33 | tzsetup 1:0.81ubuntu1 | 34 | tzsetup 1:0.81ubuntu1 |
34 | 34 | user-setup 1.63ubuntu4 | 35 | user-setup 1.63ubuntu4 |
35 | 36 | yaboot-installer 1.1.36ubuntu1 | ||
36 | 35 | 37 | ||
37 | === modified file 'debian/changelog' | |||
38 | --- debian/changelog 2017-04-10 02:36:04 +0000 | |||
39 | +++ debian/changelog 2017-06-22 16:34:36 +0000 | |||
40 | @@ -1,3 +1,9 @@ | |||
41 | 1 | ubiquity (17.04.10~system76~1) zesty; urgency=medium | ||
42 | 2 | |||
43 | 3 | * Fix for crashes when selecting a WPA 2 enterprise network | ||
44 | 4 | |||
45 | 5 | -- Jeremy Soller <jeremy@system76.com> Fri, 16 Jun 2017 09:55:28 -0600 | ||
46 | 6 | |||
47 | 1 | ubiquity (17.04.9) zesty; urgency=medium | 7 | ubiquity (17.04.9) zesty; urgency=medium |
48 | 2 | 8 | ||
49 | 3 | * tests/test_misc.py: Really fix test for the 'ta' keymap: check for | 9 | * tests/test_misc.py: Really fix test for the 'ta' keymap: check for |
50 | 4 | 10 | ||
51 | === modified file 'debian/control' | |||
52 | --- debian/control 2016-09-26 19:16:34 +0000 | |||
53 | +++ debian/control 2017-06-22 16:34:36 +0000 | |||
54 | @@ -45,7 +45,7 @@ | |||
55 | 45 | Package: ubiquity-frontend-gtk | 45 | Package: ubiquity-frontend-gtk |
56 | 46 | Architecture: amd64 arm64 armhf i386 powerpc ppc64el | 46 | Architecture: amd64 arm64 armhf i386 powerpc ppc64el |
57 | 47 | Pre-Depends: ${misc:Pre-Depends} | 47 | Pre-Depends: ${misc:Pre-Depends} |
59 | 48 | Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, ubiquity (= ${binary:Version}), python3-dbus, gir1.2-gtk-3.0 (>= 3.20), 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 | 48 | Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, ubiquity (= ${binary:Version}), python3-dbus, gir1.2-gtk-3.0 (>= 3.20), 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 | 49 | Suggests: gnome-control-center | feh | 49 | Suggests: gnome-control-center | feh |
61 | 50 | Conflicts: ubuntu-express-frontend-gtk, espresso-frontend-gtk, ubiquity (<< 2.4.3) | 50 | Conflicts: ubuntu-express-frontend-gtk, espresso-frontend-gtk, ubiquity (<< 2.4.3) |
62 | 51 | Replaces: ubuntu-express-frontend-gtk, espresso-frontend-gtk, ubiquity (<< 2.4.3) | 51 | Replaces: ubuntu-express-frontend-gtk, espresso-frontend-gtk, ubiquity (<< 2.4.3) |
63 | 52 | 52 | ||
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-06-22 16:34:36 +0000 | |||
67 | @@ -4,7 +4,7 @@ | |||
68 | 4 | 4 | ||
69 | 5 | import mock | 5 | import mock |
70 | 6 | 6 | ||
72 | 7 | from ubiquity import gtkwidgets, nm, plugin_manager | 7 | from ubiquity import nm, plugin_manager |
73 | 8 | 8 | ||
74 | 9 | 9 | ||
75 | 10 | class WirelessTests(unittest.TestCase): | 10 | class WirelessTests(unittest.TestCase): |
76 | @@ -22,20 +22,3 @@ | |||
77 | 22 | self.manager = self.nmwidget.view.wifi_model | 22 | self.manager = self.nmwidget.view.wifi_model |
78 | 23 | self.model = self.manager.model | 23 | self.model = self.manager.model |
79 | 24 | self.manager.passphrases_cache = {} | 24 | self.manager.passphrases_cache = {} |
80 | 25 | |||
81 | 26 | @mock.patch('ubiquity.nm.NetworkManager.is_connected') | ||
82 | 27 | def test_secure_ap_can_enter_password(self, is_connected): | ||
83 | 28 | is_connected.return_value = False | ||
84 | 29 | iterator = self.model.append(None, ['/foo', 'Intel', 'Wireless']) | ||
85 | 30 | iterator_insecure = self.model.append(iterator, ['Insecure', False, 0]) | ||
86 | 31 | iterator_secure = self.model.append(iterator, ['Secure', True, 0]) | ||
87 | 32 | gtkwidgets.refresh() | ||
88 | 33 | self.assertFalse(self.nmwidget.hbox.get_sensitive()) | ||
89 | 34 | self.nmwidget.view.set_cursor( | ||
90 | 35 | self.model.get_path(iterator_secure), None, False) | ||
91 | 36 | gtkwidgets.refresh() | ||
92 | 37 | self.assertTrue(self.nmwidget.hbox.get_sensitive()) | ||
93 | 38 | self.nmwidget.view.set_cursor( | ||
94 | 39 | self.model.get_path(iterator_insecure), None, False) | ||
95 | 40 | gtkwidgets.refresh() | ||
96 | 41 | self.assertFalse(self.nmwidget.hbox.get_sensitive()) | ||
97 | 42 | 25 | ||
98 | === modified file 'ubiquity/frontend/gtk_components/nmwidgets.py' | |||
99 | --- ubiquity/frontend/gtk_components/nmwidgets.py 2016-12-01 14:00:11 +0000 | |||
100 | +++ ubiquity/frontend/gtk_components/nmwidgets.py 2017-06-22 16:34:36 +0000 | |||
101 | @@ -1,11 +1,10 @@ | |||
102 | 1 | import string | ||
103 | 2 | |||
104 | 3 | from dbus.mainloop.glib import DBusGMainLoop | 1 | from dbus.mainloop.glib import DBusGMainLoop |
105 | 4 | DBusGMainLoop(set_as_default=True) | 2 | DBusGMainLoop(set_as_default=True) |
106 | 5 | 3 | ||
107 | 6 | from gi.repository import Gtk, GObject, GLib | 4 | from gi.repository import Gtk, GObject, GLib |
108 | 5 | from gi.repository import NM, NMA | ||
109 | 7 | 6 | ||
111 | 8 | from ubiquity.nm import QueuedCaller, NetworkStore, NetworkManager | 7 | from ubiquity.nm import decode_ssid, QueuedCaller, NetworkStore, NetworkManager |
112 | 9 | 8 | ||
113 | 10 | 9 | ||
114 | 11 | class GLibQueuedCaller(QueuedCaller): | 10 | class GLibQueuedCaller(QueuedCaller): |
115 | @@ -92,9 +91,8 @@ | |||
116 | 92 | class NetworkManagerTreeView(Gtk.TreeView): | 91 | class NetworkManagerTreeView(Gtk.TreeView): |
117 | 93 | __gtype_name__ = 'NetworkManagerTreeView' | 92 | __gtype_name__ = 'NetworkManagerTreeView' |
118 | 94 | 93 | ||
120 | 95 | def __init__(self, password_entry=None, state_changed=None): | 94 | def __init__(self, state_changed=None): |
121 | 96 | Gtk.TreeView.__init__(self) | 95 | Gtk.TreeView.__init__(self) |
122 | 97 | self.password_entry = password_entry | ||
123 | 98 | self.configure_icons() | 96 | self.configure_icons() |
124 | 99 | model = GtkNetworkStore() | 97 | model = GtkNetworkStore() |
125 | 100 | model.set_sort_column_id(0, Gtk.SortType.ASCENDING) | 98 | model.set_sort_column_id(0, Gtk.SortType.ASCENDING) |
126 | @@ -102,6 +100,10 @@ | |||
127 | 102 | self.wifi_model = NetworkManager(model, | 100 | self.wifi_model = NetworkManager(model, |
128 | 103 | GLibQueuedCaller, | 101 | GLibQueuedCaller, |
129 | 104 | state_changed) | 102 | state_changed) |
130 | 103 | |||
131 | 104 | self.nm_client = None | ||
132 | 105 | self.nm_connection = None | ||
133 | 106 | |||
134 | 105 | self.set_model(model) | 107 | self.set_model(model) |
135 | 106 | 108 | ||
136 | 107 | ssid_column = Gtk.TreeViewColumn('') | 109 | ssid_column = Gtk.TreeViewColumn('') |
137 | @@ -157,17 +159,21 @@ | |||
138 | 157 | self.expand_row(path, False) | 159 | self.expand_row(path, False) |
139 | 158 | i = model.iter_next(i) | 160 | i = model.iter_next(i) |
140 | 159 | 161 | ||
141 | 162 | def row_activated(self, unused, path, column): | ||
142 | 163 | self.connect_to_selection() | ||
143 | 164 | |||
144 | 160 | def get_state(self): | 165 | def get_state(self): |
145 | 161 | return self.wifi_model.get_state() | 166 | return self.wifi_model.get_state() |
146 | 162 | 167 | ||
147 | 163 | def disconnect_from_ap(self): | 168 | def disconnect_from_ap(self): |
149 | 164 | self.wifi_model.disconnect_from_ap() | 169 | if self.nm_connection: |
150 | 170 | if not self.nm_client: | ||
151 | 171 | self.nm_client = NM.Client.new() | ||
152 | 165 | 172 | ||
158 | 166 | def row_activated(self, unused, path, column): | 173 | self.nm_client.deactivate_connection(self.nm_connection) |
159 | 167 | passphrase = None | 174 | self.nm_connection = None |
160 | 168 | if self.password_entry: | 175 | else: |
161 | 169 | passphrase = self.password_entry.get_text() | 176 | self.wifi_model.disconnect_from_ap() |
157 | 170 | self.connect_to_selection(passphrase) | ||
162 | 171 | 177 | ||
163 | 172 | def configure_icons(self): | 178 | def configure_icons(self): |
164 | 173 | it = Gtk.IconTheme() | 179 | it = Gtk.IconTheme() |
165 | @@ -220,13 +226,6 @@ | |||
166 | 220 | else: | 226 | else: |
167 | 221 | cell.set_property('text', ssid) | 227 | cell.set_property('text', ssid) |
168 | 222 | 228 | ||
169 | 223 | def get_passphrase(self, ssid): | ||
170 | 224 | try: | ||
171 | 225 | cached = self.wifi_model.passphrases_cache[ssid] | ||
172 | 226 | except KeyError: | ||
173 | 227 | return '' | ||
174 | 228 | return cached | ||
175 | 229 | |||
176 | 230 | def is_row_an_ap(self): | 229 | def is_row_an_ap(self): |
177 | 231 | model, iterator = self.get_selection().get_selected() | 230 | model, iterator = self.get_selection().get_selected() |
178 | 232 | if iterator is None: | 231 | if iterator is None: |
179 | @@ -244,12 +243,72 @@ | |||
180 | 244 | else: | 243 | else: |
181 | 245 | return False | 244 | return False |
182 | 246 | 245 | ||
184 | 247 | def connect_to_selection(self, passphrase): | 246 | def find_ap(self, device, ssid): |
185 | 247 | for ap in device.get_access_points(): | ||
186 | 248 | ap_ssid = ap.get_ssid() | ||
187 | 249 | if ap_ssid and decode_ssid(ap_ssid.get_data()) == ssid: | ||
188 | 250 | return ap | ||
189 | 251 | return None | ||
190 | 252 | |||
191 | 253 | def connect_cb(self, client, result, user_data): | ||
192 | 254 | self.nm_connection = client.add_and_activate_connection_finish(result) | ||
193 | 255 | |||
194 | 256 | def connect_dialog_cb(self, dialog, response): | ||
195 | 257 | if response == Gtk.ResponseType.OK: | ||
196 | 258 | connection, device, ap = dialog.get_connection() | ||
197 | 259 | |||
198 | 260 | if not self.nm_client: | ||
199 | 261 | self.nm_client = NM.Client.new() | ||
200 | 262 | |||
201 | 263 | self.nm_client.add_and_activate_connection_async( | ||
202 | 264 | connection, device, None, None, self.connect_cb, None | ||
203 | 265 | ) | ||
204 | 266 | dialog.hide() | ||
205 | 267 | |||
206 | 268 | def connect_to_selection(self): | ||
207 | 248 | model, iterator = self.get_selection().get_selected() | 269 | model, iterator = self.get_selection().get_selected() |
209 | 249 | ssid = model[iterator][0] | 270 | if iterator is None: |
210 | 271 | return | ||
211 | 250 | parent = model.iter_parent(iterator) | 272 | parent = model.iter_parent(iterator) |
212 | 251 | if parent: | 273 | if parent: |
214 | 252 | self.wifi_model.connect_to_ap(model[parent][0], ssid, passphrase) | 274 | try: |
215 | 275 | devid = model[parent][0] | ||
216 | 276 | ssid = model[iterator][0] | ||
217 | 277 | if model[iterator][1]: | ||
218 | 278 | if not self.nm_client: | ||
219 | 279 | self.nm_client = NM.Client.new() | ||
220 | 280 | |||
221 | 281 | device = self.nm_client.get_device_by_path(devid) | ||
222 | 282 | ap = self.find_ap(device, ssid) | ||
223 | 283 | |||
224 | 284 | connection = NM.SimpleConnection() | ||
225 | 285 | connection.add_setting(NM.SettingConnection( | ||
226 | 286 | uuid=NM.utils_uuid_generate() | ||
227 | 287 | )) | ||
228 | 288 | connection.add_setting(NM.SettingWireless( | ||
229 | 289 | ssid=ap.get_property("ssid") | ||
230 | 290 | )) | ||
231 | 291 | |||
232 | 292 | dialog = NMA.WifiDialog.new( | ||
233 | 293 | self.nm_client, | ||
234 | 294 | connection, | ||
235 | 295 | device, | ||
236 | 296 | ap, | ||
237 | 297 | False | ||
238 | 298 | ) | ||
239 | 299 | dialog.connect("response", self.connect_dialog_cb) | ||
240 | 300 | dialog.run() | ||
241 | 301 | else: | ||
242 | 302 | self.wifi_model.connect_to_ap(devid, ssid) | ||
243 | 303 | except Exception as e: | ||
244 | 304 | dialog = Gtk.MessageDialog( | ||
245 | 305 | None, Gtk.DialogFlags.MODAL, | ||
246 | 306 | Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, | ||
247 | 307 | "Failed to connect to wireless network" | ||
248 | 308 | ) | ||
249 | 309 | dialog.format_secondary_text("{}".format(e)) | ||
250 | 310 | dialog.run() | ||
251 | 311 | dialog.hide() | ||
252 | 253 | 312 | ||
253 | 254 | 313 | ||
254 | 255 | GObject.type_register(NetworkManagerTreeView) | 314 | GObject.type_register(NetworkManagerTreeView) |
255 | @@ -262,44 +321,23 @@ | |||
256 | 262 | GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, | 321 | GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, |
257 | 263 | (GObject.TYPE_UINT,)), | 322 | (GObject.TYPE_UINT,)), |
258 | 264 | 'selection_changed': ( | 323 | 'selection_changed': ( |
263 | 265 | GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ()), | 324 | GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ())} |
260 | 266 | 'pw_validated': ( | ||
261 | 267 | GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, | ||
262 | 268 | (GObject.TYPE_BOOLEAN,))} | ||
264 | 269 | 325 | ||
265 | 270 | def __init__(self): | 326 | def __init__(self): |
266 | 271 | Gtk.Box.__init__(self) | 327 | Gtk.Box.__init__(self) |
267 | 272 | self.set_orientation(Gtk.Orientation.VERTICAL) | 328 | self.set_orientation(Gtk.Orientation.VERTICAL) |
268 | 273 | self.set_spacing(12) | 329 | self.set_spacing(12) |
272 | 274 | self.password_entry = Gtk.Entry() | 330 | self.view = NetworkManagerTreeView(self.state_changed) |
270 | 275 | self.view = NetworkManagerTreeView(self.password_entry, | ||
271 | 276 | self.state_changed) | ||
273 | 277 | scrolled_window = Gtk.ScrolledWindow() | 331 | scrolled_window = Gtk.ScrolledWindow() |
274 | 278 | scrolled_window.set_policy( | 332 | scrolled_window.set_policy( |
275 | 279 | Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) | 333 | Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) |
276 | 280 | scrolled_window.set_shadow_type(Gtk.ShadowType.IN) | 334 | scrolled_window.set_shadow_type(Gtk.ShadowType.IN) |
277 | 281 | scrolled_window.add(self.view) | 335 | scrolled_window.add(self.view) |
278 | 282 | self.pack_start(scrolled_window, True, True, 0) | 336 | self.pack_start(scrolled_window, True, True, 0) |
279 | 283 | self.hbox = Gtk.Box(spacing=6) | ||
280 | 284 | self.pack_start(self.hbox, False, True, 0) | ||
281 | 285 | self.password_label = Gtk.Label(label='Password:') | ||
282 | 286 | self.password_entry.set_visibility(False) | ||
283 | 287 | self.password_entry.connect('activate', self.connect_to_ap) | ||
284 | 288 | self.password_entry.connect('changed', self.password_entry_changed) | ||
285 | 289 | self.display_password = Gtk.CheckButton(label='Display password') | ||
286 | 290 | self.display_password.connect('toggled', self.display_password_toggled) | ||
287 | 291 | self.hbox.pack_start(self.password_label, False, True, 0) | ||
288 | 292 | self.hbox.pack_start(self.password_entry, True, True, 0) | ||
289 | 293 | self.hbox.pack_start(self.display_password, False, True, 0) | ||
290 | 294 | self.hbox.set_sensitive(False) | ||
291 | 295 | self.selection = self.view.get_selection() | 337 | self.selection = self.view.get_selection() |
292 | 296 | self.selection.connect('changed', self.changed) | 338 | self.selection.connect('changed', self.changed) |
293 | 297 | self.show_all() | 339 | self.show_all() |
294 | 298 | 340 | ||
295 | 299 | def translate(self, password_label_text, display_password_text): | ||
296 | 300 | self.password_label.set_label(password_label_text) | ||
297 | 301 | self.display_password.set_label(display_password_text) | ||
298 | 302 | |||
299 | 303 | def get_state(self): | 341 | def get_state(self): |
300 | 304 | return self.view.get_state() | 342 | return self.view.get_state() |
301 | 305 | 343 | ||
302 | @@ -315,48 +353,16 @@ | |||
303 | 315 | def state_changed(self, state): | 353 | def state_changed(self, state): |
304 | 316 | self.emit('connection', state) | 354 | self.emit('connection', state) |
305 | 317 | 355 | ||
306 | 318 | def password_is_valid(self): | ||
307 | 319 | passphrase = self.password_entry.get_text() | ||
308 | 320 | if len(passphrase) >= 8 and len(passphrase) < 64: | ||
309 | 321 | return True | ||
310 | 322 | if len(passphrase) == 64: | ||
311 | 323 | for c in passphrase: | ||
312 | 324 | if c not in string.hexdigits: | ||
313 | 325 | return False | ||
314 | 326 | return True | ||
315 | 327 | else: | ||
316 | 328 | return False | ||
317 | 329 | |||
318 | 330 | def connect_to_ap(self, *args): | 356 | def connect_to_ap(self, *args): |
322 | 331 | if self.password_is_valid(): | 357 | self.view.connect_to_selection() |
320 | 332 | passphrase = self.password_entry.get_text() | ||
321 | 333 | self.view.connect_to_selection(passphrase) | ||
323 | 334 | 358 | ||
324 | 335 | def disconnect_from_ap(self): | 359 | def disconnect_from_ap(self): |
325 | 336 | self.view.disconnect_from_ap() | 360 | self.view.disconnect_from_ap() |
326 | 337 | 361 | ||
327 | 338 | def password_entry_changed(self, *args): | ||
328 | 339 | self.emit('pw_validated', self.password_is_valid()) | ||
329 | 340 | |||
330 | 341 | def display_password_toggled(self, *args): | ||
331 | 342 | self.password_entry.set_visibility(self.display_password.get_active()) | ||
332 | 343 | |||
333 | 344 | def changed(self, selection): | 362 | def changed(self, selection): |
334 | 345 | iterator = selection.get_selected()[1] | 363 | iterator = selection.get_selected()[1] |
335 | 346 | if not iterator: | 364 | if not iterator: |
336 | 347 | return | 365 | return |
337 | 348 | row = selection.get_tree_view().get_model()[iterator] | ||
338 | 349 | secure = row[1] | ||
339 | 350 | ssid = row[0] | ||
340 | 351 | if secure: | ||
341 | 352 | self.hbox.set_sensitive(True) | ||
342 | 353 | passphrase = self.view.get_passphrase(ssid) | ||
343 | 354 | self.password_entry.set_text(passphrase) | ||
344 | 355 | self.emit('pw_validated', False) | ||
345 | 356 | else: | ||
346 | 357 | self.hbox.set_sensitive(False) | ||
347 | 358 | self.password_entry.set_text('') | ||
348 | 359 | self.emit('pw_validated', True) | ||
349 | 360 | self.emit('selection_changed') | 366 | self.emit('selection_changed') |
350 | 361 | 367 | ||
351 | 362 | 368 | ||
352 | 363 | 369 | ||
353 | === modified file 'ubiquity/frontend/kde_components/nmwidgets.py' | |||
354 | --- ubiquity/frontend/kde_components/nmwidgets.py 2016-10-06 14:29:28 +0000 | |||
355 | +++ ubiquity/frontend/kde_components/nmwidgets.py 2017-06-22 16:34:36 +0000 | |||
356 | @@ -272,7 +272,13 @@ | |||
357 | 272 | 272 | ||
358 | 273 | def connect_to_selection(self, passphrase): | 273 | def connect_to_selection(self, passphrase): |
359 | 274 | devid, ssid = self._get_selected_row_ids() | 274 | devid, ssid = self._get_selected_row_ids() |
361 | 275 | self.wifi_model.connect_to_ap(devid, ssid, passphrase) | 275 | try: |
362 | 276 | self.wifi_model.connect_to_ap(devid, ssid, passphrase) | ||
363 | 277 | except Exception as e: | ||
364 | 278 | dialog = QtWidgets.QMessageBox() | ||
365 | 279 | dialog.setWindowTitle("Failed to connect to wireless network") | ||
366 | 280 | dialog.setText("{}".format(e)) | ||
367 | 281 | dialog.exec_() | ||
368 | 276 | 282 | ||
369 | 277 | def get_cached_passphrase(self): | 283 | def get_cached_passphrase(self): |
370 | 278 | index = self.currentIndex() | 284 | index = self.currentIndex() |
371 | 279 | 285 | ||
372 | === modified file 'ubiquity/plugins/ubi-wireless.py' | |||
373 | --- ubiquity/plugins/ubi-wireless.py 2016-10-06 03:27:02 +0000 | |||
374 | +++ ubiquity/plugins/ubi-wireless.py 2017-06-22 16:34:36 +0000 | |||
375 | @@ -84,7 +84,6 @@ | |||
376 | 84 | self.nmwidget = builder.get_object('nmwidget') | 84 | self.nmwidget = builder.get_object('nmwidget') |
377 | 85 | self.nmwidget.connect('connection', self.state_changed) | 85 | self.nmwidget.connect('connection', self.state_changed) |
378 | 86 | self.nmwidget.connect('selection_changed', self.selection_changed) | 86 | self.nmwidget.connect('selection_changed', self.selection_changed) |
379 | 87 | self.nmwidget.connect('pw_validated', self.pw_validated) | ||
380 | 88 | self.no_wireless = builder.get_object('no_wireless') | 87 | self.no_wireless = builder.get_object('no_wireless') |
381 | 89 | self.use_wireless = builder.get_object('use_wireless') | 88 | self.use_wireless = builder.get_object('use_wireless') |
382 | 90 | self.use_wireless.connect('toggled', self.wireless_toggled) | 89 | self.use_wireless.connect('toggled', self.wireless_toggled) |
383 | @@ -99,10 +98,6 @@ | |||
384 | 99 | 98 | ||
385 | 100 | def plugin_translate(self, lang): | 99 | def plugin_translate(self, lang): |
386 | 101 | get_s = self.controller.get_string | 100 | get_s = self.controller.get_string |
387 | 102 | label_text = get_s('ubiquity/text/wireless_password_label') | ||
388 | 103 | display_text = get_s('ubiquity/text/wireless_display_password') | ||
389 | 104 | self.nmwidget.translate(label_text, display_text) | ||
390 | 105 | |||
391 | 106 | self.connect_text = get_s('ubiquity/text/connect', lang) | 101 | self.connect_text = get_s('ubiquity/text/connect', lang) |
392 | 107 | self.stop_text = get_s('ubiquity/text/stop', lang) | 102 | self.stop_text = get_s('ubiquity/text/stop', lang) |
393 | 108 | frontend = self.controller._wizard | 103 | frontend = self.controller._wizard |
394 | @@ -141,7 +136,6 @@ | |||
395 | 141 | frontend.connecting_spinner.stop() | 136 | frontend.connecting_spinner.stop() |
396 | 142 | frontend.connecting_label.hide() | 137 | frontend.connecting_label.hide() |
397 | 143 | frontend.translate_widget(frontend.next) | 138 | frontend.translate_widget(frontend.next) |
398 | 144 | self.nmwidget.hbox.set_sensitive(False) | ||
399 | 145 | self.next_normal = True | 139 | self.next_normal = True |
400 | 146 | self.controller.allow_go_forward(True) | 140 | self.controller.allow_go_forward(True) |
401 | 147 | 141 | ||
402 | @@ -179,7 +173,6 @@ | |||
403 | 179 | frontend.connecting_spinner.hide() | 173 | frontend.connecting_spinner.hide() |
404 | 180 | frontend.connecting_spinner.stop() | 174 | frontend.connecting_spinner.stop() |
405 | 181 | frontend.connecting_label.hide() | 175 | frontend.connecting_label.hide() |
406 | 182 | self.controller.allow_go_forward(True) | ||
407 | 183 | 176 | ||
408 | 184 | frontend.translate_widget(frontend.back) | 177 | frontend.translate_widget(frontend.back) |
409 | 185 | self.back_normal = True | 178 | self.back_normal = True |
410 | @@ -196,9 +189,6 @@ | |||
411 | 196 | frontend.back.set_sensitive(True) | 189 | frontend.back.set_sensitive(True) |
412 | 197 | self.selection_changed(None) | 190 | self.selection_changed(None) |
413 | 198 | 191 | ||
414 | 199 | def pw_validated(self, unused, validated): | ||
415 | 200 | self.controller.allow_go_forward(validated) | ||
416 | 201 | |||
417 | 202 | 192 | ||
418 | 203 | class PageKde(WirelessPageBase): | 193 | class PageKde(WirelessPageBase): |
419 | 204 | plugin_breadcrumb = 'ubiquity/text/breadcrumb_wireless' | 194 | plugin_breadcrumb = 'ubiquity/text/breadcrumb_wireless' |
Looks fine to me code-wise; now I'll merge and review functionally.