2 #ifndef PYCONSOLE_EDITOR_H
3 #define PYCONSOLE_EDITOR_H
9 class PyConsole_Interp;
10 class PyInterp_Request;
13 class PYCONSOLE_EXPORT PyConsole_Editor : public QTextEdit
18 PyConsole_Editor( PyConsole_Interp* theInterp, QWidget *theParent = 0 );
21 virtual void addText( const QString& str, const bool newBlock = false, const bool isError = false );
22 bool isCommand( const QString& str ) const;
24 virtual void exec( const QString& command );
25 void execAndWait( const QString& command );
28 void setIsSync( const bool );
30 bool isSuppressOutput() const;
31 void setIsSuppressOutput(const bool);
33 bool isShowBanner() const;
34 void setIsShowBanner( const bool );
36 virtual QSize sizeHint() const;
43 void onPyInterpChanged( PyConsole_Interp* );
47 virtual void dropEvent( QDropEvent* event );
48 virtual void mouseReleaseEvent( QMouseEvent* event );
49 virtual void keyPressEvent ( QKeyEvent* event);
50 virtual void customEvent( QEvent* event);
52 virtual PyInterp_Request* createRequest( const QString& );
54 /** Convenience function */
55 inline int promptSize() const { return myPrompt.size(); }
57 PyConsole_Interp* myInterp; //!< python interpreter
59 QString myCommandBuffer; //!< python command buffer
60 QString myCurrentCommand; //!< currently being printed command
61 QString myPrompt; //!< current command line prompt
62 int myCmdInHistory; //!< current history command index
63 QStringList myHistory; //!< commands history buffer
64 QEventLoop* myEventLoop; //!< internal event loop
65 QString myBanner; //!< current banner
66 bool myShowBanner; //!< 'show banner' flag
67 QStringList myQueue; //!< python commands queue
68 bool myIsSync; //!< synchronous mode flag
69 bool myIsSuppressOutput; //!< suppress output flag
72 #endif // PYCONSOLE_EDITOR_H