]> SALOME platform Git repositories - modules/hydrosolver.git/commitdiff
Salome HOME
interpolz dialogs improvement
authorPaul RASCLE <paul.rascle@openfields.fr>
Thu, 20 Aug 2020 13:08:02 +0000 (15:08 +0200)
committerYOANN AUDOUIN <B61570@dsp0851742.postes.calibre.edf.fr>
Fri, 30 Oct 2020 16:04:18 +0000 (17:04 +0100)
src/salome_hydro/assignStrickler.ui
src/salome_hydro/assignStrickler_gui.py
src/salome_hydro/changeCoordsDialog.py
src/salome_hydro/interpolz.ui
src/salome_hydro/interpolz_gui.py

index 34f6d4872703f69120f730c1368eff29f50c48b5..7ef51ba27481bda58b378157a5b785e3c9eaf08a 100644 (file)
@@ -7,14 +7,14 @@
     <x>0</x>
     <y>0</y>
     <width>496</width>
-    <height>201</height>
+    <height>213</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Dialog</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout_2">
-   <item row="0" column="0">
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
     <layout class="QGridLayout" name="gridLayout">
      <item row="0" column="1">
       <widget class="QLabel" name="lblCalcCase">
@@ -35,7 +35,7 @@
      </item>
     </layout>
    </item>
-   <item row="1" column="0">
+   <item>
     <widget class="QGroupBox" name="grpPaths">
      <property name="title">
       <string>Paths</string>
@@ -49,7 +49,7 @@
            <string>path of the script to create, for generation of Strickler coefficients</string>
           </property>
           <property name="text">
-           <string>Output path:</string>
+           <string>Script output path:</string>
           </property>
          </widget>
         </item>
@@ -66,7 +66,7 @@
            <string>MED file containing the mesh, that will receive a new field on nodes, for Strickler coefficients</string>
           </property>
           <property name="text">
-           <string>MED file:</string>
+           <string>Innput MED file:</string>
           </property>
          </widget>
         </item>
@@ -96,7 +96,7 @@
      </layout>
     </widget>
    </item>
-   <item row="2" column="0">
+   <item>
     <widget class="QCheckBox" name="cb_scriptExec">
      <property name="toolTip">
       <string>if checked the script is generated and executed on apply, otherwise it is only generated for later use</string>
      </property>
     </widget>
    </item>
-   <item row="3" column="0">
+   <item>
     <widget class="QFrame" name="frame">
      <property name="frameShape">
       <enum>QFrame::NoFrame</enum>
index dd4f0931641859d8542091c8108e5774203a5279..8d6a9833c5a04d42236c7b283d3934baf5192af8 100644 (file)
@@ -129,29 +129,21 @@ class assignStricklerDlg( QDialog ):
         msg = """
         <h2>assignStrickler dialog</h2>
 
-        This dialog is a tool for automation the writing of the script <b>assignStrickler.py</b>.
+        This dialog is a tool for generation and execution of the script <b>assignStrickler.py</b>.
 
         <h3>Calculation case</h3>
-        The name of the calculation case. It can be filled automatically on the base of selection or can be input by user.
+        The name of the calculation case. It can be filled automatically on the base of selection or can be set by user.
 
-        <h3>Output path</h3>
+        <h3>Script output path</h3>
         The path for the output, i.e. the path of the target script assignStrickler.
 
-        <h3>MED file</h3>
-        The path to MED file where MED groups are extracted.
+        <h3>Input MED file</h3>
+        The path to MED file where the MED field is written.
 
-        <h3>Method</h3>
-        The interpolation method (interpolation at the nearest point and linear interpolation from a triangulation of the cloud of points).
-
-        <h3>Undefined Z</h3>
-        The Z value for nodes outside the regions.
-
-        <h3>Table</h3>
-        The table with MED groups and regions names.
-
-        When the data is input, the user clicks on "Apply" or "Apply and Close" button to perform the script generation.
+        <h3>Execute the script</h3>
+        Execute the script on Apply if checked, or just keep it for later use.
         """
-        QMessageBox.about(self, self.tr("About boundary conditions dialog"), msg);
+        QMessageBox.about(self, self.tr("About assign Strckler coefficients dialog"), msg);
 
 
 if __name__=='__main__':
index 177a1c7952e6e77f1daf52a04891801e565efbc7..fbf360fda6dc4ab0ae6ca0bd423e4004b984cd73 100644 (file)
@@ -124,7 +124,7 @@ class changeCoordsDialog(QDialog):
         <h3>Output Coord System</h3>
         This combo box is use to select the coordinate system of the output mesh. 
         """
-        QMessageBox.about(self, self.tr("About mesh edges to shapes dialog"), msg);
+        QMessageBox.about(self, self.tr("About change coordinates dialog"), msg);
        
    
     def on_accept(self):
index c6eec98268eaa501c054bb1f98b6f36d249c60e0..747c2661106e36437a8380f7aefe8dec02cc64a6 100644 (file)
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>850</width>
+    <width>851</width>
     <height>651</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Dialog</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout_2">
-   <item row="2" column="0">
-    <widget class="QFrame" name="frame">
-     <property name="frameShape">
-      <enum>QFrame::NoFrame</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Plain</enum>
-     </property>
-     <layout class="QHBoxLayout" name="horizontalLayout_2">
-      <property name="spacing">
-       <number>0</number>
-      </property>
-      <property name="leftMargin">
-       <number>0</number>
-      </property>
-      <property name="topMargin">
-       <number>0</number>
-      </property>
-      <property name="rightMargin">
-       <number>0</number>
-      </property>
-      <property name="bottomMargin">
-       <number>0</number>
-      </property>
-      <item>
-       <widget class="QPushButton" name="ApplyClose">
-        <property name="text">
-         <string>Apply and Close</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QPushButton" name="Apply">
-        <property name="text">
-         <string>Apply</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QPushButton" name="Close">
-        <property name="text">
-         <string>Close</string>
-        </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="Help">
-        <property name="text">
-         <string>Help</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="lblMEDFile">
+       <property name="text">
+        <string>Input MED file:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="MEDFile">
+       <property name="toolTip">
+        <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;MED file containing the mesh, that will receive a new or updated field with altitude&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QToolButton" name="btnMEDFile">
+       <property name="text">
+        <string>...</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
-   <item row="1" column="0">
-    <widget class="QGroupBox" name="grpPaths">
-     <property name="title">
-      <string>Paths</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_4">
-      <item row="0" column="0">
-       <layout class="QGridLayout" name="gridLayout_3">
-        <item row="1" column="3">
-         <widget class="QToolButton" name="btnMEDFile">
-          <property name="text">
-           <string>...</string>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="3">
-         <widget class="QToolButton" name="btnOutputPath">
-          <property name="text">
-           <string>...</string>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="2">
-         <widget class="QLineEdit" name="OutputPath"/>
-        </item>
-        <item row="0" column="0">
-         <widget class="QLabel" name="lblOutputPath">
-          <property name="text">
-           <string>Output path:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="2">
-         <widget class="QLineEdit" name="MEDFile"/>
-        </item>
-        <item row="1" column="0">
-         <widget class="QLabel" name="lblMEDFile">
-          <property name="text">
-           <string>MED file:</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="0" column="0">
+   <item>
     <widget class="QTabWidget" name="tabWidget">
+     <property name="toolTip">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the bathymetry, using an active Calculation Case from HYDRO module:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Calculation Case&lt;/span&gt;: set the bathymetry for all the groups of faces.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;MED group bathymetry&lt;/span&gt;: set the bathymetry for only one MED group of faces (other groups unchanged).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
      <property name="currentIndex">
       <number>1</number>
      </property>
           </widget>
          </item>
          <item row="0" column="2">
-          <widget class="QLineEdit" name="CalcCase"/>
+          <widget class="QLineEdit" name="CalcCase">
+           <property name="toolTip">
+            <string>Select an active calculation case from HYDRO module in SALOME Object Browser</string>
+           </property>
+          </widget>
          </item>
         </layout>
        </item>
              </widget>
             </item>
             <item row="1" column="1">
-             <widget class="QComboBox" name="InterpMethod"/>
+             <widget class="QComboBox" name="InterpMethod">
+              <property name="toolTip">
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;select the method used to interpolate the bathymetry:&lt;/p&gt;&lt;p&gt;use the z value of the nearest bathymetry point, &lt;/p&gt;&lt;p&gt;interpolate between 3 bathymetry points (linear triangle interpolation),&lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+              </property>
+             </widget>
             </item>
             <item row="0" column="1">
-             <widget class="QDoubleSpinBox" name="UndefZ"/>
+             <widget class="QDoubleSpinBox" name="UndefZ">
+              <property name="toolTip">
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Z value to set when no bathymetry is available for some point&lt;/p&gt;&lt;p&gt;(Mainly used to help in case of problem, when some points are not associated with any  bathymetry)&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+              </property>
+             </widget>
             </item>
            </layout>
           </item>
           <item row="1" column="0">
            <widget class="QTableWidget" name="Groups">
+            <property name="toolTip">
+             <string>Associate MED groups with Regions from Calculation Case</string>
+            </property>
             <attribute name="horizontalHeaderDefaultSectionSize">
              <number>250</number>
             </attribute>
      </widget>
      <widget class="QWidget" name="bathy_tab">
       <attribute name="title">
-       <string>Bathymetry</string>
+       <string>MED Group bathymetry</string>
       </attribute>
       <layout class="QGridLayout" name="gridLayout_14">
        <item row="2" column="0">
        <item row="1" column="0">
         <layout class="QGridLayout" name="gridLayout_13">
          <item row="0" column="2">
-          <widget class="QComboBox" name="medGroupNames"/>
+          <widget class="QComboBox" name="medGroupNames">
+           <property name="toolTip">
+            <string>^Select a Med group of faces in the list</string>
+           </property>
+          </widget>
          </item>
          <item row="0" column="1">
           <widget class="QLabel" name="lblMedGroup">
           </widget>
          </item>
          <item row="0" column="2">
-          <widget class="QLineEdit" name="BathyName"/>
+          <widget class="QLineEdit" name="BathyName">
+           <property name="toolTip">
+            <string>Select an active bathymetry from HYDRO module in SALOME Object Browser</string>
+           </property>
+          </widget>
          </item>
         </layout>
        </item>
      </widget>
     </widget>
    </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
+     <item>
+      <widget class="QLabel" name="lblOutputPath">
+       <property name="text">
+        <string>Script output path:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="OutputPath">
+       <property name="toolTip">
+        <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;path of the script to create, for generation of bathymetry (altitude) field&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QToolButton" name="btnOutputPath">
+       <property name="text">
+        <string>...</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="cb_scriptExec">
+     <property name="toolTip">
+      <string>if checked the script is generated and executed on apply, otherwise it is only generated for later use</string>
+     </property>
+     <property name="text">
+      <string>Execute the script</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QFrame" name="frame">
+     <property name="frameShape">
+      <enum>QFrame::NoFrame</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Plain</enum>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_2">
+      <property name="spacing">
+       <number>0</number>
+      </property>
+      <property name="leftMargin">
+       <number>0</number>
+      </property>
+      <property name="topMargin">
+       <number>0</number>
+      </property>
+      <property name="rightMargin">
+       <number>0</number>
+      </property>
+      <property name="bottomMargin">
+       <number>0</number>
+      </property>
+      <item>
+       <widget class="QPushButton" name="ApplyClose">
+        <property name="text">
+         <string>Apply and Close</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="Apply">
+        <property name="text">
+         <string>Apply</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="Close">
+        <property name="text">
+         <string>Close</string>
+        </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="Help">
+        <property name="text">
+         <string>Help</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
   </layout>
  </widget>
  <resources/>
index a1021c68ac44959f5ad98b58afe49749aad3eb9f..84a26d866018e8a1ddf074869341a1ac4daa81c8 100644 (file)
@@ -208,6 +208,8 @@ class InterpolzDlg( QDialog ):
         path = str(self.OutputPath.text())
         med_file = str(self.MEDFile.text())
         print('current  TAB = ', self.tabWidget.currentIndex())
+        isScriptExec = self.cb_scriptExec.isChecked()
+
         if self.tabWidget.currentIndex() == 0: #calc case tab
             calc_case = str(self.CalcCase.text())
             med_groups_regions = {}
@@ -241,8 +243,12 @@ class InterpolzDlg( QDialog ):
                 #  iinterp = 1
                 #generate( path, calc_case, med_file, med_groups_regions, z_undef, iinterp )
                 generate( path, calc_case, med_file, med_groups_regions, z_undef, regions_interp_method )
-                msg = "InterpolZ script is successfully generated"
+                msg = "InterpolZ script is successfully generated"                
                 result = True
+                
+                if isScriptExec:
+                    msg = msg + " and executed"
+                    exec(open(path).read())
         
             QMessageBox.information( self, "", msg )
             return result
@@ -270,10 +276,14 @@ class InterpolzDlg( QDialog ):
             if len(msg)==0:
                 iinterp = 0
                 if 'Linear' in interp:
-                  iinterp = 1
+                    iinterp = 1
                 generate_B( path, bathy_name, med_file, group_name, z_undef, iinterp )
                 msg = "InterpolZ_B script is successfully generated"
                 result = True
+                
+                if isScriptExec:
+                    msg = msg + " and executed"
+                    exec(open(path).read())
         
             QMessageBox.information( self, "", msg )
             return result
@@ -284,18 +294,17 @@ class InterpolzDlg( QDialog ):
     """Shows help page"""
     def onHelp( self ):
         msg = """
-        <h2>Interpolz dialog</h2>
+        <h1>Interpolz dialog</h1>
 
-        This dialog is a tool for automation the writing of the script <b>interpolz.py</b>.
+        This dialog is a tool for generation and execution of the script <b>interpolz.py</b>.
 
-        <h3>Calculation case</h3>
-        The name of the calculation case. It can be filled automatically on the base of selection or can be input by user.
+        <h3>Input MED file</h3>
+        The path to MED file where MED groups are extracted.
 
-        <h3>Output path</h3>
-        The path for the output, i.e. the path of the target script interpolz.
+        <h2>TAB: Calculation Case</h2>
 
-        <h3>MED file</h3>
-        The path to MED file where MED groups are extracted.
+        <ol><h3>Calculation case</h3>
+        The name of the calculation case. It can be filled automatically on the base of selection or can be set by user.
 
         <h3>Method</h3>
         The interpolation method (interpolation at the nearest point and linear interpolation from a triangulation of the cloud of points).
@@ -304,11 +313,28 @@ class InterpolzDlg( QDialog ):
         The Z value for nodes outside the regions.
 
         <h3>Table</h3>
-        The table with MED groups and regions names.
+        The table with MED groups and regions names.</ol>
+
+        <h2>TAB: MED group bathymetry</h2>
+        
+        <ol><h3>Calculation case</h3>
+        The name of the bathymetry. It can be filled automatically on the base of selection or can be set by user.
+
+        <h3>Method</h3>
+        The interpolation method (interpolation at the nearest point and linear interpolation from a triangulation of the cloud of points).
+
+        <h3>Undefined Z</h3>
+        The Z value for nodes outside the regions.</ol>
+
+        <h3>Script output path</h3>
+        The path for the output, i.e. the path of the target script interpolz.
+
+        <h3>Execute the script</h3>
+        Execute the script on Apply if checked, or just keep it for later use.
 
-        When the data is input, the user clicks on "Apply" or "Apply and Close" button to perform the script generation.
+        When the data is set, the user clicks on "Apply" or "Apply and Close" button to perform the script generation.
         """
-        QMessageBox.about(self, self.tr("About boundary conditions dialog"), msg);
+        QMessageBox.about(self, self.tr("About bathymetry interpolation dialog"), msg);
 
 
 if __name__=='__main__':