HomePhabricator

[electrum] fix update of amounts when changing unit

Description

[electrum] fix update of amounts when changing unit

Summary:
There is some code that tries to update the amounts in the widgets of the send and receive tab when the unit is changed in the preferences menu.
But there were two issues:

  • the decimal_point attribute was not updated in XECAmountEdit
  • the base unit string was not updated in SettingsDialog and there was some code preventing the unit_changed signal from being emitted if the base_unit attribute was equal to the newly selected unit, so the signal was not emitted when changing to a new unit then back to the previous unit

After fixing the self.base_unit update in SettingsDialog, the if self.base_unit == unit_result: branch becomes dead code because the on_unit method is only called when the unit actually changes. So we can just remove that self.base_unit attribute which is not used anywhere else.

Depends on D18331

Test Plan: type an amount in the receive tab or send tab, go to Preferences and toggle between the 3 units, check that the value is correctly updated in the XECAmountWidget.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18331

Details

Provenance
PiRKAuthored on Jul 5 2025, 12:59
PiRKPushed on Jul 7 2025, 11:38
Reviewer
Restricted Project
Differential Revision
D18331: [electrum] fix update of amounts when changing unit
Parents
rABC2649c671c6a0: [electrum] fix fee unit in Preferences > Fee > Custom Fee Rate
Branches
Unknown
Tags
Unknown