Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef PYCONSOLE_EDITOR_H
00028 #define PYCONSOLE_EDITOR_H
00029
00030 #include "PyConsole.h"
00031
00032 #include <QTextEdit>
00033
00034 class PyConsole_Interp;
00035 class PyInterp_Request;
00036 class QEventLoop;
00037
00038 class PYCONSOLE_EXPORT PyConsole_Editor : public QTextEdit
00039 {
00040 Q_OBJECT;
00041
00042 public:
00043 PyConsole_Editor( PyConsole_Interp* theInterp, QWidget *theParent = 0 );
00044 ~PyConsole_Editor();
00045
00046 virtual void addText( const QString& str, const bool newBlock = false );
00047 bool isCommand( const QString& str ) const;
00048
00049 virtual void exec( const QString& command );
00050 void execAndWait( const QString& command );
00051
00052 bool isSync() const;
00053 void setIsSync( const bool );
00054
00055 bool isSuppressOutput() const;
00056 void setIsSuppressOutput(const bool);
00057
00058 bool isShowBanner() const;
00059 void setIsShowBanner( const bool );
00060
00061 virtual QSize sizeHint() const;
00062
00063 protected:
00064 virtual void dropEvent( QDropEvent* event );
00065 virtual void mouseReleaseEvent( QMouseEvent* event );
00066 virtual void keyPressEvent ( QKeyEvent* event);
00067 virtual void customEvent( QEvent* event);
00068
00069 virtual PyInterp_Request* createRequest( const QString& );
00070
00071 public slots:
00072 void cut();
00073 void paste();
00074 void clear();
00075 void handleReturn();
00076 void onPyInterpChanged( PyConsole_Interp* );
00077 void dump();
00078
00079 private:
00080 PyConsole_Interp* myInterp;
00081
00082 QString myCommandBuffer;
00083 QString myCurrentCommand;
00084 QString myPrompt;
00085 int myCmdInHistory;
00086 QStringList myHistory;
00087 QEventLoop* myEventLoop;
00088 QString myBanner;
00089 bool myShowBanner;
00090 QStringList myQueue;
00091 bool myIsSync;
00092 bool myIsSuppressOutput;
00093 };
00094
00095 #endif // PYCONSOLE_EDITOR_H