actionId = _salomeModule->createStandardAction(label,this, SLOT(OnAddDatasource()),icon,tooltip);
_salomeModule->addActionInToolbar(actionId);
+ // This action has to be placed in the general file menu with the label "Import MED file"
+ int menuId = _salomeModule->createMenu( tr( "MEN_FILE" ), -1, 1 );
+ _salomeModule->addActionInMenubar(actionId, menuId);
+
label = tr("LAB_ADD_IMAGE_SOURCE");
tooltip = tr("TIP_ADD_IMAGE_SOURCE");
icon = tr("ICO_IMAGE_ADD");
icon = tr("ICO_DATASOURCE_CHANGE_MESH");
actionId = _salomeModule->createStandardAction(label,this,SLOT(OnChangeUnderlyingMesh()),icon);
_salomeModule->addActionInPopupMenu(actionId);
+
}
/**
QStringList filter;
filter.append(tr("FILE_FILTER_MED"));
+ QString anInitialPath = "";
+ if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
+ anInitialPath = QDir::currentPath();
+
+ /*
QString filename = SUIT_FileDlg::getFileName(_salomeModule->getApp()->desktop(),
"",
filter,
tr("IMPORT_MED_FIELDS"),
true);
-
- if ( filename.isEmpty() ) return;
-
- this->addDatasource(QCHARSTAR(filename));
- _salomeModule->updateObjBrowser(true);
+ */
+
+ QStringList filenames = SUIT_FileDlg::getOpenFileNames( _salomeModule->getApp()->desktop(),
+ anInitialPath,
+ filter,
+ tr("IMPORT_MED_FIELDS") );
+
+ if ( filenames.count() <= 0 ) return;
+ for ( QStringList::ConstIterator itFile = filenames.begin();
+ itFile != filenames.end(); ++itFile ) {
+ QString filename = *itFile;
+ this->addDatasource(QCHARSTAR(filename));
+ _salomeModule->updateObjBrowser(true);
+ }
}
#include "DlgImageToMed.hxx"
// This part implements the mandatory interface
// =====================================================================
//
-//=======================================================================
-// function : initialize
-// purpose :
-//=======================================================================
-void MEDOPModule::initialize( CAM_Application* app ) {
- StandardApp_Module::initialize( app );
-
- QWidget* aParent = application()->desktop();
- SUIT_ResourceMgr* resMgr = dynamic_cast<SUIT_ResourceMgr*>( SUIT_Session::session()->resourceMgr() );
-
- QPixmap aPixmap = resMgr->loadPixmap("XMED", tr("ICO_IMPORT_MED"));
- createAction( MEDOP_MENU_ACTION_ID_IMPORT_MED, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
- tr("IMPORT_MED_FILE"), "", (Qt::CTRL + Qt::Key_M), aParent, false,
- this, SLOT(onImportMedFile()));
-
- int xmedId = createMenu( tr( "MEN_FILE" ), -1, 1 );
- createMenu( MEDOP_MENU_ACTION_ID_IMPORT_MED, xmedId, 10 );
-}
-
/*!
* Returns the engine of the XMED module, i.e. the SALOME component
// Creating actions concerning the workspace
_workspaceController->createActions();
}
-
-void MEDOPModule::onImportMedFile()
-{
- SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
- if( !app )
- return;
- SUIT_Desktop* desktop = app->desktop();
-
- QStringList filter;
- filter.append( tr( "FILE_FILTER_MED" ) );
-
- QString anInitialPath = "";
- if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
- anInitialPath = QDir::currentPath();
-
- QString caption = tr( "IMPORT_FROM_FILE" );
- QStringList filenames = SUIT_FileDlg::getOpenFileNames( desktop,
- anInitialPath,
- filter,
- caption );
-
- if ( filenames.count() <= 0 )
- return;
-
- for ( QStringList::ConstIterator itFile = filenames.begin(); itFile != filenames.end(); ++itFile ) {
- QString filename = *itFile;
- _datasourceController->addDatasource(QCHARSTAR(filename));
- updateObjBrowser(true);
- }
-}
public:
MEDOPModule();
- virtual void initialize( CAM_Application* );
-
protected:
virtual Engines::EngineComponent_ptr getEngine() const;
virtual QString studyIconName();
virtual bool activateModule( SUIT_Study* theStudy );
virtual bool deactivateModule( SUIT_Study* theStudy );
- private slots:
- void onImportMedFile();
-
private:
DatasourceController * _datasourceController;
WorkspaceController * _workspaceController;
<name>@default</name>
<message>
<source>ICO_IMPORT_MED</source>
- <translation>fileimport-32.png</translation>
+ <translation>datasource_add.png</translation>
</message>
<message>
<source>ICO_DATASOURCE</source>
<message>
<location filename="MEDOP/gui/DatasourceController.cxx" line="45"/>
<source>LAB_ADD_DATA_SOURCE</source>
- <translation>Ajouter des données</translation>
+ <translation>Importer des données MED</translation>
</message>
<message>
<location filename="MEDOP/gui/DatasourceController.cxx" line="46"/>
<source>TIP_ADD_DATA_SOURCE</source>
- <translation>Ajouter un fichier de données (au format MED)</translation>
+ <translation>Ajouter des données par import de fichiers MED</translation>
</message>
<message>
<location filename="MEDOP/gui/DatasourceController.cxx" line="52"/>
<message>
<location filename="MEDOP/gui/DatasourceController.cxx" line="53"/>
<source>TIP_ADD_IMAGE_SOURCE</source>
- <translation>Créer des données à partir d'un fichier image</translation>
+ <translation>Ajouter des données par import d'un fichier image</translation>
</message>
<message>
<location filename="MEDOP/gui/DatasourceController.cxx" line="62"/>