X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FYamsPlug%2FmonYamsPlugDialog.py;h=37a15f6cc591b6ded93d34d83430cbd8253c8c4c;hp=f27bc22b5bb31f57c5e8bae59c29d12ac5df87c0;hb=c445ce74d816a2f89830ef0527a7ef9e76144c5e;hpb=1bd4ba8acdfe7ab1edc96a016836e174a393d445 diff --git a/src/Tools/YamsPlug/monYamsPlugDialog.py b/src/Tools/YamsPlug/monYamsPlugDialog.py index f27bc22b5..37a15f6cc 100644 --- a/src/Tools/YamsPlug/monYamsPlugDialog.py +++ b/src/Tools/YamsPlug/monYamsPlugDialog.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 EDF R&D +# Copyright (C) 2007-2016 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -22,6 +22,7 @@ # Modules Eficas import os, subprocess +import tempfile from YamsPlugDialog_ui import Ui_YamsPlugDialog from monViewText import MonViewText from PyQt4.QtGui import * @@ -76,7 +77,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): v1=QDoubleValidator(self) v1.setBottom(0.) #v1.setTop(1000.) #per thousand... only if relative - v1.setDecimals(2) + v1.setDecimals(3) self.SP_Tolerance.setValidator(v1) self.SP_Tolerance.titleForWarning="Chordal Tolerance" @@ -102,14 +103,20 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): self.connect(self.LE_ParamsFile,SIGNAL("returnPressed()"),self.paramsFileNameChanged) def PBHelpPressed(self): + import SalomePyQt + sgPyQt = SalomePyQt.SalomePyQt() try : mydir=os.environ["SMESH_ROOT_DIR"] except Exception: QMessageBox.warning(self, "Help", "Help unavailable $SMESH_ROOT_DIR not found") return - maDoc=mydir+"/share/doc/salome/gui/SMESH/yams/_downloads/mg-surfopt_user_manual.pdf" - command="xdg-open "+maDoc+";" - subprocess.call(command, shell=True) + + maDoc=mydir+"/share/doc/salome/gui/SMESH/yams/index.html" + sgPyQt.helpContext(maDoc,"") + + #maDoc=mydir+"/share/doc/salome/gui/SMESH/yams/_downloads/mg-surfopt_user_manual.pdf" + #command="xdg-open "+maDoc+";" + #subprocess.call(command, shell=True) def PBOKPressed(self): if not(self.PrepareLigneCommande()): @@ -401,7 +408,11 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): mySObject, myEntry = guihelper.getSObjectSelected() if CORBA.is_nil(mySObject) or mySObject==None: - QMessageBox.critical(self, "Mesh", "select an input mesh") + #QMessageBox.critical(self, "Mesh", "select an input mesh") + self.LE_MeshSmesh.setText("") + self.MeshIn="" + self.LE_MeshFile.setText("") + self.fichierIn="" return self.smeshStudyTool = SMeshStudyTools() try: @@ -420,7 +431,9 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): self.fichierIn="" def prepareFichier(self): - self.fichierIn="/tmp/ForSurfOpt_"+str(self.num)+".meshb" + self.fichierIn=tempfile.mktemp(suffix=".meshb",prefix="ForSurfOpt_") + if os.path.exists(self.fichierIn): + os.remove(self.fichierIn) self.__selectedMesh.ExportGMF(self.__selectedMesh, self.fichierIn, True) def PrepareLigneCommande(self): @@ -475,9 +488,9 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): if self.SP_Ridge.value() != 45.0 : self.commande+=" --ridge_angle %f"%self.SP_Ridge.value() if self.SP_MaxSize.value() != 100 : self.commande+=" --max_size %f" %self.SP_MaxSize.value() if self.SP_MinSize.value() != 5 : self.commande+=" --min_size %f" %self.SP_MinSize.value() - if self.SP_Gradation.value() != 1.3 : self.commande+=" --gradation %f" %self.SP_MaxSize.value() + if self.SP_Gradation.value() != 1.3 : self.commande+=" --gradation %f" %self.SP_Gradation.value() if self.SP_Memory.value() != 0 : self.commande+=" --max_memory %d" %self.SP_Memory.value() - if self.SP_Verbosity.value() != 3 : self.commande+=" --max_memory %d" %self.SP_Verbosity.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 @@ -503,22 +516,24 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): self.CB_Ridge.setChecked(True) self.CB_Point.setChecked(True) self.CB_SplitEdge.setChecked(False) - self.SP_MaxSize.setProperty("value", -2.0) - self.SP_MinSize.setProperty("value", -2.0) + self.SP_MaxSize.setProperty("value", 100) + self.SP_MinSize.setProperty("value", 5) self.SP_Verbosity.setProperty("value", 3) self.SP_Memory.setProperty("value", 0) + self.PBMeshSmeshPressed() + self.TWOptions.setCurrentIndex(0) # Reset current active tab to the first tab __dialog=None def getDialog(): """ This function returns a singleton instance of the plugin dialog. - c est obligatoire pour faire un show sans parent... + It is mandatory in order to call show without a parent ... """ global __dialog if __dialog is None: __dialog = MonYamsPlugDialog() - #else : - # __dialog.clean() + else : + __dialog.clean() return __dialog #