COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Classes | Public Types | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
PythonCodeContainer Class Referenceabstract

This class contains common code for python editors. More...

#include <PythonCodeContainer.hpp>

Inherits QPlainTextEdit.

Inherited by PythonCodeEditor, and PythonConsole.

Classes

class  PythonDict
 

Public Types

enum  line_type { PROMPT_1 = 100000, PROMPT_2 = 100001, LINE_NUMBER = 100002 }
 Use to manage userData in a QTextBlock. More...
 

Public Member Functions

 PythonCodeContainer (QWidget *parent=0)
 constructor More...
 
void repaint_border_area (QPaintEvent *event)
 called by the border area on repaint event, display the line numbers from QTextBlock::userState More...
 
virtual void border_click (const QPoint &pos)=0
 called by the border area on click event More...
 

Protected Slots

void update_border_area (const QRect &, int)
 connected to the scrollbar signal of the code zone, ask to the border area to do a repaint More...
 
void keywords_changed (const QStringList &add, const QStringList &sub)
 
void insert_completion (QString)
 
void request_documentation ()
 
void popup_documentation (const QString &documentation)
 

Protected Member Functions

void toggle_break_point (int fragment_block, int line_number, bool send=true)
 Send a toggle break command to the script engine. More...
 
void keyPressEvent (QKeyEvent *e)
 manage some typing behaviour then call key_press_event to propagate the event to the inherited class More...
 
void resizeEvent (QResizeEvent *e)
 repaint the border area More...
 
void mouseMoveEvent (QMouseEvent *e)
 start a timer when the mouse is on a word, the timer will make a request_documentation for this word More...
 
void leaveEvent (QEvent *)
 stop the documentation timer More...
 
QMimeData * createMimeDataFromSelection () const
 create a mimeData with a preview of the selected text More...
 
bool canInsertFromMimeData (const QMimeData *source) const
 allow to drop text mimeData and QListWidgetItem mimeData More...
 
void insertFromMimeData (const QMimeData *source)
 call insert_text with the extracted mimeData More...
 
virtual void key_press_event (QKeyEvent *e)=0
 call after the the common text More...
 
virtual void new_line (int indent_number)
 allow the console to known when execute a inputed code More...
 
virtual bool editable_zone (const QTextCursor &cursor)=0
 allow the python container to known if the position of the cursor is writable, used for the python console More...
 
virtual void insert_text (const QString &text)=0
 ask a text insertion to the inherited class More...
 

Protected Attributes

int border_width
 
QPoint offset_border
 
QToolBar * tool_bar
 
QVector< int > break_points
 
PythonSyntaxeHighlighterhighlighter
 

Static Protected Attributes

static PythonConsolepython_console =NULL
 
static QStandardItemModel python_dictionary
 
static QTreeView * python_scope_values =NULL
 

Private Member Functions

void add_to_dictionary (int &i, const QStringList &add, CustomStandardItem *item)
 
void remove_dictionary_item (QString name, CustomStandardItem *item)
 
QString get_word_under_cursor (QTextCursor &c)
 

Private Attributes

BorderAreaborder_area
 
QPoint last_mouse_pos
 
QTimer doc_timer
 
QString last_documented_word
 
QString last_documentation
 

Static Private Attributes

static PythonCompletercompleter =NULL
 
static QVector< PythonDictdictionary
 

Detailed Description

This class contains common code for python editors.

Definition at line 45 of file PythonCodeContainer.hpp.

Member Enumeration Documentation

enum line_type

Use to manage userData in a QTextBlock.

Enumerator
PROMPT_1 
PROMPT_2 
LINE_NUMBER 

Definition at line 50 of file PythonCodeContainer.hpp.

Constructor & Destructor Documentation

PythonCodeContainer ( QWidget *  parent = 0)

constructor

Definition at line 50 of file PythonCodeContainer.cpp.

Member Function Documentation

void add_to_dictionary ( int &  i,
const QStringList &  add,
CustomStandardItem item 
)
private

Definition at line 363 of file PythonCodeContainer.cpp.

virtual void border_click ( const QPoint &  pos)
pure virtual

called by the border area on click event

Implemented in PythonConsole, and PythonCodeEditor.

bool canInsertFromMimeData ( const QMimeData *  source) const
protected

allow to drop text mimeData and QListWidgetItem mimeData

Definition at line 302 of file PythonCodeContainer.cpp.

QMimeData * createMimeDataFromSelection ( ) const
protected

create a mimeData with a preview of the selected text

Definition at line 294 of file PythonCodeContainer.cpp.

virtual bool editable_zone ( const QTextCursor &  cursor)
protectedpure virtual

allow the python container to known if the position of the cursor is writable, used for the python console

Implemented in PythonConsole, and PythonCodeEditor.

QString get_word_under_cursor ( QTextCursor &  c)
private

Definition at line 469 of file PythonCodeContainer.cpp.

void insert_completion ( QString  completion)
protectedslot

Definition at line 333 of file PythonCodeContainer.cpp.

virtual void insert_text ( const QString &  text)
protectedpure virtual

ask a text insertion to the inherited class

Implemented in PythonConsole, and PythonCodeEditor.

void insertFromMimeData ( const QMimeData *  source)
protected

call insert_text with the extracted mimeData

Definition at line 310 of file PythonCodeContainer.cpp.

virtual void key_press_event ( QKeyEvent *  e)
protectedpure virtual

call after the the common text

Implemented in PythonConsole, and PythonCodeEditor.

void keyPressEvent ( QKeyEvent *  e)
protected

manage some typing behaviour then call key_press_event to propagate the event to the inherited class

Definition at line 192 of file PythonCodeContainer.cpp.

void keywords_changed ( const QStringList &  add,
const QStringList &  sub 
)
protectedslot

Definition at line 341 of file PythonCodeContainer.cpp.

void leaveEvent ( QEvent *  e)
protected

stop the documentation timer

Definition at line 286 of file PythonCodeContainer.cpp.

void mouseMoveEvent ( QMouseEvent *  e)
protected

start a timer when the mouse is on a word, the timer will make a request_documentation for this word

Definition at line 276 of file PythonCodeContainer.cpp.

virtual void new_line ( int  indent_number)
inlineprotectedvirtual

allow the console to known when execute a inputed code

Reimplemented in PythonConsole, and PythonCodeEditor.

Definition at line 84 of file PythonCodeContainer.hpp.

void popup_documentation ( const QString &  documentation)
protectedslot

Definition at line 459 of file PythonCodeContainer.cpp.

void remove_dictionary_item ( QString  name,
CustomStandardItem item 
)
private

Definition at line 405 of file PythonCodeContainer.cpp.

void repaint_border_area ( QPaintEvent *  event)

called by the border area on repaint event, display the line numbers from QTextBlock::userState

Definition at line 118 of file PythonCodeContainer.cpp.

void request_documentation ( )
protectedslot

Definition at line 437 of file PythonCodeContainer.cpp.

void resizeEvent ( QResizeEvent *  e)
protected

repaint the border area

Definition at line 184 of file PythonCodeContainer.cpp.

void toggle_break_point ( int  fragment_block,
int  line_number,
bool  send = true 
)
protected

Send a toggle break command to the script engine.

Definition at line 166 of file PythonCodeContainer.cpp.

void update_border_area ( const QRect &  rect,
int  dy 
)
protectedslot

connected to the scrollbar signal of the code zone, ask to the border area to do a repaint

Definition at line 108 of file PythonCodeContainer.cpp.

Member Data Documentation

BorderArea* border_area
private

Definition at line 107 of file PythonCodeContainer.hpp.

int border_width
protected

Definition at line 116 of file PythonCodeContainer.hpp.

QVector<int> break_points
protected

Definition at line 122 of file PythonCodeContainer.hpp.

PythonCompleter * completer =NULL
staticprivate

Definition at line 112 of file PythonCodeContainer.hpp.

QVector< PythonCodeContainer::PythonDict > dictionary
staticprivate

Definition at line 113 of file PythonCodeContainer.hpp.

QTimer doc_timer
private

Definition at line 109 of file PythonCodeContainer.hpp.

PythonSyntaxeHighlighter* highlighter
protected

Definition at line 123 of file PythonCodeContainer.hpp.

QString last_documentation
private

Definition at line 111 of file PythonCodeContainer.hpp.

QString last_documented_word
private

Definition at line 110 of file PythonCodeContainer.hpp.

QPoint last_mouse_pos
private

Definition at line 108 of file PythonCodeContainer.hpp.

QPoint offset_border
protected

Definition at line 117 of file PythonCodeContainer.hpp.

PythonConsole * python_console =NULL
staticprotected

Definition at line 119 of file PythonCodeContainer.hpp.

QStandardItemModel python_dictionary
staticprotected

Definition at line 120 of file PythonCodeContainer.hpp.

QTreeView * python_scope_values =NULL
staticprotected

Definition at line 121 of file PythonCodeContainer.hpp.

QToolBar* tool_bar
protected

Definition at line 118 of file PythonCodeContainer.hpp.


The documentation for this class was generated from the following files:
Send comments to:
COOLFluiD Web Admin