當前位置: 首頁>>代碼示例>>Python>>正文


Python Flowchart.setLibrary方法代碼示例

本文整理匯總了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
開發者ID:fossasia,項目名稱:pslab-apps,代碼行數:58,代碼來源:Z_hackyourown.py

示例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'])
開發者ID:acrsilva,項目名稱:animated-zZz-machine,代碼行數:32,代碼來源:FlowchartCustomNode.py


注:本文中的pyqtgraph.flowchart.Flowchart.setLibrary方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。