-
Notifications
You must be signed in to change notification settings - Fork 2
/
pgtest.py
95 lines (89 loc) · 2.93 KB
/
pgtest.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import sys
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore, QtWidgets
import pyqtgraph.parametertree as pt
#import qdarktheme
STYLE_SHEET = """
QPushButton {
color: #8ab4f7;
border: 1px solid #3f4042;
padding: 4px 8px;
border-radius: $radius{4px};
}
QPushButton:!window {
background: transparent;
}
"""
junk = """
QPushButton:flat,
QPushButton:default {
border: none;
padding: 5px 9px;
}
QPushButton:default {
color: #202124;
background: #8ab4f7;
}
QPushButton:hover,
QPushButton:flat:hover {
background: rgba(46.000, 70.000, 94.000, 0.333);
}
QPushButton:pressed,
QPushButton:flat:pressed,
QPushButton:checked:pressed,
QPushButton:flat:checked:pressed {
background: rgba(46.000, 70.000, 94.000, 0.933);
}
QPushButton:checked,
QPushButton:flat:checked {
background: rgba(46.000, 70.000, 94.000, 0.733);
}
QPushButton:default:hover {
background: #7fa7e5;
}
QPushButton:default:pressed {
background: #6d8bbe;
}
QPushButton:default:disabled {
background: #53575b;
}
"""
import numpy as np
app = pg.mkQApp()
# app.setStyle("Fusion")
#app.setStyle("Fusion") # necessary to remove double labels on mac os
# note that the default:
# print("Current style: ", app.style().name())
# returns "macos".
#app.setStyleSheet(qdarktheme.load_stylesheet())
#app.setStyleSheet("QPushButton {color: #8ab4f7;border: 1px solid #3f4042;padding: 4px 8px;border-radius: $radius{4px};}")
#app.setStyleSheet("QPushButton:!window {background: opaque; border: 2px solid #8f8f91;} QPushButton:!open {color:#aaaaaa;} QPushButton:!closed {color:#aa0000;}")
# app.setStyleSheet("QPushButton:pressed {background-color: QtGui.qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #dadbde, stop: 1 #f6f7fa);}")
# app.setStyleSheet("QPushButton:!window {background: opaque;}")
class PGTest(QtWidgets.QWidget):
def __init__(self):
QtWidgets.QWidget.__init__(self)
self.fullscreen_widget = None
self.resize(320, 320)
self.layout = QtWidgets.QGridLayout()
self.layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(self.layout)
self.ptree = pg.parametertree.ParameterTree(showHeader=False)
self.layout.addWidget(self.ptree)
self.params = pt.Parameter.create(name='params', type='group', children=[
dict(name='Run/Stop', type='action', value=False),
])
# self.params.setOpts(name = "Forward/Backward")
self.ptree.setParameters(self.params)
self.params.sigTreeStateChanged.connect(self.params_changed)
self.params.setOpts(name = "Forward/Backward !") # sets group paramater name (default was "params")
self.params.setOpts(title = "Up/Down >") # adds options dict with Title (also in parameter name)
self.show()
def params_changed(self, root, changes):
print(root)
print(changes)
pass
if __name__ == "__main__":
win = PGTest()
if sys.flags.interactive == 0:
pg.exec()