Salome HOME
Hide "by general equation" case for plane creation
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetMultiSelector.cpp
index 9d74cc2fb48bb08f67d546bcf00611bf0389cf2b..6ae74c0618d7761da3439185f7aa22ac871f5e54 100644 (file)
@@ -196,19 +196,15 @@ void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool/* theValid*/)
 }
 
 //********************************************************************
-bool ModuleBase_WidgetMultiSelector::setSelection(const Handle_SelectMgr_EntityOwner& theOwner)
+bool ModuleBase_WidgetMultiSelector::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
 {
-  ModuleBase_ViewerPrs aPrs;
-  ModuleBase_ISelection* aSelection = myWorkshop->selection();
-  aSelection->fillPresentation(aPrs, theOwner);
-
-  const TopoDS_Shape& aTDSShape = aPrs.shape();
+  const TopoDS_Shape& aTDSShape = thePrs.shape();
   if (aTDSShape.IsNull())
     return false;
   GeomShapePtr aShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
   aShape->setImpl(new TopoDS_Shape(aTDSShape));
 
-  ObjectPtr anObject = aSelection->getSelectableObject(theOwner);
+  ObjectPtr anObject = myWorkshop->selection()->getSelectableObject(thePrs.owner());
   ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
   if (myFeature) {
     // We can not select a result of our feature
@@ -276,17 +272,15 @@ void ModuleBase_WidgetMultiSelector::onSelectionChanged()
   aSelectionListAttr->clear();
   if (aSelected.size() > 0) {
     foreach (ModuleBase_ViewerPrs aPrs, aSelected) {
-      Handle(SelectMgr_EntityOwner) anOwner = aPrs.owner();
-      if (isValid(anOwner)) {
-        setSelection(anOwner);
+      if (isValidSelection(aPrs)) {
+        setSelectionCustom(aPrs);
       }
     }
   }
+  emit valuesChanged();
   // the updateObject method should be called to flush the updated sigal. The workshop listens it,
   // calls validators for the feature and, as a result, updates the Apply button state.
   updateObject(myFeature);
-
-  emit valuesChanged();
 }
 
 //********************************************************************
@@ -334,6 +328,8 @@ void ModuleBase_WidgetMultiSelector::updateSelectionList(AttributeSelectionListP
     AttributeSelectionPtr aAttr = theList->value(i);
     myListControl->addItem(aAttr->namingName().c_str());
   }
+  // We have to call repaint because sometimes the List control is not updated
+  myListControl->repaint();
 }
 
 //********************************************************************