#include <PythonConsole.h>
Public Slots | |
void | onCopyCommand () |
Copy the selected commands into the clipboard. | |
void | onCopyHistory () |
Copy the history of the console into the clipboard. | |
void | onInsertFileName () |
void | onSaveHistoryAs () |
Public Member Functions | |
void | OnChange (Base::Subject< const char * > &rCaller, const char *rcReason) |
Set new font and colors according to the paramerts. | |
void | printStatement (const QString &cmd) |
Prints the Python statement cmd to the console. | |
PythonConsole (QWidget *parent=0) | |
Constructs a PythonConsole which is a child of 'parent'. | |
~PythonConsole () | |
Destroys the object and frees any allocated resources. | |
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. | |
QMimeData * | createMimeDataFromSelection () const |
void | dragEnterEvent (QDragEnterEvent *e) |
Dragging of action objects is allowed. | |
void | dragMoveEvent (QDragMoveEvent *e) |
Dragging of action objects is allowed. | |
void | dropEvent (QDropEvent *e) |
Drops the event e and writes the right Python command. | |
void | insertFromMimeData (const QMimeData *source) |
Allow to paste plain text or urls of text files. | |
void | keyPressEvent (QKeyEvent *e) |
Checks the input of the console to make the correct indentations. | |
void | overrideCursor (const QString &txt) |
Overwrites the text of the cursor. | |
void | showEvent (QShowEvent *e) |
Shows the Python window and sets the focus to set text cursor. | |
Friends | |
class | PythonStderr |
class | PythonStdout |
Definition at line 91 of file PythonConsole.h.
PythonConsole::PythonConsole | ( | QWidget * | parent = 0 |
) |
Constructs a PythonConsole which is a child of 'parent'.
Definition at line 333 of file PythonConsole.cpp.
References Gui::PythonConsoleP::_stderrPy, Gui::PythonConsoleP::_stdin, Gui::PythonConsoleP::_stdinPy, Gui::PythonConsoleP::_stdoutPy, Gui::PythonConsoleP::callTipsList, Gui::WindowParameter::getWindowParameter(), Gui::PythonConsoleP::interactive, Gui::PythonConsoleP::interpreter, Gui::PythonConsoleP::output, PythonStderr, PythonStdout, and Base::Exception::what().
PythonConsole::~PythonConsole | ( | ) |
Destroys the object and frees any allocated resources.
Definition at line 389 of file PythonConsole.cpp.
References Gui::PythonConsoleP::_stderrPy, Gui::PythonConsoleP::_stdinPy, Gui::PythonConsoleP::_stdoutPy, Gui::WindowParameter::getWindowParameter(), and Gui::PythonConsoleP::interpreter.
bool PythonConsole::canInsertFromMimeData | ( | const QMimeData * | source | ) | const [protected] |
Definition at line 771 of file PythonConsole.cpp.
References Mesh2Shape::ext.
Referenced by contextMenuEvent().
void PythonConsole::changeEvent | ( | QEvent * | e | ) | [protected] |
Definition at line 715 of file PythonConsole.cpp.
References draftlibs::fcgeo::connect().
void PythonConsole::contextMenuEvent | ( | QContextMenuEvent * | e | ) | [protected] |
Pops up the context menu with some extensions.
Definition at line 984 of file PythonConsole.cpp.
References canInsertFromMimeData(), draftlibs::dxfLibrary::copy, Gui::PythonConsoleP::history, Gui::ConsoleHistory::isEmpty(), onCopyCommand(), onCopyHistory(), onInsertFileName(), and onSaveHistoryAs().
QMimeData * PythonConsole::createMimeDataFromSelection | ( | ) | const [protected] |
Definition at line 825 of file PythonConsole.cpp.
References FemExample::b, Gui::PythonConsoleP::Command, Gui::PythonConsoleP::history, Gui::PythonConsoleP::History, Gui::SyntaxHighlighter::maximumUserState(), Gui::PythonConsoleP::Normal, Gui::PythonConsoleP::type, and Gui::ConsoleHistory::values().
Referenced by onCopyHistory().
void PythonConsole::dragEnterEvent | ( | QDragEnterEvent * | e | ) | [protected] |
Dragging of action objects is allowed.
Definition at line 762 of file PythonConsole.cpp.
void PythonConsole::dragMoveEvent | ( | QDragMoveEvent * | e | ) | [protected] |
Dragging of action objects is allowed.
Definition at line 752 of file PythonConsole.cpp.
void PythonConsole::dropEvent | ( | QDropEvent * | e | ) | [protected] |
Drops the event e and writes the right Python command.
Definition at line 730 of file PythonConsole.cpp.
References printStatement().
void PythonConsole::insertFromMimeData | ( | const QMimeData * | source | ) | [protected] |
Allow to paste plain text or urls of text files.
Definition at line 793 of file PythonConsole.cpp.
References Mesh2Shape::ext, and DrawingExample::file.
void PythonConsole::keyPressEvent | ( | QKeyEvent * | e | ) | [protected] |
Checks the input of the console to make the correct indentations.
After a command is prompted completely the Python interpreter is started.
Reimplemented from Gui::TextEdit.
Definition at line 431 of file PythonConsole.cpp.
References Gui::ConsoleHistory::append(), Gui::PythonConsoleP::callTipsList, macros::cmd, Gui::PythonConsoleP::history, Gui::ConsoleHistory::isEmpty(), Gui::ConsoleHistory::next(), overrideCursor(), Gui::ConsoleHistory::prev(), Gui::CallTipsList::showTips(), Gui::CallTipsList::validateCursor(), and Gui::ConsoleHistory::value().
void PythonConsole::OnChange | ( | Base::Subject< const char * > & | rCaller, | |
const char * | sReason | |||
) |
Set new font and colors according to the paramerts.
Reimplemented from Gui::WindowParameter.
Definition at line 402 of file PythonConsole.cpp.
References Gui::PythonConsoleP::colormap, Gui::WindowParameter::getWindowParameter(), and Gui::SyntaxHighlighter::setColor().
void PythonConsole::onCopyCommand | ( | ) | [slot] |
Copy the selected commands into the clipboard.
This is a subset of the history.
Definition at line 1069 of file PythonConsole.cpp.
References Gui::PythonConsoleP::Command, draftlibs::dxfLibrary::copy, Gui::PythonConsoleP::Normal, and Gui::PythonConsoleP::type.
Referenced by contextMenuEvent().
void PythonConsole::onCopyHistory | ( | ) | [slot] |
Copy the history of the console into the clipboard.
Definition at line 1056 of file PythonConsole.cpp.
References createMimeDataFromSelection(), Gui::PythonConsoleP::History, Gui::PythonConsoleP::history, Gui::ConsoleHistory::isEmpty(), Gui::PythonConsoleP::Normal, and Gui::PythonConsoleP::type.
Referenced by contextMenuEvent().
void PythonConsole::onInsertFileName | ( | ) | [slot] |
Definition at line 1045 of file PythonConsole.cpp.
References Gui::getMainWindow(), and Gui::FileDialog::getOpenFileName().
Referenced by contextMenuEvent().
void PythonConsole::onSaveHistoryAs | ( | ) | [slot] |
Definition at line 1024 of file PythonConsole.cpp.
References boost::numeric::bindings::atlas::dot(), SketcherExample::f, Gui::WindowParameter::getDefaultParameter(), Gui::FileDialog::getSaveFileName(), App::Application::getUserAppDataDir(), Gui::PythonConsoleP::history, RobotExample::t, and Gui::ConsoleHistory::values().
Referenced by contextMenuEvent().
void PythonConsole::overrideCursor | ( | const QString & | txt | ) | [protected] |
Overwrites the text of the cursor.
Definition at line 968 of file PythonConsole.cpp.
Referenced by keyPressEvent().
void PythonConsole::printStatement | ( | const QString & | cmd | ) |
Prints the Python statement cmd to the console.
Definition at line 679 of file PythonConsole.cpp.
References Gui::ConsoleHistory::append(), Gui::PythonConsoleP::history, Gui::PythonConsoleP::interactive, and Gui::PythonConsoleP::statements.
Referenced by Gui::MacroManager::addLine(), and dropEvent().
void PythonConsole::showEvent | ( | QShowEvent * | e | ) | [protected] |
Shows the Python window and sets the focus to set text cursor.
Definition at line 702 of file PythonConsole.cpp.
friend class PythonStderr [friend] |
Definition at line 140 of file PythonConsole.h.
Referenced by PythonConsole().
friend class PythonStdout [friend] |
Definition at line 139 of file PythonConsole.h.
Referenced by PythonConsole().