mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-11 16:19:16 +05:00
Compute progress bar
This commit is contained in:
parent
49cd1d951a
commit
f4b63cd2bd
@ -92,6 +92,7 @@
|
||||
#include <QButtonGroup>
|
||||
#include <QCloseEvent>
|
||||
#include <QTimerEvent>
|
||||
#include <QProgressBar>
|
||||
|
||||
// VTK includes
|
||||
#include <vtkProperty.h>
|
||||
@ -109,20 +110,6 @@
|
||||
|
||||
#define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
|
||||
|
||||
/* OBSOLETE
|
||||
static void addSeparator( QWidget* parent )
|
||||
{
|
||||
QGridLayout* l = qobject_cast<QGridLayout*>( parent->layout() );
|
||||
int row = l->rowCount();
|
||||
int cols = l->columnCount();
|
||||
for ( int i = 0; i < cols; i++ ) {
|
||||
QFrame* hline = new QFrame( parent );
|
||||
hline->setFrameStyle( QFrame::HLine | QFrame::Sunken );
|
||||
l->addWidget( hline, row, i );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
enum TCol {
|
||||
COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS
|
||||
};
|
||||
@ -745,10 +732,10 @@ SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget
|
||||
qthread(gen, mesh, mainShape)
|
||||
{
|
||||
// --
|
||||
setWindowTitle(tr("Compute"));
|
||||
setWindowTitle(tr("TITLE"));
|
||||
setMinimumWidth( 200 );
|
||||
|
||||
cancelButton = new QPushButton(tr("Cancel"));
|
||||
cancelButton = new QPushButton(tr("CANCEL"));
|
||||
cancelButton->setDefault(true);
|
||||
|
||||
QLabel * nbNodesName = new QLabel(tr("SMESH_MESHINFO_NODES"), this );
|
||||
@ -757,6 +744,9 @@ SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget
|
||||
nbNodesLabel = new QLabel("0", this );
|
||||
nbElemsLabel = new QLabel("0", this );
|
||||
freeRAMLabel = new QLabel("", this );
|
||||
progressBar = new QProgressBar(this);
|
||||
progressBar->setMinimum( 0 );
|
||||
progressBar->setMaximum( 1000 );
|
||||
|
||||
QGridLayout* layout = new QGridLayout(this);
|
||||
layout->setMargin( MARGIN );
|
||||
@ -770,7 +760,8 @@ SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget
|
||||
layout->addWidget(freeRAMName, row, 0);
|
||||
layout->addWidget(freeRAMLabel, row++, 1);
|
||||
#endif
|
||||
layout->addWidget(cancelButton, row, 0, 1, 2);
|
||||
layout->addWidget(progressBar, row++, 0, 1, 2);
|
||||
layout->addWidget(cancelButton, row++, 0, 1, 2);
|
||||
adjustSize();
|
||||
update();
|
||||
|
||||
@ -788,10 +779,15 @@ bool SMESHGUI_ComputeDlg_QThreadQDialog::result()
|
||||
void SMESHGUI_ComputeDlg_QThreadQDialog::onCancel()
|
||||
{
|
||||
qthread.cancel();
|
||||
}
|
||||
cancelButton->setDown( true );
|
||||
cancelButton->setText( tr("CANCELING"));
|
||||
}
|
||||
|
||||
void SMESHGUI_ComputeDlg_QThreadQDialog::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
if ( !cancelButton->isDown() ) // not yet cancelled
|
||||
progressBar->setValue( progressBar->maximum() * qthread.getMesh()->GetComputeProgress() );
|
||||
|
||||
if(qthread.isFinished())
|
||||
{
|
||||
close();
|
||||
@ -863,13 +859,9 @@ void SMESHGUI_BaseComputeOp::computeMesh()
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
bool res;
|
||||
SMESHGUI_ComputeDlg_QThreadQDialog qthreaddialog(desktop(), gen, myMesh, myMainShape);
|
||||
qthreaddialog.exec();
|
||||
res = qthreaddialog.result();
|
||||
res = gen->Compute(myMesh, myMainShape);
|
||||
if (res)
|
||||
computeFailed = false;
|
||||
computeFailed = !qthreaddialog.result();
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception & S_ex) {
|
||||
memoryLack = true;
|
||||
@ -904,26 +896,26 @@ void SMESHGUI_BaseComputeOp::computeMesh()
|
||||
int entities = SMESH_Actor::eAllEntity;
|
||||
if ( !memoryLack )
|
||||
{
|
||||
if ( getSMESHGUI()->automaticUpdate( myMesh, &entities, &limitExceeded ) )
|
||||
if ( getSMESHGUI()->automaticUpdate( myMesh, &entities, &limitExceeded ) )
|
||||
{
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
SMESH_Actor *anActor = SMESH::FindActorByObject( myMesh );
|
||||
if ( !anActor ) anActor = SMESH::CreateActor( aMeshSObj->GetStudy(), aMeshSObj->GetID().c_str(), true );
|
||||
SMESH_Actor *anActor = SMESH::FindActorByObject( myMesh );
|
||||
if ( !anActor ) anActor = SMESH::CreateActor( aMeshSObj->GetStudy(), aMeshSObj->GetID().c_str(), true );
|
||||
|
||||
anActor->SetEntityMode( entities );
|
||||
SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor );
|
||||
anActor->SetEntityMode( entities );
|
||||
SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor );
|
||||
|
||||
SMESH::Update(myIObject, true);
|
||||
SMESH::Update(myIObject, true);
|
||||
|
||||
if ( limitExceeded )
|
||||
{
|
||||
SUIT_MessageBox::warning( desktop(),
|
||||
tr( "SMESH_WRN_WARNING" ),
|
||||
tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( myMesh->NbElements() ).arg( limitSize ) );
|
||||
}
|
||||
if ( limitExceeded )
|
||||
{
|
||||
SUIT_MessageBox::warning( desktop(),
|
||||
tr( "SMESH_WRN_WARNING" ),
|
||||
tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( myMesh->NbElements() ).arg( limitSize ) );
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
#ifdef _DEBUG_
|
||||
@ -937,7 +929,7 @@ void SMESHGUI_BaseComputeOp::computeMesh()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( limitExceeded )
|
||||
else if ( limitExceeded )
|
||||
{
|
||||
SUIT_MessageBox::warning( desktop(),
|
||||
tr( "SMESH_WRN_WARNING" ),
|
||||
|
@ -49,6 +49,7 @@ class QPushButton;
|
||||
class QTableWidget;
|
||||
class QLabel;
|
||||
class QtxComboBox;
|
||||
class QProgressBar;
|
||||
class SMESHGUI_ComputeDlg;
|
||||
class SMESHGUI_MeshInfosBox;
|
||||
class SMESHGUI_PrecomputeDlg;
|
||||
@ -318,6 +319,7 @@ private:
|
||||
QLabel * nbNodesLabel;
|
||||
QLabel * nbElemsLabel;
|
||||
QLabel * freeRAMLabel;
|
||||
QProgressBar* progressBar;
|
||||
};
|
||||
|
||||
#endif // SMESHGUI_COMPUTEDLG_H
|
||||
|
@ -4651,6 +4651,21 @@ Please, create VTK viewer and try again</translation>
|
||||
<translation>Bad Mesh to Group</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SMESHGUI_ComputeDlg_QThreadQDialog</name>
|
||||
<message>
|
||||
<source>CANCEL</source>
|
||||
<translation>Cancel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CANCELING</source>
|
||||
<translation>Canceling...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TITLE</source>
|
||||
<translation>Compute</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SMESHGUI_PrecomputeDlg</name>
|
||||
<message>
|
||||
|
@ -7484,4 +7484,19 @@ en raison de leurs types incompatibles:
|
||||
<translation>Coef de réduction:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SMESHGUI_ComputeDlg_QThreadQDialog</name>
|
||||
<message>
|
||||
<source>TITLE</source>
|
||||
<translation type="unfinished">Compute</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CANCELING</source>
|
||||
<translation type="unfinished">Canceling...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CANCEL</source>
|
||||
<translation type="unfinished">Cancel</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
Loading…
Reference in New Issue
Block a user