]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1901: Restore field from Python script
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 13 Dec 2016 14:10:55 +0000 (17:10 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 13 Dec 2016 14:11:09 +0000 (17:11 +0300)
src/CollectionPlugin/CollectionPlugin_WidgetField.cpp
src/ModuleBase/ModuleBase_FilterValidated.cpp

index fbf74355733b347be345dbd3a4f15cbc3e539b9b..80f3e3d683e9f15afc10c6255e5f21b050c4689a 100644 (file)
@@ -590,17 +590,19 @@ bool CollectionPlugin_WidgetField::restoreValueCustom()
 //**********************************************************************************
 int CollectionPlugin_WidgetField::getSelectionType(const std::string& theStr) const
 {
-  if (theStr == "vertex")
+  QString aType(theStr.c_str());
+  aType = aType.toLower();
+  if (aType == "vertex")
     return 0;
-  else if (theStr == "edge")
+  else if (aType == "edge")
     return 1;
-  else if (theStr == "face")
+  else if (aType == "face")
     return 2;
-  else if (theStr == "solid")
+  else if (aType == "solid")
     return 3;
-  else if (theStr == "object")
+  else if (aType == "object")
     return 4;
-  else if (theStr == "part")
+  else if (aType == "part")
     return 5;
   return -1;
 }
index 2a9debb0bdd38f9a1acddef00d820775fcf51bce..829a70579781f50ef707254da7e524f3924f68bf 100644 (file)
@@ -30,20 +30,22 @@ Standard_Boolean ModuleBase_FilterValidated::
     Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
 
     ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
-    ModuleBase_ModelWidget* aCurrentWidget = aPanel->preselectionWidget();
-    if (!aCurrentWidget)
-      aCurrentWidget = myWorkshop->module()->activeWidget();
-    if (aCurrentWidget) {
-      ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs());
-      myWorkshop->selection()->fillPresentation(aPrs, theOwner);
-      ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
-                                                                             (aCurrentWidget);
-      if (aWidgetValidated)
-        aValid = !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs);
-      else{
-        ModuleBase_WidgetValidator* aWidgetValidator = aCurrentWidget->widgetValidator();
-        if (aWidgetValidator)
-          aValid = aWidgetValidator->isValidSelection(aPrs);
+    if (aPanel) {
+      ModuleBase_ModelWidget* aCurrentWidget = aPanel->preselectionWidget();
+      if (!aCurrentWidget)
+        aCurrentWidget = myWorkshop->module()->activeWidget();
+      if (aCurrentWidget) {
+        ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs());
+        myWorkshop->selection()->fillPresentation(aPrs, theOwner);
+        ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
+                                                                               (aCurrentWidget);
+        if (aWidgetValidated)
+          aValid = !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs);
+        else{
+          ModuleBase_WidgetValidator* aWidgetValidator = aCurrentWidget->widgetValidator();
+          if (aWidgetValidator)
+            aValid = aWidgetValidator->isValidSelection(aPrs);
+        }
       }
     }
   }