]> SALOME platform Git repositories - modules/hydrosolver.git/commitdiff
Salome HOME
porting of the boundary conditions dialog
authorasl <asl@opencascade.com>
Mon, 30 Jan 2017 09:10:21 +0000 (12:10 +0300)
committerasl <asl@opencascade.com>
Mon, 30 Jan 2017 09:10:21 +0000 (12:10 +0300)
src/HYDROGUI/BndConditionsDialog.py [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 21f109b..617e780
@@ -38,7 +38,8 @@ def get_med_groups_on_edges(file_path):
     try:
         med_file_mesh = MEDFileMesh.New(file_path)
         groups = list(med_file_mesh.getGroupsOnSpecifiedLev(-1))
-    except:
+    except Exception as e:
+        print e.what()
         return []
           
     return groups
@@ -89,10 +90,9 @@ class ValueDelegate(QStyledItemDelegate):
         return line_edit
         
     def setEditorData(self, editor, index):
-        value, is_ok = index.model().data(index, Qt.EditRole).toInt()
-
-        if is_ok:
-            editor.setText(str(value))
+        value = index.model().data(index, Qt.EditRole)
+        if value.isdigit():
+            editor.setText(value)
         else:
             editor.setText('')
     
@@ -212,7 +212,7 @@ class BoundaryConditionsDialog(QDialog):
     """Select MED file"""
     def on_med_file_browse(self):
         # Get file path
-        file_path = QFileDialog.getOpenFileName(self, self.tr("Open MED file"), "", self.tr("MED files (*.med)"))
+        file_path, filt = QFileDialog.getOpenFileName(self, self.tr("Open MED file"), "", self.tr("MED files (*.med)"))
         if not file_path:
             return
         
@@ -230,7 +230,7 @@ class BoundaryConditionsDialog(QDialog):
     
     """Select boundary conditions file"""
     def on_bnd_file_browse(self):
-        file_path = QFileDialog.getOpenFileName(self, self.tr("Open boundary conditions file"))
+        file_path, filt = QFileDialog.getOpenFileName(self, self.tr("Open boundary conditions file"))
         
         if file_path:
             self.bndConditionsFileEdit.setText(file_path)
@@ -260,9 +260,9 @@ class BoundaryConditionsDialog(QDialog):
        
         if preset and self.presets.has_key(preset):
             values = self.presets[preset]
-            row_nb, is_ok = combo.property(ROW_PROPERTY_NAME).toInt()
+            row_nb = combo.property(ROW_PROPERTY_NAME)
             
-            if is_ok and row_nb >= 0 and row_nb < self.boundaryConditionsTable.rowCount():
+            if row_nb >= 0 and row_nb < self.boundaryConditionsTable.rowCount():
                 lihbor = values[0]
                 liubor = values[1]
                 livbor = values[2]
@@ -282,7 +282,8 @@ class BoundaryConditionsDialog(QDialog):
         
     """Define result file path"""
     def on_result_file_browse(self):
-        file_path = QFileDialog.getSaveFileName(self, self.tr("Select output file path"))
+        file_path, filt = QFileDialog.getSaveFileName(self, self.tr("Select output file path"))
+        #print file_path
         if file_path:
             self.resultBndConditionsFileEdit.setText(file_path)
     
@@ -368,7 +369,7 @@ class BoundaryConditionsDialog(QDialog):
     
         if self.boundaryConditionsTable.rowCount() < 1:
             QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Boundary conditions list is empty."))
-        elif self.get_output_path().isEmpty():
+        elif len(self.get_output_path())==0:
             QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Output file path is empty."))
         else:
             has_empty_cells = False
@@ -423,4 +424,4 @@ class BoundaryConditionsDialog(QDialog):
         Click on "Close" button does not lead to saving the data and just closes the dialog.
         """
         QMessageBox.about(self, self.tr("About boundary conditions dialog"), msg);
-        pass
\ No newline at end of file
+        pass