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
37 from Extensions.i18n import tr
43 class JDC(V_MCCOMPO.MCCOMPO):
49 Methode pour generation d un rapport de validite
52 self.cr.debut=tr("DEBUT CR validation : ")+self.nom
53 self.cr.fin=tr("FIN CR validation : ")+self.nom
54 for e in self.etapes :
56 self.cr.add(e.report())
57 self.state = 'modified'
58 self.isvalid(cr='oui')
61 def isvalid(self,cr='non'):
63 Méthode booléenne qui retourne 0 si le JDC est invalide, 1 sinon
65 # FR : on prend en compte l'état du JDC ('unchanged','modified','undetermined')
66 # afin d'accélérer le test de validité du JDC
67 if self.state == 'unchanged':
71 texte,test = self.verif_regles()
74 self.cr.fatal(' '.strip(texte))
78 if not e.isactif() : continue
82 self.state="unchanged"
86 def verif_regles(self):
88 Effectue la vérification de validité des règles du jeu de commandes
90 noms_etapes = [etape.nom for etape in self.etapes]
93 for regle in self.regles:
94 texte, test = regle.verif(noms_etapes)
95 texte_global = texte_global + texte
96 test_global = test_global*test
97 return texte_global, test_global