Browse Source

qml: optimize imports

patch-4
Sander van Grieken 3 years ago
parent
commit
5008cef491
  1. 15
      electrum/gui/qml/__init__.py
  2. 8
      electrum/gui/qml/qeaddressdetails.py
  3. 9
      electrum/gui/qml/qebitcoin.py
  4. 8
      electrum/gui/qml/qechannellistmodel.py
  5. 14
      electrum/gui/qml/qechannelopener.py
  6. 13
      electrum/gui/qml/qedaemon.py
  7. 8
      electrum/gui/qml/qefx.py
  8. 22
      electrum/gui/qml/qeinvoice.py
  9. 4
      electrum/gui/qml/qelnpaymentdetails.py
  10. 8
      electrum/gui/qml/qeswaphelper.py
  11. 1
      electrum/gui/qml/qetypes.py
  12. 27
      electrum/gui/qml/qewallet.py
  13. 2
      electrum/gui/qml/qewalletdb.py
  14. 4
      electrum/gui/qml/util.py

15
electrum/gui/qml/__init__.py

@ -1,10 +1,9 @@
import os
import signal
import sys
import traceback
import threading
import re
from typing import Optional, TYPE_CHECKING, List
import traceback
from typing import TYPE_CHECKING
try:
import PyQt5
@ -20,14 +19,10 @@ from PyQt5.QtCore import QLocale, QTimer
from PyQt5.QtGui import QGuiApplication
import PyQt5.QtCore as QtCore
from electrum.i18n import _, set_language, languages
from electrum.i18n import set_language, languages
from electrum.plugin import run_hook
from electrum.base_wizard import GoBack
from electrum.util import (UserCancelled, profiler,
WalletFileException, BitcoinException, get_new_wallet_name)
from electrum.wallet import Wallet, Abstract_Wallet
from electrum.wallet_db import WalletDB
from electrum.logging import Logger, get_logger
from electrum.util import (profiler)
from electrum.logging import Logger
if TYPE_CHECKING:
from electrum.daemon import Daemon

8
electrum/gui/qml/qeaddressdetails.py

@ -1,13 +1,11 @@
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from decimal import Decimal
from electrum.logging import get_logger
from electrum.util import DECIMAL_POINT_DEFAULT
from .qewallet import QEWallet
from .qetypes import QEAmount
from .qetransactionlistmodel import QETransactionListModel
from .qetypes import QEAmount
from .qewallet import QEWallet
class QEAddressDetails(QObject):
def __init__(self, parent=None):

9
electrum/gui/qml/qebitcoin.py

@ -1,17 +1,16 @@
import asyncio
from datetime import datetime
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from electrum.logging import get_logger
from electrum.keystore import bip39_is_checksum_valid
from electrum import mnemonic
from electrum.bip32 import is_bip32_derivation
from electrum.keystore import bip39_is_checksum_valid
from electrum.logging import get_logger
from electrum.slip39 import decode_mnemonic, Slip39Error
from electrum import mnemonic
from electrum.util import parse_URI, create_bip21_uri, InvalidBitcoinURI, get_asyncio_loop
from .qetypes import QEAmount
class QEBitcoin(QObject):
def __init__(self, config, parent=None):
super().__init__(parent)

8
electrum/gui/qml/qechannellistmodel.py

@ -1,12 +1,10 @@
from datetime import datetime, timedelta
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, Q_ENUMS
from PyQt5.QtCore import Qt, QAbstractListModel, QModelIndex
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot
from electrum.lnchannel import ChannelState
from electrum.lnutil import LOCAL, REMOTE
from electrum.logging import get_logger
from electrum.util import Satoshis
from electrum.lnutil import LOCAL, REMOTE
from electrum.lnchannel import ChannelState
from .qetypes import QEAmount
from .util import QtEventListener, qt_event_listener

14
electrum/gui/qml/qechannelopener.py

@ -2,16 +2,16 @@ import threading
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from electrum.i18n import _
from electrum.logging import get_logger
from electrum.lnutil import extract_nodeid, ConnStringFormatError, LNPeerAddr, ln_dummy_address
from electrum.lnworker import hardcoded_trampoline_nodes
from electrum.gui import messages
from electrum.lnutil import extract_nodeid, LNPeerAddr, ln_dummy_address
from electrum.lnworker import hardcoded_trampoline_nodes
from electrum.logging import get_logger
from .qewallet import QEWallet
from .qetypes import QEAmount
from .qetxfinalizer import QETxFinalizer
from .auth import AuthMixin, auth_protect
from .qetxfinalizer import QETxFinalizer
from .qetypes import QEAmount
from .qewallet import QEWallet
class QEChannelOpener(QObject, AuthMixin):
def __init__(self, parent=None):

13
electrum/gui/qml/qedaemon.py

@ -1,19 +1,16 @@
import os
from decimal import Decimal
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QUrl
from PyQt5.QtCore import Qt, QAbstractListModel, QModelIndex
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from electrum.util import register_callback, get_new_wallet_name, WalletFileException, standardize_path
from electrum.logging import get_logger
from electrum.wallet import Wallet, Abstract_Wallet
from electrum.storage import WalletStorage, StorageReadWriteError
from electrum.wallet_db import WalletDB
from electrum.util import WalletFileException, standardize_path
from electrum.wallet import Abstract_Wallet
from .auth import AuthMixin, auth_protect
from .qefx import QEFX
from .qewallet import QEWallet
from .qewalletdb import QEWalletDB
from .qefx import QEFX
from .auth import AuthMixin, auth_protect
# wallet list model. supports both wallet basenames (wallet file basenames)
# and whole Wallet instances (loaded wallets)

8
electrum/gui/qml/qefx.py

@ -1,15 +1,15 @@
from decimal import Decimal
from datetime import datetime
from decimal import Decimal
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from electrum.logging import get_logger
from electrum.bitcoin import COIN
from electrum.exchange_rate import FxThread
from electrum.logging import get_logger
from electrum.simple_config import SimpleConfig
from electrum.bitcoin import COIN
from .qetypes import QEAmount
from .util import QtEventListener, qt_event_listener, event_listener
from .util import QtEventListener, event_listener
class QEFX(QObject, QtEventListener):
def __init__(self, fxthread: FxThread, config: SimpleConfig, parent=None):

22
electrum/gui/qml/qeinvoice.py

@ -1,23 +1,19 @@
import asyncio
from datetime import datetime
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, Q_ENUMS
from electrum.logging import get_logger
from electrum.i18n import _
from electrum.util import (parse_URI, create_bip21_uri, InvalidBitcoinURI, InvoiceError,
maybe_extract_lightning_payment_identifier)
from electrum.invoices import Invoice
from electrum.invoices import (PR_UNPAID,PR_EXPIRED,PR_UNKNOWN,PR_PAID,PR_INFLIGHT,
PR_FAILED,PR_ROUTING,PR_UNCONFIRMED,LN_EXPIRY_NEVER)
from electrum.transaction import PartialTxOutput
from electrum.lnaddr import lndecode
from electrum import bitcoin
from electrum import lnutil
from electrum.i18n import _
from electrum.invoices import Invoice
from electrum.invoices import (PR_UNPAID, PR_EXPIRED, PR_UNKNOWN, PR_PAID, PR_INFLIGHT,
PR_FAILED, PR_ROUTING, PR_UNCONFIRMED)
from electrum.lnaddr import LnInvoiceException
from electrum.logging import get_logger
from electrum.transaction import PartialTxOutput
from electrum.util import (parse_URI, InvalidBitcoinURI, InvoiceError,
maybe_extract_lightning_payment_identifier)
from .qewallet import QEWallet
from .qetypes import QEAmount
from .qewallet import QEWallet
class QEInvoice(QObject):
class Type:

4
electrum/gui/qml/qelnpaymentdetails.py

@ -1,10 +1,10 @@
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from electrum.logging import get_logger
from electrum.util import format_time, bfh, format_time
from electrum.util import bfh, format_time
from .qewallet import QEWallet
from .qetypes import QEAmount
from .qewallet import QEWallet
class QELnPaymentDetails(QObject):
def __init__(self, parent=None):

8
electrum/gui/qml/qeswaphelper.py

@ -1,17 +1,17 @@
import asyncio
from typing import TYPE_CHECKING, Optional, Union
from typing import Union
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from electrum.i18n import _
from electrum.logging import get_logger
from electrum.lnutil import ln_dummy_address
from electrum.logging import get_logger
from electrum.transaction import PartialTxOutput
from electrum.util import NotEnoughFunds, NoDynamicFeeEstimates, profiler
from .qewallet import QEWallet
from .qetypes import QEAmount
from .auth import AuthMixin, auth_protect
from .qetypes import QEAmount
from .qewallet import QEWallet
class QESwapHelper(AuthMixin, QObject):
_logger = get_logger(__name__)

1
electrum/gui/qml/qetypes.py

@ -2,7 +2,6 @@ from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from electrum.logging import get_logger
from electrum.i18n import _
from electrum.util import profiler
# container for satoshi amounts that can be passed around more
# easily between python, QML-property and QML-javascript contexts

27
electrum/gui/qml/qewallet.py

@ -1,30 +1,25 @@
from typing import Optional, TYPE_CHECKING, Sequence, List, Union
import queue
import time
import asyncio
import queue
import threading
import time
from typing import Optional
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QUrl, QTimer
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QTimer
from electrum import bitcoin
from electrum.i18n import _
from electrum.util import (Satoshis, format_time, parse_max_spend, InvalidPassword,
event_listener)
from electrum.invoices import (InvoiceError)
from electrum.logging import get_logger
from electrum.wallet import Wallet, Abstract_Wallet
from electrum.storage import StorageEncryptionVersion
from electrum import bitcoin
from electrum.transaction import PartialTxOutput
from electrum.invoices import (Invoice, InvoiceError,
PR_DEFAULT_EXPIRATION_WHEN_CREATING, PR_PAID,
PR_UNPAID, PR_UNKNOWN, PR_EXPIRED, PR_UNCONFIRMED)
from electrum.network import TxBroadcastError, BestEffortRequestFailed
from electrum.transaction import PartialTxOutput
from electrum.util import (parse_max_spend, InvalidPassword, event_listener)
from .qeinvoicelistmodel import QEInvoiceListModel, QERequestListModel
from .qetransactionlistmodel import QETransactionListModel
from .auth import AuthMixin, auth_protect
from .qeaddresslistmodel import QEAddressListModel
from .qechannellistmodel import QEChannelListModel
from .qeinvoicelistmodel import QEInvoiceListModel, QERequestListModel
from .qetransactionlistmodel import QETransactionListModel
from .qetypes import QEAmount
from .auth import AuthMixin, auth_protect
from .util import QtEventListener, qt_event_listener
class QEWallet(AuthMixin, QObject, QtEventListener):

2
electrum/gui/qml/qewalletdb.py

@ -2,7 +2,7 @@ import os
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from electrum.logging import Logger, get_logger
from electrum.logging import get_logger
from electrum.storage import WalletStorage, StorageEncryptionVersion
from electrum.wallet_db import WalletDB
from electrum.bip32 import normalize_bip32_derivation

4
electrum/gui/qml/util.py

@ -1,9 +1,7 @@
from functools import wraps
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from PyQt5.QtCore import pyqtSignal
from electrum.logging import get_logger
from electrum.i18n import _
from electrum.util import EventListener, event_listener
class QtEventListener(EventListener):

Loading…
Cancel
Save