Salome HOME
91e4adcbca58530ba41c4b8e0609f7cdb73d2c96
[modules/hydrosolver.git] / src / salome_hydro / interpolz_gui.py
1
2 import sys, os
3 sys.path.append(os.path.join(os.environ['MEDFILE_ROOT_DIR'], 'lib\python2.7\site-packages\med'))
4
5 import salome
6 salome.salome_init()
7
8 import MEDLoader
9 import HYDROPy
10
11 from PyQt4 import QtCore, QtGui
12 #from interpolzUI import Ui_InterpolZ
13
14 def get_med_groups( file_path ):
15     meshes = MEDLoader.MEDLoader_GetMeshNames(file_path)
16     if len(meshes)==0:
17         return []
18     mesh1 = meshes[0]
19     groups = list(MEDLoader.MEDLoader_GetMeshGroupsNames(file_path, mesh1))
20     return groups
21
22 def get_hydro_regions( calc_case_name ):
23     aStudyId = salome.myStudyId
24     doc = HYDROPy.HYDROData_Document.Document( aStudyId )
25     case = doc.FindObjectByName( calc_case_name )
26     if isinstance(case, HYDROPy.HYDROData_CalculationCase):
27       regions = case.GetRegions()
28       regions_names = []
29       for r in regions:
30         rname = r.GetName()
31         regions_names.append( str(rname) )
32       return regions_names
33     else:
34       return []
35
36 class InterpolzDlg( QtGui.QDialog ):
37
38     def __init__(self, parent = None):
39         QtGui.QDialog.__init__( self, parent )
40
41
42 #app = QtGui.QApplication( sys.argv )
43 #dlg = InterpolzDlg()
44 #dlg.show()
45 #app.exec_()
46
47 #print get_med_groups( "/dn26/HYDRO/channel.med" )
48 print get_hydro_regions( "Case_1" )