flake happifier
This commit is contained in:
@@ -460,11 +460,14 @@ class ChoicesLayout(object):
|
|||||||
class ChoiceWidget(QWidget):
|
class ChoiceWidget(QWidget):
|
||||||
itemSelected = pyqtSignal([int], arguments=['index'])
|
itemSelected = pyqtSignal([int], arguments=['index'])
|
||||||
|
|
||||||
def __init__(self, *, message=None, choices=[], selected=None):
|
def __init__(self, *, message=None, choices=None, selected=None):
|
||||||
QWidget.__init__(self)
|
QWidget.__init__(self)
|
||||||
vbox = QVBoxLayout()
|
vbox = QVBoxLayout()
|
||||||
self.setLayout(vbox)
|
self.setLayout(vbox)
|
||||||
|
|
||||||
|
if choices is None:
|
||||||
|
choices = []
|
||||||
|
|
||||||
self.selected_index = -1
|
self.selected_index = -1
|
||||||
self.selected_item = None
|
self.selected_item = None
|
||||||
self.choices = choices
|
self.choices = choices
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
from typing import Optional
|
from typing import Optional, TYPE_CHECKING
|
||||||
|
|
||||||
from electrum import bip32, constants
|
from electrum import bip32, constants
|
||||||
from electrum.crypto import sha256
|
from electrum.crypto import sha256
|
||||||
@@ -15,9 +15,12 @@ from electrum.logging import get_logger
|
|||||||
from electrum.plugin import runs_in_hwd_thread, Device
|
from electrum.plugin import runs_in_hwd_thread, Device
|
||||||
from electrum.network import Network
|
from electrum.network import Network
|
||||||
|
|
||||||
from ..hw_wallet import HW_PluginBase, HardwareClientBase
|
from electrum.plugins.hw_wallet import HW_PluginBase, HardwareClientBase
|
||||||
from ..hw_wallet.plugin import OutdatedHwFirmwareException
|
from electrum.plugins.hw_wallet.plugin import OutdatedHwFirmwareException
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from electrum.plugin import DeviceInfo
|
||||||
|
from electrum.wizard import NewWalletWizard
|
||||||
|
|
||||||
_logger = get_logger(__name__)
|
_logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import threading
|
import threading
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, Qt
|
from PyQt5.QtCore import pyqtSignal, Qt
|
||||||
|
|
||||||
@@ -16,6 +17,9 @@ from electrum.gui.qt.wizard.wizard import WizardComponent
|
|||||||
|
|
||||||
from .jade import JadePlugin
|
from .jade import JadePlugin
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from electrum.gui.qt.wizard.wallet import QENewWalletWizard
|
||||||
|
|
||||||
|
|
||||||
class Plugin(JadePlugin, QtPluginBase):
|
class Plugin(JadePlugin, QtPluginBase):
|
||||||
icon_unpaired = "jade_unpaired.png"
|
icon_unpaired = "jade_unpaired.png"
|
||||||
@@ -36,11 +40,11 @@ class Plugin(JadePlugin, QtPluginBase):
|
|||||||
menu.addAction(_("Show on Jade"), show_address)
|
menu.addAction(_("Show on Jade"), show_address)
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def init_wallet_wizard(self, wizard: 'QEWalletWizard'):
|
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
|
||||||
self.extend_wizard(wizard)
|
self.extend_wizard(wizard)
|
||||||
|
|
||||||
# insert trezor pages in new wallet wizard
|
# insert trezor pages in new wallet wizard
|
||||||
def extend_wizard(self, wizard: 'NewWalletWizard'):
|
def extend_wizard(self, wizard: 'QENewWalletWizard'):
|
||||||
super().extend_wizard(wizard)
|
super().extend_wizard(wizard)
|
||||||
views = {
|
views = {
|
||||||
'jade_start': { 'gui': WCScriptAndDerivation },
|
'jade_start': { 'gui': WCScriptAndDerivation },
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
import threading
|
import threading
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QEventLoop, pyqtSignal
|
from PyQt5.QtCore import Qt, QEventLoop, pyqtSignal
|
||||||
from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QGridLayout, QPushButton,
|
from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QGridLayout, QPushButton,
|
||||||
@@ -22,8 +23,10 @@ from electrum.gui.qt.wizard.wizard import WizardComponent
|
|||||||
from .trezor import (TrezorPlugin, TIM_NEW, TIM_RECOVER, TrezorInitSettings,
|
from .trezor import (TrezorPlugin, TIM_NEW, TIM_RECOVER, TrezorInitSettings,
|
||||||
PASSPHRASE_ON_DEVICE, Capability, BackupType, RecoveryDeviceType)
|
PASSPHRASE_ON_DEVICE, Capability, BackupType, RecoveryDeviceType)
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from electrum.gui.qt.wizard.wallet import QENewWalletWizard
|
||||||
|
|
||||||
PASSPHRASE_HELP_SHORT =_(
|
PASSPHRASE_HELP_SHORT = _(
|
||||||
"Passphrases allow you to access new wallets, each "
|
"Passphrases allow you to access new wallets, each "
|
||||||
"hidden behind a particular case-sensitive passphrase.")
|
"hidden behind a particular case-sensitive passphrase.")
|
||||||
PASSPHRASE_HELP = PASSPHRASE_HELP_SHORT + " " + _(
|
PASSPHRASE_HELP = PASSPHRASE_HELP_SHORT + " " + _(
|
||||||
@@ -463,11 +466,11 @@ class Plugin(TrezorPlugin, QtPlugin):
|
|||||||
return PinMatrixWidget
|
return PinMatrixWidget
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def init_wallet_wizard(self, wizard: 'QEWalletWizard'):
|
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
|
||||||
self.extend_wizard(wizard)
|
self.extend_wizard(wizard)
|
||||||
|
|
||||||
# insert trezor pages in new wallet wizard
|
# insert trezor pages in new wallet wizard
|
||||||
def extend_wizard(self, wizard: 'NewWalletWizard'):
|
def extend_wizard(self, wizard: 'QENewWalletWizard'):
|
||||||
super().extend_wizard(wizard)
|
super().extend_wizard(wizard)
|
||||||
views = {
|
views = {
|
||||||
'trezor_start': { 'gui': WCScriptAndDerivation },
|
'trezor_start': { 'gui': WCScriptAndDerivation },
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
import traceback
|
from typing import NamedTuple, Any, Optional, TYPE_CHECKING, Sequence
|
||||||
import sys
|
|
||||||
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING, Sequence
|
|
||||||
|
|
||||||
from electrum.util import bfh, versiontuple, UserCancelled, UserFacingException
|
from electrum.util import bfh, UserCancelled, UserFacingException
|
||||||
from electrum.bip32 import BIP32Node
|
from electrum.bip32 import BIP32Node
|
||||||
from electrum import descriptor
|
from electrum import descriptor
|
||||||
from electrum import constants
|
from electrum import constants
|
||||||
from electrum.i18n import _
|
from electrum.i18n import _
|
||||||
from electrum.plugin import Device, runs_in_hwd_thread
|
from electrum.plugin import Device, runs_in_hwd_thread
|
||||||
from electrum.transaction import Transaction, PartialTransaction, PartialTxInput, PartialTxOutput, Sighash
|
from electrum.transaction import Transaction, PartialTransaction, PartialTxInput, Sighash
|
||||||
from electrum.keystore import Hardware_KeyStore
|
from electrum.keystore import Hardware_KeyStore
|
||||||
from electrum.base_wizard import ScriptTypeNotSupported, HWD_SETUP_NEW_WALLET
|
from electrum.base_wizard import ScriptTypeNotSupported, HWD_SETUP_NEW_WALLET
|
||||||
from electrum.logging import get_logger
|
from electrum.logging import get_logger
|
||||||
|
|
||||||
from ..hw_wallet import HW_PluginBase
|
from electrum.plugins.hw_wallet import HW_PluginBase
|
||||||
from ..hw_wallet.plugin import (is_any_tx_output_on_change_branch, trezor_validate_op_return_output_and_get_data,
|
from electrum.plugins.hw_wallet.plugin import is_any_tx_output_on_change_branch, \
|
||||||
LibraryFoundButUnusable, OutdatedHwFirmwareException)
|
trezor_validate_op_return_output_and_get_data, LibraryFoundButUnusable, OutdatedHwFirmwareException
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from electrum.plugin import DeviceInfo
|
||||||
|
from electrum.wizard import NewWalletWizard
|
||||||
|
|
||||||
_logger = get_logger(__name__)
|
_logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ from .trustedcoin import TrustedCoinPlugin, server, DISCLAIMER
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from electrum.gui.qt.main_window import ElectrumWindow
|
from electrum.gui.qt.main_window import ElectrumWindow
|
||||||
from electrum.wallet import Abstract_Wallet
|
from electrum.wallet import Abstract_Wallet
|
||||||
from electrum.wizard import NewWalletWizard
|
from electrum.gui.qt.wizard.wallet import QENewWalletWizard
|
||||||
|
|
||||||
|
|
||||||
class TOS(QTextEdit):
|
class TOS(QTextEdit):
|
||||||
@@ -334,18 +334,14 @@ class Plugin(TrustedCoinPlugin):
|
|||||||
self.check_otp(window, short_id, otp_secret, xpub3, pw.get_amount(), cb_lost.isChecked())
|
self.check_otp(window, short_id, otp_secret, xpub3, pw.get_amount(), cb_lost.isChecked())
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def init_qt(self, gui: 'ElectrumGui'):
|
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
|
||||||
pass
|
|
||||||
|
|
||||||
@hook
|
|
||||||
def init_wallet_wizard(self, wizard: 'QEWalletWizard'):
|
|
||||||
# FIXME: self.so is currently scoped to plugin, which is shared among wizards. This is wrong
|
# FIXME: self.so is currently scoped to plugin, which is shared among wizards. This is wrong
|
||||||
# refactor to be a member of the wizard instance
|
# refactor to be a member of the wizard instance
|
||||||
self.so = QSignalObject(self, wizard, None)
|
self.so = QSignalObject(self, wizard, None)
|
||||||
self.extend_wizard(wizard)
|
self.extend_wizard(wizard)
|
||||||
self._wizard = wizard
|
self._wizard = wizard
|
||||||
|
|
||||||
def extend_wizard(self, wizard: 'NewWalletWizard'):
|
def extend_wizard(self, wizard: 'QENewWalletWizard'):
|
||||||
super().extend_wizard(wizard)
|
super().extend_wizard(wizard)
|
||||||
views = {
|
views = {
|
||||||
'trustedcoin_start': {
|
'trustedcoin_start': {
|
||||||
|
|||||||
@@ -22,14 +22,13 @@
|
|||||||
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
import asyncio
|
|
||||||
import socket
|
import socket
|
||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
import time
|
import time
|
||||||
import hashlib
|
import hashlib
|
||||||
from collections import defaultdict
|
from typing import Dict, Union, Sequence, List, TYPE_CHECKING
|
||||||
from typing import Dict, Union, Sequence, List
|
|
||||||
|
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
@@ -49,6 +48,9 @@ from electrum.network import Network
|
|||||||
from electrum.base_wizard import BaseWizard, WizardWalletPasswordSetting
|
from electrum.base_wizard import BaseWizard, WizardWalletPasswordSetting
|
||||||
from electrum.logging import Logger
|
from electrum.logging import Logger
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from electrum.wizard import NewWalletWizard
|
||||||
|
|
||||||
|
|
||||||
def get_signing_xpub(xtype):
|
def get_signing_xpub(xtype):
|
||||||
if not constants.net.TESTNET:
|
if not constants.net.TESTNET:
|
||||||
|
|||||||
Reference in New Issue
Block a user