-# Copyright (C) 2007-2013 EDF R&D
+# Copyright (C) 2007-2017 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# Modules Python
# Modules Eficas
+from __future__ import absolute_import
+try :
+ from builtins import str
+except : pass
+
from desWidgetParam import Ui_WidgetParam
-from gereIcones import FacultatifOuOptionnel
-from determine import monEnvQT5
-if monEnvQT5:
- from PyQt5.QtWidgets import QWidget
-else :
- from PyQt4.QtGui import *
- from PyQt4.QtCore import *
+from InterfaceQT4.gereIcones import FacultatifOuOptionnel
+import six
+from PyQt5.QtWidgets import QWidget, QMessageBox
+from PyQt5.QtGui import QIcon
from Extensions.i18n import tr
from Extensions.eficas_exception import EficasException
import Accas
import os, re
-import string
import types
pattern_name = re.compile(r'^[^\d\W]\w*\Z')
self.repIcon=self.appliEficas.repIcon
self.setIconePoubelle()
+ if not(self.node.item.object.isValid()) :
+ icon=QIcon(self.repIcon+"/ast-red-ball.png")
+ self.RBValide.setIcon(icon)
+
self.remplit()
+ #if self.editor.code in ['MAP','CARMELCND','CF'] : self.bCatalogue.close()
if self.editor.code in ['MAP','CARMELCND'] : self.bCatalogue.close()
- elif monEnvQT5 : self.bCatalogue.clicked.connect(self.afficheCatalogue)
- else : self.connect(self.bCatalogue,SIGNAL("clicked()"), self.afficheCatalogue)
-
- if monEnvQT5 :
- self.lineEditVal.returnPressed.connect(self.LEValeurPressed)
- self.lineEditNom.returnPressed.connect(self.LENomPressed)
- self.bAvant.clicked.connect(self.afficheAvant)
- self.bApres.clicked.connect(self.afficheApres)
- self.bVerifie.clicked.connect(self.verifiePressed)
- else :
- self.connect(self.lineEditVal,SIGNAL("returnPressed()"),self.LEValeurPressed)
- self.connect(self.lineEditNom,SIGNAL("returnPressed()"),self.LENomPressed)
- self.connect(self.bAvant,SIGNAL("clicked()"), self.afficheAvant)
- self.connect(self.bApres,SIGNAL("clicked()"), self.afficheApres)
- self.connect(self.bVerifie,SIGNAL("clicked()"), self.verifiePressed)
- self.editor.affiche_infos("")
-
-
- if self.editor.widgetOptionnel!= None :
- self.editor.widgetOptionnel.close()
- self.editor.widgetOptionnel=None
+ else : self.bCatalogue.clicked.connect(self.afficheCatalogue)
+ self.lineEditVal.returnPressed.connect(self.LEvaleurPressed)
+ self.lineEditNom.returnPressed.connect(self.LENomPressed)
+ self.bAvant.clicked.connect(self.afficheAvant)
+ self.bApres.clicked.connect(self.afficheApres)
+ self.bVerifie.clicked.connect(self.verifiePressed)
+ self.editor.fermeOptionnel()
def afficheCatalogue(self):
else : self.node.tree.racine.select()
def remplit(self):
- nom=self.node.item.get_nom()
+ nom=self.node.item.getNom()
self.lineEditNom.setText(nom)
- valeur=self.node.item.get_valeur()
+ valeur=self.node.item.getValeur()
if valeur == None :
self.lineEditVal.clear()
- elif type(valeur) == types.ListType :
+ elif type(valeur) == list :
texte="["
for l in valeur :
texte=texte+str(l) +","
def donnePremier(self):
self.lineEditVal.setFocus(7)
- def LEValeurPressed(self):
+ def LEvaleurPressed(self):
if self.verifiePressed() == False :
QMessageBox.warning( self,tr( "Modification Impossible"),tr( "le parametre n'est pas valide"))
nom=str(self.lineEditNom.text())
val=str(self.lineEditVal.text())
- self.node.item.set_nom(nom)
- self.node.item.set_valeur(val)
- self.node.update_texte()
- self.node.update_node_valid()
+ self.node.item.setNom(nom)
+ self.node.item.setValeur(val)
+ self.node.updateTexte()
def LENomPressed(self):
- self.LEValeurPressed()
+ self.LEvaleurPressed()
def verifiePressed(self):
nomString=str(self.lineEditNom.text())
valString=str(self.lineEditVal.text())
contexte={}
- exec "from math import *" in contexte
- jdc=self.node.item.get_jdc()
+ exec("from math import *", contexte)
+ jdc=self.node.item.getJdc()
for p in jdc.params :
try:
tp=p.nom+'='+str(repr(p.valeur))
- exec tp in contexte
+ exec(tp, contexte)
except exc :
pass
monTexte=nomString+"="+valString
try :
- exec monTexte in contexte
- except (ValueError,TypeError, NameError,RuntimeError,ZeroDivisionError), exc:
- self.LECommentaire.setText(tr("Valeur incorrecte: ")+unicode (exc))
+ exec(monTexte, contexte)
+ except (ValueError,TypeError, NameError,RuntimeError,ZeroDivisionError) as exc:
+ self.LECommentaire.setText(tr("Valeur incorrecte: ")+six.text_type (exc))
return False
except :
self.LECommentaire.setText(tr("Valeur incorrecte "))