if typ == 'TXM' :return 1
return 0
+ def wait_tuple(self):
+ for ss_type in self.definition.type:
+ if repr(ss_type).find('Tuple') != -1 :
+ return 1
+ return 0
+
+
def get_liste_valeurs(self):
"""
"""
self.parent.update_condition_bloc()
def set_valeur(self,new_valeur,evaluation='oui'):
- #print "set_valeur",new_valeur
self.init_modif()
self.valeur = new_valeur
self.val = new_valeur
if maDefinition.max == 1 :
# A verifier
- if maDefinition.into != [] and maDefinition.into != None:
+ if maDefinition.intoSug != [] and maDefinition.intoSug != None:
+ from .monWidgetCBIntoSug import MonWidgetCBIntoSug
+ widget=MonWidgetCBIntoSug(self,maDefinition,monNom,monObjet,parentQt,maCommande)
+ elif maDefinition.into != [] and maDefinition.into != None:
if len(monInto) < 4 :
from .monWidgetRadioButton import MonWidgetRadioButton
widget=MonWidgetRadioButton(self,maDefinition,monNom,monObjet,parentQt,maCommande)
# Modules Eficas
from Extensions.i18n import tr
-from .feuille import Feuille
+from InterfaceQT4.feuille import Feuille
from desWidgetCB import Ui_WidgetCB
-from .politiquesValidation import PolitiqueUnique
-from .qtSaisie import SaisieValeur
+from InterfaceQT4.politiquesValidation import PolitiqueUnique
+from InterfaceQT4.qtSaisie import SaisieValeur
from PyQt5.QtWidgets import QComboBox, QCompleter
from PyQt5.QtCore import Qt
-class MonWidgetCBCommun (Ui_WidgetCB,Feuille):
+class MonWidgetCBCommun (Feuille):
def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande)
SaisieValeur.LEValeurPressed(self,valeur)
self.reaffiche()
-class MonWidgetCB (MonWidgetCBCommun):
+class MonWidgetCB (Ui_WidgetCB, MonWidgetCBCommun):
def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
self.maListeDeValeur=monSimpDef.into
MonWidgetCBCommun. __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande)
-class MonWidgetCBSD (MonWidgetCBCommun):
+class MonWidgetCBSD (Ui_WidgetCB, MonWidgetCBCommun):
def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
self.maListeDeValeur=node.item.get_sd_avant_du_bon_type()
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2017 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
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# Modules Python
+from __future__ import absolute_import
+try :
+ from builtins import str
+except : pass
+
+import types,os
+
+# Modules Eficas
+from Extensions.i18n import tr
+
+from .feuille import Feuille
+from .politiquesValidation import PolitiqueUnique
+from .qtSaisie import SaisieValeur
+from desWidgetCBIntoSug import Ui_WidgetCBIntoSug
+
+from PyQt5.QtWidgets import QComboBox, QCompleter
+from PyQt5.QtCore import Qt
+
+from monWidgetCB import MonWidgetCBCommun
+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.has_intoSug() : self.maListeDeValeur=node.item.get_liste_possible_avecSug([])
+ 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,)
+ self.lineEditVal.setText('')
+ self.CBChoix.setCurrentIndex(self.CBChoix.findText(valeur));
+
+
+ def choixSaisi(self):
+ MonWidgetCBCommun.choixSaisi(self)
+ self.lineEditVal.setText('')
+
self.node.selectAvant()
def setValide(self):
+ # Possibilite d enlever un isvalid si necessaire
+ # en utilisant nomIcone
if not(hasattr (self,'RBValide')) : return
icon = QIcon()
if self.node.item.object.isvalid() :
icon=QIcon(self.repIcon+"/ast-green-ball.png")
else :
icon=QIcon(self.repIcon+"/ast-red-ball.png")
- if self.node.item.GetIconName() == "ast-yellow-square" :
+ self.RBValide.setIcon(icon)
+
+ nomIcone = self.node.item.GetIconName()
+ if nomIcone == "ast-yellow-square" :
icon=QIcon(self.repIcon+"/ast-yel-ball.png")
self.LENom.setDisabled(False)
- if self.node.item.GetIconName() == "ast-red-square" : self.LENom.setDisabled(True)
- self.RBValide.setIcon(icon)
+ if nomIcone == "ast-red-square" : self.LENom.setDisabled(True)
from desWidgetIntoSug import Ui_WidgetIntoSug
from monWidgetPlusieursInto import MonWidgetPlusieursInto
-class MonWidgetIntoSug (Ui_WidgetIntoSug, MonWidgetPlusieursInto):
+class GereAjoutDsPossible:
+ def LEValeurAjouteDsPossible(self):
+ text=str(self.lineEditVal.text())
+ if text == "" : return
+ # il faudrait essauer d en obtenir un reel, un tuple ou ...
+ # si cela est utilise pour autre chose que Telemac
+ # tout devrait etre fait ici
+ if not isinstance(text,str) :
+ self.lineEditVal.setText("")
+ return
+ if self.node.item.has_intoSug() :
+ self.maListeDeValeur=list(self.node.item.get_liste_possible_avecSug([]))
+ self.maListeDeValeur.insert(0,text)
+ else :
+ try :
+ self.monSimpDef.intoSug.insert(0,text)
+ except :
+ self.monSimpDef.intoSug=list(self.monSimpDef.intoSug)
+ self.monSimpDef.intoSug.insert(0,text)
+ # selon si on est une liste ou un combo
+ try : self.ajouteValeurPossible(text)
+ except : self.setValeurs()
+
+class MonWidgetIntoSug (Ui_WidgetIntoSug, MonWidgetPlusieursInto,GereAjoutDsPossible):
# Attention Attention
# cette wdget ne fonctionne actuellement que pour Telemac
# on attend du texte . on n essaye pas de transformer
MonWidgetPlusieursInto.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande)
self.lineEditVal.returnPressed.connect(self.LEValeurAjouteDsPossible)
- def LEValeurAjouteDsPossible(self):
- text=str(self.lineEditVal.text())
- if text == "" : return
- # il faudrait essauer d en obtenir un reel, un tuple ou ...
- # si cela est utilise pour autre chose que Telemac
- if not isinstance(text,str) :
- self.lineEditVal.setText("")
- print ('jkjkl')
- return
- self.monSimpDef.intoSug.insert(0,text)
- self.setValeurs()
self.editor.affiche_infos(texte,Qt.red)
return
- validite,comm,comm2,listeRetour= self.politique.ajoutNTuple(listeComplete)
- if not validite :
- self.editor.affiche_infos(texte,Qt.red)
- return
-
# on calcule le dernier lineedit rempli avant de changer la valeur
if self.objSimp.valeur != None : indexDernierRempli=len(self.objSimp.valeur)
else : indexDernierRempli=0
+ print ('indexDernierRempli', indexDernierRempli)
+
+ validite, texte =self.politique.recordValeur(listeComplete)
+ if not validite :
+ self.editor.affiche_infos(texte,Qt.red)
+ return
- self.politique.recordValeur(listeComplete)
- indexDernierRempli=0
while ( indexDernierRempli < len(liste) ) :
texte=liste[indexDernierRempli]
if indexDernierRempli < self.indexDernierLabel:
self.editor.affiche_infos(tr(texte),Qt.red)
return
- i=0
longueur=len(liste)//self.nbValeurs
increment=self.nbValeurs
listeFormatee=[liste[k*increment:(k+1)*increment] for k in range(longueur)]
- listeFormatee=tuple(listeFormatee)
min,max=self.node.item.GetMinMax()
if self.objSimp.valeur == None : listeComplete=listeFormatee
self.editor.affiche_infos(texte,Qt.red)
return
- validite,comm,comm2,listeRetour= self.politique.ajoutNTuple(listeComplete)
- if not validite :
- self.editor.affiche_infos(texte,Qt.red)
- return
-
# on calcule le dernier lineedit rempli avant de changer la valeur
if self.objSimp.valeur != None : indexDernierRempli=len(self.objSimp.valeur)
- else : indexDernierRempli=0
- self.politique.recordValeur(listeComplete)
+ else : indexDernierRempli=0
+ validite,texte=self.politique.recordValeur(listeComplete)
+ if not validite :
+ self.editor.affiche_infos(texte,Qt.red)
+ return
+ i=0
while ( i < len(liste) ) :
try :
- t=tuple(liste[i:i+self.nbValeurs])
+ t=list(liste[i:i+self.nbValeurs])
except:
- t=tuple(liste[i:len(liste)])
+ t=list(liste[i:len(liste)])
i=i+self.nbValeurs
if indexDernierRempli < self.indexDernierLabel:
nomLineEdit=self.nomLine+str(indexDernierRempli+1)
else :
self.ajoutLineEdit(t,False)
indexDernierRempli = indexDernierRempli + 1
+ self.setValide()
def RBListePush(self):
listeRetour.append(valeurTuple)
return valide,commentaire,commentaire2,listeRetour
- def ajoutNTuple(self,liste):
- listeRetour=[]
- commentaire="Nouvelles valeurs acceptee"
- commentaire2=""
- valide=self.node.item.valide_liste_partielle(None,liste)
- if not valide :
- commentaire2=self.node.item.info_erreur_liste()
- return valide,commentaire,commentaire2,listeRetour
def recordValeur(self,liste,dejaValide=True):
- ancienne_val = self.node.item.get_valeur()
+ ancienneVal = self.node.item.get_valeur()
validite=self.node.item.set_valeur(liste)
- if validite : self.node.item.init_modif()
if self.node.item.isvalid():
commentaire = tr("Valeur du mot-cle enregistree")
else:
#
eficas_compile_ui ( desWidgetBloc.ui )
eficas_compile_ui ( desWidgetCB.ui )
+eficas_compile_ui ( desWidgetCBIntoSug.ui )
eficas_compile_ui ( desWidgetCommentaire.ui )
eficas_compile_ui ( desWidgetDate.ui )
eficas_compile_ui ( desWidgetFact.ui )
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>WidgetCBIntoSug</class>
+ <widget class="QWidget" name="WidgetCBIntoSug">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1104</width>
+ <height>102</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>1493</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QComboBox{combobox-popup:0;};</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>4</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>9</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="MonBoutonValide" name="RBValide">
+ <property name="minimumSize">
+ <size>
+ <width>21</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>21</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::ClickFocus</enum>
+ </property>
+ <property name="toolTip">
+ <string>Affiche le rapport de validation du mot-clef</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">border : 0px</string>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>../Editeur/icons/ast-green-ball.png</normaloff>../Editeur/icons/ast-green-ball.png</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>25</width>
+ <height>25</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>5</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="MonLabelClic" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>178</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string><html><head/><body><p>aaa</p><p>dqsklmdqm</p></body></html></string>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QFrame" name="frameHorsListe">
+ <property name="styleSheet">
+ <string notr="true">background:rgb(221, 221, 166)</string>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string>Valeurs hors liste - la valeur saisie sera ajoutée à la liste</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEditVal">
+ <property name="styleSheet">
+ <string notr="true">background : white
+</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QComboBox" name="CBChoix">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>361</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="accessibleName">
+ <string/>
+ </property>
+ <property name="accessibleDescription">
+ <string/>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QComboBox {
+ background:rgb(235,235,235);
+ }
+/*QComboBox: on {
+ font : italic
+ }
+background:rgb(235,235,235);
+border:0px;
+
+
+QComboBox:!editable:on, QComboBox::drop-down:editable:on {
+background: black;
+ font : italic 14px
+ }
+QComboBox:on {
+ font : italic 20px;
+ background: red ;
+}/*
+</string>
+ </property>
+ <property name="maxVisibleItems">
+ <number>100</number>
+ </property>
+ <property name="frame">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>301</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QToolButton" name="RBPoubelle">
+ <property name="minimumSize">
+ <size>
+ <width>21</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>21</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Détruit le mot-clef</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">border : 0px</string>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>../Editeur/icons/deleteRond.png</normaloff>../Editeur/icons/deleteRond.png</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>25</width>
+ <height>25</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>MonBoutonValide</class>
+ <extends>QToolButton</extends>
+ <header>monBoutonValide.h</header>
+ </customwidget>
+ <customwidget>
+ <class>MonLabelClic</class>
+ <extends>QLabel</extends>
+ <header>monLabelClic.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
desChoixLangue.py desRecherche.py desRechercheCatalogue.py\
desSelectVal.py desViewTexte.py desViewRegles.py desVisu.py desWidgetCreeParam.py desWidgetCommande.py \
desWidgetOptionnel.py desWidgetOptionnelMC.py Tuple2.py Tuple3.py \
- desWidgetBloc.py desWidgetCB.py desWidgetCommentaire.py desWidgetDate.py \
+ desWidgetBloc.py desWidgetCB.py desWidgetCBIntoSug.py desWidgetCommentaire.py desWidgetDate.py \
desWidgetFact.py desWidgetFactPlie.py desWidgetFormule.py desGroupeOptionnel.py \
desWidgetHeure.py desWidgetInformation.py desWidgetIntoSug.py desWidgetInactif.py \
desWidgetMatrice.py desWidgetParam.py desWidgetPlusieursBase.py desWidgetPlusieursInto.py \
# Pour tenir compte des Tuples
if hasattr(self.definition.type[0],'ntuple') :
try :
- if not (type(lval[0]) is tuple) : lval=(lval,)
+ if (not (type(lval[0]) is tuple)) and (not (type(lval[0]) is list)) : lval=(lval,)
except :
pass
s3=s2.replace(',',';')
else:
s3=s2
- if s3 != "" and s3[0]=='(' :
+ if s3 != "" and s3[0]=='(' :
try : s3=s3[1:-1] # cas de liste vide
except : s3 = ' '
+ # cas des Tuples
+ if obj.wait_tuple() and s3 != '' and s3 != 'None':
+ s3=s
+ if s3[-1] == ',': s3=s3[:-1]
# LIQUID_BOUNDARIES
#if obj.nom in ('PRESCRIBED_FLOWRATES','PRESCRIBED_VELOCITIES','PRESCRIBED_ELEVATIONS') :
s3="'"+ s3 +"'"
else:
s3 = "''"
+
if s3 == "" or s3 == " " : s3 = " "
ligne=nom+ " : " + s3 + "\n"
if len(ligne) > 72 : ligne=self.redecoupeLigne(nom,s3)