electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit bd83ca02863920479fefd41f1e54b0315fc6a318
parent 30bb7dd6f46070953f03abedb9ee692dd74e55ff
Author: SomberNight <somber.night@protonmail.com>
Date:   Wed, 18 Sep 2019 02:10:53 +0200

qt: (trivial) some type hints

Diffstat:
Melectrum/gui/qt/address_dialog.py | 13++++++++++---
Melectrum/gui/qt/history_list.py | 3++-
Melectrum/gui/qt/transaction_dialog.py | 6+++---
3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/electrum/gui/qt/address_dialog.py b/electrum/gui/qt/address_dialog.py @@ -23,25 +23,32 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from electrum.i18n import _ +from typing import TYPE_CHECKING from PyQt5.QtWidgets import QVBoxLayout, QLabel +from electrum.i18n import _ + from .util import WindowModalDialog, ButtonsLineEdit, ColorScheme, Buttons, CloseButton from .history_list import HistoryList, HistoryModel from .qrtextedit import ShowQRTextEdit +if TYPE_CHECKING: + from .main_window import ElectrumWindow + + class AddressHistoryModel(HistoryModel): - def __init__(self, parent, address): + def __init__(self, parent: 'ElectrumWindow', address): super().__init__(parent) self.address = address def get_domain(self): return [self.address] + class AddressDialog(WindowModalDialog): - def __init__(self, parent, address): + def __init__(self, parent: 'ElectrumWindow', address: str): WindowModalDialog.__init__(self, parent, _("Address")) self.address = address self.parent = parent diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py @@ -52,6 +52,7 @@ from .util import (read_QIcon, MONOSPACE_FONT, Buttons, CancelButton, OkButton, if TYPE_CHECKING: from electrum.wallet import Abstract_Wallet + from .main_window import ElectrumWindow _logger = get_logger(__name__) @@ -107,7 +108,7 @@ def get_item_key(tx_item): class HistoryModel(QAbstractItemModel, Logger): - def __init__(self, parent): + def __init__(self, parent: 'ElectrumWindow'): QAbstractItemModel.__init__(self, parent) Logger.__init__(self) self.parent = parent diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py @@ -73,7 +73,7 @@ def show_transaction(tx, parent, desc=None, prompt_if_unsaved=False): 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. 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 # e.g. the FX plugin. If this happens during or after a long # sign operation the signatures are lost. - self.tx = tx = copy.deepcopy(tx) # type: Transaction + self.tx = tx = copy.deepcopy(tx) try: self.tx.deserialize() except BaseException as e: raise SerializationError(e) - self.main_window = parent # type: ElectrumWindow + self.main_window = parent self.wallet = parent.wallet self.prompt_if_unsaved = prompt_if_unsaved self.saved = False