1 # Copyright (C) 2007-2021 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
24 from builtins import str
27 from PyQt5.QtWidgets import QButtonGroup, QToolButton
28 from PyQt5.QtGui import QIcon, QPixmap
29 from Extensions.i18n import tr
32 #----------------------
33 class MonLayoutBouton :
34 #----------------------
36 # -------------------------------
37 def __init__(self,appliEficas):
38 # -------------------------------
40 self.appliEficas = appliEficas
41 self.buttonGroup = QButtonGroup()
43 for etape in self.appliEficas.readercata.cata.JdC.commandes :
45 toolButton = QToolButton(self.appliEficas.toolBarCommande)
47 if nomEtape in self.appliEficas.maConfiguration.dicoIcones:
48 fichier = self.appliEficas.maConfiguration.dicoIcones[nomEtape]
49 icon.addPixmap(QPixmap(fichier), QIcon.Normal, QIcon.Off)
50 toolButton.setIcon(icon)
52 try : label = nomEtape[0:3]
53 except : label = nomEtape
54 toolButton.setText(label)
56 action = self.appliEficas.toolBarCommande.addWidget(toolButton)
57 action.setVisible(True)
58 toolButton.setObjectName(nomEtape)
59 toolButton.setToolTip(tr(nomEtape))
60 self.buttonGroup.addButton(toolButton)
62 self.buttonGroup.buttonClicked.connect(self.rbCliqueEtInsere)
64 def rbCliqueEtInsere(self,id):
65 self.appliEficas.handleAjoutEtape(id.objectName())