Salome HOME
Merge branch 'V8_3_BR' into ngr/python3_dev
[modules/smesh.git] / doc / salome / gui / SMESH / collect_mesh_methods.py
index 8f524bc2defe200d4e7d2a9f237816befe330e7c..da53d4ee664ee6afb9f162bc1dd5e1e58a57d382 100755 (executable)
@@ -1,11 +1,11 @@
 #!/usr/bin/env python
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # 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
@@ -31,7 +31,7 @@
 # class.
 # 
 # This script is intended for internal usage - only
-# for generatation of the extra developer documentation for
+# for generation of the extra developer documentation for
 # the meshing plug-in(s).
 # 
 # Usage:
 #
 ################################################################################
 
+import inspect
 import sys
 
 def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
     plugin_module_name  = plugin_name + "Builder"
     plugin_module       = "salome.%s.%s" % (plugin_name, plugin_module_name)
-    if dummymeshhelp:
-        namespace = plugin_name
-    else:
-        namespace = "SMESH_SWIG"
-    plugin_module_short = "%s.%s" % (namespace, plugin_module_name)
     try:
         exec( "from salome.smesh.smeshBuilder import *")
         exec( "import %s" % plugin_module )
@@ -64,7 +60,7 @@ def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
         for attr in dir( mod ):
             if attr.startswith( '_' ): continue
             algo = getattr( mod, attr )
-            if type( algo ).__name__ == 'classobj' and hasattr( algo, "meshMethod" ):
+            if inspect.isclass(algo) and hasattr(algo, "meshMethod"):
                 method = getattr( algo, "meshMethod" )
                 if method not in methods: methods[ method ] = []
                 methods[ method ].append( algo )
@@ -73,7 +69,7 @@ def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
         if methods:
             output = []
             if dummymeshhelp:
-                output.append( "## @package smesh" )
+                output.append( "## @package smeshBuilder" )
                 output.append( "#  Documentation of the methods dynamically added by the " + plugin_name + " meshing plug-in to the Mesh class." )
                 output.append( "" )
                 pass
@@ -83,7 +79,7 @@ def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
                 # Add dummy Mesh help
                 # This is supposed to be done when generating documentation for meshing plug-ins
                 output.append( "#  @note The documentation below does not provide complete description of class @b %Mesh" )
-                output.append( "#  from @b %smesh.py package. This documentation provides only information about" )
+                output.append( "#  from @b smeshBuilder package. This documentation provides only information about" )
                 output.append( "#  the methods dynamically added to the %Mesh class by the " + plugin_name + " plugin" )
                 output.append( "#  For more details on the %Mesh class, please refer to the SALOME %Mesh module" )
                 output.append( "#  documentation." )
@@ -112,7 +108,7 @@ def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
                 output.append( " #  @param algo_type type of algorithm to be created; allowed values are specified by classes implemented by plug-in (see below)" )
                 output.append( " #  @param geom_shape if defined, the subshape to be meshed (GEOM_Object)" )
                 output.append( " #  @return An instance of Mesh_Algorithm sub-class according to the specified @a algo_type, see " )
-                output.append( " #  %s" % ", ".join( [ "%s.%s" % ( plugin_module_short, algo.__name__ ) for algo in methods[ method ] ] ) )
+                output.append( " #  %s" % ", ".join( [ "%s.%s" % ( plugin_module_name, algo.__name__ ) for algo in methods[ method ] ] ) )
                 output.append( " def %s(algo_type, geom_shape=0):" % method )
                 output.append( "   pass" )
                 pass
@@ -121,8 +117,8 @@ def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
             f.close()
             pass
         pass
-    except Exception, e:
-        print e
+    except Exception as e:
+        print(e)
         pass
     pass