From c52669a85d8ae31477fe5ed83df35d6f84080e62 Mon Sep 17 00:00:00 2001 From: nicolas Date: Wed, 11 Sep 2013 15:07:58 +0000 Subject: [PATCH] =?utf8?q?GUI=20pour=20la=20cr=C3=83=C2=A9ation=20du=20sch?= =?utf8?q?=C3=83=C2=A9ma=20YACS?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- resources/Makefile.am | 1 + resources/yacs.png | Bin 0 -> 173 bytes src/HOMARDGUI/CreateYACS.h | 260 ++++++++++++++++++++++++++ src/HOMARDGUI/CreateYACS.ui | 266 +++++++++++++++++++++++++++ src/HOMARDGUI/HOMARDGUI.cxx | 60 ++++-- src/HOMARDGUI/HOMARDGUI.h | 1 + src/HOMARDGUI/HOMARD_msg_en.ts | 12 ++ src/HOMARDGUI/HOMARD_msg_fr.ts | 28 +++ src/HOMARDGUI/HOMARD_msg_ja.ts | 28 +++ src/HOMARDGUI/HomardQtCommun.cxx | 2 +- src/HOMARDGUI/Makefile.am | 5 + src/HOMARDGUI/MonCreateYACS.cxx | 199 ++++++++++++++++++++ src/HOMARDGUI/MonCreateYACS.h | 66 +++++++ src/HOMARDGUI/MonPursueIteration.cxx | 1 - 14 files changed, 909 insertions(+), 20 deletions(-) create mode 100644 resources/yacs.png create mode 100644 src/HOMARDGUI/CreateYACS.h create mode 100644 src/HOMARDGUI/CreateYACS.ui create mode 100644 src/HOMARDGUI/MonCreateYACS.cxx create mode 100644 src/HOMARDGUI/MonCreateYACS.h diff --git a/resources/Makefile.am b/resources/Makefile.am index 3ea6d8b5..957cdc87 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -62,6 +62,7 @@ dist_salomeres_DATA = \ texte_2.png \ triangle.png \ whatis.png \ + yacs.png \ yacs_01.xml \ zone_boxdxyz.png \ zone_boxdxyz_2.png \ diff --git a/resources/yacs.png b/resources/yacs.png new file mode 100644 index 0000000000000000000000000000000000000000..39c00aa1306302f9eafddb29018916cabb88429d GIT binary patch literal 173 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJ5>FS$kcif|(=7Q8DDbct>OX$@ zGg2dCkw=B&H>b_P$~MQ^HC#C!e%kYf zI=^h(>phuO>EOo_#>SpAwVlqs7Sk7`zqtJ7mxNb?*?s0cC;0X< +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_CreateYACS +{ +public: + QGridLayout *gridLayout_2; + QGridLayout *gridLayout; + QLabel *Case; + QPushButton *PBCaseName; + QLineEdit *LECaseName; + QHBoxLayout *_2; + QLabel *Script; + QPushButton *PushFile; + QLineEdit *LEFileNameScript; + QHBoxLayout *hboxLayout; + QLabel *DirectoryStart; + QPushButton *PushDir; + QLineEdit *LEDirName; + QHBoxLayout *_3; + QLabel *MeshFile; + QPushButton *PushFile_2; + QLineEdit *LEFileNameMesh; + QRadioButton *RBStatic; + QRadioButton *RBTransient; + QGroupBox *GroupButtons; + QGridLayout *gridLayout1; + QPushButton *buttonHelp; + QPushButton *buttonApply; + QPushButton *buttonOk; + QPushButton *buttonCancel; + QSpacerItem *spacer_2; + + void setupUi(QDialog *CreateYACS) + { + if (CreateYACS->objectName().isEmpty()) + CreateYACS->setObjectName(QString::fromUtf8("CreateYACS")); + CreateYACS->resize(601, 300); + QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(CreateYACS->sizePolicy().hasHeightForWidth()); + CreateYACS->setSizePolicy(sizePolicy); + CreateYACS->setAutoFillBackground(true); + gridLayout_2 = new QGridLayout(CreateYACS); + gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); + gridLayout = new QGridLayout(); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + Case = new QLabel(CreateYACS); + Case->setObjectName(QString::fromUtf8("Case")); + + gridLayout->addWidget(Case, 0, 0, 1, 1); + + PBCaseName = new QPushButton(CreateYACS); + PBCaseName->setObjectName(QString::fromUtf8("PBCaseName")); + PBCaseName->setEnabled(true); + PBCaseName->setMaximumSize(QSize(50, 27)); + + gridLayout->addWidget(PBCaseName, 0, 1, 1, 1); + + LECaseName = new QLineEdit(CreateYACS); + LECaseName->setObjectName(QString::fromUtf8("LECaseName")); + LECaseName->setMinimumSize(QSize(382, 21)); + + gridLayout->addWidget(LECaseName, 0, 2, 1, 1); + + + gridLayout_2->addLayout(gridLayout, 0, 0, 1, 3); + + _2 = new QHBoxLayout(); +#ifndef Q_OS_MAC + _2->setSpacing(6); +#endif + _2->setContentsMargins(0, 0, 0, 0); + _2->setObjectName(QString::fromUtf8("_2")); + Script = new QLabel(CreateYACS); + Script->setObjectName(QString::fromUtf8("Script")); + + _2->addWidget(Script); + + PushFile = new QPushButton(CreateYACS); + PushFile->setObjectName(QString::fromUtf8("PushFile")); + PushFile->setAutoDefault(false); + + _2->addWidget(PushFile); + + LEFileNameScript = new QLineEdit(CreateYACS); + LEFileNameScript->setObjectName(QString::fromUtf8("LEFileNameScript")); + LEFileNameScript->setMinimumSize(QSize(382, 21)); + + _2->addWidget(LEFileNameScript); + + + gridLayout_2->addLayout(_2, 1, 0, 1, 3); + + hboxLayout = new QHBoxLayout(); +#ifndef Q_OS_MAC + hboxLayout->setSpacing(6); +#endif + hboxLayout->setContentsMargins(0, 0, 0, 0); + hboxLayout->setObjectName(QString::fromUtf8("hboxLayout")); + DirectoryStart = new QLabel(CreateYACS); + DirectoryStart->setObjectName(QString::fromUtf8("DirectoryStart")); + + hboxLayout->addWidget(DirectoryStart); + + PushDir = new QPushButton(CreateYACS); + PushDir->setObjectName(QString::fromUtf8("PushDir")); + PushDir->setAutoDefault(false); + + hboxLayout->addWidget(PushDir); + + LEDirName = new QLineEdit(CreateYACS); + LEDirName->setObjectName(QString::fromUtf8("LEDirName")); + LEDirName->setMinimumSize(QSize(382, 21)); + + hboxLayout->addWidget(LEDirName); + + + gridLayout_2->addLayout(hboxLayout, 2, 0, 1, 3); + + _3 = new QHBoxLayout(); +#ifndef Q_OS_MAC + _3->setSpacing(6); +#endif + _3->setContentsMargins(0, 0, 0, 0); + _3->setObjectName(QString::fromUtf8("_3")); + MeshFile = new QLabel(CreateYACS); + MeshFile->setObjectName(QString::fromUtf8("MeshFile")); + + _3->addWidget(MeshFile); + + PushFile_2 = new QPushButton(CreateYACS); + PushFile_2->setObjectName(QString::fromUtf8("PushFile_2")); + PushFile_2->setAutoDefault(false); + + _3->addWidget(PushFile_2); + + LEFileNameMesh = new QLineEdit(CreateYACS); + LEFileNameMesh->setObjectName(QString::fromUtf8("LEFileNameMesh")); + LEFileNameMesh->setMinimumSize(QSize(382, 21)); + + _3->addWidget(LEFileNameMesh); + + + gridLayout_2->addLayout(_3, 3, 0, 1, 3); + + RBStatic = new QRadioButton(CreateYACS); + RBStatic->setObjectName(QString::fromUtf8("RBStatic")); + RBStatic->setChecked(true); + + gridLayout_2->addWidget(RBStatic, 4, 0, 1, 1); + + RBTransient = new QRadioButton(CreateYACS); + RBTransient->setObjectName(QString::fromUtf8("RBTransient")); + + gridLayout_2->addWidget(RBTransient, 4, 1, 1, 1); + + GroupButtons = new QGroupBox(CreateYACS); + GroupButtons->setObjectName(QString::fromUtf8("GroupButtons")); + gridLayout1 = new QGridLayout(GroupButtons); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + buttonHelp = new QPushButton(GroupButtons); + buttonHelp->setObjectName(QString::fromUtf8("buttonHelp")); + buttonHelp->setAutoDefault(false); + + gridLayout1->addWidget(buttonHelp, 0, 4, 1, 1); + + buttonApply = new QPushButton(GroupButtons); + buttonApply->setObjectName(QString::fromUtf8("buttonApply")); + buttonApply->setAutoDefault(false); + + gridLayout1->addWidget(buttonApply, 0, 1, 1, 1); + + buttonOk = new QPushButton(GroupButtons); + buttonOk->setObjectName(QString::fromUtf8("buttonOk")); + buttonOk->setAutoDefault(false); + + gridLayout1->addWidget(buttonOk, 0, 0, 1, 1); + + buttonCancel = new QPushButton(GroupButtons); + buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); + buttonCancel->setAutoDefault(false); + + gridLayout1->addWidget(buttonCancel, 0, 2, 1, 1); + + + gridLayout_2->addWidget(GroupButtons, 5, 0, 1, 2); + + spacer_2 = new QSpacerItem(128, 25, QSizePolicy::Fixed, QSizePolicy::Minimum); + + gridLayout_2->addItem(spacer_2, 5, 2, 1, 1); + + + retranslateUi(CreateYACS); + + QMetaObject::connectSlotsByName(CreateYACS); + } // setupUi + + void retranslateUi(QDialog *CreateYACS) + { + CreateYACS->setWindowTitle(QApplication::translate("CreateYACS", "Create YACS", 0, QApplication::UnicodeUTF8)); + Case->setText(QApplication::translate("CreateYACS", "Case", 0, QApplication::UnicodeUTF8)); + PBCaseName->setText(QString()); + Script->setText(QApplication::translate("CreateYACS", "Script", 0, QApplication::UnicodeUTF8)); + PushFile->setText(QString()); + DirectoryStart->setText(QApplication::translate("CreateYACS", "Directory", 0, QApplication::UnicodeUTF8)); + PushDir->setText(QString()); + MeshFile->setText(QApplication::translate("CreateYACS", "Mesh file", 0, QApplication::UnicodeUTF8)); + PushFile_2->setText(QString()); + RBStatic->setText(QApplication::translate("CreateYACS", "Static", 0, QApplication::UnicodeUTF8)); + RBTransient->setText(QApplication::translate("CreateYACS", "Transient", 0, QApplication::UnicodeUTF8)); + GroupButtons->setTitle(QString()); + buttonHelp->setText(QApplication::translate("CreateYACS", "Help", 0, QApplication::UnicodeUTF8)); + buttonApply->setText(QApplication::translate("CreateYACS", "Apply", 0, QApplication::UnicodeUTF8)); + buttonOk->setText(QApplication::translate("CreateYACS", "OK", 0, QApplication::UnicodeUTF8)); + buttonCancel->setText(QApplication::translate("CreateYACS", "Cancel", 0, QApplication::UnicodeUTF8)); + } // retranslateUi + +}; + +namespace Ui { + class CreateYACS: public Ui_CreateYACS {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // CREATEYACS_H diff --git a/src/HOMARDGUI/CreateYACS.ui b/src/HOMARDGUI/CreateYACS.ui new file mode 100644 index 00000000..8e55a8a1 --- /dev/null +++ b/src/HOMARDGUI/CreateYACS.ui @@ -0,0 +1,266 @@ + + + CreateYACS + + + + 0 + 0 + 601 + 300 + + + + + 0 + 0 + + + + Create YACS + + + true + + + + + + + + Case + + + + + + + true + + + + 50 + 27 + + + + + + + + + + + + 382 + 21 + + + + + + + + + + 6 + + + 0 + + + + + Script + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + 6 + + + 0 + + + + + Directory + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + 6 + + + 0 + + + + + Mesh file + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + Static + + + true + + + + + + + Transient + + + + + + + + + + + 9 + + + 6 + + + + + Help + + + false + + + + + + + Apply + + + false + + + + + + + OK + + + false + + + + + + + Cancel + + + false + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 128 + 25 + + + + + + + + + diff --git a/src/HOMARDGUI/HOMARDGUI.cxx b/src/HOMARDGUI/HOMARDGUI.cxx index 30a49447..58f7111a 100644 --- a/src/HOMARDGUI/HOMARDGUI.cxx +++ b/src/HOMARDGUI/HOMARDGUI.cxx @@ -68,6 +68,7 @@ using namespace std; #include "MonEditBoundaryAn.h" #include "MonEditBoundaryDi.h" #include "MonMeshInfo.h" +#include "MonCreateYACS.h" #include "MonIterInfo.h" #include "HomardQtCommun.h" @@ -165,6 +166,8 @@ void HOMARDGUI::createActions(){ // createHOMARDAction( 1301, "MESH_INFO", "advanced_mesh_info.png" ); createHOMARDAction( 1302, "EDIT_MESS_FILE", "texte.png" ); +// + createHOMARDAction( 1401, "YACS", "yacs.png" ); // } @@ -205,6 +208,10 @@ void HOMARDGUI::createMenus(){ createMenu( separator(), HOMARD_Id,-1); createMenu( 1201, HOMARD_Id, -1 ); //Edit createMenu( separator(), HOMARD_Id,-1); +// + HOMARD_Id = createMenu( tr( "HOM_MEN_YACS" ), -1, 5, 10 ); + createMenu( 1401, HOMARD_Id, -1 ); // Création d'un schéma YACS + createMenu( separator(), HOMARD_Id,-1); // /*// La langue des preferences SUIT_ResourceMgr* resMgr = getApp()->resourceMgr(); @@ -233,7 +240,7 @@ void HOMARDGUI::OnGUIEvent() //======================================================================= bool HOMARDGUI::OnGUIEvent (int theCommandID) { - MESSAGE("OnGUIEvent(int)"); + MESSAGE("OnGUIEvent avec theCommandID = "<( application() ); if ( !app ) return false; @@ -466,7 +473,18 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) if ( aDlg->_codret == 0 ) { aDlg->show(); } } break; - } + } + + case 1401: // Création d'un schéma YACS + { + MESSAGE("etape 1401") + MESSAGE("command " << theCommandID << " activated"); + QString CaseName=HOMARD_QT_COMMUN::SelectionArbreEtude(QString("CasHomard"), 1); + MESSAGE("CaseName " << CaseName.toStdString().c_str() << " choisi dans arbre"); + MonCreateYACS *aDlg = new MonCreateYACS( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), CaseName ) ; + aDlg->show(); + break; + } } getApp()->updateObjectBrowser(); @@ -543,22 +561,20 @@ void HOMARDGUI::setOrb() _PTR(SObject) HOMARDGUI::chercheMonObjet() //======================================== { - - SALOMEDSClient_SObject* aSO = NULL; - _PTR(SObject) obj; - SALOME_ListIO lst; - getApp()->selectionMgr()->selectedObjects( lst ); - if ( lst.Extent() == 1 ) - { - Handle(SALOME_InteractiveObject) io = lst.First(); - SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); - _PTR(Study) study = appStudy->studyDS(); - _PTR(SObject) obj = study->FindObjectID( io->getEntry() ); - _ObjectName = QString( obj->GetName().c_str() ); - return obj; - } - else - return _PTR(SObject)(aSO); + SALOMEDSClient_SObject* aSO = NULL; + _PTR(SObject) obj; + SALOME_ListIO lst; + getApp()->selectionMgr()->selectedObjects( lst ); + if ( lst.Extent() == 1 ) + { + Handle(SALOME_InteractiveObject) io = lst.First(); + SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); + _PTR(Study) study = appStudy->studyDS(); + _PTR(SObject) obj = study->FindObjectID( io->getEntry() ); + _ObjectName = QString( obj->GetName().c_str() ); + return obj; + } + else { return _PTR(SObject)(aSO); } } //============================================================================= void HOMARDGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title ) @@ -609,6 +625,8 @@ void HOMARDGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& t } else if ( HOMARD_UTILS::isCase(obj) ) { + pix = resMgr->loadPixmap( "HOMARD", "yacs.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_YACS").toLatin1().data()), this, SLOT(YACS())); EditObject = true ; DeleteObject = true ; } @@ -667,6 +685,12 @@ void HOMARDGUI::EditAsciiFile() this->OnGUIEvent(1302); } +void HOMARDGUI::YACS() +{ + this->OnGUIEvent(1401); +} + + // //============================================================================= // Export the module diff --git a/src/HOMARDGUI/HOMARDGUI.h b/src/HOMARDGUI/HOMARDGUI.h index 460de11e..ee3e64ab 100644 --- a/src/HOMARDGUI/HOMARDGUI.h +++ b/src/HOMARDGUI/HOMARDGUI.h @@ -65,6 +65,7 @@ private slots: void LanceCalcul(); void IterInfo(); void NextIter(); + void YACS(); void Edit(); void Delete(); void XmGraceFichier(); diff --git a/src/HOMARDGUI/HOMARD_msg_en.ts b/src/HOMARDGUI/HOMARD_msg_en.ts index e984097f..59ea6a10 100644 --- a/src/HOMARDGUI/HOMARD_msg_en.ts +++ b/src/HOMARDGUI/HOMARD_msg_en.ts @@ -15,6 +15,10 @@ HOM_MEN_INFORMATION Information + + HOM_MEN_YACS + YACS + HOM_MEN_NEW_CASE New case @@ -147,6 +151,10 @@ HOM_SELECT_FILE_3 This file cannot be opened. + + HOM_SCRIPT_FILE + A script file must be given. + HOM_MED_FILE_1 This MED file cannot be read. @@ -191,6 +199,10 @@ HOM_CASE_DIRECTORY_3 A valid directory for the case must be selected. + + HOM_CASE_DIRECTORY_4 + A directory for the computation must be selected. + HOM_CASE_MESH The file of the initial mesh must be selected. diff --git a/src/HOMARDGUI/HOMARD_msg_fr.ts b/src/HOMARDGUI/HOMARD_msg_fr.ts index a7ca7c71..1309e5a5 100644 --- a/src/HOMARDGUI/HOMARD_msg_fr.ts +++ b/src/HOMARDGUI/HOMARD_msg_fr.ts @@ -15,6 +15,10 @@ HOM_MEN_INFORMATION Information + + HOM_MEN_YACS + YACS + HOM_MEN_NEW_CASE Nouveau cas @@ -199,6 +203,10 @@ HOM_SELECT_FILE_3 Impossible d'ouvrir ce fichier. + + HOM_SCRIPT_FILE + Il faut donner un fichier pour le script python. + HOM_MED_FILE_1 Ce fichier MED est illisible. @@ -247,6 +255,10 @@ HOM_CASE_DIRECTORY_3 Un répertoire valide doit être choisi. + + HOM_CASE_DIRECTORY_4 + Il faut choisir un répertoire de travail pour le calcul. + HOM_CASE_MESH Il faut choisir le maillage initial. @@ -963,6 +975,22 @@ Number of iteration Numéro de l'itération + + Case + Cas + + + Mesh file + Maillage initial + + + Static + Statique + + + Transient + Transitoire + Edit a file Affichage d'un fichier diff --git a/src/HOMARDGUI/HOMARD_msg_ja.ts b/src/HOMARDGUI/HOMARD_msg_ja.ts index 6dfefe88..8aa05da1 100644 --- a/src/HOMARDGUI/HOMARD_msg_ja.ts +++ b/src/HOMARDGUI/HOMARD_msg_ja.ts @@ -15,6 +15,10 @@ HOM_MEN_INFORMATION Information + + HOM_MEN_YACS + YACS + HOM_MEN_NEW_CASE New case @@ -199,6 +203,10 @@ HOM_SELECT_FILE_3 This file cannot be opened. + + HOM_SCRIPT_FILE + A script file must be given. + HOM_MED_FILE_1 This MED file cannot be read. @@ -247,6 +255,10 @@ HOM_CASE_DIRECTORY_3 A valid directory for the case must be selected. + + HOM_CASE_DIRECTORY_4 + A directory for the computation must be selected. + HOM_CASE_MESH The file of the initial mesh must be selected. @@ -963,6 +975,22 @@ Number of iteration Number of iteration + + Case + Case + + + Mesh file + Mesh File + + + Static + Static + + + Transient + Transient + Edit a file Edit a file diff --git a/src/HOMARDGUI/HomardQtCommun.cxx b/src/HOMARDGUI/HomardQtCommun.cxx index 188b6ed6..4d8214ef 100644 --- a/src/HOMARDGUI/HomardQtCommun.cxx +++ b/src/HOMARDGUI/HomardQtCommun.cxx @@ -48,7 +48,7 @@ QString HOMARD_QT_COMMUN::SelectionArbreEtude(QString commentaire, int option ) // . si le commentaire est une chaine vide, on ne tient pas compte du type de l'objet // et on retourne le nom de cet objet // . sinon : -// . si l'objet est du type defini par commentaitr, retourne le nom de cet objet +// . si l'objet est du type defini par commentaite, retourne le nom de cet objet // . sinon on retourne une QString("") // option : // . Si option = 0, ce n'est pas grave de ne rien trouver ; aucun message n'est emis diff --git a/src/HOMARDGUI/Makefile.am b/src/HOMARDGUI/Makefile.am index 12d17bc1..0ba0c29d 100644 --- a/src/HOMARDGUI/Makefile.am +++ b/src/HOMARDGUI/Makefile.am @@ -51,6 +51,8 @@ salomeinclude_HEADERS = \ MeshInfo.h \ MonIterInfo.h \ IterInfo.h \ + MonCreateYACS.h \ + CreateYACS.h \ HOMARDGUI.h \ HOMARDGUI_Utils.h \ EditFile.h \ @@ -81,6 +83,7 @@ dist_libHOMARD_la_SOURCES = \ MonEditZone.cxx \ MonMeshInfo.cxx \ MonIterInfo.cxx \ + MonCreateYACS.cxx \ MonEditFile.cxx \ HomardQtCommun.cxx @@ -104,6 +107,7 @@ MOC_FILES = \ MonPursueIteration_moc.cxx \ MonMeshInfo_moc.cxx \ MonIterInfo_moc.cxx \ + MonCreateYACS_moc.cxx \ MonEditFile_moc.cxx nodist_libHOMARD_la_SOURCES = $(MOC_FILES) @@ -152,6 +156,7 @@ CreateZone.ui \ PursueIteration.ui \ MeshInfo.ui \ IterInfo.ui \ +CreateYACS.ui \ EditFile.ui EXTRA_DIST += $(UI_FILES) diff --git a/src/HOMARDGUI/MonCreateYACS.cxx b/src/HOMARDGUI/MonCreateYACS.cxx new file mode 100644 index 00000000..6612fba4 --- /dev/null +++ b/src/HOMARDGUI/MonCreateYACS.cxx @@ -0,0 +1,199 @@ +// Copyright (C) 2011-2012 CEA/DEN, 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. +// +// 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 +// + +using namespace std; + +#include "MonCreateYACS.h" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + + +// ----------------------------------------------------------------------------------------- +/* Constructs a MonCreateYACS + * Sets attributes to default values + */ +// ----------------------------------------------------------------------------------------- +MonCreateYACS::MonCreateYACS (QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString CaseName ) + : + Ui_CreateYACS(), + _aCaseName(CaseName), + _aFileNameScript(""), + _aDirName(""), + _aFileNameMesh("") +{ + MESSAGE("Debut du constructeur de MonCreateYACS"); + _myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen); + setupUi(this); + setModal(modal); + + InitConnect(); + + if (_aCaseName != QString("")) + { SetCaseName(); } + else + {setModal(false); /* permet selection du cas dans l arbre d etude */} + + adjustSize(); + MESSAGE("Fin du constructeur de MonCreateYACS"); +} + +// ------------------------------------------------------------------------ +MonCreateYACS::~MonCreateYACS() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateYACS::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( PBCaseName, SIGNAL(pressed()), this, SLOT(SetCaseName())); + connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName())); + connect( PushFile, SIGNAL(pressed()), this, SLOT(SetFileNameScript())); + connect( PushFile_2, SIGNAL(pressed()), this, SLOT(SetFileNameMesh())); + + connect( RBStatic, SIGNAL(clicked()), this, SLOT(FromIteration())); + connect( RBTransient, SIGNAL(clicked()), this, SLOT(FromCase())); + + connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK())); + connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply())); + connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close())); + connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp())); +} +// ------------------------------- +bool MonCreateYACS::PushOnApply() +// -------------------------------- +{ + MESSAGE("PushOnApply"); + + if ( _aCaseName == QString ("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_NAME") ); + return false; + } +// Le fichier du script + QString aFileName=LEFileNameScript->text().trimmed(); + if (aFileName ==QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SCRIPT_FILE") ); + return false; + } + +// Le repertoire de calcul + QString aDirName=LEDirName->text().trimmed(); + if (aDirName == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_4") ); + return false; + } + if ((aDirName != _aDirName) and (_myHomardGen->VerifieDir( aDirName.toStdString().c_str()) == false)) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_2") ); + return false; + } + if (chdir(aDirName.toStdString().c_str()) != 0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_3") ); + return false; + } + +// Le fichier du tout premier maillage + aFileName=LEFileNameMesh->text().trimmed(); + if (aFileName ==QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_MESH") ); + return false; + } + QString aMeshName = HOMARD_QT_COMMUN::LireNomMaillage(aFileName); + if (aMeshName == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_2") ); + return false; + } + + HOMARD_UTILS::updateObjBrowser(); + MESSAGE ("_aCaseName.toStdString " << _aCaseName.toStdString() ); + + return true; +} +// --------------------------- +void MonCreateYACS::PushOnOK() +// --------------------------- +{ + bool bOK = PushOnApply(); + if ( bOK ) this->close(); +} +//------------------------------ +void MonCreateYACS::PushOnHelp() +//------------------------------- +{ + HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString("")); +} +// ------------------------------------------------------------------------ +void MonCreateYACS::SetCaseName() +// ------------------------------------------------------------------------ +{ + MESSAGE ("SetCaseName avec _aCaseName = " << _aCaseName.toStdString() ); + if (_aCaseName == QString("")) + { + _aCaseName=HOMARD_QT_COMMUN::SelectionArbreEtude(QString("CasHomard"), 1); + if (_aCaseName == QString("")) { raise();return;}; + } +/* MESSAGE ("appel de GetCase avec _aCaseName = " << _aCaseName.toStdString() );*/ + aCase = _myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + LECaseName->setText(_aCaseName); +} +// ------------------------------------------------------------------------ +void MonCreateYACS::SetDirName() +// ------------------------------------------------------------------------ +{ + QString aDirName=QFileDialog::getExistingDirectory (); + if (!(aDirName.isEmpty()))LEDirName->setText(aDirName); +} +// ------------------------------------------------------------------------ +void MonCreateYACS::SetFileNameScript() +// ------------------------------------------------------------------------ +{ + QString fileName0 = LEFileNameScript->text().trimmed(); + QString fileName = HOMARD_QT_COMMUN::PushNomFichier(false); + if (fileName.isEmpty()) fileName = fileName0 ; + LEFileNameScript->setText(fileName); +} +// ------------------------------------------------------------------------ +void MonCreateYACS::SetFileNameMesh() +// ------------------------------------------------------------------------ +{ + QString fileName0 = LEFileNameMesh->text().trimmed(); + QString fileName = HOMARD_QT_COMMUN::PushNomFichier(false); + if (fileName.isEmpty()) fileName = fileName0 ; + LEFileNameMesh->setText(fileName); +} diff --git a/src/HOMARDGUI/MonCreateYACS.h b/src/HOMARDGUI/MonCreateYACS.h new file mode 100644 index 00000000..2f8d5e2b --- /dev/null +++ b/src/HOMARDGUI/MonCreateYACS.h @@ -0,0 +1,66 @@ +// Copyright (C) 2011-2012 CEA/DEN, 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. +// +// 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 +// + +#ifndef MON_CREATEYACS_H +#define MON_CREATEYACS_H + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) + +#include +#include + +class MonCreateYACS : public QDialog, public Ui_CreateYACS +{ + Q_OBJECT + + public: + MonCreateYACS( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString CaseName); + virtual ~MonCreateYACS(); + + protected : + QString _aCaseName; + QString _aFileNameScript; + QString _aDirName; + QString _aFileNameMesh; + + + HOMARD::HOMARD_Cas_var aCase ; + HOMARD::HOMARD_Gen_var _myHomardGen; + + virtual void InitConnect(); + + public slots: + virtual void SetCaseName(); + virtual void SetDirName(); + + virtual void SetFileNameScript(); + virtual void SetFileNameMesh(); + + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +#endif // MON_CREATEYACS_H diff --git a/src/HOMARDGUI/MonPursueIteration.cxx b/src/HOMARDGUI/MonPursueIteration.cxx index d8950013..599b04ac 100644 --- a/src/HOMARDGUI/MonPursueIteration.cxx +++ b/src/HOMARDGUI/MonPursueIteration.cxx @@ -32,7 +32,6 @@ using namespace std; // ----------------------------------------------------------------------------------------- /* Constructs a MonPursueIteration - * Inherits from CasHomard * Sets attributes to default values */ // ----------------------------------------------------------------------------------------- -- 2.39.2