electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 112ad72ceec6decfa2a5afa84fd411f5b8852a64
parent 731756f6e86a009dc3bd85dc72c5d5a8e897637a
Author: SomberNight <somber.night@protonmail.com>
Date:   Wed, 23 Dec 2020 17:34:21 +0100

qt: follow-up passing-around-config

follow-up b28b3994c7c879d43325faa8db8f4691be1f920f

E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\main_window.py", line 670, in new_wallet
    self.gui_object.start_new_window(full_path, None)
  File "...\electrum\electrum\gui\qt\__init__.py", line 245, in wrapper
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\gui\qt\__init__.py", line 269, in start_new_window
    wallet = self._start_wizard_to_select_or_create_wallet(path)
  File "...\electrum\electrum\gui\qt\__init__.py", line 311, in _start_wizard_to_select_or_create_wallet
    wizard.run('new')
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 153, in new
    self.choice_dialog(title=title, message=message, choices=choices, run_next=self.on_wallet_type)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 193, in on_wallet_type
    self.run(action)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 201, in choose_multisig
    self.multisig_dialog(run_next=on_multisig)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 200, in on_multisig
    self.run('choose_keystore')
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 225, in choose_keystore
    self.choice_dialog(title=title, message=message, choices=choices, run_next=self.run)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 275, in choose_hw_device
    self._choose_hw_device(purpose=purpose, storage=storage)
  File "...\electrum\electrum\base_wizard.py", line 358, in _choose_hw_device
    self.choice_dialog(title=title, message=msg, choices=choices,
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 359, in <lambda>
    run_next=lambda *args: self.on_device(*args, purpose=purpose, storage=storage))
  File "...\electrum\electrum\base_wizard.py", line 394, in on_device
    self.derivation_and_script_type_dialog(f)
  File "...\electrum\electrum\base_wizard.py", line 441, in derivation_and_script_type_dialog
    self.derivation_and_script_type_gui_specific_dialog(
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 393, in f
    self.run('on_hw_derivation', name, device_info, derivation, script_type)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 490, in on_hw_derivation
    self.on_keystore(k)
  File "...\electrum\electrum\base_wizard.py", line 592, in on_keystore
    self.run('show_xpub_and_add_cosigners', xpub)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 686, in show_xpub_and_add_cosigners
    self.show_xpub_dialog(xpub=xpub, run_next=lambda x: self.run('choose_keystore'))
  File "...\electrum\electrum\gui\qt\installwizard.py", line 106, in func_wrapper
    out = func(*args, **kwargs)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 700, in show_xpub_dialog
    layout = SeedLayout(xpub, title=msg, icon=False, for_seed_words=False)
  File "...\electrum\electrum\gui\qt\seed_dialog.py", line 108, in __init__
    self.seed_e = ShowQRTextEdit(config=self.config)
AttributeError: 'SeedLayout' object has no attribute 'config'

Diffstat:
Melectrum/gui/qt/installwizard.py | 26++++++++++++++++++++++----
Melectrum/gui/qt/main_window.py | 2+-
Melectrum/gui/qt/seed_dialog.py | 27+++++++++++++++++++++++----
3 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/electrum/gui/qt/installwizard.py b/electrum/gui/qt/installwizard.py @@ -452,7 +452,13 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): return slayout.get_text() def seed_input(self, title, message, is_seed, options): - slayout = SeedLayout(title=message, is_seed=is_seed, options=options, parent=self) + slayout = SeedLayout( + title=message, + is_seed=is_seed, + options=options, + parent=self, + config=self.config, + ) self.exec_layout(slayout, title, next_enabled=False) return slayout.get_seed(), slayout.is_bip39, slayout.is_ext @@ -500,8 +506,14 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): @wizard_dialog def show_seed_dialog(self, run_next, seed_text): - title = _("Your wallet generation seed is:") - slayout = SeedLayout(seed=seed_text, title=title, msg=True, options=['ext']) + title = _("Your wallet generation seed is:") + slayout = SeedLayout( + seed=seed_text, + title=title, + msg=True, + options=['ext'], + config=self.config, + ) self.exec_layout(slayout) return slayout.is_ext @@ -697,7 +709,13 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): _("Please share it with your cosigners.") ]) vbox = QVBoxLayout() - layout = SeedLayout(xpub, title=msg, icon=False, for_seed_words=False) + layout = SeedLayout( + xpub, + title=msg, + icon=False, + for_seed_words=False, + config=self.config, + ) vbox.addLayout(layout.layout()) self.exec_layout(vbox, _('Master Public Key')) return None diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py @@ -2430,7 +2430,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): self.show_error(repr(e)) return from .seed_dialog import SeedDialog - d = SeedDialog(self, seed, passphrase) + d = SeedDialog(self, seed, passphrase, config=self.config) d.exec_() def show_qrcode(self, data, title = _("QR code"), parent=None, *, diff --git a/electrum/gui/qt/seed_dialog.py b/electrum/gui/qt/seed_dialog.py @@ -94,11 +94,24 @@ class SeedLayout(QVBoxLayout): self.is_ext = cb_ext.isChecked() if 'ext' in self.options else False self.is_bip39 = cb_bip39.isChecked() if 'bip39' in self.options else False - def __init__(self, seed=None, title=None, icon=True, msg=None, options=None, - is_seed=None, passphrase=None, parent=None, for_seed_words=True): + def __init__( + self, + seed=None, + title=None, + icon=True, + msg=None, + options=None, + is_seed=None, + passphrase=None, + parent=None, + for_seed_words=True, + *, + config: 'SimpleConfig', + ): QVBoxLayout.__init__(self) self.parent = parent self.options = options + self.config = config if title: self.addWidget(WWLabel(title)) if seed: # "read only", we already have the text @@ -238,11 +251,17 @@ class KeysLayout(QVBoxLayout): class SeedDialog(WindowModalDialog): - def __init__(self, parent, seed, passphrase): + def __init__(self, parent, seed, passphrase, *, config: 'SimpleConfig'): WindowModalDialog.__init__(self, parent, ('Electrum - ' + _('Seed'))) self.setMinimumWidth(400) vbox = QVBoxLayout(self) title = _("Your wallet generation seed is:") - slayout = SeedLayout(title=title, seed=seed, msg=True, passphrase=passphrase) + slayout = SeedLayout( + title=title, + seed=seed, + msg=True, + passphrase=passphrase, + config=config, + ) vbox.addLayout(slayout) vbox.addLayout(Buttons(CloseButton(self)))