1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2017 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 from __future__ import absolute_import
25 from . import CONNECTOR
28 from Noyau.N_CO import CO
29 from Noyau.N_ASSD import assd
33 Retourne 1 si self est une MCList (liste de mots-cles), 0 sinon (defaut)
39 Retourne les regles de self
41 if hasattr(self,'definition'):
42 return self.definition.regles
43 elif hasattr(self,'regles'):
50 Met l'etat de l'objet a modified et propage au parent
51 qui vaut None s'il n'existe pas
53 self.state = 'modified'
55 self.parent.initModif()
59 Methode appelee apres qu'une modification a ete faite afin de declencher
60 d'eventuels traitements post-modification
62 #print "finModif",self
63 # pour les objets autres que les commandes, aucun traitement specifique
64 # on remonte l'info de fin de modif au parent
65 CONNECTOR.Emit(self,"valid")
67 self.parent.finModif()
69 def isRepetable(self):
71 Indique si l'objet est repetable
75 def listeMcPresents(self):
77 Retourne la liste des noms des mots cles presents
82 return self.definition.getDocu()
84 def getListeMcInconnus(self):
86 Retourne la liste des mots-cles inconnus dans self
90 def verifConditionRegles(self,liste_presents):
92 Retourne la liste des mots-cles a rajouter pour satisfaire les regles
93 en fonction de la liste des mots-cles presents
96 for regle in self.definition.regles:
97 liste=regle.verifConditionRegle(liste,liste_presents)
100 def verifConditionBloc(self):
102 Evalue les conditions de tous les blocs fils possibles
103 (en fonction du catalogue donc de la definition) de self et
104 retourne deux listes :
105 - la premiere contient les noms des blocs a rajouter
106 - la seconde contient les noms des blocs a supprimer
110 def getGenealogiePrecise(self):
112 l=self.parent.getGenealogiePrecise()
113 l.append(self.nom.strip())
116 return [self.nom.strip()]
118 def getGenealogie(self):
120 Retourne la liste des noms des ascendants (noms de MCSIMP,MCFACT,MCBLOC
121 ou ETAPE) de self jusqu'au premier objet etape rencontre
124 l=self.parent.getGenealogie()
125 l.append(self.nom.strip())
128 return [self.nom.strip()]
132 Retourne la chaine d'aide contenue dans le catalogue
133 en tenant compte de la langue
137 c=getattr(self.definition,self.jdc.lang)
142 c=getattr(self.definition,"fr")
147 def updateConcept(self,sd):
151 """ Retourne l'objet normalise. En general self sauf si
152 pour etre insere dans l'objet pere il doit etre
153 wrappe dans un autre objet (voir mot cle facteur).
157 def deleteMcGlobal(self):
160 def updateMcGlobal(self):
164 # print "__del__",self
166 class ErrorObj(OBJECT):pass