Salome HOME
Tuple
[tools/eficas.git] / InterfaceQT4 / monWidgetCommentaire.py
1 # Copyright (C) 2007-2013   EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19 # Modules Python
20 # Modules Eficas
21
22 from desWidgetCommentaire import Ui_WidgetCommentaire
23 from gereIcones import FacultatifOuOptionnel
24 from PyQt4.QtGui import *
25 from PyQt4.QtCore import *
26 from Extensions.i18n import tr
27 import Accas 
28 import os
29 import string
30
31     
32 # Import des panels
33
34 class MonWidgetCommentaire(QWidget,Ui_WidgetCommentaire,FacultatifOuOptionnel):
35   """
36   """
37   def __init__(self,node,editor,commentaire):
38       QWidget.__init__(self,None)
39       self.node=node
40       self.node.fenetre=self
41       self.setupUi(self)
42       self.editor=editor
43       self.setIconePoubelle()
44       self.remplitTexte()
45       if self.editor.code in ['MAP','CARMELCND'] : self.bCatalogue.close()
46       else : self.connect(self.bCatalogue,SIGNAL("clicked()"), self.afficheCatalogue)
47       self.connect(self.commentaireLE,SIGNAL("returnPressed()"),self.TexteCommentaireEntre)
48        
49   def afficheCatalogue(self):
50       if self.editor.code != "CARMELCND" : self.monOptionnel.hide()
51       self.node.tree.racine.affichePanneau()
52       if self.node : self.node.select()
53       else : self.node.tree.racine.select()
54
55   def remplitTexte(self):
56       texte=self.node.item.get_valeur()
57       self.commentaireLE.setText(texte)
58       if self.editor.code == "CARMELCND" and texte[0:16]=="Cree - fichier :" :
59          self.commentaireLE.setDisabled(True)
60          self.commentaireLE.setStyleSheet(QString.fromUtf8("background:rgb(244,244,244);\n" "border:0px;\n"))
61          self.commentaireLE.setToolTip(tr("Valeur non modifiable"))
62
63   def donnePremier(self):
64       self.commentaireLE.setFocus(7)
65
66
67   def TexteCommentaireEntre(self):
68       texte=str(self.commentaireLE.text())
69       self.editor.init_modif()
70       self.node.item.set_valeur(texte)
71