1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013 EDF R&D
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.
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.
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
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 """ Ce module contient la classe de definition SIMP
22 qui permet de spécifier les caractéristiques des mots clés simples
29 from strfunc import ufmt
31 class SIMP(N_ENTITE.ENTITE):
33 Classe pour definir un mot cle simple
35 Cette classe a deux attributs de classe
37 - class_instance qui indique la classe qui devra etre utilisée
38 pour créer l'objet qui servira à controler la conformité d'un
39 mot-clé simple avec sa définition
41 - label qui indique la nature de l'objet de définition (ici, SIMP)
44 class_instance = N_MCSIMP.MCSIMP
47 def __init__(self,typ,fr="",ang="",statut='f',into=None,defaut=None,
48 min=1,max=1,homo=1,position ='local',
49 val_min = '**',val_max='**',docu="",validators=None,sug=None):
52 Un mot-clé simple est caractérisé par les attributs suivants :
54 - type : cet attribut est obligatoire et indique le type de valeur attendue
80 N_ENTITE.ENTITE.__init__(self,validators)
81 # Initialisation des attributs
82 if type(typ) == types.TupleType :
94 self.position = position
100 def verif_cata(self):
102 Cette methode sert à valider les attributs de l'objet de définition
110 self.check_position()
111 self.check_validators()
113 def __call__(self,val,nom,parent=None):
115 Construit un objet mot cle simple (MCSIMP) a partir de sa definition (self)
116 de sa valeur (val), de son nom (nom) et de son parent dans l arboresence (parent)
118 return self.class_instance(nom=nom,definition=self,val=val,parent=parent)