HomePhabricator

[electrum] remove more uses of main_window in ContactList

Description

[electrum] remove more uses of main_window in ContactList

Summary:
Ideally the child widget should not have to know its parent's API, so let's remove a few more unnecessary connections.

  • show_error and show_message are provided by MessageBoxMixin, which ContactList inherits from
  • the QApplication instance can be fetched directly through QWidget
  • main_window.get_wallet_folder() is a one-liner that only needs self.config, which ContactList already has a reference to
  • the parent parameter for new contact dialog can be get via the self.top_level_window(), provided for some reason by MessageBoxMixin

Test Plan:
In the contacts tab, try all the context menu actions:

  • add contact (try with a valid address and an invalid addresse to trigger an error dialog)
  • export and import contacts (try also importing an invalid contacts file)
  • with one or multiple contacts selected, try "Copy Label" and check it is in the clipboard

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
PiRKAuthored on Sep 26 2023, 06:13
PiRKPushed on Sep 26 2023, 15:44
Reviewer
Restricted Project
Differential Revision
D14536: [electrum] remove more uses of main_window in ContactList
Parents
rABC3606c76051e3: [electrum] pass a wallet.contacts reference to ContactList
Branches
Unknown
Tags
Unknown