1 # -*- coding: utf-8 -*-
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
24 from desChoixCode import Ui_ChoixCode
25 from determine import monEnvQT5
27 from PyQt5.QtWidgets import QDialog, QRadioButton, QGroupBox, QButtonGroup
28 from PyQt5.QtGui import QPalette
29 from PyQt5.QtCore import QProcess, QFileInfo, Qt, QSize
31 from PyQt4.QtGui import *
32 from PyQt4.QtCore import *
37 class MonChoixCode(Ui_ChoixCode,QDialog):
39 Classe définissant le panel associé aux mots-clés qui demandent
40 à l'utilisateur de choisir une seule valeur parmi une liste de valeurs
43 def __init__(self, parentAppli=None):
44 QDialog.__init__(self,parentAppli)
47 self.parentAppli=parentAppli
51 self.pB_OK.clicked.connect(self.choisitCode)
52 self.pB_cancel.clicked.connect(self.sortie)
54 self.connect(self.pB_OK,SIGNAL("clicked()"),self.choisitCode)
55 self.connect(self.pB_cancel,SIGNAL("clicked()"),self.sortie)
60 def verifieInstall(self):
61 self.groupCodes=QButtonGroup(self.groupBox)
62 vars=os.environ.items()
63 listeCode=('Aster','Adao','Carmel3D','CarmelCND','CF','MAP','MT','PSEN','PSEN_N1','Telemac','ZCracks',)
64 for code in listeCode:
65 dirCode=os.path.abspath(os.path.join(os.path.abspath(__file__),'../..',code))
68 bouton=QRadioButton(self.groupBox)
70 self.groupCodes.addButton(bouton)
71 self.vlBouton.addWidget(bouton)
73 clef="PREFS_CATA_"+code
75 repIntegrateur=os.path.abspath(os.environ[clef])
76 l=os.listdir(repIntegrateur)
77 bouton=QRadioButton(self.groupBox)
80 self.groupCodes.addButton(bouton)
83 listeCodesIntegrateur=[]
85 if re.search('^PREFS_CATA_',k) != None and k[11:] not in listeCode:
86 listeCodesIntegrateur.append(k[11:])
87 for code in listeCodesIntegrateur:
89 clef="PREFS_CATA_"+code
90 repIntegrateur=os.path.abspath(os.environ[clef])
91 l=os.listdir(repIntegrateur)
92 bouton=QRadioButton(self)
95 self.groupCodes.addButton(bouton)
98 self.parentAppli.ListeCode=self.parentAppli.ListeCode+listeCodesIntegrateur
100 def choisitCode(self):
101 bouton=self.groupCodes.checkedButton()
102 if bouton==None : return
103 code=str(bouton.text())
104 codeUpper=code.upper()
105 self.parentAppli.code=codeUpper
107 dirCode=os.path.abspath(os.path.join(os.path.abspath(__file__),'../..',code))
108 l=os.listdir(dirCode)
109 sys.path.insert(0,dirCode)
111 clef="PREFS_CATA_"+code
112 repIntegrateur=os.path.abspath(os.environ[clef])
113 l=os.listdir(repIntegrateur)
114 sys.path.insert(0,repIntegrateur)