From d705815efcbf3e34bb65290e6306bc2d9fe6c5ed Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Fri, 25 Mar 2022 17:17:57 +0100 Subject: [PATCH] Minor documentation and code review corrections (29) Avoid backup file name problem on Windows --- doc/en/license.rst | 12 +++++------ doc/en/tui.rst | 4 ++-- doc/fr/license.rst | 15 +++++++------ doc/fr/tui.rst | 27 ++++++++++++------------ src/daSalome/daGUI/daGuiImpl/adaoCase.py | 6 +++++- 5 files changed, 35 insertions(+), 29 deletions(-) diff --git a/doc/en/license.rst b/doc/en/license.rst index 7647572..6c0beb2 100644 --- a/doc/en/license.rst +++ b/doc/en/license.rst @@ -47,19 +47,19 @@ GPL), as stated here and in the source files:: 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 + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -In addition, it is requested that any publication or presentation describing +In addition, it is requested that any publication or presentation, describing work using this module, or any commercial or non-commercial product using it, -cite at least one of the references below with the current year added: +explicitly cite ADAO and at least one of the references below with the current +year added: * *ADAO, a module for Data Assimilation and Optimization*, http://www.salome-platform.org/ @@ -70,5 +70,5 @@ cite at least one of the references below with the current year added: * *SALOME The Open Source Integration Platform for Numerical Simulation*, http://www.salome-platform.org/ -The documentation of the module is also covered by the license and the +The documentation of the module is also fully covered by the license and the requirement of quoting. diff --git a/doc/en/tui.rst b/doc/en/tui.rst index e8c8e7c..9acb8d5 100644 --- a/doc/en/tui.rst +++ b/doc/en/tui.rst @@ -35,12 +35,12 @@ :scale: 50% This section presents advanced usage of the ADAO module using its text -programming interface (API/TUI). This interface gives ability to create a +programming interface (API/TUI). This interface gives user ability to create a calculation object in a similar way than the case building obtained through the graphical interface (GUI). A scripted form of a case built in the GUI can be obtained directly using the TUI export button |eficas_totui| integrated in the interface, but more complicated or integrated cases can be build only using TUI -approach. When one wants to elaborate "by hand" the TUI calculation case, it is +approach. When one wants to elaborate directly the TUI calculation case, it is recommended to extensively use all the ADAO module documentation, and to go back if necessary to the graphical interface (GUI), to get all the elements allowing to correctly set the commands. The general used notions and terms are diff --git a/doc/fr/license.rst b/doc/fr/license.rst index bbfcbfc..4d94eb3 100644 --- a/doc/fr/license.rst +++ b/doc/fr/license.rst @@ -47,18 +47,19 @@ tel qu'il est déclaré ici et dans les fichiers sources:: 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 + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -En outre, on demande que toute publication ou présentation décrivant des travaux -utilisant ce module, ou tout produit commercial ou non l'utilisant, cite au -moins l'une des références ci-dessous en ajoutant l'année en cours : +En outre, on demande que toute publication ou présentation décrivant des +travaux utilisant ce module, ou tout produit commercial ou non l'utilisant, +cite explicitement ADAO et au moins l'une des références ci-dessous en ajoutant +l'année en cours : * *ADAO, a module for Data Assimilation and Optimization*, http://www.salome-platform.org/ @@ -69,5 +70,5 @@ moins l'une des références ci-dessous en ajoutant l'année en cours : * *SALOME The Open Source Integration Platform for Numerical Simulation*, http://www.salome-platform.org/ -La documentation du module est également couverte par la licence et l'obligation -de citation. +La documentation du module est également entièrement couverte par la licence et +l'obligation de citation. diff --git a/doc/fr/tui.rst b/doc/fr/tui.rst index a4b2d53..7de90cd 100644 --- a/doc/fr/tui.rst +++ b/doc/fr/tui.rst @@ -35,19 +35,20 @@ :scale: 50% Cette section présente des méthodes avancées d'usage du module ADAO à l'aide de -son interface de programmation textuelle (API/TUI). Cette interface permet de -créer un objet de calcul de manière similaire à la construction d'un cas par -l'interface graphique (GUI). On peut d'ailleurs directement obtenir une forme -scriptée d'un cas construit dans l'interface graphique GUI à l'aide du bouton -d'export TUI |eficas_totui| intégré dans l'interface, mais des cas plus -compliqués ou plus intégrés peuvent uniquement être construits avec la démarche -TUI. Dans le cas où l'on désire réaliser à la main le cas de calcul TUI, on -recommande de bien s'appuyer sur l'ensemble de la documentation du module ADAO, -et de se reporter si nécessaire à l'interface graphique (GUI), pour disposer de -l'ensemble des éléments permettant de renseigner correctement les commandes. -Les notions générales et termes utilisés ici sont définis dans -:ref:`section_theory`. Comme dans l'interface graphique, on note que la -démarche en TUI est destinée à créer et gérer un unique cas de calcul. +son interface de programmation textuelle (API/TUI). Cette interface permet à +l'utilisateur de créer un objet de calcul de manière similaire à la +construction d'un cas par l'interface graphique (GUI). On peut d'ailleurs +directement obtenir une forme scriptée d'un cas construit dans l'interface +graphique GUI à l'aide du bouton d'export TUI |eficas_totui| intégré dans +l'interface, mais des cas plus compliqués ou plus intégrés peuvent uniquement +être construits avec la démarche TUI. Dans le cas où l'on désire réaliser +directement le cas de calcul TUI, on recommande de bien s'appuyer sur +l'ensemble de la documentation du module ADAO, et de se reporter si nécessaire +à l'interface graphique (GUI), pour disposer de l'ensemble des éléments +permettant de renseigner correctement les commandes. Les notions générales et +termes utilisés ici sont définis dans :ref:`section_theory`. Comme dans +l'interface graphique, on note que la démarche en TUI est destinée à créer et +gérer un unique cas de calcul. .. _subsection_tui_creating: diff --git a/src/daSalome/daGUI/daGuiImpl/adaoCase.py b/src/daSalome/daGUI/daGuiImpl/adaoCase.py index 1875d24..4dc6007 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoCase.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoCase.py @@ -75,6 +75,8 @@ class AdaoCase: self.yacs_filename = self.filename[:self.filename.rfind(".")] + '.xml' yacs_filename_backup = self.filename[:self.filename.rfind(".")] + '.xml.back' if os.path.exists(self.yacs_filename): + if os.path.exists(yacs_filename_backup): + os.unlink(yacs_filename_backup) os.rename(self.yacs_filename, yacs_filename_backup) self.eficas_editor.modified = True @@ -112,7 +114,9 @@ class AdaoCase: self.tui_filename = self.filename[:self.filename.rfind(".")] + '_TUI.py' tui_filename_backup = self.filename[:self.filename.rfind(".")] + '_TUI.py.back' if os.path.exists(self.tui_filename): - os.rename(self.tui_filename, tui_filename_backup) + if os.path.exists(tui_filename_backup): + os.unlink(tui_filename_backup) + os.rename(self.tui_filename, tui_filename_backup) self.eficas_editor.modified = True self.eficas_editor.saveFile() -- 2.39.2