1
0

misc python3 updates:

- use jsonrpclib-pelix
 - update the kivy gui
 - update plugins
This commit is contained in:
ThomasV
2017-02-16 10:54:24 +01:00
parent e562b0b565
commit c3388d9677
32 changed files with 130 additions and 129 deletions

View File

@@ -157,7 +157,7 @@ class DigitalBitbox_Client():
self.isInitialized = True # Wallet exists. Electrum code later checks if the device matches the wallet
elif not self.isInitialized:
reply = self.hid_send_encrypt('{"device":"info"}')
if reply['device']['id'] <> "":
if reply['device']['id'] != "":
self.recover_or_erase_dialog() # Already seeded
else:
self.seed_device_dialog() # Seed if not initialized
@@ -594,7 +594,7 @@ class DigitalBitboxPlugin(HW_PluginBase):
handler = keystore.handler
with devmgr.hid_lock:
client = devmgr.client_for_keystore(self, handler, keystore, force_pair)
if client <> None:
if client is not None:
client.check_device_dialog()
return client

View File

@@ -1,6 +1,6 @@
from PyQt4.Qt import (QInputDialog, QLineEdit)
from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
from digitalbitbox import DigitalBitboxPlugin
from .digitalbitbox import DigitalBitboxPlugin
class Plugin(DigitalBitboxPlugin, QtPluginBase):

View File

@@ -1,5 +1,5 @@
from ..trezor.qt_generic import QtPlugin
from keepkey import KeepKeyPlugin
from .keepkey import KeepKeyPlugin
class Plugin(KeepKeyPlugin, QtPlugin):

View File

@@ -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)

View File

@@ -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

View File

@@ -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"

View File

@@ -1,5 +1,5 @@
from ..trezor.qt_generic import QtPlugin
from trezor import TrezorPlugin
from .trezor import TrezorPlugin
class Plugin(TrezorPlugin, QtPlugin):

View File

@@ -37,7 +37,7 @@ from electrum_gui.qt.amountedit import AmountEdit
from electrum_gui.qt.main_window import StatusBarButton
from electrum.i18n import _
from electrum.plugins import hook
from trustedcoin import TrustedCoinPlugin, server
from .trustedcoin import TrustedCoinPlugin, server
class Plugin(TrustedCoinPlugin):

View File

@@ -90,11 +90,10 @@ class TrustedCoinCosignerClient(object):
kwargs['headers']['content-type'] = 'application/json'
url = urljoin(self.base_url, relative_url)
if self.debug:
print '%s %s %s' % (method, url, data)
print('%s %s %s' % (method, url, data))
response = requests.request(method, url, **kwargs)
if self.debug:
print response.text
print
print(response.text)
if response.status_code != 200:
message = str(response.text)
if response.headers.get('content-type') == 'application/json':