Salome HOME
23288: [CEA 1626] Meshgems v2.3
[modules/smesh.git] / src / Tools / MGCleanerPlug / MGCleanerplug_plugin.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2013-2016  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 qtsalome import QFileDialog, QMessageBox
34   
35   #prior test to avoid unnecessary user GUI work with ending crash
36   try :
37       os.environ['DISTENE_LICENSE_FILE']
38   except:
39       QMessageBox.warning(None, "Products", """\
40 Distene's product MeshGem Cleaner is not installed.
41 required environment variable:
42 DISTENE_LICENSE_FILE='.../dlim8.var.sh'""")
43       return
44   import MGCleanerMonPlugDialog
45   window = MGCleanerMonPlugDialog.getDialog()
46   window.show()
47