"Install path: SALOME HYDRO scripts")
SET(SALOME_HYDRO_INSTALL_SAMPLES share/salome/hydrosamples CACHE PATH
"Install path: SALOME HYDRO samples")
+SET(SALOME_HYDRO_INSTALL_PLUGINS share/salome/plugins/hydro CACHE PATH
+ "Install path: SALOME HYDRO plugins")
+
MARK_AS_ADVANCED(
SALOME_HYDRO_INSTALL_RES_DATA
SALOME_HYDRO_INSTALL_RES_SCRIPTS
SALOME_HYDRO_INSTALL_SAMPLES
+ SALOME_HYDRO_INSTALL_PLUGINS
)
# Sources
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#include <Python.h>
+
#include "HYDROGUI_Module.h"
#include "HYDROGUI.h"
setMenuShown( true );
setToolShown( true );
+ // import Python module that manages HYDRO plugins (need to be here because SalomePyQt API uses active module)
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* pluginsmanager = PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
+ if ( !pluginsmanager ) {
+ PyErr_Print();
+ }
+ else {
+ PyObject* result =
+ PyObject_CallMethod(pluginsmanager, (char*)"initialize", (char*)"isss", 1, "hydro",
+ tr("MEN_DESK_HYDRO").toUtf8().data(),
+ tr("Python plugins").toUtf8().data());
+ if ( !result )
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+ PyGILState_Release(gstate);
+ // end of GEOM plugins loading
+
#ifndef DISABLE_PYCONSOLE
aDesktop->tabifyDockWidget( HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_PyConsole ) ),
HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_LogWindow ) ) );
-<!DOCTYPE TS> \r
+<!DOCTYPE TS>
<TS version="1.1" >\r
- \r
+
<context>\r
<name>@default</name>\r
<message>\r
<message>\r
<source>INCLUDED_OBJECTS</source>\r
<translation>Included objects</translation>\r
- </message> \r
+ </message>
<message>\r
<source>ALREADY_INCLUDED_OBJECTS</source>\r
<translation>Already included objects (can't be excluded)</translation>\r
- </message> \r
+ </message>
<message>\r
<source>AVAILABLE_GROUPS</source>\r
<translation>Available groups</translation>\r
<translation>Export image to file</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_InputPanel</name>\r
<message>\r
<translation>Help</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_Wizard</name>\r
<message>\r
<translation>Finish</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_ImportBathymetryDlg</name>\r
<message>\r
<translation>Invert altitude values</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_ImportBathymetryOp</name>\r
<message>\r
<translation>'%1'\r
All files cannot be correctly imported for a Bathymetry definition.</translation>\r
</message>\r
- \r
+
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_ImportImageDlg</name>\r
<message>\r
<translation>Image georeferencement files (*.grf);;All files (*.* *)</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_ImportImageOp</name>\r
<message>\r
<translation>The image file is not chosen</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_Module</name>\r
<message>\r
</message>\r
<message>\r
<source>DSK_EDIT_IMMERSIBLE_ZONE</source>\r
- <translation>Edit immersible zone</translation> \r
+ <translation>Edit immersible zone</translation>
</message>\r
<message>\r
<source>DSK_CREATE_STREAM</source>\r
<translation>Polyline arrow size</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_PolylineOp</name>\r
<message>\r
<translation>Hide all</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_ObserveImageOp</name>\r
<message>\r
<translation>Observe image</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_PolylineDlg</name>\r
<message>\r
<translation>Name</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_Poly3DDlg</name>\r
<message>\r
<translation>U: %1, Z: %2</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_ProfileDlg</name>\r
<message>\r
<translation>Transparent</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_TwoImagesOp</name>\r
<message>\r
<translation>HYDRO_</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_GeomObjectDlg</name>\r
<message>\r
<source>ATTRS_ISNT_SELECTED</source>\r
<translation>Attribute isn't selected</translation>\r
</message>\r
- \r
+
<message>\r
<source>DBF_LOAD_ERR_MESS</source>\r
<translation>Cannot open DBF file or it's corrupted</translation>\r
\r
</context>\r
\r
- \r
+
<context>\r
<name>HYDROGUI_ImportSinusXOp</name>\r
<message>\r
<translation>Cannot export polylines of different kind</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_GeoreferencementDlg</name>\r
<message>\r
<translation>Y2</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_GeoreferencementOp</name>\r
<message>\r
<translation>Do you want to store table data in the data model?</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_SetColorOp</name>\r
<message>\r
</message>\r
<message>\r
<source>INVALID_PROFILES</source>\r
- <translation>Invalid profiles: \r
+ <translation>Invalid profiles:
%1</translation>\r
</message>\r
<message>\r
<source>EXISTING_PROFILES</source>\r
- <translation>Existing profiles: \r
+ <translation>Existing profiles:
%1</translation>\r
</message>\r
<message>\r
<source>NOT_INTERSECTED_PROFILES</source>\r
- <translation>Not intersected with the hydraulic axis: \r
+ <translation>Not intersected with the hydraulic axis:
%1</translation>\r
</message>\r
<message>\r
<message>\r
<source>LAND_COVER_MAP_SELECTED_FACES</source>\r
<translation>\r
- \r
+
This operation is performed on a set of land covers selected in the 3D Viewer.\r
- \r
+
Number of selected land covers: </translation>\r
</message>\r
</context>\r
<translation>Translation of an obstacle</translation>\r
</message>\r
</context>\r
- \r
+
\r
<context>\r
<name>HYDROGUI_RunBrowser</name>\r
<translation>Incorrect input</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_PriorityTableModel</name>\r
<message>\r
<translation>Can't obtain stream oject \"%1\"</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_RecognizeContoursDlg</name>\r
<message>\r
<message>\r
<source>TYPE</source>\r
<translation>Type</translation>\r
- </message>\r
- <message>\r
- <source>AS_BATHY</source>\r
- <translation>As bathymetry</translation>\r
- </message>\r
- <message>\r
- <source>AS_BATHY</source>\r
- <translation>As bathymetry</translation>\r
</message>\r
<message>\r
<source>AS_POLYXY</source>\r
<translation>Ok</translation>\r
</message>\r
</context>\r
- \r
+
<context>\r
<name>HYDROGUI_SIProgressIndicator</name>\r
<message>\r
<message>\r
<source>COMPLETED</source>\r
<translation>Completed</translation>\r
- </message> \r
+ </message>
<message>\r
<source>CANCELLING</source>\r
<translation>Cancelling...</translation>\r
<name>HYDROGUI_ImportPolylineDlg</name>\r
<message>\r
<source>POLYLINES_3D_IN_FILES</source>\r
- <translation>The shp file contains polyline3D objects (ARCZ). \r
-They have been imported as polylineXY only, \r
-but can be imported with Z part (additional profile and bathymetry). \r
-If checkbox of corresponding polyline in the table below is checked \r
+ <translation>The shp file contains polyline3D objects (ARCZ).
+They have been imported as polylineXY only,
+but can be imported with Z part (additional profile and bathymetry).
+If checkbox of corresponding polyline in the table below is checked
then it will be imported with Z part, otherwise as PolylineXY only</translation>\r
</message>\r
<message>\r
changeCoords.py
)
+# --- plugins dialogs
+
+ADD_SUBDIRECTORY(plugins)
+ADD_SUBDIRECTORY(testPlugin)
+
+# --- plugin scripts / static
+
+SET(plugin_SCRIPTS
+ hydro_plugins.py
+)
+
# --- rules ---
SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydrotools)
+
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_HYDRO_INSTALL_PLUGINS})
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2019 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# Author : Guillaume Boulant (EDF)
+#
+import salome_pluginsmanager
+import os
+from qtsalome import QIcon
+
+try:
+ from plugins import meshEdgesToShapesDialog
+ salome_pluginsmanager.AddFunction('Mesh edges to shapes',
+ 'Create shapefiles from mesh edges groups and borders',
+ meshEdgesToShapesDialog.execDialog)
+except Exception as e:
+ salome_pluginsmanager.logger.info('ERROR: meshEdgesToShapes plug-in is unavailable: {}'.format(e))
+ pass
+
+try:
+ from testPlugin import testDialog
+ salome_pluginsmanager.AddFunction('test Dialog',
+ 'test Dialog not implemented',
+ testDialog.execDialog)
+except Exception as e:
+ salome_pluginsmanager.logger.info('ERROR: test plug-in is unavailable: {}'.format(e))
+ pass
+
--- /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/>.
+
+# --- Python files ---
+
+SET(PLUGIN_SCRIPTS
+ __init__.py
+ meshEdgesToShapesDialog.py
+)
+
+SET(UIFILES
+ meshEdgesToShapes.ui
+)
+
+# --- rules ---
+
+SALOME_INSTALL_SCRIPTS("${PLUGIN_SCRIPTS}" ${SALOME_HYDRO_INSTALL_PLUGINS}/plugins)
+INSTALL( FILES ${UIFILES} DESTINATION ${SALOME_HYDRO_INSTALL_PLUGINS}/plugins)
--- /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>814</width>
+ <height>369</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Mesh Edges to Shapes</string>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Input</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <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>
+ <widget class="QLineEdit" name="le_medFile"/>
+ </item>
+ <item>
+ <widget class="QToolButton" name="pb_medFile">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="lb_offsetX">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Offset X</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QDoubleSpinBox" name="dsb_offsetX">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>X coordinate of origin of input mesh</string>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="decimals">
+ <number>0</number>
+ </property>
+ <property name="minimum">
+ <double>-10000000.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>10000000.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>10000.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <spacer name="horizontalSpacer_2">
+ <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 row="1" column="0">
+ <widget class="QLabel" name="lb_offsetY">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Offset Y</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="dsb_offsetY">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Y coordinate of origin of input mesh</string>
+ </property>
+ <property name="decimals">
+ <number>0</number>
+ </property>
+ <property name="minimum">
+ <double>-10000000.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>10000000.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>10000.000000000000000</double>
+ </property>
+ <property name="stepType">
+ <enum>QAbstractSpinBox::DefaultStepType</enum>
+ </property>
+ <property name="value">
+ <double>0.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Output</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="lb_outDir">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Output dir:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="le_outDir">
+ <property name="statusTip">
+ <string>directory to store shapefiles and output mesh file if kept</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="pb_outDir">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cb_keepOutMed">
+ <property name="text">
+ <string>Keep Output MED File</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </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>
+ <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>
+ <connection>
+ <sender>pb_ok</sender>
+ <signal>rejected()</signal>
+ <receiver>Dialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>pb_ok</sender>
+ <signal>accepted()</signal>
+ <receiver>Dialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </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
+
+from salome.hydrotools.shapesGroups import freeBordersGroup, exploreEdgeGroups
+
+#import sysconfig
+#pythonVersion = 'python' + sysconfig.get_python_version()
+hydro_root = os.path.join(os.environ['HYDRO_ROOT_DIR'], 'share', 'salome', 'plugins', 'hydro', 'plugins')
+
+class meshEdgesToShapesDialog(QDialog):
+ """
+ """
+
+ def __init__(self, parent = None, modal = 0):
+ QDialog.__init__(self, parent)
+ uic.loadUi(os.path.join(hydro_root, 'meshEdgesToShapes.ui'), self )
+
+ # Connections
+ self.pb_medFile.clicked.connect(self.on_med_file_browse)
+ self.pb_outDir.clicked.connect(self.on_outputDir_browse)
+ 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.cb_keepOutMed.setChecked(True)
+ self.medFile = None
+ self.outDir = None
+
+ def on_med_file_browse(self):
+ """
+ Select MED file
+ """
+ print("on_med_file_browse")
+ self.medFile, filt = QFileDialog.getOpenFileName(self, self.tr("Input MED file"), "", self.tr("MED files (*.med)"))
+ print(self.medFile)
+ if not self.medFile:
+ return
+ self.le_medFile.setText(self.medFile)
+
+ def on_outputDir_browse(self):
+ """
+ Select OutputDirectory
+ """
+ print("on_ouptutDir_browse")
+ self.outDir = QFileDialog.getExistingDirectory(self, self.tr("Output Directory"), "")
+ print(self.outDir)
+ if not self.outDir:
+ return
+ self.le_outDir.setText(self.outDir)
+
+ def on_help(self):
+ """
+ display a help message
+ """
+ msg = """
+ <h2>Mesh Edges to Shapes Dialog</h2>
+
+ This dialog is used to extract all groups of edges from a mesh, plus all the border (free) edges,
+ and write the groups as shapefiles.
+ <br><br>
+ The free edges regroup the external border of the mesh, and all the internal borders (isles).
+ A group containing the free edges is added to the mesh.
+ <br>
+ The mesh is saved in a new file, in an ouput directory used also to store the shapefiles.
+ <br>
+ A shapefile of edges and a shapefile of points are generated for each group of edges.
+ The shapefiles are intended to be loaded in a SIG tool (Qgis) and should preferaby be set in a correct coordinates system.
+ <br>
+ If the mesh uses a local coordinate system with an origin offset, the coordinates of this origin should be set in the dialog.
+ <br><br>
+ Below is the description of the dialog controls.
+
+ <h3>MED file</h3>
+ This field allows selection of a med file (via the standard file open dialog).
+ The filling of this field is mandatory.
+
+ <h3>offsetX, offsetY</h3>
+ These fields are used to set the Origin of the local coordinates system of the mesh, if any.
+
+ <h3>Output directory</h3>
+ This field allows selection of a directory to store the shapes and the outputMesh.
+
+ <h3>Keep output MED file</h3>
+ If this checkbox is unchecked, the output mesh will be removed after calculation of the shapes.
+ """
+ QMessageBox.about(self, self.tr("About mesh edges to shapes dialog"), msg);
+
+
+ def on_accept(self):
+ print("accept")
+ medFile = self.le_medFile.text()
+ outDir = self.le_outDir.text()
+ offsetX = self.dsb_offsetX.value()
+ offsetY = self.dsb_offsetY.value()
+ isOutMedKept = self.cb_keepOutMed.isChecked()
+ self.accept()
+ print(medFile)
+ print(outDir)
+ print(isOutMedKept)
+ print(offsetX, offsetY)
+ a = os.path.splitext(medFile)
+ medFileOut = os.path.join(outDir, os.path.basename(a[0]) + '_brd' + a[1])
+ print(medFileOut)
+ medFileOut = freeBordersGroup(medFile, medFileOut)
+ exploreEdgeGroups(medFileOut, outDir, offsetX, offsetY)
+ if not isOutMedKept:
+ print("remove", medFileOut)
+ os.remove(medFileOut)
+
+ def on_reject(self):
+ print("reject")
+ self.reject()
+
+
+def execDialog(context):
+ print("execDialog")
+ # get context study, salomeGui
+ study = context.study
+ sg = context.sg
+ dlg = meshEdgesToShapesDialog()
+ dlg.exec_()
--- /dev/null
+# Copyright (C) 2012-2019 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# --- scripts ---
+
+# scripts / static
+SET(plugin_SCRIPTS
+ testDialog.py
+ )
+
+# --- rules ---
+
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_HYDRO_INSTALL_PLUGINS}/testPlugin)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys, os
+import string
+
+#import sysconfig
+#pythonVersion = 'python' + sysconfig.get_python_version()
+#hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome')
+
+#import salome
+#salome.salome_init()
+
+#import HYDROPy
+
+from PyQt5.QtWidgets import QDialog, QFileDialog, QTableWidgetItem, QComboBox, QMessageBox
+from PyQt5 import uic
+
+#import SalomePyQt
+#import libSALOME_Swig
+#salome_gui = libSALOME_Swig.SALOMEGUI_Swig()
+
+class testDialog():
+
+ def __init__(self, parent = None):
+ pass
+
+ def exec_(self):
+ msgBox = QMessageBox()
+ msgBox.setText( "The test dialog is not yet implemented!" )
+ msgBox.exec_()
+
+def execDialog(parent):
+ print("execDialog")
+ dlg = testDialog(parent)
+ dlg.exec_()
\ No newline at end of file