mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-12 05:29:52 +00:00
kivy updates
This commit is contained in:
parent
6ec610c359
commit
1126555f14
5 changed files with 55 additions and 59 deletions
|
@ -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)
|
||||||
|
|
|
@ -177,8 +177,11 @@ class ScreenPassword(Factory.Screen):
|
||||||
|
|
||||||
|
|
||||||
class SendScreen(CScreen):
|
class SendScreen(CScreen):
|
||||||
|
|
||||||
kvname = 'send'
|
kvname = 'send'
|
||||||
def set_qr_data(self, uri):
|
|
||||||
|
def set_URI(self, uri):
|
||||||
|
print "z", uri
|
||||||
self.ids.payto_e.text = uri.get('address', '')
|
self.ids.payto_e.text = uri.get('address', '')
|
||||||
self.ids.message_e.text = uri.get('message', '')
|
self.ids.message_e.text = uri.get('message', '')
|
||||||
amount = uri.get('amount')
|
amount = uri.get('amount')
|
||||||
|
|
|
@ -29,7 +29,7 @@ ReceiveScreen:
|
||||||
Label:
|
Label:
|
||||||
id: address
|
id: address
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '38dp'
|
height: '48dp'
|
||||||
opacity: 0.5 if qr.shaded else 1
|
opacity: 0.5 if qr.shaded else 1
|
||||||
|
|
||||||
SendReceiveBlueBottom:
|
SendReceiveBlueBottom:
|
||||||
|
@ -51,7 +51,7 @@ ReceiveScreen:
|
||||||
text_size: (amount.width-15, None)
|
text_size: (amount.width-15, None)
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
size_hint: 0.5, None
|
size_hint: 0.5, None
|
||||||
height: '38dp'
|
height: '48dp'
|
||||||
on_release: app.amount_dialog(amount, receive_screen.parent.update_qr, False)
|
on_release: app.amount_dialog(amount, receive_screen.parent.update_qr, False)
|
||||||
background_color: 0, 0, 0, 0
|
background_color: 0, 0, 0, 0
|
||||||
CardSeparator:
|
CardSeparator:
|
||||||
|
@ -75,16 +75,16 @@ ReceiveScreen:
|
||||||
|
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '38dp'
|
height: '48dp'
|
||||||
Button:
|
Button:
|
||||||
text: _('Clear')
|
text: _('Clear')
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '38dp'
|
height: '48dp'
|
||||||
on_release: receive_screen.parent.do_clear()
|
on_release: receive_screen.parent.do_clear()
|
||||||
Button:
|
Button:
|
||||||
text: _('Share')
|
text: _('Share')
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '38dp'
|
height: '48dp'
|
||||||
on_release: receive_screen.parent.do_share()
|
on_release: receive_screen.parent.do_share()
|
||||||
|
|
||||||
Widget:
|
Widget:
|
||||||
|
|
|
@ -28,20 +28,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<SendReceiveToggle@BoxLayout>
|
|
||||||
padding: '5dp', '5dp'
|
|
||||||
size_hint: 1, None
|
|
||||||
height: '45dp'
|
|
||||||
canvas.before:
|
|
||||||
Color:
|
|
||||||
rgba: 1, 1, 1, 1
|
|
||||||
BorderImage:
|
|
||||||
border: 12, 12, 12, 12
|
|
||||||
source: 'atlas://gui/kivy/theming/light/card'
|
|
||||||
size: self.width + dp(3), self.height
|
|
||||||
pos: self.x - dp(1.5), self.y
|
|
||||||
|
|
||||||
|
|
||||||
SendScreen:
|
SendScreen:
|
||||||
|
|
||||||
id: send_screen
|
id: send_screen
|
||||||
|
@ -55,25 +41,6 @@ SendScreen:
|
||||||
padding: '12dp', '12dp', '12dp', '12dp'
|
padding: '12dp', '12dp', '12dp', '12dp'
|
||||||
spacing: '12dp'
|
spacing: '12dp'
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
SendReceiveToggle:
|
|
||||||
size_hint: 1, None
|
|
||||||
SendToggle:
|
|
||||||
id: qr
|
|
||||||
text: 'QR Code'
|
|
||||||
group: 'send_type'
|
|
||||||
source: 'atlas://gui/kivy/theming/light/qrcode'
|
|
||||||
on_release:
|
|
||||||
app.scan_qr(on_complete=root.set_qr_data)
|
|
||||||
state: 'down'
|
|
||||||
background_down: 'atlas://gui/kivy/theming/light/btn_send_nfc'
|
|
||||||
SendToggle:
|
|
||||||
id: nfc_toggle
|
|
||||||
text: 'NFC'
|
|
||||||
group: 'send_type'
|
|
||||||
state: 'normal'
|
|
||||||
source: 'atlas://gui/kivy/theming/light/nfc'
|
|
||||||
background_down: 'atlas://gui/kivy/theming/light/btn_send_nfc'
|
|
||||||
|
|
||||||
SendReceiveBlueBottom:
|
SendReceiveBlueBottom:
|
||||||
id: blue_bottom
|
id: blue_bottom
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
|
@ -108,7 +75,7 @@ SendScreen:
|
||||||
text_size: (self.width-15, None)
|
text_size: (self.width-15, None)
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
size_hint: 0.5, None
|
size_hint: 0.5, None
|
||||||
height: '38dp'
|
height: '48dp'
|
||||||
on_release: app.amount_dialog(self, None, True)
|
on_release: app.amount_dialog(self, None, True)
|
||||||
background_color: .238, .585, .878, 0
|
background_color: .238, .585, .878, 0
|
||||||
CardSeparator:
|
CardSeparator:
|
||||||
|
@ -130,18 +97,31 @@ SendScreen:
|
||||||
hint_text: 'Description (optional)'
|
hint_text: 'Description (optional)'
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '38dp'
|
height: '48dp'
|
||||||
|
Button:
|
||||||
|
id: qr
|
||||||
|
text: _('QR Code')
|
||||||
|
on_release:
|
||||||
|
app.scan_qr(on_complete=root.set_URI)
|
||||||
|
Button:
|
||||||
|
id: paste_button
|
||||||
|
text: _('Clipboard')
|
||||||
|
on_release:
|
||||||
|
app.send_from_clipboard(on_complete=root.set_URI)
|
||||||
Button:
|
Button:
|
||||||
text: _('Clear')
|
text: _('Clear')
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '38dp'
|
height: '48dp'
|
||||||
on_release: send_screen.do_clear()
|
on_release: send_screen.do_clear()
|
||||||
|
Widget:
|
||||||
|
size_hint: 1, 1
|
||||||
|
BoxLayout:
|
||||||
|
size_hint: 1, None
|
||||||
|
height: '48dp'
|
||||||
Button:
|
Button:
|
||||||
text: _('Send')
|
text: _('Send')
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '38dp'
|
height: '48dp'
|
||||||
on_release: send_screen.do_send()
|
on_release: send_screen.do_send()
|
||||||
Widget:
|
|
||||||
size_hint: 1, 1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
#:import os os
|
#:import os os
|
||||||
|
|
||||||
|
|
||||||
<WalletSelector@BlueSpinner>
|
|
||||||
icon: 'atlas://gui/kivy/theming/light/wallet'
|
|
||||||
values: ('default Wallet',)
|
|
||||||
text: _('Select your wallet')
|
|
||||||
|
|
||||||
|
|
||||||
Popup:
|
Popup:
|
||||||
title: _('Wallets')
|
title: _('Wallets')
|
||||||
id: popup
|
id: popup
|
||||||
|
|
Loading…
Add table
Reference in a new issue