1 # Copyright (C) 2007-2021 EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 from __future__ import absolute_import
21 from builtins import object
27 # "OPENTURNS_STUDY" : {0:{"Essai":"Std.comm"}},
28 # "OPENTURNS_WRAPPER" : {0:{"Essai":"wrapper_exemple.comm"}},
31 class listePatrons(object) :
33 def __init__(self,code = "ASTER"):
34 repIni=os.path.dirname(os.path.abspath(__file__))
35 self.rep_patrons=repIni+"/Patrons/"+code
37 if code in sous_menus :
38 self.sous_menu=sous_menus[code]
43 def traiteListe(self):
44 if not (self.code in sous_menus) : return
45 if not (os.path.exists(self.rep_patrons)) : return
46 for file in os.listdir(self.rep_patrons):
47 for i in range(len(self.sous_menu)):
48 clef=list(self.sous_menu[i].keys())[0]
49 chaine=self.sous_menu[i][clef]
50 if re.search(chaine,file) :
51 if clef in self.liste:
52 self.liste[clef].append(file)
54 self.liste[clef]=[file]