Back to index

salome-gui  6.5.0
Public Member Functions | Protected Member Functions | Private Attributes
ExecCommand Class Reference

Python command execution request. More...

List of all members.

Public Member Functions

 ExecCommand (PyInterp_Interp *theInterp, const QString &theCommand, PyConsole_Editor *theListener, bool sync=false)
 Constructor.

Protected Member Functions

virtual void execute ()
 Execute the python command in the interpreter and get its execution status.
virtual QEvent * createEvent () const
 Create and return a notification event.

Private Attributes

QString myCommand
 Python command.
int myState
 Python command execution status.

Detailed Description

Python command execution request.

Definition at line 150 of file PyConsole_Editor.cxx.


Constructor & Destructor Documentation

ExecCommand::ExecCommand ( PyInterp_Interp theInterp,
const QString &  theCommand,
PyConsole_Editor theListener,
bool  sync = false 
) [inline]

Constructor.

Creates new python command execution request.

Parameters:
theInterppython interpreter
theCommandpython command
theListenerwidget to get the notification messages
syncif True the request is processed synchronously

Definition at line 162 of file PyConsole_Editor.cxx.

    : PyInterp_LockRequest( theInterp, theListener, sync ),
      myCommand( theCommand ), myState( PyInterp_Event::ES_OK )
  {}

Member Function Documentation

virtual QEvent* ExecCommand::createEvent ( ) const [inline, protected, virtual]

Create and return a notification event.

Returns:
new notification event

Definition at line 191 of file PyConsole_Editor.cxx.

  {
    if ( IsSync() )
      QCoreApplication::sendPostedEvents( listener(), PRINT_EVENT );
    return new PyInterp_Event( myState, (PyInterp_Request*)this );    
  }
virtual void ExecCommand::execute ( ) [inline, protected, virtual]

Execute the python command in the interpreter and get its execution status.

Definition at line 175 of file PyConsole_Editor.cxx.

  {
    if ( myCommand != "" )
    {
      int ret = getInterp()->run( myCommand.toUtf8().data() );
      if ( ret < 0 )
        myState = PyInterp_Event::ES_ERROR;
      else if ( ret > 0 )
        myState = PyInterp_Event::ES_INCOMPLETE;
    } 
  }

Member Data Documentation

QString ExecCommand::myCommand [private]

Python command.

Definition at line 199 of file PyConsole_Editor.cxx.

int ExecCommand::myState [private]

Python command execution status.

Definition at line 200 of file PyConsole_Editor.cxx.


The documentation for this class was generated from the following file: