X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FYamsPlug%2FmonYamsPlugDialog.py;h=dba2a29cc5d4d5df14fb5d36a9b7c096f507c46e;hp=90e4917971f0affb707c86f068f83f7d7abce4ec;hb=499f29d24922cec66e41b41a0039a954993bc6df;hpb=5260bd00bd51567f6137d5ea7ae0564464c4290a diff --git a/src/Tools/YamsPlug/monYamsPlugDialog.py b/src/Tools/YamsPlug/monYamsPlugDialog.py index 90e491797..dba2a29cc 100644 --- a/src/Tools/YamsPlug/monYamsPlugDialog.py +++ b/src/Tools/YamsPlug/monYamsPlugDialog.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2016 EDF R&D +# Copyright (C) 2007-2022 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 @@ -69,7 +69,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): self.PB_MeshFile.setToolTip("source mesh from a file in disk") #Ces parametres ne sont pas remis a rien par le clean - self.paramsFile= os.path.abspath(os.path.join(os.environ["HOME"],".MGSurfOpt.dat")) + self.paramsFile= os.path.abspath(os.path.join(os.path.expanduser("~"),".MGSurfOpt.dat")) self.LE_ParamsFile.setText(self.paramsFile) self.LE_MeshFile.setText("") self.LE_MeshSmesh.setText("") @@ -80,7 +80,9 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): v1.setDecimals(3) self.SP_Tolerance.setValidator(v1) self.SP_Tolerance.titleForWarning="Chordal Tolerance" - + + self.SP_MinSize.setDecimals(5) + self.resize(800, 600) self.clean() @@ -130,13 +132,13 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): import SMESH from salome.kernel import studyedit from salome.smesh import smeshBuilder - smesh = smeshBuilder.New(salome.myStudy) + smesh = smeshBuilder.New() if not os.path.isfile(self.fichierOut): QMessageBox.warning(self, "Compute", "Result file "+self.fichierOut+" not found") - maStudy=studyedit.getActiveStudy() - smesh.SetCurrentStudy(maStudy) + maStudy=salome.myStudy + smesh.UpdateStudy() (outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut) name=str(self.LE_MeshSmesh.text()) initialMeshFile=None @@ -178,7 +180,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): newLink=monStudyBuilder.NewObject(SOMesh) monStudyBuilder.Addreference(newLink, newStudyIter) - if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False) + if salome.sg.hasDesktop(): salome.sg.updateObjBrowser() self.num+=1 return True @@ -236,7 +238,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): ACmt = myBuilder.FindOrCreateAttribute(myObject, "AttributeComment") ACmt.SetValue(datai) - if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False) + if salome.sg.hasDesktop(): salome.sg.updateObjBrowser() self.num += 1 if verbose: print(("save %s in Object Browser done: %s\n%s" % (name, myObject.GetID(), datai))) return True @@ -254,10 +256,10 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): QMessageBox.warning(self, "Save", "waiting for fix: Object Browser will not display hypothesis") if verbose: print("save hypothesis in Object Browser") - smesh = smeshBuilder.New(salome.myStudy) + smesh = smeshBuilder.New() - maStudy=studyedit.getActiveStudy() - smesh.SetCurrentStudy(maStudy) + maStudy=salome.myStudy + smesh.UpdateStudy() self.editor = studyedit.getStudyEditor() moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH") @@ -273,7 +275,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): data = self.getResumeData(separator=" ; ") self.editor.setAttributeValue(newStudyIter, "AttributeComment", data) - if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False) + if salome.sg.hasDesktop(): salome.sg.updateObjBrowser() self.num += 1 if verbose: print(("save %s in Object Browser done:\n%s" % (name, data))) return True @@ -334,7 +336,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): for slig in reversed(text.split(separator)): lig=slig.strip() #print "load ResumeData",lig - if lig=="": continue #skip blanck lines + if lig=="": continue #skip blank lines if lig[0]=="#": break try: tit,value=lig.split("=") @@ -413,16 +415,17 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): if fd.exec_(): infile = fd.selectedFiles()[0] self.LE_MeshFile.setText(infile) - self.fichierIn=str(infile).encode("latin-1") + self.fichierIn=str(infile) self.MeshIn="" self.LE_MeshSmesh.setText("") + self.__selectedMesh=None def setParamsFileName(self): fd = QFileDialog(self, "select a file", self.LE_ParamsFile.text(), "dat Files (*.dat);;All Files (*)") if fd.exec_(): infile = fd.selectedFiles()[0] self.LE_ParamsFile.setText(infile) - self.paramsFile=str(infile).encode("latin-1") + self.paramsFile=str(infile) def meshFileNameChanged(self): self.fichierIn=str(self.LE_MeshFile.text()) @@ -452,7 +455,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): from salome.smesh.smeshstudytools import SMeshStudyTools from salome.gui import helper as guihelper from salome.smesh import smeshBuilder - smesh = smeshBuilder.New(salome.myStudy) + smesh = smeshBuilder.New() mySObject, myEntry = guihelper.getSObjectSelected() if CORBA.is_nil(mySObject) or mySObject==None: @@ -504,7 +507,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): except: pass - style = str(self.style).encode("latin-1") + style = str(self.style) # Translation of old Yams options to new MG-SurfOpt options if style == "0" : self.commande+= " --optimisation only" @@ -540,8 +543,12 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): if self.SP_Memory.value() != 0 : self.commande+=" --max_memory %d" %self.SP_Memory.value() if self.SP_Verbosity.value() != 3 : self.commande+=" --verbose %d" %self.SP_Verbosity.value() - self.commande+=" --in " + self.fichierIn - self.commande+=" --out " + self.fichierOut + self.commande+=' --in "' + self.fichierIn +'"' + self.commande+=' --out "' + self.fichierOut +'"' + + import SMeshHelper + key = SMeshHelper.GetMGLicenseKey( self.fichierIn ) + self.commande+=' --key ' + key print(self.commande) return True