Salome HOME
9af73c3dfdba68cc4703d5f22cbb25327a2eb93c
[modules/shaper.git] / src / XGUI / XGUI_Workshop.cpp
1 #include "XGUI_Module.h"
2 #include "XGUI_Constants.h"
3 #include "XGUI_Command.h"
4 #include "XGUI_MainMenu.h"
5 #include "XGUI_MainWindow.h"
6 #include "XGUI_MenuGroupPanel.h"
7 #include "XGUI_Tools.h"
8 #include "XGUI_Workbench.h"
9 #include "XGUI_Workshop.h"
10 #include "XGUI_Viewer.h"
11 #include "ModuleBase_WidgetFactory.h"
12 #include "XGUI_SelectionMgr.h"
13 #include "XGUI_ObjectsBrowser.h"
14 #include "XGUI_Displayer.h"
15 #include "XGUI_OperationMgr.h"
16 #include "XGUI_SalomeConnector.h"
17
18 #include <ModelAPI_PluginManager.h>
19 #include <ModelAPI_Feature.h>
20 #include <ModelAPI_Data.h>
21 #include <ModelAPI_AttributeDocRef.h>
22
23 #include <Events_Loop.h>
24 #include <ModuleBase_PropPanelOperation.h>
25 #include <ModuleBase_Operation.h>
26 #include <Config_FeatureMessage.h>
27 #include <Config_PointerMessage.h>
28
29 #include <QApplication>
30 #include <QFileDialog>
31 #include <QMessageBox>
32 #include <QMdiSubWindow>
33 #include <QPushButton>
34 #include <QDockWidget>
35 #include <QLayout>
36
37 #ifdef _DEBUG
38 #include <QDebug>
39 #endif
40
41 #ifdef WIN32
42 #include <windows.h>
43 #else
44 #include <dlfcn.h>
45 #endif
46
47 XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
48   : QObject(), 
49   myPartSetModule(NULL),
50   mySalomeConnector(theConnector),
51   myPropertyPanelDock(0),
52   myObjectBrowser(0)
53 {
54   myMainWindow = mySalomeConnector? 0 : new XGUI_MainWindow();
55   mySelector = new XGUI_SelectionMgr(this);
56   myDisplayer = myMainWindow? new XGUI_Displayer(myMainWindow->viewer()) : 0;
57   myOperationMgr = new XGUI_OperationMgr(this);
58   connect(myOperationMgr, SIGNAL(operationStarted()),  this, SLOT(onOperationStarted()));
59   connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
60           this, SLOT(onOperationStopped(ModuleBase_Operation*)));
61 }
62
63 //******************************************************
64 XGUI_Workshop::~XGUI_Workshop(void)
65 {
66 }
67
68 //******************************************************
69 void XGUI_Workshop::startApplication()
70 {
71   initMenu();
72   //Initialize event listening
73   Events_Loop* aLoop = Events_Loop::loop();
74   //TODO(sbh): Implement static method to extract event id [SEID]
75   Events_ID aFeatureId = aLoop->eventByName("FeatureEvent");
76   aLoop->registerListener(this, aFeatureId);
77   Events_ID aPartSetId = aLoop->eventByName("PartSetModuleEvent");
78   aLoop->registerListener(this, aPartSetId);
79   activateModule();
80   if (myMainWindow) {
81     myMainWindow->show();
82     updateCommandStatus();
83   }
84   onNew();
85   // Testing of document creation
86   //boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
87   //boost::shared_ptr<ModelAPI_Feature> aPoint1 = aMgr->rootDocument()->addFeature("Point");
88   //boost::shared_ptr<ModelAPI_Feature> aPart = aMgr->rootDocument()->addFeature("Part");
89   //aPart->execute();
90   //aMgr->setCurrentDocument(aPart->data()->docRef("PartDocument")->value());
91   //boost::shared_ptr<ModelAPI_Feature> aPoint2 = aMgr->rootDocument()->addFeature("Point");
92   //aPoint2 = aMgr->rootDocument()->addFeature("Point");
93
94   //aPart = aMgr->rootDocument()->addFeature("Part");
95   //aPart->execute();
96 }
97
98 //******************************************************
99 void XGUI_Workshop::initMenu()
100 {
101   if (isSalomeMode()) {
102     // Create only Undo, Redo commands
103     salomeConnector()->addEditCommand("UNDO_CMD", 
104                                       tr("Undo"), tr("Undo last command"),
105                                       QIcon(":pictures/undo.png"), 
106                                       false, this, SLOT(onUndo()),
107                                       QKeySequence::Undo);
108     salomeConnector()->addEditCommand("REDO_CMD", 
109                                       tr("Redo"), tr("Redo last command"),
110                                       QIcon(":pictures/redo.png"), 
111                                       false, this, SLOT(onRedo()),
112                                       QKeySequence::Redo);
113     salomeConnector()->addEditMenuSeparator();
114     return;
115   }
116   XGUI_Workbench* aPage = myMainWindow->menuObject()->generalPage();
117
118   // File commands group
119   XGUI_MenuGroupPanel* aGroup = aPage->addGroup("Default");
120
121   XGUI_Command* aCommand;
122
123   aCommand = aGroup->addFeature("SAVE_CMD", tr("Save..."), tr("Save the document"),
124                                 QIcon(":pictures/save.png"), QKeySequence::Save);
125   aCommand->connectTo(this, SLOT(onSave()));
126   //aCommand->disable();
127
128   aCommand = aGroup->addFeature("UNDO_CMD", tr("Undo"), tr("Undo last command"),
129                                 QIcon(":pictures/undo.png"), QKeySequence::Undo);
130   aCommand->connectTo(this, SLOT(onUndo()));
131
132   aCommand = aGroup->addFeature("REDO_CMD", tr("Redo"), tr("Redo last command"),
133                                 QIcon(":pictures/redo.png"), QKeySequence::Redo);
134   aCommand->connectTo(this, SLOT(onRedo()));
135
136   aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
137                                 QIcon(":pictures/rebuild.png"));
138
139   aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"),
140                                 QIcon(":pictures/save.png"));
141   aCommand->connectTo(this, SLOT(onSaveAs()));
142   //aCommand->disable();
143
144   aCommand = aGroup->addFeature("OPEN_CMD", tr("Open..."), tr("Open a new document"),
145                                 QIcon(":pictures/open.png"), QKeySequence::Open);
146   aCommand->connectTo(this, SLOT(onOpen()));
147
148   //aCommand = aGroup->addFeature("NEW_CMD", tr("New"), tr("Create a new document"),
149   //                              QIcon(":pictures/new.png"), QKeySequence::New);
150   //aCommand->connectTo(this, SLOT(onNew()));
151
152   aCommand = aGroup->addFeature("EXIT_CMD", tr("Exit"), tr("Exit application"),
153                                 QIcon(":pictures/close.png"), QKeySequence::Close);
154   aCommand->connectTo(this, SLOT(onExit()));
155
156 }
157
158 //******************************************************
159 XGUI_Workbench* XGUI_Workshop::addWorkbench(const QString& theName)
160 {
161   XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
162   return aMenuBar->addWorkbench(theName);
163 }
164
165 //******************************************************
166 void XGUI_Workshop::processEvent(const Events_Message* theMessage)
167 {
168   static Events_ID aFeatureId = Events_Loop::loop()->eventByName("FeatureEvent");
169   if (theMessage->eventID() == aFeatureId) {
170     const Config_FeatureMessage* aFeatureMsg =
171         dynamic_cast<const Config_FeatureMessage*>(theMessage);
172     addFeature(aFeatureMsg);
173     return;
174   }
175   const Config_PointerMessage* aPartSetMsg =
176       dynamic_cast<const Config_PointerMessage*>(theMessage);
177   if (aPartSetMsg) {
178     ModuleBase_PropPanelOperation* anOperation =
179         (ModuleBase_PropPanelOperation*)(aPartSetMsg->pointer());
180
181     if (myOperationMgr->startOperation(anOperation)) {
182       if (anOperation->isPerformedImmediately()) {
183         anOperation->commit();
184         updateCommandStatus();
185       }
186     }
187     return;
188   }
189
190 #ifdef _DEBUG
191   qDebug() << "XGUI_Workshop::ProcessEvent: "
192   << "Catch message, but it can not be processed.";
193 #endif
194
195 }
196
197 //******************************************************
198 void XGUI_Workshop::onOperationStarted()
199 {
200   ModuleBase_PropPanelOperation* aOperation =
201         (ModuleBase_PropPanelOperation*)(myOperationMgr->currentOperation());
202
203   if(!aOperation->xmlRepresentation().isEmpty()) { //!< No need for property panel
204     connectWithOperation(aOperation);
205     QWidget* aPropWidget = myPropertyPanelDock->findChild<QWidget*>(XGUI::PROP_PANEL_WDG);
206     qDeleteAll(aPropWidget->children());
207
208     showPropertyPanel();
209
210     ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aOperation);
211     aFactory.createWidget(aPropWidget);
212     setPropertyPannelTitle(aOperation->description());
213   }
214 }
215
216 //******************************************************
217 void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation)
218 {
219   ModuleBase_PropPanelOperation* aOperation =
220         (ModuleBase_PropPanelOperation*)(myOperationMgr->currentOperation());
221
222   if(aOperation->xmlRepresentation().isEmpty()) { //!< No need for property panel
223     updateCommandStatus();
224   } else {
225     hidePropertyPanel();
226     updateCommandStatus();
227
228   if (myMainWindow) {
229     XGUI_MainMenu* aMenu = myMainWindow->menuObject();
230     aMenu->restoreCommandState();
231   }
232   }
233 }
234
235 /*
236  *
237  */
238 void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage)
239 {
240   if (!theMessage) {
241 #ifdef _DEBUG
242     qDebug() << "XGUI_Workshop::addFeature: NULL message.";
243 #endif
244     return;
245   }
246   //Find or create Workbench
247   QString aWchName = QString::fromStdString(theMessage->workbenchId());
248   if (isSalomeMode()) {
249     salomeConnector()->addFeature(aWchName,
250                                   QString::fromStdString(theMessage->id()),
251                                   QString::fromStdString(theMessage->text()),
252                                   QString::fromStdString(theMessage->tooltip()),
253                                   QIcon(theMessage->icon().c_str()),
254                                   false, this, 
255                                   SLOT(onFeatureTriggered()), QKeySequence());
256   } else {
257     XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
258     XGUI_Workbench* aPage = aMenuBar->findWorkbench(aWchName);
259     if (!aPage) {
260       aPage = addWorkbench(aWchName);
261     }
262     //Find or create Group
263     QString aGroupName = QString::fromStdString(theMessage->groupId());
264     XGUI_MenuGroupPanel* aGroup = aPage->findGroup(aGroupName);
265     if (!aGroup) {
266       aGroup = aPage->addGroup(aGroupName);
267     }
268     bool isUsePropPanel = theMessage->isUseInput();
269     //Create feature...
270     XGUI_Command* aCommand = aGroup->addFeature(QString::fromStdString(theMessage->id()),
271                                                 QString::fromStdString(theMessage->text()),
272                                                 QString::fromStdString(theMessage->tooltip()),
273                                                 QIcon(theMessage->icon().c_str()),
274                                                 QKeySequence(), isUsePropPanel);
275     
276     connect(aCommand,                   SIGNAL(toggled(bool)),
277             myMainWindow->menuObject(), SLOT(onFeatureChecked(bool)));
278     myPartSetModule->featureCreated(aCommand);
279   }
280 }
281
282 /*
283  * Makes a signal/slot connections between Property Panel
284  * and given operation. The given operation becomes a
285  * current operation and previous operation if exists
286  */
287 void XGUI_Workshop::connectWithOperation(ModuleBase_Operation* theOperation)
288 {
289   QPushButton* aOkBtn = myPropertyPanelDock->findChild<QPushButton*>(XGUI::PROP_PANEL_OK);
290   connect(aOkBtn, SIGNAL(clicked()), theOperation, SLOT(commit()));
291   QPushButton* aCancelBtn = myPropertyPanelDock->findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
292   connect(aCancelBtn, SIGNAL(clicked()), theOperation, SLOT(abort()));
293
294   QAction* aCommand = 0;
295   if (isSalomeMode()) {
296     aCommand = salomeConnector()->command(theOperation->operationId());
297   } else {
298     XGUI_MainMenu* aMenu = myMainWindow->menuObject();
299     aCommand = aMenu->feature(theOperation->operationId());
300   }
301   //Abort operation on uncheck the command
302   connect(aCommand, SIGNAL(toggled(bool)), theOperation, SLOT(setRunning(bool)));
303 }
304
305 //******************************************************
306 void XGUI_Workshop::onExit()
307 {
308   qApp->exit();
309 }
310
311 //******************************************************
312 void XGUI_Workshop::onNew()
313 {
314   QApplication::setOverrideCursor(Qt::WaitCursor);
315   if (objectBrowser() == 0) {
316     createDockWidgets();
317     mySelector->connectObjectBrowser(objectBrowser());
318   }
319   showObjectBrowser();
320   if (!isSalomeMode()) {
321     myMainWindow->showPythonConsole();
322     QMdiSubWindow* aWnd = myMainWindow->viewer()->createView();
323     aWnd->showMaximized();
324     updateCommandStatus();
325   }
326   QApplication::restoreOverrideCursor();
327 }
328
329 //******************************************************
330 void XGUI_Workshop::onOpen()
331 {
332   //QString aFileName = QFileDialog::getOpenFileName(mainWindow());
333   updateCommandStatus();
334 }
335
336 //******************************************************
337 void XGUI_Workshop::onSave()
338 {
339   updateCommandStatus();
340 }
341
342 //******************************************************
343 void XGUI_Workshop::onSaveAs()
344 {
345   //QString aFileName = QFileDialog::getSaveFileName(mainWindow());
346   updateCommandStatus();
347 }
348
349 //******************************************************
350 void XGUI_Workshop::onUndo()
351 {
352   objectBrowser()->setCurrentIndex(QModelIndex());
353   boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
354   boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
355   aDoc->undo();
356   updateCommandStatus();
357 }
358
359 //******************************************************
360 void XGUI_Workshop::onRedo()
361 {
362   objectBrowser()->setCurrentIndex(QModelIndex());
363   boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
364   boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
365   aDoc->redo();
366   updateCommandStatus();
367 }
368
369 //******************************************************
370 XGUI_Module* XGUI_Workshop::loadModule(const QString& theModule)
371 {
372   QString libName = library(theModule);
373   if (libName.isEmpty()) {
374     qWarning(
375     qPrintable( tr( "Information about module \"%1\" doesn't exist." ).arg( theModule ) ));
376     return 0;
377   }
378
379   QString err;
380   CREATE_FUNC crtInst = 0;
381
382 #ifdef WIN32
383
384   HINSTANCE modLib = ::LoadLibrary((LPTSTR) qPrintable(libName));
385   if (!modLib) {
386     LPVOID lpMsgBuf;
387     ::FormatMessage(
388         FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
389         0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0);
390     QString aMsg((char*) &lpMsgBuf);
391     err = QString("Failed to load  %1. %2").arg(libName).arg(aMsg);
392     ::LocalFree(lpMsgBuf);
393   } else {
394     crtInst = (CREATE_FUNC) ::GetProcAddress(modLib, CREATE_MODULE);
395     if (!crtInst) {
396       LPVOID lpMsgBuf;
397       ::FormatMessage(
398           FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
399               | FORMAT_MESSAGE_IGNORE_INSERTS,
400           0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0);
401       QString aMsg((char*) &lpMsgBuf);
402       err = QString("Failed to find  %1 function. %2").arg( CREATE_MODULE).arg(aMsg);
403       ::LocalFree(lpMsgBuf);
404     }
405   }
406 #else
407   void* modLib = dlopen( libName.toLatin1(), RTLD_LAZY );
408   if ( !modLib )
409   err = QString( "Can not load library %1. %2" ).arg( libName ).arg( dlerror() );
410   else
411   {
412     crtInst = (CREATE_FUNC)dlsym( modLib, CREATE_MODULE );
413     if ( !crtInst )
414     err = QString( "Failed to find function %1. %2" ).arg( CREATE_MODULE ).arg( dlerror() );
415   }
416 #endif
417
418   XGUI_Module* aModule = crtInst ? crtInst(this) : 0;
419
420   if (!err.isEmpty()) {
421     if (mainWindow() && mainWindow()->isVisible())
422       QMessageBox::warning(mainWindow(), tr("Error"), err);
423     else
424       qWarning( qPrintable( err ));
425   }
426   return aModule;
427 }
428
429 //******************************************************
430 bool XGUI_Workshop::activateModule()
431 {
432   myPartSetModule = loadModule("PartSet");
433   if (!myPartSetModule)
434     return false;
435   myPartSetModule->createFeatures();
436   return true;
437 }
438
439 //******************************************************
440 void XGUI_Workshop::updateCommandStatus()
441 {
442   if (isSalomeMode()) // TODO: update commands in SALOME
443     return;
444   XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
445
446   QList<XGUI_Command*> aCommands = aMenuBar->features();
447   QList<XGUI_Command*>::const_iterator aIt;
448
449   boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
450   if (aMgr->hasRootDocument()) {
451     XGUI_Command* aUndoCmd;
452     XGUI_Command* aRedoCmd;
453     for (aIt = aCommands.constBegin(); aIt != aCommands.constEnd(); ++aIt) {
454       if ((*aIt)->id() == "UNDO_CMD")
455         aUndoCmd = (*aIt);
456       else if ((*aIt)->id() == "REDO_CMD")
457         aRedoCmd = (*aIt);
458       else // Enable all commands
459         (*aIt)->enable();
460     }
461     boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
462     aUndoCmd->setEnabled(aDoc->canUndo());
463     aRedoCmd->setEnabled(aDoc->canRedo());
464   } else {
465     for (aIt = aCommands.constBegin(); aIt != aCommands.constEnd(); ++aIt) {
466       if ((*aIt)->id() == "NEW_CMD")
467         (*aIt)->enable();
468       else if ((*aIt)->id() == "EXIT_CMD")
469         (*aIt)->enable();
470       else 
471         (*aIt)->disable();
472     }
473   }
474 }
475
476 //******************************************************
477 QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
478 {
479   QDockWidget* aObjDock = new QDockWidget(theParent);
480   aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
481   aObjDock->setWindowTitle(tr("Object browser"));
482   myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
483   aObjDock->setWidget(myObjectBrowser);
484   return aObjDock;
485 }
486
487 //******************************************************
488 QDockWidget* XGUI_Workshop::createPropertyPanel(QWidget* theParent)
489 {
490   QDockWidget* aPropPanel = new QDockWidget(theParent);
491   aPropPanel->setWindowTitle(tr("Property Panel"));
492   QAction* aViewAct = aPropPanel->toggleViewAction();
493   aPropPanel->setObjectName(XGUI::PROP_PANEL);
494
495   QWidget* aContent = new QWidget(aPropPanel);
496   QVBoxLayout* aMainLay = new QVBoxLayout(aContent);
497   aMainLay->setContentsMargins(3, 3, 3, 3);
498   aPropPanel->setWidget(aContent);
499
500   QFrame* aFrm = new QFrame(aContent);
501   aFrm->setFrameStyle(QFrame::Sunken);
502   aFrm->setFrameShape(QFrame::Panel);
503   QHBoxLayout* aBtnLay = new QHBoxLayout(aFrm);
504   aBtnLay->setContentsMargins(0, 0, 0, 0);
505   aMainLay->addWidget(aFrm);
506
507   QPushButton* aBtn = new QPushButton(QIcon(":pictures/button_help.png"), "", aFrm);
508   aBtn->setFlat(true);
509   aBtnLay->addWidget(aBtn);
510   aBtnLay->addStretch(1);
511   aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm);
512   aBtn->setObjectName(XGUI::PROP_PANEL_OK);
513   aBtn->setFlat(true);
514   aBtnLay->addWidget(aBtn);
515   aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm);
516   aBtn->setObjectName(XGUI::PROP_PANEL_CANCEL);
517   aBtn->setFlat(true);
518   aBtnLay->addWidget(aBtn);
519
520   QWidget* aCustomWidget = new QWidget(aContent);
521   aCustomWidget->setObjectName(XGUI::PROP_PANEL_WDG);
522   aMainLay->addWidget(aCustomWidget);
523   aMainLay->addStretch(1);
524
525   return aPropPanel;
526 }
527
528 //******************************************************
529 void XGUI_Workshop::setPropertyPannelTitle(const QString& theTitle)
530 {
531   myPropertyPanelDock->setWindowTitle(theTitle);
532 }
533
534 //******************************************************
535 /*
536  * Creates dock widgets, places them in corresponding area
537  * and tabifies if necessary.
538  */
539 void XGUI_Workshop::createDockWidgets()
540 {
541   QMainWindow* aDesktop = isSalomeMode()? salomeConnector()->desktop() :
542                                           myMainWindow;
543   QDockWidget* aObjDock = createObjectBrowser(aDesktop);
544   aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
545   myPropertyPanelDock = createPropertyPanel(aDesktop);
546   aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanelDock);
547   hidePropertyPanel(); //<! Invisible by default
548   hideObjectBrowser();
549   aDesktop->tabifyDockWidget(aObjDock, myPropertyPanelDock);
550 }
551
552 //******************************************************
553 void XGUI_Workshop::showPropertyPanel()
554 {
555   QAction* aViewAct = myPropertyPanelDock->toggleViewAction();
556   //<! Restore ability to close panel from the window's menu
557   aViewAct->setEnabled(true);
558   myPropertyPanelDock->show();
559   myPropertyPanelDock->raise();
560 }
561
562 //******************************************************
563 void XGUI_Workshop::hidePropertyPanel()
564 {
565   QAction* aViewAct = myPropertyPanelDock->toggleViewAction();
566   //<! Do not allow to show empty property panel
567   aViewAct->setEnabled(false);
568   myPropertyPanelDock->hide();
569 }
570
571 //******************************************************
572 void XGUI_Workshop::showObjectBrowser()
573 {
574   myObjectBrowser->parentWidget()->show();
575 }
576
577 //******************************************************
578 void XGUI_Workshop::hideObjectBrowser()
579 {
580   myObjectBrowser->parentWidget()->hide();
581 }
582
583 //******************************************************
584 void XGUI_Workshop::onFeatureTriggered()
585 {
586   QAction* aCmd = dynamic_cast<QAction*>(sender());
587   if (aCmd) {
588     QString aId = salomeConnector()->commandId(aCmd);
589     if (!aId.isNull())
590       myPartSetModule->launchOperation(aId);
591   }
592 }