config: add option to display amounts with msat precision
This commit is contained in:
@@ -98,8 +98,7 @@ class SettingsDialog(WindowModalDialog):
|
|||||||
if self.config.num_zeros != value:
|
if self.config.num_zeros != value:
|
||||||
self.config.num_zeros = value
|
self.config.num_zeros = value
|
||||||
self.config.set_key('num_zeros', value, True)
|
self.config.set_key('num_zeros', value, True)
|
||||||
self.window.history_list.update()
|
self.window.need_update.set()
|
||||||
self.window.address_list.update()
|
|
||||||
nz.valueChanged.connect(on_nz)
|
nz.valueChanged.connect(on_nz)
|
||||||
gui_widgets.append((nz_label, nz))
|
gui_widgets.append((nz_label, nz))
|
||||||
|
|
||||||
@@ -191,6 +190,17 @@ class SettingsDialog(WindowModalDialog):
|
|||||||
self.alias_e.editingFinished.connect(self.on_alias_edit)
|
self.alias_e.editingFinished.connect(self.on_alias_edit)
|
||||||
oa_widgets.append((alias_label, self.alias_e))
|
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
|
||||||
units = base_units_list
|
units = base_units_list
|
||||||
msg = (_('Base unit of your wallet.')
|
msg = (_('Base unit of your wallet.')
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ class SimpleConfig(Logger):
|
|||||||
except UnknownBaseUnit:
|
except UnknownBaseUnit:
|
||||||
self.decimal_point = DECIMAL_POINT_DEFAULT
|
self.decimal_point = DECIMAL_POINT_DEFAULT
|
||||||
self.num_zeros = int(self.get('num_zeros', 0))
|
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):
|
def electrum_path(self):
|
||||||
# Read electrum_path from command line
|
# Read electrum_path from command line
|
||||||
@@ -665,6 +666,7 @@ class SimpleConfig(Logger):
|
|||||||
decimal_point=self.decimal_point,
|
decimal_point=self.decimal_point,
|
||||||
is_diff=is_diff,
|
is_diff=is_diff,
|
||||||
whitespaces=whitespaces,
|
whitespaces=whitespaces,
|
||||||
|
precision=self.amt_precision_post_satoshi,
|
||||||
)
|
)
|
||||||
|
|
||||||
def format_amount_and_units(self, amount):
|
def format_amount_and_units(self, amount):
|
||||||
|
|||||||
Reference in New Issue
Block a user