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