diff -r ee41fab001f2 -r 5182a7c5a9f3 src/eric7/EricWidgets/EricAnimatedWidget.py --- a/src/eric7/EricWidgets/EricAnimatedWidget.py Wed Jan 03 18:09:15 2024 +0100 +++ b/src/eric7/EricWidgets/EricAnimatedWidget.py Thu Jan 04 10:43:29 2024 +0100 @@ -11,25 +11,32 @@ # Code was inspired by qupzilla web browser # +import enum + from PyQt6.QtCore import QPoint, QTimeLine, pyqtSlot from PyQt6.QtWidgets import QWidget +class EricAnimationDirection(enum.Enum): + """ + Class defining the animation directions. + """ + Down = 0 + Up = 1 + class EricAnimatedWidget(QWidget): """ Class implementing an animated widget. """ - # TODO: change this to an enum - DirectionDown = 0 - DirectionUp = 1 - - def __init__(self, direction=DirectionDown, duration=300, parent=None): + def __init__( + self, direction=EricAnimationDirection.Down, duration=300, parent=None + ): """ Constructor @param direction direction of the animation - @type int (one of DirectionDown or DirectionUp) + @type EricAnimationDirection @param duration duration of the animation @type int @param parent reference to the parent widget @@ -69,7 +76,7 @@ shown = 0 hidden = 0 - if self.__direction == self.DirectionDown: + if self.__direction == EricAnimationDirection.Down: shown = 0 hidden = -self.__widget.height()