Salome HOME
dialog initial field
authorPaul RASCLE <paul.rascle@openfields.fr>
Tue, 18 Aug 2020 13:38:58 +0000 (15:38 +0200)
committerYOANN AUDOUIN <B61570@dsp0851742.postes.calibre.edf.fr>
Fri, 30 Oct 2020 16:04:18 +0000 (17:04 +0100)
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROSOLVERGUI.py
src/HYDROTools/CMakeLists.txt
src/HYDROTools/initialField.py [new file with mode: 0644]
src/salome_hydro/CMakeLists.txt
src/salome_hydro/initialField.ui [new file with mode: 0644]
src/salome_hydro/initialFieldDialog.py [new file with mode: 0644]

index f385352e64d543c8f7d854de5b03350d8cbb1f22..6850242077fc5c3f2bc372bdb94b6e12ee3d7e47 100644 (file)
@@ -21,7 +21,6 @@ SET(PYFILES
   HYDROSOLVERGUI.py
   BndConditionsDialog.py
   BreachesDialog.py
-  InitialConditionsDialog.py
   LiquidBoundariesDialog.py
 )
 
index d80a6c5d782516b9ec1a2a07a8b12d7ce0148817..b3c2b8078c6feb9de18995e13d56d3b2597b20e9 100755 (executable)
@@ -52,7 +52,7 @@ from eficasSalome import runEficas
 from BndConditionsDialog import BoundaryConditionsDialog
 from LiquidBoundariesDialog import LiquidBoundariesDialog
 from BreachesDialog import BreachesDialog
-from InitialConditionsDialog import InitialConditionsDialog
+from salome.hydro.initialFieldDialog import initialFieldDialog
 
 ################################################
 # GUI context class
@@ -61,7 +61,7 @@ from InitialConditionsDialog import InitialConditionsDialog
 
 class GUIcontext:
   
-    # --- menus/toolbars/actions IDs
+    # --- menus/toolbars/actions IDss
     
     HYDRO_MENU_ID = 90
     CREATE_STUDY_ID = 951
@@ -79,7 +79,7 @@ class GUIcontext:
     EDIT_BOUNDARY_CONDITIONS_FILE_ID = 959
     EDIT_LIQUID_BOUNDARY_FILE_ID = 960
     EDIT_BREACHES_FILE_ID = 961
-    EDIT_INITIAL_CONDITIONS_FILE_ID = 962
+    EDIT_INITIAL_FIELD_FILE_ID = 962
 
     CREATE_PARAM_STUDY_ID = 963
     EDIT_PARAM_STUDY_ID = 964
@@ -152,10 +152,10 @@ class GUIcontext:
         sgPyQt.createTool(act, tid)
         
         act = sgPyQt.createAction(\
-                GUIcontext.EDIT_INITIAL_CONDITIONS_FILE_ID,
-                "Edit initial conditions file",
-                "Edit initial conditions file",
-                "Create/edit the initial conditions file for Telemac",
+                GUIcontext.EDIT_INITIAL_FIELD_FILE_ID,
+                "Edit initial field file",
+                "Edit initial field file",
+                "Create/edit the initial field file for Telemac",
                 "edit_boundary_conditions_file.png" )
         sgPyQt.createMenu( act, mid )
         sgPyQt.createTool( act, tid )
@@ -454,9 +454,9 @@ def edit_breaches_file():
 ###
 # Open dialog for initial conditions edition
 ###
-def edit_initial_conditions_file():
+def edit_initial_field_file():
     desktop = sgPyQt.getDesktop()
-    dlg = InitialConditionsDialog(desktop)
+    dlg = initialFieldDialog(desktop)
     dlg.exec_()
 
 ###
@@ -539,7 +539,7 @@ dict_command = {
     GUIcontext.EDIT_LIQUID_BOUNDARY_FILE_ID: edit_liquid_boundary_file,
     GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID: edit_boundary_conditions_file,
     GUIcontext.EDIT_BREACHES_FILE_ID: edit_breaches_file,
-    GUIcontext.EDIT_INITIAL_CONDITIONS_FILE_ID: edit_initial_conditions_file,
+    GUIcontext.EDIT_INITIAL_FIELD_FILE_ID: edit_initial_field_file,
     GUIcontext.CREATE_PARAM_STUDY_ID: create_param_study,
     GUIcontext.EDIT_PARAM_STUDY_ID: edit_param_study,
     GUIcontext.GEN_PARAM_STUDY_PYTHON_ID: generate_param_study_python,
index 61a10ecd69b0811f3ba2d4fb4cc594c42fe55671..bacfd434b9a8604be78767795b71228969b25555 100644 (file)
@@ -23,6 +23,7 @@ SET(PYFILES
   __init__.py
   interpolS.py
   boundaryConditions.py
+  initialField.py
 )
 
 # --- rules ---
diff --git a/src/HYDROTools/initialField.py b/src/HYDROTools/initialField.py
new file mode 100644 (file)
index 0000000..da4797c
--- /dev/null
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+import MEDLoader as ml
+import numpy as np
+
+# Open the file
+
+def set_var_on_group(filename, meshname, groups_val, varname):
+    """
+    Set values on groups_val
+
+    @param filename Name of the MED file
+    @param meshname Name of the mesh in the MED file
+    @param groups_val List of tuples(Name, value)
+    @param varname Name of the field
+    """
+    # Opening mesh
+    meshFile2D = ml.MEDFileUMesh(filename, meshname)
+
+    m2D = meshFile2D.getMeshAtLevel(0)
+
+    npoin = m2D.getNumberOfNodes()
+
+    # Values for the field
+    values = ml.DataArrayDouble(npoin)
+
+    for group , val in groups_val:
+        # Getting element in the group
+        cellsInGroup = meshFile2D.getGroupArr(0, group)
+        for cell in cellsInGroup:
+            # Get list of nodes in the element
+            nodes = m2D.getNodeIdsOfCell(cell[0])
+            for node in nodes:
+                values[node] = val
+
+    # Building the new field
+    field = ml.MEDCouplingFieldDouble.New(ml.ON_NODES)
+    field.setName(varname)
+    field.setMesh(m2D)
+    field.setArray(values)
+    field.setTime(0.0, 0, -1)
+
+    # Writing field on file
+    ml.WriteField(filename, field, False)
+
+
+if __name__ == "__main__":
+    filename = "garonne_1F.med"
+    meshname = "HYDRO_garonne_1"
+    groups = [("riveDroite",0.010),
+              ("riveGauche",0.010),
+              ("litMineur",10.0),
+              ]
+    varname = "WATER DEPTH"
+
+    set_var_on_group(filename, meshname, groups, varname)
+
+
+
index a8fdfdff96bdfd3dd96bfe947541853e5d81e531..f40a286821ba4ba4333576952d86689f7cb49008 100644 (file)
@@ -30,12 +30,14 @@ SET(PYFILES
   assignStrickler_gui.py
   interpolz_gui.py
   changeCoordsDialog.py
+  initialFieldDialog.py
 )
 
 SET(UIFILES
   assignStrickler.ui
   interpolz.ui
   changeCoords.ui
+  initialField.ui
 )
 
 SET(TEMPLFILES
diff --git a/src/salome_hydro/initialField.ui b/src/salome_hydro/initialField.ui
new file mode 100644 (file)
index 0000000..d745905
--- /dev/null
@@ -0,0 +1,280 @@
+<?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>586</width>
+    <height>576</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Initial Field</string>
+  </property>
+  <property name="layoutDirection">
+   <enum>Qt::LeftToRight</enum>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <widget class="QGroupBox" name="groupBoxIn">
+     <property name="title">
+      <string>Input</string>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_4">
+      <item>
+       <widget class="QFrame" name="fr_coordSystemIn"/>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <item>
+         <widget class="QLabel" name="lb_medFileIn">
+          <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_medFileIn"/>
+        </item>
+        <item>
+         <widget class="QToolButton" name="pb_medFileIn">
+          <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>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBoxOut">
+     <property name="title">
+      <string>Output</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_3">
+        <item>
+         <widget class="QLabel" name="lb_medFileOut">
+          <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_medFileOut">
+          <property name="statusTip">
+           <string>directory to store shapefiles and output mesh file if kept</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QToolButton" name="pb_medFileOut">
+          <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="QHBoxLayout" name="horizontalLayout_5">
+        <item>
+         <widget class="QLabel" name="lb_field">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>Field name</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLineEdit" name="le_field">
+          <property name="text">
+           <string>WATER DEPTH</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_6">
+        <item>
+         <widget class="QLabel" name="lb_defaultValue">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>default value</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QDoubleSpinBox" name="dsb_defaultValue">
+          <property name="toolTip">
+           <string>If modified, all the values at previous default value will be udated, leaving others as they are. </string>
+          </property>
+          <property name="decimals">
+           <number>3</number>
+          </property>
+          <property name="minimum">
+           <double>-9999.000000000000000</double>
+          </property>
+          <property name="maximum">
+           <double>9999.000000000000000</double>
+          </property>
+          <property name="value">
+           <double>0.010000000000000</double>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <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>
+         <widget class="QPushButton" name="pb_reset">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="toolTip">
+           <string>Reset  all values to default value</string>
+          </property>
+          <property name="text">
+           <string>reset</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="QTableWidget" name="tw_fieldValues">
+        <column>
+         <property name="text">
+          <string>group</string>
+         </property>
+        </column>
+        <column>
+         <property name="text">
+          <string>value</string>
+         </property>
+        </column>
+       </widget>
+      </item>
+      <item>
+       <widget class="QFrame" name="fr_CoordSystemOut"/>
+      </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/>
+</ui>
diff --git a/src/salome_hydro/initialFieldDialog.py b/src/salome_hydro/initialFieldDialog.py
new file mode 100644 (file)
index 0000000..14b3b62
--- /dev/null
@@ -0,0 +1,253 @@
+#  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
+import shutil
+
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+from PyQt5 import uic
+
+import salome
+salome.salome_init()
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+from salome.hydro.initialField import set_var_on_group
+
+import sysconfig
+pythonVersion = 'python' + sysconfig.get_python_version()
+hydro_solver_root = os.path.join(os.environ['HYDROSOLVER_ROOT_DIR'], 'lib', pythonVersion, 'site-packages', 'salome', 'salome', 'hydro')
+
+def get_med_groups( file_path ):
+    """
+    Get all the groups of faces in the first mesh
+    """
+    try:
+        (meshes, status) = smesh.CreateMeshesFromMED(file_path)
+    except:
+        print('No meshes found')
+        return (None, [])
+    if len(meshes)==0:
+        print('No mesh found')
+        return (None, [])
+    mesh1 = meshes[0]
+    print('Found mesh:', mesh1)
+    try:
+        grps = mesh1.GetGroups()
+        groups = [grp.GetName().strip() for grp in grps if grp.GetType() == SMESH.FACE]
+        if len(groups) == 0:
+            print("Problem! There are no groups of faces in the mesh!")
+            print("Please create at least the groups of faces corresponding to each region of the HYDRO case")
+            return (mesh1, [])
+        print('Found groups:', groups)
+    except:
+        print('No groups found')
+        return (mesh1, [])
+    return (mesh1, groups)
+
+class initialFieldDialog(QDialog):
+    """
+    """
+
+    def __init__(self, parent = None, modal = 0):
+        QDialog.__init__(self, parent)
+        uic.loadUi(os.path.join(hydro_solver_root, 'initialField.ui'), self )
+
+        # Connections
+        self.pb_medFileIn.clicked.connect(self.on_med_file_in_browse)
+        self.pb_medFileOut.clicked.connect(self.on_med_file_out_browse)
+        self.pb_reset.clicked.connect(self.on_fieldReset)
+        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.dsb_defaultValue.valueChanged.connect(self.on_defaultValueChanged)
+        self.medFileIn = None
+        self.medFileOut = None
+        self.le_field.setText("WATER DEPTH")
+        self.dsb_defaultValue.setValue(0.01)
+        self.previousDefaultValue = self.dsb_defaultValue.value()
+        self.med_groups = []
+        
+    def on_med_file_in_browse(self):
+        """
+        Select input MED file
+        """
+        print("on_med_file_in_browse")
+        self.medFileIn, filt = QFileDialog.getOpenFileName(self, self.tr("Input MED file"), "", self.tr("MED files (*.med)"))
+        print(self.medFileIn)
+        if not self.medFileIn:
+            return
+        self.le_medFileIn.setText(self.medFileIn)
+        if not os.path.isfile(self.medFileIn):
+            msgBox = QMessageBox()
+            msgBox.setText( "Input MED file does not exist" )
+            msgBox.exec_()
+            return        
+        a = os.path.splitext(self.medFileIn)
+        self.medFileOut = a[0] + '_ic' + a[1]
+        self.le_medFileOut.setText(self.medFileOut)
+        self.onMEDChanged()
+        
+    def onMEDChanged(self):
+        mesh, self.med_groups = get_med_groups(self.medFileIn)
+        self.meshName = mesh.GetName()
+        print(self.meshName)
+        print(self.med_groups)
+        
+        self.dsbItems = []
+        n = len(self.med_groups)
+        self.tw_fieldValues.setRowCount(n)
+        for i in range(n):
+            if self.tw_fieldValues.item( i, 0 ) is None:
+                self.tw_fieldValues.setItem( i, 0, QTableWidgetItem() )
+                self.tw_fieldValues.setItem( i, 1, QTableWidgetItem() )
+                self.tw_fieldValues.item( i, 0 ).setText( self.med_groups[i] )
+            dsb = QDoubleSpinBox()
+            dsb.setDecimals(3)
+            dsb.setRange(-9999.0, 9999.0)
+            dsb.setSingleStep(1.0)
+            dsb.setValue(self.dsb_defaultValue.value())
+            self.tw_fieldValues.setCellWidget( i, 1, dsb )
+            self.dsbItems.append(dsb)
+        
+    def on_med_file_out_browse(self):
+        """
+        Select output MED file
+        """
+        print("on_med_file_out_browse")
+        self.medFileOut, filt = QFileDialog.getSaveFileName(self, self.tr("Output MED file"), "", self.tr("MED files (*.med)"))
+        print(self.medFileOut)
+        if not self.medFileOut:
+            return
+        self.le_medFileOut.setText(self.medFileOut)
+        
+    def on_fieldReset(self):
+        """
+        Reset the values on each group to default value, erasing previous settings
+        """
+        print("onFieldReset")
+        for dsb in self.dsbItems:
+            dsb.setValue(self.dsb_defaultValue.value())
+            
+    def on_defaultValueChanged(self):
+        """
+        change the values set to previous default to new default, leaving other values unchanged
+        """
+        print("on_defaultValueChanged")
+        for dsb in self.dsbItems:
+            if dsb.value() == self.previousDefaultValue:
+                dsb.setValue(self.dsb_defaultValue.value())
+        self.previousDefaultValue = self.dsb_defaultValue.value()
+       
+    def on_help(self):
+        """
+        display a help message
+        """
+        msg = """
+        <h2>Initial field dialog</h2>
+
+        This dialog is used set an initial field with constant values per groups of faces in a mesh.
+        Typical use is to set an initial water depth on the minor bed of a river, for instance.
+        <br><br>        
+        The modified mesh is saved in a new file by default.
+        <br>
+        All the groups of faces are listed with their name, and a constant default value is set by default for each group.
+        It is possible to modify the value associated with some groups. It is also possible to modify the default value,
+        or to reset all the values to the default.
+        <br>     
+         <br><br>         
+        Below is the description of the dialog controls.
+
+        <h3>Input MED file</h3>
+        This field allows the selection of a med file (via the standard file open dialog).
+        The filling of this field is mandatory.
+
+        <h3>Output MED file</h3>
+        This field allows the definition of a med file (via the standard file save dialog).
+        The filling of this field is mandatory. It is set by default, with a suffix on input MED file.
+        It can be set equal to input MED file.
+        
+        <h3>Field name</h3>
+        The name of the field to create. 
+
+        <h3>default value</h3>
+        The default value for the field. When modified, groups set to the default value are modified.
+        
+        <h3>reset</h3>
+        This button forces a general reset of all the groups to the default value.
+        
+        <h3>table group value</h3>
+        This table is filled with one line per group of faces found in the mesh
+        """
+        QMessageBox.about(self, self.tr("About mesh edges to shapes dialog"), msg);
+       
+   
+    def on_accept(self):
+        print("accept")
+        #TODO check medfile in and out not empty
+        #TODO preset for medFileOut
+        medFileIn = self.le_medFileIn.text()
+        medFileOut = self.le_medFileOut.text()
+        meshName = self.meshName
+        fieldName = self.le_field.text()
+        groups = []
+        n = len(self.med_groups)
+        for i in range(n):
+            groups.append((self.med_groups[i], self.dsbItems[i].value()))
+        print(medFileIn)
+        print(medFileOut)
+        print(meshName)
+        print(fieldName)
+        print(groups)
+
+        if not os.path.isfile(medFileIn):
+            msgBox = QMessageBox()
+            msgBox.setText( "Input MED file does not exist" )
+            msgBox.exec_()
+            return
+        dir = os.path.dirname(medFileOut)
+        base = os.path.basename(medFileOut)
+        ext = os.path.splitext(medFileOut)[1]
+        if not os.path.isdir(dir) or (base == "") or (ext.lower() != ".med"):
+            msgBox = QMessageBox()
+            msgBox.setText( "Output MED file is not a valid path" )
+            msgBox.exec_()
+            return
+        if medFileOut != medFileIn:
+            shutil.copyfile(medFileIn, medFileOut)
+        set_var_on_group(medFileOut, meshName, groups, fieldName)
+        self.accept()
+        
+        #initialField(medFileIn, medFileOut, epsgIn, epsgOut, offsetXin, offsetYin, offsetXout, offsetYout)
+
+    def on_reject(self):
+        print("reject")
+        self.reject()
+        
+
+def execDialog(context):
+    print("execDialog")
+  # get context study, salomeGui
+    study = context.study
+    sg = context.sg
+    dlg = initialFieldDialog()
+    dlg.exec_()