Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetSelector.cpp
index 665c9e56befda9c91613a5d48d0b6d6811126be6..ec0e2bf6a3f56a8b4c3ff6765f844536224b6ebe 100755 (executable)
@@ -64,6 +64,8 @@ void ModuleBase_WidgetSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr&
 {
   ModuleBase_ISelection* aSelection = myWorkshop->selection();
   theObject = aSelection->getResult(thePrs);
+  if (!theObject.get())
+    theObject = thePrs->object();
   theShape = aSelection->getShape(thePrs);
 }
 
@@ -133,7 +135,9 @@ bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape,
     return aValid;
   }
   // when the SHAPE type is provided by XML as Object, the whole result shape should be selected.
-  if (!aShape.get() && aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result)) {
+  //if (!aShape.get() && aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result)) {
+  // In case of selection of a feature aShape could be not NULL, but result has to be selected
+  if (aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result)) {
     aValid = true;
     return aValid;
   }
@@ -247,28 +251,3 @@ void ModuleBase_WidgetSelector::deactivate()
     aSelectAttr->removeTemporaryValues();
   }
 }
-
-//********************************************************************
-std::string ModuleBase_WidgetSelector::generateName(const AttributePtr& theAttribute,
-                                                    ModuleBase_IWorkshop* theWorkshop)
-{
-  std::string aName;
-  if (theAttribute.get() != NULL) {
-    ModuleBase_Operation* anOperation = theWorkshop->currentOperation();
-
-    FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
-    if (aFeature.get()) {
-      std::string aXmlCfg, aDescription;
-      theWorkshop->module()->getXMLRepresentation(aFeature->getKind(), aXmlCfg, aDescription);
-
-      ModuleBase_WidgetFactory aFactory(aXmlCfg, theWorkshop);
-      std::string anAttributeTitle;
-      aFactory.getAttributeTitle(theAttribute->id(), anAttributeTitle);
-
-      std::stringstream aStreamName;
-      aStreamName << theAttribute->owner()->data()->name() << "/"<< anAttributeTitle.c_str();
-      aName = aStreamName.str();
-    }
-  }
-  return aName;
-}