1 # -*- coding: utf-8 -*-
2 # CONFIGURATION MANAGEMENT OF EDF VERSION
3 # ======================================================================
4 # COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
5 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
6 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
7 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
8 # (AT YOUR OPTION) ANY LATER VERSION.
10 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
11 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
12 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
13 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
15 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
16 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
17 # 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
20 # ======================================================================
22 import string,types,os
29 from desUniqueBase import DUnBase
30 from qtCommun import QTPanel
31 from qtSaisie import SaisieValeur
32 from politiquesValidation import PolitiqueUnique
36 class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur):
38 Classe définissant le panel associé aux mots-clés qui demandent
39 à l'utilisateur de choisir une seule valeur parmi une liste de valeurs
42 def __init__(self,node, parent = None,name = None,fl = 0):
44 QTPanel.__init__(self,node,parent)
45 DUnBase.__init__(self,parent,name,fl)
46 self.politique=PolitiqueUnique(node,parent)
47 self.InitLineEditVal()
48 self.InitCommentaire()
54 def detruitBouton(self):
55 mc = self.node.item.get_definition()
57 #if not('grma' in repr(type)):
58 #if not('grma' in repr(type)) or not(self.editor.salome) :
59 if not(('grma' in repr(type)) or ('grno' in repr(type))) or not(self.editor.salome) :
63 def InitLineEditVal(self):
64 valeur=self.node.item.get_valeur()
65 valeurTexte=self.politique.GetValeurTexte(valeur)
66 if valeurTexte != None:
68 maString=QString("").setNum(valeurTexte)
70 maString=str(valeurTexte)
71 self.lineEditVal.setText(maString)
74 def InitCommentaire(self):
75 mc = self.node.item.get_definition()
76 d_aides = { 'TXM' : "Une chaîne de caractères est attendue",
77 'R' : "Un réel est attendu",
78 'I' : "Un entier est attendu"}
80 commentaire=d_aides.get(type,"Type de base inconnu")
81 aideval=self.node.item.aide()
82 commentaire=commentaire +"\n"+ aideval
83 self.Commentaire.setText(QString(commentaire))
85 def BOk2Pressed(self):
86 SaisieValeur.BOk2Pressed(self)
88 def BSupPressed(self):
89 QTPanel.BSupPressed(self)
91 def LEValeurPressed(self):
92 SaisieValeur.LEValeurPressed(self)
94 def BParametresPressed(self):
95 QTPanel.BParametresPressed(self)
97 def Ajout1Valeur(self,valeur):
98 SaisieValeur.LEValeurPressed(self,valeur)
100 def BSalomePressed(self):
101 genea=self.node.item.get_genealogie()
104 if "GROUP_NO" in e: kwType = "GROUP_NO"
105 if "GROUP_MA" in e: kwType = "GROUP_MA"
107 selection, commentaire = self.editor.parent.appliEficas.selectGroupFromSalome(kwType,editor=self.editor)
108 if commentaire !="" :
109 self.Commentaire.setText(QString(commentaire))
111 if selection == [] : return
112 for geomElt in selection:
114 monTexte= monTexte[0:-1]
115 self.LEValeur.setText(QString(monTexte))
117 def BView2DPressed(self):
118 valeur=self.LEValeur.text()
119 if valeur == QString("") : return
122 ok, msgError = self.editor.parent.appliEficas.displayShape(valeur)
124 self.editor.parent.appli.affiche_infos(msgError)