Salome HOME
66e96da05803e05bd355a14781353b546e028eda
[modules/gui.git] / src / SalomeApp / pluginsdemo / tubedialog_ui.py
1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2010-2014  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 # Author : Guillaume Boulant (EDF)
21
22 import sys
23 from PyQt4 import QtGui
24 from PyQt4 import QtCore
25
26
27 class TubeDialog_UI(QtGui.QDialog):
28     """
29     This class defines the design of a Qt dialog box dedicated to the
30     salome plugin examples. It presents a UI form that contains
31     parameters for the spatial dimensions of geometrical object.  
32     """
33     def __init__(self, parent=None):
34         QtGui.QDialog.__init__(self, parent)
35         self.setupUi()
36
37     def setupUi(self):
38         self.setObjectName("Dialog")
39         self.resize(400, 300)
40         self.hboxlayout = QtGui.QHBoxLayout(self)
41         self.hboxlayout.setMargin(9)
42         self.hboxlayout.setSpacing(6)
43         self.hboxlayout.setObjectName("hboxlayout")
44         self.vboxlayout = QtGui.QVBoxLayout()
45         self.vboxlayout.setMargin(0)
46         self.vboxlayout.setSpacing(6)
47         self.vboxlayout.setObjectName("vboxlayout")
48         self.hboxlayout1 = QtGui.QHBoxLayout()
49         self.hboxlayout1.setMargin(0)
50         self.hboxlayout1.setSpacing(6)
51         self.hboxlayout1.setObjectName("hboxlayout1")
52         self.vboxlayout1 = QtGui.QVBoxLayout()
53         self.vboxlayout1.setMargin(0)
54         self.vboxlayout1.setSpacing(6)
55         self.vboxlayout1.setObjectName("vboxlayout1")
56         self.lblRadius = QtGui.QLabel(self)
57         self.lblRadius.setObjectName("lblRadius")
58         self.vboxlayout1.addWidget(self.lblRadius)
59         self.lblLength = QtGui.QLabel(self)
60         self.lblLength.setObjectName("lblLength")
61         self.vboxlayout1.addWidget(self.lblLength)
62         self.lblWidth = QtGui.QLabel(self)
63         self.lblWidth.setObjectName("lblWidth")
64         self.vboxlayout1.addWidget(self.lblWidth)
65         self.hboxlayout1.addLayout(self.vboxlayout1)
66         self.vboxlayout2 = QtGui.QVBoxLayout()
67         self.vboxlayout2.setMargin(0)
68         self.vboxlayout2.setSpacing(6)
69         self.vboxlayout2.setObjectName("vboxlayout2")
70         self.txtRadius = QtGui.QLineEdit(self)
71         self.txtRadius.setObjectName("txtRadius")
72         self.vboxlayout2.addWidget(self.txtRadius)
73         self.txtLength = QtGui.QLineEdit(self)
74         self.txtLength.setObjectName("txtLength")
75         self.vboxlayout2.addWidget(self.txtLength)
76         self.txtWidth = QtGui.QLineEdit(self)
77         self.txtWidth.setObjectName("txtWidth")
78         self.vboxlayout2.addWidget(self.txtWidth)
79         self.hboxlayout1.addLayout(self.vboxlayout2)
80         self.vboxlayout.addLayout(self.hboxlayout1)
81         spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
82         self.vboxlayout.addItem(spacerItem)
83         self.buttonBox = QtGui.QDialogButtonBox(self)
84         self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
85         self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Ok)
86         self.buttonBox.setObjectName("buttonBox")
87         self.vboxlayout.addWidget(self.buttonBox)
88         self.hboxlayout.addLayout(self.vboxlayout)
89
90         self.setWindowTitle("Tube construction")
91         self.lblRadius.setText("Rayon")
92         self.lblLength.setText("Longueur")
93         self.lblWidth.setText("Epaisseur")
94
95 #
96 # ======================================================================
97 # Unit test
98 # ======================================================================
99 #
100 def main( args ):
101     a = QtGui.QApplication(sys.argv)
102     tubedialog = TubeDialog_UI()
103     sys.exit(tubedialog.exec_())
104
105 if __name__=="__main__":
106     main(sys.argv)
107