-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuiFunctions.py
57 lines (44 loc) · 1.88 KB
/
uiFunctions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from main import ChixculubImpactor
from PyQt5.QtWidgets import QFrame
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QPropertyAnimation, QEasingCurve
WINDOW_STATE = 0
class UIFunctions(ChixculubImpactor):
def activateTitleBarButtons(self):
self.ui.minBtn.clicked.connect(lambda: self.showMinimized())
self.ui.maxBtn.clicked.connect(lambda: UIFunctions.maximizeRestore(self))
self.ui.Toodle.clicked.connect(lambda: UIFunctions.toodle(self, 250, True))
def maximizeRestore(self):
global WINDOW_STATE
status = WINDOW_STATE
if status == 0:
self.showMaximized()
WINDOW_STATE = 1
self.ui.maxBtn.setToolTip("Restore")
self.ui.maxBtn.setIcon(QIcon(":/icons/resources/051-minimize.png"))
#self.ui.drag.hide()
else:
WINDOW_STATE = 0
self.showNormal()
self.resize(self.width() + 1, self.height() + 1)
self.ui.maxBtn.setToolTip("Maximize")
self.ui.maxBtn.setIcon(QIcon(":/icons/resources/expand.png"))
#self.ui.drag.show()
def toodle(self, maxWidth, clicked):
global elongate
for x in self.ui.westFrame.findChildren(QFrame):
x.setStyleSheet("background:transparent")
minWidth = 80
if clicked:
currentWidth = self.ui.westFrame.width()
#minWidth = 0
if currentWidth == minWidth:
elongate = maxWidth
else:
elongate = minWidth
self.animation = QPropertyAnimation(self.ui.westFrame, b"minimumWidth")
self.animation.setDuration(300)
self.animation.setStartValue(currentWidth)
self.animation.setEndValue(elongate)
self.animation.setEasingCurve(QEasingCurve.InOutQuart)
self.animation.start()