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