Browse Source

config: add option to display amounts with msat precision

patch-4
SomberNight 4 years ago
parent
commit
5891e039b1
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 14
      electrum/gui/qt/settings_dialog.py
  2. 2
      electrum/simple_config.py

14
electrum/gui/qt/settings_dialog.py

@ -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.')

2
electrum/simple_config.py

@ -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):

Loading…
Cancel
Save