Salome HOME
f3e84ec18414fbaddfed9c74f83296e11a8f31cd
[tools/eficas.git] / InterfaceQT4 / typeNode.py
1 # -*- coding: utf-8 -*-
2 from PyQt4 import *
3 from PyQt4.QtGui import *
4 from PyQt4.QtCore import *
5
6 #---------------------------#
7 class PopUpMenuNodePartiel :
8 #---------------------------#
9     def createPopUpMenu(self):
10         self.createActions()
11
12         self.menu = QMenu(self.tree)
13         #ss-menu Comment:
14         self.commentMenu=self.menu.addMenu('Commentaire')
15         self.commentMenu.addAction(self.CommApres)
16         self.commentMenu.addAction(self.CommAvant)
17         #ss-menu Parameters:
18         self.paramMenu =self.menu.addMenu('Parametre') 
19         self.paramMenu.addAction(self.ParamApres)
20         self.paramMenu.addAction(self.ParamAvant)
21
22         #items du menu
23         self.menu.addAction(self.Supprime)
24     
25     def createActions(self):
26         self.CommApres = QAction('après',self.tree)
27         self.tree.connect(self.CommApres,SIGNAL("activated()"),self.addCommApres)
28         self.CommApres.setStatusTip("Insere un commentaire apres la commande ")
29         self.CommAvant = QAction('avant',self.tree)
30         self.tree.connect(self.CommAvant,SIGNAL("activated()"),self.addCommAvant)
31         self.CommAvant.setStatusTip("Insere un commentaire avant la commande ")
32
33         self.ParamApres = QAction('après',self.tree)
34         self.tree.connect(self.ParamApres,SIGNAL("activated()"),self.addParametersApres)
35         self.ParamApres.setStatusTip("Insere un parametre apres la commande ")
36         self.ParamAvant = QAction('avant',self.tree)
37         self.tree.connect(self.ParamAvant,SIGNAL("activated()"),self.addParametersAvant)
38         self.ParamAvant.setStatusTip("Insere un parametre avant la commande ")
39
40         self.Supprime = QAction('Supprimer',self.tree)
41         self.tree.connect(self.Supprime,SIGNAL("activated()"),self.supprimeNoeud)
42         self.Supprime.setStatusTip("supprime le mot clef ")
43
44     def supprimeNoeud(self):
45         item= self.tree.currentItem()
46         item.delete()
47
48     def addParametersApres(self):
49         item= self.tree.currentItem()
50         item.addParameters(True)
51
52     def addParametersAvant(self):
53         item= self.tree.currentItem()
54         item.addParameters(False)
55
56     def addCommApres(self):
57         item= self.tree.currentItem()
58         item.addComment(True)
59
60     def addCommAvant(self):
61         item= self.tree.currentItem()
62         item.addComment(False)
63
64 #-----------------------------------------#
65 class PopUpMenuNode(PopUpMenuNodePartiel) :
66 #-----------------------------------------#
67     def createPopUpMenu(self):
68         PopUpMenuNodePartiel.createPopUpMenu(self)
69         self.Commente = QAction('ce noeud',self.tree)
70         self.tree.connect(self.Commente,SIGNAL("activated()"),self.Commenter)
71         self.Commente.setStatusTip("commente le noeud ")
72         self.commentMenu.addAction(self.Commente)
73
74     def Commenter(self):
75         item= self.tree.currentItem()
76         item.commentIt()