commit e5e3ac0364a9eefcef8ad6c6cfe4a14e2e6a9b6b
parent aee2d8e12060e0568559627130ca8a9dc9b12bc9
Author: SomberNight <somber.night@protonmail.com>
Date: Mon, 17 Sep 2018 14:44:01 +0200
fix #4720
Diffstat:
8 files changed, 18 insertions(+), 104 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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