+ if hasattr(self,'RBHaut'):
+ self.RBHaut.clicked.connect(self.hautPushed)
+ self.RBBas.clicked.connect(self.basPushed)
+ self.RBMoins.clicked.connect(self.moinsPushed)
+ self.RBPlus.clicked.connect(self.plusPushed)
+ self.RBVoisListe.clicked.connect(self.voisListePushed)
+ if hasattr(self,'PBAlpha'):
+ self.PBCata.clicked.connect(self.cataPushed)
+ self.PBAlpha.clicked.connect(self.alphaPushed)
+ self.PBFind.clicked.connect(self.findPushed)
+ self.LEFiltre.returnPressed.connect(self.LEFiltreReturnPressed)
+
+ def filtreListe(self):
+ l=[]
+ if self.filtre != "" :
+ for i in self.listeAAfficher :
+ if i.find(self.filtre) == 0 :l.append(i)
+ self.listeAAfficher=l
+ if self.alpha : self.listeAAfficher.sort()
+
+ def LEFiltreReturnPressed(self):
+ self.filtre= self.LEFiltre.text()
+ self.prepareListeResultatFiltre()
+
+ def findPushed(self):
+ self.filtre= self.LEFiltre.text()
+ self.prepareListeResultatFiltre()
+
+ def alphaPushed(self):
+ #print "alphaPushed" ,self.alpha
+ if self.alpha == 1 : return
+ self.alpha=1
+ self.prepareListeResultat()
+
+ def cataPushed(self):
+ if self.alpha == 0 : return
+ self.alpha=0
+ self.prepareListeResultat()
+
+ def hautPushed(self):
+ if self.NumLineEditEnCours == 1 : return
+ else : numEchange=self.NumLineEditEnCours-1
+ self.echange(self.NumLineEditEnCours,numEchange)
+ self.LineEditEnCours.setFocus(True)
+ self.scrollArea.ensureWidgetVisible(self.LineEditEnCours)
+
+
+ def basPushed(self):
+ if self.NumLineEditEnCours == self.indexDernierLabel : return
+ else : numEchange=self.NumLineEditEnCours+1
+ self.echange(self.NumLineEditEnCours,numEchange)
+ self.LineEditEnCours.setFocus(True)
+ self.scrollArea.ensureWidgetVisible(self.LineEditEnCours)
+
+ def echange(self,num1,num2):
+ # on donne le focus au a celui ou on a bouge
+ # par convention le 2
+ nomLineEdit=self.nomLine+str(num1)
+ #print nomLineEdit
+ courant=getattr(self,nomLineEdit)
+ valeurAGarder=courant.text()
+ nomLineEdit2=self.nomLine+str(num2)
+ #print nomLineEdit2
+ courant2=getattr(self,nomLineEdit2)
+ courant.setText(courant2.text())
+ courant2.setText(valeurAGarder)
+ self.changeValeur(changeDePlace=False)
+ self.NumLineEditEnCours=num2
+ self.LineEditEnCours=courant2
+ self.LineEditEnCours.setFocus(True)
+
+ def moinsPushed(self):
+ # on supprime le dernier
+ if self.NumLineEditEnCours == 0 : return
+ if self.indexDernierLabel == 0 : return
+ if self.NumLineEditEnCours==self.indexDernierLabel :
+ nomLineEdit=self.nomLine+str(self.indexDernierLabel)
+ courant=getattr(self,nomLineEdit)
+ courant.clean()
+ else :
+ for i in range (self.NumLineEditEnCours, self.indexDernierLabel):
+ aRemonter=i+1
+ nomLineEdit=self.nomLine+str(aRemonter)
+ courant=getattr(self,nomLineEdit)
+ valeurARemonter=courant.getValeur()
+ nomLineEdit=self.nomLine+str(i)
+ courant=getattr(self,nomLineEdit)
+ if valeurARemonter != None : courant.setValeur(valeurARemonter)
+ else : courant.clean()
+ nomLineEdit=self.nomLine+str(self.indexDernierLabel)
+ courant=getattr(self,nomLineEdit)
+ courant.clean()
+ self.changeValeur(changeDePlace=False,oblige=True)
+ self.setValide()
+
+ def plusPushed(self):
+ if self.indexDernierLabel == self.monSimpDef.max:
+ if len(self.listeValeursCourantes) < self.monSimpDef.max : self.chercheLigneVide()
+ else : self.editor.affiche_infos('nb max de valeurs : '+str(self.monSimpDef.max)+' atteint',Qt.red)
+ return
+ self.ajoutLineEdit()
+ self.descendLesLignes()
+
+ def chercheLigneVide(self):
+ for i in range(self.indexDernierLabel) :
+ nomLineEdit=self.nomLine+str(i+1)
+ courant=getattr(self,nomLineEdit)
+ valeur=courant.getValeur()
+ if valeur=="" : courant.setFocus(7);return
+
+
+ def descendLesLignes(self):
+ if self.NumLineEditEnCours==self.indexDernierLabel : return
+ nomLineEdit=self.nomLine+str(self.NumLineEditEnCours+1)
+ courant=getattr(self,nomLineEdit)
+ valeurADescendre=courant.getValeur()
+ courant.clean()
+ for i in range (self.NumLineEditEnCours+1, self.indexDernierLabel):
+ aDescendre=i+1
+ nomLineEdit=self.nomLine+str(aDescendre)
+ courant=getattr(self,nomLineEdit)
+ valeurAGarder=courant.getValeur()
+ courant.setValeur(valeurADescendre)
+ valeurADescendre=valeurAGarder
+ self.changeValeur(changeDePlace=False)
+ if hasattr (self, 'LineEditEnCours') :self.scrollArea.ensureWidgetVisible(self.LineEditEnCours)
+
+ def voisListePushed(self):
+ texteValeurs=""
+ for v in self.node.item.GetListeValeurs():
+ texteValeurs+=str(v)+", "
+ entete="Valeurs pour "+self.nom
+ f=ViewText(self,self.editor,entete,texteValeurs[0:-2])
+ f.show()
+
+
+ def selectInFile(self):
+ init=str( self.editor.CONFIGURATION.savedir)
+ fn = QFileDialog.getOpenFileName(self.node.appliEficas,
+ tr("Fichier de donnees"),
+ init,
+ tr('Tous les Fichiers (*)',))
+ fn=fn[0]
+ if fn == None : return
+ if fn == "" : return
+ ulfile = os.path.abspath(six.text_type(fn))
+ self.editor.CONFIGURATION.savedir=os.path.split(ulfile)[0]
+
+ from .monSelectVal import MonSelectVal
+ MonSelectVal(file=fn,parent=self).show()
+
+ def noircirResultatFiltre(self):
+ filtre=str(self.LEFiltre.text())
+ for cb in self.listeCbRouge:
+ palette = QPalette(Qt.red)
+ palette.setColor(QPalette.WindowText,Qt.black)
+ cb.setPalette(palette)
+ t=cb.text()
+ cb.setText(t)
+ self.LEFiltre.setText("")
+ self.listeCbRouge = []
+
+
+# ----------- #
+class GerePlie(object):
+# ----------- #