# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2011-2016 EDF R&D
+# Copyright (C) 2011-2021 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
from qtsalome import QDialog, QIcon, Qt
-from plugindialog_ui import Ui_PluginDialog
-from .inputdialog import InputDialog
-from .inputdata import InputData
+from salome.smesh.spadder.gui.plugindialog_ui import Ui_PluginDialog
+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
from omniORB import CORBA
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
import MESHJOB
gui_states = ["CAN_SELECT", "CAN_COMPUTE", "CAN_REFRESH", "CAN_PUBLISH"]
def setupJobManager(self):
'''
- This function configures the jobmanager by transmiting the
+ This function configures the jobmanager by transmitting the
parameters required for a local execution and a remote
execution. The choice between "local" and "remote" is done at
- the initialize step, by specifing the name of the resource to
+ the initialize step, by specifying the name of the resource to
be used.
'''
# We first
name. This returns the filename.
'''
filename=str("/tmp/padder_inputfile_"+meshName+".med")
- meshObject.ExportToMEDX( filename, 0, SMESH.MED_V2_2, 1, 1 )
+ meshObject.ExportMED(filename, False, True, True)
return filename
def clear(self):
This function clears the log area and the states of the buttons
"""
self.__listInputData = []
+ self.__dictInputParameters = {}
self.__ui.txtLog.clear()
self.__setGuiState(["CAN_SELECT"])
self.__isRunning = False
windows to process the validation event (see the slot
onProcessInput which is connected to this event).
'''
- self.__inputDialog.setData(self.__listInputData)
+ dictInputData = {}
+ dictInputData[INPUTDATA_KEY_FILES] = self.__listInputData
+ dictInputData[INPUTDATA_KEY_PARAM] = self.__dictInputParameters
+ self.__inputDialog.setData(dictInputData)
self.__inputDialog.open()
def onProcessInput(self):
"""
# The processing simply consists in requesting the input data
# from the dialog window.
- self.__listInputData = self.__inputDialog.getData()
+ dictInputData = self.__inputDialog.getData()
+ self.__listInputData = dictInputData[INPUTDATA_KEY_FILES]
+ self.__dictInputParameters = dictInputData[INPUTDATA_KEY_PARAM]
+
self.__ui.lblStatusBar.setText("Input data OK")
self.__log("INF: Press \"Compute\" to start the job")
self.__setGuiState(["CAN_SELECT", "CAN_COMPUTE"])
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:
+ 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())
medfilename = os.path.join(meshJobResults.results_dirname,
meshJobResults.outputmesh_filename)
- smesh.SetCurrentStudy(studyedit.getActiveStudy())
+ smesh.UpdateStudy()
([outputMesh], status) = smesh.CreateMeshesFromMED(medfilename)
# By convention, the name of the output mesh in the study is
meshname = 'padder_'+str(self.__jobid)
smesh.SetName(outputMesh.GetMesh(), meshname)
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(False)
+ salome.sg.updateObjBrowser()
self.__ui.lblStatusBar.setText("Publication OK")
self.__setGuiState(["CAN_SELECT"])