Browse Source

qt wallet information: show has_seed and watching_only

3.3.3.1
SomberNight 6 years ago
parent
commit
2a60a701bf
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 18
      electrum/gui/qt/main_window.py
  2. 5
      electrum/wallet.py

18
electrum/gui/qt/main_window.py

@ -56,8 +56,11 @@ from electrum.util import (format_time, format_satoshis, format_fee_satoshis,
UnknownBaseUnit, DECIMAL_POINT_DEFAULT) UnknownBaseUnit, DECIMAL_POINT_DEFAULT)
from electrum.transaction import Transaction, TxOutput from electrum.transaction import Transaction, TxOutput
from electrum.address_synchronizer import AddTransactionException from electrum.address_synchronizer import AddTransactionException
from electrum.wallet import Multisig_Wallet, CannotBumpFee from electrum.wallet import Multisig_Wallet, CannotBumpFee, Abstract_Wallet
from electrum.version import ELECTRUM_VERSION from electrum.version import ELECTRUM_VERSION
from electrum.network import Network
from electrum.exchange_rate import FxThread
from electrum.simple_config import SimpleConfig
from .exception_window import Exception_Hook from .exception_window import Exception_Hook
from .amountedit import AmountEdit, BTCAmountEdit, MyLineEdit, FeerateEdit from .amountedit import AmountEdit, BTCAmountEdit, MyLineEdit, FeerateEdit
@ -102,17 +105,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
computing_privkeys_signal = pyqtSignal() computing_privkeys_signal = pyqtSignal()
show_privkeys_signal = pyqtSignal() show_privkeys_signal = pyqtSignal()
def __init__(self, gui_object, wallet): def __init__(self, gui_object, wallet: Abstract_Wallet):
QMainWindow.__init__(self) QMainWindow.__init__(self)
self.gui_object = gui_object self.gui_object = gui_object
self.config = config = gui_object.config self.config = config = gui_object.config # type: SimpleConfig
self.setup_exception_hook() self.setup_exception_hook()
self.network = gui_object.daemon.network self.network = gui_object.daemon.network # type: Network
self.wallet = wallet self.wallet = wallet
self.fx = gui_object.daemon.fx self.fx = gui_object.daemon.fx # type: FxThread
self.invoices = wallet.invoices self.invoices = wallet.invoices
self.contacts = wallet.contacts self.contacts = wallet.contacts
self.tray = gui_object.tray self.tray = gui_object.tray
@ -2079,6 +2082,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
mpk_list = self.wallet.get_master_public_keys() mpk_list = self.wallet.get_master_public_keys()
vbox = QVBoxLayout() vbox = QVBoxLayout()
wallet_type = self.wallet.storage.get('wallet_type', '') wallet_type = self.wallet.storage.get('wallet_type', '')
if self.wallet.is_watching_only():
wallet_type += ' [{}]'.format(_('watching-only'))
seed_available = _('True') if self.wallet.has_seed() else _('False')
grid = QGridLayout() grid = QGridLayout()
basename = os.path.basename(self.wallet.storage.path) basename = os.path.basename(self.wallet.storage.path)
grid.addWidget(QLabel(_("Wallet name")+ ':'), 0, 0) grid.addWidget(QLabel(_("Wallet name")+ ':'), 0, 0)
@ -2087,6 +2093,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
grid.addWidget(QLabel(wallet_type), 1, 1) grid.addWidget(QLabel(wallet_type), 1, 1)
grid.addWidget(QLabel(_("Script type")+ ':'), 2, 0) grid.addWidget(QLabel(_("Script type")+ ':'), 2, 0)
grid.addWidget(QLabel(self.wallet.txin_type), 2, 1) grid.addWidget(QLabel(self.wallet.txin_type), 2, 1)
grid.addWidget(QLabel(_("Seed available") + ':'), 3, 0)
grid.addWidget(QLabel(str(seed_available)), 3, 1)
vbox.addLayout(grid) vbox.addLayout(grid)
if self.wallet.is_deterministic(): if self.wallet.is_deterministic():
mpk_text = ShowQRTextEdit() mpk_text = ShowQRTextEdit()

5
electrum/wallet.py

@ -1142,6 +1142,9 @@ class Abstract_Wallet(AddressSynchronizer):
# overloaded for TrustedCoin wallets # overloaded for TrustedCoin wallets
return False return False
def is_watching_only(self) -> bool:
raise NotImplementedError()
class Simple_Wallet(Abstract_Wallet): class Simple_Wallet(Abstract_Wallet):
# wallet with a single keystore # wallet with a single keystore
@ -1602,7 +1605,7 @@ class Multisig_Wallet(Deterministic_Wallet):
return self.keystore.has_seed() return self.keystore.has_seed()
def is_watching_only(self): def is_watching_only(self):
return not any([not k.is_watching_only() for k in self.get_keystores()]) return all([k.is_watching_only() for k in self.get_keystores()])
def get_master_public_key(self): def get_master_public_key(self):
return self.keystore.get_master_public_key() return self.keystore.get_master_public_key()

Loading…
Cancel
Save