Prevent loading overlay from slowing actual loading

The python GIL means quick pre-emption is too costly
This commit is contained in:
Kovid Goyal 2019-10-08 18:34:20 +05:30
parent 5385df337e
commit 96ebc4bda3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -22,7 +22,7 @@ class LoadingOverlay(QWidget):
self.move(0, 0) self.move(0, 0)
self.angle = 0 self.angle = 0
self.timer = t = QTimer(self) self.timer = t = QTimer(self)
t.setInterval(10) t.setInterval(60)
t.timeout.connect(self.tick) t.timeout.connect(self.tick)
f = self.font() f = self.font()
f.setBold(True) f.setBold(True)
@ -32,7 +32,7 @@ class LoadingOverlay(QWidget):
self.calculate_rects() self.calculate_rects()
def tick(self): def tick(self):
self.angle -= 2 self.angle -= 6
self.angle %= 360 self.angle %= 360
self.update() self.update()
@ -43,6 +43,7 @@ class LoadingOverlay(QWidget):
self.setVisible(True) self.setVisible(True)
self.raise_() self.raise_()
self.setFocus(Qt.OtherFocusReason) self.setFocus(Qt.OtherFocusReason)
self.update()
def hide(self): def hide(self):
self.parent().web_view.setFocus(Qt.OtherFocusReason) self.parent().web_view.setFocus(Qt.OtherFocusReason)