1 # Copyright (C) 2006-2008 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
26 def __init__(self,root=None):
27 Item.Item.__init__(self)
36 CONNECTOR.Emit(self.root,"selected",self)
39 def panel(self,parent):
40 """Retourne un tab widget pour browser/editer la proc"""
41 tabWidget = QTabWidget( parent )
42 for name,method in self.panels:
43 tabWidget.addTab( method(self,tabWidget), name )
48 def panel1(self,parent):
50 self.text=QTextEdit(qvbox,"log")
51 self.text.setFrameShape(QTextEdit.NoFrame)
52 self.text.setTextFormat(QTextEdit.PlainText)
53 self.text.setWordWrap(QTextEdit.FixedColumnWidth)
54 #self.text.setWrapColumnOrWidth(120)
55 self.text.setReadOnly(1)
58 panels=[("Panel1",panel1)]
60 class ItemService(Item.Item):
61 def __init__(self,service,root):
62 Item.Item.__init__(self)
65 self.label=service.getName()
67 def isExpandable(self):
70 def addNode(self,appli):
71 appli.addNode(self.service)
73 def getChildren(self):
75 for port in self.service.getSetOfInputPort():
76 sublist.append(Items.ItemInPort(port,self.root))
77 for port in self.service.getSetOfOutputPort():
78 sublist.append(Items.ItemOutPort(port,self.root))
79 for port in self.service.getSetOfInputDataStreamPort():
80 sublist.append(Items.ItemInStream(port,self.root))
81 for port in self.service.getSetOfOutputDataStreamPort():
82 sublist.append(Items.ItemOutStream(port,self.root))
88 CONNECTOR.Emit(self.root,"selected",self)
91 class ItemType(Item.Item):
92 def __init__(self,typ,root,name=""):
93 Item.Item.__init__(self)
101 def isExpandable(self):
104 def getChildren(self):
109 if not self.emitting:
111 CONNECTOR.Emit(self.root,"selected",self)
114 class ItemCompo(Item.Item):
115 def __init__(self,compo,root):
116 Item.Item.__init__(self)
119 self.label=compo.getName()
121 def isExpandable(self):
124 def getChildren(self):
126 for service in self.compo._serviceMap.values():
127 itemservice=ItemService(service,self.root)
128 sublist.append(itemservice)
132 if not self.emitting:
134 CONNECTOR.Emit(self.root,"selected",self)
137 class ItemNode(Item.Item):
138 def __init__(self,node,root):
139 Item.Item.__init__(self)
142 self.label=node.getName()
144 def isExpandable(self):
147 def addNode(self,appli):
148 appli.addNode(self.node)
150 def getChildren(self):
155 if not self.emitting:
157 CONNECTOR.Emit(self.root,"selected",self)
160 class ItemComposedNode(Item.Item):
161 def __init__(self,node,root):
162 Item.Item.__init__(self)
165 self.label=node.getName()
167 def addNode(self,appli):
168 appli.addNode(self.node)
170 def isExpandable(self):
173 def getChildren(self):
178 if not self.emitting:
180 CONNECTOR.Emit(self.root,"selected",self)
183 class TypesItem(Item.Item):
184 """Item for types folder"""
185 def __init__(self,typeMap,root):
186 Item.Item.__init__(self)
191 def getIconName(self):
194 def isExpandable(self):
197 def getChildren(self):
199 for name,typ in self.typeMap.items():
200 itemtype=ItemType(typ,self.root,name)
201 sublist.append(itemtype)
204 class ComponentsItem(Item.Item):
205 """Item for components folder"""
206 def __init__(self,compoMap,root):
207 Item.Item.__init__(self)
208 self.compoMap=compoMap
209 self.label="Components"
212 def getIconName(self):
215 def isExpandable(self):
218 def getChildren(self):
220 for compo in self.compoMap.values():
221 itemcompo=ItemCompo(compo,self.root)
222 sublist.append(itemcompo)
225 class NodesItem(Item.Item):
226 """Item for nodes folder"""
227 def __init__(self,nodesMap,root):
228 Item.Item.__init__(self)
229 self.nodesMap=nodesMap
233 def getIconName(self):
236 def isExpandable(self):
239 def getChildren(self):
241 for node in self.nodesMap.values():
242 itemnode=ItemNode(node,self.root)
243 sublist.append(itemnode)
246 class ComposedNodesItem(Item.Item):
247 """Item for composed nodes folder"""
248 def __init__(self,composedMap,root):
249 Item.Item.__init__(self)
250 self.composedMap=composedMap
251 self.label="ComposedNodes"
254 def getIconName(self):
257 def isExpandable(self):
260 def getChildren(self):
262 for node in self.composedMap.values():
263 itemnode=ItemComposedNode(node,self.root)
264 sublist.append(itemnode)
268 def __init__(self,cata):
271 self.label=cata.getName()
273 def isExpandable(self):
276 def getChildren(self):
278 sublist.append(TypesItem(self.cata._typeMap,self))
279 sublist.append(NodesItem(self.cata._nodeMap,self))
280 sublist.append(ComposedNodesItem(self.cata._composednodeMap,self))
281 sublist.append(ComponentsItem(self.cata._componentMap,self))
284 def dblselected(self):
285 if not self.emitting:
287 CONNECTOR.Emit(self,"dblselected",self)