Greetings,
I'm finding the bool checkbox items in the ParameterTree / Parameter not
working on the connect sigValueChanging (.sigValueChanging.Connect() ).
Please see the example attached. In this crude example, I override the
default values in the group. To trigger the value changed, press the right
hand side "un-do" control. This triggers on the float and string, but not
the bool checkbox. The output is listed below, including the connect added
to each child. Typing into the float and string fields trigger the
signal. Manually checking/unchecking the bool value does not signal.
Any suggestions? Thank you.
Output:
grp par_value
grp/chld: par_value / path
added path connect
grp/chld: par_value / date_time_append
added time connect
grp/chld: par_value / time
added time connect
path adjust string reached
time adjust float reached
Cheers,
J-
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/03721451-6b36-4c50-84e7-1352f0405a88%40googlegroups.com.
from pyqtgraph.parametertree import ParameterTree, Parameter
import sys
from PyQt5.QtWidgets import QWidget, QVBoxLayout
from PyQt5 import QtWidgets
from pyqtgraph.dockarea import DockArea, Dock
class PT:
def __init__(self, filepath):
self.par_value = [
{ 'name': 'par_value', 'type':'group', 'children': [
{'name': 'path', 'type':'str', 'value': "c:\\"},
{'name': 'date_time_append', 'type':'bool', 'value': True},
{'name': 'time', 'type':'float', 'value':5.0}
]}
]
self.p = ""
self.filepath = filepath
def add_value(self, debug):
par = Parameter.create(name='whatever', type='group', children=self.par_value)
#stuff / place different values
for grp in par:
grp.child('path').setValue( "d:\\")
grp.child('date_time_append').setValue( False )
grp.child('time').setValue( 1.3 )
self.p = par
class Window(QtWidgets.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.title = 'Data Acqusition - Python with PyQt5 & pyqtgraph'
self.left = 50
self.top = 50
self.width = 1300
self.height = 700
self.MainWindowCreate()
self.fp = "c:\\dir"
def MainWindowCreate(self):
#print("create main window")
self.area = DockArea()
self.setCentralWidget(self.area)
self.resize(500,800)
self.d_area = Dock("some dock", size=(400,400))
# docks stacked on top of each other 'above'
self.area.addDock(self.d_area, 'left')
self.doSomething()
def doSomething(self):
ext_data = PT( "string path" )
ext_data.add_value(False)
self.ext_data = ext_data
self.p = self.ext_data.p
self.pt = ParameterTree()
self.vbl = QVBoxLayout()
self.vbl.setContentsMargins(0,0,0,0)
self.vbl.setSpacing(0)
self.pt.addParameters(self.p, showTop=False)
self.vbl.addWidget( self.pt )
wdq = QWidget()
wdq.setLayout( self.vbl )
self.d_area.addWidget(wdq)
self.Add_Signals()
def time_adjust_float(self):
print("time adjust float reached")
def path_adjust_string(self):
print("path adjust string reached")
def date_adjust_bool(self):
print("date adjust bool reached")
def Add_Signals(self):
for group in self.p.children():
print("grp", group.name())
for chld in group.children():
print("grp/chld:", group.name(), "/", chld.name())
if ("time" in chld.name()):
chld.sigValueChanging.connect(self.time_adjust_float)
print("added time connect")
elif("path" in chld.name()):
chld.sigValueChanging.connect(self.path_adjust_string)
print("added path connect")
elif("date" in chld.name()):
chld.sigValueChanging.connect(self.date_adjust_bool)
print("added date time append")
#self.p_plt.sigTreeStateChanged.connect(self.Plot_Dock_Change)
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
ex = Window()
ex.show()
app.exec_()
#sys.exit(app.exec_())