Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
23599: EDF 17907 - Gnome freezes when suppressing horde of groups
[modules/smesh.git]
/
src
/
SMESHGUI
/
SMESHGUI.cxx
diff --git
a/src/SMESHGUI/SMESHGUI.cxx
b/src/SMESHGUI/SMESHGUI.cxx
index 25977a776107cdba7778dd5282133e89d001bae3..1bf93ec85426cdc3d00c208c1c7250d331930b53 100644
(file)
--- a/
src/SMESHGUI/SMESHGUI.cxx
+++ b/
src/SMESHGUI/SMESHGUI.cxx
@@
-655,7
+655,8
@@
namespace
// Get parameters of export operation
QString aFilename;
// Get parameters of export operation
QString aFilename;
- int aFormat =-1; // for MED minor versions
+ int aFormat =-1; // for MED minor versions
+ bool isOkToWrite = true; // to check MED file version compatibility before adding a mesh in an existing file
// Init the parameters with the default values
bool aIsASCII_STL = true;
// Init the parameters with the default values
bool aIsASCII_STL = true;
@@
-708,7
+709,7
@@
namespace
if ( fd->exec() )
aFilename = fd->selectedFile();
if ( fd->exec() )
aFilename = fd->selectedFile();
- toOverwrite = fv->isOverwrite();
+ toOverwrite = fv->isOverwrite(
aFilename
);
toCreateGroups = fd->IsChecked(0);
SMESHGUI::resourceMgr()->setValue("SMESH", theByTypeResource, toCreateGroups );
toCreateGroups = fd->IsChecked(0);
SMESHGUI::resourceMgr()->setValue("SMESH", theByTypeResource, toCreateGroups );
@@
-747,19
+748,19
@@
namespace
if ( isMED ) {
//filters << QObject::tr( "MED_FILES_FILTER" ) + " (*.med)";
QString vmed (aMesh->GetVersionString(-1, 2));
if ( isMED ) {
//filters << QObject::tr( "MED_FILES_FILTER" ) + " (*.med)";
QString vmed (aMesh->GetVersionString(-1, 2));
- MESSAGE("MED version: " << vmed.toStdString());
+
//
MESSAGE("MED version: " << vmed.toStdString());
int minor = vmed.split(".").last().toInt();
int minor = vmed.split(".").last().toInt();
- MESSAGE("MED version minor: "<< minor);
- minor +=3; // TODO test, to remove
+
//
MESSAGE("MED version minor: "<< minor);
+ //minor +=3; // TODO remove: test multiple minor
aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( vmed ) + " (*.med)", minor );
for (int ii=0; ii<minor; ii++)
{
QString vs = aMesh->GetVersionString(ii, 2);
aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( vmed ) + " (*.med)", minor );
for (int ii=0; ii<minor; ii++)
{
QString vs = aMesh->GetVersionString(ii, 2);
- std::ostringstream vss; // TODO test, to remove
- vss << "4."; //
- vss << ii; //
- vs = vss.str().c_str(); // TODO test, to remove
- MESSAGE("MED version: " << vs.toStdString());
+ //std::ostringstream vss; // TODO remove: test multiple minor
+ //vss << "4."; // TODO remove: test multiple minor
+ //vss << ii; // TODO remove: test multiple minor
+ //vs = vss.str().c_str(); // TODO remove: test multiple minor
+
//
MESSAGE("MED version: " << vs.toStdString());
aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( vs ) + " (*.med)", ii);
}
}
aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( vs ) + " (*.med)", ii);
}
}
@@
-810,6
+811,8
@@
namespace
bool is_ok = false;
while (!is_ok) {
bool is_ok = false;
while (!is_ok) {
+ MESSAGE("******* Loop on file dialog ***********");
+ isOkToWrite =true;
if ( fd->exec() )
aFilename = fd->selectedFile();
else {
if ( fd->exec() )
aFilename = fd->selectedFile();
else {
@@
-817,13
+820,15
@@
namespace
break;
}
aFormat = aFilterMap[fd->selectedNameFilter()];
break;
}
aFormat = aFilterMap[fd->selectedNameFilter()];
- MESSAGE("selected minor: " << aFormat);
- toOverwrite = fv->isOverwrite();
+ MESSAGE("selected minor: " << aFormat << " file: " << aFilename.toUtf8().constData());
+ toOverwrite = fv->isOverwrite(aFilename);
+ MESSAGE("toOverwrite:" << toOverwrite);
is_ok = true;
if ( !aFilename.isEmpty() ) {
if( !toOverwrite ) {
// can't append to an existing using other format
is_ok = true;
if ( !aFilename.isEmpty() ) {
if( !toOverwrite ) {
// can't append to an existing using other format
- bool isVersionOk = SMESHGUI::GetSMESHGen()->CheckCompatibility( aFilename.toUtf8().constData() );
+ bool isVersionOk = SMESHGUI::GetSMESHGen()->CheckWriteCompatibility( aFilename.toUtf8().constData() );
+ MESSAGE("Append check, isVersionOk:" << isVersionOk);
if ( !isVersionOk ) {
int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
if ( !isVersionOk ) {
int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
@@
-831,11
+836,17
@@
namespace
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"), 0, 1);
if (aRet == 0)
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"), 0, 1);
if (aRet == 0)
- toOverwrite = true;
+ {
+ toOverwrite = true;
+ MESSAGE("incompatible MED file version for add, overwrite accepted");
+ }
else
else
- is_ok = false;
+ {
+ isOkToWrite = false;
+ is_ok = false;
+ MESSAGE("incompatible MED file version for add, overwrite refused");
+ }
}
}
-
QStringList aMeshNamesCollisionList;
SMESH::string_array_var aMeshNames = SMESHGUI::GetSMESHGen()->GetMeshNames( aFilename.toUtf8().constData() );
for( int i = 0, n = aMeshNames->length(); i < n; i++ ) {
QStringList aMeshNamesCollisionList;
SMESH::string_array_var aMeshNames = SMESHGUI::GetSMESHGen()->GetMeshNames( aFilename.toUtf8().constData() );
for( int i = 0, n = aMeshNames->length(); i < n; i++ ) {
@@
-848,7
+859,8
@@
namespace
}
}
}
}
}
}
- if( !aMeshNamesCollisionList.isEmpty() ) {
+ if( !aMeshNamesCollisionList.isEmpty() ) {
+ isOkToWrite = false;
QString aMeshNamesCollisionString = aMeshNamesCollisionList.join( ", " );
int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QString aMeshNamesCollisionString = aMeshNamesCollisionList.join( ", " );
int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
@@
-856,14
+868,18
@@
namespace
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"),
QObject::tr("SMESH_BUT_CANCEL"), 0, 2);
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"),
QObject::tr("SMESH_BUT_CANCEL"), 0, 2);
- if (aRet == 0)
+ MESSAGE("answer collision name " << aRet);
+ if (aRet == 0) {
toOverwrite = true;
toOverwrite = true;
+ isOkToWrite = true;
+ }
else if (aRet == 2)
is_ok = false;
}
}
}
}
else if (aRet == 2)
is_ok = false;
}
}
}
}
+ MESSAGE(" ****** end of file dialog loop, toOverwrite:" << toOverwrite << " isOkToWrite:" << isOkToWrite);
toCreateGroups = fd->IsChecked(0);
toFindOutDim = fd->IsChecked(1);
fieldSelWdg->GetSelectedFields();
toCreateGroups = fd->IsChecked(0);
toFindOutDim = fd->IsChecked(1);
fieldSelWdg->GetSelectedFields();
@@
-898,8
+914,9
@@
namespace
// if ( SMESHGUI::automaticUpdate() )
// SMESH::UpdateView();
// }
// if ( SMESHGUI::automaticUpdate() )
// SMESH::UpdateView();
// }
- if ( isMED )
+ if ( isMED
&& isOkToWrite
)
{
{
+ MESSAGE("OK to write MED file "<< aFilename.toUtf8().constData());
aMeshIter = aMeshList.begin();
for( int aMeshIndex = 0; aMeshIter != aMeshList.end(); aMeshIter++, aMeshIndex++ )
{
aMeshIter = aMeshList.begin();
for( int aMeshIndex = 0; aMeshIter != aMeshList.end(); aMeshIter++, aMeshIndex++ )
{
@@
-1838,6
+1855,7
@@
void SMESHGUI::OnEditDelete()
_PTR(GenericAttribute) anAttr;
_PTR(AttributeIOR) anIOR;
_PTR(GenericAttribute) anAttr;
_PTR(AttributeIOR) anIOR;
+ const int objectCountLimit = 30; // PAL23599
int objectCount = 0;
QString aNameList;
QString aParentComponent = QString::null;
int objectCount = 0;
QString aNameList;
QString aParentComponent = QString::null;
@@
-1847,29
+1865,33
@@
void SMESHGUI::OnEditDelete()
Handle(SALOME_InteractiveObject) anIO = anIt.Value();
if ( anIO.IsNull() ) continue;
Handle(SALOME_InteractiveObject) anIO = anIt.Value();
if ( anIO.IsNull() ) continue;
- QString father = "unknown";
+ QString father = "unknown"
, name
;
_PTR(SObject) aSO = aStudy->FindObjectID( anIO->getEntry() );
if (aSO) {
father = QString::fromStdString( aSO->GetFatherComponent()->ComponentDataType() );
// check if object is reference
_PTR(SObject) aRefSObj;
_PTR(SObject) aSO = aStudy->FindObjectID( anIO->getEntry() );
if (aSO) {
father = QString::fromStdString( aSO->GetFatherComponent()->ComponentDataType() );
// check if object is reference
_PTR(SObject) aRefSObj;
- aNameList.append("\n - ");
if ( aSO->ReferencedObject( aRefSObj ) ) {
if ( aSO->ReferencedObject( aRefSObj ) ) {
- QString aRefName = QString::fromStdString ( aRefSObj->GetName() );
- aNameList.append( aRefName );
+ name = QString::fromStdString ( aRefSObj->GetName() );
father = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
}
else
father = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
}
else
-
aNameList.append(anIO->getName()
);
+
name = anIO->getName(
);
objectCount++;
}
objectCount++;
}
+ if ( objectCount < objectCountLimit ) { // avoid occupying the whole screen
+ aNameList.append("\n - ");
+ aNameList.append( name );
+ }
if( aParentComponent.isNull() )
aParentComponent = father;
else if( !aParentComponent.isEmpty() && aParentComponent!=father )
aParentComponent = "";
}
if( aParentComponent.isNull() )
aParentComponent = father;
else if( !aParentComponent.isEmpty() && aParentComponent!=father )
aParentComponent = "";
}
+ if ( objectCount >= objectCountLimit )
+ aNameList.append("\n - ...");
if ( objectCount == 0 )
return; // No Valid Objects Selected
if ( objectCount == 0 )
return; // No Valid Objects Selected
@@
-5083,6
+5105,11
@@
void SMESHGUI::createPreferences()
setPreferenceProperty( doubleNodesTol, "max", 1000000.0 );
setPreferenceProperty( doubleNodesTol, "step", 0.0000001 );
setPreferenceProperty( doubleNodesTol, "max", 1000000.0 );
setPreferenceProperty( doubleNodesTol, "step", 0.0000001 );
+ /*
+ int cinc = addPreference(tr("PREF_CONTROLS_INCREMENT"), qaGroup, LightApp_Preferences::IntSpin, "SMESH", "controls_increment");
+ setPreferenceProperty( cinc, "min", 0 );
+ setPreferenceProperty( cinc, "max", 5 );
+ */
int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
setPreferenceProperty( exportgroup, "columns", 2 );
int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
setPreferenceProperty( exportgroup, "columns", 2 );
@@
-5316,6
+5343,10
@@
void SMESHGUI::createPreferences()
addPreference( tr( "PREF_ELEMENTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_element" );
addPreference( tr( "PREF_OBJECTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_object" );
addPreference( tr( "PREF_ELEMENTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_element" );
addPreference( tr( "PREF_OBJECTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_object" );
+ int sinc = addPreference(tr("PREF_SELECTION_INCREMENT"), selTab, LightApp_Preferences::IntSpin, "SMESH", "selection_increment");
+ setPreferenceProperty( sinc, "min", 0 );
+ setPreferenceProperty( sinc, "max", 5 );
+
// Scalar Bar tab ------------------------------------------------------------------------
int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) );
int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
// Scalar Bar tab ------------------------------------------------------------------------
int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) );
int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
@@
-5415,7
+5446,8
@@
void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
name== "highlight_color" ||
name=="selection_precision_node" ||
name=="selection_precision_element" ||
name== "highlight_color" ||
name=="selection_precision_node" ||
name=="selection_precision_element" ||
- name=="selection_precision_object" )
+ name=="selection_precision_object" ||
+ name=="selection_increment")
{
SMESH::UpdateSelectionProp( this );
}
{
SMESH::UpdateSelectionProp( this );
}
@@
-6244,7
+6276,7
@@
void SMESHGUI::restoreVisualParameters (int savePoint)
// Check that the entry corresponds to a real object in the Study
// as the object may be deleted or modified after the visual state is saved.
// Check that the entry corresponds to a real object in the Study
// as the object may be deleted or modified after the visual state is saved.
- _PTR(SObject) so = studyDS->FindObjectID(entry.to
Latin1
().data());
+ _PTR(SObject) so = studyDS->FindObjectID(entry.to
Utf8
().data());
if (!so) continue; //Skip the not existent entry
std::vector<std::string> paramNames = ip->getAllParameterNames( *entIt );
if (!so) continue; //Skip the not existent entry
std::vector<std::string> paramNames = ip->getAllParameterNames( *entIt );
@@
-6311,7
+6343,7
@@
void SMESHGUI::restoreVisualParameters (int savePoint)
SMESH_Actor* aGeomAc = SMESH_Actor::SafeDownCast(ac);
if (aGeomAc->hasIO()) {
Handle(SALOME_InteractiveObject) io = aGeomAc->getIO();
SMESH_Actor* aGeomAc = SMESH_Actor::SafeDownCast(ac);
if (aGeomAc->hasIO()) {
Handle(SALOME_InteractiveObject) io = aGeomAc->getIO();
- if (io->hasEntry() && strcmp(io->getEntry(), entry.to
Latin1
().data()) == 0) {
+ if (io->hasEntry() && strcmp(io->getEntry(), entry.to
Utf8
().data()) == 0) {
isFound = true;
vtkActors.Bind(viewIndex, aGeomAc);
}
isFound = true;
vtkActors.Bind(viewIndex, aGeomAc);
}
@@
-6997,7
+7029,7
@@
void SMESHGUI::message( const QString& msg )
// get study
_PTR(Study) study = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() )->studyDS();
// get mesh name
// get study
_PTR(Study) study = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() )->studyDS();
// get mesh name
- _PTR(SObject) obj = study->FindObjectID( entry.to
Latin1
().constData() );
+ _PTR(SObject) obj = study->FindObjectID( entry.to
Utf8
().constData() );
QString name;
if ( obj )
name = SMESH::fromUtf8(obj->GetName());
QString name;
if ( obj )
name = SMESH::fromUtf8(obj->GetName());
@@
-7106,7
+7138,7
@@
bool SMESHGUI::renameObject( const QString& entry, const QString& name) {
aType == SMESH::SUBMESH_EDGE || aType == SMESH::SUBMESH_VERTEX ||
aType == SMESH::HYPOTHESIS || aType == SMESH::ALGORITHM) {
if ( !name.isEmpty() ) {
aType == SMESH::SUBMESH_EDGE || aType == SMESH::SUBMESH_VERTEX ||
aType == SMESH::HYPOTHESIS || aType == SMESH::ALGORITHM) {
if ( !name.isEmpty() ) {
- SMESHGUI::GetSMESHGen()->SetName(obj->GetIOR().c_str(), qPrintable(name) );
+ SMESHGUI::GetSMESHGen()->SetName(obj->GetIOR().c_str(), q
Utf8
Printable(name) );
// update name of group object and its actor
Handle(SALOME_InteractiveObject) IObject =
// update name of group object and its actor
Handle(SALOME_InteractiveObject) IObject =
@@
-7114,9
+7146,9
@@
bool SMESHGUI::renameObject( const QString& entry, const QString& name) {
SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
if( !aGroupObject->_is_nil() ) {
SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
if( !aGroupObject->_is_nil() ) {
- aGroupObject->SetName( qPrintable(name) );
+ aGroupObject->SetName( q
Utf8
Printable(name) );
if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( qPrintable(entry) ) )
if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( qPrintable(entry) ) )
- anActor->setName( qPrintable(name) );
+ anActor->setName( q
Utf8
Printable(name) );
}
return true;
}
}
return true;
}