Version: 9.15.0
cataitems.py
Go to the documentation of this file.
1 # Copyright (C) 2006-2025 CEA, EDF
2 #
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, or (at your option) any later version.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19 
20 from qt import *
21 
22 from . import Item
23 from . import CONNECTOR
24 from . import Items
25 
26 class Obj(Item.Item):
27  def __init__(self,root=None):
28  Item.Item.__init__(self)
29  if root:
30  self.rootroot=root
31  else:
32  self.rootroot=self
33 
34  def selected(self):
35  if not self.emittingemittingemitting:
36  self.emittingemittingemitting=1
37  CONNECTOR.Emit(self.rootroot,"selected",self)
38  self.emittingemittingemitting=0
39 
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.panelspanels:
44  tabWidget.addTab( method(self,tabWidget), name )
45  return tabWidget
46 
47  box=panel
48 
49  def panel1(self,parent):
50  qvbox=QVBox(parent)
51  self.texttext=QTextEdit(qvbox,"log")
52  self.texttext.setFrameShape(QTextEdit.NoFrame)
53  self.texttext.setTextFormat(QTextEdit.PlainText)
54  self.texttext.setWordWrap(QTextEdit.FixedColumnWidth)
55  #self.text.setWrapColumnOrWidth(120)
56  self.texttext.setReadOnly(1)
57  return qvbox
58 
59  panels=[("Panel1",panel1)]
60 
62  def __init__(self,service,root):
63  Item.Item.__init__(self)
64  self.rootroot=root
65  self.serviceservice=service
66  self.labellabellabel=service.getName()
67 
68  def isExpandable(self):
69  return True
70 
71  def addNode(self,appli):
72  appli.addNode(self.serviceservice)
73 
74  def getChildren(self):
75  sublist=[]
76  for port in self.serviceservice.getSetOfInputPort():
77  sublist.append(Items.ItemInPort(port,self.rootroot))
78  for port in self.serviceservice.getSetOfOutputPort():
79  sublist.append(Items.ItemOutPort(port,self.rootroot))
80  for port in self.serviceservice.getSetOfInputDataStreamPort():
81  sublist.append(Items.ItemInStream(port,self.rootroot))
82  for port in self.serviceservice.getSetOfOutputDataStreamPort():
83  sublist.append(Items.ItemOutStream(port,self.rootroot))
84  return sublist
85 
86  def selected(self):
87  if not self.emittingemittingemitting:
88  self.emittingemittingemitting=1
89  CONNECTOR.Emit(self.rootroot,"selected",self)
90  self.emittingemittingemitting=0
91 
93  def __init__(self,typ,root,name=""):
94  Item.Item.__init__(self)
95  self.typtyp=typ
96  self.rootroot=root
97  if name:
98  self.labellabellabel=name
99  else:
100  self.labellabellabel=typ.name()
101 
102  def isExpandable(self):
103  return True
104 
105  def getChildren(self):
106  sublist=[]
107  return sublist
108 
109  def selected(self):
110  if not self.emittingemittingemitting:
111  self.emittingemittingemitting=1
112  CONNECTOR.Emit(self.rootroot,"selected",self)
113  self.emittingemittingemitting=0
114 
116  def __init__(self,compo,root):
117  Item.Item.__init__(self)
118  self.compocompo=compo
119  self.rootroot=root
120  self.labellabellabel=compo.getName()
121 
122  def isExpandable(self):
123  return True
124 
125  def getChildren(self):
126  sublist=[]
127  for service in list(self.compocompo._serviceMap.values()):
128  itemservice=ItemService(service,self.rootroot)
129  sublist.append(itemservice)
130  return sublist
131 
132  def selected(self):
133  if not self.emittingemittingemitting:
134  self.emittingemittingemitting=1
135  CONNECTOR.Emit(self.rootroot,"selected",self)
136  self.emittingemittingemitting=0
137 
139  def __init__(self,node,root):
140  Item.Item.__init__(self)
141  self.nodenode=node
142  self.rootroot=root
143  self.labellabellabel=node.getName()
144 
145  def isExpandable(self):
146  return True
147 
148  def addNode(self,appli):
149  appli.addNode(self.nodenode)
150 
151  def getChildren(self):
152  sublist=[]
153  return sublist
154 
155  def selected(self):
156  if not self.emittingemittingemitting:
157  self.emittingemittingemitting=1
158  CONNECTOR.Emit(self.rootroot,"selected",self)
159  self.emittingemittingemitting=0
160 
162  def __init__(self,node,root):
163  Item.Item.__init__(self)
164  self.nodenode=node
165  self.rootroot=root
166  self.labellabellabel=node.getName()
167 
168  def addNode(self,appli):
169  appli.addNode(self.nodenode)
170 
171  def isExpandable(self):
172  return True
173 
174  def getChildren(self):
175  sublist=[]
176  return sublist
177 
178  def selected(self):
179  if not self.emittingemittingemitting:
180  self.emittingemittingemitting=1
181  CONNECTOR.Emit(self.rootroot,"selected",self)
182  self.emittingemittingemitting=0
183 
185  """Item for types folder"""
186  def __init__(self,typeMap,root):
187  Item.Item.__init__(self)
188  self.typeMaptypeMap=typeMap
189  self.labellabellabel="Types"
190  self.rootroot=root
191 
192  def getIconName(self):
193  return "folder"
194 
195  def isExpandable(self):
196  return True
197 
198  def getChildren(self):
199  sublist=[]
200  for name,typ in list(self.typeMaptypeMap.items()):
201  itemtype=ItemType(typ,self.rootroot,name)
202  sublist.append(itemtype)
203  return sublist
204 
206  """Item for components folder"""
207  def __init__(self,compoMap,root):
208  Item.Item.__init__(self)
209  self.compoMapcompoMap=compoMap
210  self.labellabellabel="Components"
211  self.rootroot=root
212 
213  def getIconName(self):
214  return "folder"
215 
216  def isExpandable(self):
217  return True
218 
219  def getChildren(self):
220  sublist=[]
221  for compo in list(self.compoMapcompoMap.values()):
222  itemcompo=ItemCompo(compo,self.rootroot)
223  sublist.append(itemcompo)
224  return sublist
225 
227  """Item for nodes folder"""
228  def __init__(self,nodesMap,root):
229  Item.Item.__init__(self)
230  self.nodesMapnodesMap=nodesMap
231  self.labellabellabel="Nodes"
232  self.rootroot=root
233 
234  def getIconName(self):
235  return "folder"
236 
237  def isExpandable(self):
238  return True
239 
240  def getChildren(self):
241  sublist=[]
242  for node in list(self.nodesMapnodesMap.values()):
243  itemnode=ItemNode(node,self.rootroot)
244  sublist.append(itemnode)
245  return sublist
246 
248  """Item for composed nodes folder"""
249  def __init__(self,composedMap,root):
250  Item.Item.__init__(self)
251  self.composedMapcomposedMap=composedMap
252  self.labellabellabel="ComposedNodes"
253  self.rootroot=root
254 
255  def getIconName(self):
256  return "folder"
257 
258  def isExpandable(self):
259  return True
260 
261  def getChildren(self):
262  sublist=[]
263  for node in list(self.composedMapcomposedMap.values()):
264  itemnode=ItemComposedNode(node,self.rootroot)
265  sublist.append(itemnode)
266  return sublist
267 
268 class Cata(Obj):
269  def __init__(self,cata):
270  Obj.__init__(self)
271  self.catacata=cata
272  self.labellabellabel=cata.getName()
273 
274  def isExpandable(self):
275  return True
276 
277  def getChildren(self):
278  sublist=[]
279  sublist.append(TypesItem(self.catacata._typeMap,self))
280  sublist.append(NodesItem(self.catacata._nodeMap,self))
281  sublist.append(ComposedNodesItem(self.catacata._composednodeMap,self))
282  sublist.append(ComponentsItem(self.catacata._componentMap,self))
283  return sublist
284 
285  def dblselected(self):
286  if not self.emittingemittingemittingemitting:
288  CONNECTOR.Emit(self,"dblselected",self)
289  self.emittingemittingemittingemitting=0
290 
def dblselected(self)
Definition: cataitems.py:285
def getChildren(self)
Definition: cataitems.py:277
def isExpandable(self)
Definition: cataitems.py:274
def __init__(self, cata)
Definition: cataitems.py:269
def __init__(self, compoMap, root)
Definition: cataitems.py:207
def __init__(self, composedMap, root)
Definition: cataitems.py:249
def __init__(self, compo, root)
Definition: cataitems.py:116
def __init__(self, node, root)
Definition: cataitems.py:162
def addNode(self, appli)
Definition: cataitems.py:168
def isExpandable(self)
Definition: cataitems.py:145
def __init__(self, node, root)
Definition: cataitems.py:139
def addNode(self, appli)
Definition: cataitems.py:148
def addNode(self, appli)
Definition: cataitems.py:71
def __init__(self, service, root)
Definition: cataitems.py:62
def __init__(self, typ, root, name="")
Definition: cataitems.py:93
def isExpandable(self)
Definition: cataitems.py:102
def __init__(self, nodesMap, root)
Definition: cataitems.py:228
def panel(self, parent)
Definition: cataitems.py:40
def __init__(self, root=None)
Definition: cataitems.py:27
def selected(self)
Definition: cataitems.py:34
def panel1(self, parent)
Definition: cataitems.py:49
def __init__(self, typeMap, root)
Definition: cataitems.py:186