Page MenuHomePhabricator

[electrum] fix update of amounts when changing unit
ClosedPublic

Authored by PiRK on Sat, Jul 5, 13:12.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC06282c4db8de: [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.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Sat, Jul 5, 13:12
Fabien requested changes to this revision.Mon, Jul 7, 07:59
Fabien added a subscriber: Fabien.
Fabien added inline comments.
electrum/electrumabc_gui/qt/main_window.py
1157 ↗(On Diff #54705)

Maybe add a comment to explain that it's connected to the unit_changed event that passes down the decimal point

1260 ↗(On Diff #54705)

dito

This revision now requires changes to proceed.Mon, Jul 7, 07:59

don't add unused args to update_status and update_tabs, use lambda function to ignore argument in the signal connection

remove unused docstring

This revision is now accepted and ready to land.Mon, Jul 7, 09:49