1 # Copyright (C) 2006-2013 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
27 def __init__(self,root=None):
28 Item.Item.__init__(self)
37 CONNECTOR.Emit(self.root,"selected",self)
40 def panel(self,parent):
41 """Retourne un tab widget pour browser/editer la proc"""
42 tabWidget = QTabWidget( parent )
43 for name,method in self.panels:
44 tabWidget.addTab( method(self,tabWidget), name )
49 def panel1(self,parent):
51 self.text=QTextEdit(qvbox,"log")
52 self.text.setFrameShape(QTextEdit.NoFrame)
53 self.text.setTextFormat(QTextEdit.PlainText)
54 self.text.setWordWrap(QTextEdit.FixedColumnWidth)
55 #self.text.setWrapColumnOrWidth(120)
56 self.text.setReadOnly(1)
59 panels=[("Panel1",panel1)]
61 class ItemService(Item.Item):
62 def __init__(self,service,root):
63 Item.Item.__init__(self)
66 self.label=service.getName()
68 def isExpandable(self):
71 def addNode(self,appli):
72 appli.addNode(self.service)
74 def getChildren(self):
76 for port in self.service.getSetOfInputPort():
77 sublist.append(Items.ItemInPort(port,self.root))
78 for port in self.service.getSetOfOutputPort():
79 sublist.append(Items.ItemOutPort(port,self.root))
80 for port in self.service.getSetOfInputDataStreamPort():
81 sublist.append(Items.ItemInStream(port,self.root))
82 for port in self.service.getSetOfOutputDataStreamPort():
83 sublist.append(Items.ItemOutStream(port,self.root))
89 CONNECTOR.Emit(self.root,"selected",self)
92 class ItemType(Item.Item):
93 def __init__(self,typ,root,name=""):
94 Item.Item.__init__(self)
100 self.label=typ.name()
102 def isExpandable(self):
105 def getChildren(self):
110 if not self.emitting:
112 CONNECTOR.Emit(self.root,"selected",self)
115 class ItemCompo(Item.Item):
116 def __init__(self,compo,root):
117 Item.Item.__init__(self)
120 self.label=compo.getName()
122 def isExpandable(self):
125 def getChildren(self):
127 for service in self.compo._serviceMap.values():
128 itemservice=ItemService(service,self.root)
129 sublist.append(itemservice)
133 if not self.emitting:
135 CONNECTOR.Emit(self.root,"selected",self)
138 class ItemNode(Item.Item):
139 def __init__(self,node,root):
140 Item.Item.__init__(self)
143 self.label=node.getName()
145 def isExpandable(self):
148 def addNode(self,appli):
149 appli.addNode(self.node)
151 def getChildren(self):
156 if not self.emitting:
158 CONNECTOR.Emit(self.root,"selected",self)
161 class ItemComposedNode(Item.Item):
162 def __init__(self,node,root):
163 Item.Item.__init__(self)
166 self.label=node.getName()
168 def addNode(self,appli):
169 appli.addNode(self.node)
171 def isExpandable(self):
174 def getChildren(self):
179 if not self.emitting:
181 CONNECTOR.Emit(self.root,"selected",self)
184 class TypesItem(Item.Item):
185 """Item for types folder"""
186 def __init__(self,typeMap,root):
187 Item.Item.__init__(self)
192 def getIconName(self):
195 def isExpandable(self):
198 def getChildren(self):
200 for name,typ in self.typeMap.items():
201 itemtype=ItemType(typ,self.root,name)
202 sublist.append(itemtype)
205 class ComponentsItem(Item.Item):
206 """Item for components folder"""
207 def __init__(self,compoMap,root):
208 Item.Item.__init__(self)
209 self.compoMap=compoMap
210 self.label="Components"
213 def getIconName(self):
216 def isExpandable(self):
219 def getChildren(self):
221 for compo in self.compoMap.values():
222 itemcompo=ItemCompo(compo,self.root)
223 sublist.append(itemcompo)
226 class NodesItem(Item.Item):
227 """Item for nodes folder"""
228 def __init__(self,nodesMap,root):
229 Item.Item.__init__(self)
230 self.nodesMap=nodesMap
234 def getIconName(self):
237 def isExpandable(self):
240 def getChildren(self):
242 for node in self.nodesMap.values():
243 itemnode=ItemNode(node,self.root)
244 sublist.append(itemnode)
247 class ComposedNodesItem(Item.Item):
248 """Item for composed nodes folder"""
249 def __init__(self,composedMap,root):
250 Item.Item.__init__(self)
251 self.composedMap=composedMap
252 self.label="ComposedNodes"
255 def getIconName(self):
258 def isExpandable(self):
261 def getChildren(self):
263 for node in self.composedMap.values():
264 itemnode=ItemComposedNode(node,self.root)
265 sublist.append(itemnode)
269 def __init__(self,cata):
272 self.label=cata.getName()
274 def isExpandable(self):
277 def getChildren(self):
279 sublist.append(TypesItem(self.cata._typeMap,self))
280 sublist.append(NodesItem(self.cata._nodeMap,self))
281 sublist.append(ComposedNodesItem(self.cata._composednodeMap,self))
282 sublist.append(ComponentsItem(self.cata._componentMap,self))
285 def dblselected(self):
286 if not self.emitting:
288 CONNECTOR.Emit(self,"dblselected",self)