twizard: focus password field (fix #7048) - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 1c52203346f9049f6c3fe201f672960339d8273b DIR parent 8bdbcf73d9796e1eb5f77391667372229d1f1a33 HTML Author: ThomasV <thomasv@electrum.org> Date: Sun, 21 Feb 2021 11:41:34 +0100 wizard: focus password field (fix #7048) Diffstat: M electrum/gui/qt/installwizard.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) --- DIR diff --git a/electrum/gui/qt/installwizard.py b/electrum/gui/qt/installwizard.py t@@ -425,8 +425,10 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): self.please_wait.setVisible(False) def exec_layout(self, layout, title=None, raise_on_cancel=True, - next_enabled=True): + next_enabled=True, focused_widget=None): self.set_layout(layout, title, next_enabled) + if focused_widget: + focused_widget.setFocus() result = self.loop.exec_() if not result and raise_on_cancel: raise UserCancelled() t@@ -521,14 +523,15 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): return slayout.is_ext def pw_layout(self, msg, kind, force_disable_encrypt_cb): - playout = PasswordLayout(msg=msg, kind=kind, OK_button=self.next_button, - force_disable_encrypt_cb=force_disable_encrypt_cb) - playout.encrypt_cb.setChecked(True) + pw_layout = PasswordLayout( + msg=msg, kind=kind, OK_button=self.next_button, + force_disable_encrypt_cb=force_disable_encrypt_cb) + pw_layout.encrypt_cb.setChecked(True) try: - self.exec_layout(playout.layout()) - return playout.new_password(), playout.encrypt_cb.isChecked() + self.exec_layout(pw_layout.layout(), focused_widget=pw_layout.new_pw) + return pw_layout.new_password(), pw_layout.encrypt_cb.isChecked() finally: - playout.clear_password_fields() + pw_layout.clear_password_fields() @wizard_dialog def request_password(self, run_next, force_disable_encrypt_cb=False):