26 from qtcanvas
import *
37 Item.Item.__init__(self)
40 self.
label= pout.getNode().getName()+
":"+pout.getName()+
"->"+pin.getNode().getName()+
":"+pin.getName()
47 Item.Item.__init__(self)
50 self.
label= pout.getNode().getName()+
":"+pout.getName()+
"->"+pin.getNode().getName()+
":"+pin.getName()
53 return "streamlink.png"
57 Item.Item.__init__(self)
60 self.
label= nodeup.getName()+
"->"+nodedown.getName()
63 return "controllink.png"
66 """Item for all control links of a composed node"""
68 Item.Item.__init__(self)
79 for n
in self.item.node.edGetDirectDescendants():
80 for p
in n.getOutNodes():
85 CONNECTOR.Emit(self,
"add",link)
88 """Item for all data links of a composed node"""
90 Item.Item.__init__(self)
101 for pout,pin
in self.item.node.getSetOfInternalLinks():
102 if pout.getNode().getFather() != self.item.node
and pin.getNode().getFather() != self.item.node:
104 if isinstance(pin,pilot_InputDataStreamPort):
115 CONNECTOR.Emit(self,
"add",link)
118 """Item pour les noeuds composes"""
122 Item.Item.__init__(self)
134 liste=self.node.edGetDirectDescendants()
139 sublist.append(Item.adapt(n))
150 root=self.node.getRootNode()
151 rootItem=Item.adapt(root)
154 CONNECTOR.Emit(rootItem,
"dblselected",self)
159 root=self.node.getRootNode()
160 rootItem=Item.adapt(root)
163 CONNECTOR.Emit(rootItem,
"selected",self)
170 """Retourne un tab widget pour browser/editer la proc"""
171 tabWidget = QTabWidget( parent )
172 for name,method
in self.panels:
173 tabWidget.addTab( method(self,tabWidget), name )
177 print "Composed.addNode",service
179 new_node=service.clone(
None)
180 ItemComposedNode.n=ItemComposedNode.n+1
181 name=service.getName()+
"_%d" % ItemComposedNode.n
182 new_node.setName(name)
183 self.node.edAddChild(new_node)
184 item=Item.adapt(new_node)
185 CONNECTOR.Emit(self,
"add",item)
194 self.graph.layout(rankdir)
196 panels=[(
"Panel1",panel1)]
199 print "Composed.addLink",link
200 if isinstance(link,DataLinkItem):
201 self.datalinks.addLink(link)
202 elif isinstance(link,StreamLinkItem):
203 self.datalinks.addLink(link)
205 self.controllinks.addLink(link)
213 new_node=service.clone(
None)
214 ItemComposedNode.n=ItemComposedNode.n+1
215 name=service.getName()+
"_%d" % ItemComposedNode.n
216 new_node.setName(name)
218 nodes=self.node.edGetDirectDescendants()
220 old_item=Item.adapt(nodes[0])
221 CONNECTOR.Emit(old_item,
"remove")
222 self.node.edSetNode(new_node)
223 item=Item.adapt(new_node)
224 CONNECTOR.Emit(self,
"add",item)
225 CONNECTOR.Emit(self,
"changed")
230 class ItemForEach(ItemForLoop):
237 class ItemProc(ItemComposedNode):
238 """Item pour la procedure"""
240 print "ItemProc.connecting",item
244 """Item pour les ports """
247 Item.Item.__init__(self)
252 elif self.port.getNode().getFather():
253 root=self.port.getNode().getRootNode()
254 self.
root=Item.adapt(root)
264 CONNECTOR.Emit(self.
root,
"selected",self)
271 """Retourne un tab widget pour browser/editer l'item"""
272 tabWidget = QTabWidget( parent )
273 for name,method
in self.
panels:
274 tabWidget.addTab( method(self,tabWidget), name )
279 print "ItemPort.link:",self,other
282 print "ItemPort.connect:"
283 self.root.connecting(self)
292 panels=[(
"Panel1",panel1)]
301 panels=[(
"Panel1",panel1)]
304 nodeS=self.port.getNode()
305 nodeE=other.port.getNode()
306 father=nodeS.getFather()
307 if father != nodeE.getFather():
312 cflink= nodeE.getInGate()
in nodeS.getOutGate().edSetInGate()
313 father.edAddDFLink(self.
port,other.port)
315 fitem=Item.adapt(father)
320 except ValueError,ex:
321 traceback.print_exc()
322 QMessageBox.warning(
None,
"YACS error",str(ex))
327 return "instream.png"
331 return "outstream.png"
334 father=self.port.getNode().getFather()
335 if father != other.port.getNode().getFather():
339 father.edAddLink(self.
port,other.port)
341 fitem=Item.adapt(father)
343 except ValueError,ex:
344 traceback.print_exc()
345 QMessageBox.warning(
None,
"YACS error",str(ex))
349 """Item for InGate"""
351 Item.Item.__init__(self)
354 """Item for OutGate"""
356 Item.Item.__init__(self)
360 """Item pour les noeuds elementaires
366 Item.Item.__init__(self)
373 root=self.node.getRootNode()
374 rootItem=Item.adapt(root)
378 CONNECTOR.Emit(self,
"selected",self)
380 CONNECTOR.Emit(rootItem,
"selected",self)
388 for n
in self.node.getSetOfInputPort():
389 sublist.append(Item.adapt(n))
390 for n
in self.node.getSetOfOutputPort():
391 sublist.append(Item.adapt(n))
392 for n
in self.node.getSetOfInputDataStreamPort():
393 sublist.append(Item.adapt(n))
394 for n
in self.node.getSetOfOutputDataStreamPort():
395 sublist.append(Item.adapt(n))
399 """Retourne un tab widget pour browser/editer l'item"""
400 tabWidget = QTabWidget( parent )
401 for name,method
in self.
panels:
402 tabWidget.addTab( method(self,tabWidget), name )
411 panels=[(
"Panel1",panel1)]
420 panels=[(
"Panel1",panel1)]
430 """Retourne un widget pour browser/editer l'item"""
434 qvbox.layout().setAlignment(Qt.AlignTop|Qt.AlignLeft)
435 qvbox.setSpacing( 5 )
438 label=QLabel(
"Name: ",row0)
440 qvbox.connect( self.
lined0, SIGNAL(
"textChanged(const QString &)"), self.
NameChanged )
442 QToolTip.add( self.
lined0,
"Node name" )
445 label1=QLabel(
"Ref: ",row1)
447 if self.node.getComponent():
448 self.lined1.setText(self.node.getComponent().getName())
450 self.lined1.setText(
"NO_COMPONENT_NAME")
453 label2=QLabel(
"Method: ",row2)
455 self.lined2.setText(self.node.getMethod())
458 but1=QPushButton(
"Save", row3 )
459 but2=QPushButton(
"Cancel", row3 )
460 qvbox.connect( but1, SIGNAL(
"clicked()"), self.
handleSave )
461 qvbox.connect( but2, SIGNAL(
"clicked()"), self.
handleCancel )
465 panels=[(
"Panel1",panel1)]
474 return "green-square"
477 self.node.setRef(str(self.lined1.text()))
478 self.node.setMethod(str(self.lined2.text()))
480 self.lined0.setText(self.node.getName())
481 self.lined1.setText(self.node.getComponent().getName())
482 self.lined2.setText(self.node.getMethod())
535 if hasattr(pilot,
"ProcPtr"):
537 adapt.registerAdapterFactory(pilot.ProcPtr,
Item.Item, adapt_Proc_to_Item)
538 adapt.registerAdapterFactory(pilot.BlocPtr,
Item.Item, adapt_ComposedNode_to_Item)
539 adapt.registerAdapterFactory(pilot.ForLoopPtr,
Item.Item, adapt_ComposedNode_to_Item)
540 adapt.registerAdapterFactory(pilot.WhileLoopPtr,
Item.Item, adapt_ComposedNode_to_Item)
541 adapt.registerAdapterFactory(pilot.ForEachLoopPtr,
Item.Item, adapt_ComposedNode_to_Item)
542 adapt.registerAdapterFactory(pilot.SwitchPtr,
Item.Item, adapt_ComposedNode_to_Item)
543 adapt.registerAdapterFactory(pilot.ComposedNodePtr,
Item.Item, adapt_ComposedNode_to_Item)
545 adapt.registerAdapterFactory(pilot.ServiceNodePtr,
Item.Item, adapt_ServiceNode_to_Item)
547 adapt.registerAdapterFactory(pilot.InlineNodePtr,
Item.Item, adapt_InlineScriptNode_to_Item)
548 adapt.registerAdapterFactory(pilot.InlineFuncNodePtr,
Item.Item, adapt_InlineFuncNode_to_Item)
549 adapt.registerAdapterFactory(pilot.NodePtr,
Item.Item, adapt_Node_to_Item)
551 adapt.registerAdapterFactory(pilot.OutputPortPtr,
Item.Item, adapt_OutPort_to_Item)
552 adapt.registerAdapterFactory(pilot.InputPortPtr,
Item.Item, adapt_InPort_to_Item)
553 adapt.registerAdapterFactory(pilot.OutputDataStreamPortPtr,
Item.Item, adapt_OutStream_to_Item)
554 adapt.registerAdapterFactory(pilot.InputDataStreamPortPtr,
Item.Item, adapt_InStream_to_Item)
556 pilot_InputDataStreamPort=pilot.InputDataStreamPortPtr
560 adapt.registerAdapterFactory(pilot.Proc,
Item.Item, adapt_Proc_to_Item)
561 adapt.registerAdapterFactory(SALOMERuntime.SalomeProc,
Item.Item, adapt_Proc_to_Item)
562 adapt.registerAdapterFactory(pilot.Bloc,
Item.Item, adapt_ComposedNode_to_Item)
563 adapt.registerAdapterFactory(pilot.ForLoop,
Item.Item, adapt_ForLoop_to_Item)
565 adapt.registerAdapterFactory(pilot.WhileLoop,
Item.Item, adapt_While_to_Item)
566 adapt.registerAdapterFactory(pilot.ForEachLoop,
Item.Item, adapt_ForEach_to_Item)
567 adapt.registerAdapterFactory(pilot.Switch,
Item.Item, adapt_Switch_to_Item)
568 adapt.registerAdapterFactory(pilot.ComposedNode,
Item.Item, adapt_ComposedNode_to_Item)
570 adapt.registerAdapterFactory(pilot.ServiceNode,
Item.Item, adapt_ServiceNode_to_Item)
571 adapt.registerAdapterFactory(SALOMERuntime.CORBANode,
Item.Item, adapt_ServiceNode_to_Item)
572 adapt.registerAdapterFactory(SALOMERuntime.SalomeNode,
Item.Item, adapt_ServiceNode_to_Item)
574 adapt.registerAdapterFactory(pilot.InlineNode,
Item.Item, adapt_InlineScriptNode_to_Item)
575 adapt.registerAdapterFactory(SALOMERuntime.PythonNode,
Item.Item, adapt_InlineScriptNode_to_Item)
576 adapt.registerAdapterFactory(pilot.InlineFuncNode,
Item.Item, adapt_InlineFuncNode_to_Item)
577 adapt.registerAdapterFactory(SALOMERuntime.PyFuncNode,
Item.Item, adapt_InlineFuncNode_to_Item)
578 adapt.registerAdapterFactory(pilot.Node,
Item.Item, adapt_Node_to_Item)
580 adapt.registerAdapterFactory(pilot.OutputPort,
Item.Item, adapt_OutPort_to_Item)
581 adapt.registerAdapterFactory(SALOMERuntime.OutputPyPort,
Item.Item, adapt_OutPort_to_Item)
582 adapt.registerAdapterFactory(SALOMERuntime.OutputCorbaPort,
Item.Item, adapt_OutPort_to_Item)
583 adapt.registerAdapterFactory(pilot.InputPort,
Item.Item, adapt_InPort_to_Item)
584 adapt.registerAdapterFactory(SALOMERuntime.InputPyPort,
Item.Item, adapt_InPort_to_Item)
585 adapt.registerAdapterFactory(SALOMERuntime.InputCorbaPort,
Item.Item, adapt_InPort_to_Item)
586 adapt.registerAdapterFactory(pilot.OutputDataStreamPort,
Item.Item, adapt_OutStream_to_Item)
587 adapt.registerAdapterFactory(pilot.InputDataStreamPort,
Item.Item, adapt_InStream_to_Item)
588 adapt.registerAdapterFactory(pilot.OutGate,
Item.Item, adapt_OutGate_to_Item)
589 adapt.registerAdapterFactory(pilot.InGate,
Item.Item, adapt_InGate_to_Item)
591 pilot_InputDataStreamPort=pilot.InputDataStreamPort