Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / PyConsole / PyConsole_Request.h
1
2
3
4 #ifndef PYCONSOLE_REQUEST_H_
5 #define PYCONSOLE_REQUEST_H_
6
7 #include "PyConsole.h"
8 #include "PyInterp_Request.h"
9
10 #include <vector>
11 #include <QString>
12 #include <QEvent>
13
14 class PyInterp_Interp;
15 class PyConsole_Editor;
16
17 /*!
18   \class ExecCommand
19   \brief Python command execution request.
20   \internal
21 */
22 class ExecCommand : public PyInterp_LockRequest
23 {
24 public:
25   /*!
26     \brief Constructor.
27
28     Creates new python command execution request.
29     \param theInterp   python interpreter
30     \param theCommand  python command
31     \param theListener widget to get the notification messages
32     \param sync        if True the request is processed synchronously
33   */
34   ExecCommand( PyInterp_Interp*        theInterp,
35                const QString&          theCommand,
36                PyConsole_Editor*       theListener,
37                bool                    sync = false );
38
39 protected:
40   /*!
41     \brief Execute the python command in the interpreter and
42            get its execution status.
43   */
44   virtual void execute();
45
46   /*!
47     \brief Create and return a notification event.
48     \return new notification event
49   */
50   virtual QEvent* createEvent();
51
52 private:
53   QString myCommand;   //!< Python command
54   int     myState;     //!< Python command execution status
55 };
56
57 class PyConsole_EnhInterp;
58 class PyConsole_EnhEditor;
59
60 class CompletionCommand : public PyInterp_LockRequest
61 {
62 public:
63   CompletionCommand( PyConsole_EnhInterp*      theInterp,
64                const QString&          input,
65                const QString&          startMatch,
66                PyConsole_EnhEditor*    theListener,
67                bool                    sync = false );
68
69
70 protected:
71   /** List of separators identifying the last parsable token for completion */
72   static const std::vector<QString> SEPARATORS;
73
74   /** String to be passed to the dir() command */
75   QString _dirArg;
76   /** Begining of the command (as typed by the user) */
77   QString _startMatch;
78   /** was the completion command successful */
79   bool _tabSuccess;
80
81   virtual void execute();
82   virtual QEvent* createEvent();
83
84 };
85
86 #endif /* PYCONSOLE_REQUEST_H_ */