Salome HOME
Update state of Apply and Continue button
[modules/shaper.git] / src / XGUI / XGUI_Workshop.cpp
index 0b587f157be4582fc72091862fd9f7159c6a27ae..c1598b82984a957edf34ca9ffef6a2e70d6b2562 100644 (file)
@@ -80,6 +80,7 @@
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Tools.h>
 #include <ModelAPI_ResultField.h>
+#include <ModuleBase_IconFactory.h>
 
 //#include <PartSetPlugin_Part.h>
 
@@ -89,6 +90,7 @@
 
 #include <ExchangePlugin_ExportPart.h>
 #include <ExchangePlugin_ImportPart.h>
+#include <ExchangePlugin_Import.h>
 
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_ShapeExplorer.h>
@@ -491,6 +493,13 @@ void XGUI_Workshop::initMenu()
                                           QIcon(), QKeySequence(),
                                           false, "MEN_DESK_FILE");
   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onImportPart()));
+
+  aAction = salomeConnector()->addDesktopCommand("IMPORT_SHAPE_CMD", tr("Import shape..."),
+    tr("Import shape from a file"),
+    ModuleBase_IconFactory::loadIcon("icons/Exchange/import.png"),
+    QKeySequence(), false, "MEN_DESK_FILE");
+  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onImportShape()));
+
   salomeConnector()->addDesktopMenuSeparator("MEN_DESK_FILE");
 
 #else
@@ -1293,16 +1302,29 @@ void XGUI_Workshop::onImportPart()
   if (abortAllOperations()) {
     ModuleBase_OperationFeature* anImportPartOp = dynamic_cast<ModuleBase_OperationFeature*>(
         module()->createOperation(ExchangePlugin_ImportPart::ID()));
+    myPropertyPanel->updateApplyPlusButton(anImportPartOp->feature());
     operationMgr()->startOperation(anImportPartOp);
   }
 }
 
+//******************************************************
+void XGUI_Workshop::onImportShape()
+{
+  if (abortAllOperations()) {
+    ModuleBase_OperationFeature* anImportOp = dynamic_cast<ModuleBase_OperationFeature*>(
+        module()->createOperation(ExchangePlugin_Import::ID()));
+    myPropertyPanel->updateApplyPlusButton(anImportOp->feature());
+    operationMgr()->startOperation(anImportOp);
+  }
+}
+
 //******************************************************
 void XGUI_Workshop::onExportPart()
 {
   if (abortAllOperations()) {
     ModuleBase_OperationFeature* anExportPartOp = dynamic_cast<ModuleBase_OperationFeature*>(
         module()->createOperation(ExchangePlugin_ExportPart::ID()));
+    myPropertyPanel->updateApplyPlusButton(anExportPartOp->feature());
     operationMgr()->startOperation(anExportPartOp);
   }
 }