1 # -*- coding: utf-8 -*-
2 # CONFIGURATION MANAGEMENT OF EDF VERSION
3 # ======================================================================
4 # COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
5 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
6 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
7 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
8 # (AT YOUR OPTION) ANY LATER VERSION.
10 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
11 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
12 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
13 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
15 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
16 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
17 # 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
20 # ======================================================================
22 from PyQt4.QtGui import *
23 from PyQt4.QtCore import *
26 from Editeur import Objecttreeitem
31 class Node(browser.JDCNode,typeNode.PopUpMenuNodePartiel):
35 from monCommentairePanel import MonCommentairePanel
36 return MonCommentairePanel(self,parent=self.editor)
38 def createPopUpMenu(self):
39 typeNode.PopUpMenuNodePartiel.createPopUpMenu(self)
40 self.Decommente = QAction('Decommenter',self.tree)
41 self.tree.connect(self.Decommente,SIGNAL("activated()"),self.Decommenter)
42 self.Decommente.setStatusTip("Decommente la commande ")
44 if hasattr(self.item,'uncomment'):
45 self.menu.addAction(self.Decommente)
47 def Decommenter(self) :
48 item= self.tree.currentItem()
51 def update_node_label(self) :
54 debComm=self.item.GetText()
55 self.setText(1,debComm)
59 class COMMTreeItem(Objecttreeitem.ObjectTreeItem):
63 self.setfunction = self.set_valeur
65 def GetIconName(self):
67 Retourne le nom de l'icône associée au noeud qui porte self,
68 dépendant de la validité de l'objet
69 NB : un commentaire est toujours valide ...
71 return "ast-white-percent"
73 def GetLabelText(self):
74 """ Retourne 3 valeurs :
75 - le texte à afficher dans le noeud représentant l'item
76 - la fonte dans laquelle afficher ce texte
79 return 'commentaire' #CS_pbruno,Fonte_Commentaire,None
83 Retourne la valeur de l'objet Commentaire cad son texte
85 return self.object.get_valeur() or ''
88 texte = self.object.valeur
89 texte = string.split(texte,'\n')[0]
95 def set_valeur(self,valeur):
97 Afecte valeur à l'objet COMMENTAIRE
99 self.object.set_valeur(valeur)
101 def GetSubList(self):
103 Retourne la liste des fils de self
108 def get_objet_commentarise(self):
110 La méthode get_objet_commentarise() de la classe compocomm.COMMTreeItem
111 surcharge la méthode get_objet_commentarise de la classe Objecttreeitem.ObjectTreeItem
112 elle a pour but d'empecher l'utilisateur final de commentariser un commentaire.
114 raise Exception( 'Impossible de commentariser un commentaire' )
117 treeitem =COMMTreeItem
118 objet = Extensions.commentaire.COMMENTAIRE