]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Add a feature
authorvsv <vsv@opencascade.com>
Mon, 19 Aug 2019 13:36:54 +0000 (16:36 +0300)
committervsv <vsv@opencascade.com>
Mon, 19 Aug 2019 13:36:54 +0000 (16:36 +0300)
src/ConnectorPlugin/CMakeLists.txt
src/ConnectorPlugin/ConnectorPlugin.py
src/ConnectorPlugin/ConnectorPlugin_PublishToStudy.py [new file with mode: 0644]
src/ConnectorPlugin/plugin-Connector.xml

index 9e247c9d8b106c9b48a0a092a547168eb5a824c3..4b49da8c25bb96e31fb31a427efdc79013828483 100644 (file)
@@ -22,6 +22,7 @@ INCLUDE(Common)
 SET(PYTHON_FILES
     ConnectorPlugin.py
     ConnectorPlugin_ExportFeature.py
+    ConnectorPlugin_PublishToStudy.py
 )
 
 SET(XML_RESOURCES
index f16adee55871b3ad29316e9a96c67ca254acbae3..3ff045bc0cf9c476a01fabd802fe7e8bd35ccda1 100644 (file)
@@ -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 (file)
index 0000000..fe050bd
--- /dev/null
@@ -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
index caac05b282201cccb10641ccd8214ebd522b2395..e7b3d7b1d733a3b1cd654dd8bfa0bf4b0c3286ab 100644 (file)
@@ -7,6 +7,14 @@
         tooltip="Export all bodies and groups into GEOM module"
         icon="icons/Connector/geom_export.png"
         helpfile="ConnectorPlugin/ConnectorPlugin.html"/>
+      <feature
+        id="PublishToStudy"
+        title="Publish to Study"
+        tooltip="Publish to Study all bodies and groups"
+        icon="icons/Connector/geom_export.png"
+        helpfile="ConnectorPlugin/ConnectorPlugin.html">
+        <tree_data_selector id="DataTree" tooltip="Current data tree"/>
+      </feature>
     </group>
   </workbench>
 </plugin>
\ No newline at end of file