|
|
|
#:import _ electrum.i18n._
|
|
|
|
#:import Decimal decimal.Decimal
|
|
|
|
#:set btc_symbol unichr(171)
|
|
|
|
#:set mbtc_symbol unichr(187)
|
|
|
|
#:set font_light 'data/fonts/Roboto-Condensed.ttf'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ReceiveScreen:
|
|
|
|
name: 'receive'
|
|
|
|
mode: 'qr'
|
|
|
|
on_mode: if args[1] == 'nfc': from electrum_gui.kivy.nfc_scanner import NFCScanner
|
|
|
|
action_view: Factory.ReceiveActionView()
|
|
|
|
|
|
|
|
#on_activate:
|
|
|
|
# self.ids.toggle_qr.state = 'down'
|
|
|
|
# first_address = app.wallet.addresses()[0]
|
|
|
|
# qr.data = app.encode_uri(first_address,
|
|
|
|
# amount=amount_e.text,
|
|
|
|
# label=app.wallet.labels.get(first_address, first_address),
|
|
|
|
# message='') if app.wallet and app.wallet.addresses() else ''
|
|
|
|
#on_deactivate:
|
|
|
|
# self.ids.amount_e.focus = False
|
|
|
|
|
|
|
|
BoxLayout
|
|
|
|
padding: '12dp', '12dp', '12dp', '12dp'
|
|
|
|
spacing: '12dp'
|
|
|
|
mode: 'qr'
|
|
|
|
orientation: 'vertical'
|
|
|
|
SendReceiveToggle
|
|
|
|
SendToggle:
|
|
|
|
id: toggle_qr
|
|
|
|
text: 'QR'
|
|
|
|
state: 'down' if root.mode == 'qr' else 'normal'
|
|
|
|
source: 'atlas://gui/kivy/theming/light/qrcode'
|
|
|
|
background_down: 'atlas://gui/kivy/theming/light/btn_send_address'
|
|
|
|
on_release:
|
|
|
|
if root.mode == 'qr': root.mode = 'nr'
|
|
|
|
root.mode = 'qr'
|
|
|
|
SendToggle:
|
|
|
|
id: toggle_nfc
|
|
|
|
text: 'NFC'
|
|
|
|
state: 'down' if root.mode == 'nfc' else 'normal'
|
|
|
|
source: 'atlas://gui/kivy/theming/light/nfc'
|
|
|
|
background_down: 'atlas://gui/kivy/theming/light/btn_send_nfc'
|
|
|
|
on_release:
|
|
|
|
if root.mode == 'nfc': root.mode = 'nr'
|
|
|
|
root.mode = 'nfc'
|
|
|
|
GridLayout:
|
|
|
|
id: grid
|
|
|
|
cols: 1
|
|
|
|
#size_hint: 1, None
|
|
|
|
#height: self.minimum_height
|
|
|
|
SendReceiveCardTop
|
|
|
|
height: '110dp'
|
|
|
|
BoxLayout:
|
|
|
|
size_hint: 1, None
|
|
|
|
height: '42dp'
|
|
|
|
rows: 1
|
|
|
|
Label:
|
|
|
|
color: amount_e.foreground_color
|
|
|
|
bold: True
|
|
|
|
text_size: self.size
|
|
|
|
valign: 'bottom'
|
|
|
|
font_size: '22sp'
|
|
|
|
text:
|
|
|
|
u'[font={fnt}]{smbl}[/font]'.\
|
|
|
|
format(smbl=btc_symbol if app.base_unit == 'BTC' else mbtc_symbol, fnt=font_light)
|
|
|
|
size_hint_x: .25
|
|
|
|
ELTextInput:
|
|
|
|
id: amount_e
|
|
|
|
input_type: 'number'
|
|
|
|
multiline: False
|
|
|
|
bold: True
|
|
|
|
font_size: '50sp'
|
|
|
|
foreground_color: .308, .308, .308, 1
|
|
|
|
background_normal: 'atlas://gui/kivy/theming/light/tab_btn'
|
|
|
|
pos_hint: {'top': 1.5}
|
|
|
|
size_hint: .7, None
|
|
|
|
height: '67dp'
|
|
|
|
hint_text: 'Amount'
|
|
|
|
text: '0.0'
|
|
|
|
CardSeparator
|
|
|
|
BoxLayout:
|
|
|
|
size_hint: 1, None
|
|
|
|
height: '32dp'
|
|
|
|
spacing: '5dp'
|
|
|
|
Label:
|
|
|
|
color: lbl_quote.color
|
|
|
|
font_size: '12dp'
|
|
|
|
text: 'Ask to scan the QR below'
|
|
|
|
text_size: self.size
|
|
|
|
halign: 'left'
|
|
|
|
valign: 'middle'
|
|
|
|
Label:
|
|
|
|
id: lbl_quote
|
|
|
|
font_size: '12dp'
|
|
|
|
size_hint: .5, 1
|
|
|
|
color: .761, .761, .761, 1
|
|
|
|
text: u'= {}'.format(app.create_quote_text(Decimal(float(amount_e.text)), mode='symbol')) if amount_e.text else u'0'
|
|
|
|
text_size: self.size
|
|
|
|
halign: 'right'
|
|
|
|
valign: 'middle'
|
|
|
|
SendReceiveBlueBottom
|
|
|
|
id: blue_bottom
|
|
|
|
padding: '12dp', 0, '12dp', '12dp'
|
|
|
|
AddressSelector:
|
|
|
|
id: address_selection
|
|
|
|
foreground_color: blue_bottom.foreground_color
|
|
|
|
opacity: 1
|
|
|
|
size_hint: 1, None
|
|
|
|
height: blue_bottom.item_height
|
|
|
|
on_text:
|
|
|
|
if not args[1].startswith('Select'):\
|
|
|
|
qr.data = app.encode_uri(args[1],\
|
|
|
|
amount=amount_e.text,\
|
|
|
|
label=app.wallet.labels.get(args[1], args[1]),\
|
|
|
|
message='')
|
|
|
|
CardSeparator
|
|
|
|
opacity: address_selection.opacity
|
|
|
|
color: blue_bottom.foreground_color
|
|
|
|
Widget:
|
|
|
|
size_hint_y: None
|
|
|
|
height: dp(10)
|
|
|
|
FloatLayout
|
|
|
|
id: bl
|
|
|
|
QRCodeWidget:
|
|
|
|
id: qr
|
|
|
|
size_hint: None, 1
|
|
|
|
width: min(self.height, bl.width)
|
|
|
|
pos_hint: {'center': (.5, .5)}
|
|
|
|
on_touch_down:
|
|
|
|
if self.collide_point(*args[1].pos):\
|
|
|
|
app.show_info_bubble(icon=self.ids.qrimage.texture, text='texture')
|
|
|
|
Button:
|
|
|
|
background_color: (1, 1, 1, 1) if self.disabled else ((.258, .80, .388, 1) if self.state == 'normal' else (.203, .490, .741, 1))
|
|
|
|
text: _('Goto next step') if app.wallet and app.wallet.seed else _('Create unsigned transaction')
|
|
|
|
size_hint_y: None
|
|
|
|
height: '38dp'
|
|
|
|
#disabled: True if wallet_selection.opacity == 0 else False
|
|
|
|
on_release:
|
|
|
|
message = 'sending {} {} to {}'.format(\
|
|
|
|
app.base_unit, amount_e.text, payto_e.text)
|
|
|
|
app.gui.main_gui.do_send(self, message=message)
|
|
|
|
|
|
|
|
<ReceiveActionView@ActionView>
|
|
|
|
WalletActionPrevious:
|
|
|
|
id: action_previous
|
|
|
|
width: '32dp'
|
|
|
|
ActionButton:
|
|
|
|
id: action_logo
|
|
|
|
important: True
|
|
|
|
size_hint: 1, 1
|
|
|
|
markup: True
|
|
|
|
mipmap: True
|
|
|
|
bold: True
|
|
|
|
markup: True
|
|
|
|
color: 1, 1, 1, 1
|
|
|
|
text:
|
|
|
|
"[color=#777777][sub] [sup][size=9dp]{}[/size][/sup][/sub]{}[/color]"\
|
|
|
|
.format(app.base_unit, app.status)
|
|
|
|
font_size: '22dp'
|
|
|
|
minimum_width: '1dp'
|