From 6fbb4e68ea611caf80a3f311cb880888b1a65680 Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Thu, 6 Apr 2017 17:04:04 +0200 Subject: [PATCH] pour simple clic --- InterfaceQT4/monGroupeOptionnel.py | 41 ++++++++++++++++++++++---- InterfaceQT4/monWidgetPlusieursBase.py | 1 - InterfaceQT4/monWidgetPlusieursPlie.py | 2 +- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/InterfaceQT4/monGroupeOptionnel.py b/InterfaceQT4/monGroupeOptionnel.py index 2d5972b2..dff78b61 100644 --- a/InterfaceQT4/monGroupeOptionnel.py +++ b/InterfaceQT4/monGroupeOptionnel.py @@ -20,16 +20,17 @@ # Modules Eficas from __future__ import absolute_import -from PyQt5.QtWidgets import QCheckBox, QWidget, QLabel -from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import QCheckBox, QWidget, QLabel, QPushButton +from PyQt5.QtCore import Qt, QRect from Extensions.i18n import tr from desGroupeOptionnel import Ui_groupeOptionnel +from desPBOptionnelMT import Ui_customPB # Import des panels -class monButtonCustom(QCheckBox): +class monRBButtonCustom(QCheckBox): def __init__(self,texte,monOptionnel,parent=None): QCheckBox.__init__(self,tr(texte),parent) @@ -73,7 +74,32 @@ class monButtonCustom(QCheckBox): monAide = "" self.monOptionnel.parentMC.editor.affiche_commentaire(monAide) +class monPBButtonCustom(QWidget,Ui_customPB): + def __init__(self,texte,monOptionnel,parent=None): + QWidget.__init__(self) + self.setupUi(self) + self.monPb.setText(texte) + self.monPb.clicked.connect(self.ajoutMC) + + self.texte=texte + self.monOptionnel=monOptionnel + self.definitAideMC() + self.setToolTip(self.monAide) + + def ajoutMC (self) : + listeCheckedMC="+"+self.monOptionnel.dicoCb[self] + self.monOptionnel.parentMC.ajoutMC(listeCheckedMC) + + def definitAideMC(self): + try : + maDefinition = self.monOptionnel.parentMC.definition.entites[self.texte] + maLangue = self.monOptionnel.parentMC.jdc.lang + if hasattr(maDefinition,maLangue): + self.monAide = getattr(maDefinition,self.monOptionnel.parentMC.jdc.lang) + except : + self.monAide = "" + class MonGroupeOptionnel (QWidget,Ui_groupeOptionnel): """ """ @@ -118,12 +144,15 @@ class MonGroupeOptionnel (QWidget,Ui_groupeOptionnel): self.dicoCb={} liste.reverse() for mot in liste : - cb = monButtonCustom(mot,self) - cb.clicked.connect(cb.ajoutAideMC) + if self.parentQt.parentQt.simpleClic == False : + cb = monRBButtonCustom(mot,self) + cb.clicked.connect(cb.ajoutAideMC) + else : + cb = monPBButtonCustom(mot,self) + self.MCOptionnelLayout.insertWidget(0,cb) self.dicoCb[cb]=mot self.scrollAreaCommandesOptionnelles.horizontalScrollBar().setSliderPosition(0) - print "Fin Optionnel ____ affiche", liste diff --git a/InterfaceQT4/monWidgetPlusieursBase.py b/InterfaceQT4/monWidgetPlusieursBase.py index 05c89d3a..b506c205 100644 --- a/InterfaceQT4/monWidgetPlusieursBase.py +++ b/InterfaceQT4/monWidgetPlusieursBase.py @@ -98,7 +98,6 @@ class MonWidgetPlusieursBase (Ui_WidgetPlusieursBase,Feuille,GereListe,GerePlie) if self.monSimpDef.max == "**" : aConstruire=7 elif self.monSimpDef.max == float('inf'): aConstruire=7 else : aConstruire=self.monSimpDef.max - print ('1,aConstruire', aConstruire) for i in range(1,aConstruire): self.ajoutLineEdit() diff --git a/InterfaceQT4/monWidgetPlusieursPlie.py b/InterfaceQT4/monWidgetPlusieursPlie.py index 7da3e7ac..60f96104 100644 --- a/InterfaceQT4/monWidgetPlusieursPlie.py +++ b/InterfaceQT4/monWidgetPlusieursPlie.py @@ -43,7 +43,7 @@ pattern_blanc = re.compile(r"^\s*$") class MonWidgetPlusieursPlie (Ui_WidgetPlusieursPlie,Feuille): def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande): - print "MonWidgetPlusieursBase", nom + #print ("MonWidgetPlusieursBase", nom) Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande) self.parentQt.commandesLayout.insertWidget(-1,self) self.AAfficher=self.lineEditVal -- 2.39.2