wizard: add keepkey to new wizard
This commit is contained in:
@@ -731,7 +731,7 @@ class BitBox02Plugin(HW_PluginBase):
|
||||
else:
|
||||
return 'bitbox02_unlock'
|
||||
|
||||
# insert trezor pages in new wallet wizard
|
||||
# insert bitbox02 pages in new wallet wizard
|
||||
def extend_wizard(self, wizard: 'NewWalletWizard'):
|
||||
views = {
|
||||
'bitbox02_start': {
|
||||
|
||||
@@ -73,7 +73,7 @@ class Plugin(BitBox02Plugin, QtPluginBase):
|
||||
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
|
||||
self.extend_wizard(wizard)
|
||||
|
||||
# insert trezor pages in new wallet wizard
|
||||
# insert bitbox02 pages in new wallet wizard
|
||||
def extend_wizard(self, wizard: 'QENewWalletWizard'):
|
||||
super().extend_wizard(wizard)
|
||||
views = {
|
||||
|
||||
@@ -780,7 +780,7 @@ class DigitalBitboxPlugin(HW_PluginBase):
|
||||
else:
|
||||
return 'dbitbox_unlock'
|
||||
|
||||
# insert trezor pages in new wallet wizard
|
||||
# insert digitalbitbox pages in new wallet wizard
|
||||
def extend_wizard(self, wizard: 'NewWalletWizard'):
|
||||
views = {
|
||||
'dbitbox_start': {
|
||||
|
||||
@@ -47,7 +47,7 @@ class Plugin(DigitalBitboxPlugin, QtPluginBase):
|
||||
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
|
||||
self.extend_wizard(wizard)
|
||||
|
||||
# insert trezor pages in new wallet wizard
|
||||
# insert digitalbitbox pages in new wallet wizard
|
||||
def extend_wizard(self, wizard: 'QENewWalletWizard'):
|
||||
super().extend_wizard(wizard)
|
||||
views = {
|
||||
|
||||
@@ -488,7 +488,7 @@ class JadePlugin(HW_PluginBase):
|
||||
else:
|
||||
return 'jade_unlock'
|
||||
|
||||
# insert trezor pages in new wallet wizard
|
||||
# insert jade pages in new wallet wizard
|
||||
def extend_wizard(self, wizard: 'NewWalletWizard'):
|
||||
views = {
|
||||
'jade_start': {
|
||||
|
||||
@@ -39,7 +39,7 @@ class Plugin(JadePlugin, QtPluginBase):
|
||||
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
|
||||
self.extend_wizard(wizard)
|
||||
|
||||
# insert trezor pages in new wallet wizard
|
||||
# insert jade pages in new wallet wizard
|
||||
def extend_wizard(self, wizard: 'QENewWalletWizard'):
|
||||
super().extend_wizard(wizard)
|
||||
views = {
|
||||
|
||||
@@ -488,3 +488,29 @@ class KeepKeyPlugin(HW_PluginBase):
|
||||
def get_tx(self, tx_hash):
|
||||
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'
|
||||
else:
|
||||
return 'keepkey_unlock'
|
||||
|
||||
# insert keepkey pages in new wallet wizard
|
||||
def extend_wizard(self, wizard: 'NewWalletWizard'):
|
||||
views = {
|
||||
'keepkey_start': {
|
||||
'next': 'keepkey_xpub',
|
||||
},
|
||||
'keepkey_xpub': {
|
||||
'next': lambda d: wizard.wallet_password_view(d) if wizard.last_cosigner(d) else 'multisig_cosigner_keystore',
|
||||
'accept': wizard.maybe_master_pubkey,
|
||||
'last': lambda d: wizard.is_single_password() and wizard.last_cosigner(d)
|
||||
},
|
||||
'keepkey_not_initialized': {},
|
||||
'keepkey_unlock': {
|
||||
'last': True
|
||||
},
|
||||
}
|
||||
wizard.navmap_merge(views)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from functools import partial
|
||||
import threading
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from PyQt5.QtCore import Qt, QEventLoop, pyqtSignal, QRegExp
|
||||
from PyQt5.QtGui import QRegExpValidator
|
||||
@@ -17,6 +17,10 @@ from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
|
||||
from ..hw_wallet.plugin import only_hook_if_libraries_available
|
||||
from .keepkey import KeepKeyPlugin, TIM_NEW, TIM_RECOVER, TIM_MNEMONIC
|
||||
|
||||
from electrum.gui.qt.wizard.wallet import WCScriptAndDerivation, WCHWUninitialized, WCHWUnlock, WCHWXPub
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from electrum.gui.qt.wizard.wallet import QENewWalletWizard
|
||||
|
||||
PASSPHRASE_HELP_SHORT =_(
|
||||
"Passphrases allow you to access new wallets, each "
|
||||
@@ -310,6 +314,21 @@ class Plugin(KeepKeyPlugin, QtPlugin):
|
||||
from keepkeylib.qt.pinmatrix import PinMatrixWidget
|
||||
return PinMatrixWidget
|
||||
|
||||
@hook
|
||||
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
|
||||
self.extend_wizard(wizard)
|
||||
|
||||
# insert keepkey pages in new wallet wizard
|
||||
def extend_wizard(self, wizard: 'QENewWalletWizard'):
|
||||
super().extend_wizard(wizard)
|
||||
views = {
|
||||
'keepkey_start': {'gui': WCScriptAndDerivation},
|
||||
'keepkey_xpub': {'gui': WCHWXPub},
|
||||
'keepkey_not_initialized': {'gui': WCHWUninitialized},
|
||||
'keepkey_unlock': {'gui': WCHWUnlock}
|
||||
}
|
||||
wizard.navmap_merge(views)
|
||||
|
||||
|
||||
class SettingsDialog(WindowModalDialog):
|
||||
'''This dialog doesn't require a device be paired with a wallet.
|
||||
|
||||
Reference in New Issue
Block a user