mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make the new spinner exception safe
This commit is contained in:
parent
5e7c076bc0
commit
d280a69a92
@ -53,6 +53,7 @@ class ProgressSpinner(QWidget):
|
|||||||
pal = self.palette()
|
pal = self.palette()
|
||||||
self.dark = pal.color(pal.Text)
|
self.dark = pal.color(pal.Text)
|
||||||
self.light = pal.color(pal.Window)
|
self.light = pal.color(pal.Window)
|
||||||
|
self.errored_out = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def animation_interval(self):
|
def animation_interval(self):
|
||||||
@ -106,7 +107,13 @@ class ProgressSpinner(QWidget):
|
|||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def paintEvent(self, ev):
|
def paintEvent(self, ev):
|
||||||
draw_snake_spinner(QPainter(self), self.rect(), self.loading_angle, self.light, self.dark)
|
if not self.errored_out:
|
||||||
|
try:
|
||||||
|
draw_snake_spinner(QPainter(self), self.rect(), self.loading_angle, self.light, self.dark)
|
||||||
|
except Exception:
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
self.errored_out = True
|
||||||
|
|
||||||
ProgressIndicator = ProgressSpinner
|
ProgressIndicator = ProgressSpinner
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user