1 # Copyright (C) 2007-2013 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
22 from __future__ import absolute_import
23 from PyQt5.QtWidgets import QCheckBox, QWidget
24 from PyQt5.QtCore import Qt
26 from Extensions.i18n import tr
27 from desWidgetOptionnel import Ui_WidgetOptionnel
28 from .monGroupeOptionnel import MonGroupeOptionnel
32 class MonWidgetOptionnel (QWidget,Ui_WidgetOptionnel):
33 def __init__(self,parentQt):
34 #print ("dans init de monWidgetOptionnel ", parentQt )
35 QWidget.__init__(self,None)
37 self.dicoMCWidgetOptionnel={}
38 self.parentQt=parentQt
40 def afficheOptionnel(self,liste,MC):
41 print ('afficheOptionnel MonWidgetOptionnel', self,liste,MC)
43 #traceback.print_stack()
44 self.vireLesAutres(MC)
45 if MC.node.item.nom in self.dicoMCWidgetOptionnel :
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 groupe = MonGroupeOptionnel(liste,self,MC)
50 self.groupesOptionnelsLayout.insertWidget(0,groupe)
51 self.dicoMCWidgetOptionnel[MC.node.item.nom]=groupe
54 def vireLesAutres(self,MC):
55 #print( "je passe dans vireLesAutres")
56 genea =MC.obj.get_genealogie()
58 for k in list(self.dicoMCWidgetOptionnel.keys()):
59 #if k not in genea : print ( k)
61 self.dicoMCWidgetOptionnel[k].close()
62 del self.dicoMCWidgetOptionnel[k]
63 #print( "fin vireLesAutres")
65 def afficheOptionnelVide(self):
66 self.GeneaLabel.setText("")
67 for k in list(self.dicoMCWidgetOptionnel.keys()):
68 self.dicoMCWidgetOptionnel[k].close()
69 del self.dicoMCWidgetOptionnel[k]
72 if self.parentCommande.node.editor.code in ['Adao','ADAO'] and self.parentCommande.node.editor.closeFrameRechercheCommande==True :
73 self.frameLabelCommande.close()
75 labeltext,fonte,couleur = self.parentCommande.node.item.GetLabelText()
83 for l in li : texte+=l+"\n"
85 self.GeneaLabel.setText(tr("Options pour \n") +texte)