COOLFluiD
Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
|
The python console send python command to the server in form of python "fragment" the term "fragment" is used to describe a single python statement wich mean one instruction without tabulation (that instruction may have children instruction) Example of python fragment: for i in range(0,5): print i. More...
#include <PythonConsole.hpp>
Inherits PythonCodeContainer.
Classes | |
class | python_command |
used to store the pending command on the command stack More... | |
Public Slots | |
void | execute_code (QString code, bool immediate, QVector< int > break_lines) |
parse and append the code to the console More... | |
void | execute_code (QString code) |
reduiced call, used in signal conversion More... | |
Public Member Functions | |
PythonConsole (QWidget *parent, MainWindow *main_window) | |
Construct a python console. More... | |
void | create_python_area (QWidget *widget) |
called by the parent to create the splitter with the scope values More... | |
bool | is_stopped () |
to check if the console can execute command (like for documentation request) More... | |
const QListWidget * | get_history_list_widget () |
give acces to history_list_widget used in PythonCodeContainer to retrieve history from drag and drop More... | |
int | get_debug_arrow_block () |
return the block number where the debug arrow is, -1 if the execution is not breaked More... | |
void | send_toggle_break_point (int fragment_block, int line_number) |
ask to the script engine to toggle the break point on the given fragment at the given line number More... | |
Public Member Functions inherited from PythonCodeContainer | |
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... | |
Protected Member Functions | |
void | key_press_event (QKeyEvent *) |
called by PythonCodeContainer when the key event is not managed by him More... | |
void | new_line (int indent_number) |
called at each new line More... | |
void | border_click (const QPoint &pos) |
called when the user click on the border area to toggle a break point More... | |
bool | editable_zone (const QTextCursor &cursor) |
called by PythonCodeContainer to know if the zone is editable More... | |
void | insert_text (const QString &text) |
called by PythonCodeContainer when a text need to be inserted More... | |
Protected Member Functions inherited from PythonCodeContainer | |
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... | |
Private Slots | |
void | display_debug_trace (int fragment, int line) |
called by NScriptEngine when the execution is breaked, the debug arrow will be showed at More... | |
void | change_code_fragment (int fragment, int new_fragment) |
change the fragment index with the new one, used in multi-client communication More... | |
void | reset_debug_trace () |
clear the debug arrow More... | |
void | insert_output (QString output, int fragment=-1) |
insert output for a particular fragment More... | |
void | insert_log (const QString &) |
called by the log manager, the log will be shown at the last fragment More... | |
void | line_by_line_activated (bool) |
active the line by line execution, called by the toolbar More... | |
void | stop_continue_pressed () |
if the script engine is executing some this will ask to stop the execution if the script engine where breaked this will continue the execution More... | |
void | break_pressed () |
if the script engine is stopped this will ask to go out of the current fragment, usefull for infinite loop by example More... | |
void | execution_stopped (int fragment, int line) |
void | stream_next_command () |
if they are some commands on the command stack this function will execute then one by one More... | |
void | push_history_to_script_editor () |
append all the history on a new PythonScriptEditor More... | |
void | scope_double_click (const QModelIndex &index) |
when the user double click on the scope this will append the symbole to the PythonConsole More... | |
void | history_double_click (const QModelIndex &index) |
when the user double click on the history this will append the command to the PythonConsole More... | |
void | cursor_position_changed () |
void | append_false_code (QString code) |
append a command on the PythonConsole as if this command where executed but it is just for display purpose , the code is not actually executed More... | |
Private Member Functions | |
void | print_next_prompt () |
display the next prompt after executing the last one More... | |
void | execute_input (QTextCursor &) |
execute the current statement More... | |
void | set_input (const QString &) |
replace the current prompted code with the given text More... | |
void | select_input (QTextCursor &) |
select the current prompted code with the on the given text cursor More... | |
void | fix_prompt () |
correct the block state on the current prompt More... | |
void | add_history_draggable_item (const QString &text) |
add to the history a new entry More... | |
void | register_fragment (QString code, int block_number, QVector< int > break_point) |
Send the python code fragment to the script engine. More... | |
Private Attributes | |
int | fragment_generator |
used to generate the fragment index More... | |
QMap< int, int > | blocks_fragment |
store the fragment number for each block More... | |
QMap< int, int > | fragment_container |
store the block number for each fragment More... | |
int | input_block |
Index of the block that contains the current prompt. More... | |
int | input_start_in_text |
position in character where the last prompt start More... | |
int | debug_arrow |
block number of the debug arrow, -1 for no arrow More... | |
QAction * | line_by_line |
toolbar line by line action More... | |
QAction * | stop_continue |
toolbar stop continue action More... | |
QAction * | break_action |
toolbar break action More... | |
QStringList | history |
store the history, used when up key and down key are pressed More... | |
int | history_index |
store the current history index when using the up and down keys More... | |
QString | tmp_command |
store a temporary command when some code need to be executed and they where some code on the current prompt More... | |
QIcon | icon_stop |
used to change the icon on the stop_continue action More... | |
QIcon | icon_continue |
QQueue< python_command > | command_stack |
store the pending commands More... | |
QVector< int > | temporary_break_points |
store the break points of the input, in order to send them when the execution is asked More... | |
QTimer | auto_execution_timer |
a little weird but it is for avoid cross call when they are pending commands on the command stack More... | |
bool | stopped |
store the state of the execution More... | |
bool | text_being_entered |
... More... | |
MainWindow * | main_window |
used to add a PythonCodeEditor from the PythonConsole More... | |
CustomListWidget * | history_list_widget |
to acces to the history list widget More... | |
Additional Inherited Members | |
Public Types inherited from PythonCodeContainer | |
enum | line_type { PROMPT_1 = 100000, PROMPT_2 = 100001, LINE_NUMBER = 100002 } |
Use to manage userData in a QTextBlock. More... | |
Protected Slots inherited from PythonCodeContainer | |
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 Attributes inherited from PythonCodeContainer | |
int | border_width |
QPoint | offset_border |
QToolBar * | tool_bar |
QVector< int > | break_points |
PythonSyntaxeHighlighter * | highlighter |
Static Protected Attributes inherited from PythonCodeContainer | |
static PythonConsole * | python_console =NULL |
static QStandardItemModel | python_dictionary |
static QTreeView * | python_scope_values =NULL |
The python console send python command to the server in form of python "fragment" the term "fragment" is used to describe a single python statement wich mean one instruction without tabulation (that instruction may have children instruction) Example of python fragment: for i in range(0,5): print i.
Definition at line 47 of file PythonConsole.hpp.
PythonConsole | ( | QWidget * | parent, |
MainWindow * | main_window | ||
) |
Construct a python console.
parent | Parent widget. |
main_window | Used to create a new script editor from the console |
Definition at line 38 of file PythonConsole.cpp.
|
private |
add to the history a new entry
Definition at line 678 of file PythonConsole.cpp.
|
privateslot |
append a command on the PythonConsole as if this command where executed but it is just for display purpose , the code is not actually executed
Definition at line 582 of file PythonConsole.cpp.
|
protectedvirtual |
called when the user click on the border area to toggle a break point
Implements PythonCodeContainer.
Definition at line 337 of file PythonConsole.cpp.
|
privateslot |
if the script engine is stopped this will ask to go out of the current fragment, usefull for infinite loop by example
Definition at line 636 of file PythonConsole.cpp.
|
privateslot |
change the fragment index with the new one, used in multi-client communication
Definition at line 188 of file PythonConsole.cpp.
void create_python_area | ( | QWidget * | widget | ) |
called by the parent to create the splitter with the scope values
Definition at line 91 of file PythonConsole.cpp.
|
privateslot |
Definition at line 118 of file PythonConsole.cpp.
|
privateslot |
called by NScriptEngine when the execution is breaked, the debug arrow will be showed at
Definition at line 153 of file PythonConsole.cpp.
|
protectedvirtual |
called by PythonCodeContainer to know if the zone is editable
Implements PythonCodeContainer.
Definition at line 280 of file PythonConsole.cpp.
|
slot |
parse and append the code to the console
code | The code to execute, can be a single command or a complete script |
immediate | determine if the console must execute immediatly the command or let the user press enter after each commmands |
Definition at line 389 of file PythonConsole.cpp.
|
slot |
reduiced call, used in signal conversion
Definition at line 442 of file PythonConsole.cpp.
|
private |
execute the current statement
Definition at line 365 of file PythonConsole.cpp.
|
privateslot |
Definition at line 645 of file PythonConsole.cpp.
|
private |
correct the block state on the current prompt
Definition at line 298 of file PythonConsole.cpp.
int get_debug_arrow_block | ( | ) |
return the block number where the debug arrow is, -1 if the execution is not breaked
Definition at line 148 of file PythonConsole.cpp.
const QListWidget * get_history_list_widget | ( | ) |
give acces to history_list_widget used in PythonCodeContainer to retrieve history from drag and drop
Definition at line 692 of file PythonConsole.cpp.
|
privateslot |
when the user double click on the history this will append the command to the PythonConsole
Definition at line 686 of file PythonConsole.cpp.
|
privateslot |
called by the log manager, the log will be shown at the last fragment
Definition at line 555 of file PythonConsole.cpp.
|
privateslot |
insert output for a particular fragment
Definition at line 475 of file PythonConsole.cpp.
|
protectedvirtual |
called by PythonCodeContainer when a text need to be inserted
Implements PythonCodeContainer.
Definition at line 286 of file PythonConsole.cpp.
bool is_stopped | ( | ) |
to check if the console can execute command (like for documentation request)
Definition at line 292 of file PythonConsole.cpp.
|
protectedvirtual |
called by PythonCodeContainer when the key event is not managed by him
Implements PythonCodeContainer.
Definition at line 203 of file PythonConsole.cpp.
|
privateslot |
active the line by line execution, called by the toolbar
Definition at line 611 of file PythonConsole.cpp.
|
protectedvirtual |
called at each new line
Reimplemented from PythonCodeContainer.
Definition at line 316 of file PythonConsole.cpp.
|
private |
display the next prompt after executing the last one
|
privateslot |
append all the history on a new PythonScriptEditor
Definition at line 657 of file PythonConsole.cpp.
|
private |
Send the python code fragment to the script engine.
Definition at line 171 of file PythonConsole.cpp.
|
privateslot |
clear the debug arrow
Definition at line 179 of file PythonConsole.cpp.
|
privateslot |
when the user double click on the scope this will append the symbole to the PythonConsole
Definition at line 664 of file PythonConsole.cpp.
|
private |
select the current prompted code with the on the given text cursor
Definition at line 604 of file PythonConsole.cpp.
void send_toggle_break_point | ( | int | fragment_block, |
int | line_number | ||
) |
ask to the script engine to toggle the break point on the given fragment at the given line number
Definition at line 199 of file PythonConsole.cpp.
|
private |
replace the current prompted code with the given text
|
privateslot |
if the script engine is executing some this will ask to stop the execution if the script engine where breaked this will continue the execution
Definition at line 627 of file PythonConsole.cpp.
|
privateslot |
if they are some commands on the command stack this function will execute then one by one
Definition at line 448 of file PythonConsole.cpp.
|
private |
a little weird but it is for avoid cross call when they are pending commands on the command stack
Definition at line 176 of file PythonConsole.hpp.
|
private |
store the fragment number for each block
Definition at line 120 of file PythonConsole.hpp.
|
private |
toolbar break action
Definition at line 162 of file PythonConsole.hpp.
|
private |
store the pending commands
Definition at line 172 of file PythonConsole.hpp.
|
private |
block number of the debug arrow, -1 for no arrow
Definition at line 128 of file PythonConsole.hpp.
|
private |
store the block number for each fragment
Definition at line 122 of file PythonConsole.hpp.
|
private |
used to generate the fragment index
Definition at line 118 of file PythonConsole.hpp.
|
private |
store the history, used when up key and down key are pressed
Definition at line 164 of file PythonConsole.hpp.
|
private |
store the current history index when using the up and down keys
Definition at line 166 of file PythonConsole.hpp.
|
private |
to acces to the history list widget
Definition at line 184 of file PythonConsole.hpp.
|
private |
Definition at line 170 of file PythonConsole.hpp.
|
private |
used to change the icon on the stop_continue action
Definition at line 170 of file PythonConsole.hpp.
|
private |
Index of the block that contains the current prompt.
Definition at line 124 of file PythonConsole.hpp.
|
private |
position in character where the last prompt start
Definition at line 126 of file PythonConsole.hpp.
|
private |
toolbar line by line action
Definition at line 158 of file PythonConsole.hpp.
|
private |
used to add a PythonCodeEditor from the PythonConsole
Definition at line 182 of file PythonConsole.hpp.
|
private |
toolbar stop continue action
Definition at line 160 of file PythonConsole.hpp.
|
private |
store the state of the execution
Definition at line 178 of file PythonConsole.hpp.
|
private |
store the break points of the input, in order to send them when the execution is asked
Definition at line 174 of file PythonConsole.hpp.
|
private |
...
Definition at line 180 of file PythonConsole.hpp.
|
private |
store a temporary command when some code need to be executed and they where some code on the current prompt
Definition at line 168 of file PythonConsole.hpp.
Send comments to: COOLFluiD Web Admin |