Salome HOME
Addition of MEDFileUMesh.__setitem__ in python bindings.
[modules/med.git] / src / MEDOP / gui / MEDOPModule.cxx
1 // Copyright (C) 2007-2015  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 "MEDOPModule.hxx"
23 #include "QtHelper.hxx"
24
25 #include <SALOMEconfig.h>
26 #include CORBA_CLIENT_HEADER(SALOMEDS)
27
28 #include "MEDOPFactoryClient.hxx"
29 #include "PVViewer_ViewModel.h"
30
31 MEDOPModule::MEDOPModule() :
32   StandardApp_Module()
33 {
34   // Note also that we can't use the getApp() function here because
35   // the initialize(...) function has not been called yet.
36
37   this->setModuleName("MED");
38 }
39
40 //
41 // =====================================================================
42 // This part implements the mandatory interface
43 // =====================================================================
44 //
45
46 /*!
47  * Returns the engine of the XMED module, i.e. the SALOME component
48  * associated to the study root of the module.
49  */
50 Engines::EngineComponent_ptr MEDOPModule::getEngine() const {
51   return MEDOPFactoryClient::getFactory();
52 }
53
54 /*!
55  * Returns the base file name of the image used for the icon's
56  * module. The file is supposed to be located in the resource
57  * directory of the module.
58  */
59 QString MEDOPModule::studyIconName() {
60   return tr("ICO_MEDOP_SMALL");
61 }
62
63 //
64 // =====================================================================
65 // This part add custom widgets (a dockwidget containing a tree view
66 // in this example) and add special actions in the toolbox of the
67 // module.
68 // =====================================================================
69 //
70
71 /*!
72  * This function implements the interface StandardApp_Module. It
73  * creates the widgets specific for this module, in particular the
74  * workspace widget and the dataspace widget.
75  */
76 void MEDOPModule::createModuleWidgets() {
77   _datasourceController = new DatasourceController(this);
78   _workspaceController = new WorkspaceController(this);
79   _xmedDataModel  = new XmedDataModel();
80   _workspaceController->setDataModel(_xmedDataModel);
81
82   connect(_datasourceController, SIGNAL(datasourceSignal(const DatasourceEvent *)),
83     _workspaceController, SLOT(processDatasourceEvent(const DatasourceEvent *)));
84 }
85
86 bool MEDOPModule::activateModule( SUIT_Study* theStudy )
87 {
88   bool bOk = StandardApp_Module::activateModule( theStudy );
89   _workspaceController->showDockWidgets(true);
90   this->setDockLayout(StandardApp_Module::DOCKLAYOUT_LEFT_VLARGE);
91   return bOk;
92 }
93 bool MEDOPModule::deactivateModule( SUIT_Study* theStudy )
94 {
95   _workspaceController->showDockWidgets(false);
96   this->unsetDockLayout();
97   return StandardApp_Module::deactivateModule( theStudy );
98 }
99
100 void MEDOPModule::createModuleActions() {
101   // Creating actions concerning the dataspace
102   _datasourceController->createActions();
103   // Creating actions concerning the workspace
104   _workspaceController->createActions();
105 }
106
107 void MEDOPModule::viewManagers( QStringList& list ) const
108 {
109   list.append( PVViewer_Viewer::Type() );
110 }