#include <PythonConsole.h>
Public Types | |
enum | Prompt { Complete = 0 , Incomplete = 1 , Flush = 2 , Special = 3 } |
Public Slots | |
void | onClearConsole () |
void | onCopyCommand () |
Copy the selected commands into the clipboard. More... | |
void | onCopyHistory () |
Copy the history of the console into the clipboard. More... | |
void | onFlush () |
void | onInsertFileName () |
void | onSaveHistoryAs () |
Signals | |
void | pendingSource (void) |
Signals inherited from Gui::TextEdit | |
void | findNext () |
void | findPrevious () |
void | showSearchBar () |
Public Member Functions | |
void | OnChange (Base::Subject< const char * > &rCaller, const char *rcReason) |
Set new font and colors according to the parameters. More... | |
void | printStatement (const QString &cmd) |
Prints the Python statement cmd to the console. More... | |
PythonConsole (QWidget *parent=nullptr) | |
Constructs a PythonConsole which is a child of 'parent'. More... | |
QString | readline (void) |
~PythonConsole () | |
Destroys the object and frees any allocated resources. More... | |
Public Member Functions inherited from Gui::TextEdit | |
TextEdit (QWidget *parent=nullptr) | |
Constructs a TextEdit which is a child of 'parent'. More... | |
virtual | ~TextEdit () |
Destroys the object and frees any allocated resources. More... | |
Public Member Functions inherited from Gui::WindowParameter | |
ParameterGrp::handle | getWindowParameter (void) |
return the parameter group of this window More... | |
void | OnChange (Base::Subject< const char * > &rCaller, const char *sReason) |
bool | setGroupName (const char *name) |
Sets the group of the window to name. More... | |
WindowParameter (const char *name) | |
virtual | ~WindowParameter () |
Protected Member Functions | |
bool | canInsertFromMimeData (const QMimeData *source) const |
void | changeEvent (QEvent *e) |
void | contextMenuEvent (QContextMenuEvent *e) |
Pops up the context menu with some extensions. More... | |
QMimeData * | createMimeDataFromSelection () const |
void | dragEnterEvent (QDragEnterEvent *e) |
Dragging of action objects is allowed. More... | |
void | dragMoveEvent (QDragMoveEvent *e) |
Dragging of action objects is allowed. More... | |
void | dropEvent (QDropEvent *e) |
Drops the event e and writes the right Python command. More... | |
QTextCursor | inputBegin (void) const |
void | insertFromMimeData (const QMimeData *source) |
Allow to paste plain text or urls of text files. More... | |
void | keyPressEvent (QKeyEvent *e) |
Checks the input of the console to make the correct indentations. More... | |
void | mouseReleaseEvent (QMouseEvent *e) |
void | overrideCursor (const QString &txt) |
Overwrites the text of the cursor. More... | |
void | showEvent (QShowEvent *e) |
Shows the Python window and sets the focus to set text cursor. More... | |
Protected Member Functions inherited from Gui::TextEdit | |
void | keyPressEvent (QKeyEvent *) |
Set the approproriate item of the completion box or hide it, if needed. More... | |
Friends | |
class | PythonStderr |
class | PythonStdout |
Additional Inherited Members | |
Static Public Member Functions inherited from Gui::WindowParameter | |
static ParameterGrp::handle | getDefaultParameter (void) |
get the parameters More... | |
PythonConsole::PythonConsole | ( | QWidget * | parent = nullptr | ) |
Constructs a PythonConsole which is a child of 'parent'.
References Base::Subject< _MessageType >::Attach(), Gui::PythonConsoleP::callTipsList, Complete, Gui::WindowParameter::getDefaultParameter(), ParameterGrp::GetGroup(), Gui::WindowParameter::getWindowParameter(), Gui::PythonConsoleP::hGrpSettings, Gui::PythonConsoleP::info, Gui::PythonConsoleP::interactive, Gui::PythonConsoleP::interpreter, ParameterGrp::NotifyAll(), Gui::PythonConsoleP::output, PythonStderr, and PythonStdout.
PythonConsole::~PythonConsole | ( | ) |
Destroys the object and frees any allocated resources.
References Base::Subject< _MessageType >::Detach(), Gui::WindowParameter::getWindowParameter(), Gui::PythonConsoleP::hGrpSettings, and Gui::PythonConsoleP::interpreter.
|
protected |
Referenced by contextMenuEvent().
|
protected |
|
protected |
Pops up the context menu with some extensions.
References canInsertFromMimeData(), Gui::cursorBeyond(), ParameterGrp::GetBool(), Gui::PythonConsoleP::hGrpSettings, Gui::PythonConsoleP::history, inputBegin(), Gui::ConsoleHistory::isEmpty(), onClearConsole(), onCopyCommand(), onCopyHistory(), onInsertFileName(), onSaveHistoryAs(), and ParameterGrp::SetBool().
|
protected |
|
protected |
Dragging of action objects is allowed.
|
protected |
Dragging of action objects is allowed.
|
protected |
Drops the event e and writes the right Python command.
References printStatement().
|
protected |
References Gui::promptLength().
Referenced by contextMenuEvent(), keyPressEvent(), mouseReleaseEvent(), and overrideCursor().
|
protected |
Allow to paste plain text or urls of text files.
|
protected |
Checks the input of the console to make the correct indentations.
After a command is prompted completely the Python interpreter is started.
The cursor is placed not on the input line (or within the prompt string) So we handle key input as follows:
The cursor sits somewhere on the input line (after the prompt) Here we handle key input a bit different:
References Gui::ConsoleHistory::append(), Gui::PythonConsoleP::callTipsList, Complete, Gui::cursorBeyond(), Gui::InteractiveInterpreter::hasPendingInput(), Gui::PythonConsoleP::history, Incomplete, inputBegin(), Gui::PythonConsoleP::interpreter, Gui::TextEdit::keyPressEvent(), Gui::ConsoleHistory::next(), overrideCursor(), Gui::ConsoleHistory::prev(), Gui::ConsoleHistory::restart(), Gui::CallTipsList::showTips(), Gui::stripPromptFrom(), Gui::CallTipsList::validateCursor(), and Gui::ConsoleHistory::value().
|
protected |
References inputBegin().
void PythonConsole::OnChange | ( | Base::Subject< const char * > & | rCaller, |
const char * | rcReason | ||
) |
Set new font and colors according to the parameters.
References Gui::PythonConsoleP::colormap, ParameterGrp::GetBool(), Gui::QtTools::horizontalAdvance(), and Gui::SyntaxHighlighter::setColor().
|
slot |
References Complete, Gui::PythonConsoleP::info, and Gui::PythonConsoleP::output.
Referenced by contextMenuEvent().
|
slot |
Copy the selected commands into the clipboard.
This is a subset of the history.
References Gui::PythonConsoleP::Command, Gui::PythonConsoleP::Normal, and Gui::PythonConsoleP::type.
Referenced by contextMenuEvent().
|
slot |
Copy the history of the console into the clipboard.
References createMimeDataFromSelection(), Gui::PythonConsoleP::History, Gui::PythonConsoleP::history, Gui::ConsoleHistory::isEmpty(), Gui::PythonConsoleP::Normal, and Gui::PythonConsoleP::type.
Referenced by contextMenuEvent().
|
slot |
References Flush.
|
slot |
References Gui::getMainWindow(), and Gui::FileDialog::getOpenFileName().
Referenced by contextMenuEvent().
|
slot |
|
protected |
|
signal |
Referenced by readline().
void PythonConsole::printStatement | ( | const QString & | cmd | ) |
Prints the Python statement cmd to the console.
References Gui::ConsoleHistory::append(), Complete, Gui::PythonConsoleP::history, Gui::PythonConsoleP::interactive, and Gui::PythonConsoleP::statements.
Referenced by Gui::MacroManager::addLine(), and dropEvent().
QString PythonConsole::readline | ( | void | ) |
References draftgeoutils.intersections::connect(), Gui::PythonConsoleP::output, pendingSource(), and Special.
Referenced by Gui::PythonStdin::readline().
|
protected |
Shows the Python window and sets the focus to set text cursor.
|
friend |
Referenced by PythonConsole().
|
friend |
Referenced by PythonConsole().