本文整理汇总了Python中Item.adapt方法的典型用法代码示例。如果您正苦于以下问题:Python Item.adapt方法的具体用法?Python Item.adapt怎么用?Python Item.adapt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item.adapt方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getChildren
# 需要导入模块: import Item [as 别名]
# 或者: from Item import adapt [as 别名]
def getChildren(self):
sublist=[]
for n in self.node.getSetOfInputPort():
sublist.append(Item.adapt(n))
for n in self.node.getSetOfOutputPort():
sublist.append(Item.adapt(n))
for n in self.node.getSetOfInputDataStreamPort():
sublist.append(Item.adapt(n))
for n in self.node.getSetOfOutputDataStreamPort():
sublist.append(Item.adapt(n))
return sublist
示例2: addNode
# 需要导入模块: import Item [as 别名]
# 或者: from Item import adapt [as 别名]
def addNode(self,service):
new_node=service.clone(None)
ItemComposedNode.n=ItemComposedNode.n+1
name=service.getName()+"_%d" % ItemComposedNode.n
new_node.setName(name)
#replace the old node (if it exists) with the new one
nodes=self.node.edGetDirectDescendants()
if nodes:
old_item=Item.adapt(nodes[0])
CONNECTOR.Emit(old_item,"remove")
self.node.edSetNode(new_node)
item=Item.adapt(new_node)
CONNECTOR.Emit(self,"add",item)
CONNECTOR.Emit(self,"changed")
示例3: connect
# 需要导入模块: import Item [as 别名]
# 或者: from Item import adapt [as 别名]
def connect(self):
print "ControlItem.connect",self.context
print self.port
item=Item.adapt(self.port)
print item
item.connect()
self.context.connecting(item)
示例4: __init__
# 需要导入模块: import Item [as 别名]
# 或者: from Item import adapt [as 别名]
def __init__(self,parent,item):
QVBox.__init__(self,parent)
self.item=item
vsplit=QSplitter(Qt.Vertical,self,"VSplitter")
vbox=QVBox(vsplit)
vbox.layout().setAlignment(Qt.AlignTop|Qt.AlignLeft)
row0=QHBox(vbox)
label=QLabel("Name: ",row0)
self.lined0 = QLineEdit(item.node.getName(),row0)
#row1=QVBox(self)
#self.setStretchFactor(row1,10)
row2=QHBox(vbox)
but1=QPushButton( "Save", row2 )
but1.setFixedSize( but1.sizeHint())
but2=QPushButton( "Cancel", row2 )
but2.setFixedSize( but2.sizeHint())
self.connect( but1, SIGNAL("clicked()"), self.handleSave )
self.connect( but2, SIGNAL("clicked()"), self.handleCancel )
nodes= item.node.edGetDirectDescendants()
if nodes:
node=nodes[0]
subitem=Item.adapt(node)
panel=subitem.box(vsplit)
示例5: selected
# 需要导入模块: import Item [as 别名]
# 或者: from Item import adapt [as 别名]
def selected(self):
#print "ItemComposedNode selected"
root=self.node.getRootNode()
rootItem=Item.adapt(root)
if not self.emitting:
self.emitting=1
CONNECTOR.Emit(rootItem,"selected",self)
self.emitting=0
示例6: __init__
# 需要导入模块: import Item [as 别名]
# 或者: from Item import adapt [as 别名]
def __init__(self,node,port,canvas):
QCanvasRectangle.__init__(self,canvas)
self.setSize(6,6)
self.port=port
self.setPen(QPen(Qt.black))
self.setBrush(QBrush(Qt.red))
self.setZ(node.z()+1)
self.node=node
self.item=Item.adapt(self.port)
示例7: __init__
# 需要导入模块: import Item [as 别名]
# 或者: from Item import adapt [as 别名]
def __init__(self,port,root=None):
Item.Item.__init__(self)
self.port=port
self.label=port.getName()
if root:
self.root=root
elif self.port.getNode().getFather():
root=self.port.getNode().getRootNode()
self.root=Item.adapt(root)
else:
self.root=None
示例8: __init__
# 需要导入模块: import Item [as 别名]
# 或者: from Item import adapt [as 别名]
def __init__(self,item,parent):
self.parent=parent
self.item=item
self.node=item.node
#initial canvas size : 1000x1000
self.canvas=MyCanvas(1000,1000)
self.editor=GraphViewer(self.canvas,parent,"example",0)
self.createGraph()
root=self.node.getRootNode()
rootItem=Item.adapt(root)
CONNECTOR.Connect(rootItem,"selected",self.selectItem,())
CONNECTOR.Connect(self.item,"add",self.addItem,())
CONNECTOR.Connect(self.item.datalinks,"add",self.addLink,())
示例9: link
# 需要导入模块: import Item [as 别名]
# 或者: from Item import adapt [as 别名]
def link(self,other):
father=self.port.getNode().getFather()
if father != other.port.getNode().getFather():
#not same father : not for the moment
return
try:
father.edAddLink(self.port,other.port)
l=StreamLinkItem(other.port,self.port)
fitem=Item.adapt(father)
fitem.addLink(l)
except ValueError,ex:
traceback.print_exc()
QMessageBox.warning(None,"YACS error",str(ex))
return
示例10: __init__
# 需要导入模块: import Item [as 别名]
# 或者: from Item import adapt [as 别名]
def __init__(self,parent,proc):
QVBox.__init__(self,parent)
pp=Item.adapt(proc)
self.proc=proc
self.pproc=pp
self.hSplitter = QSplitter(self,"hSplitter")
self.objectBrowser=Tree.Tree(self.hSplitter,self.onSelect,self.onDblSelect)
self.objectBrowser.additem(pp)
self.panelManager=PanelManager.PanelManager(self.hSplitter)
self.panelManager.setRootItem(pp)
self.boxManager=BoxManager.BoxManager(self.hSplitter)
self.boxManager.setRootItem(pp)
self.selected=None
self.executor=None
self.resume=0
self.thr=None
self.log=logview.LogView()
示例11: selected
# 需要导入模块: import Item [as 别名]
# 或者: from Item import adapt [as 别名]
def selected(self):
"""The canvas item has been selected"""
#print "node selected"
item=Item.adapt(self.node)
item.selected()