]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Merge remote-tracking branch 'origin/V8_3_BR' into ngr/python3_dev
authorGilles DAVID <gilles-g.david@edf.fr>
Tue, 18 Apr 2017 13:43:53 +0000 (15:43 +0200)
committerGilles DAVID <gilles-g.david@edf.fr>
Tue, 18 Apr 2017 13:57:30 +0000 (15:57 +0200)
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

1  2 
src/Tools/ZCracksPlug/__init__.py
src/Tools/ZCracksPlug/casTests/launchCas.py
src/Tools/ZCracksPlug/main.py
src/Tools/ZCracksPlug/utilityFunctions.py
src/Tools/padder/spadderpy/gui/inputdialog.py
src/Tools/padder/spadderpy/gui/plugindialog.py
src/Tools/padder/unittests/usecase_meshJobManager.py

index b06743239d89cb19450d834bcd7e059821ab6dad,4ae994c9491a12cf157772f5d48e27d00246b9d3..967dc97cf00d65775ff9be8ede697db90a2845d0
@@@ -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'}
  
index 3522ee67e1583d24a2107b1a8e9d3a928c95b5fd,4672776ec901f77b553ea1717468fb5be5a746fc..592305cce677585d3e9ceb3417ede4d1d66cdb90
@@@ -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.
  
    OK=[]
    NOOK=[]
-   for s in list(synthese.keys()):
 -  for s in synthese.keys():
++  for s in synthese:
      if synthese[s]:
        OK.append(s)
      else:
index 347c7c0ada26148e9af2b378287c1fffd2b943a0,4d3384de0d64aeb04d6eab57462b60ac78048465..fb75c82e1f386965d7f8875451d58bdebfb3cd27
@@@ -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()
  
  
index a5e08488c43b6a72cf6bb0608e1c07e918505724,a050077922fbd93f567a0bfb5521a33645db71c0..6620020b71b899e1a5ee9c0999d28159aae9859c
@@@ -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()
          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):
          """
index c3f30e55b4b91c165580c2d01934ee3db9c7c669,4fec4e8d375a091325aa6d7f703ee01b3c5216b8..ba00df765c989578370e14397d8f0ae2f0b73fca
  
  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)
  
 -        for inputParameterKey in self.__dictInputParameters.keys():
+         # And to create a list of the additional parameters.
+         # WARN: the CORBA interface requires string values.
+         meshJobParameterList=[]
++        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())
index 393840239d54ca1bcbdeb9df9881f6bd41ff8021,3f705458f0dd146fa52c530edd53da1250a1ed96..4fe3da6d91f45bcf060e8cea72607de816a596fa
@@@ -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)