Browse Source

config: make adding thousand separators to amounts optional

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

11
electrum/gui/qt/settings_dialog.py

@ -225,6 +225,17 @@ class SettingsDialog(WindowModalDialog):
unit_combo.currentIndexChanged.connect(lambda x: on_unit(x, nz))
gui_widgets.append((unit_label, unit_combo))
thousandsep_cb = QCheckBox(_("Add thousand separators to bitcoin amounts"))
thousandsep_cb.setChecked(bool(self.config.get('amt_add_thousands_sep', False)))
def on_set_thousandsep(v):
checked = v == Qt.Checked
if self.config.amt_add_thousands_sep != checked:
self.config.amt_add_thousands_sep = checked
self.config.set_key('amt_add_thousands_sep', checked)
self.window.need_update.set()
thousandsep_cb.stateChanged.connect(on_set_thousandsep)
gui_widgets.append((thousandsep_cb, None))
qr_combo = QComboBox()
qr_combo.addItem("Default", "default")
msg = (_("For scanning QR codes.") + "\n"

5
electrum/simple_config.py

@ -111,6 +111,7 @@ class SimpleConfig(Logger):
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))
self.amt_add_thousands_sep = bool(self.get('amt_add_thousands_sep', False))
def electrum_path(self):
# Read electrum_path from command line
@ -659,7 +660,7 @@ class SimpleConfig(Logger):
except:
pass
def format_amount(self, x, is_diff=False, whitespaces=False, add_thousands_sep=True):
def format_amount(self, x, is_diff=False, whitespaces=False):
return format_satoshis(
x,
num_zeros=self.num_zeros,
@ -667,7 +668,7 @@ class SimpleConfig(Logger):
is_diff=is_diff,
whitespaces=whitespaces,
precision=self.amt_precision_post_satoshi,
add_thousands_sep=add_thousands_sep,
add_thousands_sep=self.amt_add_thousands_sep,
)
def format_amount_and_units(self, amount):

Loading…
Cancel
Save