add 'sat' as base unit option
This commit is contained in:
@@ -47,7 +47,9 @@ from electrum.i18n import _
|
||||
from electrum.util import (format_time, format_satoshis, format_fee_satoshis,
|
||||
format_satoshis_plain, NotEnoughFunds, PrintError,
|
||||
UserCancelled, NoDynamicFeeEstimates, profiler,
|
||||
export_meta, import_meta, bh2u, bfh, InvalidPassword)
|
||||
export_meta, import_meta, bh2u, bfh, InvalidPassword,
|
||||
base_units, base_units_list, base_unit_name_to_decimal_point,
|
||||
decimal_point_to_base_unit_name)
|
||||
from electrum import Transaction
|
||||
from electrum import util, bitcoin, commands, coinchooser
|
||||
from electrum import paymentrequest
|
||||
@@ -655,14 +657,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
return self.decimal_point
|
||||
|
||||
def base_unit(self):
|
||||
assert self.decimal_point in [2, 5, 8]
|
||||
if self.decimal_point == 2:
|
||||
return 'bits'
|
||||
if self.decimal_point == 5:
|
||||
return 'mBTC'
|
||||
if self.decimal_point == 8:
|
||||
return 'BTC'
|
||||
raise Exception('Unknown base unit')
|
||||
return decimal_point_to_base_unit_name(self.decimal_point)
|
||||
|
||||
def connect_fields(self, window, btc_e, fiat_e, fee_e):
|
||||
|
||||
@@ -2727,9 +2722,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
SSL_id_e.setReadOnly(True)
|
||||
id_widgets.append((SSL_id_label, SSL_id_e))
|
||||
|
||||
units = ['BTC', 'mBTC', 'bits']
|
||||
units = base_units_list
|
||||
msg = (_('Base unit of your wallet.')
|
||||
+ '\n1 BTC = 1000 mBTC. 1 mBTC = 1000 bits.\n'
|
||||
+ '\n1 BTC = 1000 mBTC. 1 mBTC = 1000 bits. 1 bit = 100 sat.\n'
|
||||
+ _('This setting affects the Send tab, and all balance related fields.'))
|
||||
unit_label = HelpLabel(_('Base unit') + ':', msg)
|
||||
unit_combo = QComboBox()
|
||||
@@ -2741,14 +2736,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
return
|
||||
edits = self.amount_e, self.fee_e, self.receive_amount_e
|
||||
amounts = [edit.get_amount() for edit in edits]
|
||||
if unit_result == 'BTC':
|
||||
self.decimal_point = 8
|
||||
elif unit_result == 'mBTC':
|
||||
self.decimal_point = 5
|
||||
elif unit_result == 'bits':
|
||||
self.decimal_point = 2
|
||||
else:
|
||||
raise Exception('Unknown base unit')
|
||||
self.decimal_point = base_unit_name_to_decimal_point(unit_result)
|
||||
self.config.set_key('decimal_point', self.decimal_point, True)
|
||||
nz.setMaximum(self.decimal_point)
|
||||
self.history_list.update()
|
||||
|
||||
Reference in New Issue
Block a user