Commit a13f6b1d authored by pieper's avatar pieper
Browse files

ENH: add client data point script handler function to support different...

ENH: add client data point script handler function to support different interpreters (pythonqt, for instances)

git-svn-id: http://svn.slicer.org/Slicer4/trunk@14521 3bd1e089-480b-0410-8dfb-8563597acbee
parent 8273fee5
......@@ -227,7 +227,7 @@ int Slicer3_Tcl_Eval ( Tcl_Interp *interp, const char *script )
return 0;
}
void Slicer3_BrokerScriptHandler ( const char *script )
void Slicer3_BrokerScriptHandler ( const char *script, void * vtkNotUsed(dummy) )
{
vtkSlicerApplication::GetInstance()->Script( script );
}
......@@ -932,7 +932,7 @@ int Slicer3_main(int& argc, char *argv[])
// - synchronous mode so that redunant events do not get collapsed
// (this is compatible with standard vtk event behavior, but adds
// the ability to trace event execution).
vtkEventBroker::GetInstance()->SetScriptHandler( Slicer3_BrokerScriptHandler );
vtkEventBroker::GetInstance()->SetScriptHandler( Slicer3_BrokerScriptHandler, NULL );
vtkEventBroker::GetInstance()->SetEventModeToSynchronous();
if ( EventLog != "" )
......
......@@ -101,6 +101,7 @@ vtkEventBroker::vtkEventBroker()
this->CompressCallData = 0;
this->LogFileName = NULL;
this->ScriptHandler = NULL;
this->ScriptHandlerClientData = NULL;
}
//----------------------------------------------------------------------------
......@@ -837,9 +838,12 @@ void vtkEventBroker::InvokeObservation ( vtkObservation *observation, void *call
// Invoke the observation
// - run script is available, otherwise run callback command
// -- pass back the client data to the script handler (for
// example it could be the interpreter to use)
if ( observation->GetScript() != NULL )
{
(*(this->ScriptHandler)) ( observation->GetScript() );
(*(this->ScriptHandler)) (
observation->GetScript(), this->ScriptHandlerClientData );
}
else
{
......
......@@ -231,9 +231,10 @@ public:
///
/// Sets the method pointer to be used for processing script observations
//BTX
void SetScriptHandler ( void (*scriptHandler) (const char* script) )
void SetScriptHandler ( void (*scriptHandler) (const char* script, void *clientData), void *clientData )
{
this->ScriptHandler = scriptHandler;
this->ScriptHandlerClientData = clientData;
}
//ETX
......@@ -272,7 +273,8 @@ protected:
//ETX
//BTX
void (*ScriptHandler) (const char* script);
void (*ScriptHandler) (const char* script, void* clientData);
void *ScriptHandlerClientData;
//ETX
int EventLogging;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment