mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-29 16:31:29 +00:00
kivy: more usable amount dialog
This commit is contained in:
parent
7e501115cd
commit
1e6d522137
1 changed files with 27 additions and 21 deletions
|
@ -13,21 +13,34 @@ Builder.load_string('''
|
||||||
anchor_x: 'center'
|
anchor_x: 'center'
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
size_hint: 0.8, 1
|
size_hint: 0.9, 1
|
||||||
|
Widget:
|
||||||
|
size_hint: 1, 0.2
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '80dp'
|
height: '80dp'
|
||||||
Label:
|
Button:
|
||||||
id: a
|
background_color: 0, 0, 0, 0
|
||||||
btc_text: (kb.amount + ' ' + app.base_unit) if kb.amount else ''
|
id: btc
|
||||||
fiat_text: (kb.fiat_amount + ' ' + app.fiat_unit) if kb.fiat_amount else ''
|
text: kb.amount + ' ' + app.base_unit
|
||||||
text1: ((self.fiat_text if kb.is_fiat else self.btc_text) if app.fiat_unit else self.btc_text) if self.btc_text else ''
|
color: (0.7, 0.7, 1, 1) if kb.is_fiat else (1, 1, 1, 1)
|
||||||
text2: ((self.btc_text if kb.is_fiat else self.fiat_text) if app.fiat_unit else '') if self.btc_text else ''
|
|
||||||
text: self.text1 + "\\n" + "[color=#8888ff]" + self.text2 + "[/color]"
|
|
||||||
halign: 'right'
|
halign: 'right'
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
font_size: '22dp'
|
font_size: '20dp'
|
||||||
height: '80dp'
|
height: '48dp'
|
||||||
|
on_release:
|
||||||
|
kb.is_fiat = False
|
||||||
|
Button:
|
||||||
|
background_color: 0, 0, 0, 0
|
||||||
|
id: fiat
|
||||||
|
text: kb.fiat_amount + ' ' + app.fiat_unit
|
||||||
|
color: (1, 1, 1, 1) if kb.is_fiat else (0.7, 0.7, 1, 1)
|
||||||
|
halign: 'right'
|
||||||
|
size_hint: 1, None
|
||||||
|
font_size: '20dp'
|
||||||
|
height: '48dp'
|
||||||
|
on_release:
|
||||||
|
kb.is_fiat = True
|
||||||
Widget:
|
Widget:
|
||||||
size_hint: 1, 0.2
|
size_hint: 1, 0.2
|
||||||
GridLayout:
|
GridLayout:
|
||||||
|
@ -65,6 +78,9 @@ Builder.load_string('''
|
||||||
text: '0'
|
text: '0'
|
||||||
KButton:
|
KButton:
|
||||||
text: '<'
|
text: '<'
|
||||||
|
Widget:
|
||||||
|
size_hint: 1, None
|
||||||
|
height: '48dp'
|
||||||
Button:
|
Button:
|
||||||
id: but_max
|
id: but_max
|
||||||
opacity: 1 if root.show_max else 0
|
opacity: 1 if root.show_max else 0
|
||||||
|
@ -75,13 +91,6 @@ Builder.load_string('''
|
||||||
on_release:
|
on_release:
|
||||||
kb.is_fiat = False
|
kb.is_fiat = False
|
||||||
kb.amount = app.get_max_amount()
|
kb.amount = app.get_max_amount()
|
||||||
Button:
|
|
||||||
id: button_fiat
|
|
||||||
size_hint: 1, None
|
|
||||||
height: '48dp'
|
|
||||||
text: (app.base_unit if not kb.is_fiat else app.fiat_unit) if app.fiat_unit else ''
|
|
||||||
on_release:
|
|
||||||
if app.fiat_unit: popup.toggle_fiat(kb)
|
|
||||||
Button:
|
Button:
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
|
@ -102,7 +111,7 @@ Builder.load_string('''
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
text: _('OK')
|
text: _('OK')
|
||||||
on_release:
|
on_release:
|
||||||
root.callback(a.btc_text)
|
root.callback(btc.text)
|
||||||
popup.dismiss()
|
popup.dismiss()
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
@ -117,9 +126,6 @@ class AmountDialog(Factory.Popup):
|
||||||
if amount:
|
if amount:
|
||||||
self.ids.kb.amount = amount
|
self.ids.kb.amount = amount
|
||||||
|
|
||||||
def toggle_fiat(self, a):
|
|
||||||
a.is_fiat = not a.is_fiat
|
|
||||||
|
|
||||||
def update_amount(self, c):
|
def update_amount(self, c):
|
||||||
kb = self.ids.kb
|
kb = self.ids.kb
|
||||||
amount = kb.fiat_amount if kb.is_fiat else kb.amount
|
amount = kb.fiat_amount if kb.is_fiat else kb.amount
|
||||||
|
|
Loading…
Add table
Reference in a new issue