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 JDC qui porte les méthodes
23 nécessaires pour réaliser la validation d'un objet de type JDC
26 Une classe mixin porte principalement des traitements et est
27 utilisée par héritage multiple pour composer les traitements.
31 from Noyau.N_Exception import AsException
32 from Noyau.N_utils import AsType
33 from Noyau.strfunc import ufmt
35 class JDC(V_MCCOMPO.MCCOMPO):
41 Methode pour generation d un rapport de validite
44 self.cr.debut="DEBUT CR validation : "+self.nom
45 self.cr.fin="FIN CR validation :"+self.nom
46 for e in self.etapes :
48 self.cr.add(e.report())
49 self.state = 'modified'
50 self.isvalid(cr='oui')
53 def isvalid(self,cr='non'):
55 Méthode booléenne qui retourne 0 si le JDC est invalide, 1 sinon
57 # FR : on prend en compte l'état du JDC ('unchanged','modified','undetermined')
58 # afin d'accélérer le test de validité du JDC
59 if self.state == 'unchanged':
63 texte,test = self.verif_regles()
66 self.cr.fatal(' '.strip(texte))
70 if not e.isactif() : continue
74 self.state="unchanged"
78 def verif_regles(self):
80 Effectue la vérification de validité des règles du jeu de commandes
82 noms_etapes = [etape.nom for etape in self.etapes]
85 for regle in self.regles:
86 texte, test = regle.verif(noms_etapes)
87 texte_global = texte_global + texte
88 test_global = test_global*test
89 return texte_global, test_global