From: Pascale Noyret Date: Thu, 22 Feb 2007 16:20:29 +0000 (+0000) Subject: PN X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=de4e95a503bc5a61578903390901aa6cc875322f;p=tools%2Feficas.git PN --- diff --git a/Interface/desUniqueInto.py b/Interface/desUniqueInto.py new file mode 100644 index 00000000..41fc10c0 --- /dev/null +++ b/Interface/desUniqueInto.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'desUniqueInto.ui' +# +# Created: jeu fév 22 16:32:04 2007 +# by: The PyQt User Interface Compiler (pyuic) 3.13 +# +# WARNING! All changes made in this file will be lost! + + +from qt import * + + +class DUnIn(QWidget): + def __init__(self,parent = None,name = None,fl = 0): + QWidget.__init__(self,parent,name,fl) + + if not name: + self.setName("DUnIn") + + self.setMinimumSize(QSize(350,0)) + + + self.tabuniqueinto = QTabWidget(self,"tabuniqueinto") + self.tabuniqueinto.setGeometry(QRect(20,20,450,440)) + + self.Widget8 = QWidget(self.tabuniqueinto,"Widget8") + + self.textLabel2 = QLabel(self.Widget8,"textLabel2") + self.textLabel2.setGeometry(QRect(170,30,100,21)) + + self.textLabel1 = QLabel(self.Widget8,"textLabel1") + self.textLabel1.setGeometry(QRect(170,-10,90,31)) + + self.Commentaire = QLabel(self.Widget8,"Commentaire") + self.Commentaire.setGeometry(QRect(38,316,381,41)) + + self.bHelp = QPushButton(self.Widget8,"bHelp") + self.bHelp.setGeometry(QRect(0,370,142,30)) + self.bHelp.setAutoDefault(1) + + self.listBoxVal = QListBox(self.Widget8,"listBoxVal") + self.listBoxVal.setGeometry(QRect(80,60,290,240)) + + self.bOk = QPushButton(self.Widget8,"bOk") + self.bOk.setGeometry(QRect(150,370,142,30)) + self.bOk.setAutoDefault(1) + self.bOk.setDefault(1) + + self.bSup = QPushButton(self.Widget8,"bSup") + self.bSup.setGeometry(QRect(300,370,142,30)) + self.bSup.setAutoDefault(1) + self.tabuniqueinto.insertTab(self.Widget8,QString("")) + + self.languageChange() + + self.resize(QSize(482,480).expandedTo(self.minimumSizeHint())) + self.clearWState(Qt.WState_Polished) + + self.connect(self.bHelp,SIGNAL("clicked()"),self.ViewDoc) + self.connect(self.bOk,SIGNAL("clicked()"),self.BOkPressed) + self.connect(self.bSup,SIGNAL("clicked()"),self.BSupPressed) + + + def languageChange(self): + self.setCaption(self.__tr("DUnIn")) + self.textLabel2.setText(self.__tr("

Valeurs possibles

")) + self.textLabel1.setText(self.__tr("

Choisir une valeur

")) + self.Commentaire.setText(QString.null) + self.bHelp.setText(self.__tr("&Documentation")) + self.bHelp.setAccel(self.__tr("Alt+D")) + QToolTip.add(self.bHelp,self.__tr("affichage documentation aster")) + self.bOk.setText(self.__tr("&Valider")) + self.bOk.setAccel(self.__tr("Shift+A, Alt+A, Alt+A, Alt+A")) + QToolTip.add(self.bOk,self.__tr("validation de la saisie")) + self.bSup.setText(self.__tr("&Supprimer")) + self.bSup.setAccel(self.__tr("Alt+S")) + QToolTip.add(self.bSup,self.__tr("suppression du mot clef")) + self.tabuniqueinto.changeTab(self.Widget8,self.__tr("Saisir Valeur")) + + + def BSupPressed(self): + print "DUnIn.BSupPressed(): Not implemented yet" + + def ViewDoc(self): + print "DUnIn.ViewDoc(): Not implemented yet" + + def BOkPressed(self): + print "DUnIn.BOkPressed(): Not implemented yet" + + def __tr(self,s,c = None): + return qApp.translate("DUnIn",s,c) diff --git a/Interface/editor.py b/Interface/editor.py index 015eb61e..7c5aa4e2 100644 --- a/Interface/editor.py +++ b/Interface/editor.py @@ -17,8 +17,7 @@ import prefs import configuration import panels -##import afficheErreur -##import visualisation +import afficheErreur VERSION_EFICAS = "EFICAS v1.11" VERSION_CODE = session.d_env.cata @@ -123,13 +122,14 @@ class JDCEditor(QSplitter): self.jdc.analyse() txt_exception = self.jdc.cr.get_mess_exception() if txt_exception: - # des exceptions ont été levées à la création du JDC - # --> on affiche les erreurs mais pas le JDC - print 'txt_exception ->',txt_exception - self.affiche_infos("Erreur fatale au chargement de %s" %fn) - qApp.restoreOverrideCursor() - QMessageBox.critical( self, "Erreur fatale au chargement d'un fichier", txt_exception) + # PN attention reporter ici les tests pour batch / ou non + # if self.appli.test == 0 : + qApp.restoreOverrideCursor() + monDialog=afficheErreur.afficheErreur(parent=self.parent,fl=Qt.WType_Dialog) + monDialog.texteErreur.setText(QString(txt_exception)) + monDialog.show() self.jdc = None + self.closeIt() else: comploader.charger_composants() jdc_item=Objecttreeitem.make_objecttreeitem( self, "nom", self.jdc ) diff --git a/Interface/politiquesValidation.py b/Interface/politiquesValidation.py new file mode 100644 index 00000000..7f1dd5a0 --- /dev/null +++ b/Interface/politiquesValidation.py @@ -0,0 +1,44 @@ +# -*- 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 + +class PolitiqueUnique: + """ + classe servant pour les entrees ne demandant qu un mot clef + """ + def __init__(self,node) : + self.node=node + + def record_valeur(self,valeurentree): + validite = 1 + commentaire="" + valeur,validite=self.node.item.eval_valeur(valeurentree) + if not validite : + commentaire = "impossible d'évaluer : %s " %`valeurentree` + + if validite : + validite,commentaire=self.node.item.valide_val(valeur) + + if validite : + self.node.item.set_valeur(valeur) + + return validite,commentaire + diff --git a/Interface/qtcommun.py b/Interface/qtcommun.py new file mode 100644 index 00000000..f2a5c3a1 --- /dev/null +++ b/Interface/qtcommun.py @@ -0,0 +1,37 @@ +# -*- 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 +import traceback + +from qt import * + +# Import des panels + +class QTPanel: + """ + Classe définissant le panel associé aux mots-clés qui demandent + à l'utilisateur de choisir une seule valeur parmi une liste de valeurs + discrètes + """ + def __init__(self,node, parent = None): + self.editor = parent + self.node = node diff --git a/Interface/qtuniqueintopanel.py b/Interface/qtuniqueintopanel.py new file mode 100644 index 00000000..71531d59 --- /dev/null +++ b/Interface/qtuniqueintopanel.py @@ -0,0 +1,73 @@ +# -*- 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 +import prefs + +from qt import * + +from desUniqueInto import DUnIn +from qtcommun import QTPanel +from politiquesValidation import PolitiqueUnique + +# Import des panels + +class UNIQUE_INTO_Panel(DUnIn,QTPanel): + """ + Classe définissant le panel associé aux mots-clés qui demandent + à l'utilisateur de choisir une seule valeur parmi une liste de valeurs + discrètes + """ + def __init__(self,node, parent = None,name = None,fl = 0): + QTPanel.__init__(self,node,parent) + DUnIn.__init__(self,parent,name,fl) + self.remplitPannel() + self.politique=PolitiqueUnique(node) + + def remplitPannel(self): + lChoix=self.node.item.get_liste_possible([]) + for valeur in lChoix : + self.listBoxVal.insertItem( valeur ) + QObject.connect(self.listBoxVal, SIGNAL("doubleClicked(QListBoxItem*)" ), self.clicValeur ) + + def clicValeur(self): + valeurQstring=self.listBoxVal.selectedItem().text() + valeur=valeurQstring.latin1() + validite,commentaire=self.politique.record_valeur(valeur) + if commentaire != "" : + self.Commentaire.setText(QString(commentaire)) + + def BOkPressed(self): + if self.listBoxVal.selectedItem()==None : + commentaire =DUnIn.tr(self,"Pas de valeur selectionnée") + self.Commentaire.setText(QString(commentaire)) + else : + self.clicValeur() + + def get_bulle_aide(self): +# """ +# Retourne la bulle d'aide affectée au panneau courant (affichée par clic droit) +# """ + return """Double-cliquez sur la valeur désirée + pour valoriser le mot-clé simple courant""" +