2 # -*- coding: utf-8 -*-
3 # Copyright (C) 2007-2017 EDF R&D
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 from __future__ import print_function
23 from __future__ import absolute_import
28 from PyQt5.QtWidgets import QLabel, QFrame
29 from PyQt5.QtCore import QEvent
30 from Extensions.i18n import tr
32 #from Extensions.i18n import tr
34 class MonLabelClic(QLabel) :
36 def __init__(self,parent):
37 QLabel.__init__(self,parent)
38 # Pas propre mais impossible de faire fonctionner isinstance sur Groupe, MonWidgetCommande
39 # PNPNPN ? a ameliorer
40 if isinstance (parent,QFrame): parent=parent.parent()
41 while not( hasattr(parent,'traiteClicSurLabel')) :
42 try : parent=parent.parent()
43 except : print ("pb avec MonLabelClic"); break
47 def event(self,event) :
48 if event.type() == QEvent.MouseButtonRelease:
49 self.texte=self.text()
50 self.parent.traiteClicSurLabel(self.texte)
51 return QLabel.event(self,event)