1 # Copyright (C) 2006-2022 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, or (at your option) any later version.
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
25 class PanelScript(QVBox):
26 def __init__(self,parent,item):
27 QVBox.__init__(self,parent)
32 label=QLabel("Name: ",row0)
33 self.lined0 = QLineEdit(item.node.getName(),row0)
35 label=QLabel("Script: ",self)
36 self.mle=Editor.Editor(self,"multiLineEdit" )
37 self.mle.setText(item.node.getScript())
40 but1=QPushButton( "Save", row2 )
41 but1.setFixedSize( but1.sizeHint())
42 but2=QPushButton( "Cancel", row2 )
43 but2.setFixedSize( but2.sizeHint())
44 self.connect( but1, SIGNAL("clicked()"), self.handleSave )
45 self.connect( but2, SIGNAL("clicked()"), self.handleCancel )
48 self.item.node.setScript(str(self.mle.text()))
50 def handleCancel(self):
51 self.lined0.setText(self.item.node.getName())
52 self.mle.setText(self.item.node.getScript())
54 class PanelFunc(QVBox):
55 def __init__(self,parent,item):
56 QVBox.__init__(self,parent)
61 label=QLabel("Name: ",row0)
62 self.lined0 = QLineEdit(self.item.node.getName(),row0)
65 label=QLabel("Fname: ",row1)
66 self.lined1 = QLineEdit(self.item.node.getFname(),row1)
68 label=QLabel("Function: ",self)
69 self.mle=Editor.Editor(self,"multiLineEdit" )
70 self.mle.setText(self.item.node.getScript())
73 but1=QPushButton( "Save", row2 )
74 but1.setFixedSize( but1.sizeHint())
75 but2=QPushButton( "Cancel", row2 )
76 but2.setFixedSize( but2.sizeHint())
77 self.connect( but1, SIGNAL("clicked()"), self.handleSave )
78 self.connect( but2, SIGNAL("clicked()"), self.handleCancel )
81 self.item.node.setFname(str(self.lined1.text()))
82 self.item.node.setScript(str(self.mle.text()))
84 def handleCancel(self):
85 self.lined0.setText(self.item.node.getName())
86 self.lined1.setText(self.item.node.getFname())
87 self.mle.setText(self.item.node.getScript())
89 class PanelForLoop(QVBox):
90 def __init__(self,parent,item):
91 QVBox.__init__(self,parent)
93 vsplit=QSplitter(Qt.Vertical,self,"VSplitter")
95 vbox.layout().setAlignment(Qt.AlignTop|Qt.AlignLeft)
98 label=QLabel("Name: ",row0)
99 self.lined0 = QLineEdit(item.node.getName(),row0)
102 #self.setStretchFactor(row1,10)
105 but1=QPushButton( "Save", row2 )
106 but1.setFixedSize( but1.sizeHint())
107 but2=QPushButton( "Cancel", row2 )
108 but2.setFixedSize( but2.sizeHint())
109 self.connect( but1, SIGNAL("clicked()"), self.handleSave )
110 self.connect( but2, SIGNAL("clicked()"), self.handleCancel )
112 nodes= item.node.edGetDirectDescendants()
115 subitem=Item.adapt(node)
116 panel=subitem.box(vsplit)
118 def handleSave(self):
120 def handleCancel(self):
123 class PanelInPort(QVBox):
124 def __init__(self,parent,item):
125 QVBox.__init__(self,parent)
127 self.layout().setAlignment(Qt.AlignTop|Qt.AlignLeft)
130 label=QLabel("Name: ",row0)
131 lined0 = QLineEdit(self.item.port.getName(),row0)
132 label=QLabel("Type: ",row0)
133 QLineEdit(self.item.port.edGetType().name(),row0)
135 label=QLabel("Value: ",self)
136 self.value=QTextEdit(self)
137 self.value.setText("Empty")
141 but1=QPushButton( "Save", row3 )
142 but1.setFixedSize( but1.sizeHint())
143 self.connect( but1, SIGNAL("clicked()"), self.handleSave )
144 but2=QPushButton( "Restore", row3 )
145 but2.setFixedSize( but2.sizeHint())
146 self.connect( but2, SIGNAL("clicked()"), self.handleRestore )
148 def handleSave(self):
150 self.item.port.edInitXML(str(self.value.text()))
152 traceback.print_exc()
153 self.value.setText(self.item.port.dump())
155 def handleRestore(self):
156 if not self.item.port.isEmpty():
157 self.value.setText(self.item.port.dump())
159 class PanelOutPort(PanelInPort):
160 def handleRestore(self):
162 self.value.setText(self.item.port.dump())
164 traceback.print_exc()