From: Gilles DAVID Date: Tue, 18 Apr 2017 13:43:53 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/V8_3_BR' into ngr/python3_dev X-Git-Tag: V9_0_0~6^2~11 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=e8173b4ff130ddb26d165c92403ef847fdfb8be2 Merge remote-tracking branch 'origin/V8_3_BR' into ngr/python3_dev Conflicts: src/Tools/ZCracksPlug/casTests/launchCas.py src/Tools/padder/spadderpy/gui/inputdialog.py src/Tools/padder/spadderpy/gui/plugindialog.py src/Tools/padder/unittests/usecase_meshJobManager.py --- e8173b4ff130ddb26d165c92403ef847fdfb8be2 diff --cc src/Tools/ZCracksPlug/__init__.py index b06743239,4ae994c94..967dc97cf --- a/src/Tools/ZCracksPlug/__init__.py +++ b/src/Tools/ZCracksPlug/__init__.py @@@ -1,7 -1,15 +1,15 @@@ import sys, os, shutil, pickle, tempfile -import main, genereCrack, Zset -import utilityFunctions as uF +from Zcracks import main, genereCrack, Zset +from Zcracks import utilityFunctions as uF + os.environ['QT_QPA_PLATFORM_PLUGIN_PATH']=os.path.join(os.environ['QTDIR'],'plugins','platforms') + + if 'MESHGEMSHOME' in os.environ: + meshgemsdir=os.environ['MESHGEMSHOME'] + if len(meshgemsdir) > 0: + meshgems=meshgemsdir.split(os.sep)[-1] + uF.removeFromSessionPath('LD_LIBRARY_PATH', meshgems) + #commande="/bin/bash -c ""source $HOME/zebulon/Z8.6.6_NEW/do_config_bash""" #os.system(commande) @@@ -29,10 -34,9 +34,9 @@@ def SCRIPT(dataFile=None, data=None, di if data==None: data=pickle.load(open(dataFile,'r')) - print data + print(data) - tmpdir=tempfile.mkdtemp() - uF.removeFromSessionPath('LD_LIBRARY_PATH', 'Meshgems-2111') + tmpdir=tempfile.mkdtemp(prefix='tmpZcracks') if names==None: names={'saneGeoName':'salome_sane', 'crackGeoName':'salome_crack', 'crackedGeoName':'salome_cracked'} diff --cc src/Tools/ZCracksPlug/casTests/launchCas.py index 3522ee67e,4672776ec..592305cce --- a/src/Tools/ZCracksPlug/casTests/launchCas.py +++ b/src/Tools/ZCracksPlug/casTests/launchCas.py @@@ -18,16 -18,16 +18,16 @@@ import strin #tmpdir = "/local00/home/B27118/projets/Zcracks/Zcracks/casTests/tmpdir" #if not os.path.isdir(tmpdir): os.mkdir(tmpdir) - tmpdir=tempfile.mktemp(prefix='tmpZcracks') + tmpdir=tempfile.mkdtemp(prefix='tmpZcracks') -print "tmpdir=", tmpdir +print("tmpdir=", tmpdir) - meshgemsdir=os.environ('MESHGEMSHOME') - if len(meshgemsdir) > 0: - meshgems=string.split(meshgemsdir,os.sep)[-1] - uF.removeFromSessionPath('LD_LIBRARY_PATH', meshgems) + #meshgemsdir=os.environ('MESHGEMSHOME') + #if len(meshgemsdir) > 0: + #meshgems=string.split(meshgemsdir,os.sep)[-1] + #uF.removeFromSessionPath('LD_LIBRARY_PATH', meshgems) def LAUNCH(listCas=[]): - if type(listCas)!=list: listCas=[listCas] + if not isinstance(listCas, list): listCas=[listCas] N=20 L=1. @@@ -194,7 -194,7 +194,7 @@@ OK=[] NOOK=[] - for s in list(synthese.keys()): - for s in synthese.keys(): ++ for s in synthese: if synthese[s]: OK.append(s) else: diff --cc src/Tools/ZCracksPlug/main.py index 347c7c0ad,4d3384de0..fb75c82e1 --- a/src/Tools/ZCracksPlug/main.py +++ b/src/Tools/ZCracksPlug/main.py @@@ -1,19 -1,15 +1,15 @@@ import sys, pickle, tempfile, shutil from os import path, getpid, environ, remove, system - try: - from PyQt5.QtCore import * - from PyQt5.QtGui import * - from PyQt5.QtWidgets import * - except: - from PyQt4.QtCore import * - from PyQt4.QtGui import * + from PyQt5.QtCore import * + from PyQt5.QtGui import * + from PyQt5.QtWidgets import * -import utilityFunctions as uF -import genereCrack, Zset, output, zcracks_ui +from . import utilityFunctions as uF +from . import genereCrack, Zset, output, zcracks_ui -from output import message, init -from zcracks_ui import Ui_Zui +from .output import message, init +from .zcracks_ui import Ui_Zui # --------------------- @@@ -287,23 -262,15 +262,15 @@@ class ShipHolderApplication(QGroupBox) for cont, obj in enumerate(self.lineEditObjects): if self.lineEditTypes[cont] in [float, int]: - obj.setText(QString(self.data['TXT'+self.lineEditNames[cont]])) + obj.setText(self.data['TXT'+self.lineEditNames[cont]]) else: - obj.setText(QString(self.data[self.lineEditNames[cont]])) + obj.setText(self.data[self.lineEditNames[cont]]) - self.ui.CBQuad.setChecked(True if 'quad' in self.data.keys() and self.data['quad'] else False) - self.ui.CBBarsoum.setChecked(True if 'barsoum' in self.data.keys() and self.data['barsoum'] else False) - self.ui.CBIs2D.setChecked(True if 'is2D' in self.data.keys() and self.data['is2D'] else False) - self.ui.CBRefine.setChecked(True if 'refine' in self.data.keys() and self.data['refine'] else False) + self.ui.CBQuad.setChecked(True if 'quad' in list(self.data.keys()) and self.data['quad'] else False) + self.ui.CBBarsoum.setChecked(True if 'barsoum' in list(self.data.keys()) and self.data['barsoum'] else False) + self.ui.CBIs2D.setChecked(True if 'is2D' in list(self.data.keys()) and self.data['is2D'] else False) + self.ui.CBRefine.setChecked(True if 'refine' in list(self.data.keys()) and self.data['refine'] else False) - - - - - #if self.data['quad']: self.ui.CBQuad.setChecked(True) - #if self.data['barsoum']: self.ui.CBBarsoum.setChecked(True) - #if self.data['is2D']: self.ui.CBIs2D.setChecked(True) - #if self.data['refine']: self.ui.CBRefine.setChecked(True) self.setTableParameters() diff --cc src/Tools/padder/spadderpy/gui/inputdialog.py index a5e08488c,a05007792..6620020b7 --- a/src/Tools/padder/spadderpy/gui/inputdialog.py +++ b/src/Tools/padder/spadderpy/gui/inputdialog.py @@@ -231,7 -240,7 +240,7 @@@ class InputDialog(GenericDialog) """ # if the entry already exists, we remove it to replace by a # new one - if meshName in self.__dictInputData: - if self.__dictInputFiles.has_key(meshName): ++ if meshName in self.__dictInputFiles: self.__delInputFromMap(meshName) inputData = InputData() @@@ -278,29 -287,38 +287,38 @@@ else: self.__nbSteelbarMesh -= 1 - print inputData - print "nb concrete mesh ",self.__nbConcreteMesh - print "nb steelbar mesh ",self.__nbSteelbarMesh + print(inputData) + print("nb concrete mesh ",self.__nbConcreteMesh) + print("nb steelbar mesh ",self.__nbSteelbarMesh) - def setData(self, listInputData=[]): + def setData(self, dictInputData={}): """ This function fills the dialog widgets with values provided by the specified data list. """ self.clear() - for inputData in listInputData: - if dictInputData.has_key(INPUTDATA_KEY_FILES): ++ if INPUTDATA_KEY_FILES in dictInputData: + listInputData = dictInputData["meshfiles"] + for inputData in listInputData: - meshName = inputData.meshName - meshObject = inputData.meshObject - meshType = inputData.meshType - groupName = inputData.groupName - meshName = inputData.meshName ++ meshName = inputData.meshName + meshObject = inputData.meshObject - meshType = inputData.meshType - groupName = inputData.groupName ++ meshType = inputData.meshType ++ groupName = inputData.groupName - self.__addInputInGui(meshName, meshObject, meshType, groupName) - self.__addInputInMap(meshName, meshObject, meshType, groupName) + self.__addInputInGui(meshName, meshObject, meshType, groupName) + self.__addInputInMap(meshName, meshObject, meshType, groupName) - if not DEBUG_MODE: - self.onSelectSmeshObject() + if not DEBUG_MODE: + self.onSelectSmeshObject() + - if dictInputData.has_key(INPUTDATA_KEY_PARAM): - dictInputParameters = dictInputData[INPUTDATA_KEY_PARAM] - if dictInputParameters.has_key(PARAM_KEY_NBITER): ++ if INPUTDATA_KEY_PARAM in dictInputData: ++ dictInputParameters = dictInputData[INPUTDATA_KEY_PARAM] ++ if PARAM_KEY_NBITER in dictInputParameters: + self.__ui.txtParamNbIter.setValue(dictInputParameters[PARAM_KEY_NBITER]) - if dictInputParameters.has_key(PARAM_KEY_RMAXRMIN): ++ if PARAM_KEY_RMAXRMIN in dictInputParameters: + self.__ui.txtParamRminRmax.setValue(dictInputParameters[PARAM_KEY_RMAXRMIN]) def getData(self): """ diff --cc src/Tools/padder/spadderpy/gui/plugindialog.py index c3f30e55b,4fec4e8d3..ba00df765 --- a/src/Tools/padder/spadderpy/gui/plugindialog.py +++ b/src/Tools/padder/spadderpy/gui/plugindialog.py @@@ -22,9 -22,10 +22,10 @@@ from qtsalome import QDialog, QIcon, Qt -from plugindialog_ui import Ui_PluginDialog -from inputdialog import InputDialog, INPUTDATA_KEY_FILES, INPUTDATA_KEY_PARAM -from inputdialog import PARAM_KEY_NBITER, PARAM_KEY_RMAXRMIN -from inputdata import InputData +from salome.smesh.spadder.gui.plugindialog_ui import Ui_PluginDialog - from salome.smesh.spadder.gui.inputdialog import InputDialog ++from salome.smesh.spadder.gui.inputdialog import InputDialog, INPUTDATA_KEY_FILES, INPUTDATA_KEY_PARAM ++from salome.smesh.spadder.gui.inputdialog import PARAM_KEY_NBITER, PARAM_KEY_RMAXRMIN +from salome.smesh.spadder.gui.inputdata import InputData # __GBO__: uncomment this line and comment the previous one to use the # demo input dialog instead of the real one. #from demoinputdialog import InputDialog @@@ -283,8 -291,16 +291,16 @@@ class PluginDialog(QDialog) group_name = inputData.groupName) meshJobFileList.append(parameter) + # And to create a list of the additional parameters. + # WARN: the CORBA interface requires string values. + meshJobParameterList=[] - for inputParameterKey in self.__dictInputParameters.keys(): ++ for inputParameterKey in self.__dictInputParameters: + value = self.__dictInputParameters[inputParameterKey] + parameter = MESHJOB.MeshJobParameter(name=inputParameterKey,value=str(value)) + meshJobParameterList.append(parameter) + jobManager = self.__getJobManager() - self.__jobid = jobManager.initialize(meshJobFileList, self.__configId) + self.__jobid = jobManager.initialize(meshJobFileList, meshJobParameterList, self.__configId) if self.__jobid < 0: self.__log("ERR: the job can't be initialized") self.__log("ERR: %s"%jobManager.getLastErrorMessage()) diff --cc src/Tools/padder/unittests/usecase_meshJobManager.py index 393840239,3f705458f..4fe3da6d9 --- a/src/Tools/padder/unittests/usecase_meshJobManager.py +++ b/src/Tools/padder/unittests/usecase_meshJobManager.py @@@ -172,9 -172,9 +172,9 @@@ meshJobParameterList.append(param jobid = component.initialize(meshJobFileList, meshJobParameterList, configId) if jobid<0: msg = component.getLastErrorMessage() - print "ERR: %s"%msg + print("ERR: %s"%msg) sys.exit(1) - + created = False nbiter = 0 while not created: @@@ -217,15 -217,15 +217,15 @@@ while not ended ended=True time.sleep(0.5) nbiter+=1 - + if state not in end_states: - print "ERR: jobid = "+str(jobid)+" ended abnormally with state="+str(state) + print("ERR: jobid = "+str(jobid)+" ended abnormally with state="+str(state)) msg = component.getLastErrorMessage() - print("ERR: %s"%msg) - print "ERR: %s"%msg ++ print("ERR: %s"%msg) else: - print "OK: jobid = "+str(jobid)+" ended with state="+str(state) + print("OK: jobid = "+str(jobid)+" ended with state="+str(state)) meshJobResults = component.finalize(jobid) - print meshJobResults + print(meshJobResults) if meshJobResults.status is not True: - print "ERR: the results are not OK: %s"%component.getLastErrorMessage() - print "ERR: see log files in %s"%meshJobResults.results_dirname + print("ERR: the results are not OK: %s"%component.getLastErrorMessage()) + print("ERR: see log files in %s"%meshJobResults.results_dirname)