Skip to content

Commit

Permalink
#97 - using spin icon internal to stop the timer.
Browse files Browse the repository at this point in the history
  • Loading branch information
jitender.singh committed Jul 12, 2021
1 parent 14014b0 commit 68f2b02
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ui/customwidgets/pushbutton.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class CustomPushButton(QPushButton):
def __init__(self):
super().__init__()
self.spin_icon = None
pass

def changeEvent(self, event: QEvent) -> None:
Expand All @@ -26,16 +27,22 @@ def apply_current_palette(self, animate=False):
text_color = QApplication.palette().color(QPalette.Text)

if animate:
self.spin_icon = qta.Spin(self, interval=100, step=2)
qicon = qta.icon(
self.objectName(),
color=text_color,
color_active=highlight_color,
animation=qta.Spin(self, interval=100, step=2)
animation=self.spin_icon,
)
else:
qicon = qta.icon(
self.objectName(),
color=text_color,
color_active=highlight_color,
)
if self.spin_icon:
# hacky-ish way to stop the spin icon from updating
# till the issue is fixed. https://github.com/spyder-ide/qtawesome/issues/165
self.spin_icon.info[self][0].stop()
self.spin_icon = None
super().setIcon(qicon)

0 comments on commit 68f2b02

Please sign in to comment.