From 349a033ce6a599b1acd98d98b4cd1794b886aa83 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sun, 4 Apr 2021 01:43:49 +0200 Subject: [PATCH] qt: fix some widget parenting issues If you force-show a widget (e.g. `w.setVisible(True)`) before parenting it, a small window will flash (appear and disappear) for a fraction of second, which is a bit irritating. --- electrum/gui/qt/main_window.py | 8 +++++--- electrum/gui/qt/password_dialog.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 37aede244..4d11a069b 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -1028,9 +1028,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): self.history_model.set_view(self.history_list) l.searchable_list = l toolbar = l.create_toolbar(self.config) + tab = self.create_list_tab(l, toolbar) toolbar_shown = bool(self.config.get('show_toolbar_history', False)) l.show_toolbar(toolbar_shown) - return self.create_list_tab(l, toolbar) + return tab def show_address(self, addr): from . import address_dialog @@ -2032,9 +2033,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): from .address_list import AddressList self.address_list = l = AddressList(self) toolbar = l.create_toolbar(self.config) + tab = self.create_list_tab(l, toolbar) toolbar_shown = bool(self.config.get('show_toolbar_addresses', False)) l.show_toolbar(toolbar_shown) - return self.create_list_tab(l, toolbar) + return tab def create_utxo_tab(self): from .utxo_list import UTXOList @@ -2247,8 +2249,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): self.seed_button = StatusBarButton(read_QIcon("seed.png"), _("Seed"), self.show_seed_dialog) sb.addPermanentWidget(self.seed_button) self.lightning_button = StatusBarButton(read_QIcon("lightning.png"), _("Lightning Network"), self.gui_object.show_lightning_dialog) - self.update_lightning_icon() sb.addPermanentWidget(self.lightning_button) + self.update_lightning_icon() self.status_button = None if self.network: self.status_button = StatusBarButton(read_QIcon("status_disconnected.png"), _("Network"), self.gui_object.show_network_dialog) diff --git a/electrum/gui/qt/password_dialog.py b/electrum/gui/qt/password_dialog.py index c096ff4b0..2f2c9aed3 100644 --- a/electrum/gui/qt/password_dialog.py +++ b/electrum/gui/qt/password_dialog.py @@ -124,7 +124,8 @@ class PasswordLayout(object): self.encrypt_cb = QCheckBox(_('Encrypt wallet file')) self.encrypt_cb.setEnabled(False) grid.addWidget(self.encrypt_cb, 4, 0, 1, 2) - self.encrypt_cb.setVisible(kind != PW_PASSPHRASE) + if kind == PW_PASSPHRASE: + self.encrypt_cb.setVisible(False) def enable_OK(): ok = self.new_pw.text() == self.conf_pw.text()