From 63b827a3e08e8ddaf8273ff76b80fdd0182e68af Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Wed, 14 Oct 2015 13:56:24 +0200 Subject: [PATCH] 7.7 rc0 --- Adao/prefs_Adao.py | 2 +- InterfaceQT4/browser.py | 3 +- InterfaceQT4/composimp.py | 4 + .../monWidgetPlusieursASSDIntoOrdonne.py | 61 +++++++ InterfaceQT4/monWidgetPlusieursIntoOrdonne.py | 25 +-- InterfaceQT4/qtEficas.py | 1 - PSEN_Eficas/PSEN_Cata.py | 159 +++++++++++++++--- PSEN_Eficas/opsPSEN.py | 4 +- UiQT4/desChoixCommandes.ui | 94 +++++++---- generator/generator_python.py | 1 - 10 files changed, 282 insertions(+), 72 deletions(-) create mode 100644 InterfaceQT4/monWidgetPlusieursASSDIntoOrdonne.py diff --git a/Adao/prefs_Adao.py b/Adao/prefs_Adao.py index 32bd4dbc..65ed235b 100644 --- a/Adao/prefs_Adao.py +++ b/Adao/prefs_Adao.py @@ -15,7 +15,7 @@ encoding='iso-8859-1' # format du Tuple (code,version,catalogue,formatOut, finit par defaut Ãventuellement) catalogues = ( # ('Adao','V1',os.path.join(repIni,'ADAO_Cata_V1.py'),'python','python'), - ('Adao','V760',os.path.join(repIni,'ADAO_Cata_V0_V7_6_0.py'),'python','python'), + ('Adao','V770',os.path.join(repIni,'ADAO_Cata_V0_V7_7_0.py'),'python','python'), # ('Adao','V751',os.path.join(repIni,'ADAO_Cata_V0_V7_5_1.py'),'python','python'), ) diff --git a/InterfaceQT4/browser.py b/InterfaceQT4/browser.py index 7761a6c3..0f1b30b5 100644 --- a/InterfaceQT4/browser.py +++ b/InterfaceQT4/browser.py @@ -147,10 +147,11 @@ class JDCTree( QTreeWidget,GereRegles ): from InterfaceQT4 import composimp - if (isinstance(item,composimp.Node)) : item.fenetre.rendVisible() + if (isinstance(item,composimp.Node)) and item.fenetre : item.fenetre.rendVisible() elif itemParent!=item: #self.tree.handleExpandedItem(item) #item.fenetre.donnePremier() + #item.fenetre.rendActif() print 'il faut afficher le 1er' try : fr = item.item.get_fr() diff --git a/InterfaceQT4/composimp.py b/InterfaceQT4/composimp.py index ca8a572a..56f42d84 100644 --- a/InterfaceQT4/composimp.py +++ b/InterfaceQT4/composimp.py @@ -115,6 +115,7 @@ class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal): from monWidgetSDCOInto import MonWidgetSDCOInto widget=MonWidgetSDCOInto(self,maDefinition,monNom,monObjet,parentQt,maCommande) elif self.item.wait_assd(): + print self.item.get_sd_avant_du_bon_type() if len(self.item.get_sd_avant_du_bon_type()) == 0 : from monWidgetVide import MonWidgetVide widget=MonWidgetVide(self,maDefinition,monNom,monObjet,parentQt,maCommande) @@ -147,6 +148,9 @@ class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal): if self.item.wait_assd() and self.item.is_list_SansOrdreNiDoublon(): from monWidgetPlusieursInto import MonWidgetPlusieursInto widget=MonWidgetPlusieursInto(self,maDefinition,monNom,monObjet,parentQt,maCommande) + elif self.item.wait_assd() : + from monWidgetPlusieursASSDIntoOrdonne import MonWidgetPlusieursASSDIntoOrdonne + widget=MonWidgetPlusieursASSDIntoOrdonne(self,maDefinition,monNom,monObjet,parentQt,maCommande) elif self.item.wait_tuple() : if self.item.object.definition.type[0].ntuple == 2: from monWidgetPlusieursTuple2 import MonWidgetPlusieursTuple2 diff --git a/InterfaceQT4/monWidgetPlusieursASSDIntoOrdonne.py b/InterfaceQT4/monWidgetPlusieursASSDIntoOrdonne.py new file mode 100644 index 00000000..f60a713c --- /dev/null +++ b/InterfaceQT4/monWidgetPlusieursASSDIntoOrdonne.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2013 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 +import string,types,os,sys + +# Modules Eficas +from PyQt4.QtGui import * +from PyQt4.QtCore import * +from Extensions.i18n import tr + +from monWidgetPlusieursIntoOrdonne import MonWidgetPlusieursIntoOrdonne +from politiquesValidation import PolitiquePlusieurs + + + + +class MonWidgetPlusieursASSDIntoOrdonne (MonWidgetPlusieursIntoOrdonne): + + def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande): + MonWidgetPlusieursIntoOrdonne.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande) + + + def prepareListeResultat(self): + for i in self.listeLE: i.close() + self.listeLE=[] + self.vScrollBar = self.scrollArea.verticalScrollBar() + self.listeAAfficher = self.node.item.get_sd_avant_du_bon_type() + + if len(self.listeAAfficher) == 0 : + self.ajoutLE(0) + return + + + if len(self.listeAAfficher)*20 > 400 : self.setMinimumHeight(400) + else : self.setMinimumHeight(len(self.listeAAfficher)*30) + self.politique=PolitiquePlusieurs(self.node,self.editor) + for i in range(1,len(self.listeAAfficher)+1): self.ajoutLE(i) + for i in range(len(self.listeAAfficher)): + nomLE="lineEditVal"+str(i+1) + courant=getattr(self,nomLE) + courant.setText(str(self.listeAAfficher[i])) + self.vScrollBar.triggerAction(QScrollBar.SliderToMinimum) + + diff --git a/InterfaceQT4/monWidgetPlusieursIntoOrdonne.py b/InterfaceQT4/monWidgetPlusieursIntoOrdonne.py index c08781ec..dc137d76 100644 --- a/InterfaceQT4/monWidgetPlusieursIntoOrdonne.py +++ b/InterfaceQT4/monWidgetPlusieursIntoOrdonne.py @@ -41,18 +41,16 @@ class MonWidgetPlusieursIntoOrdonne (Ui_WidgetPlusieursIntoOrdonne, Feuille,Gere #print "MonWidgetPlusieursInto", nom, self self.nomLine="LEResultat" self.listeLE=[] + self.ouAjouter=0 Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande) GereListe.__init__(self) - self.parentQt.commandesLayout.insertWidget(-1,self) try : self.maCommande.listeAffichageWidget.append(self.lineEditVal1) except : # cas ou on ne peut rien ajouter pass - self.ouAjouter=0 self.prepareListeResultat() self.adjustSize() - self.vScrollBarRE = self.scrollAreaRE.verticalScrollBar() if sys.platform[0:5]!="linux": repIcon=self.node.editor.appliEficas.repIcon fichier=os.path.join(repIcon, 'arrow_up.png') @@ -62,12 +60,13 @@ class MonWidgetPlusieursIntoOrdonne (Ui_WidgetPlusieursIntoOrdonne, Feuille,Gere fichier2=os.path.join(repIcon, 'arrow_down.png') icon2 = QIcon(fichier2) self.RBBas.setIcon(icon2) + self.parentQt.commandesLayout.insertWidget(-1,self) - def setValeurs(self): - for i in self.listeLE: - i.close() + def prepareListeResultat(self): + for i in self.listeLE: i.close() self.listeLE=[] + self.vScrollBar = self.scrollArea.verticalScrollBar() listeValeursCourantes=self.node.item.GetListeValeurs() if hasattr(self.node.item.definition.validators,'set_MCSimp'): obj=self.node.item.getObject() @@ -80,12 +79,16 @@ class MonWidgetPlusieursIntoOrdonne (Ui_WidgetPlusieursIntoOrdonne, Feuille,Gere else: self.listeAAfficher=self.node.item.get_liste_possible([]) else : - self.listeAAfficher=self.node.item.get_liste_possible(listeValeursCourantes) + print self.node.item.get_liste_possible + self.listeAAfficher=self.node.item.get_liste_possible(listeValeursCourantes) + if self.listeAAfficher==[] : + self.ajoutLE(0) + return + print self.listeAAfficher if len(self.listeAAfficher)*20 > 400 : self.setMinimumHeight(400) else : self.setMinimumHeight(len(self.listeAAfficher)*30) - self.vScrollBar = self.scrollArea.verticalScrollBar() self.politique=PolitiquePlusieurs(self.node,self.editor) for i in range(1,len(self.listeAAfficher)+1): self.ajoutLE(i) for i in range(len(self.listeAAfficher)): @@ -94,7 +97,8 @@ class MonWidgetPlusieursIntoOrdonne (Ui_WidgetPlusieursIntoOrdonne, Feuille,Gere courant.setText(str(self.listeAAfficher[i])) self.vScrollBar.triggerAction(QScrollBar.SliderToMinimum) - def prepareListeResultat(self): + + def setValeurs(self): listeValeursCourantes=self.node.item.GetListeValeurs() if self.monSimpDef.max == "**" : aConstruire=7 else : aConstruire=self.monSimpDef.max @@ -126,7 +130,8 @@ class MonWidgetPlusieursIntoOrdonne (Ui_WidgetPlusieursIntoOrdonne, Feuille,Gere nouveauLE.setReadOnly(True) if index % 2 == 1 : nouveauLE.setStyleSheet("background:rgb(210,210,210)") else : nouveauLE.setStyleSheet("background:rgb(240,240,240)") - self.vScrollBar.triggerAction(QScrollBar.SliderToMaximum) + self.vScrollBarRE = self.scrollAreaRE.verticalScrollBar() + self.vScrollBarRE.triggerAction(QScrollBar.SliderToMaximum) setattr(self,nomLE,nouveauLE) self.estVisibleRE=nouveauLE if valeur != None : diff --git a/InterfaceQT4/qtEficas.py b/InterfaceQT4/qtEficas.py index f78ff28c..e38f1e61 100644 --- a/InterfaceQT4/qtEficas.py +++ b/InterfaceQT4/qtEficas.py @@ -63,7 +63,6 @@ class Appli(Ui_Eficas,QMainWindow): self.ficRecents={} self.listeAEnlever=[] self.ListeCode=['Aster','Carmel3D','Cuve2dg','Openturns_Study','Openturns_Wrapper','MAP','ZCracks', 'CarmelCND','MT'] - #self.repIcon=os.path.join( os.path.dirname(os.path.abspath(__file__)),'../Editeur/icons') self.repIcon=os.path.join( os.path.dirname(os.path.abspath(__file__)),'..','Editeur','icons') if self.salome: diff --git a/PSEN_Eficas/PSEN_Cata.py b/PSEN_Eficas/PSEN_Cata.py index b8881494..c754ed51 100755 --- a/PSEN_Eficas/PSEN_Cata.py +++ b/PSEN_Eficas/PSEN_Cata.py @@ -226,6 +226,8 @@ CORRELATION = PROC ( nom = 'CORRELATION', structure="symetrique"), fr = "Matrice de correlation entre les variables d'entree", ang = "Correlation matrix for input variables", + #val_max=1.0, + #val_min=-1.0 ), ## #), # Fin BLOC Matrix ## @@ -234,15 +236,15 @@ CORRELATION = PROC ( nom = 'CORRELATION', DIRECTORY = MACRO ( nom = 'DIRECTORY', op=None, - fr = "Chargement des generateurs et des charges", - ang = "Physical model wrapper load", + fr = "Chargement des directoires et fichiers", + ang = "Load directories and files necessary to run PSEN", sd_prod = opsPSEN.INCLUDE, op_init = opsPSEN.INCLUDE_context, #sd_prod=None, fichier_ini = 1, PSSE_path=SIMP(statut="o",typ='Repertoire',defaut='C:\Program Files\PTI\PSSE33\PSSBIN'), - sav_file=SIMP(statut="o", typ = ('Fichier', 'Wrapper Files (*.sav);;All Files (*)',),), + sav_file=SIMP(statut="o", typ = ('Fichier', 'Network Case Files (*.sav);;All Files (*)',),), results_folder=SIMP(statut="o",typ='Repertoire'), #lines_file=SIMP(statut="o" ,typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),), #groups_file=SIMP(statut="o", typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),), @@ -369,12 +371,13 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", # Type de distribution #==== + b_gener_level = BLOC (condition= "Type == 'Generator Power Level'", Law = SIMP ( statut = "o", typ = "TXM", into = ( "Exponential", "Histogram", "Normal", - "Rayleigh", + #"Rayleigh", "PDF_from_file", "TruncatedNormal", "TimeSeries_from_file", @@ -474,8 +477,8 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", FileName = SIMP ( statut = "o", typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',), - fr = "Nom du modele physique", - ang = "Physical model identifier", + fr = "Nom du fichier .csv", + ang = ".csv file name", ), ), @@ -550,8 +553,8 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", Values = SIMP ( statut = 'o', typ = Tuple(2), max = '**', - fr = "Liste de couples : (valeur, probabilite)", - ang = "List of pairs : (value, probability)", + fr = "Liste de couples : (valeur, prob.)", + ang = "List of pairs : (value, prob.)", validators=VerifTypeTuple(('R','R')), ), @@ -621,7 +624,7 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", Transfer_Function = FACT(statut='f', - Input = SIMP ( statut='o', + TF_Input = SIMP ( statut='o', typ = 'TXM', fr = 'Entrer une fonction de transfert à partir d''un fichier .pow (vitesse de vent - puissance eolienne)\n \ ou entrer une liste de tuples (valeur tiree - puissance normalisee)', @@ -629,7 +632,7 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", or enter a generic list of (law output value, normalized power output) tuples', into = ('.pow file', 'tuples list'), ), - b_file = BLOC(condition = "Input == '.pow file'", + b_file = BLOC(condition = "TF_Input == '.pow file'", File_Name = SIMP ( statut = "o", typ = ('Fichier', 'Pow files (*.pow);;All Files (*)',), fr = "Nom du fichier de transfer .pow", @@ -667,9 +670,9 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", ), ), #fin du bloc FileName - b_tuples = BLOC(condition = "Input == 'tuples list'", + b_tuples = BLOC(condition = "TF_Input == 'tuples list'", - Values = SIMP ( statut = 'o', + TF_Values = SIMP ( statut = 'o', typ = Tuple(2), max = '**', min = 2, @@ -681,6 +684,62 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", ), #fin du FACT Transfer Function + ), #fin du bloc generator level + + + b_gener_avail = BLOC (condition= "Type == 'Generator Availability'", + + Law = SIMP ( statut = "o", typ = "TXM", + into = ( #"Exponential", + #"Histogram", + #"Normal", + #"Rayleigh", + #"PDF_from_file", + #"TruncatedNormal", + "TimeSeries_from_file", + #"Uniform", + "UserDefined", + #"Weibull", + ), + fr = "Choix du type de la loi marginale", + ang = "1D marginal distribution", + defaut="UserDefined", + ), + + +#==== +# Definition des parametres selon le type de la loi +#==== + + + TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ", + + FileName = SIMP ( statut = "o", + typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',), + fr = "Fichier CSV d'une serie temporelle", + ang = "CSV file of a time series", + ), + ), + + + USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ", + + # Il faut definir une collection de couples ( x,p ) + Values = SIMP ( statut = 'o', + typ = Tuple(2), + max = '**', + fr = "Liste de couples : (valeur, prob.)", + ang = "List of pairs : (value, prob.)", + validators=VerifTypeTuple(('R','R')), + defaut=((0,0.0),(1,1.0)), + ), + + ), # Fin BLOC USERDEFINED + + + ), #fin du bloc generator avail + + ), #fin du bloc generateur b_charge = BLOC (condition = "ComponentType == 'Load'", @@ -699,11 +758,14 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", Load = SIMP(statut='o',typ=sd_charge,max="**", homo="SansOrdreNiDoublon",), + + b_charge_level = BLOC (condition = "Type == 'Load Level'", + Law = SIMP ( statut = "o", typ = "TXM", into = ( "Exponential", "Histogram", "Normal", - "Rayleigh", + #"Rayleigh", "PDF_from_file", "TruncatedNormal", "TimeSeries_from_file", @@ -803,8 +865,8 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", FileName = SIMP ( statut = "o", typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',), - fr = "Nom du modele physique", - ang = "Physical model identifier", + fr = "Nom du fichier .csv", + ang = ".csv file name", ), ), @@ -947,6 +1009,61 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", ), # Fin BLOC WEIBULL + ), #fin du block Load Level + + + b_charge_avail = BLOC (condition = "Type == 'Load Availability'", + + Law = SIMP ( statut = "o", typ = "TXM", + into = ( #"Exponential", + #"Histogram", + #"Normal", + #"Rayleigh", + #"PDF_from_file", + #"TruncatedNormal", + "TimeSeries_from_file", + #"Uniform", + "UserDefined", + #"Weibull", + ), + fr = "Choix du type de la loi marginale", + ang = "1D marginal distribution", + defaut = "UserDefined", + ), + + +#==== +# Definition des parametres selon le type de la loi +#==== + + TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ", + + FileName = SIMP ( statut = "o", + typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',), + fr = "Fichier CSV d'une serie temporelle", + ang = "CSV file of a time series", + ), + ), + + + + USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ", + + # Il faut definir une collection de couples ( x,p ) + Values = SIMP ( statut = 'o', + typ = Tuple(2), + max = '**', + fr = "Liste de couples : (valeur, probabilite)", + ang = "List of pairs : (value, probability)", + validators=VerifTypeTuple(('R','R')), + defaut=((0,0.0),(1,1.0)), + ), + + ), # Fin BLOC USERDEFINED + + + ), #fin du block Load Avail + ), #fin du bloc charge @@ -974,7 +1091,7 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", #"Rayleigh", #"PDF_from_file", #"TruncatedNormal", - #"TimeSeries_from_file", + "TimeSeries_from_file", #"Uniform", "UserDefined", #"Weibull", @@ -1072,8 +1189,8 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", FileName = SIMP ( statut = "o", typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',), - fr = "Nom du modele physique", - ang = "Physical model identifier", + fr = "Nom du fichier .csv", + ang = ".csv file name", ), ), @@ -1254,7 +1371,7 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", #"PDF_from_file", #"Triangular", #"TruncatedNormal", - #"TimeSeries_from_file", + "TimeSeries_from_file", #"Uniform", "UserDefined", #"Weibull", @@ -1747,8 +1864,8 @@ DISTRIBUTION = OPER ( nom = "DISTRIBUTION", FileName = SIMP ( statut = "o", typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',), - fr = "Nom du modele physique", - ang = "Physical model identifier", + fr = "Nom du fichier .csv", + ang = ".csv file name", ), ), diff --git a/PSEN_Eficas/opsPSEN.py b/PSEN_Eficas/opsPSEN.py index 1e641cfd..ef56370d 100755 --- a/PSEN_Eficas/opsPSEN.py +++ b/PSEN_Eficas/opsPSEN.py @@ -18,8 +18,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico -from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico2 +from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico +#from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico2 def INCLUDE(self,PSSE_path,sav_file,**args): """ diff --git a/UiQT4/desChoixCommandes.ui b/UiQT4/desChoixCommandes.ui index 1a2b13ee..e86d7862 100644 --- a/UiQT4/desChoixCommandes.ui +++ b/UiQT4/desChoixCommandes.ui @@ -6,7 +6,7 @@ 0 0 - 1188 + 1244 652 @@ -29,16 +29,10 @@ background-color : rgb(248,247,246) - - 0 - - - 0 - - + 0 0 @@ -46,13 +40,13 @@ 0 - 116 + 130 16777215 - 116 + 130 @@ -64,7 +58,7 @@ QFrame::Raised - + @@ -125,8 +119,8 @@ - 382 - 18 + 109 + 20 @@ -147,7 +141,13 @@ 141 - 40 + 35 + + + + + 16777215 + 35 @@ -193,32 +193,58 @@ - - - Qt::Vertical - - - - 306 - 5 - - - + + + + + Sensible à la casse + + + + + + + + 0 + 0 + + + + + 200 + 40 + + + + + 200 + 40 + + + + background-color:rgb(104,110,149); +color :white; +border-radius : 12px + + + + Effacer + + + + - + Qt::Horizontal - - QSizePolicy::Minimum - - 48 - 18 + 108 + 20 @@ -290,8 +316,6 @@ - horizontalSpacer - horizontalSpacer_3 @@ -313,8 +337,8 @@ 0 0 - 1170 - 530 + 1226 + 498 diff --git a/generator/generator_python.py b/generator/generator_python.py index 0b855e0a..29cf196b 100644 --- a/generator/generator_python.py +++ b/generator/generator_python.py @@ -529,7 +529,6 @@ class PythonGenerator: Convertit un objet MCSIMP en une liste de chaines de caracteres a la syntaxe python """ - if obj.isInformation() : return "" waitTuple=0 if type(obj.valeur) in (types.TupleType,types.ListType) : s = '' -- 2.39.2