本文整理汇总了Python中pyqtgraph.flowchart.Flowchart.setLibrary方法的典型用法代码示例。如果您正苦于以下问题:Python Flowchart.setLibrary方法的具体用法?Python Flowchart.setLibrary怎么用?Python Flowchart.setLibrary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph.flowchart.Flowchart
的用法示例。
在下文中一共展示了Flowchart.setLibrary方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AppWindow
# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import setLibrary [as 别名]
class AppWindow(QtGui.QMainWindow, hackYourOwn.Ui_MainWindow,utilitiesClass):
def __init__(self, parent=None,**kwargs):
super(AppWindow, self).__init__(parent)
self.setupUi(self)
self.I=kwargs.get('I',None)
self.setWindowTitle('pyqtgraph example: FlowchartCustomNode')
## Create an empty flowchart with a single input and output
self.fc = Flowchart(terminals={
'dataIn': {'io': 'in'},
})
self.w = self.fc.widget()
self.WidgetLayout.addWidget(self.fc.widget())
self.plot1 = self.add2DPlot(self.ExperimentLayout)
self.plot2 = self.add2DPlot(self.ExperimentLayout)
self.curve1 = self.addCurve(self.plot1)
self.curve2 = self.addCurve(self.plot2)
self.curve1.setData([1,2,3],[5,6,7])
self.library = fclib.LIBRARY.copy() # start with the default node set
self.library.addNodeType(PlotViewNode, [('Display',)])
self.library.addNodeType(CaptureNode, [('Acquire',)])
self.fc.setLibrary(self.library)
## Now we will programmatically add nodes to define the function of the flowchart.
## Normally, the user will do this manually or by loading a pre-generated
## flowchart file.
self.cap = self.fc.createNode('Capture', pos=(0, 0))
self.cap.setI(self.I)
self.v1Node = self.fc.createNode('PlotView', pos=(0, -150))
self.v1Node.setView(self.curve1)
self.v2Node = self.fc.createNode('PlotView', pos=(150, -150))
self.v2Node.setView(self.curve2)
self.fc.connectTerminals(self.fc['dataIn'], self.cap['dataIn'])
self.fc.connectTerminals(self.cap['dataOut'], self.v1Node['data'])
#self.fc.connectTerminals(self.fc['dataIn'], self.v2Node['data'])
self.fc.setInput(dataIn=True)
def run(self):
self.fc.setInput(dataIn=True)
def __del__(self):
#self.looptimer.stop()
print ('bye')
def closeEvent(self, event):
self.finished=True
示例2:
# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import setLibrary [as 别名]
## Method 1: Register to global default library:
#fclib.registerNodeType(ImageViewNode, [('Display',)])
#fclib.registerNodeType(UnsharpMaskNode, [('Image',)])
## Method 2: If we want to make our custom node available only to this flowchart,
## then instead of registering the node type globally, we can create a new
## NodeLibrary:
library = fclib.LIBRARY.copy() # start with the default node set
library.addNodeType(ImageViewNode, [('Display',)])
# Add the unsharp mask node to two locations in the menu to demonstrate
# that we can create arbitrary menu structures
library.addNodeType(UnsharpMaskNode, [('Image',),
('Submenu_test','submenu2','submenu3')])
fc.setLibrary(library)
## Now we will programmatically add nodes to define the function of the flowchart.
## Normally, the user will do this manually or by loading a pre-generated
## flowchart file.
v1Node = fc.createNode('ImageView', pos=(0, -150))
v1Node.setView(v1)
v2Node = fc.createNode('ImageView', pos=(150, -150))
v2Node.setView(v2)
fNode = fc.createNode('UnsharpMask', pos=(0, 0))
fc.connectTerminals(fc['dataIn'], fNode['dataIn'])
fc.connectTerminals(fc['dataIn'], v1Node['data'])