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
23 from __future__ import absolute_import
25 from builtins import str
29 from desChoixCode import Ui_ChoixCode
30 from PyQt5.QtWidgets import QDialog, QRadioButton, QGroupBox, QButtonGroup
31 from PyQt5.QtGui import QPalette
32 from PyQt5.QtCore import QProcess, QFileInfo, Qt, QSize
37 class MonChoixCode(Ui_ChoixCode,QDialog):
39 Classe definissant le panel associe aux mots-cles qui demandent
40 a 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
50 self.pB_OK.clicked.connect(self.choisitCode)
51 self.pB_cancel.clicked.connect(self.sortie)
56 def verifieInstall(self):
57 self.groupCodes=QButtonGroup(self.groupBox)
58 vars=list(os.environ.items())
59 listeCode=('Aster','Adao','Carmel3D','CarmelCND','CF','MAP','MT','PSEN','PSEN_N1','Telemac','ZCracks',)
60 for code in listeCode:
61 dirCode=os.path.abspath(os.path.join(os.path.abspath(__file__),'../..',code))
64 bouton=QRadioButton(self.groupBox)
66 self.groupCodes.addButton(bouton)
67 self.vlBouton.addWidget(bouton)
69 clef="PREFS_CATA_"+code
71 repIntegrateur=os.path.abspath(os.environ[clef])
72 l=os.listdir(repIntegrateur)
73 bouton=QRadioButton(self.groupBox)
76 self.groupCodes.addButton(bouton)
79 listeCodesIntegrateur=[]
81 if re.search('^PREFS_CATA_',k) != None and k[11:] not in listeCode:
82 listeCodesIntegrateur.append(k[11:])
83 for code in listeCodesIntegrateur:
85 clef="PREFS_CATA_"+code
86 repIntegrateur=os.path.abspath(os.environ[clef])
87 l=os.listdir(repIntegrateur)
88 bouton=QRadioButton(self)
91 self.groupCodes.addButton(bouton)
94 self.parentAppli.listeCode=self.parentAppli.listeCode+listeCodesIntegrateur
96 def choisitCode(self):
97 bouton=self.groupCodes.checkedButton()
98 if bouton==None : return
99 code=str(bouton.text())
100 codeUpper=code.upper()
101 self.parentAppli.code=codeUpper
103 dirCode=os.path.abspath(os.path.join(os.path.abspath(__file__),'../..',code))
104 l=os.listdir(dirCode)
105 sys.path.insert(0,dirCode)
107 clef="PREFS_CATA_"+code
108 repIntegrateur=os.path.abspath(os.environ[clef])
109 l=os.listdir(repIntegrateur)
110 sys.path.insert(0,repIntegrateur)