]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#1083 errors in parameter
authornds <nds@opencascade.com>
Thu, 12 Nov 2015 15:58:16 +0000 (18:58 +0300)
committernds <nds@opencascade.com>
Thu, 12 Nov 2015 15:58:41 +0000 (18:58 +0300)
The correction for widgets, which are not in the parameters dialog.
They also should show tool tip errors.

14 files changed:
src/ModuleBase/ModuleBase_IErrorMgr.cpp
src/ModuleBase/ModuleBase_IModule.cpp
src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_ModelWidget.cpp
src/ModuleBase/ModuleBase_ModelWidget.h
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherMgr.h
src/PartSet/PartSet_SketcherReetntrantMgr.cpp
src/XGUI/XGUI_ErrorMgr.cpp
src/XGUI/XGUI_ErrorMgr.h
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_Workshop.cpp

index 1d1c8a8d25aa34d434f598a06582a6a1ad43ab4f..293c2b80f9b98a78ada27b13871953b8ff1d61e5 100644 (file)
@@ -29,6 +29,7 @@ void ModuleBase_IErrorMgr::setPropertyPanel(ModuleBase_IPropertyPanel* theProp)
     foreach(const ModuleBase_ModelWidget* aWgt, myPropertyPanel->modelWidgets()) {
       connect(aWgt, SIGNAL(afterValuesChanged()), this, SLOT(onWidgetChanged()));
       connect(aWgt, SIGNAL(afterValuesRestored()), this, SLOT(onWidgetChanged()));
+      connect(aWgt, SIGNAL(valueStateChanged(int)), this, SLOT(onWidgetChanged()));
     }
   }
 }
index 29e89f3efff4863dffa23eccb418c231133f5a7a..c73bf3c1c5081a803b07d15181918d283418eaae 100644 (file)
@@ -8,9 +8,11 @@
 #include "ModuleBase_ISelection.h"
 #include "ModuleBase_OperationDescription.h"
 #include "ModuleBase_OperationFeature.h"
+#include <ModuleBase_ModelWidget.h>
 
 #include <Events_Loop.h>
 
+#include <ModelAPI_Validator.h>
 #include <ModelAPI_Events.h>
 #include <ModelAPI_CompositeFeature.h>
 #include <ModelAPI_Session.h>
@@ -78,7 +80,7 @@ const char* toString(ModelAPI_ExecState theExecState)
 #undef TO_STRING
 }
 
-QString ModuleBase_IModule::getFeatureError(const FeaturePtr& theFeature, const bool isCheckGUI)
+QString ModuleBase_IModule::getFeatureError(const FeaturePtr& theFeature)
 {
   QString anError;
   if (!theFeature.get() || !theFeature->data()->isValid() || theFeature->isAction())
@@ -101,6 +103,35 @@ QString ModuleBase_IModule::getFeatureError(const FeaturePtr& theFeature, const
   return anError;
 }
 
+QString ModuleBase_IModule::getWidgetError(ModuleBase_ModelWidget* theWidget)
+{
+  QString anError;
+
+  if (!theWidget || !theWidget->feature().get())
+    return anError;
+
+  std::string anAttributeID = theWidget->attributeID();
+  AttributePtr anAttribute = theWidget->feature()->attribute(anAttributeID);
+  if (!anAttribute.get())
+    return anError;
+
+  std::string aValidatorID;
+  std::string anErrorMsg;
+
+  static ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
+  if (!aValidators->validate(anAttribute, aValidatorID, anErrorMsg)) {
+    if (anErrorMsg.empty())
+      anErrorMsg = "unknown error.";
+    anErrorMsg = anAttributeID + " - " + aValidatorID + ": " + anErrorMsg;
+  }
+
+  anError = QString::fromStdString(anErrorMsg);
+  if (anError.isEmpty())
+    anError = theWidget->getValueStateError();
+
+  return anError;
+}
+
 void ModuleBase_IModule::grantedOperationIds(ModuleBase_Operation* theOperation,
                                              QStringList& theIds) const
 {
index de02c0dfe5bf972adddf366c515562960c1a3cfe..11e7949cfaf5e5e3de153dcda2f2e11a263eea0b 100755 (executable)
@@ -189,7 +189,12 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   //! Returns the feature error if the current state of the feature in the module is not correct\r
   //! If the feature is correct, it returns an empty value\r
   //! \return string value\r
-  virtual QString getFeatureError(const FeaturePtr& theFeature, const bool isCheckGUI = true);\r
+  virtual QString getFeatureError(const FeaturePtr& theFeature);\r
+\r
+  //! Returns the widget error, get it from the attribute validator and state of the widget\r
+  //! If the feature is correct, it returns an empty value\r
+  //! \return string value\r
+  virtual QString getWidgetError(ModuleBase_ModelWidget* theWidget);\r
 \r
   /// Returns list of granted operation indices\r
   virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const;\r
index f0d33055320a9a9d21ef2fd36029e063aa75a5e1..11a884722518389d0db509315038d050f7762423 100644 (file)
@@ -55,6 +55,33 @@ bool ModuleBase_ModelWidget::isInitialized(ObjectPtr theObject) const
   return theObject->data()->attribute(attributeID())->isInitialized();
 }
 
+QString ModuleBase_ModelWidget::getValueStateError() const
+{
+  QString anError = "";
+
+  ModuleBase_ModelWidget::ValueState aState = getValueState();
+  if (aState != ModuleBase_ModelWidget::Stored) {
+    AttributePtr anAttr = feature()->attribute(attributeID());
+    if (anAttr.get()) {
+      QString anAttributeName = anAttr->id().c_str();
+      switch (aState) {
+        case ModuleBase_ModelWidget::ModifiedInPP:
+          anError = "Attribute \"" + anAttributeName +
+                    "\" modification is not applyed. Please click \"Enter\" or \"Tab\".";
+          break;
+        case ModuleBase_ModelWidget::ModifiedInViewer:
+          anError = "Attribute \"" + anAttributeName +
+                    "\" is locked by modification value in the viewer.";
+          break;
+        case ModuleBase_ModelWidget::Reset:
+          anError = "Attribute \"" + anAttributeName + "\" is not initialized.";
+          break;
+      }
+    }
+  }
+  return anError;
+}
+
 void ModuleBase_ModelWidget::enableFocusProcessing()
 {
   QList<QWidget*> aMyControls = getControls();
index 6e6b1aac416f420a7d17ce35dffec20d8c16df52..3a2f19961939c97e78a9c8d0b559230cee0e0dfb 100644 (file)
@@ -81,6 +81,10 @@ Q_OBJECT
   /// \return the enumeration result
   ValueState getValueState() const { return myState; }
 
+  /// Returns an attribute error according to the value state
+  /// It exists in all cases excepring the "Store" case
+  QString getValueStateError() const;
+
   /// Defines if it is supposed that the widget should interact with the viewer.
   virtual bool isViewerSelector() { return false; }
 
index 69d58a916dfc8cf1b39691db64bc5fe660149e3d..3346c8a75c6c0b6d236ec1ccc4049386b626c735 100755 (executable)
@@ -373,11 +373,11 @@ void PartSet_Module::updateViewerMenu(const QMap<QString, QAction*>& theStdActio
   myMenuMgr->updateViewerMenu(theStdActions);
 }
 
-QString PartSet_Module::getFeatureError(const FeaturePtr& theFeature, const bool isCheckGUI)
+QString PartSet_Module::getFeatureError(const FeaturePtr& theFeature)
 {
-  QString anError = ModuleBase_IModule::getFeatureError(theFeature, isCheckGUI);
+  QString anError = ModuleBase_IModule::getFeatureError(theFeature);
   if (anError.isEmpty())
-    anError = sketchMgr()->getFeatureError(theFeature, isCheckGUI);
+    anError = sketchMgr()->getFeatureError(theFeature);
 
   return anError;
 }
index 26f7ace3431a7ec298888c5000ed51013a2e318f..b83286bf54e5e8c40c9356dd49831d87b31d221a 100755 (executable)
@@ -206,7 +206,7 @@ public:
   //! Returns the feature error if the current state of the feature in the module is not correct
   //! If the feature is correct, it returns an empty value
   //! \return string value
-  virtual QString getFeatureError(const FeaturePtr& theFeature, const bool isCheckGUI = true);
+  virtual QString getFeatureError(const FeaturePtr& theFeature);
 
   /// Returns list of granted operation indices
   virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const;
index a9a2232fac40c1dfdd86215523cfa9a4de2c435e..5accebfb8c86c424ceea17a0ad5cb011b2857c03 100755 (executable)
@@ -680,7 +680,7 @@ bool PartSet_SketcherMgr::sketchSolverError()
   return anError;
 }
 
-QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr& theFeature, const bool isCheckGUI)
+QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr& theFeature)
 {
   QString anError = "";
   if (!theFeature.get() || !theFeature->data()->isValid())
@@ -691,31 +691,6 @@ QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr& theFeature, const
     AttributeStringPtr aAttributeString = aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR());
     anError = aAttributeString->value().c_str();
   }
-  else {
-    ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
-    if (isCheckGUI && anActiveWidget) {
-      ModuleBase_ModelWidget::ValueState aState = anActiveWidget->getValueState();
-      if (aState != ModuleBase_ModelWidget::Stored) {
-        AttributePtr anAttr = anActiveWidget->feature()->attribute(anActiveWidget->attributeID());
-        if (anAttr.get()) {
-          QString anAttributeName = anAttr->id().c_str();
-          switch (aState) {
-            case ModuleBase_ModelWidget::ModifiedInPP:
-              anError = "Attribute \"" + anAttributeName +
-                        "\" modification is not applyed. Please click \"Enter\" or \"Tab\".";
-              break;
-            case ModuleBase_ModelWidget::ModifiedInViewer:
-              anError = "Attribute \"" + anAttributeName +
-                        "\" is locked by modification value in the viewer.";
-              break;
-            case ModuleBase_ModelWidget::Reset:
-              anError = "Attribute \"" + anAttributeName + "\" is not initialized.";
-              break;
-          }
-        }
-      }
-    }
-  }
   return anError;
 }
 
index 8971ba26fbbf6503e476bdeb19f43f45ce537645..3b3280152fdb39a516cc83c5b63266c4eb0eb3a6 100644 (file)
@@ -184,7 +184,7 @@ public:
   //! Incorrect states: the feature is sketch, the solver error value
   //! The feature value is reset, this is the flag of sketch mgr
   //! \return string value
-  QString getFeatureError(const FeaturePtr& theFeature, const bool isCheckGUI = true);
+  QString getFeatureError(const FeaturePtr& theFeature);
 
   /// It nullify internal flags concerned to clicked mouse event
   void clearClickedFlags();
index 083cbd36f4dde52f511f144efa0ec8d72c4679a1..24d2b33098234a22a9bf43acdd7eff8722c109c5 100755 (executable)
@@ -178,7 +178,7 @@ void PartSet_SketcherReetntrantMgr::onNoMoreWidgets(const std::string& thePrevio
 
   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                        (myWorkshop->currentOperation());
-  if (!myWorkshop->module()->getFeatureError(aFOperation->feature(), false).isEmpty())
+  if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty())
     return;
 
   if (aFOperation && PartSet_SketcherMgr::isNestedSketchOperation(aFOperation)) {
@@ -201,7 +201,7 @@ bool PartSet_SketcherReetntrantMgr::processEnter(const std::string& thePreviousA
 
   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                        (myWorkshop->currentOperation());
-  if (!myWorkshop->module()->getFeatureError(aFOperation->feature(), false).isEmpty())
+  if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty())
     return isDone;
 
   myRestartingMode = RM_EmptyFeatureUsed;
index 4da32c07764bcdb9cbb48407859ca5b47aabf5d5..afacb5d82e77cb29e1212b3a39dda5e9bdd88961 100644 (file)
@@ -49,21 +49,29 @@ XGUI_ErrorMgr::~XGUI_ErrorMgr()
 
 void XGUI_ErrorMgr::updateActions(const FeaturePtr& theFeature)
 {
-  QString anError = myWorkshop->module()->getFeatureError(theFeature);
-
   //update Ok Action and header of property panel if the current operation started for the feature
   XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr();
   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                       (workshop()->operationMgr()->currentOperation());
   if (aFOperation && aFOperation->feature() == theFeature) {
     QAction* anOkAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept);
-    updateActionState(anOkAction, theFeature);
+    QString anError = myWorkshop->module()->getFeatureError(theFeature);
+
+    ModuleBase_ModelWidget* anActiveWidget = activeWidget();
+    QString aWidgetError = myWorkshop->module()->getWidgetError(anActiveWidget);
+    if (anError.isEmpty())
+      anError = aWidgetError;
+
+    updateActionState(anOkAction, anError);
+    updateToolTip(anActiveWidget, aWidgetError);
   }
 }
 
 void XGUI_ErrorMgr::updateAcceptAllAction(const FeaturePtr& theFeature)
 {
   QString anError = myWorkshop->module()->getFeatureError(theFeature);
+  if (anError.isEmpty())
+    anError = myWorkshop->module()->getWidgetError(activeWidget());
 
   XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr();
   if (workshop()->isFeatureOfNested(theFeature)) {
@@ -74,134 +82,36 @@ void XGUI_ErrorMgr::updateAcceptAllAction(const FeaturePtr& theFeature)
   }
 }
 
-bool XGUI_ErrorMgr::canProcessClick(QAction* theAction, const FeaturePtr& theFeature)
+void XGUI_ErrorMgr::updateActionState(QAction* theAction, const QString& theError)
 {
-  QString anError = myWorkshop->module()->getFeatureError(theFeature);
-  bool isActionEnabled = anError.isEmpty();
-  if (!isActionEnabled && !anError.isEmpty()) {
-    if (!myErrorDialog) {
-      myErrorDialog = new QDialog(QApplication::desktop(), Qt::Popup);
-      QHBoxLayout* aLay = new QHBoxLayout(myErrorDialog);
-      aLay->setContentsMargins(0, 0, 0, 0);
-
-      QFrame* aMarginWidget = new QFrame(myErrorDialog);
-      aMarginWidget->setFrameStyle(QFrame::Panel | QFrame::Raised);
-
-      aLay->addWidget(aMarginWidget);
-      QHBoxLayout* aMarginLay = new QHBoxLayout(aMarginWidget);
-      aMarginLay->setContentsMargins(4, 4, 4, 4);
-
-      myErrorLabel = new QLabel(aMarginWidget);
-      aMarginLay->addWidget(myErrorLabel);
-    }
-    myErrorLabel->setText(anError);
-    myErrorDialog->move(QCursor::pos());
-    myErrorDialog->show();
-  }
-  return isActionEnabled;
-}
+  bool anEnabled = theError.isEmpty();
 
-void XGUI_ErrorMgr::updateActionState(QAction* theAction, const FeaturePtr& theFeature/*,
-                                      const bool theEnabled*/)
-{
-  QString anError = myWorkshop->module()->getFeatureError(theFeature);
-  bool anEnabled = anError.isEmpty();
-
-  /*bool isActionEnabled = theAction->data() != INVALID_VALUE;
-  if (anEnabled  != isActionEnabled) {
-    // update enable state of the button
-    theAction->setIcon(anEnabled ? QIcon(":pictures/button_ok.png"): QIcon(":pictures/button_ok_error.png"));
-    if (anEnabled)
-      theAction->setData("");
-    else
-      theAction->setData(INVALID_VALUE);
-  }*/
   theAction->setEnabled(anEnabled);
   // some operations have no property panel, so it is important to check that it is not null
   if (myPropertyPanel) {
     // update controls error information
     QWidget* aWidget = myPropertyPanel->headerWidget();
     if (aWidget)
-      aWidget->setToolTip(anError);
+      aWidget->setToolTip(theError);
   }
 }
-
-/*const char* toString(ModelAPI_ExecState theExecState) 
-{
-#define TO_STRING(__NAME__) case __NAME__: return #__NAME__;
-  switch (theExecState) {
-  TO_STRING(ModelAPI_StateDone)
-  TO_STRING(ModelAPI_StateMustBeUpdated)
-  TO_STRING(ModelAPI_StateExecFailed)
-  TO_STRING(ModelAPI_StateInvalidArgument)
-  TO_STRING(ModelAPI_StateNothing)
-  default: return "Unknown ExecState.";
-  }
-#undef TO_STRING
-}*/
-
-/*void XGUI_ErrorMgr::onValidationStateChanged()
-{
-  XGUI_OperationMgr* anOperationMgr = dynamic_cast<XGUI_OperationMgr*>(sender());
-  if (!anOperationMgr)
-    return;
-  ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
-                                                  (anOperationMgr->currentOperation());
-  if (!myPropertyPanel || !aFOperation)
-    return;
-
-  FeaturePtr aFeature = aFOperation->feature();
-  QString anError = getFeatureError(aFeature);
-
-  QWidget* aWidget = myPropertyPanel->headerWidget();
-  if (aWidget) {
-    aWidget->setToolTip(anError);
-    aWidget->setStyleSheet(anError.isEmpty() ? "" : "background-color:pink;");
-  }
-}*/
-
-/*QString XGUI_ErrorMgr::getFeatureError(const FeaturePtr& theFeature) const
-{
-  QString anError;
-  // get feature
-  if (!theFeature.get() || !theFeature->data()->isValid())
-    return anError;
-
-  // set error indication
-  anError = QString::fromStdString(theFeature->error());
-  if (anError.isEmpty()) {
-    bool isDone = ( theFeature->data()->execState() == ModelAPI_StateDone
-                 || theFeature->data()->execState() == ModelAPI_StateMustBeUpdated );
-    if (!isDone)
-      anError = toString(theFeature->data()->execState());
-  }
-
-  return anError;
-}*/
-
 void XGUI_ErrorMgr::onWidgetChanged()
 {
-  static ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
-
   ModuleBase_ModelWidget* aModelWidget = dynamic_cast<ModuleBase_ModelWidget*>(sender());
   if (!aModelWidget || !aModelWidget->feature().get())
     return;
 
-  std::string anAttributeID = aModelWidget->attributeID();
-  AttributePtr anAttribute = aModelWidget->feature()->attribute(anAttributeID);
-  if (!anAttribute.get())
-    return;
+  QString aWidgetError = myWorkshop->module()->getWidgetError(aModelWidget);
+  updateToolTip(aModelWidget, aWidgetError);
+}
 
-  std::string aValidatorID;
-  std::string anErrorMsg;
-  if (!aValidators->validate(anAttribute, aValidatorID, anErrorMsg)) {
-    if (anErrorMsg.empty())
-      anErrorMsg = "unknown error.";
-    anErrorMsg = anAttributeID + " - " + aValidatorID + ": " + anErrorMsg;
-  }
+void XGUI_ErrorMgr::updateToolTip(ModuleBase_ModelWidget* theWidget,
+                                  const QString& theError)
+{
+  if (!theWidget)
+    return;
 
-  QString anError = QString::fromStdString(anErrorMsg);
-  QList<QWidget*> aWidgetList = aModelWidget->getControls();
+  QList<QWidget*> aWidgetList = theWidget->getControls();
   foreach(QWidget* aWidget, aWidgetList) {
     QLabel* aLabel = qobject_cast<QLabel*>(aWidget);
     // We won't set the effect to QLabels - it looks ugly
@@ -210,10 +120,10 @@ void XGUI_ErrorMgr::onWidgetChanged()
     // Get the original tool tip of the widget
     QString aTTip = aWidget->toolTip().section("Errors:\n", 0, 0).trimmed();
     // Add the error message into the tool tip
-    if (!anError.isEmpty()) {
+    if (!theError.isEmpty()) {
       if (!aTTip.isEmpty())
         aTTip.append('\n');
-      aTTip += "Errors:\n" + anError;
+      aTTip += "Errors:\n" + theError;
     }
     aWidget->setToolTip(aTTip);
     //aWidget->setStyleSheet(anError.isEmpty() ? "" : "background-color:pink;");
@@ -225,3 +135,19 @@ XGUI_Workshop* XGUI_ErrorMgr::workshop() const
   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
   return aConnector->workshop();
 }
+
+ModuleBase_ModelWidget* XGUI_ErrorMgr::activeWidget() const
+{
+  ModuleBase_ModelWidget* anActiveWidget = 0;
+
+  ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+                                      (workshop()->operationMgr()->currentOperation());
+  if (aFOperation) {
+    ModuleBase_IPropertyPanel* aPropertyPanel = aFOperation->propertyPanel();
+    if (aPropertyPanel) {
+      anActiveWidget = aPropertyPanel->activeWidget();
+    }
+  }
+  return anActiveWidget;
+}
+
index 89deaeef928cb6430759c511e1030e4704cd1a8e..7295a52a4fd0f4b4e9561112feb5d84e3ae8ee37 100644 (file)
@@ -14,6 +14,8 @@
 
 class XGUI_Workshop;
 class ModuleBase_IWorkshop;
+class ModuleBase_ModelWidget;
+
 class QAction;
 class QDialog;
 class QLabel;
@@ -42,12 +44,6 @@ public:
   /// \param theFeature a feature
   void updateAcceptAllAction(const FeaturePtr& theFeature);
 
-  /// Return true if the feature has no error. If there is an error and the action
-  /// is not valid, the dialog with the error information is shown.
-  /// \param theAction an action, which is checked on validity
-  /// \param theFeature a feature that provides error information
-  bool canProcessClick(QAction* theAction, const FeaturePtr& theFeature);
-
 public slots:
   /// Reimplemented from ModuleBase_ErrorMgr::onValidationStateChanged().
   //virtual void onValidationStateChanged();
@@ -57,21 +53,26 @@ protected slots:
   virtual void onWidgetChanged();
 
 private:
-  /// It updates the action state according to the given parameter
+  /// It disables the action if the error message is not empty
+  /// The message is set to the header tool tip.
   /// \param theAction an action to be changed
-  /// \param theFeature an feature that corresponds to the action
-  void updateActionState(QAction* theAction, const FeaturePtr& theFeature);
+  /// \param theError an error state
+  void updateActionState(QAction* theAction, const QString& theError);
 
-  /// Returns the feature error message
-  /// \param theFeature a feature
-  /// \return the error message
-  //QString getFeatureError(const FeaturePtr& theFeature) const;
+  /// It updates the tool tip of the widget controls according to the widget error
+  /// \param theWidget a widget
+  /// \param theError an error state
+  void updateToolTip(ModuleBase_ModelWidget* theWidget, const QString& theError);
 
   /// Returns casted workshop
   XGUI_Workshop* workshop() const;
 
+  /// Returns an active widget of the current operation
+  /// \return the widget or zero
+  ModuleBase_ModelWidget* activeWidget() const;
+
 private:
-  ModuleBase_IWorkshop* myWorkshop;
+  ModuleBase_IWorkshop* myWorkshop; /// workshop
   QDialog* myErrorDialog; /// contains the error message
   QLabel* myErrorLabel; /// contains an error information
 };
index 4cf2001e1e28a50ae8ba778c624a1eea9f9de397..e0139d8f511cb460a2e64661f4d1ea1f045a00ce 100644 (file)
@@ -198,8 +198,18 @@ void XGUI_OperationMgr::onValidateOperation()
     return;
   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                                           (currentOperation());
-  if(aFOperation && aFOperation->feature().get())
-    setApplyEnabled(myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty());
+  if(aFOperation && aFOperation->feature().get()) {
+    QString anError = myWorkshop->module()->getFeatureError(aFOperation->feature());
+    if (anError.isEmpty()) {
+      ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
+      if (aPanel) {
+        ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
+        if (anActiveWidget)
+          anError = myWorkshop->module()->getWidgetError(anActiveWidget);
+      }
+    }
+    setApplyEnabled(anError.isEmpty());
+  }
 }
 
 void XGUI_OperationMgr::setApplyEnabled(const bool theEnabled)
@@ -541,7 +551,7 @@ bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent)
       if (!aActiveWgt || !aActiveWgt->processEnter()) {
         if (!myWorkshop->module()->processEnter(aActiveWgt ? aActiveWgt->attributeID() : "")) {
           ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(currentOperation());
-          if (!aFOperation || myWorkshop->module()->getFeatureError(aFOperation->feature(), false).isEmpty()) {
+          if (!aFOperation || myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) {
             emit keyEnterReleased();
             commitOperation();
           }
index 25ed50fd39464097d6644633235e667595e9f337..2199df248daadf4873e4b07639499cf6650cbc8e 100755 (executable)
@@ -387,8 +387,8 @@ void XGUI_Workshop::onAcceptActionClicked()
     ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                     (anOperationMgr->currentOperation());
     if (aFOperation) {
-      if (errorMgr()->canProcessClick(anAction, aFOperation->feature()))
-        myOperationMgr->onCommitOperation();
+      //if (errorMgr()->canProcessClick(anAction, aFOperation->feature()))
+      myOperationMgr->onCommitOperation();
     }
   }
 }