X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=Noyau%2FN_SIMP.py;h=ef61e1944c73b5ca2f20dd8f8c25d70b4598215f;hb=2c5a8689b9c6cc46804fd268d416d1de2777059e;hp=70720181c007912df605d65dccce2396a382d9bf;hpb=f1ca95b49f76bed371d3bc90fc94bd12a6f17523;p=tools%2Feficas.git diff --git a/Noyau/N_SIMP.py b/Noyau/N_SIMP.py index 70720181..ef61e194 100644 --- a/Noyau/N_SIMP.py +++ b/Noyau/N_SIMP.py @@ -1,25 +1,22 @@ -#@ MODIF N_SIMP Noyau DATE 14/09/2004 AUTEUR MCOURTOI M.COURTOIS # -*- coding: iso-8859-1 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY -# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY -# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. +# Copyright (C) 2007-2013 EDF R&D # -# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT -# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU -# GENERAL PUBLIC LICENSE FOR MORE DETAILS. +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE -# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - """ Ce module contient la classe de definition SIMP qui permet de spécifier les caractéristiques des mots clés simples @@ -29,15 +26,16 @@ import types import N_ENTITE import N_MCSIMP +from strfunc import ufmt class SIMP(N_ENTITE.ENTITE): """ - Classe pour definir un mot cle simple + Classe pour definir un mot cle simple - Cette classe a deux attributs de classe + Cette classe a deux attributs de classe - - class_instance qui indique la classe qui devra etre utilisée - pour créer l'objet qui servira à controler la conformité d'un + - class_instance qui indique la classe qui devra etre utilisée + pour créer l'objet qui servira à controler la conformité d'un mot-clé simple avec sa définition - label qui indique la nature de l'objet de définition (ici, SIMP) @@ -48,12 +46,12 @@ class SIMP(N_ENTITE.ENTITE): def __init__(self,typ,fr="",ang="",statut='f',into=None,defaut=None, min=1,max=1,homo=1,position ='local', - val_min = '**',val_max='**',docu="",validators=None): - + val_min = '**',val_max='**',docu="",validators=None,sug=None): + """ Un mot-clé simple est caractérisé par les attributs suivants : - - type : cet attribut est obligatoire et indique le type de valeur attendue + - type : cet attribut est obligatoire et indique le type de valeur attendue - fr : @@ -97,33 +95,20 @@ class SIMP(N_ENTITE.ENTITE): self.val_min=val_min self.val_max=val_max self.docu = docu + self.sug = sug def verif_cata(self): """ - Cette methode sert à valider les attributs de l'objet de définition + Cette methode sert à valider les attributs de l'objet de définition de la classe SIMP """ - if type(self.min) != types.IntType : - if self.min != '**': - self.cr.fatal("L'attribut 'min' doit etre un entier : "+`self.min`) - if type(self.max) != types.IntType : - if self.max != '**' : - self.cr.fatal("L'attribut 'max' doit etre un entier : "+`self.max`) - if self.min > self.max : - self.cr.fatal("Nombres d'occurrence min et max invalides : %s %s" %(`self.min`,`self.max`)) - if type(self.fr) != types.StringType : - self.cr.fatal("L'attribut 'fr' doit etre une chaine de caractères : %s" +`self.fr`) - if self.statut not in ['o','f','c','d']: - self.cr.fatal("L'attribut 'statut' doit valoir 'o','f','c' ou 'd' : %s" %`self.statut`) - if self.homo != 0 and self.homo != 1 : - self.cr.fatal("L'attribut 'homo' doit valoir 0 ou 1 : %s" %`self.homo`) - if self.into != None : - if type(self.into) != types.TupleType : - self.cr.fatal("L'attribut 'into' doit etre un tuple : %s" %`self.into`) - if self.position not in ['local','global','global_jdc']: - self.cr.fatal("L'attribut 'position' doit valoir 'local','global' ou 'global_jdc' : %s" %`self.position`) - if self.validators and not self.validators.verif_cata(): - self.cr.fatal("Un des validateurs est incorrect. Raison : "+self.validators.cata_info) + self.check_min_max() + self.check_fr() + self.check_statut() + self.check_homo() + self.check_into() + self.check_position() + self.check_validators() def __call__(self,val,nom,parent=None): """