Salome HOME
[PythonAPI] Use _fillAttribute() in some sketch functions
[modules/shaper.git] / src / ModuleBase / ModuleBase_IModule.cpp
index 0036afcadc38557a6992655951b0bbb2285c324e..343f3a086fc22649fbda698b6e7f375ee105301b 100644 (file)
@@ -8,12 +8,14 @@
 #include "ModuleBase_ISelection.h"
 #include "ModuleBase_OperationDescription.h"
 #include "ModuleBase_OperationFeature.h"
+#include "ModuleBase_ModelWidget.h"
 
 #include <Events_Loop.h>
 
 #include <ModelAPI_Events.h>
 #include <ModelAPI_CompositeFeature.h>
 #include <ModelAPI_Session.h>
+#include "ModelAPI_Tools.h"
 
 #include <Config_PointerMessage.h>
 #include <Config_WidgetReader.h>
@@ -80,25 +82,12 @@ const char* toString(ModelAPI_ExecState theExecState)
 
 QString ModuleBase_IModule::getFeatureError(const FeaturePtr& theFeature)
 {
-  QString anError;
-  if (!theFeature.get() || !theFeature->data()->isValid() || theFeature->isAction())
-    return anError;
-
-  // to be removed later, this error should be got from the feature
-  if (theFeature->data()->execState() == ModelAPI_StateDone ||
-      theFeature->data()->execState() == ModelAPI_StateMustBeUpdated)
-    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 ModelAPI_Tools::getFeatureError(theFeature).c_str();
+}
 
-  return anError;
+void ModuleBase_IModule::grantedOperationIds(ModuleBase_Operation* theOperation,
+                                             QStringList& theIds) const
+{
 }
 
 ModuleBase_Operation* ModuleBase_IModule::getNewOperation(const std::string& theFeatureId)
@@ -115,7 +104,7 @@ ModuleBase_Operation* ModuleBase_IModule::createOperation(const std::string& the
 {
   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                           (getNewOperation(theFeatureId));
-  // If the operation is launched as sub-operation of another then we have to initialise
+  // If the operation is launched as sub-operation of another then we have to initialize
   // parent feature
   ModuleBase_OperationFeature* aCurOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                          (myWorkshop->currentOperation());
@@ -179,11 +168,6 @@ bool ModuleBase_IModule::canRedo() const
   return aMgr->hasModuleDocument() && aMgr->canRedo() && !aMgr->isOperation();
 }
 
-bool ModuleBase_IModule::canCommitOperation() const
-{
-  return true;
-}
-
 void ModuleBase_IModule::onFeatureTriggered()
 {
   QAction* aCmd = dynamic_cast<QAction*>(sender());
@@ -223,7 +207,7 @@ bool ModuleBase_IModule::canActivateSelection(const ObjectPtr& theObject) const
   return !aFOperation || !aFOperation->hasObject(theObject);
 }
 
-void ModuleBase_IModule::onOperationResumed(ModuleBase_Operation* theOperation) 
+void ModuleBase_IModule::operationResumed(ModuleBase_Operation* theOperation) 
 {
-  emit operationResumed(theOperation);
+  emit resumed(theOperation);
 }