From 3dd1acf49d088cb3c5a5fad35a637fa9c9f610f6 Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 23 Jan 2017 16:10:42 +0300 Subject: [PATCH] porting interpolz GUI on PyQt5 --- src/salome_hydro/interpolz_gui.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/salome_hydro/interpolz_gui.py b/src/salome_hydro/interpolz_gui.py index 6fa168a..69f63c8 100644 --- a/src/salome_hydro/interpolz_gui.py +++ b/src/salome_hydro/interpolz_gui.py @@ -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 ): -- 2.39.2