From 2d2b8dfab64e9846f37608a6a4cf9ad7c3e8b74e Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Thu, 20 Aug 2020 15:08:02 +0200 Subject: [PATCH] interpolz dialogs improvement --- src/salome_hydro/assignStrickler.ui | 16 +- src/salome_hydro/assignStrickler_gui.py | 24 +- src/salome_hydro/changeCoordsDialog.py | 2 +- src/salome_hydro/interpolz.ui | 285 ++++++++++++++---------- src/salome_hydro/interpolz_gui.py | 52 +++-- 5 files changed, 218 insertions(+), 161 deletions(-) diff --git a/src/salome_hydro/assignStrickler.ui b/src/salome_hydro/assignStrickler.ui index 34f6d48..7ef51ba 100644 --- a/src/salome_hydro/assignStrickler.ui +++ b/src/salome_hydro/assignStrickler.ui @@ -7,14 +7,14 @@ 0 0 496 - 201 + 213 Dialog - - + + @@ -35,7 +35,7 @@ - + Paths @@ -49,7 +49,7 @@ path of the script to create, for generation of Strickler coefficients - Output path: + Script output path: @@ -66,7 +66,7 @@ MED file containing the mesh, that will receive a new field on nodes, for Strickler coefficients - MED file: + Innput MED file: @@ -96,7 +96,7 @@ - + if checked the script is generated and executed on apply, otherwise it is only generated for later use @@ -106,7 +106,7 @@ - + QFrame::NoFrame diff --git a/src/salome_hydro/assignStrickler_gui.py b/src/salome_hydro/assignStrickler_gui.py index dd4f093..8d6a983 100644 --- a/src/salome_hydro/assignStrickler_gui.py +++ b/src/salome_hydro/assignStrickler_gui.py @@ -129,29 +129,21 @@ class assignStricklerDlg( QDialog ): msg = """

assignStrickler dialog

- This dialog is a tool for automation the writing of the script assignStrickler.py. + This dialog is a tool for generation and execution of the script assignStrickler.py.

Calculation case

- 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. -

Output path

+

Script output path

The path for the output, i.e. the path of the target script assignStrickler. -

MED file

- The path to MED file where MED groups are extracted. +

Input MED file

+ The path to MED file where the MED field is written. -

Method

- The interpolation method (interpolation at the nearest point and linear interpolation from a triangulation of the cloud of points). - -

Undefined Z

- The Z value for nodes outside the regions. - -

Table

- 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. +

Execute the script

+ 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__': diff --git a/src/salome_hydro/changeCoordsDialog.py b/src/salome_hydro/changeCoordsDialog.py index 177a1c7..fbf360f 100644 --- a/src/salome_hydro/changeCoordsDialog.py +++ b/src/salome_hydro/changeCoordsDialog.py @@ -124,7 +124,7 @@ class changeCoordsDialog(QDialog):

Output Coord System

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): diff --git a/src/salome_hydro/interpolz.ui b/src/salome_hydro/interpolz.ui index c6eec98..747c266 100644 --- a/src/salome_hydro/interpolz.ui +++ b/src/salome_hydro/interpolz.ui @@ -6,131 +6,44 @@ 0 0 - 850 + 851 651
Dialog - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Apply and Close - - - - - - - Apply - - - - - - - Close - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Help - - - - - + + + + + + + Input MED file: + + + + + + + <html><head/><body><p>MED file containing the mesh, that will receive a new or updated field with altitude</p></body></html> + + + + + + + ... + + + + - - - - Paths - - - - - - - - ... - - - - - - - ... - - - - - - - - - - Output path: - - - - - - - - - - MED file: - - - - - - - - - + + + <html><head/><body><p>Set the bathymetry, using an active Calculation Case from HYDRO module:</p><p><span style=" font-weight:600;">Calculation Case</span>: set the bathymetry for all the groups of faces.</p><p><span style=" font-weight:600;">MED group bathymetry</span>: set the bathymetry for only one MED group of faces (other groups unchanged).</p></body></html> + 1 @@ -149,7 +62,11 @@ - + + + Select an active calculation case from HYDRO module in SALOME Object Browser + + @@ -176,15 +93,26 @@
- + + + <html><head/><body><p>select the method used to interpolate the bathymetry:</p><p>use the z value of the nearest bathymetry point, </p><p>interpolate between 3 bathymetry points (linear triangle interpolation),</p><p>...</p></body></html> + + - + + + <html><head/><body><p>Z value to set when no bathymetry is available for some point</p><p>(Mainly used to help in case of problem, when some points are not associated with any bathymetry)</p><p><br/></p></body></html> + +
+ + Associate MED groups with Regions from Calculation Case + 250 @@ -212,7 +140,7 @@ - Bathymetry + MED Group bathymetry @@ -257,7 +185,11 @@ - + + + ^Select a Med group of faces in the list + + @@ -278,7 +210,11 @@ - + + + Select an active bathymetry from HYDRO module in SALOME Object Browser + + @@ -299,6 +235,109 @@ + + + + + + Script output path: + + + + + + + <html><head/><body><p>path of the script to create, for generation of bathymetry (altitude) field</p></body></html> + + + + + + + ... + + + + + + + + + if checked the script is generated and executed on apply, otherwise it is only generated for later use + + + Execute the script + + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Apply and Close + + + + + + + Apply + + + + + + + Close + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Help + + + + + + diff --git a/src/salome_hydro/interpolz_gui.py b/src/salome_hydro/interpolz_gui.py index a1021c6..84a26d8 100644 --- a/src/salome_hydro/interpolz_gui.py +++ b/src/salome_hydro/interpolz_gui.py @@ -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 = """ -

Interpolz dialog

+

Interpolz dialog

- This dialog is a tool for automation the writing of the script interpolz.py. + This dialog is a tool for generation and execution of the script interpolz.py. -

Calculation case

- The name of the calculation case. It can be filled automatically on the base of selection or can be input by user. +

Input MED file

+ The path to MED file where MED groups are extracted. -

Output path

- The path for the output, i.e. the path of the target script interpolz. +

TAB: Calculation Case

-

MED file

- The path to MED file where MED groups are extracted. +

    Calculation case

    + The name of the calculation case. It can be filled automatically on the base of selection or can be set by user.

    Method

    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.

    Table

    - The table with MED groups and regions names. + The table with MED groups and regions names.
+ +

TAB: MED group bathymetry

+ +

    Calculation case

    + The name of the bathymetry. It can be filled automatically on the base of selection or can be set by user. + +

    Method

    + The interpolation method (interpolation at the nearest point and linear interpolation from a triangulation of the cloud of points). + +

    Undefined Z

    + The Z value for nodes outside the regions.
+ +

Script output path

+ The path for the output, i.e. the path of the target script interpolz. + +

Execute the script

+ 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__': -- 2.39.2