app.set_URI
This commit is contained in:
parent
d91d321dfa
commit
2881565de3
|
@ -56,6 +56,15 @@ from kivy.core.clipboard import Clipboard
|
||||||
|
|
||||||
Factory.register('TabbedCarousel', module='electrum_gui.kivy.uix.screens')
|
Factory.register('TabbedCarousel', module='electrum_gui.kivy.uix.screens')
|
||||||
|
|
||||||
|
# Register fonts without this you won't be able to use bold/italic...
|
||||||
|
# inside markup.
|
||||||
|
from kivy.core.text import Label
|
||||||
|
Label.register('Roboto',
|
||||||
|
'gui/kivy/data/fonts/Roboto.ttf',
|
||||||
|
'gui/kivy/data/fonts/Roboto.ttf',
|
||||||
|
'gui/kivy/data/fonts/Roboto-Bold.ttf',
|
||||||
|
'gui/kivy/data/fonts/Roboto-Bold.ttf')
|
||||||
|
|
||||||
|
|
||||||
from electrum.util import base_units
|
from electrum.util import base_units
|
||||||
|
|
||||||
|
@ -66,12 +75,15 @@ class ElectrumWindow(App):
|
||||||
|
|
||||||
language = StringProperty('en')
|
language = StringProperty('en')
|
||||||
|
|
||||||
|
def set_URI(self, uri):
|
||||||
|
self.switch_to('send')
|
||||||
|
self.send_screen.set_URI(uri)
|
||||||
|
|
||||||
def on_new_intent(self, intent):
|
def on_new_intent(self, intent):
|
||||||
if intent.getScheme() != 'bitcoin':
|
if intent.getScheme() != 'bitcoin':
|
||||||
return
|
return
|
||||||
uri = intent.getDataString()
|
uri = intent.getDataString()
|
||||||
self.switch_to('send')
|
self.set_URI(uri)
|
||||||
self.send_screen.set_URI(uri)
|
|
||||||
|
|
||||||
def on_language(self, instance, language):
|
def on_language(self, instance, language):
|
||||||
Logger.info('language: {}'.format(language))
|
Logger.info('language: {}'.format(language))
|
||||||
|
@ -227,8 +239,7 @@ class ElectrumWindow(App):
|
||||||
|
|
||||||
def on_qr(self, data):
|
def on_qr(self, data):
|
||||||
if data.startswith('bitcoin:'):
|
if data.startswith('bitcoin:'):
|
||||||
self.switch_to('send')
|
self.set_URI(data)
|
||||||
self.send_screen.set_URI(data)
|
|
||||||
else:
|
else:
|
||||||
from electrum.bitcoin import base_decode
|
from electrum.bitcoin import base_decode
|
||||||
from electrum.transaction import Transaction
|
from electrum.transaction import Transaction
|
||||||
|
@ -303,27 +314,14 @@ class ElectrumWindow(App):
|
||||||
Logger.info('Time to on_start: {} <<<<<<<<'.format(time.clock()))
|
Logger.info('Time to on_start: {} <<<<<<<<'.format(time.clock()))
|
||||||
Logger.info("dpi: {} {}".format(metrics.dpi, metrics.dpi_rounded))
|
Logger.info("dpi: {} {}".format(metrics.dpi, metrics.dpi_rounded))
|
||||||
win = Window
|
win = Window
|
||||||
win.bind(size=self.on_size,
|
win.bind(size=self.on_size, on_keyboard=self.on_keyboard)
|
||||||
on_keyboard=self.on_keyboard)
|
|
||||||
win.bind(on_key_down=self.on_key_down)
|
win.bind(on_key_down=self.on_key_down)
|
||||||
|
|
||||||
# Register fonts without this you won't be able to use bold/italic...
|
|
||||||
# inside markup.
|
|
||||||
from kivy.core.text import Label
|
|
||||||
Label.register('Roboto',
|
|
||||||
'gui/kivy/data/fonts/Roboto.ttf',
|
|
||||||
'gui/kivy/data/fonts/Roboto.ttf',
|
|
||||||
'gui/kivy/data/fonts/Roboto-Bold.ttf',
|
|
||||||
'gui/kivy/data/fonts/Roboto-Bold.ttf')
|
|
||||||
|
|
||||||
win.softinput_mode = 'below_target'
|
win.softinput_mode = 'below_target'
|
||||||
self.on_size(win, win.size)
|
self.on_size(win, win.size)
|
||||||
self.init_ui()
|
self.init_ui()
|
||||||
self.load_wallet_by_name(self.electrum_config.get_wallet_path())
|
self.load_wallet_by_name(self.electrum_config.get_wallet_path())
|
||||||
# init plugins
|
# init plugins
|
||||||
run_hook('init_kivy', self)
|
run_hook('init_kivy', self)
|
||||||
# were we sent a url?
|
|
||||||
#self.uri = self.electrum_config.get('url')
|
|
||||||
# default tab
|
# default tab
|
||||||
self.switch_to('history')
|
self.switch_to('history')
|
||||||
# bind intent for bitcoin: URI scheme
|
# bind intent for bitcoin: URI scheme
|
||||||
|
@ -331,6 +329,11 @@ class ElectrumWindow(App):
|
||||||
from android import activity
|
from android import activity
|
||||||
activity.bind(on_new_intent=self.on_new_intent)
|
activity.bind(on_new_intent=self.on_new_intent)
|
||||||
|
|
||||||
|
# URI passed in config
|
||||||
|
uri = self.electrum_config.get('url')
|
||||||
|
if uri:
|
||||||
|
self.set_URI(uri)
|
||||||
|
|
||||||
def load_wallet_by_name(self, wallet_path):
|
def load_wallet_by_name(self, wallet_path):
|
||||||
if not wallet_path:
|
if not wallet_path:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue