]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
dialog mesh edges to shapes
authorPaul RASCLE <paul.rascle@openfields.fr>
Thu, 13 Aug 2020 11:05:39 +0000 (13:05 +0200)
committerYOANN AUDOUIN <B61570@dsp0851742.postes.calibre.edf.fr>
Fri, 30 Oct 2020 16:06:22 +0000 (17:06 +0100)
CMakeLists.txt
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDROTools/CMakeLists.txt
src/HYDROTools/hydro_plugins.py [new file with mode: 0644]
src/HYDROTools/plugins/CMakeLists.txt [new file with mode: 0644]
src/HYDROTools/plugins/__init__.py [new file with mode: 0644]
src/HYDROTools/plugins/meshEdgesToShapes.ui [new file with mode: 0644]
src/HYDROTools/plugins/meshEdgesToShapesDialog.py [new file with mode: 0644]
src/HYDROTools/testPlugin/CMakeLists.txt [new file with mode: 0644]
src/HYDROTools/testPlugin/testDialog.py [new file with mode: 0644]

index a51eeff2f2923ff7721ab5031f88352085498826..9c8dbcd844e79d5d869fdeb5ed16e6ad69aa57d1 100644 (file)
@@ -188,10 +188,14 @@ SET(SALOME_HYDRO_INSTALL_RES_SCRIPTS "${SALOME_INSTALL_RES}/hydro" CACHE PATH
   "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
index f52320a7b555f0fce1a2f0c3226337aaa614e95d..96823ea6d5b52fd73398bf46758f7f2fe4511c25 100755 (executable)
@@ -16,6 +16,8 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
+#include <Python.h>
+
 #include "HYDROGUI_Module.h"
 
 #include "HYDROGUI.h"
@@ -181,6 +183,24 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
   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 ) ) );
index dc4465a16b99a828add3d02ece7e4ea799c15ef0..7b5e6aad2c8e344e4ea26ad89a729bafef5a29cb 100755 (executable)
@@ -1,6 +1,6 @@
-<!DOCTYPE TS> \r
+<!DOCTYPE TS>
 <TS version="1.1" >\r
-  \r
+
   <context>\r
     <name>@default</name>\r
     <message>\r
@@ -337,11 +337,11 @@ All supported formats (*.brep *.iges *.igs *.step *.stp)</translation>
     <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
@@ -608,7 +608,7 @@ Do you want to continue?</translation>
       <translation>Export image to file</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_InputPanel</name>\r
     <message>\r
@@ -632,7 +632,7 @@ Do you want to continue?</translation>
       <translation>Help</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_Wizard</name>\r
     <message>\r
@@ -648,7 +648,7 @@ Do you want to continue?</translation>
       <translation>Finish</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_ImportBathymetryDlg</name>\r
     <message>\r
@@ -672,7 +672,7 @@ Do you want to continue?</translation>
       <translation>Invert altitude values</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_ImportBathymetryOp</name>\r
     <message>\r
@@ -693,9 +693,9 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <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
@@ -779,7 +779,7 @@ All files cannot be correctly imported for a Bathymetry definition.</translation
       <translation>Image georeferencement files (*.grf);;All files (*.* *)</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_ImportImageOp</name>\r
     <message>\r
@@ -848,7 +848,7 @@ Would you like to remove all references from the image?</translation>
       <translation>The image file is not chosen</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_Module</name>\r
     <message>\r
@@ -881,7 +881,7 @@ Would you like to remove all references from the image?</translation>
     </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
@@ -2050,7 +2050,7 @@ Would you like to remove all references from the image?</translation>
       <translation>Polyline arrow size</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_PolylineOp</name>\r
     <message>\r
@@ -2153,7 +2153,7 @@ Would you like to remove all references from the image?</translation>
       <translation>Hide all</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_ObserveImageOp</name>\r
     <message>\r
@@ -2161,7 +2161,7 @@ Would you like to remove all references from the image?</translation>
       <translation>Observe image</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_PolylineDlg</name>\r
     <message>\r
@@ -2177,7 +2177,7 @@ Would you like to remove all references from the image?</translation>
       <translation>Name</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_Poly3DDlg</name>\r
     <message>\r
@@ -2213,7 +2213,7 @@ Would you like to remove all references from the image?</translation>
       <translation>U: %1, Z: %2</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_ProfileDlg</name>\r
     <message>\r
@@ -2306,7 +2306,7 @@ Would you like to remove all references from the image?</translation>
       <translation>Transparent</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_TwoImagesOp</name>\r
     <message>\r
@@ -2499,7 +2499,7 @@ file cannot be correctly imported for an Obstacle definition.</translation>
       <translation>HYDRO_</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_GeomObjectDlg</name>\r
     <message>\r
@@ -2709,7 +2709,7 @@ file cannot be correctly imported for an Obstacle definition.</translation>
       <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
@@ -2788,7 +2788,7 @@ file cannot be correctly imported for an Obstacle definition.</translation>
 \r
   </context>\r
 \r
\r
+
   <context>\r
     <name>HYDROGUI_ImportSinusXOp</name>\r
     <message>\r
@@ -2857,7 +2857,7 @@ file cannot be correctly imported for an Obstacle definition.</translation>
       <translation>Cannot export polylines of different kind</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_GeoreferencementDlg</name>\r
     <message>\r
@@ -2897,7 +2897,7 @@ file cannot be correctly imported for an Obstacle definition.</translation>
       <translation>Y2</translation>\r
     </message>\r
   </context>\r
\r
+
   <context>\r
     <name>HYDROGUI_GeoreferencementOp</name>\r
     <message>\r
@@ -2917,7 +2917,7 @@ file cannot be correctly imported for an Obstacle definition.</translation>
       <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
@@ -3063,17 +3063,17 @@ file cannot be correctly imported for an Obstacle definition.</translation>
     </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
@@ -3323,9 +3323,9 @@ Polyline should consist from one not closed curve.</translation>
     <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
@@ -3429,7 +3429,7 @@ Polyline should consist from one not closed curve.</translation>
       <translation>Translation of an obstacle</translation>\r
     </message>\r
   </context>\r
-  \r
+
 \r
   <context>\r
     <name>HYDROGUI_RunBrowser</name>\r
@@ -3514,7 +3514,7 @@ Polyline should consist from one not closed curve.</translation>
       <translation>Incorrect input</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_PriorityTableModel</name>\r
     <message>\r
@@ -3622,7 +3622,7 @@ Polyline should consist from one not closed curve.</translation>
       <translation>Can't obtain stream oject \"%1\"</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_RecognizeContoursDlg</name>\r
     <message>\r
@@ -3860,14 +3860,6 @@ Polyline should consist from one not closed curve.</translation>
      <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
@@ -3902,7 +3894,7 @@ Polyline should consist from one not closed curve.</translation>
       <translation>Ok</translation>\r
     </message>\r
   </context>\r
-  \r
+
   <context>\r
     <name>HYDROGUI_SIProgressIndicator</name>\r
      <message>\r
@@ -3948,7 +3940,7 @@ Polyline should consist from one not closed curve.</translation>
      <message>\r
       <source>COMPLETED</source>\r
       <translation>Completed</translation>\r
-     </message>     \r
+     </message>
      <message>\r
       <source>CANCELLING</source>\r
       <translation>Cancelling...</translation>\r
@@ -3960,10 +3952,10 @@ Polyline should consist from one not closed curve.</translation>
     <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
index b3b04c9efc69abf5a797c8f7cef8539087850bb8..013d25b632f1763c4a8c179513606abfad646ce2 100644 (file)
@@ -29,6 +29,19 @@ SET(PYFILES
   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})
diff --git a/src/HYDROTools/hydro_plugins.py b/src/HYDROTools/hydro_plugins.py
new file mode 100644 (file)
index 0000000..11eb9f4
--- /dev/null
@@ -0,0 +1,43 @@
+# -*- 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
+
diff --git a/src/HYDROTools/plugins/CMakeLists.txt b/src/HYDROTools/plugins/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2509e46
--- /dev/null
@@ -0,0 +1,32 @@
+#  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)
diff --git a/src/HYDROTools/plugins/__init__.py b/src/HYDROTools/plugins/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/HYDROTools/plugins/meshEdgesToShapes.ui b/src/HYDROTools/plugins/meshEdgesToShapes.ui
new file mode 100644 (file)
index 0000000..20bef9c
--- /dev/null
@@ -0,0 +1,326 @@
+<?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>
diff --git a/src/HYDROTools/plugins/meshEdgesToShapesDialog.py b/src/HYDROTools/plugins/meshEdgesToShapesDialog.py
new file mode 100644 (file)
index 0000000..e17579c
--- /dev/null
@@ -0,0 +1,142 @@
+#  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_()        
diff --git a/src/HYDROTools/testPlugin/CMakeLists.txt b/src/HYDROTools/testPlugin/CMakeLists.txt
new file mode 100644 (file)
index 0000000..229a7fd
--- /dev/null
@@ -0,0 +1,28 @@
+# 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)
diff --git a/src/HYDROTools/testPlugin/testDialog.py b/src/HYDROTools/testPlugin/testDialog.py
new file mode 100644 (file)
index 0000000..7c05c0f
--- /dev/null
@@ -0,0 +1,35 @@
+# -*- 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