mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-14 06:29:51 +00:00
parent
d5d9f5b46c
commit
b1dc281cba
1 changed files with 9 additions and 2 deletions
|
@ -120,6 +120,8 @@ from kivy.properties import BooleanProperty
|
||||||
|
|
||||||
class AmountDialog(Factory.Popup):
|
class AmountDialog(Factory.Popup):
|
||||||
show_max = BooleanProperty(False)
|
show_max = BooleanProperty(False)
|
||||||
|
app = App.get_running_app()
|
||||||
|
|
||||||
def __init__(self, show_max, amount, cb):
|
def __init__(self, show_max, amount, cb):
|
||||||
Factory.Popup.__init__(self)
|
Factory.Popup.__init__(self)
|
||||||
self.show_max = show_max
|
self.show_max = show_max
|
||||||
|
@ -129,8 +131,8 @@ class AmountDialog(Factory.Popup):
|
||||||
|
|
||||||
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 # type: str
|
||||||
if c == '<':
|
if c == '<': # delete
|
||||||
amount = amount[:-1]
|
amount = amount[:-1]
|
||||||
elif c == '.' and amount in ['0', '']:
|
elif c == '.' and amount in ['0', '']:
|
||||||
amount = '0.'
|
amount = '0.'
|
||||||
|
@ -142,6 +144,11 @@ class AmountDialog(Factory.Popup):
|
||||||
amount += c
|
amount += c
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
# truncate btc amounts to max precision:
|
||||||
|
if not kb.is_fiat and '.' in amount:
|
||||||
|
p = amount.find('.')
|
||||||
|
amount = amount.replace('.', '')
|
||||||
|
amount = amount[:p] + '.' + amount[p:p + self.app.decimal_point()]
|
||||||
if kb.is_fiat:
|
if kb.is_fiat:
|
||||||
kb.fiat_amount = amount
|
kb.fiat_amount = amount
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue