]> SALOME platform Git repositories - tools/eficas.git/blob - Ihm/I_REGLE.py
Salome HOME
update version
[tools/eficas.git] / Ihm / I_REGLE.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2021   EDF R&D
3 #
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.
8 #
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.
13 #
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
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 """
21 """
22 from __future__ import absolute_import
23
24 class REGLE:
25
26     def getText(self):
27         text = self.__class__.__name__+ ' :\n'
28         for mc in self.mcs :
29             text = text + '\t' + mc.strip() + '\n'
30         return text
31
32     def purgeListe(self,liste_a_purger,listeMcPresents):
33         """
34              Cette methode doit retirer de la liste liste_a_purger
35              les elements qui ne doivent plus apparaitre en fonction du contexte
36         """
37         # Dans le cas general on ne touche pas a la liste
38         return liste_a_purger
39
40     def hasOperande(self,nom):
41         # On peut faire aussi try:self.mcs.index(nom);return 1;except:return 0
42         for mc in self.mcs:
43             if mc==nom : return 1
44         return 0
45
46     def verifConditionRegle(self,liste,l_mc_presents):
47         return []
48
49
50 #  def enregistreXML(self,root,catalogueXml):
51 #      import xml.etree.ElementTree as ET
52 #      regleXml=ET.SubElement(root,'regles')
53 #      txt=""
54 #      for mot in self.getText().split('\n'):
55 #          mot.replace(' ','')
56 #          txt=txt + mot + " "
57 #      regleXml.text= txt