1 # Copyright (C) 2007-2017 EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 from __future__ import absolute_import
23 from builtins import str
28 from PyQt5.QtGui import QIcon
29 from InterfaceQT4.monWidgetCommande import MonWidgetCommande
30 from PyQt5.QtWidgets import QSpacerItem, QSizePolicy
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
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)
44 def afficheMots(self):
46 # Attention --> cette methode surcharge les methodes des Nodes Fils
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')
53 for node in self.node.children:
56 node.setPlieChildren()
57 if node.appartientAUnNoeudPlie==True : continue
59 node.plieToutEtReaffiche = self.plieToutEtReaffiche
60 node.deplieToutEtReaffiche = self.deplieToutEtReaffiche
61 node.affichePanneau = self.affichePanneau
62 node.getPanel = self.getPanel
64 widget=node.getPanelGroupe(self,self.maCommande)
65 self.listeFocus.append(node.fenetre)
68 node.fenetre.RBDeplie.setCheckable(False)
69 node.fenetre.RBDeplie.setEnabled(False)
70 node.fenetre.RBDeplie.setIcon(icon)
73 if node.item.object.isMCList() :
74 node.setDeplie = self.setDepliePourMCList
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
83 c.fenetre.RBDeplie.setCheckable(False)
84 c.fenetre.RBDeplie.setEnabled(False)
85 c.fenetre.RBDeplie.setIcon(icon)
89 node.setDeplie=self.setDepliePourNode
91 #print ("fin ------------------------ afficheMots de MonWidgetCommandeDeplie1Niveau ",self.node.item.nom)
93 def afficheSuivant(self,aAfficher):
94 fenetre=self.node.tree.itemCourant.fenetre
95 fenetre.afficheSuivant(aAfficher)
97 def setDepliePourNode(self):
98 noeudCourant=self.node.tree.itemCourant
99 noeudCourant.setDeplieChildren()
100 if self.editor.fenetreCentraleAffichee == noeudCourant.fenetre : return
101 noeudCourant.afficheCeNiveau()
105 # -------------------------------------------- Methodes qui surchargent les noeuds fils
107 def setDepliePourMCList(self):
108 #print ('je surcharge setDeplie pour MCList')
111 def setPlieChildren(self):
112 #print ('je surcharge setPlieChildren')
115 def setDeplieChildren(self):
116 #print ('je surcharge setDeplieChildren')
119 def plieToutEtReaffiche(self):
120 #print ('je surcharge plieToutEtReaffiche', self.node.item.nom)
123 def deplieToutEtReaffiche(self):
124 #print ('je surcharge deplieToutEtReaffiche', self.node.tree.itemCourant.item.getLabelText())
127 def plieToutEtReafficheSaufItem(self):
128 #print ('je surcharge plieToutEtReaffiche', self.node.tree.itemCourant.item.getLabelText())
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') :
136 self.node.tree.setCurrentItem(node)
139 if item.getLabelText()[0] == self.editor.fenetreCentraleAffichee.labelNomCommande.text():
141 node.setDeplieChildren()
142 node.afficheCeNiveau()
143 self.editor.fenetreCentraleAffichee.labelNomCommande.setText(item.getLabelText()[0])
144 self.editor.fenetreCentraleAffichee.labelDoc.setText(item.getFr())
149 #print ('surcharge ds getPanel')