本文整理汇总了Python中pyqtgraph.parametertree.ParameterTree类的典型用法代码示例。如果您正苦于以下问题:Python ParameterTree类的具体用法?Python ParameterTree怎么用?Python ParameterTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParameterTree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addSettings
def addSettings(self, param):
"""Adds a dockwidget designed to store a ParameterTree, also adds to 'Windows' menu"""
parameterTree = ParameterTree()
parameterTree.addParameters(param._PyQtGraphParameter)
dock = self.addDock(parameterTree, name=param.getName(), area=Qt.TopDockWidgetArea)
dock.setMaximumWidth(560)
return dock
示例2: __init__
def __init__(self):
super(maintest, self).__init__()
self.values = {'module 1': module(1), 'module 2': module(2), 'module 3': module(3)}
self.module = self.values['module 2']
p = [
{'name': 'Module', 'type': 'list',
'values': self.values,
'set': self.setmodule,
'get': self.getmodule,
'childmode': "root",
'help': '%namehdr%Boatload of text is possible here. Can use markup too with external help window.'},
{'name': 'Rocks to Skips', 'type': 'int', 'value': 0, 'help': 'Another help example', 'helpwnd': None, 'linked':['1/Rocks to Skips']},
{'name': '1/Rocks to Skips', 'type': 'float', 'help': 'Another help example', 'helpwnd': None, 'get': self.getLinked}
]
self.params = Parameter(name='Root', type='group', children=p).register()
self.params.init()
self.t = ParameterTree()
self.t.addParameters(self.params.getPyQtGraphParameter())
self.test = Parameter(name='Test', type='group')
self.test.addChildren([
{'name':'baud', 'type':'int', 'key':'baud', 'limits':(500, 2000000), 'value':38400}
])
self.params.append(self.test)
self.test.remove()
self.test.getChild("baud").setValue(500)
self.params.append(self.test)
self.t2 = ParameterTree()
self.params2 = Parameter(name='Root', type='group')
self.params.getChild("Module").stealDynamicParameters(self.params2)
self.t2.addParameters(self.params2._PyQtGraphParameter)
示例3: _draw_text_inputs
def _draw_text_inputs(self, layout):
"""
Generates a GUI that can accept parameter values.
"""
params = [
{'name': 'damage :: Saturation Threshold', 'type': 'int',
'value': 10000, 'suffix': 'ADU'},
{'name': 'damage :: Area Threshold', 'type': 'int',
'value': 20, 'suffix': '%', 'limits': (0, 100)},
{'name': 'xtal :: Saturation Threshold', 'type': 'int',
'value': 5000, 'suffix': 'ADU'},
{'name': 'xtal :: Area Threshold', 'type': 'int',
'value': 1, 'suffix': '%', 'limits': (0, 100)},
{'name': 'diffuse :: Saturation Threshold', 'type': 'int',
'value': 1000, 'suffix': 'ADU'},
{'name': 'diffuse :: Area Threshold', 'type': 'int',
'value': 20, 'suffix': '%', 'limits': (0, 100)}
]
self._params = Parameter.create(name='params', type='group',
children=params)
self._params.sigTreeStateChanged.connect(self._enable_apply)
t = ParameterTree()
t.setParameters(self._params, showTop=False)
layout.addWidget(t, 0, 1)
return
示例4: Ui_ChildWindow
class Ui_ChildWindow(object):
def setupUi(self, MainWindow, params):
#app = QtGui.QApplication([])
#self.win = QtGui.QMainWindow()
self.area = DockArea()
MainWindow.setCentralWidget(self.area)
MainWindow.resize(500, 700)
MainWindow.setWindowTitle('Action construct')
self.seq_cntr = Dock("Sequence", size=(150,200))
self.area.addDock(self.seq_cntr, 'left')
## first dock gets save/restore buttons
self.t = ParameterTree()
if params != None:
self.p_child = Parameter.create(name='params', type='group', children=params)
self.t.setParameters(self.p_child, showTop=False)
self.t.setWindowTitle('pyqtgraph example: Parameter Tree')
self.seq_cntr.addWidget(self.t)
self.seq = pg.LayoutWidget()
self.label = QtGui.QLabel("""Controls""")
self.saveBtn = QtGui.QPushButton('Add Action')
self.restoreBtn = QtGui.QPushButton('Modify table')
self.restoreBtn.setEnabled(False)
self.seq.addWidget(self.label, row=0, col=0)
self.seq.addWidget(self.saveBtn, row=1, col=0)
self.seq.addWidget(self.restoreBtn, row=2, col=0)
self.seq_cntr.addWidget(self.seq)
示例5: LayerControlTree
class LayerControlTree(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.basicParam = {'name': 'Layer','expanded':False, 'type': 'group','autoIncrementName':True, 'children': [
{'name': 'LayerType', 'type': 'list', 'values': {"RGB": 0, "LAB": 1, "ChannelWise": 2}, 'value': 0},
{'name': 'Channel', 'type': 'int', 'value': 0,'limits':[0,2]},
{'name': 'Opacity', 'type': 'float', 'value': 0.0, 'step': 0.1,'limits':[0,1]},
{'name': 'Show', 'type': 'bool', 'value': True, 'tip': "Show / Hide this layer"},
{'name': 'HideOthers', 'type': 'action','tip':"Hide all other layers"},
{'name': 'Gradient', 'type': 'colormap'},
#{'name': 'Subgroup', 'type': 'group', 'children': [
# {'name': 'Sub-param 1', 'type': 'int', 'value': 10},
# {'name': 'Sub-param 2', 'type': 'float', 'value': 1.2e6},
#]},
#{'name': 'Text Parameter', 'type': 'text', 'value': 'Some text...'},
#{'name': 'Action Parameter', 'type': 'action'},
]}
params = []
self.paramGroup = Parameter.create(name='params', type='group', children=params)
self.paramGroup.sigTreeStateChanged.connect(self.change)
self.parameterTree = ParameterTree()
self.parameterTree.setParameters(self.paramGroup, showTop=False)
# add view box to graph view layout
self.hbox = QtGui.QHBoxLayout()
self.setLayout(self.hbox)
self.hbox.addWidget(self.parameterTree)
def addLayerControl(self,layer):
layerParam = setupLayerParam(layer.layerName(),layer.baseControlTemplate(),
layer.controlTemplate())
layerParam = self.paramGroup.addChild(layerParam)
# pass parameter to layer itself
layer.setLayerParameter(layerParam)
def removeLayerControl(self,layer):
paramToRemove = layer.layerParameter
self.paramGroup.removeChild(paramToRemove)
## If anything changes in the tree, print a message
def change(self,param, changes):
#print("tree changes:")
for param, change, data in changes:
path = self.paramGroup.childPath(param)
if path is not None:
childName = '.'.join(path)
else:
childName = param.name()
示例6: FringeRemoveNode
class FringeRemoveNode(Node):
"""Node for removing fringes"""
nodeName = 'FringeRemove'
nodePaths = [('Analysis',)]
def __init__(self, name):
terminals = {
'sig':{'io':'in'},
'ref':{'io':'in'},
'bkg':{'io':'in'},
'sigMask': {'io':'in'},
'ref1':{'io':'out', 'bypass': 'ref'}
}
super().__init__(name, terminals=terminals)
paras_property = [
{'name': 'rank', 'type': 'int', 'readonly': True},
{'name': 'rankLimit', 'type': 'int', 'value': 100},
{'name': 'trunc', 'type': 'float'},
{'name': 'updateLib', 'type': 'bool'},
{'name': 'reset', 'type': 'action'}
]
self.paras = Parameter.create(name='params', type='group', children=paras_property)
self.paratree = ParameterTree()
self.paratree.setParameters(self.paras, showTop=False)
self.remover = FringeRemove()
self.paras.param('reset').sigActivated.connect(self.remover.reset)
def onReset(self):
self.remover.reset()
self.paras['rank'] = 0
def ctrlWidget(self):
return self.paratree
def process(self, sig, ref, bkg, sigMask, display=True):
self.remover.setTrunc(self.paras['trunc'])
ref = ref - bkg
if self.paras['updateLib'] and self.paras['rank'] <= self.paras['rankLimit']:
self.remover.updateLibrary(ref)
self.paras['rank'] = self.remover.rank
sig = sig - bkg
coef, ref = self.remover.reconstruct(np.ma.array(sig, mask=sigMask))
ref = ref.reshape(512, 512) + bkg
return {'ref1': ref}
def saveState(self):
state = super().saveState()
state['paras'] = self.paras.saveState()
return state
def restoreState(self, state):
super().restoreState(state)
self.paras.restoreState(state['paras'])
示例7: maintest
class maintest(Parameterized):
def __init__(self):
super(maintest, self).__init__()
self.values = {'module 1': module(1), 'module 2': module(2), 'module 3': module(3)}
self.module = self.values['module 2']
p = [
{'name': 'Module', 'type': 'list',
'values': self.values,
'set': self.setmodule,
'get': self.getmodule,
'childmode': "root",
'help': '%namehdr%Boatload of text is possible here. Can use markup too with external help window.'},
{'name': 'Rocks to Skips', 'type': 'int', 'value': 0, 'help': 'Another help example', 'helpwnd': None,
'linked': ['1/Rocks to Skips']},
{'name': '1/Rocks to Skips', 'type': 'float', 'help': 'Another help example', 'helpwnd': None,
'get': self.getLinked}
]
self.params = Parameter(name='Root', type='group', children=p).register()
self.params.init()
self.t = ParameterTree()
self.t.addParameters(self.params.getPyQtGraphParameter())
self.test = Parameter(name='Test', type='group')
self.test.addChildren([
{'name': 'baud', 'type': 'int', 'key': 'baud', 'limits': (500, 2000000), 'value': 38400}
])
self.params.append(self.test)
self.test.remove()
self.test.getChild("baud").setValue(500)
self.params.append(self.test)
self.t2 = ParameterTree()
self.params2 = Parameter(name='Root', type='group')
self.params.getChild("Module").stealDynamicParameters(self.params2)
self.t2.addParameters(self.params2._PyQtGraphParameter)
self.params.save("abcde.txt")
self.params.load("abcde.txt")
def printhelp(self, msg, obj):
print msg
def getmodule(self):
return self.module
@setupSetParam("Module")
def setmodule(self, module):
print "Changing Module"
self.module = module
def getLinked(self):
try:
return 1.0 / float(self.params.getChild('Rocks to Skips').getValue())
except:
return 0
示例8: setupTree
def setupTree():
params = [
{'name':'Update Time (s)', 'type':'float', 'value':1},
{'name':'std', 'type':'float', 'value':0},
{'name':'Save Figure', 'type':'action', 'visible':True}
]
p = Parameter.create(name = 'params', type = 'group', children = params)
t = ParameterTree()
t.setParameters(p, showTop = False)
return t,p
示例9: __init__
def __init__(self,dataSet=None):
self.dataSet=dataSet
ParameterTree.__init__(self)
self.setObjectName("ConfigurationWidget")
self.setWindowTitle("Measurement Configuration")
self.setParams()
self.p.sigTreeStateChanged.connect(self.change)
self.connections=[]
self.p.param("File Configuration","Folder").sigValueChanged.connect(self.folderModeChanged)
示例10: setupTree
def setupTree():
params = [
{'name':'Update Time (s)', 'type':'float', 'value':1},
{'name':'Sample Name', 'type':'int', 'value':1},
{'name':'Counter', 'type':'int', 'value':0}
]
p = Parameter.create(name = 'params', type = 'group', children = params)
t = ParameterTree()
t.setParameters(p, showTop = False)
return t,p
示例11: InputCalibrationChannel
class InputCalibrationChannel(SheetForm, SheetBase):
def __init__(self, config, channel, parent=None):
SheetBase.__init__(self, parent)
SheetForm.__init__(self)
self.config = config
self.channel = channel
self.settings = self.config.get("InputCalibration.{0}".format(channel), ChannelSettings())
self.myCalibration = None
self.treeWidget = None
def setupUi(self, callback, MainWindow):
SheetForm.setupUi(self, MainWindow)
self.calibrationsCombo.addItems( list(AnalogInputCalibration.AnalogInputCalibrationMap.keys()) )
self.calibrationsCombo.currentIndexChanged["QString"].connect( self.onCalibrationChanged )
self.callback = callback
if self.settings.calibration:
self.onCalibrationChanged(self.settings.calibration)
self.calibrationsCombo.setCurrentIndex(self.calibrationsCombo.findText(self.settings.calibration))
def onCalibrationChanged(self, calibration):
calibration = str(calibration)
if self.myCalibration:
self.settings.parameters[self.settings.calibration] = self.myCalibration.parameters
self.myCalibration = AnalogInputCalibration.AnalogInputCalibrationMap[calibration]()
if calibration in self.settings.parameters:
self.myCalibration.parameters = self.settings.parameters[calibration]
if not self.treeWidget:
try:
self.param = Parameter.create(name='params', type='group', children=self.myCalibration.paramDef())
self.treeWidget = ParameterTree()
self.treeWidget.setParameters(self.param, showTop=False)
self.verticalLayout.insertWidget(2, self.treeWidget)
self.param.sigTreeStateChanged.connect(self.myCalibration.update, QtCore.Qt.UniqueConnection)
except (TypeError, AttributeError):
pass
else:
self.param = Parameter.create(name='params', type='group', children=self.myCalibration.paramDef())
self.treeWidget.setParameters(self.param, showTop=False)
try:
self.param.sigTreeStateChanged.connect(self.myCalibration.update, QtCore.Qt.UniqueConnection )
except TypeError:
pass # we want the connection to be unique
self.settings.calibration = calibration
self.callback( self.channel, self.myCalibration )
def saveConfig(self):
if self.myCalibration:
self.settings.parameters[self.settings.calibration] = self.myCalibration.parameters
self.config["InputCalibration.{0}".format(self.channel)] = self.settings
示例12: __init__
def __init__(self, parent = None, savedstate=None):
super(ProjectSettingsDialog, self).__init__(parent)
self.setWindowTitle("Application Settings")
layout = QtGui.QVBoxLayout(self)
self.initKeyParamMapping()
self._settings = Parameter.create(name='params', type='group', children=settings_params)
if savedstate:
self._settings.restoreState(savedstate)
# Holds settings keys that have changed by the user when the
# dialog is closed. Used to update any needed gui values..
self._updated_settings={}
self._settings.sigTreeStateChanged.connect(self.handleSettingChange)
self.initSettingsValues()
self.ptree = ParameterTree()
self.ptree.setParameters(self._settings, showTop=False)
self.ptree.setWindowTitle('MarkWrite Application Settings')
layout.addWidget(self.ptree)
self.ptree.adjustSize()
# OK and Cancel buttons
self.buttons = QtGui.QDialogButtonBox(
QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel,
QtCore.Qt.Horizontal, self)
layout.addWidget(self.buttons)
self.buttons.accepted.connect(self.accept)
self.buttons.rejected.connect(self.reject)
self.resize(500,700)
示例13: __init__
def __init__(self):
QtGui.QWidget.__init__(self)
self.neuron_data = None
self.setWindowTitle("Experiment Control - Data Analysis & Visualization")
self.layout = QtGui.QVBoxLayout()
self.layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(self.layout)
self.splitter = QtGui.QSplitter()
self.splitter.setOrientation(QtCore.Qt.Horizontal)
self.splitter2 = QtGui.QSplitter()
self.splitter2.setOrientation(QtCore.Qt.Vertical)
self.layout.addWidget(self.splitter)
self.splitter.addWidget(self.splitter2)
self.plot_widget = pg.GraphicsLayoutWidget()
self.tree = ParameterTree(showHeader=False)
self.params = Parameter.create(
name="params",
type="group",
children=[
dict(name="Reanalyze", type="bool", value=False),
dict(name="Load", type="action"),
dict(name="GCFR-sigma (ms)", type="float", value=100.0, step=0.1, limits=[1, 5000]),
dict(name="Save", type="action"),
],
)
self.tree.setParameters(self.params, showTop=False)
# self.params.param('Save').sigActivated.connect(self.SavePlot)
self.params.param("Load").sigActivated.connect(self.OpenDataFile)
self.splitter2.addWidget(self.tree)
self.trial_list_tree = pg.TreeWidget(parent=self.splitter2)
self.splitter.addWidget(self.plot_widget)
self.trial_list_tree.setColumnCount(1)
示例14: __init__
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.basicParam = {'name': 'Layer','expanded':False, 'type': 'group','autoIncrementName':True, 'children': [
{'name': 'LayerType', 'type': 'list', 'values': {"RGB": 0, "LAB": 1, "ChannelWise": 2}, 'value': 0},
{'name': 'Channel', 'type': 'int', 'value': 0,'limits':[0,2]},
{'name': 'Opacity', 'type': 'float', 'value': 0.0, 'step': 0.1,'limits':[0,1]},
{'name': 'Show', 'type': 'bool', 'value': True, 'tip': "Show / Hide this layer"},
{'name': 'HideOthers', 'type': 'action','tip':"Hide all other layers"},
{'name': 'Gradient', 'type': 'colormap'},
#{'name': 'Subgroup', 'type': 'group', 'children': [
# {'name': 'Sub-param 1', 'type': 'int', 'value': 10},
# {'name': 'Sub-param 2', 'type': 'float', 'value': 1.2e6},
#]},
#{'name': 'Text Parameter', 'type': 'text', 'value': 'Some text...'},
#{'name': 'Action Parameter', 'type': 'action'},
]}
params = []
self.paramGroup = Parameter.create(name='params', type='group', children=params)
self.paramGroup.sigTreeStateChanged.connect(self.change)
self.parameterTree = ParameterTree()
self.parameterTree.setParameters(self.paramGroup, showTop=False)
# add view box to graph view layout
self.hbox = QtGui.QHBoxLayout()
self.setLayout(self.hbox)
self.hbox.addWidget(self.parameterTree)
示例15: onCalibrationChanged
def onCalibrationChanged(self, calibration):
calibration = str(calibration)
if self.myCalibration:
self.settings.parameters[self.settings.calibration] = self.myCalibration.parameters
self.myCalibration = AnalogInputCalibration.AnalogInputCalibrationMap[calibration]()
if calibration in self.settings.parameters:
self.myCalibration.parameters = self.settings.parameters[calibration]
if not self.treeWidget:
try:
self.param = Parameter.create(name='params', type='group', children=self.myCalibration.paramDef())
self.treeWidget = ParameterTree()
self.treeWidget.setParameters(self.param, showTop=False)
self.verticalLayout.insertWidget(2, self.treeWidget)
self.param.sigTreeStateChanged.connect(self.myCalibration.update, QtCore.Qt.UniqueConnection)
except (TypeError, AttributeError):
pass
else:
self.param = Parameter.create(name='params', type='group', children=self.myCalibration.paramDef())
self.treeWidget.setParameters(self.param, showTop=False)
try:
self.param.sigTreeStateChanged.connect(self.myCalibration.update, QtCore.Qt.UniqueConnection )
except TypeError:
pass # we want the connection to be unique
self.settings.calibration = calibration
self.callback( self.channel, self.myCalibration )