Skip to content

Commit 52e2ced

Browse files
committed
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.
1 parent 440c1e9 commit 52e2ced

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

electrum/gui/qt/wizard/terms_of_use.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,7 @@ def __init__(self, parent, wizard):
5252
self.tos_label = WWLabel()
5353
self.tos_label.setText(messages.MSG_TERMS_OF_USE)
5454
self.layout().addWidget(self.tos_label)
55-
self._valid = False
56-
57-
# Find the scroll area and connect to its scrollbar
58-
QTimer.singleShot(100, self.check_scroll_position)
59-
self.window().installEventFilter(self)
60-
61-
def eventFilter(self, obj, event):
62-
if obj == self.window() and event.type() == QEvent.Type.Resize:
63-
# catch window resize events to check if the scrollbar is visible
64-
QTimer.singleShot(100, self.check_scroll_position)
65-
return super().eventFilter(obj, event)
66-
67-
def check_scroll_position(self):
68-
scroll_area = self.window().findChild(QScrollArea)
69-
if scroll_area and scroll_area.verticalScrollBar() \
70-
and scroll_area.verticalScrollBar().isVisible():
71-
scrollbar = scroll_area.verticalScrollBar()
72-
def on_scroll_change(value):
73-
if value >= scrollbar.maximum() - 5: # Allow 5 pixel margin
74-
self._valid = True
75-
self.on_updated()
76-
scrollbar.valueChanged.connect(on_scroll_change)
77-
else:
78-
# scrollbar is not visible or not found
79-
self._valid = True
80-
self.on_updated()
55+
self._valid = True
8156

8257
def apply(self):
8358
pass

0 commit comments

Comments
 (0)