#include <pqPythonScriptEditor.h>
Inherits QMainWindow.
Public Member Functions | |
pqPythonScriptEditor (QWidget *parent=nullptr) | |
void | setSaveDialogDefaultDirectory (const QString &dir) |
Sets the default save directory for the current buffer Internally, it is only used for the QFileDialog directory argument when saving or loading a file (ie the folder from which the QFileDialog is launched). More... | |
void | setPythonManager (pqPythonManager *manager) |
Sets the pqPythonManager used for the macros. More... | |
void | scrollToBottom () |
Scroll the editor to the bottom of the scroll area. More... | |
void | open (const QString &filename) |
Open a file inside the editor. More... | |
void | load (const QString &filename) |
Open the given file into the current tab. More... | |
void | updateTrace (const QString &str) |
Updates the trace tab text and creates a new one if it doesn't exists. More... | |
void | stopTrace (const QString &str) |
Wraps up the trace tab. More... | |
void | runCurrentTab () |
Run the code inside the current tab. More... | |
Static Public Member Functions | |
static pqPythonScriptEditor * | getUniqueInstance () |
Utility function that provides a single instance of the editor. More... | |
static void | updateMacroList () |
Triggers an macro list update if the PythonManager exists. More... | |
static void | updateScriptList () |
Triggers the script list update. More... | |
static void | linkTo (QTextEdit *obj) |
Link the input QTextEdit to one of the tab of the editor. More... | |
static void | bringFront () |
Opens and bring the editor in front of other windows. More... | |
static QString | getMacrosDir () |
Returns the macro directory. More... | |
static QString | getScriptsDir () |
Returns the script directory. More... | |
Protected Member Functions | |
void | closeEvent (QCloseEvent *event) override |
Override the QMainWindow closeEvent We ask the user wants to save the current file if it's not already saved. More... | |
This widget can be used as a embedded Qt python editor inside paraview. It provides functionality to read, write and edit python script and paraview macros within paraview itself. The text editor provides basic functionality such as undo/redo, line numbering and syntax highlighting (through pygments).
You can either use this widget as a sole editor, or get the paraview static one from GetUniqueInstance (which gives you the editor used for the macro and the scripts).
Note that GetUniqueInstance is a lazy way of having a unique instance of the editor ready to be used. A better approach would be to actually change the code that uses this class to reflect that peculiar behavior (and not embed it inside the class). Also note that you can freely instantiate as many editor as you want as two instances of this class don't share any common data.
Definition at line 40 of file pqPythonScriptEditor.h.
|
explicit |
void pqPythonScriptEditor::setSaveDialogDefaultDirectory | ( | const QString & | dir | ) |
Sets the default save directory for the current buffer Internally, it is only used for the QFileDialog directory argument when saving or loading a file (ie the folder from which the QFileDialog is launched).
void pqPythonScriptEditor::setPythonManager | ( | pqPythonManager * | manager | ) |
Sets the pqPythonManager used for the macros.
void pqPythonScriptEditor::scrollToBottom | ( | ) |
Scroll the editor to the bottom of the scroll area.
void pqPythonScriptEditor::open | ( | const QString & | filename | ) |
Open a file inside the editor.
void pqPythonScriptEditor::load | ( | const QString & | filename | ) |
Open the given file into the current tab.
void pqPythonScriptEditor::updateTrace | ( | const QString & | str | ) |
Updates the trace tab text and creates a new one if it doesn't exists.
void pqPythonScriptEditor::stopTrace | ( | const QString & | str | ) |
Wraps up the trace tab.
void pqPythonScriptEditor::runCurrentTab | ( | ) |
Run the code inside the current tab.
|
static |
Utility function that provides a single instance of the editor.
|
static |
Triggers an macro list update if the PythonManager exists.
|
static |
Triggers the script list update.
|
static |
Link the input QTextEdit to one of the tab of the editor.
If this objects is already linked within the editor, switch to that tab otherwise creates a new one
|
static |
Opens and bring the editor in front of other windows.
|
static |
Returns the macro directory.
|
static |
Returns the script directory.
|
overrideprotected |
Override the QMainWindow closeEvent We ask the user wants to save the current file if it's not already saved.