X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FYamsPlug%2FmonYamsPlugDialog.py;h=27953a1b8968fe15e4007df1d617fe3845393d70;hp=44cce78ca85eb0abf762ec71f5cb46cef81fc9c2;hb=eb75a450cceabb83064e079ca4f907bde33b38de;hpb=271a3fb6bb3074155e44fc7b7efb04a02c34c4f0 diff --git a/src/Tools/YamsPlug/monYamsPlugDialog.py b/src/Tools/YamsPlug/monYamsPlugDialog.py index 44cce78ca..27953a1b8 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-2015 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 @@ -24,9 +24,7 @@ import os, subprocess from YamsPlugDialog_ui import Ui_YamsPlugDialog from monViewText import MonViewText -from PyQt4.QtGui import * -from PyQt4.QtCore import * - +from qtsalome import * class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): """ @@ -76,7 +74,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" @@ -84,32 +82,38 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): self.clean() def connecterSignaux(self) : - self.connect(self.PB_Cancel,SIGNAL("clicked()"),self.PBCancelPressed) - self.connect(self.PB_Default,SIGNAL("clicked()"),self.clean) - self.connect(self.PB_Help,SIGNAL("clicked()"),self.PBHelpPressed) - self.connect(self.PB_OK,SIGNAL("clicked()"),self.PBOKPressed) + self.PB_Cancel.clicked.connect(self.PBCancelPressed) + self.PB_Default.clicked.connect(self.clean) + self.PB_Help.clicked.connect(self.PBHelpPressed) + self.PB_OK.clicked.connect(self.PBOKPressed) - self.connect(self.PB_Load,SIGNAL("clicked()"),self.PBLoadPressed) - self.connect(self.PB_Save,SIGNAL("clicked()"),self.PBSavePressed) - self.connect(self.PB_LoadHyp,SIGNAL("clicked()"),self.PBLoadHypPressed) - self.connect(self.PB_SaveHyp,SIGNAL("clicked()"),self.PBSaveHypPressed) + self.PB_Load.clicked.connect(self.PBLoadPressed) + self.PB_Save.clicked.connect(self.PBSavePressed) + self.PB_LoadHyp.clicked.connect(self.PBLoadHypPressed) + self.PB_SaveHyp.clicked.connect(self.PBSaveHypPressed) - self.connect(self.PB_MeshFile,SIGNAL("clicked()"),self.PBMeshFilePressed) - self.connect(self.PB_MeshSmesh,SIGNAL("clicked()"),self.PBMeshSmeshPressed) - self.connect(self.LE_MeshSmesh,SIGNAL("returnPressed()"),self.meshSmeshNameChanged) - self.connect(self.PB_ParamsFileExplorer,SIGNAL("clicked()"),self.setParamsFileName) - self.connect(self.LE_MeshFile,SIGNAL("returnPressed()"),self.meshFileNameChanged) - self.connect(self.LE_ParamsFile,SIGNAL("returnPressed()"),self.paramsFileNameChanged) + self.PB_MeshFile.clicked.connect(self.PBMeshFilePressed) + self.PB_MeshSmesh.clicked.connect(self.PBMeshSmeshPressed) + self.LE_MeshSmesh.returnPressed.connect(self.meshSmeshNameChanged) + self.PB_ParamsFileExplorer.clicked.connect(self.setParamsFileName) + self.LE_MeshFile.returnPressed.connect(self.meshFileNameChanged) + self.LE_ParamsFile.returnPressed.connect(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()): @@ -358,7 +362,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): if fd.exec_(): infile = fd.selectedFiles()[0] self.LE_MeshFile.setText(infile) - self.fichierIn=infile.toLatin1() + self.fichierIn=unicode(infile).encode("latin-1") self.MeshIn="" self.LE_MeshSmesh.setText("") @@ -367,7 +371,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): if fd.exec_(): infile = fd.selectedFiles()[0] self.LE_ParamsFile.setText(infile) - self.paramsFile=infile.toLatin1() + self.paramsFile=unicode(infile).encode("latin-1") def meshFileNameChanged(self): self.fichierIn=str(self.LE_MeshFile.text()) @@ -447,7 +451,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): except: pass - style = self.style.toLatin1() + style = unicode(self.style).encode("latin-1") # Translation of old Yams options to new MG-SurfOpt options if style == "0" : self.commande+= " --optimisation only" @@ -479,7 +483,7 @@ 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+=" --verbose %d" %self.SP_Verbosity.value() @@ -507,8 +511,8 @@ 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() @@ -518,7 +522,7 @@ __dialog=None def getDialog(): """ This function returns a singleton instance of the plugin dialog. - It is mandatory in order to call show witout a parent ... + It is mandatory in order to call show without a parent ... """ global __dialog if __dialog is None: @@ -534,10 +538,9 @@ def getDialog(): # def TEST_MonYamsPlugDialog(): import sys - from PyQt4.QtGui import QApplication - from PyQt4.QtCore import QObject, SIGNAL, SLOT + from qtsalome import QApplication app = QApplication(sys.argv) - QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) + app.lastWindowClosed.connect(app.quit) dlg=MonYamsPlugDialog() dlg.show()