mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-28 16:01:30 +00:00
handle shortcut explicitly
This commit is contained in:
parent
35ecbff7a5
commit
ef3ae450f3
2 changed files with 6 additions and 2 deletions
|
@ -11,6 +11,7 @@ class AmountEdit(QLineEdit):
|
||||||
self.text_getter = text_getter
|
self.text_getter = text_getter
|
||||||
self.textChanged.connect(self.numbify)
|
self.textChanged.connect(self.numbify)
|
||||||
self.is_int = is_int
|
self.is_int = is_int
|
||||||
|
self.is_shortcut = False
|
||||||
|
|
||||||
|
|
||||||
def paintEvent(self, event):
|
def paintEvent(self, event):
|
||||||
|
@ -27,6 +28,8 @@ class AmountEdit(QLineEdit):
|
||||||
|
|
||||||
def numbify(self):
|
def numbify(self):
|
||||||
text = unicode(self.text()).strip()
|
text = unicode(self.text()).strip()
|
||||||
|
if text == '!':
|
||||||
|
self.is_shortcut = True
|
||||||
pos = self.cursorPosition()
|
pos = self.cursorPosition()
|
||||||
chars = '0123456789'
|
chars = '0123456789'
|
||||||
if not self.is_int: chars +='.'
|
if not self.is_int: chars +='.'
|
||||||
|
|
|
@ -408,7 +408,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
return format_satoshis(x, is_diff, self.wallet.num_zeros, self.decimal_point)
|
return format_satoshis(x, is_diff, self.wallet.num_zeros, self.decimal_point)
|
||||||
|
|
||||||
def read_amount(self, x):
|
def read_amount(self, x):
|
||||||
if x == '': return None
|
if x in['.', '']: return None
|
||||||
p = pow(10, self.decimal_point)
|
p = pow(10, self.decimal_point)
|
||||||
return int( p * Decimal(x) )
|
return int( p * Decimal(x) )
|
||||||
|
|
||||||
|
@ -717,7 +717,8 @@ class ElectrumWindow(QMainWindow):
|
||||||
def entry_changed( is_fee ):
|
def entry_changed( is_fee ):
|
||||||
self.funds_error = False
|
self.funds_error = False
|
||||||
|
|
||||||
if self.amount_e.text() == '.':
|
if self.amount_e.is_shortcut:
|
||||||
|
self.amount_e.is_shortcut = False
|
||||||
c, u = self.wallet.get_account_balance(self.current_account)
|
c, u = self.wallet.get_account_balance(self.current_account)
|
||||||
inputs, total, fee = self.wallet.choose_tx_inputs( c + u, 0, self.current_account)
|
inputs, total, fee = self.wallet.choose_tx_inputs( c + u, 0, self.current_account)
|
||||||
fee = self.wallet.estimated_fee(inputs)
|
fee = self.wallet.estimated_fee(inputs)
|
||||||
|
|
Loading…
Add table
Reference in a new issue