MCPcopy Create free account
hub / github.com/MCSLTeam/MCSL2 / EraseStackedWidget

Class EraseStackedWidget

MCSL2Lib/ProgramControllers/interfaceController.py:48–198  ·  view source on GitHub ↗

Stacked widget with erase animation

Source from the content-addressed store, hash-verified

46
47
48class EraseStackedWidget(QStackedWidget):
49 """Stacked widget with erase animation"""
50
51 aniFinished = pyqtSignal()
52 aniStart = pyqtSignal()
53
54 def __init__(self, parent=None):
55 super().__init__(parent)
56 self.aniInfos = [] # type: List[EraseAniInfo]
57 self._nextIndex = None
58 self._ani = None
59
60 def addWidget(self, widget, deltaX=180, deltaY=0):
61 """add widget to window
62
63 Parameters
64 -----------
65 widget:
66 widget to be added
67
68 deltaX: int
69 the x-axis offset from the beginning to the end of animation
70
71 deltaY: int
72 the y-axis offset from the beginning to the end of animation
73 """
74 super().addWidget(widget)
75
76 self.aniInfos.append(
77 EraseAniInfo(
78 widget=widget,
79 deltaX=deltaX,
80 deltaY=deltaY,
81 ani=QPropertyAnimation(widget, b"pos"),
82 )
83 )
84
85 def setCurrentIndex(
86 self,
87 index: int,
88 needPopOut: bool = False,
89 showNextWidgetDirectly: bool = True,
90 duration: int = 220,
91 easingCurve=QEasingCurve.BezierSpline,
92 ):
93 """set current window to display
94
95 Parameters
96 ----------
97 index: int
98 the index of widget to display
99
100 isNeedPopOut: bool
101 need pop up animation or not
102
103 showNextWidgetDirectly: bool
104 whether to show next widget directly when animation started
105

Callers 3

__init__Method · 0.90
setupInterfaceMethod · 0.90
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected