From 52e2ced62e5110dc2e4a204d813ee2d1361d863f Mon Sep 17 00:00:00 2001 From: f321x Date: Fri, 13 Jun 2025 14:45:27 +0200 Subject: [PATCH] qt: fix: ToU 'I Accept' button not getting enabled The 'I Accept' button might not get enabled for some users where startup is very slow. The first check if the 'I Agree' button should be enabled gets fired 100ms after constructing the Dialog, which might not be enough. So we can either remove the logic completely (done here) to prevent these issues, or alternatively increase the initial timer to some large timout after which the window should be assembled fully (e.g. 2 seconds). As the user is not able to read the whole terms in few seconds this would be a viable option too. --- electrum/gui/qt/wizard/terms_of_use.py | 27 +------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/electrum/gui/qt/wizard/terms_of_use.py b/electrum/gui/qt/wizard/terms_of_use.py index 503de3b2e..324b67662 100644 --- a/electrum/gui/qt/wizard/terms_of_use.py +++ b/electrum/gui/qt/wizard/terms_of_use.py @@ -52,32 +52,7 @@ class WCTermsOfUseScreen(WizardComponent): self.tos_label = WWLabel() self.tos_label.setText(messages.MSG_TERMS_OF_USE) self.layout().addWidget(self.tos_label) - self._valid = False - - # Find the scroll area and connect to its scrollbar - QTimer.singleShot(100, self.check_scroll_position) - self.window().installEventFilter(self) - - def eventFilter(self, obj, event): - if obj == self.window() and event.type() == QEvent.Type.Resize: - # catch window resize events to check if the scrollbar is visible - QTimer.singleShot(100, self.check_scroll_position) - return super().eventFilter(obj, event) - - def check_scroll_position(self): - scroll_area = self.window().findChild(QScrollArea) - if scroll_area and scroll_area.verticalScrollBar() \ - and scroll_area.verticalScrollBar().isVisible(): - scrollbar = scroll_area.verticalScrollBar() - def on_scroll_change(value): - if value >= scrollbar.maximum() - 5: # Allow 5 pixel margin - self._valid = True - self.on_updated() - scrollbar.valueChanged.connect(on_scroll_change) - else: - # scrollbar is not visible or not found - self._valid = True - self.on_updated() + self._valid = True def apply(self): pass