Salome HOME
Copyright update 2020
[modules/smesh.git] / src / Tools / padder / spadderpy / gui / inputdata.py
1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2011-2020  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.MeshJobFile). 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.MeshJobFile.
32
33 class InputData(DataModeler):
34     MESHTYPES=Enumerate([
35         'CONCRETE',
36         'STEELBAR'
37         ])
38
39     maListe=MESHTYPES.listvalues()
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             a_type  = TypeString,
50             a_range = None
51             )
52         self.addAttribute(
53             name  = "meshType",
54             a_type  = TypeInteger,
55             a_range = [0,1] 
56             )
57         self.addAttribute(
58             name  = "groupName",
59             a_type  = TypeString,
60             a_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")