qt: follow-up "rm thousand sep when copying numbers to clipboard"

follow-up https://github.com/spesmilo/electrum/pull/8479
This commit is contained in:
SomberNight
2023-06-13 15:59:18 +00:00
parent 5b5100eedc
commit 23f2412da7
10 changed files with 49 additions and 27 deletions

View File

@@ -651,13 +651,16 @@ class FxThread(ThreadJob, EventListener):
def fiat_value(self, satoshis, rate) -> Decimal:
return Decimal('NaN') if satoshis is None else Decimal(satoshis) / COIN * Decimal(rate)
def value_str(self, satoshis, rate) -> str:
return self.format_fiat(self.fiat_value(satoshis, rate))
def value_str(self, satoshis, rate, *, add_thousands_sep: bool = None) -> str:
fiat_val = self.fiat_value(satoshis, rate)
return self.format_fiat(fiat_val, add_thousands_sep=add_thousands_sep)
def format_fiat(self, value: Decimal) -> str:
def format_fiat(self, value: Decimal, *, add_thousands_sep: bool = None) -> str:
if value.is_nan():
return _("No data")
return self.ccy_amount_str(value, add_thousands_sep=True)
if add_thousands_sep is None:
add_thousands_sep = True
return self.ccy_amount_str(value, add_thousands_sep=add_thousands_sep)
def history_rate(self, d_t: Optional[datetime]) -> Decimal:
if d_t is None: