1 # Copyright (C) 2010-2014 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # This case corresponds to: /visu/dump_study/B1 case
22 from paravistest import tablesdir
23 from presentations import *
25 from pvsimple import *
27 my_paravis = paravis.myParavis
29 # Import table from file
30 xls_file = tablesdir + "tables_test.xls"
31 table_reader = TableReader(FileName=xls_file)
32 if table_reader is None:
33 raise RuntimeError, "Table was not imported..."
35 table_reader.UpdatePipeline()
36 RenameSource("tables_test.xls", table_reader)
39 path_to_save = os.path.join(os.getenv("HOME"), "table.py")
40 SaveTrace(path_to_save)
42 # 3. Delete the created objects
45 # 4. Execution of the created script
46 execfile(path_to_save)
48 # 5. Check the restored table
49 restored_obj = FindSource("tables_test.xls")
50 if restored_obj is None:
51 raise RuntimeError, "There is no tables_test.xls table in the study (must be created by executed python script)!!!"
53 available_tables = restored_obj.GetPropertyValue("AvailableTables")
55 tables = ["Table:0", "Table toto 1", "sinus"]
60 if name not in available_tables:
62 print "ERROR!!! Table with ", name, " name was not found"
65 print "\"" + name + "\" table was found..."
68 print "ERROR!!! "+str(count_not)+" table(s) was(were) not found!!!"
71 raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."