# -*- 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.
+# Copyright (C) 2007-2013 EDF R&D
#
-# 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.
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
#
-# 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.
+# This library 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
+# Lesser General Public License for more details.
#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# ======================================================================
# Modules Python
import string,types,os
from PyQt4 import *
from PyQt4.QtGui import *
from PyQt4.QtCore import *
+from Extensions.i18n import tr
+
# Import des panels
class SaisieValeur:
"""
- Classe contenant les méthodes communes aux panels
+ Classe contenant les méthodes communes aux panels
permettant de choisir des valeurs
"""
def __init__(self):
- pass
-
- def InitListBoxASSD(self):
- listeNomsSD = self.node.item.get_sd_avant_du_bon_type()
- for aSD in listeNomsSD:
- self.listBoxASSD.addItem( aSD)
- QObject.connect(self.listBoxASSD, SIGNAL("doubleClicked(QListBoxItem*)" ), self.ClicASSD )
- min,max = self.node.item.GetMinMax()
- l= self.node.item.GetListeValeurs()
-
- if (min == 1 and min == max and len(listeNomsSD)==1 and (l==[] or l==None)):
- if ('R' not in self.node.item.get_type()) :
- self.listBoxASSD.setCurrentRow(0)
-
-
- def BuildLBValeurs(self):
- self.LBValeurs.clear()
- listeValeurs=self.node.item.GetListeValeurs()
- for valeur in listeValeurs:
- self.LBValeurs.addItem(str(valeur))
- if listeValeurs != None and listeValeurs != [] :
- self.LBValeurs.setCurrentRow(len(listeValeurs) - 1)
-
-
- def RemplitPanel(self,listeDejaLa=[]):
- self.listBoxVal.clear()
- lChoix=self.node.item.get_liste_possible(listeDejaLa)
- for valeur in lChoix :
- self.listBoxVal.addItem( str(valeur) )
- if len(lChoix) == 1 :
- self.listBoxVal.setCurrentRow(1)
-
- def ClicASSD(self):
- if self.listBoxASSD.currentItem()== None : return
- valeurQstring=self.listBoxASSD.currentItem().text()
- commentaire = QString("Valeur selectionnée : ")
- commentaire.append(valeurQstring)
- self.Commentaire.setText(commentaire)
- valeur=str(valeurQstring)
- validite,commentaire=self.politique.RecordValeur(valeur)
- self.Commentaire.setText(QString(commentaire))
- self.editor.affiche_infos(commentaire)
-
- def ClicValeur(self):
- if self.listBoxVal.currentItem()== None : return
- valeurQstring=self.listBoxVal.currentItem().text()
- valeur=str(valeurQstring)
- validite,commentaire=self.politique.RecordValeur(valeur)
- #self.Commentaire.setText(QString(commentaire))
- self.editor.affiche_infos(commentaire)
-
- def BOkPressed(self):
- if self.listBoxVal.currentItem()==None :
- commentaire = "Pas de valeur selectionnée"
- self.Commentaire.setText(QString(commentaire))
- else :
- self.ClicValeur()
+ pass
- def BOk2Pressed(self):
- if str(self.lineEditVal.text())== "" :
- commentaire = "Pas de valeur entrée "
- self.Commentaire.setText(QString(commentaire))
- else :
- self.LEValeurPressed()
def LEValeurPressed(self,valeur=None):
if valeur == None :
nouvelleValeur=str(self.lineEditVal.text())
else :
- self.lineEditVal.setText(QString(valeur.nom))
+ if hasattr(self,"lineEditVal"):self.lineEditVal.setText(QString(valeur.nom))
nouvelleValeur=valeur
validite,commentaire=self.politique.RecordValeur(nouvelleValeur)
if commentaire != "" :
+ #PNPNPNP Il faut trouver une solution pour les 2 cas
+ # self.editor.affiche_infos(commentaire)
#self.Commentaire.setText(QString(commentaire))
- self.editor.affiche_infos(commentaire)
-
-
- def TraiteLEValeurTuple(self) :
- listeValeurs=[]
- valeurBrute=str(self.LEValeur.text())
- listeValeursSplit=valeurBrute.split(',')
- for val in listeValeursSplit :
- try :
- valeur=eval(val,{})
- except :
- valeur=val
- listeValeurs.append(valeur)
- return listeValeurs
+ if validite :
+ self.editor.affiche_infos(commentaire)
+ else :
+ self.editor.affiche_infos(commentaire,Qt.red)
+ self.setValide()
+
+
+ #def TraiteLEValeurTuple(self,valeurBrute=None) :
+ # listeValeurs=[]
+ # if valeurBrute== None :valeurBrute=str(self.LEValeur.text())
+ # listeValeursSplit=valeurBrute.split(',')
+ # for val in listeValeursSplit :
+ # try :
+ # valeur=eval(val,{})
+ # except :
+ # valeur=val
+ # listeValeurs.append(valeur)
+ # return listeValeurs
def TraiteLEValeur(self,valeurTraitee=None) :
# lit la chaine entree dans le line edit
listeValeurs.append(t)
indice=indice+3
except :
- commentaire = "Veuillez entrer le complexe sous forme aster ou sous forme python"
+ commentaire = tr("Veuillez entrer le complexe sous forme aster ou sous forme python")
self.editor.affiche_infos(commentaire)
return listeValeurs,0
- else : # ce n'est pas un tuple à la mode aster
+ else : # ce n'est pas un tuple a la mode aster
listeValeurs.append(v)
indice = indice + 1
elif type(valeur) == types.StringType:
listeValeurs=valeur.split(',')
else:
- listeValeurs.append(valeur)
+ listeValeurs.append(valeurBrute)
return listeValeurs,1
-
class SaisieSDCO :
- def __init__(self):
- pass
def LESDCOReturnPressed(self):
"""
- Lit le nom donné par l'utilisateur au concept de type CO qui doit être
+ Lit le nom donné par l'utilisateur au concept de type CO qui doit être
la valeur du MCS courant et stocke cette valeur
"""
self.editor.init_modif()
test,commentaire=self.node.item.set_valeur_co(nomConcept)
if test:
- commentaire="Valeur du mot-clé enregistree"
+ commentaire=tr("Valeur du mot-clef enregistree")
self.node.update_node_valid()
else :
cr = self.node.item.get_cr()
- commentaire = "Valeur du mot-clé non autorisée :"+cr.get_mess_fatal()
- self.node.item.set_valeur_co(anc_val)
- self.Commentaire.setText(QString(commentaire))
+ commentaire = tr("Valeur du mot-clef non autorisee :")+cr.get_mess_fatal()
+