Salome HOME
Merge branch 'V7_dev'
[modules/paravis.git] / test / VisuPrs / SWIG_scripts / C7.py
index 58a8da9e2742fb1e76c9f03bd27ec12fa482c454..d45f0ca4bbcb4cf26959fd1b5ecc29030bae9c71 100755 (executable)
@@ -1,9 +1,9 @@
-# Copyright (C) 2010-2013  CEA/DEN, EDF R&D
+# Copyright (C) 2010-2016  CEA/DEN, 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
@@ -25,10 +25,8 @@ import sys
 
 from paravistest import tablesdir, get_picture_dir, pictureext
 from presentations import *
-import paravis
 import pvsimple
 
-
 # Import table from file
 print 'Import file with tables....',
 file_path = tablesdir + "table_test.xls"
@@ -94,11 +92,15 @@ entity = EntityType.NODE
 
 # Get lookup table
 lookup_table = get_lookup_table(table_name, nb_components, vector_mode)
-lookup_table.LockScalarRange = 0
+if hasattr(lookup_table,"LockDataRange"):
+    lookup_table.LockDataRange = 0
+elif hasattr(lookup_table,"LockScalarRange"):
+    lookup_table.LockScalarRange = 0
+else:
+    raise RuntimeError("Object %s has no 'LockDataRange' or 'LockScalarRange' attribute!"%(lookup_table))
 
 # Set properties
-pointmap3d.ColorAttributeType = EntityType.get_pvtype(entity)
-pointmap3d.ColorArrayName = table_name
+pointmap3d.ColorArrayName = (EntityType.get_pvtype(entity), table_name)
 pointmap3d.LookupTable = lookup_table
 
 # Add scalar bar
@@ -108,7 +110,6 @@ add_scalar_bar(table_name, nb_components, vector_mode,
 # Reset view
 reset_view(view=view)
 
-
 # Write image
 
 # Directory for saving snapshots