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
diff --git a/softwareproperties/gtk/DialogUaAttach.py b/softwareproperties/gtk/DialogUaAttach.py
index 5de167c..b6575ba 100644
--- a/softwareproperties/gtk/DialogUaAttach.py
+++ b/softwareproperties/gtk/DialogUaAttach.py
@@ -144,13 +144,18 @@ class DialogUaAttach:
144 self.dialog.response(Gtk.ResponseType.CANCEL)144 self.dialog.response(Gtk.ResponseType.CANCEL)
145145
146 def poll_for_magic_token(self):146 def poll_for_magic_token(self):
147 def update_state_when_magic_radio_is_active(case):
148 while not self.magic_radio.get_active():
149 GLib.usleep(987987)
150 GLib.idle_add(self.update_state, case)
151
147 options = MagicAttachWaitOptions(magic_token=self.req_id)152 options = MagicAttachWaitOptions(magic_token=self.req_id)
148 try:153 try:
149 response = wait(options)154 response = wait(options)
150 self.contract_token = response.contract_token155 self.contract_token = response.contract_token
151 GLib.idle_add(self.update_state, 'pin_validated')156 update_state_when_magic_radio_is_active('pin_validated')
152 except MagicAttachTokenError:157 except MagicAttachTokenError:
153 GLib.idle_add(self.update_state, 'expired')158 update_state_when_magic_radio_is_active('expired')
154 except Exception as e:159 except Exception as e:
155 print("Error getting the Ubuntu Pro token: ", e, flush = True)160 print("Error getting the Ubuntu Pro token: ", e, flush = True)
156 finally:161 finally:

Subscribers

People subscribed via source and target branches