From: spo Date: Wed, 12 Aug 2015 13:07:29 +0000 (+0300) Subject: Revert "Support of additional attributes if ModelWidget and features" X-Git-Tag: V_1.4.0_beta4~398 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=685b7332585e44e47fba0e14332b4e4dd9a193a9;p=modules%2Fshaper.git Revert "Support of additional attributes if ModelWidget and features" This reverts commit 7b84d9a2bc0884881956d27123f4c31d1efd844b. --- diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index 3cad01b28..4a3943213 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -18,8 +18,6 @@ const static char* NODE_GROUP = "group"; const static char* NODE_FEATURE = "feature"; const static char* NODE_SOURCE = "source"; const static char* NODE_VALIDATOR = "validator"; -const static char* NODE_NAME_ATTRIBUTES = "attributes"; -const static char* NODE_NAME_ATTRIBUTE = "attribute"; const static char* NODE_SELFILTER = "selection_filter"; const static char* NODE_XMLPARENT = "libxml_parent"; @@ -68,9 +66,6 @@ const static char* ATTR_INTERNAL = "internal"; const static char* ATTR_OBLIGATORY = "obligatory"; const static char* ATTR_CONCEALMENT = "concealment"; const static char* ATTR_USE_RESET = "use_reset"; -const static char* ATTR_ID = _ID; -const static char* ATTR_ROLE = "role"; -const static char* ATTR_MAIN_ROLE = "main"; // WDG_INFO properties const static char* INFO_WDG_TEXT = FEATURE_TEXT; diff --git a/src/Config/Config_WidgetAPI.cpp b/src/Config/Config_WidgetAPI.cpp index 214b4bdd5..1249f9ab8 100644 --- a/src/Config/Config_WidgetAPI.cpp +++ b/src/Config/Config_WidgetAPI.cpp @@ -16,7 +16,7 @@ #include -Config_WidgetAPI::Config_WidgetAPI(const std::string& theRawXml) +Config_WidgetAPI::Config_WidgetAPI(std::string theRawXml) { myDoc = xmlParseDoc(BAD_CAST theRawXml.c_str()); myCurrentNode = xmlDocGetRootElement(myDoc); @@ -63,29 +63,6 @@ bool Config_WidgetAPI::toParentWidget() return myCurrentNode != NULL; } -std::list Config_WidgetAPI::attributes() const -{ - std::list aResult; - if (myCurrentNode && hasChild(myCurrentNode)) { - xmlNodePtr anAttributesNode = myCurrentNode->children; - while (anAttributesNode && - (!isElementNode(anAttributesNode) || - std::string((char *) anAttributesNode->name) != NODE_NAME_ATTRIBUTES)) { - anAttributesNode = anAttributesNode->next; - } - if (anAttributesNode && hasChild(anAttributesNode)) { - xmlNodePtr anAttributeNode = anAttributesNode->children; - while (anAttributeNode) { - if (isElementNode(anAttributeNode) && - std::string((char *) anAttributeNode->name) == NODE_NAME_ATTRIBUTE) - aResult.push_back(anAttributeNode); - anAttributeNode = anAttributeNode->next; - } - } - } - return aResult; -} - std::string Config_WidgetAPI::widgetType() const { std::string result = ""; @@ -136,39 +113,3 @@ std::string Config_WidgetAPI::widgetTooltip() const { return getProperty(ATTR_TOOLTIP); } - -std::list Config_WidgetAPI::getAttributes(const std::string& theRole/* = std::string()*/) const -{ - std::list aResult; - - if (theRole.empty() || theRole == ATTR_MAIN_ROLE) - aResult.push_back(widgetId()); - - if (theRole == ATTR_MAIN_ROLE) - return aResult; - - std::list anAttributes = attributes(); - for (auto it = anAttributes.begin(); it != anAttributes.end(); ++it) { - if (theRole.empty() || theRole == ::getProperty(*it, ATTR_ROLE)) - aResult.push_back(::getProperty(*it, ATTR_ID)); - } - return aResult; -} - -std::string Config_WidgetAPI::getAttributeProperty(const std::string& theAttribute, - const std::string& thePropName) const -{ - if (theAttribute == widgetId()) { - if (thePropName == ATTR_ROLE) - return ATTR_MAIN_ROLE; - return ::getProperty(myCurrentNode, thePropName.c_str()); - } - - std::list anAttributes = attributes(); - for (auto it = anAttributes.begin(); it != anAttributes.end(); ++it) { - if (theAttribute == ::getProperty(*it, ATTR_ID)) - return ::getProperty(*it, thePropName.c_str()); - } - return std::string(); -} - diff --git a/src/Config/Config_WidgetAPI.h b/src/Config/Config_WidgetAPI.h index a99ba1a58..e9531e49f 100644 --- a/src/Config/Config_WidgetAPI.h +++ b/src/Config/Config_WidgetAPI.h @@ -13,7 +13,6 @@ #include #include -#include #include //>> Forward declaration of xmlNodePtr. @@ -57,15 +56,6 @@ class CONFIG_EXPORT Config_WidgetAPI //! Returns a custom property of current widget std::string getProperty(const char* thePropName) const; - /*! Returns a list of attributes. - * If theRole is 0 then returns all attributes. - * If theRole is "main" then returns widgetId(). - */ - std::list getAttributes(const std::string& theRole = std::string()) const; - //! Returns a custom property of attribute - std::string getAttributeProperty(const std::string& theAttribute, - const std::string& thePropName) const; - /*! Checks if the XML representation of widget has given attribute, * if yes - returns it's bool value, if no, or if the value can not * be converted to bool - returns theDefault. @@ -77,7 +67,7 @@ class CONFIG_EXPORT Config_WidgetAPI protected: /// These fields are accessible for ModuleBase_WidgetFactory only - Config_WidgetAPI(const std::string& theRawXml); + Config_WidgetAPI(std::string theRawXml); //! Pass to the next (sibling) node of widget's xml definition. If impossible, returns false bool toNextWidget(); //! Pass into the child node of widget's xml definition. If impossible, returns false @@ -85,8 +75,6 @@ class CONFIG_EXPORT Config_WidgetAPI //! Pass into the parent node of widget's xml definition. If impossible, returns false bool toParentWidget(); - std::list attributes() const; - private: xmlDocPtr myDoc; //!< Pointer to the root of widget's xml definition xmlNodePtr myCurrentNode; //!< Pointer to the current node in the widget's xml definition diff --git a/src/ExchangePlugin/plugin-Exchange.xml b/src/ExchangePlugin/plugin-Exchange.xml index 061e23180..e98d9f710 100644 --- a/src/ExchangePlugin/plugin-Exchange.xml +++ b/src/ExchangePlugin/plugin-Exchange.xml @@ -11,12 +11,9 @@ - - - - + \ No newline at end of file diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index c9e21b2c4..63d8095fc 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -35,12 +35,6 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent, myAttributeID = theData ? theData->widgetId() : ""; myIsObligatory = theData->getBooleanAttribute(ATTR_OBLIGATORY, true); - std::list anAttributes = theData->getAttributes(); - for (auto it = anAttributes.begin(); it != anAttributes.end(); ++it) { - std::string aRole = theData->getAttributeProperty(*it, ATTR_ROLE); - myRoleAttributesID[aRole] << *it; - } - connect(this, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged())); } @@ -88,17 +82,6 @@ void ModuleBase_ModelWidget::setHighlighted(bool isHighlighted) } } -std::string ModuleBase_ModelWidget::attributeID(const std::string& theRole/* = std::string()*/) const -{ - if (theRole.empty()) - return myAttributeID; - - if (myRoleAttributesID.contains(theRole) && !myRoleAttributesID[theRole].isEmpty()) - return myRoleAttributesID[theRole].last(); - - return std::string(); -} - void ModuleBase_ModelWidget::setFeature(const FeaturePtr& theFeature, const bool theToStoreValue) { myFeature = theFeature; diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index b74bf54f7..cad3f174c 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -12,8 +12,6 @@ #include -#include -#include #include #include @@ -123,7 +121,10 @@ Q_OBJECT /// Returns the attribute name /// \returns the string value - std::string attributeID(const std::string& theRole = std::string()) const; + std::string attributeID() const + { + return myAttributeID; + } /// Returns the parent of the attribute /// \returns the string value @@ -215,9 +216,6 @@ protected slots: /// The attribute name of the model feature std::string myAttributeID; - /// The list of attribute names of the model feature for a role - QMap > myRoleAttributesID; - /// Name of parent std::string myParentId; diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.h b/src/ModuleBase/ModuleBase_WidgetFactory.h index f7e7bd492..1e1f29fa7 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.h +++ b/src/ModuleBase/ModuleBase_WidgetFactory.h @@ -24,8 +24,8 @@ class ModuleBase_PageBase; /** * \ingroup GUI -* A class for creation of widgets instances in for property panel using -* XML description of a feature +* A class for creation of widgets instances in for property panel using XML deskription of +* a feature */ class MODULEBASE_EXPORT ModuleBase_WidgetFactory { diff --git a/src/PartSet/PartSet_WidgetFileSelector.cpp b/src/PartSet/PartSet_WidgetFileSelector.cpp index db26f45a7..117a8c866 100644 --- a/src/PartSet/PartSet_WidgetFileSelector.cpp +++ b/src/PartSet/PartSet_WidgetFileSelector.cpp @@ -27,7 +27,7 @@ bool PartSet_WidgetFileSelector::restoreValueCustom() return false; DataPtr aData = myFeature->data(); - AttributeStringPtr aStringAttr = aData->string(attributeID("format")); + AttributeStringPtr aStringAttr = aData->string("export_file_format"); mySelectedFilter = formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value()))); return ModuleBase_WidgetFileSelector::restoreValueCustom(); @@ -40,7 +40,7 @@ bool PartSet_WidgetFileSelector::storeValueCustom() const return false; DataPtr aData = myFeature->data(); - AttributeStringPtr aStringAttr = aData->string(attributeID("format")); + AttributeStringPtr aStringAttr = aData->string("export_file_format"); aStringAttr->setValue(filterToShortFormat(mySelectedFilter).toStdString()); return ModuleBase_WidgetFileSelector::storeValueCustom(); diff --git a/src/PartSet/PartSet_WidgetMultiSelector.h b/src/PartSet/PartSet_WidgetMultiSelector.h index a7f19df94..e0479547e 100644 --- a/src/PartSet/PartSet_WidgetMultiSelector.h +++ b/src/PartSet/PartSet_WidgetMultiSelector.h @@ -19,7 +19,7 @@ class PartSet_ExternalObjectsMgr; /** * \ingroup Modules -* Customization of ModuleBase_WidgetMultiSelector in order to provide +* Customosation of ModuleBase_WidgetMultiSelector in order to provide * working with sketch specific objects and creation of external objects. */ class PARTSET_EXPORT PartSet_WidgetMultiSelector: public ModuleBase_WidgetMultiSelector @@ -29,7 +29,7 @@ Q_OBJECT /// Constructor /// \param theParent the parent object /// \param theWorkshop instance of workshop interface - /// \param theData the widget configuration. The attribute of the model widget is obtained from + /// \param theData the widget configuation. The attribute of the model widget is obtained from /// \param theParentId is Id of a parent of the current attribute PartSet_WidgetMultiSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData, const std::string& theParentId); @@ -43,7 +43,7 @@ Q_OBJECT /// \param theSketch a sketcher object void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; } - /// Returns installed sketcher + /// Retrurns installed sketcher CompositeFeaturePtr sketch() const { return mySketch; } /// Set the given wrapped value to the current widget @@ -85,4 +85,4 @@ protected: bool myIsInVaildate; }; -#endif +#endif \ No newline at end of file