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 absolute_import
29 from PyQt5.QtWidgets import QToolButton, QToolTip
30 from Extensions.i18n import tr
32 class MonBoutonValide(QToolButton) :
34 def __init__(self,parent):
35 QToolButton.__init__(self,parent)
36 while( not(hasattr(parent,'node'))):
37 parent= parent.parent()
40 def mouseDoubleClickEvent(self, event):
41 #print "dans mouseDoubleClickEvent"
42 strAide=self.parent.node.item.object.getFr()
43 if hasattr(self.parent.node.item.object.definition, 'defaut') :
44 strAide+='\ndefaut : \n'+str(self.parent.node.item.object.definition.defaut)
45 strRapport=six.text_type(self.parent.node.item.object.report())
46 self.parent.editor._viewText(strAide+"\n"+strRapport, "JDC_RAPPORT")
48 def mousePressEvent(self, event):
49 #print "dans mousePressEvent"
50 if self.parent.node.item.object.isValid() :
51 myToolTip=tr("objet valide")
52 if self.parent.editor.maConfiguration.differencieSiDefaut :
53 if hasattr(self.parent.node.item.object.definition, 'defaut') :
54 if self.parent.node.item.object.valeur != self.parent.node.item.object.definition.defaut :
55 myToolTip+='\ndefaut : \n'+str(self.parent.node.item.object.definition.defaut)
57 QToolTip.showText(event.globalPos(),myToolTip )
60 texte=six.text_type(self.parent.node.item.object.report())
62 for l in texte.split('\n')[2:-2]:
63 if re.match('^[\t !]*$',l) : continue
64 if re.match('^ *Fin Mot-cl',l) : continue
65 if re.match('^ *D?but Mot-cl',l) : continue
66 if re.match('^ *Mot-cl',l) : continue
74 QToolTip.showText(event.globalPos(),myToolTip )