from qtSaisie import SaisieValeur
-
class MonWidgetRadioButtonCommun (Feuille):
- def __init__(self,node,monSimpDef,nom,objSimp,parentQt):
+ def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
self.setMaxI()
- #print "dans MonWidgetRadioButtonCommun", self.maxI
- Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt)
+ Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande)
self.politique=PolitiqueUnique(self.node,self.editor)
self.dict_bouton={}
self.determineChoix()
self.setValeursApresBouton()
self.parentQt.commandesLayout.insertWidget(-1,self)
+ self.AAfficher=self.radioButton_1
+ self.maCommande.listeAffichageWidget.append(self.radioButton_1)
def setValeursApresBouton(self):
def determineChoix(self):
self.horizontalLayout.setAlignment(Qt.AlignLeft)
i=1
- j=len(self.monSimpDef.into)
+ j=len(self.maListeDeValeur)
if j > self.maxI :
print "poumbadaboum"
return
while i < j+1 :
nomBouton="radioButton_"+str(i)
bouton=getattr(self,nomBouton)
- valeur=self.monSimpDef.into[i-1]
+ valeur=self.maListeDeValeur[i-1]
if not(type(valeur) in types.StringTypes) : valeur=str(valeur)
bouton.setText(valeur)
self.dict_bouton[valeur]=bouton
self.connect(bouton,SIGNAL("clicked()"),self.boutonclic)
+ bouton.keyPressEvent=self.keyPressEvent
+ setattr(self,nomBouton,bouton)
i=i+1
while i < self.maxI +1 :
nomBouton="radioButton_"+str(i)
def boutonclic(self):
for valeur in self.dict_bouton.keys():
if self.dict_bouton[valeur].isChecked():
- print "dans boutonclic is checked", valeur, type(valeur)
+ #print "dans boutonclic is checked", valeur, type(valeur)
SaisieValeur.LEValeurPressed(self,valeur)
- self.parentQt.reaffiche()
+ self.reaffiche()
+
+
+ def keyPressEvent(self, event):
+ if event.key() == Qt.Key_Right : self.selectSuivant(); return
+ if event.key() == Qt.Key_Left : self.selectPrecedent(); return
+ QWidget.keyPressEvent(self,event)
+
+ def selectSuivant(self):
+ aLeFocus=self.focusWidget()
+ nom=aLeFocus.objectName()[12:]
+ i=nom.toInt()[0]+1
+ if i == len(self.maListeDeValeur) +1 : i=1
+ nomBouton="radioButton_"+str(i)
+ courant=getattr(self,nomBouton)
+ courant.setFocus(True)
+
+ def selectPrecedent(self):
+ aLeFocus=self.focusWidget()
+ nom=aLeFocus.objectName()[12:]
+ i=nom.toInt()[0]-1
+ if i == 0 : i= len(self.maListeDeValeur)
+ nomBouton="radioButton_"+str(i)
+ courant=getattr(self,nomBouton)
+ courant.setFocus(True)
+
class MonWidgetRadioButton (Ui_WidgetRadioButton,MonWidgetRadioButtonCommun):
- def __init__(self,node,monSimpDef,nom,objSimp,parentQt):
- MonWidgetRadioButtonCommun.__init__(self,node,monSimpDef,nom,objSimp,parentQt)
+ def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
+ #print "MonWidgetRadioButton ", self
+ self.maListeDeValeur=monSimpDef.into
+ MonWidgetRadioButtonCommun.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande)
def setMaxI(self):
self.maxI=3
+
+
+class MonWidgetRadioButtonSD (Ui_WidgetRadioButton,MonWidgetRadioButtonCommun):
+
+ def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
+ #print "dans le init de MonWidgetRadioButtonSD",self
+ self.maListeDeValeur=node.item.get_sd_avant_du_bon_type()
+ MonWidgetRadioButtonCommun.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande)
+
+ def setMaxI(self):
+ self.maxI=3