From: vsv Date: Mon, 19 Aug 2019 13:36:54 +0000 (+0300) Subject: Add a feature X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7b28817ddf4750762da2f1f347a9dab74ba25dbc;p=modules%2Fshaper.git Add a feature --- diff --git a/src/ConnectorPlugin/CMakeLists.txt b/src/ConnectorPlugin/CMakeLists.txt index 9e247c9d8..4b49da8c2 100644 --- a/src/ConnectorPlugin/CMakeLists.txt +++ b/src/ConnectorPlugin/CMakeLists.txt @@ -22,6 +22,7 @@ INCLUDE(Common) SET(PYTHON_FILES ConnectorPlugin.py ConnectorPlugin_ExportFeature.py + ConnectorPlugin_PublishToStudy.py ) SET(XML_RESOURCES diff --git a/src/ConnectorPlugin/ConnectorPlugin.py b/src/ConnectorPlugin/ConnectorPlugin.py index f16adee55..3ff045bc0 100644 --- a/src/ConnectorPlugin/ConnectorPlugin.py +++ b/src/ConnectorPlugin/ConnectorPlugin.py @@ -23,6 +23,7 @@ import ModelAPI from ConnectorPlugin_ExportFeature import ExportFeature +from ConnectorPlugin_PublishToStudy import PublishToStudyFeature ## @ingroup Plugins # The main class for management the construction features as plugin. @@ -37,6 +38,8 @@ class ConnectorPlugin(ModelAPI.ModelAPI_Plugin): def createFeature(self, theFeatureID): if theFeatureID == ExportFeature.ID(): return ExportFeature().__disown__() + elif theFeatureID == PublishToStudyFeature.ID(): + return PublishToStudyFeature().__disown__() else: print("ConnectorPlugin: No such feature %s" % theFeatureID) diff --git a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudy.py b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudy.py new file mode 100644 index 000000000..fe050bd20 --- /dev/null +++ b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudy.py @@ -0,0 +1,62 @@ +# Copyright (C) 2014-2019 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +## @package Plugins +# PublishToStudy class definition + +import ModelAPI +import ExchangeAPI +import EventsAPI + +import salome +from salome.geom import geomBuilder + +from salome.shaper import model + + +## @ingroup Plugins +# Feature to export all shapes and groups into the GEOM module +class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): + + ## The constructor. + def __init__(self): + ModelAPI.ModelAPI_Feature.__init__(self) + pass + + ## Export kind. Static. + @staticmethod + def ID(): + return "PublishToStudy" + + @staticmethod + def TREE_ID(): + """Returns ID tree control.""" + return "DataTree" + + ## Returns the kind of a feature. + def getKind(self): + return PublishToStudyFeature.ID() + + ## This feature has no attributes, as it is action. + def initAttributes(self): + self.data().addAttribute(self.TREE_ID(), ModelAPI.ModelAPI_AttributeRefList_typeId()) + + ## Exports all shapes and groups into the GEOM module. + def execute(self): + pass diff --git a/src/ConnectorPlugin/plugin-Connector.xml b/src/ConnectorPlugin/plugin-Connector.xml index caac05b28..e7b3d7b1d 100644 --- a/src/ConnectorPlugin/plugin-Connector.xml +++ b/src/ConnectorPlugin/plugin-Connector.xml @@ -7,6 +7,14 @@ tooltip="Export all bodies and groups into GEOM module" icon="icons/Connector/geom_export.png" helpfile="ConnectorPlugin/ConnectorPlugin.html"/> + + + \ No newline at end of file