X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=InterfaceQT4%2FmonWidgetCommande.py;h=a2555170d3f30c9e49a174e9a323157bd884cae1;hb=97c204c49d4c9e2785779957f56d9b13a1e93181;hp=f4dc44c58c35237eed15c9f37163037eb0539b10;hpb=0a450526edbc08ec2f18357f74a5e95a968af44f;p=tools%2Feficas.git diff --git a/InterfaceQT4/monWidgetCommande.py b/InterfaceQT4/monWidgetCommande.py index f4dc44c5..a2555170 100644 --- a/InterfaceQT4/monWidgetCommande.py +++ b/InterfaceQT4/monWidgetCommande.py @@ -36,25 +36,34 @@ class MonWidgetCommande(Ui_WidgetCommande,Groupe): """ """ def __init__(self,node,editor,etape): - print "MonWidgetCommande ", self - Groupe.__init__(self,node,editor,None,etape.definition,etape,1) + #print "MonWidgetCommande ", self + self.listeAffichageWidget=[] + self.inhibe=0 + self.ensure=0 + Groupe.__init__(self,node,editor,None,etape.definition,etape,1,self) + self.labelDoc.setText(QString(etape.definition.fr)) if (etape.get_type_produit()==None): self.LENom.close() elif (hasattr (etape, 'sdnom')) and etape.sdnom != "sansnom" : self.LENom.setText(etape.sdnom) else : self.LENom.setText("") maPolice= QFont("Times", 10,) self.setFont(maPolice) self.repIcon=self.appliEficas.repIcon - self.labelNomCommande.setText(self.obj.nom) + self.labelNomCommande.setText(tr(self.obj.nom)) self.commandesLayout.addStretch() self.commandesLayout.focusInEvent=self.focusInEvent self.scrollAreaCommandes.focusInEvent=self.focusInEvent - #self.RBValide.focusInEvent=FacultatifOuOptionnel.focusInEvent - self.connect(self.bCatalogue,SIGNAL("clicked()"), self.afficheCatalogue) + if self.editor.code in ['MAP','Adao','CARMELCND'] : self.bCatalogue.close() + else : self.connect(self.bCatalogue,SIGNAL("clicked()"), self.afficheCatalogue) self.connect(self.LENom,SIGNAL("returnPressed()"),self.nomChange) self.racine=self.node.tree.racine if self.node.item.GetIconName() == "ast-red-square" : self.LENom.setDisabled(True) self.setAcceptDrops(True) + self.etablitOrdre() + + if self.editor.code == "CARMELCND" : + self.RBPoubelle.close() # JDC Fige + return # Pas de MC Optionnels pour Carmel from monWidgetOptionnel import MonWidgetOptionnel if hasattr(self.editor,'widgetOptionnel') : self.monOptionnel=self.editor.widgetOptionnel @@ -62,9 +71,43 @@ class MonWidgetCommande(Ui_WidgetCommande,Groupe): self.monOptionnel=MonWidgetOptionnel(self) self.editor.widgetOptionnel=self.monOptionnel self.editor.splitter.addWidget(self.monOptionnel) + print "dans init ", self.monOptionnel self.afficheOptionnel() + def focusNextPrevChild(self, next): + # on s assure que ce n est pas un chgt de fenetre + print "je passe dans focusNextPrevChild" + if self.editor.fenetreCentraleAffichee != self : return True + try : + i= self.listeAffichageWidget.index(self.focusWidget()) + except : + i = -1 + if (i==len(self.listeAffichageWidget) -1) and next and not self.inhibe: + self.listeAffichageWidget[1].setFocus(7) + w=self.focusWidget() + self.inhibe=1 + w.focusPreviousChild() + self.inhibe=0 + return True + if i==0 and next==False and not self.inhibe: + if hasattr(self.editor.fenetreCentraleAffichee,'scrollArea'): + self.editor.fenetreCentraleAffichee.scrollArea.ensureWidgetVisible(self.listeAffichageWidget[-1]) + self.listeAffichageWidget[-2].setFocus(7) + self.inhibe=1 + w=self.focusWidget() + w.focusNextChild() + self.inhibe=0 + return True + return QWidget.focusNextPrevChild(self, next) + + def etablitOrdre(self): + i=0 + while(i +1 < len(self.listeAffichageWidget)): + self.setTabOrder(self.listeAffichageWidget[i],self.listeAffichageWidget[i+1]) + i=i+1 + # si on boucle on perd l'ordre + def nomChange(self): nom = str(self.LENom.text()) nom = string.strip(nom) @@ -81,23 +124,50 @@ class MonWidgetCommande(Ui_WidgetCommande,Groupe): def afficheOptionnel(self): # N a pas de parentQt. doit donc etre redefini liste=self.ajouteMCOptionnelDesBlocs() + print "dans afficheOptionnel", self.monOptionnel self.monOptionnel.parentMC=self self.monOptionnel.affiche(liste) def focusInEvent(self,event): - #print "je mets a jour dans focusInEvent de monWidget Commande " + print "je mets a jour dans focusInEvent de monWidget Commande " + if self.editor.code == "CARMELCND" : return #Pas de MC Optionnels pour Carmel self.afficheOptionnel() def reaffiche(self,nodeAVoir=None): + self.avantH=self.editor.fenetreCentraleAffichee.scrollAreaCommandes.horizontalScrollBar().sliderPosition() + self.avantV=self.editor.fenetreCentraleAffichee.scrollAreaCommandes.verticalScrollBar().sliderPosition() self.node.affichePanneau() + print "dans reaffiche de monWidgetCommande", self.avantH, self.avantV + QTimer.singleShot(1, self.recentre) if nodeAVoir != None: - f=nodeAVoir.fenetre - qApp.processEvents() - self.editor.fenetreCentraleAffichee.scrollAreaCommandes.ensureWidgetVisible(f) + self.f=nodeAVoir.fenetre + if self.f==None : + newNode=nodeAVoir.treeParent.chercheNoeudCorrespondant(nodeAVoir.item.object) + self.f = newNode.fenetre + print "dans reaffiche",self.f, nodeAVoir.item.nom + if self.f != None and self.f.isVisible() : return + if self.f != None : QTimer.singleShot(1, self.rendVisible) + + + def recentre(self): + qApp.processEvents() + s=self.editor.fenetreCentraleAffichee.scrollAreaCommandes + s.horizontalScrollBar().setSliderPosition(self.avantH) + s.verticalScrollBar().setSliderPosition(self.avantV) + + def rendVisibleNoeud(self,node): + self.f=node.fenetre + print "dans rendVisibleNoeud",self.f, node.item.nom + QTimer.singleShot(1, self.rendVisible) + + def rendVisible(self): + qApp.processEvents() + self.f.setFocus() + self.editor.fenetreCentraleAffichee.scrollAreaCommandes.ensureWidgetVisible(self.f) def afficheCatalogue(self): - self.monOptionnel.hide() + if self.editor.code != "CARMELCND" : self.monOptionnel.hide() self.racine.affichePanneau() if self.node : self.node.select() else : self.racine.select() @@ -105,7 +175,6 @@ class MonWidgetCommande(Ui_WidgetCommande,Groupe): def setValide(self): if not(hasattr (self,'RBValide')) : return icon = QIcon() - print self.repIcon if self.node.item.object.isvalid() : icon=QIcon(self.repIcon+"/ast-green-ball.png") else :