from LiquidBoundariesDialog import LiquidBoundariesDialog
from BreachesDialog import BreachesDialog
from salome.hydro.initialFieldDialog import initialFieldDialog
+from salome.hydro.checkBoundariesDialog import checkBoundariesDialog
+
################################################
# GUI context class
GEN_PARAM_STUDY_YACS_ID = 966
CHANGECOORDS_PY_ID = 967
+ CHECK_BOUNDARY_CONDITIONS_ID = 968
def __init__(self):
# create top-level menu
"Change coordinates",
"Change coordinates",
"Change mesh coordinates",
- "generate_interpolz_py.png")
+ "changes_coords.png")
sgPyQt.createMenu(act, mid)
sgPyQt.createTool(act, tid)
"Generate assignStrickler.py",
"Generate assignStrickler.py",
"Generate assignation script for bottom friction coefficients",
- "generate_interpolz_py.png" )
+ "assign_Strickler_py.png" )
sgPyQt.createMenu( act, mid )
sgPyQt.createTool( act, tid )
sgPyQt.createMenu(act, mid)
sgPyQt.createTool(act, tid)
+ act = sgPyQt.createAction(\
+ GUIcontext.CHECK_BOUNDARY_CONDITIONS_ID,
+ "check boundary conditions",
+ "check boundary conditions",
+ "display a graph with boundary conditions on the mesh",
+ "check_boundary_conditions.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
act = sgPyQt.createAction(\
GUIcontext.EDIT_LIQUID_BOUNDARY_FILE_ID,
- "Edit liquid boundary conditions file",
- "Edit liquid boundary conditions file",
- "Create/edit the liquid boundary conditions file for Telemac",
+ "Edit evolution of liquid boundary conditions file",
+ "Edit evolution of liquid boundary conditions file",
+ "Create/edit the evolution in time of the liquid boundary conditions file for Telemac",
"edit_liquid_boundary_conditions_file.png")
sgPyQt.createMenu(act, mid)
sgPyQt.createTool(act, tid)
"Edit initial field file",
"Edit initial field file",
"Create/edit the initial field file for Telemac",
- "edit_boundary_conditions_file.png" )
+ "edit_initial_field_file.png" )
sgPyQt.createMenu( act, mid )
sgPyQt.createTool( act, tid )
dlg = initialFieldDialog(desktop)
dlg.exec_()
+###
+# Open dialog for initial conditions edition
+###
+def check_boundaries():
+ desktop = sgPyQt.getDesktop()
+ dlg = checkBoundariesDialog(desktop)
+ dlg.exec_()
+
###
# Open dialog for liquid boundary conditions edition
###
GUIcontext.CHANGECOORDS_PY_ID: changeCoords_py,
GUIcontext.EDIT_LIQUID_BOUNDARY_FILE_ID: edit_liquid_boundary_file,
GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID: edit_boundary_conditions_file,
+ GUIcontext.CHECK_BOUNDARY_CONDITIONS_ID: check_boundaries,
GUIcontext.EDIT_BREACHES_FILE_ID: edit_breaches_file,
GUIcontext.EDIT_INITIAL_FIELD_FILE_ID: edit_initial_field_file,
GUIcontext.CREATE_PARAM_STUDY_ID: create_param_study,
interpolz_gui.py
changeCoordsDialog.py
initialFieldDialog.py
+ checkBoundariesDialog.py
)
SET(UIFILES
interpolz.ui
changeCoords.ui
initialField.ui
+ checkBoundaries.ui
)
SET(TEMPLFILES
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>448</width>
+ <height>260</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Check Boundary Conditions</string>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="lb_medFile">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>MED file</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="le_medFile">
+ <property name="statusTip">
+ <string>The file containing the mesh to check</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QToolButton" name="pb_medFile">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="statusTip">
+ <string>Browse file</string>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="lb_bcdFile">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Boundary Condition file</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="le_bcdFile">
+ <property name="statusTip">
+ <string>The file containing the MED group names and their associated Boundary condition type</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QToolButton" name="pb_bcdFile">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="statusTip">
+ <string>Browse file</string>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="rb_liqbcd">
+ <property name="toolTip">
+ <string>shows all the groups of Liquid/solid boundaries</string>
+ </property>
+ <property name="text">
+ <string>Liquid / solid boundaries by MED groups</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="rb_allbcd">
+ <property name="toolTip">
+ <string>shows all the boundaries classed by Telemac Type</string>
+ </property>
+ <property name="text">
+ <string>All boundaries by Telemac type</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>66</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="textEdit">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="html">
+ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic; color:#0000ff;">The drawing is launch in a separate process, without waiting.</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic; color:#0000ff;">The process may be long on a big mesh...</span></p></body></html></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QDialogButtonBox" name="pb_ok">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pb_help">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+from PyQt5 import uic
+
+import subprocess
+import time
+
+import sysconfig
+from test import outstanding_bugs
+pythonVersion = 'python' + sysconfig.get_python_version()
+hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome', 'salome', 'hydro')
+
+class checkBoundariesDialog(QDialog):
+ """
+ """
+
+ def __init__(self, parent = None, modal = 0):
+ QDialog.__init__(self, parent)
+ uic.loadUi(os.path.join(hydro_solver_root, 'checkBoundaries.ui'), self )
+
+ # Connections
+ self.pb_medFile.clicked.connect(self.on_med_file_browse)
+ self.pb_bcdFile.clicked.connect(self.on_bcd_file_browse)
+ self.rb_liqbcd.toggled.connect(self.on_liqbcd)
+ self.pb_help.clicked.connect(self.on_help)
+ self.pb_ok.accepted.connect(self.on_accept)
+ self.pb_ok.rejected.connect(self.on_reject)
+ self.medFile = None
+ self.bcdFile = None
+ self.rb_liqbcd.setChecked(True)
+ self.rb_allbcd.setChecked(False)
+ self.liqbcd = True
+
+ def on_med_file_browse(self):
+ """
+ Select MED file
+ """
+ print("on_med_file_browse")
+ self.medFile, _filt = QFileDialog.getOpenFileName(self, self.tr("MED file"), "", self.tr("MED files (*.med)"))
+ print(self.medFile)
+ if not self.medFile:
+ return
+ self.le_medFile.setText(self.medFile)
+
+ def on_bcd_file_browse(self):
+ """
+ Select bcd file
+ """
+ print("on_bcd_file_browse")
+ self.bcdFile, _filt = QFileDialog.getOpenFileName(self, self.tr("Boundary Condition file"), "", self.tr("Boundary Condition files (*.bcd)"))
+ print(self.bcdFile)
+ if not self.bcdFile:
+ return
+ self.le_bcdFile.setText(self.bcdFile)
+
+ def on_liqbcd(self):
+ """
+ switch type of display
+ """
+ print("on_liqbcd")
+ if self.rb_liqbcd.isChecked():
+ self.liqbcd = True
+ else:
+ self.liqbcd = False
+
+ def on_help(self):
+ """
+ display a help message
+ """
+ msg = """
+ <h2>Display boundarycondition dialog</h2>
+
+ This dialog is used to draw the mesh with colored boundary conditions on nodes.
+ <br><br>
+ The boundary condition file (bcd) associates a type of boundary condition to each concerned group in the mesh.
+ <br>
+ The option "Liquid /solid boundaries" allows to distinguish all the differents boundary condition groups
+ <br>
+ The option "All boundaries by Telemac type" allows to distinguish all the types of boundary conditions.
+ <br><br>
+ The drawing computation Is launch in a separate process, without waiting.
+ It may be long, for a big mesh...
+ """
+ QMessageBox.about(self, self.tr("About change coordinates dialog"), msg);
+
+
+ def on_accept(self):
+ print("accept")
+ #TODO check medfile in and out not empty
+ #TODO preset for bcdFile
+ medFile = self.le_medFile.text()
+ bcdFile = self.le_bcdFile.text()
+ if not os.path.isfile(medFile):
+ msgBox = QMessageBox()
+ msgBox.setText( "MED file does not exist" )
+ msgBox.exec_()
+ return
+ if not os.path.isfile(bcdFile):
+ msgBox = QMessageBox()
+ msgBox.setText( "Boundary condition file does not exist" )
+ msgBox.exec_()
+ return
+ option = "--bnd"
+ if self.liqbcd:
+ option = "--liq-bnd"
+ cmd = ["plot.py", "mesh2d", medFile, "-b", bcdFile, option]
+ try:
+ proc = subprocess.Popen(cmd)
+ except OSError:
+ print("invalid command")
+ QMessageBox.critical(self, "command error", "%s is not found" % cmd[0])
+ self.accept()
+
+ def on_reject(self):
+ print("reject")
+ self.reject()
+
+
+def execDialog(context):
+ print("execDialog")
+ # get context study, salomeGui
+ study = context.study
+ sg = context.sg
+ dlg = checkBoundariesDialog()
+ dlg.exec_()