Browse Source

flake happifier

master
Sander van Grieken 2 years ago
parent
commit
7a2633b2de
  1. 5
      electrum/gui/qt/util.py
  2. 9
      electrum/plugins/jade/jade.py
  3. 8
      electrum/plugins/jade/qt.py
  4. 9
      electrum/plugins/trezor/qt.py
  5. 18
      electrum/plugins/trezor/trezor.py
  6. 10
      electrum/plugins/trustedcoin/qt.py
  7. 8
      electrum/plugins/trustedcoin/trustedcoin.py

5
electrum/gui/qt/util.py

@ -460,11 +460,14 @@ class ChoicesLayout(object):
class ChoiceWidget(QWidget):
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)
vbox = QVBoxLayout()
self.setLayout(vbox)
if choices is None:
choices = []
self.selected_index = -1
self.selected_item = None
self.choices = choices

9
electrum/plugins/jade/jade.py

@ -1,7 +1,7 @@
import os
import base64
import json
from typing import Optional
from typing import Optional, TYPE_CHECKING
from electrum import bip32, constants
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.network import Network
from ..hw_wallet import HW_PluginBase, HardwareClientBase
from ..hw_wallet.plugin import OutdatedHwFirmwareException
from electrum.plugins.hw_wallet import HW_PluginBase, HardwareClientBase
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__)

8
electrum/plugins/jade/qt.py

@ -1,5 +1,6 @@
import threading
from functools import partial
from typing import TYPE_CHECKING
from PyQt5.QtCore import pyqtSignal, Qt
@ -16,6 +17,9 @@ from electrum.gui.qt.wizard.wizard import WizardComponent
from .jade import JadePlugin
if TYPE_CHECKING:
from electrum.gui.qt.wizard.wallet import QENewWalletWizard
class Plugin(JadePlugin, QtPluginBase):
icon_unpaired = "jade_unpaired.png"
@ -36,11 +40,11 @@ class Plugin(JadePlugin, QtPluginBase):
menu.addAction(_("Show on Jade"), show_address)
@hook
def init_wallet_wizard(self, wizard: 'QEWalletWizard'):
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
self.extend_wizard(wizard)
# insert trezor pages in new wallet wizard
def extend_wizard(self, wizard: 'NewWalletWizard'):
def extend_wizard(self, wizard: 'QENewWalletWizard'):
super().extend_wizard(wizard)
views = {
'jade_start': { 'gui': WCScriptAndDerivation },

9
electrum/plugins/trezor/qt.py

@ -1,5 +1,6 @@
from functools import partial
import threading
from typing import TYPE_CHECKING
from PyQt5.QtCore import Qt, QEventLoop, pyqtSignal
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,
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 "
"hidden behind a particular case-sensitive passphrase.")
PASSPHRASE_HELP = PASSPHRASE_HELP_SHORT + " " + _(
@ -463,11 +466,11 @@ class Plugin(TrezorPlugin, QtPlugin):
return PinMatrixWidget
@hook
def init_wallet_wizard(self, wizard: 'QEWalletWizard'):
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
self.extend_wizard(wizard)
# insert trezor pages in new wallet wizard
def extend_wizard(self, wizard: 'NewWalletWizard'):
def extend_wizard(self, wizard: 'QENewWalletWizard'):
super().extend_wizard(wizard)
views = {
'trezor_start': { 'gui': WCScriptAndDerivation },

18
electrum/plugins/trezor/trezor.py

@ -1,21 +1,23 @@
import traceback
import sys
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING, Sequence
from typing import NamedTuple, Any, Optional, 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 import descriptor
from electrum import constants
from electrum.i18n import _
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.base_wizard import ScriptTypeNotSupported, HWD_SETUP_NEW_WALLET
from electrum.logging import get_logger
from ..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,
LibraryFoundButUnusable, OutdatedHwFirmwareException)
from electrum.plugins.hw_wallet import HW_PluginBase
from electrum.plugins.hw_wallet.plugin import is_any_tx_output_on_change_branch, \
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__)

10
electrum/plugins/trustedcoin/qt.py

@ -55,7 +55,7 @@ from .trustedcoin import TrustedCoinPlugin, server, DISCLAIMER
if TYPE_CHECKING:
from electrum.gui.qt.main_window import ElectrumWindow
from electrum.wallet import Abstract_Wallet
from electrum.wizard import NewWalletWizard
from electrum.gui.qt.wizard.wallet import QENewWalletWizard
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())
@hook
def init_qt(self, gui: 'ElectrumGui'):
pass
@hook
def init_wallet_wizard(self, wizard: 'QEWalletWizard'):
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
# 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
self.so = QSignalObject(self, wizard, None)
self.extend_wizard(wizard)
self._wizard = wizard
def extend_wizard(self, wizard: 'NewWalletWizard'):
def extend_wizard(self, wizard: 'QENewWalletWizard'):
super().extend_wizard(wizard)
views = {
'trustedcoin_start': {

8
electrum/plugins/trustedcoin/trustedcoin.py

@ -22,14 +22,13 @@
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import asyncio
import socket
import json
import base64
import time
import hashlib
from collections import defaultdict
from typing import Dict, Union, Sequence, List
from typing import Dict, Union, Sequence, List, TYPE_CHECKING
from urllib.parse import urljoin
from urllib.parse import quote
@ -49,6 +48,9 @@ from electrum.network import Network
from electrum.base_wizard import BaseWizard, WizardWalletPasswordSetting
from electrum.logging import Logger
if TYPE_CHECKING:
from electrum.wizard import NewWalletWizard
def get_signing_xpub(xtype):
if not constants.net.TESTNET:

Loading…
Cancel
Save