|
@ -180,11 +180,11 @@ class ElectrumWindow(App): |
|
|
#self.config = self.gui_object.config |
|
|
#self.config = self.gui_object.config |
|
|
self.contacts = Contacts(self.electrum_config) |
|
|
self.contacts = Contacts(self.electrum_config) |
|
|
|
|
|
|
|
|
self.bind(url=self.set_url) |
|
|
self.bind(url=self.set_URI) |
|
|
# were we sent a url? |
|
|
# were we sent a url? |
|
|
url = self.electrum_config.get('url', None) |
|
|
url = self.electrum_config.get('url', None) |
|
|
if url: |
|
|
if url: |
|
|
self.set_url(url) |
|
|
self.set_URI(url) |
|
|
|
|
|
|
|
|
# create triggers so as to minimize updation a max of 2 times a sec |
|
|
# create triggers so as to minimize updation a max of 2 times a sec |
|
|
self._trigger_update_wallet =\ |
|
|
self._trigger_update_wallet =\ |
|
@ -194,10 +194,26 @@ class ElectrumWindow(App): |
|
|
self._trigger_notify_transactions = \ |
|
|
self._trigger_notify_transactions = \ |
|
|
Clock.create_trigger(self.notify_transactions, 5) |
|
|
Clock.create_trigger(self.notify_transactions, 5) |
|
|
|
|
|
|
|
|
def set_url(self, url): |
|
|
def set_URI(self, url): |
|
|
print "set url", url |
|
|
try: |
|
|
url = electrum.util.parse_URI(url) |
|
|
url = electrum.util.parse_URI(url) |
|
|
self.send_screen.set_qr_data(url) |
|
|
except: |
|
|
|
|
|
self.show_info("Invalid URI", url) |
|
|
|
|
|
return |
|
|
|
|
|
self.send_screen.set_URI(url) |
|
|
|
|
|
|
|
|
|
|
|
def send_from_clipboard(self, on_complete): |
|
|
|
|
|
if not self._clipboard: |
|
|
|
|
|
from kivy.core.clipboard import Clipboard |
|
|
|
|
|
self._clipboard = Clipboard |
|
|
|
|
|
contents = self._clipboard.get() |
|
|
|
|
|
try: |
|
|
|
|
|
uri = electrum.util.parse_URI(contents) |
|
|
|
|
|
except: |
|
|
|
|
|
self.show_info("Invalid URI", url) |
|
|
|
|
|
return |
|
|
|
|
|
on_complete(uri) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def scan_qr(self, on_complete): |
|
|
def scan_qr(self, on_complete): |
|
|
from jnius import autoclass |
|
|
from jnius import autoclass |
|
@ -211,7 +227,11 @@ class ElectrumWindow(App): |
|
|
if resultCode == -1: # RESULT_OK: |
|
|
if resultCode == -1: # RESULT_OK: |
|
|
contents = intent.getStringExtra("SCAN_RESULT") |
|
|
contents = intent.getStringExtra("SCAN_RESULT") |
|
|
if intent.getStringExtra("SCAN_RESULT_FORMAT") == 'QR_CODE': |
|
|
if intent.getStringExtra("SCAN_RESULT_FORMAT") == 'QR_CODE': |
|
|
|
|
|
try: |
|
|
uri = electrum.util.parse_URI(contents) |
|
|
uri = electrum.util.parse_URI(contents) |
|
|
|
|
|
except: |
|
|
|
|
|
self.show_info("Invalid URI", url) |
|
|
|
|
|
return |
|
|
on_complete(uri) |
|
|
on_complete(uri) |
|
|
activity.bind(on_activity_result=on_qr_result) |
|
|
activity.bind(on_activity_result=on_qr_result) |
|
|
PythonActivity.mActivity.startActivityForResult(intent, 0) |
|
|
PythonActivity.mActivity.startActivityForResult(intent, 0) |
|
|