Salome HOME
c71d4bf8a4b9bd156e33ef995172b8a7ff192bc4
[modules/med.git] / src / MEDCalc / gui / MEDModule.cxx
1 // Copyright (C) 2007-2021  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // Author : Guillaume Boulant (EDF)
21
22 #include "MEDModule.hxx"
23 #include "QtHelper.hxx"
24 #include <MEDCalcConstants.hxx>
25 #include "MEDCALCGUI_Displayer.hxx"
26
27 #include "SALOME_LifeCycleCORBA.hxx"
28 #include "QtxPopupMgr.h"
29 #include <QtxInfoPanel.h>
30
31 #include <LightApp_Preferences.h>
32 #include <SUIT_Desktop.h>
33 #include <SUIT_ResourceMgr.h>
34 #include <SUIT_Session.h>
35 #include <SUIT_DataBrowser.h>
36 #include <SalomeApp_Study.h>
37 #include <SalomeApp_DataObject.h>
38 #include <SalomeApp_DataModel.h>
39 #include <SUIT_ViewManager.h>
40 #include <SUIT_ViewWindow.h>
41
42 #include <SALOMEconfig.h>
43 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
44 #include <SALOMEDS_SObject.hxx>
45 #include <SALOMEDS_Study.hxx>
46
47 #ifndef DISABLE_PVVIEWER
48 #include <PVViewer_ViewModel.h>
49 #include <PVViewer_GUIElements.h>
50 #endif
51
52 #include "MEDFactoryClient.hxx"
53 #include "MEDPresentationManager_i.hxx"
54
55 #include <QTimer>
56 #include <sstream>
57
58 #include <pqAnimationManager.h>
59 #include <pqPVApplicationCore.h>
60 #include <pqAnimationScene.h>
61 #include <pqActiveObjects.h>
62 #include <pqView.h>
63
64 //! The only instance of the reference to engine
65 MED_ORB::MED_Gen_var MEDModule::_MED_engine;
66
67 MEDModule::MEDModule() :
68   SalomeApp_Module("FIELDS"), _studyEditor(0),
69   _datasourceController(0), _workspaceController(0), _presentationController(0),
70   _processingController(0), _pvGuiElements(0),
71   _displayer(nullptr),
72   _enableVisibilityStateUpdate(true)
73 {
74   STDLOG("MEDModule::MEDModule()");
75   // Note also that we can't use the getApp() function here because
76   // the initialize(...) function has not been called yet.
77
78   init(); // internal initialization
79 }
80
81 MEDModule::~MEDModule()
82 {
83   // Clean up engine:
84   STDLOG("MEDModule::~MEDModule(): cleaning up engine side.");
85   _MED_engine->cleanUp();
86   MEDFactoryClient::getFactory()->getPresentationManager()->cleanUp();
87   MEDFactoryClient::getFactory()->getDataManager()->cleanUp();
88
89   if (_studyEditor)
90     delete _studyEditor;
91   if (_datasourceController)
92     delete _datasourceController;
93   //if (_workspaceController)
94   //  delete _workspaceController;
95   if (_presentationController)
96     delete _presentationController;
97   if (_processingController)
98     delete _processingController;
99 }
100
101 MED_ORB::MED_Gen_var
102 MEDModule::engine()
103 {
104   init(); // initialize engine, if necessary
105   return _MED_engine;
106 }
107
108 void
109 MEDModule::init()
110 {
111   // initialize FIELDS module engine (load, if necessary)
112         
113   if (CORBA::is_nil(_MED_engine)) {
114         Engines::EngineComponent_var comp = 
115                 SalomeApp_Application::lcc()->FindOrLoad_Component("FactoryServer", "FIELDS");
116         _MED_engine = MED_ORB::MED_Gen::_narrow(comp);
117   }
118   if (CORBA::is_nil( _MED_engine )) {
119     STDLOG("Could not narrow FIELDS engine");
120   }
121 }
122
123 //void MEDModule::onEventLoopStarted()
124 //{
125 //  if(!getApp()->isMainEventLoopStarted())
126 //    {
127 //      QTimer::singleShot(100, this, SLOT(onEventLoopStarted()));
128 //      return;
129 //    }
130 //}
131
132 void
133 MEDModule::initialize( CAM_Application* app )
134 {
135   STDLOG("MEDModule::initialize()");
136   // call the parent implementation
137   SalomeApp_Module::initialize( app );
138
139   if (! getApp()->objectBrowser())
140     getApp()->getWindow(SalomeApp_Application::WT_ObjectBrowser);
141
142   // rnv: #20430 [CEA 20428] FIELDS : improvement of simplified visualisations: 
143   //      Disable auto expanding
144   //getApp()->objectBrowser()->setAutoOpenLevel(5);
145
146   if (app && app->desktop()) {
147     connect((QObject*) (getApp()->objectBrowser()->treeView()), SIGNAL(doubleClicked(const QModelIndex&)),
148             this, SLOT(onDblClick(const QModelIndex&)));
149     connect((QObject*) (getApp()->objectBrowser()->treeView()), SIGNAL(clicked(const QModelIndex&)),
150                 this, SLOT(onClick(const QModelIndex&)));
151   }
152
153   // The following initializes the GUI widget and associated actions
154   this->createModuleWidgets();
155   this->createModuleActions();
156
157   // Now that the workspace controller is created, ParaView core application has normally been started,
158   // and hidden GUI elements have been created.  We can fire the VCR toolbar activation:
159   initToolbars();
160 }
161
162 QString
163 MEDModule::engineIOR() const
164 {
165   init(); // initialize engine, if necessary
166   CORBA::String_var anIOR = getApp()->orb()->object_to_string( _MED_engine.in() );
167   return QString( anIOR.in() );
168 }
169
170 QString
171 MEDModule::iconName() const
172 {
173   return tr("ICO_MED_SMALL");
174 }
175
176 void
177 MEDModule::windows( QMap<int, int>& theMap ) const
178 {
179   STDLOG("MEDModule::windows()");
180   // want Object browser, in the left area
181   theMap.insert( SalomeApp_Application::WT_ObjectBrowser,
182                  Qt::LeftDockWidgetArea );
183   // help windows in the right area
184   theMap.insert( SalomeApp_Application::WT_InfoPanel, Qt::RightDockWidgetArea);
185 #ifndef DISABLE_PYCONSOLE
186   // want Python console, in the bottom area
187   theMap.insert( SalomeApp_Application::WT_PyConsole,
188                  Qt::BottomDockWidgetArea );
189 #endif
190 }
191
192 void
193 MEDModule::viewManagers( QStringList& list ) const
194 {
195 #ifndef DISABLE_PVVIEWER
196   list.append( PVViewer_Viewer::Type() );
197 #endif
198 }
199
200 void
201 MEDModule::createPreferences()
202 {
203   int genTab = addPreference(tr("PREF_TAB_GENERAL"));
204
205   int themeGroup = addPreference(tr("PREF_THEME_GROUP"), genTab);
206   setPreferenceProperty(themeGroup, "columns", 2);
207   int icons = addPreference(tr("PREF_ICONS"), themeGroup, LightApp_Preferences::Selector, "MEDCalc", "icons" );
208   QStringList iconsThemes;
209   iconsThemes.append(tr("PREF_ICON_THEME_MODERN"));
210   iconsThemes.append(tr("PREF_ICON_THEME_CLASSIC"));
211   QList<QVariant> indices;
212   indices.append(0);
213   indices.append(1);
214   setPreferenceProperty(icons, "strings", iconsThemes);
215   setPreferenceProperty(icons, "indexes", indices);
216 }
217
218 bool
219 MEDModule::activateModule( SUIT_Study* theStudy )
220 {
221   STDLOG("MEDModule::activateModule()");
222   if ( CORBA::is_nil( _MED_engine ) )
223     return false;
224
225   // call parent implementation
226   bool bOk = SalomeApp_Module::activateModule( theStudy );
227   if (!bOk)
228     return false;
229
230   // show own menus
231   setMenuShown( true );
232   // show own toolbars
233   setToolShown( true );
234
235   // Fill in Help Panel
236   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(application());
237   QtxInfoPanel* ip = app->infoPanel();
238   app->infoPanel()->setTitle(tr("HELP_WELCOME_FIELDS"));
239
240   // short introduction of FIEDS module
241   int gp = ip->addGroup(tr("HELP_GRP_PRESENTATION"));
242   int lp1 = ip->addLabel(tr("HELP_LABEL_PRES1"), gp);
243   int lp2 = ip->addLabel(tr("HELP_LABEL_PRES2"), gp);
244   int lp3 = ip->addLabel(tr("HELP_LABEL_PRES3"), gp);
245
246
247   // getting started Simplified Visu
248   int gv = ip->addGroup(tr("HELP_GRP_VISUALISATION"));
249   int lv1 = ip->addLabel(tr("HELP_LABEL_VISU1"), gv);
250   int av1 = ip->addAction(action(FIELDSOp::OpAddDataSource) , gv);
251   int lv2 = ip->addLabel(tr("HELP_LABEL_VISU2"), gv);
252   int lv3 = ip->addLabel(tr("HELP_LABEL_VISU3"), gv);
253   QString qs31="<ul><li>" + tr("LAB_VIEW_MODE_REPLACE") + "</li></ul>"; 
254   QString qs32="<ul><li>" + tr("LAB_VIEW_MODE_OVERLAP") + "</li></ul>"; 
255   QString qs33="<ul><li>" + tr("LAB_VIEW_MODE_NEW_LAYOUT") + "</li></ul>"; 
256   QString qs34="<ul><li>" + tr("LAB_VIEW_MODE_SPLIT_VIEW") + "</li></ul>"; 
257   int lv31 = ip->addLabel(qs31, gv);
258   int lv32 = ip->addLabel(qs32, gv);
259   int lv33 = ip->addLabel(qs33, gv);
260   int lv34 = ip->addLabel(qs34, gv);
261   int lv4 = ip->addLabel(tr("HELP_LABEL_VISU4"), gv);
262   int av2 = ip->addAction(action(FIELDSOp::OpScalarMap) , gv);
263   int av3 = ip->addAction(action(FIELDSOp::OpContour) , gv);
264   int av4 = ip->addAction(action(FIELDSOp::OpVectorFields) , gv);
265   int av5 = ip->addAction(action(FIELDSOp::OpSlices) , gv);
266   int av6 = ip->addAction(action(FIELDSOp::OpDeflectionShape) , gv);
267   int av7 = ip->addAction(action(FIELDSOp::OpPointSprite) , gv);
268   int av8 = ip->addAction(action(FIELDSOp::OpPlot3D) , gv);
269   int av9 = ip->addAction(action(FIELDSOp::OpStreamLines) , gv);
270   int av10 = ip->addAction(action(FIELDSOp::OpCutSegment) , gv);
271
272   // getting started interpolation
273   int gi = ip->addGroup(tr("HELP_GRP_INTERPOLATION"));
274   int li1 = ip->addLabel(tr("HELP_LABEL_INTERP1"), gi);
275   int li2 = ip->addLabel(tr("HELP_LABEL_INTERP2"), gi);
276   int li3 = ip->addLabel(tr("HELP_LABEL_INTERP3"), gi);
277   int ai1 = ip->addAction(action(FIELDSOp::OpProcessingInterpolation) , gi);
278   int li4 = ip->addLabel(tr("HELP_LABEL_INTERP4"), gi);
279
280   // End of Help Panel
281
282   //this->createStudyComponent(theStudy);
283   _workspaceController->showDockWidgets(true);
284   _presentationController->showDockWidgets(true);
285   //this->setDockLayout(StandardApp_Module::DOCKLAYOUT_LEFT_VLARGE);
286
287   // Mark the start of the main event loop - important for test playback:
288 //  QObject::connect(getApp(), SIGNAL(activated(SUIT_Application *)), this, SLOT(onEventLoopStarted(SUIT_Application *)));
289 //  QTimer::singleShot(0, this, SLOT(onEventLoopStarted()));
290
291   // return the activation status
292
293   QObject::connect(&pqActiveObjects::instance(), SIGNAL(viewChanged(pqView*)), this,
294     SLOT(onViewChanged()), Qt::QueuedConnection);
295
296   return bOk;
297 }
298
299 bool
300 MEDModule::deactivateModule( SUIT_Study* theStudy )
301 {
302   STDLOG("MEDModule::deactivateModule()");
303   _workspaceController->showDockWidgets(false);
304   _presentationController->showDockWidgets(false);
305   //this->unsetDockLayout();
306
307   // hide own menus
308   setMenuShown( false );
309   // hide own toolbars
310   setToolShown( false );
311
312   // call parent implementation and return the activation status
313   return SalomeApp_Module::deactivateModule( theStudy );
314 }
315
316 //
317 // =====================================================================
318 // This part add custom widgets (a dockwidget containing a tree view
319 // in this example) and add special actions in the toolbox of the
320 // module.
321 // =====================================================================
322 //
323
324 /*!
325  * This function implements the interface StandardApp_Module. It
326  * creates the widgets specific for this module, in particular the
327  * workspace widget and the dataspace widget.
328  */
329 void
330 MEDModule::createModuleWidgets() {
331   _studyEditor = new SALOME_AppStudyEditor(getApp());
332   _datasourceController = new DatasourceController(this);
333   _workspaceController = new WorkspaceController(this);
334   _xmedDataModel  = new XmedDataModel();
335   _workspaceController->setDataModel(_xmedDataModel);
336   _presentationController = new PresentationController(this);
337   // ABN: ultimately console driver should be owned by module: everyone needs it, not only WorkspaceController
338   _presentationController->setConsoleDriver(_workspaceController->getConsoleDriver());
339   _processingController = new ProcessingController(this);
340 #ifdef MED_HAS_QTTESTING
341   _testController = new TestController(this);
342 #endif
343
344   connect(_datasourceController, SIGNAL(datasourceSignal(const DatasourceEvent*)),
345     _workspaceController, SLOT(processDatasourceEvent(const DatasourceEvent*)));
346
347   connect(_presentationController, SIGNAL(presentationSignal(const PresentationEvent*)),
348     _presentationController, SLOT(processPresentationEvent(const PresentationEvent*)));
349
350   connect(_processingController, SIGNAL(processingSignal(const ProcessingEvent*)),
351     _workspaceController, SLOT(processProcessingEvent(const ProcessingEvent*)));
352
353   connect(_workspaceController, SIGNAL(workspaceSignal(const MEDCALC::MedEvent*)),
354     _datasourceController, SLOT(processWorkspaceEvent(const MEDCALC::MedEvent*)));
355
356   connect(_workspaceController, SIGNAL(workspaceSignal(const MEDCALC::MedEvent*)),
357     _presentationController, SLOT(processWorkspaceEvent(const MEDCALC::MedEvent*)));
358
359   connect(&pqActiveObjects::instance(), &pqActiveObjects::viewChanged, [this](pqView* view) { this->updateVisibilityState(); });
360
361 }
362
363
364 void MEDModule::updateVisibilityState(const bool all, const QStringList& entries) 
365 {
366   if (!_enableVisibilityStateUpdate) {
367     return;
368   }
369   QStringList allPrsEntries = QStringList();
370   const QStringList& workList = ( all ? allPrsEntries : entries );
371   if (all) {
372     SALOMEDS::Study_var aStudy = KERNEL::getStudyServant();
373     if (aStudy->_is_nil())
374       return;
375     SALOMEDS::SComponent_var father = aStudy->FindComponent("FIELDS");
376     if (father->_is_nil())
377       return;
378     SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(father);
379     SALOMEDS::GenericAttribute_var anAttribute;
380     for (it->InitEx(true); it->More(); it->Next())
381     {
382       SALOMEDS::SObject_var child(it->Value());
383       if (child->FindAttribute(anAttribute, "AttributeParameter"))
384       {
385         SALOMEDS::AttributeParameter_var attrParam = SALOMEDS::AttributeParameter::_narrow(anAttribute);
386         if (!attrParam->IsSet(IS_PRESENTATION, PT_BOOLEAN) || !attrParam->GetBool(IS_PRESENTATION) || !attrParam->IsSet(PRESENTATION_ID, PT_INTEGER))
387           continue;
388         allPrsEntries.append(child->GetID());
389       }
390     }
391   }
392   
393   // update visibility state of objects
394   LightApp_Application* app = dynamic_cast<LightApp_Application*>(SUIT_Session::session()->activeApplication());
395   if (!app) 
396     return;
397   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
398   if (!appStudy)
399     return;
400   SUIT_Study* activeStudy = app->activeStudy();
401   if (!activeStudy)
402     return;
403   SUIT_ViewWindow* aViewWindow = app->desktop()->activeWindow();
404   if (!aViewWindow)
405     return;
406   SUIT_ViewManager* aViewManager = aViewWindow->getViewManager();
407   if (!aViewManager)
408     return;
409     
410   SUIT_ViewModel * aViewModel = aViewManager->getViewModel();
411   DataObjectList aList;
412   for(const auto& str : workList) {
413     aList.append(appStudy->findObjectByEntry(str));
414   }
415   app->updateVisibilityState(aList, aViewModel);
416
417 }
418
419 void
420 MEDModule::initToolbars()
421 {
422   // VCR and Time toolbars:
423   SUIT_Desktop* dsk = getApp()->desktop();
424   _pvGuiElements = PVViewer_GUIElements::GetInstance(dsk);
425
426   _pvGuiElements->getVCRToolbar();  // make sure VCR toolbar is built
427   _pvGuiElements->setToolBarVisible(false);
428   _pvGuiElements->setVCRTimeToolBarVisible(true);
429
430   // Emit signal in order to make sure that animation scene is set - same trick as in PARAVIS module activation
431   QMetaObject::invokeMethod( pqPVApplicationCore::instance()->animationManager(),
432                              "activeSceneChanged",
433                              Q_ARG( pqAnimationScene*, pqPVApplicationCore::instance()->animationManager()->getActiveScene() ) );
434
435 #ifdef MED_HAS_QTTESTING
436   connect(_workspaceController, SIGNAL(workspaceSignal(const MEDCALC::MedEvent*)),
437     _testController, SLOT(processWorkspaceEvent(const MEDCALC::MedEvent*)));
438 #endif
439 }
440
441 double
442 MEDModule::getCurrentAnimationTimestamp()
443 {
444   double timestamp = pqPVApplicationCore::instance()->animationManager()->getActiveScene()->getAnimationTime();
445   return timestamp;
446 }
447
448 void
449 MEDModule::createModuleActions() {
450   _datasourceController->createActions();
451   _workspaceController->createActions();
452   _presentationController->createActions();
453   _processingController->createActions();
454 #ifdef MED_HAS_QTTESTING
455   _testController->createActions();
456 #endif
457 }
458
459 int
460 MEDModule::createStandardAction(const QString& label,
461                                 QObject* slotobject,
462                                 const char* slotmember,
463                                 const QString& iconName,
464                                 const QString& tooltip,
465                                 int actionid)
466 {
467   SUIT_Desktop* dsk = getApp()->desktop();
468   SUIT_ResourceMgr* resMgr = getApp()->resourceMgr();
469
470   // If the tooltip is not defined, we choose instead the label text.
471   QString effToolTip(tooltip);
472   if ( effToolTip.isEmpty() )
473     effToolTip = label;
474
475   QIcon ico;
476   if (iconName.isEmpty())
477     ico = QIcon();
478   else
479     ico = QIcon(resMgr->loadPixmap("FIELDS", iconName));
480
481   QAction* action = createAction(actionid,
482                                  label,
483                                  ico,
484                                  label,
485                                  effToolTip,
486                                  0,
487                                  dsk,
488                                  false,
489                                  slotobject,
490                                  slotmember
491                                  );
492   return actionId(action);
493 }
494
495 void
496 MEDModule::addActionInPopupMenu(int actionId,const QString& menus,const QString& rule)
497 {
498   // _GBO_ for a fine customization of the rule (for example with a
499   // test on the type of the selected object), see the LIGHT module:
500   // implement "LightApp_Selection*    createSelection() const;"
501   int parentId = -1;
502   QtxPopupMgr* mgr = this->popupMgr();
503   this->action( actionId )->setIconVisibleInMenu(true);
504   if (! menus.isEmpty())
505     mgr->insert ( this->action( actionId ), menus, parentId, 0 );
506   else
507     mgr->insert ( this->action( actionId ), parentId, 0 );
508   mgr->setRule( this->action( actionId ), rule, QtxPopupMgr::VisibleRule );
509 }
510
511 //MEDCALC::ViewModeType
512 //MEDModule::getSelectedViewMode() const
513 //{
514 //  return _presentationController->getSelectedViewMode();
515 //}
516 //
517 //MEDCALC::ColorMapType
518 //MEDModule::getSelectedColorMap() const
519 //{
520 //  return _presentationController->getSelectedColorMap();
521 //}
522 //
523 //MEDCALC::ScalarBarRangeType
524 //MEDModule::getSelectedScalarBarRange() const
525 //{
526 //  return _presentationController->getSelectedScalarBarRange();
527 //}
528
529
530 /**
531  * Returns presentation name, type and ID from the currently selected presentation in the object
532  * browser.
533  */
534 bool
535 MEDModule::itemClickGeneric(std::string & name, std::string & type, int & presId) const
536 {
537   DataObjectList dol = getApp()->objectBrowser()->getSelected();
538   if (dol.isEmpty())
539     return false;
540   SalomeApp_DataObject* item = dynamic_cast<SalomeApp_DataObject*>(dol[0]);
541   if (!item)
542     return false;
543   SalomeApp_DataModel *model = dynamic_cast<SalomeApp_DataModel*>(dataModel());
544   if (!model)
545     return false;
546
547   if (item->componentDataType().toStdString() != "FIELDS")
548     return false;
549   _PTR(SObject) obj = item->object();
550   _PTR(GenericAttribute) anAttribute;
551
552   if (! obj->FindAttribute(anAttribute, "AttributeName"))
553     return false;
554   _PTR(AttributeName) attrName(anAttribute);
555   name = attrName->Value();
556
557   if (! obj->FindAttribute(anAttribute, "AttributeParameter"))
558     return false;
559   _PTR(AttributeParameter) attrParam(anAttribute);
560   if (! attrParam->IsSet(IS_PRESENTATION, PT_BOOLEAN)
561       || ! attrParam->GetBool(IS_PRESENTATION)) { // Not a presentation
562       return false;
563   }
564 //  if (!attrParam->IsSet(FIELD_ID, PT_INTEGER))
565 //    return false;
566 //  fieldId = attrParam->GetInt(FIELD_ID);
567   if (!attrParam->IsSet(PRESENTATION_ID, PT_INTEGER))
568       return false;
569   presId = attrParam->GetInt(PRESENTATION_ID);
570   if (!attrParam->IsSet(PRESENTATION_TYPE, PT_STRING))
571     return false;
572   type = attrParam->GetString(PRESENTATION_TYPE);
573   return true;
574 }
575
576 void
577 MEDModule::onClick(const QModelIndex & /*index*/)
578 {
579   int presId;
580   std::string name, type;
581   if (!itemClickGeneric(name, type, presId))
582     {
583       // Not a presentation - clear widget:
584       emit presentationSelected(-1, QString(""), QString(""));
585       return;
586     }
587
588 //  STDLOG("Presentation selection");
589 //  std::ostringstream oss;
590 //  oss << fieldId << " / " << presId;
591 //  STDLOG("    - Field id / pres id:   " + oss.str());
592 //  STDLOG("    - Presentation type: " + type);
593 //  STDLOG("    - Presentation name: " + name);
594
595   emit presentationSelected(presId, QString::fromStdString(type), QString::fromStdString(name) );  // caught by PresentationController
596 }
597
598 void
599 MEDModule::onDblClick(const QModelIndex& /*index*/)
600 {
601   int presId;
602   std::string name, type;
603   if (!itemClickGeneric(name, type, presId))
604     return;
605
606 //  STDLOG("Presentation double click");
607 //  STDLOG("  Presentation infos:");
608 //  STDLOG("    - Component:         " + item->componentDataType().toStdString());
609 //  STDLOG("    - Item entry:        " + item->entry().toStdString());
610 //  STDLOG("    - Item name:         " + item->name().toStdString());
611 //  std::ostringstream oss;
612 //  oss << fieldId;
613 //  STDLOG("    - Field id:          " + oss.str());
614 //  STDLOG("    - Presentation name: " + name);
615 }
616
617 void
618 MEDModule::requestSALOMETermination() const
619 {
620   STDLOG("Requesting SALOME termination!!");
621   SUIT_Session::session()->closeSession( SUIT_Session::DONT_SAVE, 1 );  // killServers = True
622 }
623
624
625 //bool MEDModule::hasMainEventLoopStarted() const
626 //{
627 //  return _eventLoopStarted;
628 //}
629
630 int
631 MEDModule::getIntParamFromStudyEditor(SALOMEDS::SObject_var obj, const char* name)
632 {
633   if (obj->_is_nil())
634     return -1;
635
636   SALOMEDS::GenericAttribute_var anAttr;
637   SALOMEDS::AttributeParameter_var aParam;
638   if ( obj->FindAttribute(anAttr,"AttributeParameter") ) {
639     aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
640     if (aParam->IsSet(name, PT_INTEGER))
641       return aParam->GetInt(name);
642   }
643   return -1;
644 }
645
646 LightApp_Displayer* MEDModule::displayer()
647 {
648   if (!_displayer)
649     _displayer = new MEDCALCGUI_Displayer(_presentationController);
650   return _displayer;
651 }
652
653 void MEDModule::visibilityStateUpdateOff() {
654   _enableVisibilityStateUpdate = false;
655 }
656 void MEDModule::visibilityStateUpdateOn() {
657   _enableVisibilityStateUpdate = true;
658 }