Merge ~nteodosio/software-properties:valid-magic-wait into software-properties:ubuntu/master

Proposed by Nathan Teodosio
Status: Superseded
Proposed branch: ~nteodosio/software-properties:valid-magic-wait
Merge into: software-properties:ubuntu/master
Diff against target: 25 lines (+7/-2)
1 file modified
softwareproperties/gtk/DialogUaAttach.py (+7/-2)
Reviewer Review Type Date Requested Status
Sebastien Bacher Pending
Review via email: mp+437144@code.launchpad.net

This proposal has been superseded by a proposal from 2023-03-03.

To post a comment you must log in.

Unmerged commits

2d4142e... by Nathan Teodosio

Make PIN validation wait to update UI until magic radio is selected.

https://launchpad.net/bugs/2006940

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/softwareproperties/gtk/DialogUaAttach.py b/softwareproperties/gtk/DialogUaAttach.py
2index 5de167c..b6575ba 100644
3--- a/softwareproperties/gtk/DialogUaAttach.py
4+++ b/softwareproperties/gtk/DialogUaAttach.py
5@@ -144,13 +144,18 @@ class DialogUaAttach:
6 self.dialog.response(Gtk.ResponseType.CANCEL)
7
8 def poll_for_magic_token(self):
9+ def update_state_when_magic_radio_is_active(case):
10+ while not self.magic_radio.get_active():
11+ GLib.usleep(987987)
12+ GLib.idle_add(self.update_state, case)
13+
14 options = MagicAttachWaitOptions(magic_token=self.req_id)
15 try:
16 response = wait(options)
17 self.contract_token = response.contract_token
18- GLib.idle_add(self.update_state, 'pin_validated')
19+ update_state_when_magic_radio_is_active('pin_validated')
20 except MagicAttachTokenError:
21- GLib.idle_add(self.update_state, 'expired')
22+ update_state_when_magic_radio_is_active('expired')
23 except Exception as e:
24 print("Error getting the Ubuntu Pro token: ", e, flush = True)
25 finally:

Subscribers

People subscribed via source and target branches