1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2017 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 from __future__ import absolute_import
23 from builtins import str
29 from Extensions.i18n import tr
31 from .feuille import Feuille
32 from .politiquesValidation import PolitiqueUnique
33 from .qtSaisie import SaisieValeur
34 from desWidgetCBIntoSug import Ui_WidgetCBIntoSug
36 from PyQt5.QtWidgets import QComboBox, QCompleter
37 from PyQt5.QtCore import Qt
39 from monWidgetCB import MonWidgetCBCommun
40 from monWidgetIntoSug import GereAjoutDsPossible
43 class MonWidgetCBIntoSug (MonWidgetCBCommun, Ui_WidgetCBIntoSug,GereAjoutDsPossible):
44 def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
45 self.maListeDeValeur=monSimpDef.into
46 if node.item.hasIntoSug() : self.maListeDeValeur=node.item.getListePossibleAvecSug([])
47 if hasattr(node.item,'suggestion') : self.maListeDeValeur+= node.item.suggestion
48 MonWidgetCBCommun. __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande)
49 self.lineEditVal.returnPressed.connect(self.LEValeurAjouteDsPossible)
51 def ajouteValeurPossible(self,valeur):
52 self.CBChoix.addItem(valeur)
53 # on ne sait pas si on a deja ajouté une valeur
54 try : self.node.item.suggestion.append(valeur)
55 except : self.node.item.suggestion=(valeur,)
56 self.lineEditVal.setText('')
57 self.CBChoix.setCurrentIndex(self.CBChoix.findText(valeur));