1
0

config: add option to display amounts with msat precision

This commit is contained in:
SomberNight
2021-07-20 20:35:44 +02:00
parent 46badd128e
commit 5891e039b1
2 changed files with 14 additions and 2 deletions

View File

@@ -98,8 +98,7 @@ class SettingsDialog(WindowModalDialog):
if self.config.num_zeros != value:
self.config.num_zeros = value
self.config.set_key('num_zeros', value, True)
self.window.history_list.update()
self.window.address_list.update()
self.window.need_update.set()
nz.valueChanged.connect(on_nz)
gui_widgets.append((nz_label, nz))
@@ -191,6 +190,17 @@ class SettingsDialog(WindowModalDialog):
self.alias_e.editingFinished.connect(self.on_alias_edit)
oa_widgets.append((alias_label, self.alias_e))
msat_cb = QCheckBox(_("Show amounts with msat precision"))
msat_cb.setChecked(bool(self.config.get('amt_precision_post_satoshi', False)))
def on_msat_checked(b: bool):
prec = 3 if b else 0
if self.config.amt_precision_post_satoshi != prec:
self.config.amt_precision_post_satoshi = prec
self.config.set_key('amt_precision_post_satoshi', prec)
self.window.need_update.set()
msat_cb.stateChanged.connect(on_msat_checked)
lightning_widgets.append((msat_cb, None))
# units
units = base_units_list
msg = (_('Base unit of your wallet.')

View File

@@ -110,6 +110,7 @@ class SimpleConfig(Logger):
except UnknownBaseUnit:
self.decimal_point = DECIMAL_POINT_DEFAULT
self.num_zeros = int(self.get('num_zeros', 0))
self.amt_precision_post_satoshi = int(self.get('amt_precision_post_satoshi', 0))
def electrum_path(self):
# Read electrum_path from command line
@@ -665,6 +666,7 @@ class SimpleConfig(Logger):
decimal_point=self.decimal_point,
is_diff=is_diff,
whitespaces=whitespaces,
precision=self.amt_precision_post_satoshi,
)
def format_amount_and_units(self, amount):