当前位置: 首页>>代码示例>>Python>>正文


Python parametertree.ParameterTree方法代码示例

本文整理汇总了Python中pyqtgraph.parametertree.ParameterTree方法的典型用法代码示例。如果您正苦于以下问题:Python parametertree.ParameterTree方法的具体用法?Python parametertree.ParameterTree怎么用?Python parametertree.ParameterTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyqtgraph.parametertree的用法示例。


在下文中一共展示了parametertree.ParameterTree方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from pyqtgraph import parametertree [as 别名]
# 或者: from pyqtgraph.parametertree import ParameterTree [as 别名]
def __init__(self, params):
        super().__init__()

        self.param = Parameter.create(name='params', type='group', children=params)

        self.tree = ParameterTree()
        self.tree.setParameters(self.param, showTop=False)
        self.tree.setWindowTitle('Network Interface')

        self.window = QWidget()
        self.layout = QGridLayout()
        self.window.setLayout(self.layout)
        l = QLabel("Network Interface")
        l.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
        self.layout.addWidget(l)
        self.layout.addWidget(self.tree)
        self.window.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.window.setGeometry(500, 800, 800, 500) 
开发者ID:thomaskuestner,项目名称:CNNArt,代码行数:20,代码来源:network_interface.py

示例2: setupGUI

# 需要导入模块: from pyqtgraph import parametertree [as 别名]
# 或者: from pyqtgraph.parametertree import ParameterTree [as 别名]
def setupGUI(self):
        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.layout.addWidget(self.splitter)
        
        self.tree = ParameterTree(showHeader=False)
        self.splitter.addWidget(self.tree)
        
        self.splitter2 = QtGui.QSplitter()
        self.splitter2.setOrientation(QtCore.Qt.Vertical)
        self.splitter.addWidget(self.splitter2)
        
        self.worldlinePlots = pg.GraphicsLayoutWidget()
        self.splitter2.addWidget(self.worldlinePlots)
        
        self.animationPlots = pg.GraphicsLayoutWidget()
        self.splitter2.addWidget(self.animationPlots)
        
        self.splitter2.setSizes([int(self.height()*0.8), int(self.height()*0.2)])
        
        self.inertWorldlinePlot = self.worldlinePlots.addPlot()
        self.refWorldlinePlot = self.worldlinePlots.addPlot()
        
        self.inertAnimationPlot = self.animationPlots.addPlot()
        self.inertAnimationPlot.setAspectLocked(1)
        self.refAnimationPlot = self.animationPlots.addPlot()
        self.refAnimationPlot.setAspectLocked(1)
        
        self.inertAnimationPlot.setXLink(self.inertWorldlinePlot)
        self.refAnimationPlot.setXLink(self.refWorldlinePlot) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:35,代码来源:relativity.py

示例3: test_opts

# 需要导入模块: from pyqtgraph import parametertree [as 别名]
# 或者: from pyqtgraph.parametertree import ParameterTree [as 别名]
def test_opts():
    paramSpec = [
        dict(name='bool', type='bool', readonly=True),
        dict(name='color', type='color', readonly=True),
    ]

    param = pt.Parameter.create(name='params', type='group', children=paramSpec)
    tree = pt.ParameterTree()
    tree.setParameters(param)

    assert _getWidget(param.param('bool')).isEnabled() is False
    assert _getWidget(param.param('bool')).isEnabled() is False 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:14,代码来源:test_parametertypes.py

示例4: add

# 需要导入模块: from pyqtgraph import parametertree [as 别名]
# 或者: from pyqtgraph.parametertree import ParameterTree [as 别名]
def add(self,name,component):
        
        if component.preferences:
            widget = ParameterTree()
            widget.setHeaderHidden(True)
            widget.setParameters(component.preferences,showTop=False)
            self.root.addChild(PreferencesTreeItem((name,),
                                                    widget))
            
            self.stacked.addWidget(widget) 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:12,代码来源:preferences.py

示例5: display_tree_widget

# 需要导入模块: from pyqtgraph import parametertree [as 别名]
# 或者: from pyqtgraph.parametertree import ParameterTree [as 别名]
def display_tree_widget(self, metadata):
        """Display the parameter tree from the experiment metadata.
        :param metadata: .json metadata
        """
        # Close previous tree widget
        self.close_tree()

        # Create a variable checking whether changes have been made to the parameter tree values
        self.has_changed = False

        # Create list with parameters for the tree
        self.parameters = self.create_parameters(self.fix_types(metadata))

        # Create tree of Parameter objects
        self.p = Parameter.create(name="params", type="group", children=self.parameters)

        # Save original state
        self.original_state = self.p.saveState()

        # Create ParameterTree widget
        self.tree = ParameterTree()
        self.tree.setParameters(self.p, showTop=False)
        self.tree.setWindowTitle("pyqtgraph example: Parameter Tree")

        # Display tree widget
        self.layout.addWidget(self.tree, 2, 0, 1, 2)

        # And buttons
        self.savebtn = QPushButton("Save changes")
        self.resetbtn = QPushButton("Reset changes")
        self.layout.addWidget(self.savebtn, 3, 0)
        self.layout.addWidget(self.resetbtn, 3, 1)
        self.savebtn.clicked.connect(self.save_treevals)
        self.resetbtn.clicked.connect(self.reset)

        # Send signal when any entry is changed
        self.p.sigTreeStateChanged.connect(self.change) 
开发者ID:portugueslab,项目名称:stytra,代码行数:39,代码来源:metadata_reader_ v2.py

示例6: test_opts

# 需要导入模块: from pyqtgraph import parametertree [as 别名]
# 或者: from pyqtgraph.parametertree import ParameterTree [as 别名]
def test_opts():
    paramSpec = [
        dict(name='bool', type='bool', readonly=True),
        dict(name='color', type='color', readonly=True),
    ]

    param = pt.Parameter.create(name='params', type='group', children=paramSpec)
    tree = pt.ParameterTree()
    tree.setParameters(param)

    assert list(param.param('bool').items.keys())[0].widget.isEnabled() is False
    assert list(param.param('color').items.keys())[0].widget.isEnabled() is False 
开发者ID:AOtools,项目名称:soapy,代码行数:14,代码来源:test_parametertypes.py

示例7: test_types

# 需要导入模块: from pyqtgraph import parametertree [as 别名]
# 或者: from pyqtgraph.parametertree import ParameterTree [as 别名]
def test_types():
    paramSpec = [
        dict(name='float', type='float'),
        dict(name='int', type='int'),
        dict(name='str', type='str'),
        dict(name='list', type='list', values=['x','y','z']),
        dict(name='dict', type='list', values={'x':1, 'y':3, 'z':7}),
        dict(name='bool', type='bool'),
        dict(name='color', type='color'),
    ]
    
    param = pt.Parameter.create(name='params', type='group', children=paramSpec)
    tree = pt.ParameterTree()
    tree.setParameters(param)

    all_objs = {
        'int0': 0, 'int':7, 'float': -0.35, 'bigfloat': 1e129, 'npfloat': np.float(5), 
        'npint': np.int(5),'npinf': np.inf, 'npnan': np.nan, 'bool': True, 
        'complex': 5+3j, 'str': 'xxx', 'unicode': asUnicode('µ'), 
        'list': [1,2,3], 'dict': {'1': 2}, 'color': pg.mkColor('k'), 
        'brush': pg.mkBrush('k'), 'pen': pg.mkPen('k'), 'none': None
    }
    if hasattr(QtCore, 'QString'):
        all_objs['qstring'] = QtCore.QString('xxxµ')

    # float
    types = ['int0', 'int', 'float', 'bigfloat', 'npfloat', 'npint', 'npinf', 'npnan', 'bool']
    check_param_types(param.child('float'), float, float, 0.0, all_objs, types)

    # int
    types = ['int0', 'int', 'float', 'bigfloat', 'npfloat', 'npint', 'bool']
    inttyps = int if sys.version[0] >= '3' else (int, long) 
    check_param_types(param.child('int'), inttyps, int, 0, all_objs, types)
    
    # str  (should be able to make a string out of any type)
    types = all_objs.keys()
    strtyp = str if sys.version[0] >= '3' else unicode
    check_param_types(param.child('str'), strtyp, asUnicode, '', all_objs, types)
    
    # bool  (should be able to make a boolean out of any type?)
    types = all_objs.keys()
    check_param_types(param.child('bool'), bool, bool, False, all_objs, types)

    # color
    types = ['color', 'int0', 'int', 'float', 'npfloat', 'npint', 'list']
    init = QtGui.QColor(128, 128, 128, 255)
    check_param_types(param.child('color'), QtGui.QColor, pg.mkColor, init, all_objs, types) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:49,代码来源:test_parametertypes.py

示例8: __init__

# 需要导入模块: from pyqtgraph import parametertree [as 别名]
# 或者: from pyqtgraph.parametertree import ParameterTree [as 别名]
def  __init__(self,parent):

        super(ObjectTree,self).__init__(parent)

        self.tree = tree = QTreeWidget(self,
                                       selectionMode=QAbstractItemView.ExtendedSelection)
        self.properties_editor = ParameterTree(self)

        tree.setHeaderHidden(True)
        tree.setItemsExpandable(False)
        tree.setRootIsDecorated(False)
        tree.setContextMenuPolicy(Qt.ActionsContextMenu)

        #forward itemChanged singal
        tree.itemChanged.connect(\
            lambda item,col: self.sigItemChanged.emit(item,col))
        #handle visibility changes form tree
        tree.itemChanged.connect(self.handleChecked)

        self.CQ = CQRootItem()
        self.Imports = ImportRootItem()
        self.Helpers = HelpersRootItem()

        root = tree.invisibleRootItem()
        root.addChild(self.CQ)
        root.addChild(self.Imports)
        root.addChild(self.Helpers)
        
        tree.expandToDepth(1)

        self._export_STL_action = \
            QAction('Export as STL',
                    self,
                    enabled=False,
                    triggered=lambda: \
                        self.export('stl',
                                    self.preferences['STL precision']))

        self._export_STEP_action = \
            QAction('Export as STEP',
                    self,
                    enabled=False,
                    triggered=lambda: \
                        self.export('step'))

        self._clear_current_action = QAction(icon('delete'),
                                             'Clear current',
                                             self,
                                             enabled=False,
                                             triggered=self.removeSelected)

        self._toolbar_actions = \
            [QAction(icon('delete-many'),'Clear all',self,triggered=self.removeObjects),
             self._clear_current_action,]

        self.prepareMenu()

        tree.itemSelectionChanged.connect(self.handleSelection)
        tree.customContextMenuRequested.connect(self.showMenu)

        self.prepareLayout() 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:63,代码来源:object_tree.py

示例9: display_tree_widget

# 需要导入模块: from pyqtgraph import parametertree [as 别名]
# 或者: from pyqtgraph.parametertree import ParameterTree [as 别名]
def display_tree_widget(self, fish):
        """Display the parameter tree from the experiment metadata.
        :param metadata: .json metadata
        """

        self.fish = fish
        print(self.fish)

        self.fish_folder = Path(self.data_directory + "/{}/".format(self.fish.text()))
        self.fish_metadata_path = list(self.fish_folder.glob("*.json"))

        with open(self.fish_metadata_path) as json_file:
            self.metadata = json.load(json_file)

        # Close previous tree widget
        self.close_tree()

        # Create a variable checking whether changes have been made to the parameter tree values
        self.has_changed = False

        # Create list with parameters for the tree
        self.parameters = self.create_parameters(self.fix_types(self.metadata))

        # Create tree of Parameter objects
        self.p = Parameter.create(name="params", type="group", children=self.parameters)

        # Save original state
        self.original_state = self.p.saveState()

        # Create ParameterTree widget
        self.tree = ParameterTree()
        self.tree.setParameters(self.p, showTop=False)
        self.tree.setWindowTitle("pyqtgraph example: Parameter Tree")

        # Display tree widget
        self.layout.addWidget(self.tree, 0, 0, 1, 2)

        # And buttons
        self.savebtn = QPushButton("Save changes")
        self.resetbtn = QPushButton("Reset changes")
        self.layout.addWidget(self.savebtn, 3, 0)
        self.layout.addWidget(self.resetbtn, 3, 1)
        self.savebtn.clicked.connect(self.save_treevals)
        self.resetbtn.clicked.connect(self.reset)

        # Send signal when any entry is changed
        self.p.sigTreeStateChanged.connect(self.change) 
开发者ID:portugueslab,项目名称:stytra,代码行数:49,代码来源:GUI.py


注:本文中的pyqtgraph.parametertree.ParameterTree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。