]> SALOME platform Git repositories - modules/hydrosolver.git/commitdiff
Salome HOME
porting interpolz GUI on PyQt5
authorasl <asl@opencascade.com>
Mon, 23 Jan 2017 13:10:42 +0000 (16:10 +0300)
committerasl <asl@opencascade.com>
Mon, 23 Jan 2017 13:10:42 +0000 (16:10 +0300)
src/salome_hydro/interpolz_gui.py

index 6fa168a07471631a26071895d47eb3f29842b7f4..69f63c896725f961d389bb48677118259a3bb4ce 100644 (file)
@@ -22,17 +22,22 @@ salome_gui = libSALOME_Swig.SALOMEGUI_Swig()
 from generate_interpolz import generate
 
 def get_med_groups( file_path ):
-    #print "get_med_groups", file_path
+    print "get_med_groups", file_path
     try:
-        meshes = MEDLoader.MEDLoader_GetMeshNames(file_path)
+        meshes = MEDLoader.GetMeshNames(file_path)
     except:
+        print 'No meshes found'
         return []
     if len(meshes)==0:
+        print 'No mesh found'
         return []
     mesh1 = meshes[0]
+    print 'Found mesh:', mesh1
     try:
-        groups = list(MEDLoader.MEDLoader_GetMeshGroupsNames(file_path, mesh1))
+        groups = list(MEDLoader.GetMeshGroupsNames(file_path, mesh1))
+        print 'Found groups:', groups
     except:
+        print 'No groups found'
         return []
     return groups
 
@@ -62,7 +67,7 @@ def get_selected_calc_case():
     doc = HYDROPy.HYDROData_Document.Document( aStudyId )
     for i in ind:
         if i.column()==0:
-            name = i.data().toString()
+            name = str(i.data())
             case = doc.FindObjectByName( name )
             if isinstance(case, HYDROPy.HYDROData_CalculationCase):
                 return name
@@ -95,16 +100,16 @@ class InterpolzDlg( QDialog ):
     def onOutputFile( self ):
       caption = "Python file"
       mask = "*.py"
-      f = QFileDialog.getSaveFileName( self, caption, ".", mask )
-      if f!=None and f!="":
-        self.OutputPath.setText( f )
+      fname, filt = QFileDialog.getSaveFileName( self, caption, ".", mask )
+      if fname!=None and fname!="":
+        self.OutputPath.setText( fname )
       
     def onMEDFile( self ):
       caption = "MED file"
       mask = "*.med"
-      f = QFileDialog.getOpenFileName( self, caption, ".", mask )
-      if f!=None and f!="":
-        self.MEDFile.setText( f )
+      fname, filt = QFileDialog.getOpenFileName( self, caption, ".", mask )
+      if fname!=None and fname!="":
+        self.MEDFile.setText( fname )
         
     def onCalcCaseChanged( self ):
       self.regions = get_hydro_regions( str(self.CalcCase.text()) )
@@ -112,7 +117,7 @@ class InterpolzDlg( QDialog ):
         
     def onMEDChanged( self ):
       self.med_groups = get_med_groups( str(self.MEDFile.text()) )
-      #print self.med_groups
+      print self.med_groups
       n = len( self.med_groups )
       self.Groups.setRowCount( n )
       for i in range( 0, n ):