1
0

updates for python3

This commit is contained in:
ThomasV
2017-03-15 12:13:20 +01:00
parent 65aeb0bd3c
commit ab15ff3a00
27 changed files with 50 additions and 51 deletions

View File

@@ -36,6 +36,7 @@ from electrum import transaction
from electrum.plugins import BasePlugin, hook
from electrum.i18n import _
from electrum.wallet import Multisig_Wallet
from electrum.util import bh2u
from electrum_gui.qt.transaction_dialog import show_transaction
@@ -129,8 +130,8 @@ class Plugin(BasePlugin):
self.cosigner_list = []
for key, keystore in wallet.keystores.items():
xpub = keystore.get_master_public_key()
K = bitcoin.deserialize_xpub(xpub)[-1].encode('hex')
_hash = bitcoin.Hash(K).encode('hex')
K = bitcoin.deserialize_xpub(xpub)[-1]
_hash = bh2u(bitcoin.Hash(K))
if not keystore.is_watching_only():
self.keys.append((key, _hash, window))
else:

View File

@@ -504,7 +504,7 @@ class DigitalBitbox_KeyStore(Hardware_KeyStore):
dbb_signatures.extend(reply['sign'])
# Fill signatures
if len(dbb_signatures) <> len(tx.inputs()):
if len(dbb_signatures) != len(tx.inputs()):
raise Exception("Incorrect number of transactions signed.") # Should never occur
for i, txin in enumerate(tx.inputs()):
num = txin['num_sig']
@@ -564,7 +564,7 @@ class DigitalBitboxPlugin(HW_PluginBase):
if device.interface_number == 0 or device.usage_page == 0xffff:
self.handler = handler
client = self.get_dbb_device(device)
if client <> None:
if client is not None:
client = DigitalBitbox_Client(client)
return client
else:

View File

@@ -123,7 +123,7 @@ class QtHandlerBase(QObject, PrintError):
vbox.addWidget(pw)
vbox.addLayout(Buttons(CancelButton(d), OkButton(d)))
d.setLayout(vbox)
passphrase = unicode(pw.text()) if d.exec_() else None
passphrase = pw.text() if d.exec_() else None
self.passphrase = passphrase
self.done.set()
@@ -137,7 +137,7 @@ class QtHandlerBase(QObject, PrintError):
hbox.addWidget(text)
hbox.addStretch(1)
dialog.exec_() # Firmware cannot handle cancellation
self.word = unicode(text.text())
self.word = text.text()
self.done.set()
def message_dialog(self, msg, on_cancel):
@@ -180,7 +180,7 @@ class QtPluginBase(object):
@hook
def load_wallet(self, wallet, window):
for keystore in wallet.get_keystores():
if type(keystore) != self.keystore_class:
if not isinstance(keystore, self.keystore_class):
continue
tooltip = self.device + '\n' + (keystore.label or 'unnamed')
cb = partial(self.show_settings_dialog, window, keystore)

View File

@@ -14,7 +14,7 @@ class KeepKeyPlugin(TrezorCompatiblePlugin):
def __init__(self, *args):
try:
import client
from . import client
import keepkeylib
import keepkeylib.ckd_public
import keepkeylib.transport_hid

View File

@@ -1,4 +1,4 @@
from labels import LabelsPlugin
from .labels import LabelsPlugin
from electrum.plugins import hook
class Plugin(LabelsPlugin):

View File

@@ -1,5 +1,5 @@
from trezorlib.client import proto, BaseClient, ProtocolMixin
from clientbase import TrezorClientBase
from .clientbase import TrezorClientBase
class TrezorClient(TrezorClientBase, ProtocolMixin, BaseClient):
def __init__(self, transport, handler, plugin):

View File

@@ -209,7 +209,7 @@ class TrezorClientBase(GuiMixin, PrintError):
return (f.major_version, f.minor_version, f.patch_version)
def atleast_version(self, major, minor=0, patch=0):
return cmp(self.firmware_version(), (major, minor, patch)) >= 0
return self.firmware_version() >= (major, minor, patch)
@staticmethod
def wrapper(func):

View File

@@ -10,7 +10,7 @@ from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
from electrum.i18n import _
from electrum.plugins import hook, DeviceMgr
from electrum.util import PrintError, UserCancelled
from electrum.util import PrintError, UserCancelled, bh2u
from electrum.wallet import Wallet, Standard_Wallet
PASSPHRASE_HELP_SHORT =_(
@@ -320,7 +320,7 @@ class SettingsDialog(WindowModalDialog):
def update(features):
self.features = features
set_label_enabled()
bl_hash = features.bootloader_hash.encode('hex')
bl_hash = bh2u(features.bootloader_hash)
bl_hash = "\n".join([bl_hash[:32], bl_hash[32:]])
noyes = [_("No"), _("Yes")]
endis = [_("Enable Passphrases"), _("Disable Passphrases")]

View File

@@ -13,7 +13,7 @@ class TrezorPlugin(TrezorCompatiblePlugin):
def __init__(self, *args):
try:
import client
from . import client
import trezorlib
import trezorlib.ckd_public
import trezorlib.transport_hid