From: pascale.noyret Date: Tue, 30 Apr 2019 07:56:12 +0000 (+0200) Subject: pour WheelEvent X-Git-Tag: avantMenage~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e4d136ac75492b3a131f696b837977c9ed7f3533;p=tools%2Feficas.git pour WheelEvent --- diff --git a/InterfaceQT4/monWidgetCB.py b/InterfaceQT4/monWidgetCB.py index a23b51fc..4a6e543b 100644 --- a/InterfaceQT4/monWidgetCB.py +++ b/InterfaceQT4/monWidgetCB.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2017 EDF R&D +# Copyright (C) 2007-2020 EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -34,7 +34,7 @@ from InterfaceQT4.politiquesValidation import PolitiqueUnique from InterfaceQT4.qtSaisie import SaisieValeur from PyQt5.QtWidgets import QComboBox, QCompleter -from PyQt5.QtCore import Qt +from PyQt5.QtCore import Qt, QEvent class MonWidgetCBCommun (Feuille): @@ -45,7 +45,6 @@ class MonWidgetCBCommun (Feuille): self.determineChoix() self.setValeursApresBouton() self.CBChoix.currentIndexChanged.connect(self.choixSaisi) - #self.CBChoix.lineEdit().setText(tr("Select")) self.parentQt.commandesLayout.insertWidget(-1,self) self.maCommande.listeAffichageWidget.append(self.CBChoix) self.AAfficher=self.CBChoix @@ -54,7 +53,6 @@ class MonWidgetCBCommun (Feuille): def setValeursApresBouton(self): if self.objSimp.getValeur()==None : self.CBChoix.setCurrentIndex(-1) - #self.CBChoix.lineEdit().setStyleSheet(("QLineEdit {" " background:yellow;\n" "font: italic ;\n" " }\n" " ")) self.CBChoix.lineEdit().setText(tr("Select")) return valeur=self.objSimp.getValeur() @@ -83,14 +81,20 @@ class MonWidgetCBCommun (Feuille): SaisieValeur.LEvaleurPressed(self,valeur) self.reaffiche() + def wheelEvent(self, event): + # Sinon poum sur les fenetres trop longues + # lorsque la widget attrape le wheelevent + event.ignore(); + + class MonWidgetCB (Ui_WidgetCB, MonWidgetCBCommun): def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande): - self.maListeDeValeur=monSimpDef.into + self.maListeDeValeur = monSimpDef.into MonWidgetCBCommun. __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande) class MonWidgetCBSD (Ui_WidgetCB,MonWidgetCBCommun): def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande): - self.maListeDeValeur=node.item.getSdAvantDuBonType() + self.maListeDeValeur = node.item.getSdAvantDuBonType() MonWidgetCBCommun.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande) diff --git a/InterfaceQT4/monWidgetCBIntoSug.py b/InterfaceQT4/monWidgetCBIntoSug.py index c2e71c7a..8075451d 100644 --- a/InterfaceQT4/monWidgetCBIntoSug.py +++ b/InterfaceQT4/monWidgetCBIntoSug.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2017 EDF R&D +# Copyright (C) 2007-2020 EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -43,16 +43,16 @@ from monWidgetIntoSug import GereAjoutDsPossible class MonWidgetCBIntoSug (MonWidgetCBCommun, Ui_WidgetCBIntoSug,GereAjoutDsPossible): def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande): self.maListeDeValeur=monSimpDef.into - if node.item.hasIntoSug() : self.maListeDeValeur=node.item.getListePossibleAvecSug([]) - if hasattr(node.item,'suggestion') : self.maListeDeValeur+= node.item.suggestion + if node.item.hasIntoSug() : self.maListeDeValeur = node.item.getListePossibleAvecSug([]) + if hasattr(node.item,'suggestion') : self.maListeDeValeur += node.item.suggestion MonWidgetCBCommun. __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande) self.lineEditVal.returnPressed.connect(self.LEValeurAjouteDsPossible) def ajouteValeurPossible(self,valeur): self.CBChoix.addItem(valeur) # on ne sait pas si on a deja ajouté une valeur - try : self.node.item.suggestion.append(valeur) - except : self.node.item.suggestion=(valeur,) + try : self.node.item.suggestion.append(valeur) + except : self.node.item.suggestion = (valeur,) self.lineEditVal.setText('') self.CBChoix.setCurrentIndex(self.CBChoix.findText(valeur));