-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmeters.py
64 lines (53 loc) · 1.36 KB
/
meters.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
58
59
60
61
62
63
64
'''
Meter
'''
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from daw_tools import Meter
# Creating the application
app = QApplication([])
# Creating the display window
window = QWidget()
window.setWindowTitle('Daw Tool Meter')
window.setMinimumSize(300,100)
window.setStyleSheet("""
background-color: rgb(80, 80, 80);
""")
# Window layout
l = QGridLayout()
# Setting up meter 1
meter1 = Meter(0,100)
meter1.setPen(Qt.NoPen)
policy = QSizePolicy()
policy.setVerticalStretch(QSizePolicy.Minimum)
meter1.setSizePolicy(policy)
meter1.setFixedWidth(20)
l.addWidget(meter1,0,1)
# Setting up meter 2
meter2 = Meter(0,10)
meter2.setFixedWidth(20)
l.addWidget(meter2,0,2)
# Setting up meter 3
meter3 = Meter(0,200)
meter3.setFixedWidth(20)
meter3.setRedPercent(0.7)
meter3.setYellowPercent(0.4)
meter3.setRedColor(QColor(220, 135, 50))
meter3.setYellowColor(QColor(123, 89, 191))
meter3.setGreenColor(QColor(123, 158, 191))
meter3.setOffColor(Qt.black)
l.addWidget(meter3,0,3)
vSlider = QSlider(Qt.Vertical)
vSlider.setRange(0,100)
def changed(v):
meter1.setValue(v)
meter2.setValue(v*.1)
meter3.setValue(v*2)
vSlider.valueChanged.connect(changed)
l.addWidget(vSlider,0,0)
# Adding layout to the window
window.setLayout(l)
# Showing the window
window.show()
exit(app.exec())