EVENT_DELETE_FIELD,
EVENT_UPDATE_FIELD,
EVENT_CLEAN_WORKSPACE,
+ EVENT_ADD_DATASOURCE,
EVENT_UNKNOWN
};
struct MedEvent {
MedEventType type;
long fieldid;
+ string filename;
};
interface MEDEventListener: SALOME::GenericObj {
// // Tag the item to prevent double import
// //_studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
}
+
+void
+DatasourceController::processWorkspaceEvent(const MEDOP::MedEvent * event)
+{
+ if ( event->type == MEDOP::EVENT_ADD_DATASOURCE ) {
+ this->addDatasource(event->filename);
+ _salomeModule->updateObjBrowser(true);
+ }
+}
#ifndef DATASOURCE_CONTROLLER_H
#define DATASOURCE_CONTROLLER_H
+#include "MEDEventListener_i.hxx"
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(MEDDataManager)
#include <StandardApp_Module.hxx>
// Callback connected to dialog box validation signals
void OnChangeUnderlyingMeshInputValidated();
void OnInterpolateFieldInputValidated();
+ void processWorkspaceEvent(const MEDOP::MedEvent * event);
signals:
void datasourceSignal(const DatasourceEvent * event);
// WorkspaceController (connect to a slot of WorkspaceController).
emit medEventSignal(new MEDOP::MedEvent(event));
-
-
}
connect(_datasourceController, SIGNAL(datasourceSignal(const DatasourceEvent *)),
_workspaceController, SLOT(processDatasourceEvent(const DatasourceEvent *)));
+
+ connect(_workspaceController, SIGNAL(workspaceSignal(const MEDOP::MedEvent *)),
+ _datasourceController, SLOT(processWorkspaceEvent(const MEDOP::MedEvent *)));
}
bool MEDOPModule::activateModule( SUIT_Study* theStudy )
dataModel->removeDataObject(itemNameId);
}
}
+ else if ( event->type == MEDOP::EVENT_ADD_DATASOURCE ) {
+ emit workspaceSignal(event); // forward to DatasourceController
+ }
}
void OnSaveWorkspace();
void OnCleanWorkspace();
+signals:
+ void workspaceSignal(const MEDOP::MedEvent * event);
+
private:
XmedConsoleDriver * _consoleDriver;
StandardApp_Module * _salomeModule;
__manager = xmed.factory.getPresentationManager()
def LoadDataSource(filename):
- dataHandler = xmed.dataManager.addDatasource(filename)
- print data
- #return data
+ from xmed.fieldproxy import notifyGui_addsource
+ notifyGui_addsource(filename)
#
def MakeScalarMap(proxy, viewMode):
# that they could be used in another context than the FieldProxy instances
import MEDOP
-def __notifyGui(type, fieldId=-1):
- medEvent = MEDOP.MedEvent(type, fieldId)
+def __notifyGui(type, fieldId=-1, filename=""):
+ medEvent = MEDOP.MedEvent(type, fieldId, filename)
if not xmed.eventListenerIsRunning(): return
def notifyGui_clean():
__notifyGui(MEDOP.EVENT_CLEAN_WORKSPACE)
+def notifyGui_addsource(filename):
+ __notifyGui(MEDOP.EVENT_ADD_DATASOURCE,-1,filename)
+
#
# ===================================================================
# use case functions