Salome HOME
premiere version
[tools/eficas.git] / Editeur / analyse_catalogue_initial.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2013   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 from string import split,strip,lowercase,uppercase
21 import re,string,os
22
23 from Extensions.i18n import tr
24 #
25 __Id__="$Id: analyse_catalogue_initial.py,v 1.2.4.1.2.2.2.4 2013-04-09 14:04:44 pnoyret Exp $"
26 __version__="$Name: V7_main $"
27 #
28
29                 
30 class Catalogue_initial:
31         def __init__(self,fichier):
32                 self.liste_commandes=[]
33                 self.lignes=[]
34                 self.fichier=fichier
35                 self.ouvrir_fichier()
36                 self.constr_list_txt_cmd()
37
38         def ouvrir_fichier(self):
39                 try :
40                         f=open(self.fichier,'r')
41                         self.lignes=f.readlines()
42                         f.close()
43                 except :
44                         print tr("Impossible d'ouvrir le fichier : %s", str(self.fichier))
45
46         def constr_list_txt_cmd(self):
47                 pattern = '^# Ordre Catalogue '
48                 for i in self.lignes :
49                     if (re.search(pattern,i)):
50                         i=i.replace('# Ordre Catalogue ','')
51                         i=i.replace('\n','')
52                         self.liste_commandes.append(i)
53
54
55 def analyse_catalogue(nom_cata):
56         cata = Catalogue_initial(nom_cata)
57         return cata.liste_commandes
58
59
60 if __name__ == "__main__" :
61         monCata="/local/noyret/Install_Eficas/EficasQT4/Openturns_StudyOpenTURNS_Cata_Study_V4.py"
62         analyse_catalogue(monCata)
63
64
65
66
67
68
69
70
71
72
73
74                                 
75