Salome HOME
ab2f933e1b375ad984a88a1875733ad3fb496992
[modules/smesh.git] / src / Tools / padder / spadderpy / gui / inputdata.py
1 # -*- coding: iso-8859-1 -*-
2 #  Copyright (C) 2011 EDF R&D
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.
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 # -* Makefile *- 
21 #
22 # Author : Guillaume Boulant (EDF)
23 #
24
25 from salome.kernel.enumerate import Enumerate
26 from salome.kernel.datamodeler import DataModeler, TypeString, TypeInteger
27
28 # __MEM__: Note that this module does not depend on the SPADDER
29 # component on purpose (we could have use a derived structure of
30 # SPADDER_ORB.MeshJobParameter). This choice is made to ease the test
31 # and development of the gui part of the plugin. If this data
32 # structure becomes too important, we could make another arrangement
33 # and use directly a SPADDER_ORB.MeshJobParameter.
34
35 class InputData(DataModeler):
36     MESHTYPES=Enumerate([
37         'CONCRETE',
38         'STEELBAR'
39         ])
40
41     def __init__(self):
42         DataModeler.__init__(self)
43         self.addAttribute(
44             name  = "meshObject",
45             void  = True
46             )
47         self.addAttribute(
48             name  = "meshName",
49             type  = TypeString,
50             range = None
51             )
52         self.addAttribute(
53             name  = "meshType",
54             type  = TypeInteger,
55             range = self.MESHTYPES.listvalues()
56             )
57         self.addAttribute(
58             name  = "groupName",
59             type  = TypeString,
60             range = None
61             )
62
63 #
64 # ==============================================================================
65 # Basic use cases and unit tests
66 # ==============================================================================
67 #
68 def TEST_getName():
69     testdata = InputData()
70     testdata.meshName   = "myMesh"
71     testdata.meshObject = None
72     testdata.meshType   = InputData.MESHTYPES.CONCRETE
73     if testdata.meshName != "myMesh" :
74         return False
75     return True
76
77 if __name__ == "__main__":
78     from salome.kernel.unittester import run
79     run("inputdata","TEST_getName")