misc python3 updates:
- use jsonrpclib-pelix - update the kivy gui - update plugins
This commit is contained in:
@@ -225,7 +225,7 @@ class LedgerAuthDialog(QDialog):
|
||||
try:
|
||||
mode = self.dongle.exchange( bytearray(apdu) )
|
||||
return mode
|
||||
except BTChipException, e:
|
||||
except BTChipException as e:
|
||||
debug_msg('Device getMode Failed')
|
||||
return 0x11
|
||||
|
||||
@@ -274,7 +274,7 @@ class LedgerWebSocket(QThread):
|
||||
challenge = self.dongle.exchange( bytearray(apdu) )
|
||||
ws.send( '{"type":"challenge","data":"%s" }' % str(challenge).encode('hex') )
|
||||
self.data = data
|
||||
except BTChipException, e:
|
||||
except BTChipException as e:
|
||||
debug_msg('Identify Failed')
|
||||
|
||||
if data['type'] == 'challenge':
|
||||
@@ -287,7 +287,7 @@ class LedgerWebSocket(QThread):
|
||||
ws.send( '{"type":"pairing","is_successful":"true"}' )
|
||||
self.data['pairid'] = self.pairID
|
||||
self.pairing_done.emit(self.data)
|
||||
except BTChipException, e:
|
||||
except BTChipException as e:
|
||||
debug_msg('Pairing Failed')
|
||||
ws.send( '{"type":"pairing","is_successful":"false"}' )
|
||||
self.pairing_done.emit(None)
|
||||
|
||||
@@ -90,7 +90,7 @@ class Ledger_Client():
|
||||
try:
|
||||
client.getVerifyPinRemainingAttempts()
|
||||
return True
|
||||
except BTChipException, e:
|
||||
except BTChipException as e:
|
||||
if e.sw == 0x6d00:
|
||||
return False
|
||||
raise e
|
||||
@@ -99,7 +99,7 @@ class Ledger_Client():
|
||||
try:
|
||||
# Invalid SET OPERATION MODE to verify the PIN status
|
||||
client.dongle.exchange(bytearray([0xe0, 0x26, 0x00, 0x00, 0x01, 0xAB]))
|
||||
except BTChipException, e:
|
||||
except BTChipException as e:
|
||||
if (e.sw == 0x6982):
|
||||
return False
|
||||
if (e.sw == 0x6A80):
|
||||
@@ -118,16 +118,16 @@ class Ledger_Client():
|
||||
raise Exception("HW1 firmware version too old. Please update at https://www.ledgerwallet.com")
|
||||
try:
|
||||
self.dongleObject.getOperationMode()
|
||||
except BTChipException, e:
|
||||
except BTChipException as e:
|
||||
if (e.sw == 0x6985):
|
||||
self.dongleObject.dongle.close()
|
||||
self.handler.get_setup( )
|
||||
# Acquire the new client on the next run
|
||||
else:
|
||||
raise e
|
||||
if self.has_detached_pin_support(self.dongleObject) and not self.is_pin_validated(self.dongleObject) and (self.handler <> None):
|
||||
if self.has_detached_pin_support(self.dongleObject) and not self.is_pin_validated(self.dongleObject) and (self.handler is not None):
|
||||
remaining_attempts = self.dongleObject.getVerifyPinRemainingAttempts()
|
||||
if remaining_attempts <> 1:
|
||||
if remaining_attempts != 1:
|
||||
msg = "Enter your Ledger PIN - remaining attempts : " + str(remaining_attempts)
|
||||
else:
|
||||
msg = "Enter your Ledger PIN - WARNING : LAST ATTEMPT. If the PIN is not correct, the dongle will be wiped."
|
||||
@@ -136,7 +136,7 @@ class Ledger_Client():
|
||||
raise Exception('Aborted by user - please unplug the dongle and plug it again before retrying')
|
||||
pin = pin.encode()
|
||||
self.dongleObject.verifyPin(pin)
|
||||
except BTChipException, e:
|
||||
except BTChipException as e:
|
||||
if (e.sw == 0x6faa):
|
||||
raise Exception("Dongle is temporarily locked - please unplug it and replug it again")
|
||||
if ((e.sw & 0xFFF0) == 0x63c0):
|
||||
@@ -225,7 +225,7 @@ class Ledger_KeyStore(Hardware_KeyStore):
|
||||
raise UserWarning(_('Cancelled by user'))
|
||||
pin = str(pin).encode()
|
||||
signature = self.get_client().signMessageSign(pin)
|
||||
except BTChipException, e:
|
||||
except BTChipException as e:
|
||||
if e.sw == 0x6a80:
|
||||
self.give_error("Unfortunately, this message cannot be signed by the Ledger wallet. Only alphanumerical messages shorter than 140 characters are supported. Please remove any extra characters (tab, carriage return) and retry.")
|
||||
else:
|
||||
@@ -233,7 +233,7 @@ class Ledger_KeyStore(Hardware_KeyStore):
|
||||
except UserWarning:
|
||||
self.handler.show_error(_('Cancelled by user'))
|
||||
return ''
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.give_error(e, True)
|
||||
finally:
|
||||
self.handler.clear_dialog()
|
||||
@@ -469,7 +469,7 @@ class LedgerPlugin(HW_PluginBase):
|
||||
self.handler = handler
|
||||
|
||||
client = self.get_btchip_device(device)
|
||||
if client <> None:
|
||||
if client is not None:
|
||||
client = Ledger_Client(client)
|
||||
return client
|
||||
|
||||
@@ -501,6 +501,6 @@ class LedgerPlugin(HW_PluginBase):
|
||||
# returns the client for a given keystore. can use xpub
|
||||
#if client:
|
||||
# client.used()
|
||||
if client <> None:
|
||||
if client is not None:
|
||||
client.checkDevice()
|
||||
return client
|
||||
|
||||
@@ -9,7 +9,7 @@ from .ledger import LedgerPlugin
|
||||
from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
|
||||
from electrum_gui.qt.util import *
|
||||
|
||||
from btchip.btchipPersoWizard import StartBTChipPersoDialog
|
||||
#from btchip.btchipPersoWizard import StartBTChipPersoDialog
|
||||
|
||||
class Plugin(LedgerPlugin, QtPluginBase):
|
||||
icon_unpaired = ":icons/ledger_unpaired.png"
|
||||
|
||||
Reference in New Issue
Block a user