Exemplo n.º 1
0
 def __init__(self, **opts):
     # # Parameter uses 'limits' option to define the set of allowed values
     if 'values' in opts:
         opts['limits'] = opts['values']
     if opts.get('limits', None) is None:
         opts['limits'] = []
     Parameter.__init__(self, **opts)
     self.setLimits(opts['limits'])
Exemplo n.º 2
0
 def __init__(self, **opts):
     # # Parameter uses 'limits' option to define the set of allowed values
     if 'values' in opts:
         opts['limits'] = opts['values']
     if opts.get('limits', None) is None:
         opts['limits'] = []
     Parameter.__init__(self, **opts)
     self.setLimits(opts['limits'])
    def __init__(self, fieldDescriptor=None, **opts):
        assert fieldDescriptor is not None
        self.fieldDescriptor = fieldDescriptor

        if 'name' not in opts.keys():
            opts['name'] = fieldDescriptor.name
        default = fieldDescriptor.default_value
        if 'expanded' not in opts.keys():
            opts['expanded'] = False
        self.hideDefaults = opts.pop('hideDefaults', True)


        Parameter.__init__(self, default=default, **opts)
Exemplo n.º 4
0
    def parameter(self):
        if not (hasattr(self, "_param") and self._param):
            from pyqtgraph.parametertree.Parameter import Parameter, PARAM_TYPES

            children = []
            for name, input in self.inputs.items():
                if getattr(input.type, '__name__', None) in PARAM_TYPES:
                    childparam = Parameter.create(
                        name=name,
                        value=getattr(input, 'value', input.default),
                        default=input.default,
                        limits=input.limits,
                        type=getattr(input.type, '__name__', None),
                        units=input.units,
                        fixed=input.fixed,
                        fixable=input.fixable,
                        visible=input.visible,
                        **input.opts)
                    childparam.sigValueChanged.connect(
                        partial(self.setParameterValue, name))
                    if input.fixable:
                        childparam.sigFixToggled.connect(input.setFixed)
                    children.append(childparam)
                    input._param = childparam
                elif getattr(input.type, "__name__", None) == "Enum":
                    childparam = Parameter.create(
                        name=name,
                        value=getattr(input, "value", input.default) or "---",
                        values=input.limits or ["---"],
                        default=input.default,
                        type="list",
                    )
                    childparam.sigValueChanged.connect(
                        partial(self.setParameterValue, name))
                    children.append(childparam)
                    input._param = childparam

            self._param = Parameter(name=getattr(self, "name",
                                                 self.__class__.__name__),
                                    children=children,
                                    type="group")

            self._param.sigValueChanged.connect(self.setParameterValue)
        return self._param
Exemplo n.º 5
0
    def parameter(self):
        if not (hasattr(self, '_param') and self._param):
            from pyqtgraph.parametertree.Parameter import Parameter, PARAM_TYPES
            children = []
            for name, input in self.inputs.items():
                if getattr(input.type, '__name__', None) in PARAM_TYPES:
                    childparam = Parameter.create(
                        name=name,
                        value=getattr(input, 'value', input.default),
                        default=input.default,
                        limits=input.limits,
                        type=getattr(input.type, '__name__', None),
                        units=input.units)
                    childparam.sigValueChanged.connect(
                        partial(self.setParameterValue, name))
                    children.append(childparam)
                    input._param = childparam
                elif getattr(input.type, '__name__', None) == 'Enum':
                    childparam = Parameter.create(
                        name=name,
                        value=getattr(input, 'value', input.default) or '---',
                        values=input.limits or ['---'],
                        default=input.default,
                        type='list')
                    childparam.sigValueChanged.connect(
                        partial(self.setParameterValue, name))
                    children.append(childparam)
                    input._param = childparam

            self._param = Parameter(name=getattr(self, 'name',
                                                 self.__class__.__name__),
                                    children=children,
                                    type='group')

            self._param.sigValueChanged.connect(self.setParameterValue)
        return self._param
 def setValue(self, value, blockSignal=None):
     self.show()
     Parameter.setValue(self, value, blockSignal=blockSignal)
 def setToDefault(self):
     if self.hideDefaults:
         self.hide()
     Parameter.setToDefault(self)
Exemplo n.º 8
0
 def setLimits(self, limits):
     Parameter.setLimits(self, limits)
Exemplo n.º 9
0
 def __init__(self, **opts):
     Parameter.__init__(self, **opts)
Exemplo n.º 10
0
 def setLimits(self, limits):
     Parameter.setLimits(self, limits)
Exemplo n.º 11
0
 def __init__(self, *args, **kargs):
     self.dimension = kargs.get('dimension')
     Parameter.__init__(self, *args, **kargs)
Exemplo n.º 12
0
 def parameter(self):
     # re-create the parameters each time to prevent a exception that says the signal is not connected
     self._parameter = Parameter.create(name='Settings', type='group',children=self.settings.paramDef())
     self._parameter.sigTreeStateChanged.connect(self.update, QtCore.Qt.UniqueConnection)
     return self._parameter
Exemplo n.º 13
0
 def __init__(self, *args, **kargs):
     self.dimension = kargs.get('dimension')
     Parameter.__init__(self, *args, **kargs)