X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ModelWidget.cpp;h=fdfffa34389b7df51a34a367975047e4141ebec0;hb=aee09da348319d21259bee81c45d00a08f657de0;hp=b172e101e9ed7518e2a8bf99ec22fd4656808b7f;hpb=b9a4919649b3cd5ba06f64a290b5db18bb07f491;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index b172e101e..fdfffa343 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -32,6 +32,7 @@ //#define DEBUG_VALUE_STATE //#define DEBUG_WIDGET_INSTANCE +//#define DEBUG_ENABLE_SKETCH_INPUT_FIELDS ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent, const Config_WidgetAPI* theData) @@ -54,7 +55,12 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent, myAttributeID = theData ? theData->widgetId() : ""; myIsObligatory = theData->getBooleanAttribute(ATTR_OBLIGATORY, true); - myIsValueEnabled = theData->getBooleanAttribute(DOUBLE_WDG_ENABLE_VALUE, true); + myIsValueEnabled = On; // not defined or "true" + std::string anEnableValue = theData->getProperty(DOUBLE_WDG_ENABLE_VALUE); + if (anEnableValue == "false") + myIsValueEnabled = Off; + if (anEnableValue == DOUBLE_WDG_ENABLE_VALUE_BY_PREFERENCES) + myIsValueEnabled = DefinedInPreferences; connect(this, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged())); connect(this, SIGNAL(valuesModified()), this, SLOT(onWidgetValuesModified())); @@ -84,9 +90,18 @@ bool ModuleBase_ModelWidget::isInitialized(ObjectPtr theObject) const bool ModuleBase_ModelWidget::isValueEnabled() const { bool anEnabled = true; - bool aCanDisable = Config_PropManager::boolean("Sketch planes", "disable_input_fields", "true"); - if (aCanDisable) - anEnabled = myIsValueEnabled; + if (myIsValueEnabled == DefinedInPreferences) { +#ifdef DEBUG_ENABLE_SKETCH_INPUT_FIELDS + bool aCanDisable = false; +#else + //Config_PropManager::boolean(SKETCH_TAB_NAME, "disable_input_fields", "true"); + bool aCanDisable = true; +#endif + if (aCanDisable) + anEnabled = false; + } + else if (myIsValueEnabled == Off) + anEnabled = false; return anEnabled; } @@ -200,8 +215,13 @@ void ModuleBase_ModelWidget::setFeature(const FeaturePtr& theFeature, const bool /// after debug, it may be corrected myFlushUpdateBlocked = !isUpdateFlushed; myFeature = theFeature; - if (theToStoreValue) - storeValue(); + if (theToStoreValue) { + /// it is possible that the attribute is filled before the operation is started, + /// e.g. by reentrant operation case some attributes are filled by values of + /// feature of previous operation, we should not lost them here + if (!theFeature->data()->attribute(attributeID())->isInitialized()) + storeValue(); + } myFlushUpdateBlocked = false; }