Salome HOME
Update version
[tools/eficas.git] / InterfaceQT4 / monWidgetCommandeDeplie1Niveau.py
1 # Copyright (C) 2007-2021   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 from __future__ import absolute_import
22 try :
23     from builtins import str
24 except : pass
25 import types, os
26 import traceback
27
28 from PyQt5.QtGui import QIcon
29 from InterfaceQT4.monWidgetCommande import MonWidgetCommande
30 from PyQt5.QtWidgets  import QSpacerItem, QSizePolicy
31
32 class MonWidgetCommandeDeplie1Niveau(MonWidgetCommande):
33 # Attention au MCLIST qui ne sont pas des MCFACT
34 # il faut donc surcharger un certain nb de fonction ici pour eux
35
36
37     def __init__(self,node,editor,etape):
38         #print ("debut de ---------------------- init de MonWidgetCommandeDeplie1Niveau ",node.item.nom)
39         MonWidgetCommande.__init__(self,node,editor,etape)
40         self.node.plieToutEtReaffiche=self.plieToutEtReaffiche
41         spacerItem = QSpacerItem(21, 600, QSizePolicy.Expanding, QSizePolicy.Expanding)
42         self.verticalLayoutCommande.addItem(spacerItem)
43
44     def afficheMots(self):
45         # Attention
46         # Attention --> cette methode surcharge les methodes des Nodes Fils
47         # Attention
48         #print ("debut de ---------------------- ds afficheMots de MonWidgetCommandeDeplie1Niveau ",self.node.item.nom)
49         #traceback.print_stack()
50         repIcon=self.editor.appliEficas.repIcon
51         fichier=os.path.join(repIcon, 'deleteRondVide.png')
52         icon = QIcon(fichier)
53         for node in self.node.children:
54
55             node.plie=True
56             node.setPlieChildren()
57             if node.appartientAUnNoeudPlie==True : continue
58
59             node.plieToutEtReaffiche   = self.plieToutEtReaffiche
60             node.deplieToutEtReaffiche = self.deplieToutEtReaffiche
61             node.affichePanneau        = self.affichePanneau
62             node.getPanel              = self.getPanel
63
64             widget=node.getPanelGroupe(self,self.maCommande)
65             self.listeFocus.append(node.fenetre)
66
67             try :
68                 node.fenetre.RBDeplie.setCheckable(False)
69                 node.fenetre.RBDeplie.setEnabled(False)
70                 node.fenetre.RBDeplie.setIcon(icon)
71             except : pass
72
73             if node.item.object.isMCList() :
74                 node.setDeplie              = self.setDepliePourMCList
75
76                 for c in node.children :
77                     c.setDeplie           = self.setDepliePourNode
78                     c.plieToutEtReaffiche = self.plieToutEtReaffiche
79                     c.deplieToutEtReaffiche = self.deplieToutEtReaffiche
80                     c.getPanel              = self.getPanel
81                     c.affichePanneau      = self.affichePanneau
82                     try :
83                         c.fenetre.RBDeplie.setCheckable(False)
84                         c.fenetre.RBDeplie.setEnabled(False)
85                         c.fenetre.RBDeplie.setIcon(icon)
86                     except :
87                         pass
88             else :
89                 node.setDeplie=self.setDepliePourNode
90
91         #print ("fin ------------------------ afficheMots de MonWidgetCommandeDeplie1Niveau ",self.node.item.nom)
92
93     def afficheSuivant(self,aAfficher):
94         fenetre=self.node.tree.itemCourant.fenetre
95         fenetre.afficheSuivant(aAfficher)
96
97     def setDepliePourNode(self):
98         noeudCourant=self.node.tree.itemCourant
99         noeudCourant.setDeplieChildren()
100         if self.editor.fenetreCentraleAffichee == noeudCourant.fenetre : return
101         noeudCourant.afficheCeNiveau()
102         pass
103
104
105 # -------------------------------------------- Methodes qui surchargent les noeuds fils
106
107     def setDepliePourMCList(self):
108         #print ('je surcharge setDeplie pour MCList')
109         pass
110
111     def setPlieChildren(self):
112         #print ('je surcharge setPlieChildren')
113         pass
114
115     def setDeplieChildren(self):
116         #print ('je surcharge setDeplieChildren')
117         pass
118
119     def plieToutEtReaffiche(self):
120         #print ('je surcharge plieToutEtReaffiche', self.node.item.nom)
121         pass
122
123     def deplieToutEtReaffiche(self):
124         #print ('je surcharge deplieToutEtReaffiche', self.node.tree.itemCourant.item.getLabelText())
125         pass
126
127     def plieToutEtReafficheSaufItem(self):
128         #print ('je surcharge plieToutEtReaffiche', self.node.tree.itemCourant.item.getLabelText())
129         pass
130
131     def affichePanneau(self):
132         #print ('je surcharge affichePanneau', self.node.tree.itemCourant.item.getLabelText())
133         node=self.node.tree.itemCourant
134         while ( not (hasattr(node,'fenetreIhm')) or node.treeParent.fenetreIhm != 'deplie1Niveau') :
135             node=node.treeParent
136         self.node.tree.setCurrentItem(node)
137
138         item=node.item
139         if item.getLabelText()[0] == self.editor.fenetreCentraleAffichee.labelNomCommande.text():
140             return
141         node.setDeplieChildren()
142         node.afficheCeNiveau()
143         self.editor.fenetreCentraleAffichee.labelNomCommande.setText(item.getLabelText()[0])
144         self.editor.fenetreCentraleAffichee.labelDoc.setText(item.getFr())
145
146
147
148     def getPanel (self):
149         #print ('surcharge ds getPanel')
150         pass