From: vsv Date: Tue, 13 Dec 2016 14:10:55 +0000 (+0300) Subject: Issue #1901: Restore field from Python script X-Git-Tag: before_porting_8.2.0~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d1c3a1eb0a508414fbf1876787f522efb43700c5;p=modules%2Fshaper.git Issue #1901: Restore field from Python script --- diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp index fbf743557..80f3e3d68 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp +++ b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp @@ -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; } diff --git a/src/ModuleBase/ModuleBase_FilterValidated.cpp b/src/ModuleBase/ModuleBase_FilterValidated.cpp index 2a9debb0b..829a70579 100644 --- a/src/ModuleBase/ModuleBase_FilterValidated.cpp +++ b/src/ModuleBase/ModuleBase_FilterValidated.cpp @@ -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 - (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 + (aCurrentWidget); + if (aWidgetValidated) + aValid = !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs); + else{ + ModuleBase_WidgetValidator* aWidgetValidator = aCurrentWidget->widgetValidator(); + if (aWidgetValidator) + aValid = aWidgetValidator->isValidSelection(aPrs); + } } } }