1
0

wizard: fix trezor initialisation/recover not setting page valid to True

add auto-proceed to next page after init to trezor, safe_t, keepkey
This commit is contained in:
Sander van Grieken
2023-09-18 22:27:50 +02:00
parent 808f1877d2
commit 22d3a5edbb
9 changed files with 16 additions and 28 deletions

View File

@@ -602,8 +602,6 @@ class ColdcardPlugin(HW_PluginBase):
keystore.handler.show_error(_('This function is only available for standard wallets when using {}.').format(self.device))
return
# new wizard
def wizard_entry_for_device(self, device_info: 'DeviceInfo', *, new_wallet=True) -> str:
if new_wallet:
return 'coldcard_start' if device_info.initialized else 'coldcard_not_initialized'

View File

@@ -463,8 +463,6 @@ class JadePlugin(HW_PluginBase):
if hw_address != address:
keystore.handler.show_error(_('The address generated by {} does not match!').format(self.device))
# new wizard
def wizard_entry_for_device(self, device_info: 'DeviceInfo', *, new_wallet=True) -> str:
if new_wallet:
return 'jade_start' if device_info.initialized else 'jade_not_initialized'

View File

@@ -425,8 +425,6 @@ class KeepKeyPlugin(HW_PluginBase):
tx = self.prev_tx[tx_hash]
return self.electrum_tx_to_txtype(tx)
# new wizard
def wizard_entry_for_device(self, device_info: 'DeviceInfo', *, new_wallet=True) -> str:
if new_wallet:
return 'keepkey_start' if device_info.initialized else 'keepkey_not_initialized'

View File

@@ -678,12 +678,14 @@ class WCKeepkeyInit(WizardComponent, Logger):
def initialize_device_task(settings, method, device_id, handler):
try:
self.plugin._initialize_device(settings, method, device_id, handler)
self.logger.info('Done initialize device')
self.valid = True
self.wizard.requestNext.emit() # triggers Next GUI thread from event loop
except Exception as e:
self.valid = False
self.error = repr(e)
finally:
self.init_done()
self.busy = False
t = threading.Thread(
target=initialize_device_task,
@@ -691,9 +693,5 @@ class WCKeepkeyInit(WizardComponent, Logger):
daemon=True)
t.start()
def init_done(self):
self.logger.info('Done initialize device')
self.busy = False
def apply(self):
pass

View File

@@ -1454,8 +1454,6 @@ class LedgerPlugin(HW_PluginBase):
keystore.show_address(sequence, txin_type)
# new wizard
def wizard_entry_for_device(self, device_info: 'DeviceInfo', *, new_wallet=True) -> str:
if new_wallet:
return 'ledger_start' if device_info.initialized else 'ledger_not_initialized'

View File

@@ -610,12 +610,14 @@ class WCSafeTInit(WizardComponent, Logger):
def initialize_device_task(settings, method, device_id, handler):
try:
self.plugin._initialize_device(settings, method, device_id, handler)
self.logger.info('Done initialize device')
self.valid = True
self.wizard.requestNext.emit() # triggers Next GUI thread from event loop
except Exception as e:
self.valid = False
self.error = repr(e)
finally:
self.init_done()
self.busy = False
t = threading.Thread(
target=initialize_device_task,
@@ -623,9 +625,5 @@ class WCSafeTInit(WizardComponent, Logger):
daemon=True)
t.start()
def init_done(self):
self.logger.info('Done initialize device')
self.busy = False
def apply(self):
pass

View File

@@ -397,8 +397,6 @@ class SafeTPlugin(HW_PluginBase):
tx = self.prev_tx[tx_hash]
return self.electrum_tx_to_txtype(tx)
# new wizard
def wizard_entry_for_device(self, device_info: 'DeviceInfo', *, new_wallet=True) -> str:
if new_wallet:
return 'safet_start' if device_info.initialized else 'safet_not_initialized'

View File

@@ -885,8 +885,16 @@ class WCTrezorInit(WizardComponent, Logger):
client.handler = self.plugin.create_handler(self.wizard)
def initialize_device_task(settings, method, device_id, handler):
self.plugin._initialize_device(settings, method, device_id, handler)
self.init_done()
try:
self.plugin._initialize_device(settings, method, device_id, handler)
self.logger.info('Done initialize device')
self.valid = True
self.wizard.requestNext.emit() # triggers Next GUI thread from event loop
except Exception as e:
self.valid = False
self.error = repr(e)
finally:
self.busy = False
t = threading.Thread(
target=initialize_device_task,
@@ -894,9 +902,5 @@ class WCTrezorInit(WizardComponent, Logger):
daemon=True)
t.start()
def init_done(self):
self.logger.info('Done initialize device')
self.busy = False
def apply(self):
pass

View File

@@ -465,8 +465,6 @@ class TrezorPlugin(HW_PluginBase):
]
return t
# new wizard
def wizard_entry_for_device(self, device_info: 'DeviceInfo', *, new_wallet=True) -> str:
if new_wallet: # new wallet
return 'trezor_not_initialized' if not device_info.initialized else 'trezor_start'