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
22 Ce module contient la classe mixin MCBLOC qui porte les méthodes
23 nécessaires pour réaliser la validation d'un objet de type MCBLOC
26 Une classe mixin porte principalement des traitements et est
27 utilisée par héritage multiple pour composer les traitements.
31 from Noyau.strfunc import ufmt
33 class MCBLOC(V_MCCOMPO.MCCOMPO):
35 Cette classe a un attribut de classe :
37 - txt_nat qui sert pour les comptes-rendus liés à cette classe
42 def isvalid(self,sd='oui',cr='non'):
44 Methode pour verifier la validité du MCBLOC. Cette méthode
45 peut etre appelée selon plusieurs modes en fonction de la valeur
48 Si cr vaut oui elle crée en plus un compte-rendu
49 sd est présent pour compatibilité de l'interface mais ne sert pas
51 if self.state == 'unchanged' :
55 if hasattr(self,'valid'):
56 old_valid = self.valid
59 for child in self.mc_liste :
60 if not child.isvalid():
63 # Après avoir vérifié la validité de tous les sous-objets, on vérifie
64 # la validité des règles
65 text_erreurs,test_regles = self.verif_regles()
68 self.cr.fatal(_(u"Règle(s) non respectée(s) : %s"), text_erreurs)
71 self.state = 'unchanged'
72 if not old_valid or old_valid != self.valid :