from Extensions.i18n import tr
from monViewTexte import ViewText
+
# ---------------------- #
class LECustom(QLineEdit):
# ---------------------- #
"""
Constructor
"""
- QMainWindow.__init__(self,parent)
+ QLineEdit.__init__(self,parent)
self.parentQt=parentQt
self.num=i
+ self.dansUnTuple=False
def focusInEvent(self,event):
+ #print "dans focusInEvent de LECustom"
self.parentQt.LineEditEnCours=self
self.parentQt.NumLineEditEnCours=self.num
+ self.setStyleSheet("border: 2px solid gray")
+ QLineEdit.focusInEvent(self,event)
+
+ def focusOutEvent(self,event):
+ #print "dans focusOutEvent de LECustom"
+ 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)")
+ QLineEdit.focusOutEvent(self,event)
+
+ def clean(self):
+ self.setText("")
+
+ def getValeur(self):
+ return self.text()
+
+ def setValeur(self,valeur):
+ self.setText(valeur)
+
+# --------------------------- #
+class LECustomTuple(LECustom):
+# --------------------------- #
+ def __init__(self,parent):
+ # index sera mis a jour par TupleCustom
+ parentQt=parent.parent().parent().parent()
+ LECustom. __init__(self,parent,parentQt,0)
+
+# ---------------------------- #
+class MonLabelListeClic(QLabel):
+# ---------------------------- #
+ def __init__(self,parent):
+ QLabel.__init__(self,parent)
+ self.parent=parent
+
+ def event(self,event) :
+ if event.type() == QEvent.MouseButtonRelease:
+ self.texte=self.text()
+ self.parent.traiteClicSurLabelListe(self.texte)
+ return QLabel.event(self,event)
# ------------- #
def __init__(self):
- print "GereListe"
self.connecterSignaux()
def connecterSignaux(self):
self.connect(self.RBMoins,SIGNAL("clicked()"),self.moinsPushed)
self.connect(self.RBPlus,SIGNAL("clicked()"),self.plusPushed)
self.connect(self.RBVoisListe,SIGNAL("clicked()"),self.voisListePushed)
- self.connect(self.RBSalome,SIGNAL("clicked()"),self.salomePushed)
- self.connect(self.RBSalomeVue,SIGNAL("clicked()"),self.salomeVuePushed)
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)
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="lineEditVal"+str(num1)
+ nomLineEdit=self.nomLine+str(num1)
#print nomLineEdit
courant=getattr(self,nomLineEdit)
valeurAGarder=courant.text()
- nomLineEdit2="lineEditVal"+str(num2)
+ nomLineEdit2=self.nomLine+str(num2)
#print nomLineEdit2
courant2=getattr(self,nomLineEdit2)
courant.setText(courant2.text())
self.changeValeur(changeDePlace=False)
self.NumLineEditEnCours=num2
self.LineEditEnCours=courant2
+ self.LineEditEnCours.setFocus(True)
def moinsPushed(self):
- if self.indexDernierLabel < self.monSimpDef.min:
- self.editor.affiche_infos('nb min de valeurs : '+str(self.monSimpDef.min)+' atteint')
- return
# on supprime le dernier
if self.NumLineEditEnCours==self.indexDernierLabel :
- self.setText("")
+ 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="lineEditVal"+str(aRemonter)
+ nomLineEdit=self.nomLine+str(aRemonter)
+ print nomLineEdit
courant=getattr(self,nomLineEdit)
- valeurARemonter=courant.text()
- nomLineEdit="lineEditVal"+str(i)
+ valeurARemonter=courant.getValeur()
+ print valeurARemonter
+ nomLineEdit=self.nomLine+str(i)
+ print nomLineEdit
courant=getattr(self,nomLineEdit)
- courant.setText(valeurARemonter)
- nomLineEdit="lineEditVal"+str(self.indexDernierLabel)
+ if valeurARemonter != None : courant.setValeur(valeurARemonter)
+ else : courant.clean()
+ nomLineEdit=self.nomLine+str(self.indexDernierLabel)
courant=getattr(self,nomLineEdit)
- courant.setText("")
- self.changeValeur(changeDePlace=False)
+ courant.clean()
+ self.changeValeur(changeDePlace=False,oblige=True)
+ self.setValide()
def plusPushed(self):
if self.indexDernierLabel == self.monSimpDef.max:
- self.editor.affiche_infos('nb max de valeurs : '+str(self.monSimpDef.max)+' atteint')
+ self.editor.affiche_infos('nb max de valeurs : '+str(self.monSimpDef.max)+' atteint',Qt.red)
return
self.ajoutLineEdit()
+ self.descendLesLignes()
+
+ def descendLesLignes(self):
if self.NumLineEditEnCours==self.indexDernierLabel : return
- nomLineEdit="lineEditVal"+str(self.NumLineEditEnCours+1)
+ nomLineEdit=self.nomLine+str(self.NumLineEditEnCours+1)
courant=getattr(self,nomLineEdit)
- valeurADescendre=courant.text()
- courant.setText("")
+ valeurADescendre=courant.getValeur()
+ courant.clean()
for i in range (self.NumLineEditEnCours+1, self.indexDernierLabel):
aDescendre=i+1
- nomLineEdit="lineEditVal"+str(aDescendre)
+ nomLineEdit=self.nomLine+str(aDescendre)
courant=getattr(self,nomLineEdit)
- valeurAGarder=courant.text()
- courant.setText(valeurADescendre)
+ valeurAGarder=courant.getValeur()
+ courant.setValeur(valeurADescendre)
valeurADescendre=valeurAGarder
self.changeValeur(changeDePlace=False)
self.scrollArea.ensureWidgetVisible(self.LineEditEnCours)
f=ViewText(self,self.editor,entete,texteValeurs[0:-2])
f.show()
- def salomePushed(self):
- print "salomePushed"
- def salomeVuePushed(self):
- print "salomeVuePushed"
+ def selectInFile(self):
+ print "selectInFile"
+ init=QString( self.editor.CONFIGURATION.savedir)
+ fn = QFileDialog.getOpenFileName(self.node.appliEficas,
+ tr("Fichier de donnees"),
+ init,
+ tr('Tous les Fichiers (*)',))
+ if fn == None : return
+ if fn == "" : return
+ ulfile = os.path.abspath(unicode(fn))
+ self.editor.CONFIGURATION.savedir=os.path.split(ulfile)[0]
+
+ from monSelectVal import MonSelectVal
+ MonSelectVal(file=fn,parent=self).show()
+