From: Pascale Noyret Date: Thu, 3 Sep 2009 14:12:37 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V1_0OpenTurns~65 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=db6979e1fc7565aeb71cedfbe4e5d1e1858249b7;p=modules%2Feficas.git *** empty log message *** --- diff --git a/InterfaceQT4/browser.py b/InterfaceQT4/browser.py index a4789d92..6ef023f4 100644 --- a/InterfaceQT4/browser.py +++ b/InterfaceQT4/browser.py @@ -136,7 +136,6 @@ class JDCNode(QTreeWidgetItem): ind=ind+1 def affichePanneau(self) : - print self if self.item.isactif(): panel=self.getPanel() else: diff --git a/InterfaceQT4/compooper.py b/InterfaceQT4/compooper.py index bfbe5af8..c833cc83 100644 --- a/InterfaceQT4/compooper.py +++ b/InterfaceQT4/compooper.py @@ -67,16 +67,16 @@ class Node(browser.JDCNode, typeNode.PopUpMenuNode): def viewPng(self) : from monPixmap import MonLabelPixmap fichier=self.appliEficas.getName() - try: - #if 1: + try : + os.remove(fichier) + except : + pass + #try: + if 1: import generator g = generator.plugins[self.appliEficas.format_fichier]() - print dir(self.item) g.gener(self.item.object, format='beautifie') stdGener = g.getGenerateur() - print g - print g.__class__ - print dir(stdGener) if len(g.dictMCLois) != 1: QMessageBox.warning( None, @@ -87,20 +87,18 @@ class Node(browser.JDCNode, typeNode.PopUpMenuNode): loi = g.dictMCLois.keys()[0] nomLoi = loi.get_name() script = stdGener.GraphiquePDF(loi, fichier) - print script + #print script d = {} exec script in d - except: - #else: - traceback.print_exc() + widgetPng=MonLabelPixmap(self.appliEficas,fichier,nomLoi) + widgetPng.show() + #except: + else: QMessageBox.warning( None, self.appliEficas.trUtf8("Erreur interne"), self.appliEficas.trUtf8("La PDF de la loi ne peut pas etre affichee."), self.appliEficas.trUtf8("&Annuler")) - widgetPng=MonLabelPixmap(self.appliEficas,fichier,nomLoi) - #ret=widgetPng.exec_() - widgetPng.show() class EtapeTreeItem(Objecttreeitem.ObjectTreeItem): """ La classe EtapeTreeItem est un adaptateur des objets ETAPE du noyau diff --git a/InterfaceQT4/monMatricePanel.py b/InterfaceQT4/monMatricePanel.py new file mode 100644 index 00000000..31e48c84 --- /dev/null +++ b/InterfaceQT4/monMatricePanel.py @@ -0,0 +1,169 @@ +# -*- coding: utf-8 -*- +# CONFIGURATION MANAGEMENT OF EDF VERSION +# ====================================================================== +# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG +# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY +# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY +# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR +# (AT YOUR OPTION) ANY LATER VERSION. +# +# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT +# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU +# GENERAL PUBLIC LICENSE FOR MORE DETAILS. +# +# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE +# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, +# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. +# +# +# ====================================================================== +# Modules Python +import string,types,os + +# Modules Eficas +from PyQt4.QtGui import * +from PyQt4.QtCore import * + +from desMatrice import Ui_desMatrice + + +class MonMatricePanel(Ui_desMatrice,QDialog): + """ + Classe définissant le panel Matrice + Attention n herite pas de QtPanel + """ + def __init__(self,node, parent = None,name = None,fl = 0): + QDialog.__init__(self,parent) + self.node=node + self.editor = parent + self.nbLigs=0 + self.nbCols=0 + self.monType= self.node.item.object.definition.type[0] + if hasattr(parent,"leLayout"): + parent.leLayout.removeWidget(parent.leLayout.widgetActive) + parent.leLayout.widgetActive.close() + parent.leLayout.addWidget(self) + parent.leLayout.widgetActive=self + else: + parent.partieDroite=QWidget() + parent.leLayout=QGridLayout(parent.partieDroite) + parent.leLayout.addWidget(self) + parent.addWidget(parent.partieDroite) + parent.leLayout.widgetActive=self + self.setupUi(self) + self.initVal() + self.creeColonnes() + self.connecterSignaux() + if self.node.item.get_valeur()== None: + self.initialSsValeur() + else : + self.initialValeur() + + def initVal(self): + self.nomVariables={} + + def connecterSignaux(self) : + self.connect(self.TBMatrice,SIGNAL("itemChanged(QTableWidgetItem *)"),self.itemChanged) + self.connect(self.BOk,SIGNAL("clicked()"),self.acceptVal) + + def itemChanged(self): + monItem=self.TBMatrice.currentItem() + if monItem==None : return + texte=monItem.text() + if texte=="" : return + val,ok=texte.toDouble() + if ok == False : + self.editor.affiche_infos("Entrer un float SVP") + monItem.setText("") + return + if self.monType.valSup != None : + if val > self.monType.valSup : + self.editor.affiche_infos("Entrer un float inférieur à " + repr(self.monType.valSup)) + monItem.setText("") + return + if self.monType.valMin != None : + if val < self.monType.valMin : + self.editor.affiche_infos("Entrer un float superieur à " + repr(self.monType.valMin)) + monItem.setText("") + return + self.editor.affiche_infos("") + if self.monType.structure != None: + apply (MonMatricePanel.__dict__[self.monType.structure],(self,)) + + + def symetrique(self): + monItem=self.TBMatrice.currentItem() + texte=monItem.text() + if monItem.row() != monItem.column(): + monItemSym=self.TBMatrice.item(monItem.column(), monItem.row()) + monItemSym.setText(texte) + + def creeColonnes(self): + if self.monType.methodeCalculTaille != None : + #try: + if 1 : + apply (MonMatricePanel.__dict__[self.monType.methodeCalculTaille],(self,)) + else : + #except : + QMessageBox.critical( self, "Mauvaise execution ", "impossible d executer la méthode " + monType.methodeCalculTaille ) + return + else : + self.nbLigs=self.monType.nbLigs + self.nbCols=self.monType.nbCols + + + def NbDeVariables(self): + jdc=self.node.item.object.jdc + etape=self.node.item.object.etape + self.listeVariables=jdc.get_variables() + if self.listeVariables == [] : + QMessageBox.critical( self, "Mauvaise Commande ", "Aucune variable connue") + return + header=QStringList() + for var in self.listeVariables : + header << var + self.TBMatrice.setColumnCount(len(self.listeVariables)) + self.TBMatrice.setRowCount(len(self.listeVariables)) + self.TBMatrice.setVerticalHeaderLabels(header) + self.TBMatrice.setHorizontalHeaderLabels(header) + self.nbLigs=len(self.listeVariables) + self.nbCols=len(self.listeVariables) + + def initialSsValeur(self): + for row in range(self.nbLigs): + for column in range(self.nbCols): + if row == column : + initialFloat=0 + else : + initialFloat=1 + self.TBMatrice.setItem(row,column,QTableWidgetItem(str(initialFloat))) + + def initialValeur(self): + liste=self.node.item.get_valeur() + if (len(liste)) != self.nbLigs : + QMessageBox.critical( self, "Mauvaise dimension de matrice", "le nombre de ligne n est pas egal a " + str(self.nbLigs)) + for i in range(self.nbLigs): + inter=liste[i] + if (len(inter)) != self.nbCols : + QMessageBox.critical( self, "Mauvaise dimension de matrice", "le nombre de colonne n est pas egal a " + str(self.nbCols)) + for j in range(self.nbCols): + self.TBMatrice.setItem(i,j,QTableWidgetItem(str(liste[i][j]))) + + def acceptVal(self): + liste=[] + if self.TBMatrice.rowCount() != self.nbLigs : + QMessageBox.critical( self, "Mauvaise dimension de matrice", "le nombre de ligne n est pas egal a " + str(self.nbLigs)) + if self.TBMatrice.columnCount() != self.nbCols : + QMessageBox.critical( self, "Mauvaise dimension de matrice", "le nombre de colonne n est pas egal a " + str(self.nbCols)) + for i in range(self.nbLigs): + listeCol=[] + for j in range(self.nbCols): + monItem=self.TBMatrice.item(i,j) + texte=monItem.text() + val,ok=texte.toDouble() + if ok == False : + QMessageBox.critical( self, "Mauvaise Valeur", "l element " + str(i) + "," +str(j) +"n est pas correct") + listeCol.append(val) + liste.append(listeCol) + self.node.item.set_valeur(liste) diff --git a/InterfaceQT4/monOptionsEditeur.py b/InterfaceQT4/monOptionsEditeur.py deleted file mode 100644 index f1365093..00000000 --- a/InterfaceQT4/monOptionsEditeur.py +++ /dev/null @@ -1,172 +0,0 @@ -# -*- coding: utf-8 -*- - -import os, re - -from PyQt4.QtGui import * -from PyQt4.QtCore import * - -from OptionsEditeur import Ui_desOptions - - -class desOptions(Ui_desOptions,QDialog): - def __init__(self,parent ,modal ) : - QDialog.__init__(self,parent) - self.setupUi(self) - self.setModal(modal) - -class Options(desOptions): - def __init__(self,parent = None,modal = 0,configuration=None): - #print "Options" - desOptions.__init__(self,parent,modal) - self.configuration=configuration - self.viewMan=parent - self.dVersion={} - self.dRepMat={} - self.dRepCat={} - self.connecterSignaux() - self.initAll() - - def connecterSignaux(self) : - self.connect(self.CBVersions,SIGNAL("activated(int)"),self.VersionChoisie) - self.connect(self.Bdefaut,SIGNAL("clicked()"),self.BdefautChecked) - self.connect(self.LEVersionAjout,SIGNAL("returnPressed()"),self.AjoutVersion) - self.connect(self.LERepDoc,SIGNAL("returnPressed()"),self.ChangePathDoc) - self.connect(self.Bok,SIGNAL("clicked()"),self.BokClicked) - self.connect(self.LEVersionSup,SIGNAL("returnPressed()"),self.SupVersion) - self.connect(self.PBajout,SIGNAL("clicked()"),self.AjoutVersion) - self.connect(self.PBQuit,SIGNAL("clicked()"),self.close) - self.connect(self.LERepDoc,SIGNAL("textChanged(const QString&)"),self.ChangePathDoc) - - - def initAll(self): - self.CBVersions.clear() - for item in self.configuration.catalogues : - try : - (code,version,cata,format,defaut)=item - except : - (code,version,cata,format)=item - self.dVersion[version]=(item) - self.dRepCat[version]=str(cata) - self.CBVersions.addItem(QString(version)) - - codeSansPoint=re.sub("\.","",version) - chaine="rep_mat_"+codeSansPoint - if hasattr(self.configuration,chaine): - rep_mat=getattr(self.configuration,chaine) - self.dRepMat[version]=str(rep_mat) - else : - self.dRepMat[version]="" - self.LERepMat.setText(self.dRepMat[version]) - self.LERepCata.setText(self.dRepCat[version]) - if hasattr(self.configuration,"path_doc"): - self.LERepDoc.setText(self.configuration.path_doc) - - - def VersionChoisie(self): - version=str(self.CBVersions.currentText()) - if self.dRepMat.has_key(version): - self.LERepMat.setText(self.dRepMat[version]) - if self.dRepCat.has_key(version): - self.LERepCata.setText(self.dRepCat[version]) - - def BokClicked(self): - version=str(self.CBVersions.currentText()) - if self.LERepCata.text() == "" : - QMessageBox.critical( self, "Champ non rempli","Le champs Catalogue doit etre rempli" ) - return - - self.dRepMat[version]=self.LERepMat.text() - if str(self.dRepMat[version] != "") != "" : - codeSansPoint=re.sub("\.","",version) - chaine="rep_mat_"+codeSansPoint - setattr(self.configuration,chaine,self.dRepMat[version]) - - self.dRepCat[version]=str(self.LERepCata.text()) - if version in self.dVersion.keys(): - item=list(self.dVersion[version]) - item[2]=self.dRepCat[version] - self.dVersion[version]=tuple(item) - else : - self.dVersion[version]=('ASTER',version,self.dRepCat[version],'python') - - lItem=[] - for version in self.dVersion.keys() : - lItem.append(self.dVersion[version]) - self.configuration.catalogues=lItem - self.configuration.save_params() - - def AjoutVersion(self): - version=self.LEVersionAjout.text() - if str(version) == "" : return - self.CBVersions.addItem(version) - self.LERepMat.setText("") - self.LERepCata.setText("") - self.LEVersionAjout.setText("") - self.CBVersions.setCurrentIndex(self.CBVersions.count()-1) - - def SupVersion(self): - version=str(self.LEVersionSup.text()) - if version == "" : return - i =0 - while i < self.CBVersions.count() : - if self.CBVersions.itemText(i) == version : - self.CBVersions.removeItem(i) - break - i=i+1 - try : - del self.dVersion[version] - del self.dRepMat[version] - del self.dRepCat[version] - except : - self.LEVersionSup.setText("") - return - codeSansPoint=re.sub("\.","",version) - chaine="rep_mat_"+codeSansPoint - if hasattr(self.configuration,chaine): - delattr(self.configuration,chaine) - self.LEVersionSup.setText("") - - lItem=[] - for version in self.dVersion.keys() : - lItem.append(self.dVersion[version]) - self.LERepMat.setText("") - self.LERepCata.setText("") - self.configuration.catalogues=lItem - self.configuration.save_params() - self.CBVersions.setCurrentIndex(0) - self.VersionChoisie() - - - def BdefautChecked(self): - res = QMessageBox.warning( - None, - self.trUtf8("Restauration des parametres par defaut "), - self.trUtf8("Votre fichier editeur sera ecrase."), - self.trUtf8("&Ok"), - self.trUtf8("&Abandonner")) - self.Bdefaut.setState(QButton.Off) - if res == 1 : return - - appli=self.configuration.appli - repIni=self.configuration.REPINI - fic_ini_util=self.configuration.fic_ini_utilisateur - old_fic_ini_util=fic_ini_util+"_old" - commande="mv "+fic_ini_util+" "+old_fic_ini_util - os.system(commande) - import prefs - nameConf='configuration_'+prefs.code - configuration=__import__(nameConf) - - configNew=configuration.CONFIG(appli,repIni) - self.configuration=configNew - appli.CONFIGURATION=configNew - self.configuration.save_params() - self.dVersion={} - self.dRepMat={} - self.dRepCat={} - self.initAll() - - def ChangePathDoc(self): - self.configuration.path_doc=str(self.LERepDoc.text()) - self.configuration.save_params() - diff --git a/InterfaceQT4/monOptions_ASTER.py b/InterfaceQT4/monOptions_ASTER.py new file mode 100644 index 00000000..eff040ad --- /dev/null +++ b/InterfaceQT4/monOptions_ASTER.py @@ -0,0 +1,173 @@ +# -*- coding: utf-8 -*- + +import os, re + +from PyQt4.QtGui import * +from PyQt4.QtCore import * + +from OptionsEditeur import Ui_desOptions + + +class desOptions(Ui_desOptions,QDialog): + def __init__(self,parent ,modal ) : + QDialog.__init__(self,parent) + self.setupUi(self) + self.setModal(modal) + +class Options(desOptions): + def __init__(self,parent = None,modal = 0,configuration=None): + desOptions.__init__(self,parent,modal) + self.configuration=configuration + self.viewMan=parent + self.dVersion={} + self.dRepMat={} + self.dRepCat={} + self.connecterSignaux() + self.initAll() + + def connecterSignaux(self) : + self.connect(self.CBVersions,SIGNAL("activated(int)"),self.VersionChoisie) + self.connect(self.Bdefaut,SIGNAL("clicked()"),self.BdefautChecked) + self.connect(self.LEVersionAjout,SIGNAL("returnPressed()"),self.AjoutVersion) + self.connect(self.LERepDoc,SIGNAL("returnPressed()"),self.ChangePathDoc) + self.connect(self.Bok,SIGNAL("clicked()"),self.BokClicked) + self.connect(self.LEVersionSup,SIGNAL("returnPressed()"),self.SupVersion) + self.connect(self.PBajout,SIGNAL("clicked()"),self.AjoutVersion) + self.connect(self.PBSup,SIGNAL("clicked()"),self.SupVersion) + self.connect(self.PBQuit,SIGNAL("clicked()"),self.close) + + + def initAll(self): + self.CBVersions.clear() + for item in self.configuration.catalogues : + try : + (code,version,cata,format,defaut)=item + except : + (code,version,cata,format)=item + self.dVersion[version]=(item) + self.dRepCat[version]=str(cata) + self.CBVersions.addItem(QString(version)) + + codeSansPoint=re.sub("\.","",version) + chaine="rep_mat_"+codeSansPoint + if hasattr(self.configuration,chaine): + rep_mat=getattr(self.configuration,chaine) + self.dRepMat[version]=str(rep_mat) + else : + self.dRepMat[version]="" + self.LERepMat.setText(self.dRepMat[version]) + self.LERepCata.setText(self.dRepCat[version]) + if hasattr(self.configuration,"path_doc"): + self.LERepDoc.setText(self.configuration.path_doc) + + + def VersionChoisie(self): + version=str(self.CBVersions.currentText()) + if self.dRepMat.has_key(version): + self.LERepMat.setText(self.dRepMat[version]) + if self.dRepCat.has_key(version): + self.LERepCata.setText(self.dRepCat[version]) + + def BokClicked(self): + version=str(self.CBVersions.currentText()) + if self.LERepCata.text() == "" : + QMessageBox.critical( self, "Champ non rempli","Le champs Catalogue doit etre rempli" ) + return + + self.dRepMat[version]=self.LERepMat.text() + if str(self.dRepMat[version] != "") != "" : + codeSansPoint=re.sub("\.","",version) + chaine="rep_mat_"+codeSansPoint + setattr(self.configuration,chaine,self.dRepMat[version]) + + self.dRepCat[version]=str(self.LERepCata.text()) + if version in self.dVersion.keys(): + item=list(self.dVersion[version]) + item[2]=self.dRepCat[version] + self.dVersion[version]=tuple(item) + else : + self.dVersion[version]=('ASTER',version,self.dRepCat[version],'python') + + lItem=[] + for version in self.dVersion.keys() : + lItem.append(self.dVersion[version]) + self.configuration.catalogues=lItem + self.configuration.save_params() + + def AjoutVersion(self): + version=self.LEVersionAjout.text() + if str(version) == "" : return + self.CBVersions.addItem(version) + self.LERepMat.setText("") + self.LERepCata.setText("") + self.LEVersionAjout.setText("") + self.CBVersions.setCurrentIndex(self.CBVersions.count()-1) + + def SupVersion(self): + version=str(self.LEVersionSup.text()) + if version == "" : return + i =0 + while i < self.CBVersions.count() : + if self.CBVersions.itemText(i) == version : + self.CBVersions.removeItem(i) + break + i=i+1 + try : + del self.dVersion[version] + del self.dRepMat[version] + del self.dRepCat[version] + except : + self.LEVersionSup.setText("") + return + codeSansPoint=re.sub("\.","",version) + chaine="rep_mat_"+codeSansPoint + if hasattr(self.configuration,chaine): + delattr(self.configuration,chaine) + self.LEVersionSup.setText("") + + lItem=[] + for version in self.dVersion.keys() : + lItem.append(self.dVersion[version]) + self.LERepMat.setText("") + self.LERepCata.setText("") + self.configuration.catalogues=lItem + self.configuration.save_params() + self.CBVersions.setCurrentIndex(0) + self.VersionChoisie() + + + def BdefautChecked(self): + res = QMessageBox.warning( + None, + self.trUtf8("Restauration des parametres par defaut "), + self.trUtf8("Votre fichier editeur sera ecrase."), + self.trUtf8("&Ok"), + self.trUtf8("&Abandonner")) + self.Bdefaut.setCheckState(Qt.Unchecked) + if res == 1 : return + + appli=self.configuration.appli + fic_ini_util=self.configuration.fic_ini_utilisateur + old_fic_ini_util=fic_ini_util+"_old" + commande="mv "+fic_ini_util+" "+old_fic_ini_util + os.system(commande) + import prefs + name='prefs_'+prefs.code + prefsCode=__import__(name) + repIni=prefsCode.REPINI + nameConf='configuration_'+prefs.code + configuration=__import__(nameConf) + + configNew=configuration.CONFIG(appli,repIni) + self.configuration=configNew + appli.CONFIGURATION=configNew + self.configuration.save_params() + self.dVersion={} + self.dRepMat={} + self.dRepCat={} + self.initAll() + + def ChangePathDoc(self): + self.configuration.path_doc=str(self.LERepDoc.text()) + self.configuration.save_params() + diff --git a/InterfaceQT4/monOptions_OPENTURNS_STUDY.py b/InterfaceQT4/monOptions_OPENTURNS_STUDY.py new file mode 100644 index 00000000..95db943a --- /dev/null +++ b/InterfaceQT4/monOptions_OPENTURNS_STUDY.py @@ -0,0 +1,220 @@ +# -*- coding: utf-8 -*- + +import os, re, sys + +from PyQt4.QtGui import * +from PyQt4.QtCore import * + +from OptionsOT import Ui_desOptions + + +class desOptions(Ui_desOptions,QDialog): + def __init__(self,parent ,modal ) : + QDialog.__init__(self,parent) + self.setupUi(self) + self.setModal(modal) + +class Options(desOptions): + def __init__(self,parent = None,modal = 0,configuration=None): + desOptions.__init__(self,parent,modal) + self.configuration=configuration + self.viewMan=parent + self.dVersion={} + self.dRepCat={} + self.connecterSignaux() + self.initAll() + + def connecterSignaux(self) : + self.connect(self.CBVersions,SIGNAL("activated(int)"),self.VersionChoisie) + self.connect(self.Bdefaut,SIGNAL("clicked()"),self.BdefautChecked) + self.connect(self.LEVersionAjout,SIGNAL("returnPressed()"),self.AjoutVersion) + self.connect(self.PBajout,SIGNAL("clicked()"),self.AjoutVersion) + self.connect(self.LEVersionSup,SIGNAL("returnPressed()"),self.SupVersion) + self.connect(self.PBSup,SIGNAL("clicked()"),self.SupVersion) + self.connect(self.LERepDoc,SIGNAL("returnPressed()"),self.ChangePathDoc) + self.connect(self.LERepOT,SIGNAL("returnPressed()"),self.ChangePathOT) + self.connect(self.LERepCata,SIGNAL("returnPressed()"),self.BokClicked) + self.connect(self.LESaveDir,SIGNAL("returnPressed()"),self.ChangeSaveDir) + self.connect(self.Bok,SIGNAL("clicked()"),self.BokClicked) + self.connect(self.PBQuit,SIGNAL("clicked()"),self.close) + + + def initAll(self): + self.CBVersions.clear() + for item in self.configuration.catalogues : + try : + (code,version,cata,format,defaut)=item + except : + (code,version,cata,format)=item + self.dVersion[version]=(item) + self.dRepCat[version]=str(cata) + self.CBVersions.addItem(QString(version)) + self.LERepCata.setText(self.dRepCat[version]) + + if hasattr(self.configuration,"path_doc"): + self.LERepDoc.setText(self.configuration.path_doc) + if hasattr(self.configuration,"OpenTURNS_path"): + self.LERepOT.setText(self.configuration.OpenTURNS_path) + if hasattr(self.configuration,"savedir"): + self.LESaveDir.setText(self.configuration.savedir) + + + + def VersionChoisie(self): + version=str(self.CBVersions.currentText()) + if self.dRepCat.has_key(version): + self.LERepCata.setText(self.dRepCat[version]) + + def BokClicked(self): + version=str(self.CBVersions.currentText()) + if self.LERepCata.text() == "" : + QMessageBox.critical( self, "Champ non rempli","Le champ Catalogue doit etre rempli" ) + return + if not os.path.isfile(self.LERepCata.text()) : + res = QMessageBox.warning( None, + self.trUtf8("Fichier Catalogue "), + self.trUtf8("Le Fichier n existe pas. Voulez-vous supprimer cette version ?"), + self.trUtf8("&Oui"), + self.trUtf8("&Non")) + if res == 0 : + self.LEVersionSup.setText(version) + self.SupVersion() + return + + self.dRepCat[version]=str(self.LERepCata.text()) + if version in self.dVersion.keys(): + item=list(self.dVersion[version]) + item[2]=self.dRepCat[version] + self.dVersion[version]=tuple(item) + else : + import prefs + code=prefs.code + self.dVersion[version]=(code,version,self.dRepCat[version],code.lower()) + + lItem=[] + for version in self.dVersion.keys() : + lItem.append(self.dVersion[version]) + self.configuration.catalogues=lItem + self.configuration.save_params() + + def AjoutVersion(self): + version=self.LEVersionAjout.text() + if str(version) == "" : return + self.CBVersions.addItem(version) + self.LERepCata.setText("") + self.LEVersionAjout.setText("") + self.CBVersions.setCurrentIndex(self.CBVersions.count()-1) + + def SupVersion(self): + version=str(self.LEVersionSup.text()) + if version == "" : return + i =0 + while i < self.CBVersions.count() : + if self.CBVersions.itemText(i) == version : + self.CBVersions.removeItem(i) + break + i=i+1 + try : + del self.dVersion[version] + del self.dRepCat[version] + except : + self.LEVersionSup.setText("") + try : + self.CBVersions.setCurrentIndex(self.CBVersions.count()-1) + self.VersionChoisie() + except : + pass + return + codeSansPoint=re.sub("\.","",version) + chaine="rep_mat_"+codeSansPoint + if hasattr(self.configuration,chaine): + delattr(self.configuration,chaine) + self.LEVersionSup.setText("") + + lItem=[] + for version in self.dVersion.keys() : + lItem.append(self.dVersion[version]) + self.LERepCata.setText("") + self.configuration.catalogues=lItem + self.configuration.save_params() + self.CBVersions.setCurrentIndex(0) + self.VersionChoisie() + + + def BdefautChecked(self): + res = QMessageBox.warning( None, + self.trUtf8("Restauration des parametres par defaut "), + self.trUtf8("Votre fichier editeur sera ecrase."), + self.trUtf8("&Ok"), + self.trUtf8("&Abandonner")) + self.Bdefaut.setCheckState(Qt.Unchecked) + if res == 1 : return + + appli=self.configuration.appli + fic_ini_util=self.configuration.fic_ini_utilisateur + old_fic_ini_util=fic_ini_util+"_old" + commande="mv "+fic_ini_util+" "+old_fic_ini_util + os.system(commande) + import prefs + name='prefs_'+prefs.code + prefsCode=__import__(name) + repIni=prefsCode.REPINI + nameConf='configuration_'+prefs.code + configuration=__import__(nameConf) + + configNew=configuration.CONFIG(appli,repIni) + self.configuration=configNew + appli.CONFIGURATION=configNew + self.configuration.save_params() + self.dVersion={} + self.dRepCat={} + self.initAll() + + def ChangePathDoc(self): + if self.LERepDoc.text()=="" : return + if not os.path.isdir(self.LERepDoc.text()) : + res = QMessageBox.warning( None, + self.trUtf8("Repertoire de Documentation "), + self.trUtf8("Le Repertoire n existe pas."), + self.trUtf8("&Ok"), + self.trUtf8("&Abandonner")) + if res == 1 : + if hasattr(self.configuration,"path_doc"): + self.LERepDoc.setText(self.configuration.path_doc) + return + + self.configuration.path_doc=str(self.LERepDoc.text()) + self.configuration.save_params() + + def ChangePathOT(self): + if not os.path.isdir(self.LERepOT.text()) : + res = QMessageBox.warning( None, + self.trUtf8("Repertoire Open TURNS "), + self.trUtf8("Le Repertoire n existe pas."), + self.trUtf8("&Ok"), + self.trUtf8("&Abandonner")) + if res == 1 : + if hasattr(self.configuration,"OpenTURNS_path"): + self.LERepOT.setText(self.configuration.OpenTURNS_path) + return + + if hasattr(self.configuration,"OpenTURNS_path"): + sys.path.remove(self.configuration.OpenTURNS_path) + self.configuration.OpenTURNS_path=str(self.LERepOT.text()) + self.configuration.save_params() + if self.configuration.OpenTURNS_path == "" : return + sys.path[:0]=[self.configuration.OpenTURNS_path] + + def ChangeSaveDir(self): + if not os.path.isdir(self.LESaveDir.text()) : + res = QMessageBox.warning( None, + self.trUtf8("Repertoire Open TURNS "), + self.trUtf8("Le Repertoire n existe pas."), + self.trUtf8("&Ok"), + self.trUtf8("&Abandonner")) + if res == 1 : + if hasattr(self.configuration,"savedir"): + self.LESaveDir.setText(self.configuration.savedir) + self.configuration.savedir=str(self.LESaveDir.text()) + self.configuration.save_params() + diff --git a/InterfaceQT4/monOptions_OPENTURNS_WRAPPER.py b/InterfaceQT4/monOptions_OPENTURNS_WRAPPER.py new file mode 100644 index 00000000..95db943a --- /dev/null +++ b/InterfaceQT4/monOptions_OPENTURNS_WRAPPER.py @@ -0,0 +1,220 @@ +# -*- coding: utf-8 -*- + +import os, re, sys + +from PyQt4.QtGui import * +from PyQt4.QtCore import * + +from OptionsOT import Ui_desOptions + + +class desOptions(Ui_desOptions,QDialog): + def __init__(self,parent ,modal ) : + QDialog.__init__(self,parent) + self.setupUi(self) + self.setModal(modal) + +class Options(desOptions): + def __init__(self,parent = None,modal = 0,configuration=None): + desOptions.__init__(self,parent,modal) + self.configuration=configuration + self.viewMan=parent + self.dVersion={} + self.dRepCat={} + self.connecterSignaux() + self.initAll() + + def connecterSignaux(self) : + self.connect(self.CBVersions,SIGNAL("activated(int)"),self.VersionChoisie) + self.connect(self.Bdefaut,SIGNAL("clicked()"),self.BdefautChecked) + self.connect(self.LEVersionAjout,SIGNAL("returnPressed()"),self.AjoutVersion) + self.connect(self.PBajout,SIGNAL("clicked()"),self.AjoutVersion) + self.connect(self.LEVersionSup,SIGNAL("returnPressed()"),self.SupVersion) + self.connect(self.PBSup,SIGNAL("clicked()"),self.SupVersion) + self.connect(self.LERepDoc,SIGNAL("returnPressed()"),self.ChangePathDoc) + self.connect(self.LERepOT,SIGNAL("returnPressed()"),self.ChangePathOT) + self.connect(self.LERepCata,SIGNAL("returnPressed()"),self.BokClicked) + self.connect(self.LESaveDir,SIGNAL("returnPressed()"),self.ChangeSaveDir) + self.connect(self.Bok,SIGNAL("clicked()"),self.BokClicked) + self.connect(self.PBQuit,SIGNAL("clicked()"),self.close) + + + def initAll(self): + self.CBVersions.clear() + for item in self.configuration.catalogues : + try : + (code,version,cata,format,defaut)=item + except : + (code,version,cata,format)=item + self.dVersion[version]=(item) + self.dRepCat[version]=str(cata) + self.CBVersions.addItem(QString(version)) + self.LERepCata.setText(self.dRepCat[version]) + + if hasattr(self.configuration,"path_doc"): + self.LERepDoc.setText(self.configuration.path_doc) + if hasattr(self.configuration,"OpenTURNS_path"): + self.LERepOT.setText(self.configuration.OpenTURNS_path) + if hasattr(self.configuration,"savedir"): + self.LESaveDir.setText(self.configuration.savedir) + + + + def VersionChoisie(self): + version=str(self.CBVersions.currentText()) + if self.dRepCat.has_key(version): + self.LERepCata.setText(self.dRepCat[version]) + + def BokClicked(self): + version=str(self.CBVersions.currentText()) + if self.LERepCata.text() == "" : + QMessageBox.critical( self, "Champ non rempli","Le champ Catalogue doit etre rempli" ) + return + if not os.path.isfile(self.LERepCata.text()) : + res = QMessageBox.warning( None, + self.trUtf8("Fichier Catalogue "), + self.trUtf8("Le Fichier n existe pas. Voulez-vous supprimer cette version ?"), + self.trUtf8("&Oui"), + self.trUtf8("&Non")) + if res == 0 : + self.LEVersionSup.setText(version) + self.SupVersion() + return + + self.dRepCat[version]=str(self.LERepCata.text()) + if version in self.dVersion.keys(): + item=list(self.dVersion[version]) + item[2]=self.dRepCat[version] + self.dVersion[version]=tuple(item) + else : + import prefs + code=prefs.code + self.dVersion[version]=(code,version,self.dRepCat[version],code.lower()) + + lItem=[] + for version in self.dVersion.keys() : + lItem.append(self.dVersion[version]) + self.configuration.catalogues=lItem + self.configuration.save_params() + + def AjoutVersion(self): + version=self.LEVersionAjout.text() + if str(version) == "" : return + self.CBVersions.addItem(version) + self.LERepCata.setText("") + self.LEVersionAjout.setText("") + self.CBVersions.setCurrentIndex(self.CBVersions.count()-1) + + def SupVersion(self): + version=str(self.LEVersionSup.text()) + if version == "" : return + i =0 + while i < self.CBVersions.count() : + if self.CBVersions.itemText(i) == version : + self.CBVersions.removeItem(i) + break + i=i+1 + try : + del self.dVersion[version] + del self.dRepCat[version] + except : + self.LEVersionSup.setText("") + try : + self.CBVersions.setCurrentIndex(self.CBVersions.count()-1) + self.VersionChoisie() + except : + pass + return + codeSansPoint=re.sub("\.","",version) + chaine="rep_mat_"+codeSansPoint + if hasattr(self.configuration,chaine): + delattr(self.configuration,chaine) + self.LEVersionSup.setText("") + + lItem=[] + for version in self.dVersion.keys() : + lItem.append(self.dVersion[version]) + self.LERepCata.setText("") + self.configuration.catalogues=lItem + self.configuration.save_params() + self.CBVersions.setCurrentIndex(0) + self.VersionChoisie() + + + def BdefautChecked(self): + res = QMessageBox.warning( None, + self.trUtf8("Restauration des parametres par defaut "), + self.trUtf8("Votre fichier editeur sera ecrase."), + self.trUtf8("&Ok"), + self.trUtf8("&Abandonner")) + self.Bdefaut.setCheckState(Qt.Unchecked) + if res == 1 : return + + appli=self.configuration.appli + fic_ini_util=self.configuration.fic_ini_utilisateur + old_fic_ini_util=fic_ini_util+"_old" + commande="mv "+fic_ini_util+" "+old_fic_ini_util + os.system(commande) + import prefs + name='prefs_'+prefs.code + prefsCode=__import__(name) + repIni=prefsCode.REPINI + nameConf='configuration_'+prefs.code + configuration=__import__(nameConf) + + configNew=configuration.CONFIG(appli,repIni) + self.configuration=configNew + appli.CONFIGURATION=configNew + self.configuration.save_params() + self.dVersion={} + self.dRepCat={} + self.initAll() + + def ChangePathDoc(self): + if self.LERepDoc.text()=="" : return + if not os.path.isdir(self.LERepDoc.text()) : + res = QMessageBox.warning( None, + self.trUtf8("Repertoire de Documentation "), + self.trUtf8("Le Repertoire n existe pas."), + self.trUtf8("&Ok"), + self.trUtf8("&Abandonner")) + if res == 1 : + if hasattr(self.configuration,"path_doc"): + self.LERepDoc.setText(self.configuration.path_doc) + return + + self.configuration.path_doc=str(self.LERepDoc.text()) + self.configuration.save_params() + + def ChangePathOT(self): + if not os.path.isdir(self.LERepOT.text()) : + res = QMessageBox.warning( None, + self.trUtf8("Repertoire Open TURNS "), + self.trUtf8("Le Repertoire n existe pas."), + self.trUtf8("&Ok"), + self.trUtf8("&Abandonner")) + if res == 1 : + if hasattr(self.configuration,"OpenTURNS_path"): + self.LERepOT.setText(self.configuration.OpenTURNS_path) + return + + if hasattr(self.configuration,"OpenTURNS_path"): + sys.path.remove(self.configuration.OpenTURNS_path) + self.configuration.OpenTURNS_path=str(self.LERepOT.text()) + self.configuration.save_params() + if self.configuration.OpenTURNS_path == "" : return + sys.path[:0]=[self.configuration.OpenTURNS_path] + + def ChangeSaveDir(self): + if not os.path.isdir(self.LESaveDir.text()) : + res = QMessageBox.warning( None, + self.trUtf8("Repertoire Open TURNS "), + self.trUtf8("Le Repertoire n existe pas."), + self.trUtf8("&Ok"), + self.trUtf8("&Abandonner")) + if res == 1 : + if hasattr(self.configuration,"savedir"): + self.LESaveDir.setText(self.configuration.savedir) + self.configuration.savedir=str(self.LESaveDir.text()) + self.configuration.save_params() + diff --git a/InterfaceQT4/monPlusieursBasePanel.py b/InterfaceQT4/monPlusieursBasePanel.py index 4ca3d3e0..5a1a81e0 100644 --- a/InterfaceQT4/monPlusieursBasePanel.py +++ b/InterfaceQT4/monPlusieursBasePanel.py @@ -156,7 +156,6 @@ class MonPlusieursBasePanel(DPlusBase,QTPanel,SaisieValeur): def AjoutNValeur(self,liste) : for val in liste : - print val self.Ajout1Valeur(val) def BImportPressed(self): @@ -201,8 +200,6 @@ class MonPlusieursBasePanel(DPlusBase,QTPanel,SaisieValeur): if "GROUP_MA" in e: kwType = "GROUP_MA" #print "BkwType",kwType - print "editor", self.editor - print "appliEficas", self.editor.appliEficas selection, commentaire = self.editor.appliEficas.selectGroupFromSalome(kwType,editor=self.editor) if commentaire !="" : self.Commentaire.setText(QString(commentaire)) diff --git a/InterfaceQT4/monRacinePanel.py b/InterfaceQT4/monRacinePanel.py index 1f5b707b..23480ab7 100644 --- a/InterfaceQT4/monRacinePanel.py +++ b/InterfaceQT4/monRacinePanel.py @@ -102,5 +102,4 @@ class MonRacinePanel(DRac,QTPanelTBW2): if name==QString(" "): return if name.find("GROUPE :")==0 : return self.editor.init_modif() - print self.node.__class__ new_node = self.node.append_child(name,'first') diff --git a/InterfaceQT4/politiquesValidation.py b/InterfaceQT4/politiquesValidation.py index 7309c339..cc0dbf2b 100644 --- a/InterfaceQT4/politiquesValidation.py +++ b/InterfaceQT4/politiquesValidation.py @@ -104,8 +104,6 @@ class Validation : pass def AjoutDsDictReelEtape(self): - print self.parent.appliEficas.dict_reels - print self.node.item.object try: if self.parent.appliEficas.dict_reels.has_key(self.node.item.object) : self.parent.appliEficas.dict_reels[self.node.item.sdnom]=self.parent.appliEficas.dict_reels[self.node.item.object] diff --git a/InterfaceQT4/qtCommun.py b/InterfaceQT4/qtCommun.py index 6c5a557c..725877fc 100644 --- a/InterfaceQT4/qtCommun.py +++ b/InterfaceQT4/qtCommun.py @@ -201,8 +201,6 @@ class QTPanelTBW2(QTPanel): if name.find("GROUPE :")==0 : return self.editor.init_modif() - print self.node - print name new_node = self.node.append_brother(name,'after') diff --git a/InterfaceQT4/qtEficas.py b/InterfaceQT4/qtEficas.py index f734b003..f82afeae 100644 --- a/InterfaceQT4/qtEficas.py +++ b/InterfaceQT4/qtEficas.py @@ -19,7 +19,6 @@ class Appli(Ui_Eficas,QMainWindow): """ Constructor """ - print self self.VERSION_EFICAS="Eficas QT4 V1.17" self.ihm="QT" self.code=code @@ -234,8 +233,15 @@ class Appli(Ui_Eficas,QMainWindow): monAssistant.showPage(docsPath+QDir.separator()+QString("fichiers_"+QString(self.code)+QString("/index.html"))) def optionEditeur(self) : - from monOptionsEditeur import Options - monOption=Options(parent=self,modal = 0 ,configuration=self.CONFIGURATION) + name='monOptions_'+self.code + try : + #if 1 : + optionCode=__import__(name) + except : + #else : + QMessageBox.critical( self, "Parametrage", "Pas de possibilite de personnalisation de la configuration ") + return + monOption=optionCode.Options(parent=self,modal = 0 ,configuration=self.CONFIGURATION) monOption.show() def optionPdf(self) : diff --git a/InterfaceQT4/readercata.py b/InterfaceQT4/readercata.py index 4b257a70..b76c1e4f 100644 --- a/InterfaceQT4/readercata.py +++ b/InterfaceQT4/readercata.py @@ -50,7 +50,6 @@ class READERCATA: def __init__(self,QWParent, appliEficas): self.QWParent=QWParent self.appliEficas=self.QWParent.appliEficas - print self.appliEficas self.VERSION_EFICAS=self.appliEficas.VERSION_EFICAS self.code=self.QWParent.code self.appliEficas.format_fichier='python' diff --git a/UiQT4/OptionsOT.ui b/UiQT4/OptionsOT.ui new file mode 100644 index 00000000..0ed9364e --- /dev/null +++ b/UiQT4/OptionsOT.ui @@ -0,0 +1,406 @@ + + desOptions + + + + 0 + 0 + 657 + 794 + + + + Option TURNS + + + + + + + 635 + 252 + + + + + 16777215 + 252 + + + + Configurer une Version + + + + + 10 + 30 + 121 + 40 + + + + + 0 + 40 + + + + + 121 + 40 + + + + + + + 500 + 30 + 121 + 40 + + + + + 90 + 40 + + + + + 121 + 40 + + + + Valider + + + false + + + + + + 10 + 200 + 106 + 43 + + + + + 101 + 41 + + + + Ajouter +Version : + + + + + + 122 + 200 + 154 + 43 + + + + + 101 + 41 + + + + + + + 360 + 200 + 106 + 43 + + + + + 101 + 41 + + + + Supprimer +Version : + + + + + + 470 + 200 + 155 + 43 + + + + + 0 + 41 + + + + + + + 7 + 100 + 621 + 65 + + + + + + + Fichier catalogue (chemin complet) : + + + false + + + + + + + + 501 + 41 + + + + + + + + + + + + + + + + 548 + 90 + + + + Configurer la bibliothèque Open TURNS + + + + + 11 + 28 + 617 + 17 + + + + Répertoire d'installation d'Open TURNS : + + + false + + + + + + 11 + 50 + 617 + 41 + + + + + 520 + 41 + + + + + + + + + + + + + 548 + 90 + + + + Doc + + + + + 11 + 28 + 617 + 41 + + + + + 613 + 41 + + + + + 16777215 + 41 + + + + Répertoire d'accès à la documentation : + + + false + + + + + + 11 + 74 + 617 + 41 + + + + + 520 + 41 + + + + + + + + + + + + + 548 + 90 + + + + Espace de travail + + + + + 11 + 28 + 617 + 41 + + + + + 613 + 41 + + + + + 16777215 + 41 + + + + Répertoire de sauvegarde par défaut : + + + false + + + + + + 11 + 74 + 617 + 41 + + + + + 520 + 41 + + + + + + + + + + + + Qt::Horizontal + + + + + 340 + 41 + + + + + 16777215 + 41 + + + + + 12 + + + + Réinitialiser avec les valeurs par defaut + + + + + + 151 + 31 + + + + Quitter + + + + + + + + qPixmapFromMimeSource + + + diff --git a/UiQT4/desMatrice.ui b/UiQT4/desMatrice.ui index e7b433e7..99a3f223 100644 --- a/UiQT4/desMatrice.ui +++ b/UiQT4/desMatrice.ui @@ -12,55 +12,56 @@ Dialog - + - + Qt::Horizontal - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - + + + + + + Qt::Horizontal + + + + 140 + 24 + + + + + + + + Valider + + + + + + + Qt::Horizontal + + + + 138 + 20 + + + + + + - - - buttonBox - accepted() - desMatrice - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - desMatrice - reject() - - - 316 - 260 - - - 286 - 274 - - - - + diff --git a/UiQT4/makefile b/UiQT4/makefile index 81bbacf0..4426d9b9 100644 --- a/UiQT4/makefile +++ b/UiQT4/makefile @@ -8,7 +8,7 @@ PY_FILES = desChoixCata.py desCommande.py desCommentaire.py desError.py desFormu desPlusieursBase.py desPlusieursInto.py desPoursuite.py desRacine.py desSelectVal.py \ desUniqueASSD.py desUniqueBase.py desUniqueComp.py desUniqueInto.py desUniqueSDCOInto.py \ desUniqueSDCO.py desVisu.py aideQT.py OptionsEditeur.py OptionsPdf.py myMain.py \ - desViewTexte.py desPixmap.py desMatrice.py + desViewTexte.py desPixmap.py desMatrice.py OptionsOT.py %.py:%.ui ${PYUIC} -x -o $@ $<