mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-11 16:19:16 +05:00
Gestion des erreurs de données
This commit is contained in:
parent
5560a9e80a
commit
d90a581cef
@ -33,6 +33,6 @@ To start **Remeshing** operation, select **MG Adapt** tab in **Adaptation** dial
|
||||
:align: center
|
||||
|
||||
.. note::
|
||||
The exhaustive description of MG-Adapt can be read into its documentation. It can be reached bu the general help button.
|
||||
The exhaustive description of MG-Adapt can be read into its documentation. It can be reached by the general help button.
|
||||
|
||||
**See Also** a sample TUI Script of :ref:`tui_adaptation_page`.
|
||||
|
@ -84,7 +84,6 @@
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
|
||||
const int SPACING = 6; // layout spacing
|
||||
const int MARGIN = 9; // layout margin
|
||||
|
||||
@ -135,32 +134,25 @@ void SMESHGUI_MgAdaptDlg::buildDlg()
|
||||
myAdvOpt->logGroupBox ->setTitle(tr( "LOG_GROUP_TITLE" ));
|
||||
|
||||
// buttons
|
||||
QPushButton* okBtn = new QPushButton( tr( "SMESH_BUT_OK" ), this );
|
||||
okBtn->setAutoDefault( true );
|
||||
okBtn->setDefault( true );
|
||||
okBtn->setFocus();
|
||||
QPushButton* buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), this);
|
||||
buttonOk->setAutoDefault(false);
|
||||
QPushButton* buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), this);
|
||||
buttonApply->setAutoDefault(true);
|
||||
QPushButton* buttonApplyAndClose = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), this);
|
||||
buttonApplyAndClose->setAutoDefault(true);
|
||||
QPushButton* cancelBtn = new QPushButton( tr( "SMESH_BUT_CANCEL" ), this );
|
||||
cancelBtn->setAutoDefault( true );
|
||||
QPushButton* helpBtn = new QPushButton( tr( "SMESH_BUT_HELP" ), this );
|
||||
helpBtn->setAutoDefault( true );
|
||||
buttonApply->setAutoDefault(false);
|
||||
QPushButton* buttonCancel = new QPushButton( tr( "SMESH_BUT_CANCEL" ), this );
|
||||
buttonCancel->setAutoDefault( false );
|
||||
QPushButton* buttonHelp = new QPushButton( tr( "SMESH_BUT_HELP" ), this );
|
||||
buttonHelp->setAutoDefault( false );
|
||||
|
||||
QHBoxLayout* btnLayout = new QHBoxLayout;
|
||||
btnLayout->setSpacing( SPACING );
|
||||
btnLayout->setMargin( 0 );
|
||||
btnLayout->addWidget( buttonApplyAndClose );
|
||||
btnLayout->addWidget( buttonOk );
|
||||
btnLayout->addStretch( 10 );
|
||||
btnLayout->addWidget( buttonApply );
|
||||
btnLayout->addStretch( 10 );
|
||||
btnLayout->addWidget( okBtn );
|
||||
btnLayout->addWidget( buttonCancel );
|
||||
btnLayout->addStretch( 10 );
|
||||
btnLayout->addWidget( cancelBtn );
|
||||
btnLayout->addStretch( 10 );
|
||||
btnLayout->addWidget( helpBtn );
|
||||
okBtn->hide(); // tab 1
|
||||
btnLayout->addWidget( buttonHelp );
|
||||
|
||||
QVBoxLayout* l = new QVBoxLayout ( this );
|
||||
l->setMargin( MARGIN );
|
||||
@ -169,13 +161,12 @@ void SMESHGUI_MgAdaptDlg::buildDlg()
|
||||
l->addStretch();
|
||||
l->addLayout( btnLayout );
|
||||
|
||||
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()));
|
||||
|
||||
connect( okBtn, SIGNAL(clicked()), this, SLOT( clickOnOk() ) );
|
||||
connect( helpBtn, SIGNAL(clicked()), this, SLOT( clickOnHelp() ) );
|
||||
connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this,SLOT(clickOnApply()));
|
||||
connect(buttonApplyAndClose, SIGNAL(clicked()), this,SLOT(clickOnOk()));
|
||||
connect(myArgs, SIGNAL(meshDimSignal(ADAPTATION_MODE)), myAdvOpt, SLOT( onMeshDimChanged(ADAPTATION_MODE)) );
|
||||
connect( myArgs, SIGNAL(meshDimSignal(ADAPTATION_MODE)), myAdvOpt, SLOT( onMeshDimChanged(ADAPTATION_MODE)) );
|
||||
}
|
||||
|
||||
|
||||
@ -199,15 +190,15 @@ SMESH::MG_ADAPT_ptr SMESHGUI_MgAdaptDlg::getModel() const
|
||||
/*!
|
||||
\brief Perform clean-up actions on the dialog box closing.
|
||||
*/
|
||||
bool SMESHGUI_MgAdaptDlg::clickOnApply()
|
||||
bool SMESHGUI_MgAdaptDlg::PushOnApply()
|
||||
{
|
||||
readParamsFromWidgets();
|
||||
return true;
|
||||
bool ret = readParamsFromWidgets();
|
||||
return ret;
|
||||
}
|
||||
void SMESHGUI_MgAdaptDlg::clickOnOk()
|
||||
void SMESHGUI_MgAdaptDlg::PushOnOK()
|
||||
{
|
||||
clickOnApply();
|
||||
reject();
|
||||
bool ret = PushOnApply();
|
||||
if ( ret ) reject();
|
||||
}
|
||||
void SMESHGUI_MgAdaptDlg::reject()
|
||||
{
|
||||
@ -292,53 +283,59 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromHypo( ) const
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool SMESHGUI_MgAdaptDlg::readParamsFromWidgets()
|
||||
{
|
||||
bool ret = true;
|
||||
MESSAGE ("readParamsFromWidgets") ;
|
||||
bool ret = true ;
|
||||
SMESH::MgAdaptHypothesisData* aData = new SMESH::MgAdaptHypothesisData();
|
||||
while ( ret )
|
||||
{
|
||||
// 1. Fichier du maillage de départ
|
||||
aData->fromMedFile = myArgs->aMedfile->isChecked();
|
||||
if (aData->fromMedFile)
|
||||
{
|
||||
|
||||
aData->myFileInDir = CORBA::string_dup(myArgs->myFileInDir->toStdString().c_str());
|
||||
aData->myMeshFileIn = CORBA::string_dup(myArgs->selectMedFileLineEdit->text().toStdString().c_str());
|
||||
// aData->myInMeshName = // TODO
|
||||
}
|
||||
else // TODO browser
|
||||
{
|
||||
aData->myInMeshName = CORBA::string_dup(myArgs->aBrowserObject->text().toStdString().c_str());
|
||||
aData->myFileInDir = CORBA::string_dup(myAdvOpt->workingDirectoryLineEdit->text().toStdString().c_str());
|
||||
|
||||
TCollection_AsciiString aGenericName = (char*)aData->myFileInDir;
|
||||
TCollection_AsciiString aGenericName2 = "MgAdapt_";
|
||||
aGenericName2 += getpid();
|
||||
aGenericName2 += "_";
|
||||
aGenericName2 += Abs((Standard_Integer)(long) aGenericName.ToCString());
|
||||
aGenericName2 += ".med";
|
||||
aGenericName+=aGenericName2;
|
||||
emit myArgs->toExportMED(aGenericName.ToCString());
|
||||
aData->myMeshFileIn = aGenericName2.ToCString();
|
||||
QMessageBox::critical( 0, QObject::tr("MG_ADAPT_ERROR"),
|
||||
QObject::tr("MG_ADAPT_MED_FILE_4") );
|
||||
ret = false ;
|
||||
break ;
|
||||
// aData->myInMeshName = CORBA::string_dup(myArgs->aBrowserObject->text().toStdString().c_str());
|
||||
// aData->myFileInDir = CORBA::string_dup(myAdvOpt->workingDirectoryLineEdit->text().toStdString().c_str());
|
||||
//
|
||||
// TCollection_AsciiString aGenericName = (char*)aData->myFileInDir;
|
||||
// TCollection_AsciiString aGenericName2 = "MgAdapt_";
|
||||
// aGenericName2 += getpid();
|
||||
// aGenericName2 += "_";
|
||||
// aGenericName2 += Abs((Standard_Integer)(long) aGenericName.ToCString());
|
||||
// aGenericName2 += ".med";
|
||||
// aGenericName+=aGenericName2;
|
||||
// emit myArgs->toExportMED(aGenericName.ToCString());
|
||||
// aData->myMeshFileIn = aGenericName2.ToCString();
|
||||
}
|
||||
// 2. Fichier du maillage de sortie
|
||||
aData->myOutMeshName = CORBA::string_dup(myArgs->meshNameLineEdit->text().toStdString().c_str());
|
||||
aData->myMeshOutMed = myArgs->medFileCheckBox->isChecked();
|
||||
if(aData->myMeshOutMed)
|
||||
{
|
||||
aData->myFileOutDir = CORBA::string_dup(myArgs->myFileOutDir->toStdString().c_str());
|
||||
aData->myMeshFileOut = CORBA::string_dup(myArgs->selectOutMedFileLineEdit->text().toStdString().c_str());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
aData->myMeshFileOut = "";
|
||||
}
|
||||
|
||||
aData->myPublish = myArgs->publishOut->isChecked();
|
||||
|
||||
|
||||
// 3. Type de carte de tailles
|
||||
aData->myUseLocalMap = myArgs->localButton->isChecked();
|
||||
aData->myUseBackgroundMap = myArgs->backgroundButton->isChecked();
|
||||
aData->myUseConstantValue = myArgs->constantButton->isChecked();
|
||||
// 3.1. Constante
|
||||
if (aData->myUseConstantValue)
|
||||
{
|
||||
aData->myConstantValue = myArgs->dvalue->value();
|
||||
@ -347,6 +344,7 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromWidgets()
|
||||
{
|
||||
aData->myConstantValue = 0.0;
|
||||
}
|
||||
// 3.2. Arrière-plan
|
||||
if (aData->myUseBackgroundMap)
|
||||
{
|
||||
aData->myFileSizeMapDir = CORBA::string_dup(myArgs->myFileSizeMapDir->toStdString().c_str());
|
||||
@ -357,6 +355,17 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromWidgets()
|
||||
aData->myMeshFileBackground = "";
|
||||
}
|
||||
|
||||
// 4. Le champ
|
||||
if ( ! aData->myUseConstantValue )
|
||||
{
|
||||
if ( strlen(myArgs->fieldNameCmb->currentText().toStdString().c_str()) == 0 )
|
||||
{
|
||||
QMessageBox::critical( 0, QObject::tr("MG_ADAPT_ERROR"),
|
||||
QObject::tr("MG_ADAPT_MED_FILE_5") );
|
||||
ret = false ;
|
||||
break ;
|
||||
}
|
||||
{
|
||||
aData->myFieldName = CORBA::string_dup(myArgs->fieldNameCmb->currentText().toStdString().c_str());
|
||||
aData->myUseNoTimeStep = myArgs->noTimeStep->isChecked();
|
||||
aData->myUseLastTimeStep = myArgs->lastTimeStep->isChecked();
|
||||
@ -365,30 +374,36 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromWidgets()
|
||||
{
|
||||
aData->myRank = myArgs->rankSpinBox->value();
|
||||
aData->myTimeStep = myArgs->timeStep->value();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Options avancées
|
||||
aData->myWorkingDir = CORBA::string_dup(myAdvOpt->workingDirectoryLineEdit->text().toStdString().c_str());
|
||||
aData->myPrintLogInFile = myAdvOpt->logInFileCheck->isChecked();
|
||||
aData->myVerboseLevel = myAdvOpt->verboseLevelSpin->value();
|
||||
aData->myRemoveLogOnSuccess = myAdvOpt->removeLogOnSuccessCheck->isChecked();
|
||||
aData->myKeepFiles = myAdvOpt->keepWorkingFilesCheck->isChecked();
|
||||
model->setData(*aData);
|
||||
|
||||
QString msg;
|
||||
checkParams(msg);
|
||||
break ;
|
||||
}
|
||||
|
||||
delete aData;
|
||||
|
||||
return ret;
|
||||
}
|
||||
bool SMESHGUI_MgAdaptDlg::storeParamsToHypo( const SMESH::MgAdaptHypothesisData& ) const
|
||||
{
|
||||
|
||||
}
|
||||
/*!
|
||||
\brief Show help page
|
||||
*/
|
||||
void SMESHGUI_MgAdaptDlg::clickOnHelp()
|
||||
void SMESHGUI_MgAdaptDlg::PushOnHelp()
|
||||
{
|
||||
// QString aHelpFile;
|
||||
// QString aHelpFile;
|
||||
// if ( myTabWidget->currentIndex() == MinDistance ) {
|
||||
// aHelpFile = "measurements.html#min-distance-anchor";
|
||||
// } else if ( myTabWidget->currentIndex() == BoundingBox ) {
|
||||
@ -399,7 +414,7 @@ void SMESHGUI_MgAdaptDlg::clickOnHelp()
|
||||
// aHelpFile = "measurements.html#basic-properties-anchor";
|
||||
// }
|
||||
|
||||
// SMESH::ShowHelpFile( aHelpFile );
|
||||
// SMESH::ShowHelpFile( aHelpFile );
|
||||
}
|
||||
bool SMESHGUI_MgAdaptDlg::checkParams(QString& msg)
|
||||
{
|
||||
@ -407,7 +422,7 @@ bool SMESHGUI_MgAdaptDlg::checkParams(QString& msg)
|
||||
{
|
||||
SUIT_MessageBox::warning( this,
|
||||
tr( "SMESH_WRN_WARNING" ),
|
||||
tr( "GHS3D_PERMISSION_DENIED" ) );
|
||||
tr( "NO_PERMISSION" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1416,4 +1431,3 @@ std::string remove_extension(const std::string& filename)
|
||||
if (lastdot == std::string::npos) return filename;
|
||||
return filename.substr(0, lastdot);
|
||||
}
|
||||
|
||||
|
@ -131,11 +131,12 @@ public:
|
||||
public slots:
|
||||
|
||||
protected slots:
|
||||
virtual bool PushOnApply();
|
||||
|
||||
virtual bool clickOnApply();
|
||||
private slots:
|
||||
virtual void clickOnHelp();
|
||||
virtual void clickOnOk();
|
||||
virtual void PushOnHelp();
|
||||
virtual void PushOnOK();
|
||||
|
||||
protected :
|
||||
|
||||
SMESHGUI_MgAdaptArguments* myArgs;
|
||||
|
@ -341,27 +341,44 @@ SMESH::SMESH_Mesh_var SMESHGUI_MG_ADAPTDRIVER::getMyMesh()
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// function : PushOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_MG_ADAPTDRIVER::clickOnOk()
|
||||
void SMESHGUI_MG_ADAPTDRIVER::PushOnOK()
|
||||
{
|
||||
setIsApplyAndClose( true );
|
||||
clickOnApply();
|
||||
reject();
|
||||
bool ret = PushOnApply();
|
||||
// std::cout << "SMESHGUI_MG_ADAPTDRIVER::PushOnOK ret : " <<ret<<std::endl;
|
||||
if ( ret ) reject();
|
||||
}
|
||||
bool SMESHGUI_MG_ADAPTDRIVER::clickOnApply()
|
||||
bool SMESHGUI_MG_ADAPTDRIVER::PushOnApply()
|
||||
{
|
||||
MESSAGE("PushOnApply");
|
||||
|
||||
if ( SMESHGUI::isStudyLocked() )
|
||||
return false;
|
||||
if( !isValid() )
|
||||
return false;
|
||||
|
||||
SMESHGUI_MgAdaptDlg::clickOnApply();
|
||||
bool ok = SMESHGUI_MgAdaptDlg::PushOnApply();
|
||||
// std::cout << "SMESHGUI_MG_ADAPTDRIVER::PushOnApply ok 1 : " <<ok<<std::endl;
|
||||
|
||||
bool ok = execute();
|
||||
if ( ok )
|
||||
{
|
||||
ok = execute();
|
||||
if (getModel()->getPublish()) this->createMeshInObjectBrowser();
|
||||
// std::cout << "SMESHGUI_MG_ADAPTDRIVER::PushOnApply ok 2 : " <<ok<<std::endl;
|
||||
if ( ok )
|
||||
{
|
||||
QMessageBox::information( 0, QObject::tr(""),
|
||||
QObject::tr("MG_ADAPT_DIAG_1") );
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical( 0, QObject::tr("MG_ADAPT_ERROR"),
|
||||
QObject::tr("MG_ADAPT_DIAG_2") );
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
@ -464,33 +481,21 @@ void SMESHGUI_MG_ADAPTDRIVER::keyPressEvent( QKeyEvent* e )
|
||||
if ( e->key() == Qt::Key_F1 )
|
||||
{
|
||||
e->accept();
|
||||
clickOnHelp();
|
||||
PushOnHelp();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : clickOnHelp()
|
||||
// function : PushOnHelp()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_MG_ADAPTDRIVER::clickOnHelp()
|
||||
void SMESHGUI_MG_ADAPTDRIVER::PushOnHelp()
|
||||
{
|
||||
|
||||
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
|
||||
if (app)
|
||||
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
|
||||
else {
|
||||
QString platform;
|
||||
#ifdef WIN32
|
||||
platform = "winapplication";
|
||||
#else
|
||||
platform = "application";
|
||||
#endif
|
||||
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
|
||||
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
||||
arg(app->resourceMgr()->stringValue("ExternalBrowser",platform)).
|
||||
arg(myHelpFileName));
|
||||
}
|
||||
QString aHelpFile = "adaptation.html#_mg_adapt_anchor";
|
||||
|
||||
SMESH::ShowHelpFile( aHelpFile );
|
||||
|
||||
}
|
||||
|
||||
|
@ -190,10 +190,10 @@ private slots:
|
||||
|
||||
void exportMED(const char* );
|
||||
|
||||
virtual bool clickOnApply();
|
||||
virtual void clickOnOk();
|
||||
virtual void clickOnHelp();
|
||||
//~void SelectionIntoArgument();
|
||||
virtual bool PushOnApply();
|
||||
virtual void PushOnOK();
|
||||
virtual void PushOnHelp();
|
||||
|
||||
void deactivateActiveDialog();
|
||||
void activateThisDialog();
|
||||
void onConstructor( int );
|
||||
|
@ -430,7 +430,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>LOCAL_MG_ADAPT</source>
|
||||
<translation>local</translation>
|
||||
<translation>Local</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BACKGRND_MG_ADAPT</source>
|
||||
@ -450,12 +450,20 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>SIZE_MAP_DEF</source>
|
||||
<translation>size map definition</translation>
|
||||
<translation>Size map definition</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADVOP</source>
|
||||
<translation>Advanced Options</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_DIAG_1</source>
|
||||
<translation>Adaptation succeeded.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_DIAG_2</source>
|
||||
<translation>Adaptation failed.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_CONV_TO_QUAD</source>
|
||||
<translation>Convert to/from quadratic</translation>
|
||||
|
@ -456,6 +456,14 @@
|
||||
<source>ADVOP</source>
|
||||
<translation>Options avancées</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_DIAG_1</source>
|
||||
<translation>Adaptation réussie.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MG_ADAPT_DIAG_2</source>
|
||||
<translation>Echec de l'adaptation.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_CONV_TO_QUAD</source>
|
||||
<translation>Convertir vers/depuis quadratique</translation>
|
||||
|
Loading…
Reference in New Issue
Block a user