From 31f864e59ac751d1cfb063273844ca86954f2132 Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Mon, 26 Mar 2018 14:24:59 +0200 Subject: [PATCH] Atmo V0 --- Atmo/Cata_V0.py | 79 ++++++++++++++++++++++++++++++++++ Atmo/configuration_Atmo.py | 43 ++++++++++++++++++ Atmo/prefs.py | 22 ++++++++++ Atmo/prefs_Atmo.py | 46 ++++++++++++++++++++ Atmo/properties.py | 24 +++++++++++ Atmo/qtEficasAtmo.py | 38 ++++++++++++++++ generator/generator_TELEMAC.py | 12 +++++- 7 files changed, 262 insertions(+), 2 deletions(-) create mode 100755 Atmo/Cata_V0.py create mode 100644 Atmo/configuration_Atmo.py create mode 100644 Atmo/prefs.py create mode 100644 Atmo/prefs_Atmo.py create mode 100644 Atmo/properties.py create mode 100755 Atmo/qtEficasAtmo.py diff --git a/Atmo/Cata_V0.py b/Atmo/Cata_V0.py new file mode 100755 index 00000000..6e841feb --- /dev/null +++ b/Atmo/Cata_V0.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012-2013 EDF +# +# This file is part of SALOME HYDRO module. +# +# SALOME HYDRO module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SALOME HYDRO module 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with SALOME HYDRO module. If not, see . + +import types +from Accas import * + + +class Tuple: + def __init__(self,ntuple): + self.ntuple=ntuple + + def __convert__(self,valeur): + if type(valeur) == types.StringType: + return None + if len(valeur) != self.ntuple: + return None + return valeur + + def info(self): + return "Tuple de %s elements" % self.ntuple + + __repr__=info + __str__=info + +JdC = JDC_CATA(regles = (UN_PARMI('TELEMAC2D',)), + ) + + + +Atmos = PROC( + nom = "Atmos", op = None, + fr = u"Définition d'un cas d'étude Atmosphérique", + ang = u"Definition of study case", + Wind = FACT( statut='o', + Wind_Speed = SIMP(statut = "o", typ = 'I', sug=20), + Speed_Unit = SIMP(statut = "o", typ = 'TXM', + into = ('knots','mph','m/s'), + defaut = 'mph'), + Measurement = SIMP(statut = "o", typ = 'TXM', + into = ( 'Manual', 'TypeA', 'TypeB'),), + b_enter_mesure = BLOC(condition = 'MEASUREMENT == "Manual"', + Value = SIMP(statut = "o", typ = 'I'), + Unit = SIMP(statut = "o", typ = 'TXM', into = ('feet', 'meters')), + ), + ), + Ground = FACT( statut='o', + Ground_Roughness = SIMP(statut='o',typ='TXM', + into=('Open Country', 'Urban Or Forest', 'Open Water', 'Manual') + ), + b_enter_ground = BLOC(condition = 'Ground_Roughness == "Manual"', + Input_Roughness = SIMP(statut = "o", typ = 'I'), + Unit = SIMP(statut = "o", typ = 'TXM', into = ('in', 'cm'), defaut='cm') + ), + + ), + Cover = FACT( statut='o', + Cover_type = SIMP(statut='o',typ='TXM', into=('Manual', 'Clear','Partly Cloudy','Complete Cover',),), + b_enter_cover = BLOC(condition = 'Cover_type == "Manual"', + Cover_Value = SIMP(statut = "o", typ = 'I',val_max=10), + ), + ), + +) diff --git a/Atmo/configuration_Atmo.py b/Atmo/configuration_Atmo.py new file mode 100644 index 00000000..6a8cc458 --- /dev/null +++ b/Atmo/configuration_Atmo.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# maConfiguration MANAGEMENT OF EDF VERSION +# ====================================================================== +# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG +# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY +# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY +# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR +# (AT YOUR OPTION) ANY LATER VERSION. +# +# THIS PROGRAM 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 +# GENERAL PUBLIC LICENSE FOR MORE DETAILS. +# +# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE +# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, +# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. +# +# +# ====================================================================== +""" + Ce module sert pour charger les paramètres de configuration d'EFICAS +""" +# Modules Python +from InterfaceQT4 import configuration +import os + + +class CONFIG(configuration.configBase): + + #----------------------------------- + def __init__(self,appli,repIni): + #----------------------------------- + + self.labels_user=['catalogues','lang'] + self.labels_eficas=['lang','rep_cata','catalogues'] + self.afficheOptionnelVide=True + configuration.configBase.__init__(self,appli,repIni) + + +def make_config(appli,rep): + return CONFIG(appli,rep) + diff --git a/Atmo/prefs.py b/Atmo/prefs.py new file mode 100644 index 00000000..fd87ecf9 --- /dev/null +++ b/Atmo/prefs.py @@ -0,0 +1,22 @@ +# Copyright (C) 2007-2012 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 +# +code="Atmo" +import sys, os +if os.path.dirname(os.path.abspath(__file__)) not in sys.path : + sys.path.insert(0,os.path.dirname(os.path.abspath(__file__))) diff --git a/Atmo/prefs_Atmo.py b/Atmo/prefs_Atmo.py new file mode 100644 index 00000000..57481bd9 --- /dev/null +++ b/Atmo/prefs_Atmo.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# maConfiguration MANAGEMENT OF EDF VERSION +# ====================================================================== +# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG +# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY +# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY +# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR +# (AT YOUR OPTION) ANY LATER VERSION. +# +# THIS PROGRAM 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 +# GENERAL PUBLIC LICENSE FOR MORE DETAILS. +# +# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE +# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, +# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. +# +# +# ====================================================================== + +import os,sys +# repIni sert a localiser le fichier editeur.ini +# Obligatoire +repIni=os.path.dirname(os.path.abspath(__file__)) +INSTALLDIR=os.path.join(repIni,'..') +sys.path[:0]=[INSTALLDIR] + + +# lang indique la langue utilisee pour les chaines d'aide : fr ou ang +lang='fr' + +# Codage des strings qui accepte les accents (en remplacement de 'ascii') +encoding='iso-8859-1' + +# +catalogues=( + ('Atmo','V2017',os.path.join(repIni,'Cata_V0.py'),'python','python'), +) +nombreDeBoutonParLigne=4 +simpleClic=True +closeFrameRechercheCommande=True +boutonDsMenuBar=False +closeArbre=True +afficheListesPliees=False +afficheCommandesPliees = False diff --git a/Atmo/properties.py b/Atmo/properties.py new file mode 100644 index 00000000..1d328a46 --- /dev/null +++ b/Atmo/properties.py @@ -0,0 +1,24 @@ +#@ MODIF properties Accas DATE 11/06/2008 AUTEUR aster M.ADMINISTRATEUR +# RESPONSABLE D6BHHHH J-P.LEFEBVRE +# ====================================================================== +# COPYRIGHT (C) 1991 - 2001 EDF R&D WWW.CODE-ASTER.ORG +# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY +# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY +# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR +# (AT YOUR OPTION) ANY LATER VERSION. +# +# THIS PROGRAM 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 +# GENERAL PUBLIC LICENSE FOR MORE DETAILS. +# +# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE +# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, +# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. +# ====================================================================== +# IDENTIFICATION DU GESTIONNAIRE DE COMMANDE ACCAS A PARTIR +# DE LA VERSION DU CODE_ASTER ASSOCIE +#---------------------------------------------------------------------- +version = "1.2" +date = "25/05/2010" +exploit = False diff --git a/Atmo/qtEficasAtmo.py b/Atmo/qtEficasAtmo.py new file mode 100755 index 00000000..91140d97 --- /dev/null +++ b/Atmo/qtEficasAtmo.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- 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 +# +""" + Ce module sert a lancer EFICAS configure pour MAP +""" +# Modules Python +# Modules Eficas +import prefs +name='prefs_'+prefs.code +__import__(name) + +import sys +reload(sys) +sys.setdefaultencoding('latin1') +import os +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..')) + +import prefs +from InterfaceQT4 import eficas_go +eficas_go.lanceEficas(code=prefs.code) diff --git a/generator/generator_TELEMAC.py b/generator/generator_TELEMAC.py index 8a2328fb..ad25a7c1 100644 --- a/generator/generator_TELEMAC.py +++ b/generator/generator_TELEMAC.py @@ -62,7 +62,10 @@ class TELEMACGenerator(PythonGenerator): self.statut = statut self.langue = appli.langue - self.TelemacdicoEn = appli.readercata.TelemacdicoEn + try : self.TelemacdicoEn = appli.readercata.TelemacdicoEn + except : + print ('Attention : pas de TelemacdicoEn declare') + self.TelemacdicoEn = {} self.DicoEnumCasEnInverse = {} #from enum_Telemac2d_auto import self.TelemacdicoEn for motClef in self.TelemacdicoEn: @@ -86,7 +89,12 @@ class TELEMACGenerator(PythonGenerator): else : self.listeTelemac = () self.dicoCataToCas={} - self.dicoCasToCata=appli.readercata.dicoCasToCata + try : + self.dicoCasToCata=appli.readercata.dicoCasToCata + except : + print ('Attention pas de dicoCasToCata declare') + self.dicoCasToCata={} + self.dicoCataToCas={} for motClef in self.dicoCasToCata: self.dicoCataToCas[self.dicoCasToCata[motClef]]=motClef -- 2.39.2