]> SALOME platform Git repositories - tools/eficas.git/blob - InterfaceQT4/monWidgetOptionnel.py
Salome HOME
bug sur un mesage dans une exception sur un validator (cf JPA)
[tools/eficas.git] / InterfaceQT4 / monWidgetOptionnel.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
22 from __future__ import absolute_import
23 from PyQt5.QtWidgets import QCheckBox, QWidget
24 from PyQt5.QtCore import Qt
25
26 from Extensions.i18n import tr
27 from desWidgetOptionnel import Ui_WidgetOptionnel
28 from .monGroupeOptionnel import MonGroupeOptionnel
29
30
31 # Import des panels
32 class  MonWidgetOptionnel (QWidget,Ui_WidgetOptionnel):
33     def __init__(self,parentQt):
34         #print ("dans init de monWidgetOptionnel ", parentQt )
35         QWidget.__init__(self,None)
36         self.setupUi(self)
37         self.dicoMCWidgetOptionnel={}
38         self.parentQt=parentQt
39
40     def afficheOptionnel(self,liste,liste_rouge,MC):
41         #print ('afficheOptionnel MonWidgetOptionnel',self, liste,MC.node.item.nom)
42         self.vireLesAutres(MC)
43
44         if MC.node.item.nom in self.dicoMCWidgetOptionnel :
45             #print (MC.node.item.nom)
46             self.dicoMCWidgetOptionnel[MC.node.item.nom].close()
47             self.dicoMCWidgetOptionnel[MC.node.item.nom].setParent(None)
48             self.dicoMCWidgetOptionnel[MC.node.item.nom].deleteLater()
49             del self.dicoMCWidgetOptionnel[MC.node.item.nom]
50         if liste==[] : return
51         groupe = MonGroupeOptionnel(liste,liste_rouge,self,MC)
52         self.groupesOptionnelsLayout.insertWidget(0,groupe)
53         self.dicoMCWidgetOptionnel[MC.node.item.nom]=groupe
54         return groupe
55
56     def vireLesAutres(self,MC):
57         #print( "je passe dans vireLesAutres")
58         genea =MC.obj.getGenealogie()
59         #print (genea)
60         for k in list(self.dicoMCWidgetOptionnel.keys()):
61             #print (k)
62             #if k not in genea :  print ( k)
63             if k not in genea :
64                 self.dicoMCWidgetOptionnel[k].close()
65                 del self.dicoMCWidgetOptionnel[k]
66         #print( "fin vireLesAutres")
67
68     def vireTous(self):
69         for k in list(self.dicoMCWidgetOptionnel.keys()):
70             self.dicoMCWidgetOptionnel[k].close()
71             del self.dicoMCWidgetOptionnel[k]
72
73     def afficheOptionnelVide(self):
74         self.GeneaLabel.setText("")
75         for k in list(self.dicoMCWidgetOptionnel.keys()):
76             self.dicoMCWidgetOptionnel[k].close()
77             del self.dicoMCWidgetOptionnel[k]
78
79     def titre(self,MC):
80         if self.parentCommande.node.editor.maConfiguration.closeFrameRechercheCommande==True :
81             self.frameLabelCommande.close()
82             return
83         labeltext,fonte,couleur = self.parentCommande.node.item.getLabelText()
84         l=tr(labeltext)
85         li=[]
86         while len(l) > 25:
87             li.append(l[0:24])
88             l=l[24:]
89         li.append(l)
90         texte=""
91         for l in li : texte+=l+"\n"
92         texte=texte[0:-2]
93         self.GeneaLabel.setText(tr("Options pour \n") +texte)