From: pascale.noyret Date: Mon, 16 Apr 2018 12:41:45 +0000 (+0200) Subject: ajout validation mt X-Git-Tag: V8_5_0rc1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=04ab2d4bd48a2584fffe76966828c7eb705cc7c9;p=tools%2Feficas.git ajout validation mt --- diff --git a/InterfaceQT4/gereListe.py b/InterfaceQT4/gereListe.py index 72b4adea..755b00e7 100644 --- a/InterfaceQT4/gereListe.py +++ b/InterfaceQT4/gereListe.py @@ -53,9 +53,13 @@ class LECustom(QLineEdit): self.num=i self.dansUnTuple=False self.numDsLaListe=-1 + self.parentTuple=None + self.valeur=None def focusInEvent(self,event): - #print "dans focusInEvent de LECustom" + #print ("dans focusInEvent de LECustom") + self.parentQt.aEuLeFocus=True + self.aEuLeFocus=True self.parentQt.LineEditEnCours=self self.parentQt.numLineEditEnCours=self.num self.parentQt.textSelected=self.text() @@ -63,32 +67,43 @@ class LECustom(QLineEdit): QLineEdit.focusInEvent(self,event) def focusOutEvent(self,event): + #print (self.aEuLeFocus) self.setStyleSheet("border: 0px") if self.dansUnTuple : self.setStyleSheet("background:rgb(235,235,235); border: 0px;") elif self.num % 2 == 1 : self.setStyleSheet("background:rgb(210,210,210)") else : self.setStyleSheet("background:rgb(235,235,235)") + if self.aEuLeFocus: + self.aEuLeFocus=False + self.litValeur() + if self.dansUnTuple : self.parentTuple.getValeur() + QLineEdit.focusOutEvent(self,event) - - from InterfaceQT4.monWidgetPlusieursBase import MonWidgetPlusieursBase + def litValeur(self): + #print ("dans litValeur de LECustom") + self.aEuLeFocus=False + val=str(self.text()) + if str(val)=="" or val==None : + self.valeur=None + return try : - #if isinstance (self.parentQt, MonWidgetPlusieursBase) and not self.parentQt.inFocusOutEvent : - # self.parentQt.inFocusOutEvent=True - # self.parentQt.changeValeur(changeDePlace=True,oblige=False) - # self.parentQt.inFocusOutEvent=False - - #if isinstance(self,LECustomTuple) and not self.tupleCustomParent.inFocusOutEvent: - # self.tupleCustomParent.inFocusOutEvent=True - # self.tupleCustomParent.valueChange() - # self.tupleCustomParent.inFocusOutEvent=False - QLineEdit.focusOutEvent(self,event) - except : pass - + valeur=eval(val,{}) + except : + try : + d=self.parentQt.parentQt.objSimp.jdc.getContexteAvant(self.parentQt.objSimp. etape) + valeur=eval(val,d) + except : + valeur=val + self.valeur=valeur + #print ('self.valeur', self.valeur) + + def clean(self): self.setText("") def getValeur(self): - return self.text() + #return self.text() + return self.valeur def setValeur(self,valeur): self.setText(valeur) @@ -140,6 +155,8 @@ class GereListe(object): self.PBAlpha.clicked.connect(self.alphaPushed) self.PBFind.clicked.connect(self.findPushed) self.LEFiltre.returnPressed.connect(self.LEFiltreReturnPressed) + if hasattr(self, 'PBValideFeuille'): + self.PBValideFeuille.clicked.connect(self.changeValeur) def filtreListe(self): l=[] diff --git a/InterfaceQT4/monWidgetPlusieursPlie.py b/InterfaceQT4/monWidgetPlusieursPlie.py index 47231a08..389e5111 100644 --- a/InterfaceQT4/monWidgetPlusieursPlie.py +++ b/InterfaceQT4/monWidgetPlusieursPlie.py @@ -78,7 +78,7 @@ class MonWidgetPlusieursPlie (Ui_WidgetPlusieursPlie,Feuille): #print (valeurTexte[-1]) if valeurTexte[0] == '[' or valeurTexte[0] == '(' : valeurTexte = valeurTexte[1:] if valeurTexte[-1] == ']' or valeurTexte[-1] == ')' : valeurTexte = valeurTexte[:-1] - print (valeurTexte) + #print (valeurTexte) listeValeursBrutes=valeurTexte.split(',') if listeValeursBrutes == [] or listeValeursBrutes == None : self.lineEditVal.setText(str(self.listeValeursCourantes)) diff --git a/InterfaceQT4/monWidgetPlusieursTuple.py b/InterfaceQT4/monWidgetPlusieursTuple.py index 39061010..a4022dc6 100644 --- a/InterfaceQT4/monWidgetPlusieursTuple.py +++ b/InterfaceQT4/monWidgetPlusieursTuple.py @@ -62,7 +62,7 @@ class TupleCustom(object) : self.tailleTuple=tailleTuple self.parent=parent self.parentQt=parentQt - self.valeur=None + self.valeur=[] self.index=index self.inFocusOutEvent=False @@ -75,6 +75,7 @@ class TupleCustom(object) : courant.returnPressed.connect(self.valueChange) courant.numDsLaListe = i+1 courant.tupleCustomParent=self + courant.parentTuple = self def valueChange(self): @@ -135,6 +136,14 @@ class TupleCustom(object) : def getValeur(self): #---------------------- + self.valeur=[] + vide=True + for i in range(self.tailleTuple): + nomLE="lineEditVal_"+str(i+1) + courant=getattr(self,nomLE) + self.valeur.append(courant.valeur) + if courant.valeur!= None : vide = False + if vide : self.valeur=[] return self.valeur def text(self): @@ -341,11 +350,13 @@ class MonWidgetPlusieursTuple(Feuille,GereListe): aLeFocus=self.focusWidget() listeComplete=[] libre=False + #print (self.indexDernierLabel) for i in range(self.indexDernierLabel) : nom=self.nomLine+str(i+1) courant=getattr(self,nom) valeurTuple=courant.valeur - if valeurTuple == None or valeurTuple== "": + #print (courant, i, valeurTuple) + if valeurTuple == None or valeurTuple== "" or valeurTuple==[]: libre=True continue validite,comm,comm2,listeRetour= self.politique.ajoutTuple(valeurTuple,listeComplete) @@ -354,6 +365,7 @@ class MonWidgetPlusieursTuple(Feuille,GereListe): self.editor.afficheInfos(comm+" "+str(self.objSimp.definition.validators.typeDesTuples),Qt.red) return listeComplete.append(tuple(courant.valeur)) + #print ('listeComplete', listeComplete) if listeComplete == [] : listeComplete=None self.node.item.setValeur(listeComplete)