diff --git a/electrum/gui/kivy/nfc_scanner/__init__.py b/electrum/gui/kivy/nfc_scanner/__init__.py index 81084a64c..8fb98d1bc 100644 --- a/electrum/gui/kivy/nfc_scanner/__init__.py +++ b/electrum/gui/kivy/nfc_scanner/__init__.py @@ -1,3 +1,6 @@ +from kivy.uix.widget import Widget +from kivy.properties import ObjectProperty + __all__ = ('NFCBase', 'NFCScanner') class NFCBase(Widget): diff --git a/electrum/gui/kivy/nfc_scanner/scanner_android.py b/electrum/gui/kivy/nfc_scanner/scanner_android.py index 32ffda169..84e6d4184 100644 --- a/electrum/gui/kivy/nfc_scanner/scanner_android.py +++ b/electrum/gui/kivy/nfc_scanner/scanner_android.py @@ -117,8 +117,8 @@ class ScannerAndroid(NFCBase): recTypes = [] for record in ndefrecords: recTypes.append({ - 'type': ''.join(map(unichr, record.getType())), - 'payload': ''.join(map(unichr, record.getPayload())) + 'type': ''.join(map(chr, record.getType())), + 'payload': ''.join(map(chr, record.getPayload())) }) details['recTypes'] = recTypes diff --git a/electrum/gui/kivy/nfc_scanner/scanner_dummy.py b/electrum/gui/kivy/nfc_scanner/scanner_dummy.py index a0d3e2643..3b3faf1a9 100644 --- a/electrum/gui/kivy/nfc_scanner/scanner_dummy.py +++ b/electrum/gui/kivy/nfc_scanner/scanner_dummy.py @@ -3,6 +3,7 @@ from . import NFCBase from kivy.clock import Clock from kivy.logger import Logger +from kivy.app import App class ScannerDummy(NFCBase): '''This is the dummy interface that gets selected in case any other diff --git a/electrum/gui/kivy/uix/dialogs/nfc_transaction.py b/electrum/gui/kivy/uix/dialogs/nfc_transaction.py index f6dfd5792..981f208c4 100644 --- a/electrum/gui/kivy/uix/dialogs/nfc_transaction.py +++ b/electrum/gui/kivy/uix/dialogs/nfc_transaction.py @@ -1,4 +1,8 @@ -class NFCTransactionDialog(AnimatedPopup): +from kivy.properties import ObjectProperty, OptionProperty +from kivy.factory import Factory + + +class NFCTransactionDialog(Factory.AnimatedPopup): mode = OptionProperty('send', options=('send','receive')) @@ -19,14 +23,14 @@ class NFCTransactionDialog(AnimatedPopup): sctr = self.ids.sctr if value: def _cmp(*l): - anim = Animation(rotation=2, scale=1, opacity=1) + anim = Factory.Animation(rotation=2, scale=1, opacity=1) anim.start(sctr) anim.bind(on_complete=_start) def _start(*l): - anim = Animation(rotation=350, scale=2, opacity=0) + anim = Factory.Animation(rotation=350, scale=2, opacity=0) anim.start(sctr) anim.bind(on_complete=_cmp) _start() return - Animation.cancel_all(sctr) \ No newline at end of file + Factory.Animation.cancel_all(sctr) diff --git a/electrum/gui/kivy/uix/drawer.py b/electrum/gui/kivy/uix/drawer.py index 49a9c399b..ade3bd102 100644 --- a/electrum/gui/kivy/uix/drawer.py +++ b/electrum/gui/kivy/uix/drawer.py @@ -10,6 +10,7 @@ from kivy.factory import Factory from kivy.properties import OptionProperty, NumericProperty, ObjectProperty from kivy.clock import Clock from kivy.lang import Builder +from kivy.logger import Logger import gc diff --git a/electrum/gui/kivy/uix/menus.py b/electrum/gui/kivy/uix/menus.py deleted file mode 100644 index a7cdaefe2..000000000 --- a/electrum/gui/kivy/uix/menus.py +++ /dev/null @@ -1,95 +0,0 @@ -from functools import partial - -from kivy.animation import Animation -from kivy.core.window import Window -from kivy.clock import Clock -from kivy.uix.bubble import Bubble, BubbleButton -from kivy.properties import ListProperty -from kivy.uix.widget import Widget - -from ..i18n import _ - -class ContextMenuItem(Widget): - '''abstract class - ''' - -class ContextButton(ContextMenuItem, BubbleButton): - pass - -class ContextMenu(Bubble): - - buttons = ListProperty([_('ok'), _('cancel')]) - '''List of Buttons to be displayed at the bottom''' - - __events__ = ('on_press', 'on_release') - - def __init__(self, **kwargs): - self._old_buttons = self.buttons - super(ContextMenu, self).__init__(**kwargs) - self.on_buttons(self, self.buttons) - - def on_touch_down(self, touch): - if not self.collide_point(*touch.pos): - self.hide() - return - return super(ContextMenu, self).on_touch_down(touch) - - def on_buttons(self, _menu, value): - if 'menu_content' not in self.ids.keys(): - return - if value == self._old_buttons: - return - blayout = self.ids.menu_content - blayout.clear_widgets() - for btn in value: - ib = ContextButton(text=btn) - ib.bind(on_press=partial(self.dispatch, 'on_press')) - ib.bind(on_release=partial(self.dispatch, 'on_release')) - blayout.add_widget(ib) - self._old_buttons = value - - def on_press(self, instance): - pass - - def on_release(self, instance): - pass - - def show(self, pos, duration=0): - Window.add_widget(self) - # wait for the bubble to adjust it's size according to text then animate - Clock.schedule_once(lambda dt: self._show(pos, duration)) - - def _show(self, pos, duration): - def on_stop(*l): - if duration: - Clock.schedule_once(self.hide, duration + .5) - - self.opacity = 0 - arrow_pos = self.arrow_pos - if arrow_pos[0] in ('l', 'r'): - pos = pos[0], pos[1] - (self.height/2) - else: - pos = pos[0] - (self.width/2), pos[1] - - self.limit_to = Window - - anim = Animation(opacity=1, pos=pos, d=.32) - anim.bind(on_complete=on_stop) - anim.cancel_all(self) - anim.start(self) - - - def hide(self, *dt): - - def on_stop(*l): - Window.remove_widget(self) - anim = Animation(opacity=0, d=.25) - anim.bind(on_complete=on_stop) - anim.cancel_all(self) - anim.start(self) - - def add_widget(self, widget, index=0): - if not isinstance(widget, ContextMenuItem): - super(ContextMenu, self).add_widget(widget, index) - return - menu_content.add_widget(widget, index) diff --git a/electrum/paymentrequest.py b/electrum/paymentrequest.py index 78df75666..0cb15e47f 100644 --- a/electrum/paymentrequest.py +++ b/electrum/paymentrequest.py @@ -370,8 +370,7 @@ def verify_cert_chain(chain): hashBytes = bytearray(hashlib.sha512(data).digest()) verify = pubkey.verify(sig, x509.PREFIX_RSA_SHA512 + hashBytes) else: - raise Exception("Algorithm not supported") - util.print_error(self.error, algo.getComponentByName('algorithm')) + raise Exception("Algorithm not supported: {}".format(algo)) if not verify: raise Exception("Certificate not Signed by Provided CA Certificate Chain") diff --git a/electrum/scripts/block_headers.py b/electrum/scripts/block_headers.py index d3ecb7fdb..649a0493e 100755 --- a/electrum/scripts/block_headers.py +++ b/electrum/scripts/block_headers.py @@ -3,6 +3,8 @@ # A simple script that connects to a server and displays block headers import time +import sys + from .. import SimpleConfig, Network from electrum.util import print_msg, json_encode