#include <utilities.h>
-// -----------------------------------------------------------------------------------------
+// ----------------------------------------------------------------------
/* Constructs a MonCreateYACS
* Sets attributes to default values
*/
-// -----------------------------------------------------------------------------------------
-MonCreateYACS::MonCreateYACS (QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString CaseName )
+// ----------------------------------------------------------------------
+MonCreateYACS::MonCreateYACS (QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, QString CaseName )
:
Ui_CreateYACS(),
_aCaseName(CaseName),
- _aFileNameScript(""),
+ _aScriptFile(""),
_aDirName(""),
- _aFileNameMesh("")
+ _aMeshFile("")
{
MESSAGE("Debut du constructeur de MonCreateYACS");
- _myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen);
+ myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
setModal(modal);
InitConnect();
+ SetNewName() ;
+
if (_aCaseName != QString(""))
{ SetCaseName(); }
else
MESSAGE("Fin du constructeur de MonCreateYACS");
}
+// ----------------------------------------------------------------------
+MonCreateYACS::MonCreateYACS(QWidget* parent,
+ HOMARD::HOMARD_Gen_var myHomardGen0,
+ QString caseName):
+// ----------------------------------------------------------------------
+// Constructeur appele par MonEditYACS
+//
+ myHomardGen(myHomardGen0),
+ _Name (""),
+ Chgt (false)
+ {
+ // MESSAGE("Debut de MonCreateYACS")
+ setupUi(this) ;
+
+ setModal(true) ;
+ InitConnect() ;
+ }
+
// ------------------------------------------------------------------------
MonCreateYACS::~MonCreateYACS()
// ------------------------------------------------------------------------
{
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( PushFile, SIGNAL(pressed()), this, SLOT(SetScriptFile()));
+ connect( PushFile_2, SIGNAL(pressed()), this, SLOT(SetMeshFile()));
- connect( RBStatic, SIGNAL(clicked()), this, SLOT(FromIteration()));
- connect( RBTransient, SIGNAL(clicked()), this, SLOT(FromCase()));
+ connect( RBStatic, SIGNAL(clicked()), this, SLOT(SetType(1)));
+ connect( RBTransient, SIGNAL(clicked()), this, SLOT(SetType(2)));
connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK()));
connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply()));
return false;
}
// Le fichier du script
- QString aFileName=LEFileNameScript->text().trimmed();
+ QString aFileName=LEScriptFile->text().trimmed();
if (aFileName ==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))
+ if ((aDirName != _aDirName) and (myHomardGen->VerifieDir( aDirName.toStdString().c_str()) == false))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_2") );
}
// Le fichier du tout premier maillage
- aFileName=LEFileNameMesh->text().trimmed();
+ aFileName=LEMeshFile->text().trimmed();
if (aFileName ==QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
HOMARD_UTILS::updateObjBrowser();
MESSAGE ("_aCaseName.toStdString " << _aCaseName.toStdString() );
- return true;
+// Creation de l'objet CORBA
+ try
+ {
+ _Name=LEName->text().trimmed();
+ aYACS=myHomardGen->CreateYACSSchema(CORBA::string_dup(_Name.toStdString().c_str()), _aCaseName.toStdString().c_str(), _aScriptFile.toStdString().c_str(), _aDirName.toStdString().c_str(), _aMeshFile.toStdString().c_str());
+// _parent->AddYACS(_Name);
+ }
+ catch( SALOME::SALOME_Exception& S_ex )
+ {
+ QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+ QObject::tr(CORBA::string_dup(S_ex.details.text)) );
+ return false;
+ }
+
+return true;
}
// ---------------------------
void MonCreateYACS::PushOnOK()
{
HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""));
}
+// -------------------------------------------------
+void MonCreateYACS::SetNewName()
+// --------------------------------------------------
+{
+
+ HOMARD::listeYACSs_var MyObjects = myHomardGen->GetAllYACSsName();
+ int num = 0; QString aName="";
+ while (aName == QString("") )
+ {
+ aName.setNum(num+1) ;
+ aName.insert(0, QString("YACS_")) ;
+ for ( int i=0; i<MyObjects->length(); i++)
+ {
+ if ( aName == QString(MyObjects[i]))
+ {
+ num=num+1;
+ aName="";
+ break;
+ }
+ }
+ }
+ LEName->setText(aName);
+}
// ------------------------------------------------------------------------
void MonCreateYACS::SetCaseName()
// ------------------------------------------------------------------------
if (_aCaseName == QString("")) { raise();return;};
}
/* MESSAGE ("appel de GetCase avec _aCaseName = " << _aCaseName.toStdString() );*/
- aCase = _myHomardGen->GetCase(_aCaseName.toStdString().c_str());
+ aCase = myHomardGen->GetCase(_aCaseName.toStdString().c_str());
LECaseName->setText(_aCaseName);
}
// ------------------------------------------------------------------------
if (!(aDirName.isEmpty()))LEDirName->setText(aDirName);
}
// ------------------------------------------------------------------------
-void MonCreateYACS::SetFileNameScript()
+void MonCreateYACS::SetScriptFile()
// ------------------------------------------------------------------------
{
- QString fileName0 = LEFileNameScript->text().trimmed();
+ QString fileName0 = LEScriptFile->text().trimmed();
QString fileName = HOMARD_QT_COMMUN::PushNomFichier(false);
if (fileName.isEmpty()) fileName = fileName0 ;
- LEFileNameScript->setText(fileName);
+ LEScriptFile->setText(fileName);
}
// ------------------------------------------------------------------------
-void MonCreateYACS::SetFileNameMesh()
+void MonCreateYACS::SetMeshFile()
// ------------------------------------------------------------------------
{
- QString fileName0 = LEFileNameMesh->text().trimmed();
+ QString fileName0 = LEMeshFile->text().trimmed();
QString fileName = HOMARD_QT_COMMUN::PushNomFichier(false);
if (fileName.isEmpty()) fileName = fileName0 ;
- LEFileNameMesh->setText(fileName);
+ LEMeshFile->setText(fileName);
+}
+// ------------------------------------------------------------------------
+void MonCreateYACS::SetType(int Type)
+// ------------------------------------------------------------------------
+{
+ _Type=Type;
}