當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。