mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
qt: add some type hints
This commit is contained in:
parent
ef5a5151e3
commit
bcdb72ae93
3 changed files with 21 additions and 8 deletions
|
@ -28,7 +28,7 @@ import signal
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import threading
|
import threading
|
||||||
from typing import Optional
|
from typing import Optional, TYPE_CHECKING
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -57,6 +57,11 @@ from .network_dialog import NetworkDialog
|
||||||
from .stylesheet_patcher import patch_qt_stylesheet
|
from .stylesheet_patcher import patch_qt_stylesheet
|
||||||
from .lightning_dialog import LightningDialog
|
from .lightning_dialog import LightningDialog
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from electrum.daemon import Daemon
|
||||||
|
from electrum.simple_config import SimpleConfig
|
||||||
|
from electrum.plugin import Plugins
|
||||||
|
|
||||||
|
|
||||||
class OpenFileEventFilter(QObject):
|
class OpenFileEventFilter(QObject):
|
||||||
def __init__(self, windows):
|
def __init__(self, windows):
|
||||||
|
@ -82,7 +87,7 @@ class QNetworkUpdatedSignalObject(QObject):
|
||||||
class ElectrumGui(Logger):
|
class ElectrumGui(Logger):
|
||||||
|
|
||||||
@profiler
|
@profiler
|
||||||
def __init__(self, config, daemon, plugins):
|
def __init__(self, config: 'SimpleConfig', daemon: 'Daemon', plugins: 'Plugins'):
|
||||||
set_language(config.get('language', get_default_language()))
|
set_language(config.get('language', get_default_language()))
|
||||||
Logger.__init__(self)
|
Logger.__init__(self)
|
||||||
# Uncomment this call to verify objects are being properly
|
# Uncomment this call to verify objects are being properly
|
||||||
|
|
|
@ -6,13 +6,13 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import traceback
|
import traceback
|
||||||
from typing import Tuple, List, Callable, NamedTuple, Optional
|
from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CHECKING
|
||||||
|
|
||||||
from PyQt5.QtCore import QRect, QEventLoop, Qt, pyqtSignal
|
from PyQt5.QtCore import QRect, QEventLoop, Qt, pyqtSignal
|
||||||
from PyQt5.QtGui import QPalette, QPen, QPainter, QPixmap
|
from PyQt5.QtGui import QPalette, QPen, QPainter, QPixmap
|
||||||
from PyQt5.QtWidgets import (QWidget, QDialog, QLabel, QHBoxLayout, QMessageBox,
|
from PyQt5.QtWidgets import (QWidget, QDialog, QLabel, QHBoxLayout, QMessageBox,
|
||||||
QVBoxLayout, QLineEdit, QFileDialog, QPushButton,
|
QVBoxLayout, QLineEdit, QFileDialog, QPushButton,
|
||||||
QGridLayout, QSlider, QScrollArea)
|
QGridLayout, QSlider, QScrollArea, QApplication)
|
||||||
|
|
||||||
from electrum.wallet import Wallet, Abstract_Wallet
|
from electrum.wallet import Wallet, Abstract_Wallet
|
||||||
from electrum.storage import WalletStorage
|
from electrum.storage import WalletStorage
|
||||||
|
@ -25,7 +25,11 @@ from .network_dialog import NetworkChoiceLayout
|
||||||
from .util import (MessageBoxMixin, Buttons, icon_path, ChoicesLayout, WWLabel,
|
from .util import (MessageBoxMixin, Buttons, icon_path, ChoicesLayout, WWLabel,
|
||||||
InfoButton, char_width_in_lineedit)
|
InfoButton, char_width_in_lineedit)
|
||||||
from .password_dialog import PasswordLayout, PasswordLayoutForHW, PW_NEW
|
from .password_dialog import PasswordLayout, PasswordLayoutForHW, PW_NEW
|
||||||
from electrum.plugin import run_hook
|
from electrum.plugin import run_hook, Plugins
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from electrum.simple_config import SimpleConfig
|
||||||
|
|
||||||
|
|
||||||
MSG_ENTER_PASSWORD = _("Choose a password to encrypt your wallet keys.") + '\n'\
|
MSG_ENTER_PASSWORD = _("Choose a password to encrypt your wallet keys.") + '\n'\
|
||||||
+ _("Leave this field empty if you want to disable encryption.")
|
+ _("Leave this field empty if you want to disable encryption.")
|
||||||
|
@ -115,7 +119,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||||
|
|
||||||
accept_signal = pyqtSignal()
|
accept_signal = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, config, app, plugins):
|
def __init__(self, config: 'SimpleConfig', app: QApplication, plugins: 'Plugins'):
|
||||||
QDialog.__init__(self, None)
|
QDialog.__init__(self, None)
|
||||||
BaseWizard.__init__(self, config, plugins)
|
BaseWizard.__init__(self, config, plugins)
|
||||||
self.setWindowTitle('Electrum - ' + _('Install Wizard'))
|
self.setWindowTitle('Electrum - ' + _('Install Wizard'))
|
||||||
|
|
|
@ -36,7 +36,7 @@ import base64
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import queue
|
import queue
|
||||||
import asyncio
|
import asyncio
|
||||||
from typing import Optional
|
from typing import Optional, TYPE_CHECKING
|
||||||
|
|
||||||
from PyQt5.QtGui import QPixmap, QKeySequence, QIcon, QCursor
|
from PyQt5.QtGui import QPixmap, QKeySequence, QIcon, QCursor
|
||||||
from PyQt5.QtCore import Qt, QRect, QStringListModel, QSize, pyqtSignal
|
from PyQt5.QtCore import Qt, QRect, QStringListModel, QSize, pyqtSignal
|
||||||
|
@ -93,6 +93,10 @@ from .history_list import HistoryList, HistoryModel
|
||||||
from .update_checker import UpdateCheck, UpdateCheckThread
|
from .update_checker import UpdateCheck, UpdateCheckThread
|
||||||
from .channels_list import ChannelsList
|
from .channels_list import ChannelsList
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from . import ElectrumGui
|
||||||
|
|
||||||
|
|
||||||
LN_NUM_PAYMENT_ATTEMPTS = 10
|
LN_NUM_PAYMENT_ATTEMPTS = 10
|
||||||
|
|
||||||
class StatusBarButton(QPushButton):
|
class StatusBarButton(QPushButton):
|
||||||
|
@ -125,7 +129,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
||||||
computing_privkeys_signal = pyqtSignal()
|
computing_privkeys_signal = pyqtSignal()
|
||||||
show_privkeys_signal = pyqtSignal()
|
show_privkeys_signal = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, gui_object, wallet: Abstract_Wallet):
|
def __init__(self, gui_object: 'ElectrumGui', wallet: Abstract_Wallet):
|
||||||
QMainWindow.__init__(self)
|
QMainWindow.__init__(self)
|
||||||
|
|
||||||
self.gui_object = gui_object
|
self.gui_object = gui_object
|
||||||
|
|
Loading…
Add table
Reference in a new issue