Salome HOME
Merge remote branch 'origin/gdd/translations'
[modules/smesh.git] / src / Tools / MGCleanerPlug / MGCleanerplug_plugin.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2013-2015  EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 # if you already have plugins defined in a salome_plugins.py file, add this file at the end.
22 # if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py
23
24 def MGCleanerLct(context):
25   # get context study, studyId, salomeGui
26   study = context.study
27   studyId = context.studyId
28   sg = context.sg
29   
30   import os
31   import subprocess
32   import tempfile
33   from PyQt4 import QtCore
34   from PyQt4 import QtGui
35   from PyQt4.QtGui import QFileDialog
36   from PyQt4.QtGui import QMessageBox
37   
38   #prior test to avoid unnecessary user GUI work with ending crash
39   try :
40       os.environ['DISTENE_LICENCE_FILE_FOR_MGCLEANER']
41   except:
42       QMessageBox.warning(None,"Products","Distene's product MeshGem Cleaner is not installed.\nrequired environment variable:\nDISTENE_LICENCE_FILE_FOR_MGCLEANER='/.../dlim8.var.sh'")
43       return
44   import MGCleanerMonPlugDialog
45   window=MGCleanerMonPlugDialog.getDialog()
46   window.show()
47