X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=InterfaceQT4%2Ffeuille.py;h=ae30044f8b40b2cee22b1b22528a01f0f1730870;hb=b380d4fbcd34212327ae754b21acae46a9937d45;hp=780ca95ec278986689a1dbc5f75c19943fe20171;hpb=8eece1c8d57079d5034ac26184ec9fdad2ae76ff;p=tools%2Feficas.git diff --git a/InterfaceQT4/feuille.py b/InterfaceQT4/feuille.py index 780ca95e..ae30044f 100644 --- a/InterfaceQT4/feuille.py +++ b/InterfaceQT4/feuille.py @@ -21,11 +21,17 @@ import string,types,os import traceback -from PyQt4 import * -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from determine import monEnvQT5 +if monEnvQT5: + from PyQt5.QtWidgets import QToolButton ,QWidget + from PyQt5.QtGui import QFont, QFontMetrics + from PyQt5.QtCore import Qt +else : + from PyQt4.QtGui import * + from PyQt4.QtCore import * from Extensions.i18n import tr + from gereIcones import ContientIcones from gereIcones import FacultatifOuOptionnel from qtSaisie import SaisieValeur @@ -44,12 +50,13 @@ class Feuille(QWidget,ContientIcones,SaisieValeur,FacultatifOuOptionnel): self.node.fenetre=self # on se positionne pour les icones - os.chdir(os.path.abspath(os.path.join(os.path.dirname(__file__)))) + #os.chdir(os.path.abspath(os.path.join(os.path.dirname(__file__)))) self.setupUi(self) self.prendLeFocus=0 maPolice= QFont("Times", 10) self.setFont(maPolice) + self.setFocusPolicy(Qt.StrongFocus) self.parentQt=parentQt self.editor=self.node.editor @@ -69,13 +76,17 @@ class Feuille(QWidget,ContientIcones,SaisieValeur,FacultatifOuOptionnel): self.setIconePoubelle() self.setIconesFichier() self.setIconesSalome() + self.setIconesGenerales() self.setCommentaire() self.setZoneInfo() def setNom(self): self.debutToolTip="" + #print "kkkkkkkkkkkkkkkkkk" + #print self.objSimp.nom nomTraduit=tr(self.objSimp.nom) + #print nomTraduit #if len(nomTraduit) >= nomMax : # nom=nomTraduit[0:nomMax]+'...' # self.label.setText(nomTraduit) @@ -102,6 +113,34 @@ class Feuille(QWidget,ContientIcones,SaisieValeur,FacultatifOuOptionnel): def finCommentaire(self): return "" + + def finCommentaireListe(self): + commentaire="" + mc = self.node.item.get_definition() + d_aides = { 'TXM' : 'chaines de caracteres', + 'R' : 'reels', + 'I' : 'entiers', + 'C' : 'complexes'} + type = mc.type[0] + if not d_aides.has_key(type) : + if mc.min == mc.max: + commentaire=tr("Entrez ")+str(mc.min)+tr(" valeurs ")+'\n' + else : + if mc.max != "**" : + commentaire=tr("Entrez entre ")+str(mc.min)+tr(" et ")+str(mc.max)+tr(" valeurs ")+'\n' + else : + commentaire="" + else : + if mc.min == mc.max: + commentaire=tr("Entrez ")+str(mc.min)+" "+tr(d_aides[type])+'\n' + else : + commentaire=tr("Entrez entre ")+str(mc.min)+(" et ")+str(mc.max) +" " +tr(d_aides[type])+'\n' + aideval=self.node.item.aide() + commentaire=commentaire + tr(aideval) + self.monCommentaireLabel.setText(str(commentaire)) + return str(commentaire) + + def setSuggestion(self): if self.monSimpDef.get_sug() != None and self.monSimpDef.get_sug() != "": suggere=str('

suggestion : ')+str(self.monSimpDef.get_sug())+"

" @@ -160,12 +199,10 @@ class Feuille(QWidget,ContientIcones,SaisieValeur,FacultatifOuOptionnel): # if self.monSimpDef.get_fr() != None and self.monSimpDef.get_fr() != "": info+=self.monSimpDef.get_sug() +" " # if self.monSimpDef.get_sug() != None and self.monSimpDef.get_sug() != "": info+="Valeur suggérée : "self.monSimpDef.get_sug() pass - #self.editor.affiche_infos(info) def reaffiche(self): #print "dans reaffiche de feuille", self.nom if self.editor.jdc.aReafficher==True : - #print " j appelle le reaffiche de parentQt" self.parentQt.reaffiche() #PN PN PN pas satisfaisant @@ -176,15 +213,40 @@ class Feuille(QWidget,ContientIcones,SaisieValeur,FacultatifOuOptionnel): #self.editor.fenetreCentraleAffichee.rendVisibleNoeud(nodeAVoir) #nodeAVoir.fenetre.setFocus() # return # on est bien postionne - if self.objSimp.isvalid() and hasattr(self, 'AAfficher'): - self.editor.fenetreCentraleAffichee.afficheSuivant(self.AAfficher) + + if self.objSimp.isvalid() and hasattr(self, 'AAfficher'): + nodeAVoir=self.parentQt.node.chercheNoeudCorrespondant(self.objSimp) + try : + index=self.editor.fenetreCentraleAffichee.listeAffichageWidget.index(nodeAVoir.fenetre.AAfficher) + if (index==len(self.editor.fenetreCentraleAffichee.listeAffichageWidget)-1) : + try : + nodeAVoir.fenetre.setValeursApresBouton() + except : + pass + else : + self.editor.fenetreCentraleAffichee.afficheSuivant(nodeAVoir.fenetre.AAfficher) + except : + pass else : - if hasattr(self, 'AAfficher'): self.AAfficher.setFocus(7) + if self.objSimp.isvalid() and hasattr(self, 'AAfficher'): + try : + self.setValeursApresBouton() + except : + self.editor.fenetreCentraleAffichee.afficheSuivant(self.AAfficher) + else : + if hasattr(self, 'AAfficher'): self.AAfficher.setFocus(7) + + def reaffichePourDeplier(self): + self.parentQt.reaffiche() def rendVisible(self): #print "jjjjjjjjjjjjjjjjjjjjj" pass + #def enterEvent(self,event): + # print "je passe dans enterEvent", self.nom + # QWidget.enterEvent(self,event) + def traiteClicSurLabel(self,texte): #print self.aide aide=self.aide+"\n"+self.aideALaSaisie()