mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 17:31:36 +00:00
qt: (trivial) some type hints
This commit is contained in:
parent
30bb7dd6f4
commit
bd83ca0286
3 changed files with 15 additions and 7 deletions
|
@ -23,25 +23,32 @@
|
||||||
# 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.
|
||||||
|
|
||||||
from electrum.i18n import _
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QVBoxLayout, QLabel
|
from PyQt5.QtWidgets import QVBoxLayout, QLabel
|
||||||
|
|
||||||
|
from electrum.i18n import _
|
||||||
|
|
||||||
from .util import WindowModalDialog, ButtonsLineEdit, ColorScheme, Buttons, CloseButton
|
from .util import WindowModalDialog, ButtonsLineEdit, ColorScheme, Buttons, CloseButton
|
||||||
from .history_list import HistoryList, HistoryModel
|
from .history_list import HistoryList, HistoryModel
|
||||||
from .qrtextedit import ShowQRTextEdit
|
from .qrtextedit import ShowQRTextEdit
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .main_window import ElectrumWindow
|
||||||
|
|
||||||
|
|
||||||
class AddressHistoryModel(HistoryModel):
|
class AddressHistoryModel(HistoryModel):
|
||||||
def __init__(self, parent, address):
|
def __init__(self, parent: 'ElectrumWindow', address):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.address = address
|
self.address = address
|
||||||
|
|
||||||
def get_domain(self):
|
def get_domain(self):
|
||||||
return [self.address]
|
return [self.address]
|
||||||
|
|
||||||
|
|
||||||
class AddressDialog(WindowModalDialog):
|
class AddressDialog(WindowModalDialog):
|
||||||
|
|
||||||
def __init__(self, parent, address):
|
def __init__(self, parent: 'ElectrumWindow', address: str):
|
||||||
WindowModalDialog.__init__(self, parent, _("Address"))
|
WindowModalDialog.__init__(self, parent, _("Address"))
|
||||||
self.address = address
|
self.address = address
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
|
|
@ -52,6 +52,7 @@ from .util import (read_QIcon, MONOSPACE_FONT, Buttons, CancelButton, OkButton,
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from electrum.wallet import Abstract_Wallet
|
from electrum.wallet import Abstract_Wallet
|
||||||
|
from .main_window import ElectrumWindow
|
||||||
|
|
||||||
|
|
||||||
_logger = get_logger(__name__)
|
_logger = get_logger(__name__)
|
||||||
|
@ -107,7 +108,7 @@ def get_item_key(tx_item):
|
||||||
|
|
||||||
class HistoryModel(QAbstractItemModel, Logger):
|
class HistoryModel(QAbstractItemModel, Logger):
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent: 'ElectrumWindow'):
|
||||||
QAbstractItemModel.__init__(self, parent)
|
QAbstractItemModel.__init__(self, parent)
|
||||||
Logger.__init__(self)
|
Logger.__init__(self)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
|
|
@ -73,7 +73,7 @@ def show_transaction(tx, parent, desc=None, prompt_if_unsaved=False):
|
||||||
|
|
||||||
class TxDialog(QDialog, MessageBoxMixin):
|
class TxDialog(QDialog, MessageBoxMixin):
|
||||||
|
|
||||||
def __init__(self, tx, parent, desc, prompt_if_unsaved):
|
def __init__(self, tx: Transaction, parent: 'ElectrumWindow', desc, prompt_if_unsaved):
|
||||||
'''Transactions in the wallet will show their description.
|
'''Transactions in the wallet will show their description.
|
||||||
Pass desc to give a description for txs not yet in the wallet.
|
Pass desc to give a description for txs not yet in the wallet.
|
||||||
'''
|
'''
|
||||||
|
@ -82,12 +82,12 @@ class TxDialog(QDialog, MessageBoxMixin):
|
||||||
# Take a copy; it might get updated in the main window by
|
# Take a copy; it might get updated in the main window by
|
||||||
# e.g. the FX plugin. If this happens during or after a long
|
# e.g. the FX plugin. If this happens during or after a long
|
||||||
# sign operation the signatures are lost.
|
# sign operation the signatures are lost.
|
||||||
self.tx = tx = copy.deepcopy(tx) # type: Transaction
|
self.tx = tx = copy.deepcopy(tx)
|
||||||
try:
|
try:
|
||||||
self.tx.deserialize()
|
self.tx.deserialize()
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
raise SerializationError(e)
|
raise SerializationError(e)
|
||||||
self.main_window = parent # type: ElectrumWindow
|
self.main_window = parent
|
||||||
self.wallet = parent.wallet
|
self.wallet = parent.wallet
|
||||||
self.prompt_if_unsaved = prompt_if_unsaved
|
self.prompt_if_unsaved = prompt_if_unsaved
|
||||||
self.saved = False
|
self.saved = False
|
||||||
|
|
Loading…
Add table
Reference in a new issue