Merge branch 'master' of git://github.com/spesmilo/electrum
This commit is contained in:
commit
d5db18c594
|
@ -154,9 +154,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
self.connect(self, QtCore.SIGNAL('payment_request_error'), self.payment_request_error)
|
self.connect(self, QtCore.SIGNAL('payment_request_error'), self.payment_request_error)
|
||||||
self.history_list.setFocus(True)
|
self.history_list.setFocus(True)
|
||||||
|
|
||||||
self.connect(self, QtCore.SIGNAL('watching_only_changed'),
|
|
||||||
self.watching_only_changed)
|
|
||||||
|
|
||||||
# network callbacks
|
# network callbacks
|
||||||
if self.network:
|
if self.network:
|
||||||
self.connect(self, QtCore.SIGNAL('network'), self.on_network_qt)
|
self.connect(self, QtCore.SIGNAL('network'), self.on_network_qt)
|
||||||
|
|
|
@ -392,14 +392,22 @@ class DeviceMgr(PrintError):
|
||||||
# See comment above for same code
|
# See comment above for same code
|
||||||
client.handler = wallet.handler
|
client.handler = wallet.handler
|
||||||
# This will trigger a PIN/passphrase entry request
|
# This will trigger a PIN/passphrase entry request
|
||||||
client_first_address = client.first_address(derivation)
|
try:
|
||||||
|
client_first_address = client.first_address(derivation)
|
||||||
|
except (UserCancelled, RuntimeError):
|
||||||
|
# Bad / cancelled PIN / passphrase
|
||||||
|
client_first_address = None
|
||||||
if client_first_address == first_address:
|
if client_first_address == first_address:
|
||||||
self.pair_wallet(wallet, info.device.id_)
|
self.pair_wallet(wallet, info.device.id_)
|
||||||
return client
|
return client
|
||||||
|
|
||||||
# The user input has wrong PIN or passphrase, or it is not pairable
|
# The user input has wrong PIN or passphrase, or cancelled input,
|
||||||
|
# or it is not pairable
|
||||||
raise DeviceUnpairableError(
|
raise DeviceUnpairableError(
|
||||||
_('Unable to pair with your %s.') % plugin.device)
|
_('Unable to pair with your %s.\n\n'
|
||||||
|
'Ensure you are able to pair it, or you have the seed phrase, '
|
||||||
|
'before you request bitcoins to be sent to this wallet.'
|
||||||
|
) % plugin.device)
|
||||||
|
|
||||||
def unpaired_device_infos(self, handler, plugin, devices=None):
|
def unpaired_device_infos(self, handler, plugin, devices=None):
|
||||||
'''Returns a list of DeviceInfo objects: one for each connected,
|
'''Returns a list of DeviceInfo objects: one for each connected,
|
||||||
|
|
|
@ -39,29 +39,21 @@ class BIP44_HW_Wallet(BIP44_Wallet):
|
||||||
# handler. The handler is per-window and preserved across
|
# handler. The handler is per-window and preserved across
|
||||||
# device reconnects
|
# device reconnects
|
||||||
self.handler = None
|
self.handler = None
|
||||||
self.force_watching_only = False
|
|
||||||
|
|
||||||
def set_session_timeout(self, seconds):
|
def set_session_timeout(self, seconds):
|
||||||
self.print_error("setting session timeout to %d seconds" % seconds)
|
self.print_error("setting session timeout to %d seconds" % seconds)
|
||||||
self.session_timeout = seconds
|
self.session_timeout = seconds
|
||||||
self.storage.put('session_timeout', seconds)
|
self.storage.put('session_timeout', seconds)
|
||||||
|
|
||||||
def set_force_watching_only(self, value):
|
|
||||||
if value != self.force_watching_only:
|
|
||||||
self.force_watching_only = value
|
|
||||||
self.handler.watching_only_changed()
|
|
||||||
|
|
||||||
def unpaired(self):
|
def unpaired(self):
|
||||||
'''A device paired with the wallet was diconnected. This can be
|
'''A device paired with the wallet was diconnected. This can be
|
||||||
called in any thread context.'''
|
called in any thread context.'''
|
||||||
self.print_error("unpaired")
|
self.print_error("unpaired")
|
||||||
self.set_force_watching_only(True)
|
|
||||||
|
|
||||||
def paired(self):
|
def paired(self):
|
||||||
'''A device paired with the wallet was (re-)connected. This can be
|
'''A device paired with the wallet was (re-)connected. This can be
|
||||||
called in any thread context.'''
|
called in any thread context.'''
|
||||||
self.print_error("paired")
|
self.print_error("paired")
|
||||||
self.set_force_watching_only(False)
|
|
||||||
|
|
||||||
def timeout(self):
|
def timeout(self):
|
||||||
'''Called when the wallet session times out. Note this is called from
|
'''Called when the wallet session times out. Note this is called from
|
||||||
|
@ -81,9 +73,10 @@ class BIP44_HW_Wallet(BIP44_Wallet):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_watching_only(self):
|
def is_watching_only(self):
|
||||||
'''The wallet is watching-only if its trezor device is unpaired.'''
|
'''The wallet is not watching-only; the user will be prompted for
|
||||||
|
pin and passphrase as appropriate when needed.'''
|
||||||
assert not self.has_seed()
|
assert not self.has_seed()
|
||||||
return self.force_watching_only
|
return False
|
||||||
|
|
||||||
def can_change_password(self):
|
def can_change_password(self):
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -53,9 +53,6 @@ class QtHandlerBase(QObject, PrintError):
|
||||||
def top_level_window(self):
|
def top_level_window(self):
|
||||||
return self.win.top_level_window()
|
return self.win.top_level_window()
|
||||||
|
|
||||||
def watching_only_changed(self):
|
|
||||||
self.win.emit(SIGNAL('watching_only_changed'))
|
|
||||||
|
|
||||||
def query_choice(self, msg, labels):
|
def query_choice(self, msg, labels):
|
||||||
self.done.clear()
|
self.done.clear()
|
||||||
self.qcSig.emit(msg, labels)
|
self.qcSig.emit(msg, labels)
|
||||||
|
|
|
@ -37,7 +37,6 @@ class BTChipWallet(BIP44_HW_Wallet):
|
||||||
# device reconnects
|
# device reconnects
|
||||||
self.handler = None
|
self.handler = None
|
||||||
self.force_watching_only = False
|
self.force_watching_only = False
|
||||||
|
|
||||||
self.device_checked = False
|
self.device_checked = False
|
||||||
self.signing = False
|
self.signing = False
|
||||||
|
|
||||||
|
|
|
@ -134,12 +134,7 @@ class TrezorCompatiblePlugin(HW_PluginBase):
|
||||||
assert self.main_thread != threading.current_thread()
|
assert self.main_thread != threading.current_thread()
|
||||||
|
|
||||||
devmgr = self.device_manager()
|
devmgr = self.device_manager()
|
||||||
try:
|
client = devmgr.client_for_wallet(self, wallet, force_pair)
|
||||||
client = devmgr.client_for_wallet(self, wallet, force_pair)
|
|
||||||
except:
|
|
||||||
wallet.set_force_watching_only(True)
|
|
||||||
raise
|
|
||||||
|
|
||||||
if client:
|
if client:
|
||||||
self.print_error("set last_operation")
|
self.print_error("set last_operation")
|
||||||
wallet.last_operation = time.time()
|
wallet.last_operation = time.time()
|
||||||
|
|
Loading…
Reference in New Issue