X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=InterfaceQT4%2Ffeuille.py;h=1b11cbf0621a1b0557c515c223d7d31c130d21a0;hb=91f8ed1cbaed8a138bc89ad058c99625b2aee6c5;hp=f033eac41109d9dc16f85caffd6f4a3f124b827a;hpb=b2ab08fd7617bc1919416221b7032890e7fcc78a;p=tools%2Feficas.git diff --git a/InterfaceQT4/feuille.py b/InterfaceQT4/feuille.py index f033eac4..1b11cbf0 100644 --- a/InterfaceQT4/feuille.py +++ b/InterfaceQT4/feuille.py @@ -30,7 +30,7 @@ from gereIcones import ContientIcones from gereIcones import FacultatifOuOptionnel from qtSaisie import SaisieValeur -nomMax=26 +nomMax=250 # ---------------------------------------------------------------------- # class Feuille(QWidget,ContientIcones,SaisieValeur,FacultatifOuOptionnel): # --------------------------------------------------------------------- # @@ -73,13 +73,37 @@ class Feuille(QWidget,ContientIcones,SaisieValeur,FacultatifOuOptionnel): def setNom(self): self.debutToolTip="" nomTraduit=tr(self.objSimp.nom) - if len(nomTraduit) >= nomMax : - nom=nomTraduit[0:nomMax]+'...' - self.label.setText(nomTraduit) - self.debutToolTip=nomTraduit+"\n" + #if len(nomTraduit) >= nomMax : + # nom=nomTraduit[0:nomMax]+'...' + # self.label.setText(nomTraduit) + # self.debutToolTip=nomTraduit+"\n" + longueur=QFontMetrics(self.label.font()).width(nomTraduit) + if longueur >= nomMax : + print "je formate" + nouveauNom=self.formate(nomTraduit) + print"________" + print nouveauNom + print"________" + print self + #self.label.setTextFormat(Qt.AutoText) + self.label.setText(nouveauNom) + #self.agrandit() else : self.label.setText(nomTraduit) + def agrandit(self): + # inutile pour certains widgets + if self.height() < 40 : + print "j agrandis" + self.setMinimumHeight(50) + #self.setMaximumHeight(50) + self.resize(self.width(),200) + #self.principalLayout.setAlignment(Qt.AlignTop) + #self.label.resize(self.label.width(),200) + print self.label.height() + print self.height() + print "__________" + def setValeurs(self): # print "passe dans setValeurs pour ", self.objSimp.nom @@ -163,14 +187,34 @@ class Feuille(QWidget,ContientIcones,SaisieValeur,FacultatifOuOptionnel): #self.editor.fenetreCentraleAffichee.rendVisibleNoeud(nodeAVoir) #nodeAVoir.fenetre.setFocus() # return # on est bien postionne - if self.objSimp.isvalid(): + if self.objSimp.isvalid() and hasattr(self, 'AAfficher'): self.editor.fenetreCentraleAffichee.afficheSuivant(self.AAfficher) else : - print "dans le else de reaffiche" - self.AAfficher.setFocus(7) + if hasattr(self, 'AAfficher'): self.AAfficher.setFocus(7) - def traiteClicSurLabel(self): + def traiteClicSurLabel(self,texte): #print self.aide - self.aide+="\n"+self.aideALaSaisie() - self.editor.affiche_infos(self.aide) + aide=self.aide+"\n"+self.aideALaSaisie() + self.editor.affiche_infos(aide) + + def formate(self,t): + if t.find('_')==0 : + newText=t[0:19]+'\n'+t[19:] + else: + listeNom=t.split('_') + newTexte="" + ligne="" + for n in listeNom: + if len(ligne)+len(n) < 25 : + newTexte=newTexte+"_"+n + ligne+="_"+n + else : + newTexte=newTexte+"\n_"+n + ligne="" + #newTexte=t[0:t.rfind('_')]+'\n'+ t[t.rfind('_'):] + newText=newTexte[1:] + return newText + + +