Macro recording and play back management The purpos of this class is to handle record function calls from a command and save it in a macro file (so far). More...
#include <Macro.h>
Public Types | |
enum | LineType { App, Gui, Cmt } |
Line type enumeration More... | |
enum | MacroType { File, User, Doc } |
Macro type enumeration More... | |
Public Member Functions | |
void | addLine (LineType Type, const char *sLine, bool pending=false) |
insert a new line in the macro More... | |
void | cancel (void) |
cancels the recording session More... | |
void | commit (void) |
close (and save) the recording session More... | |
PythonDebugger * | debugger () const |
Get the Python debugger. More... | |
long | getLines () const |
Return the added lines regardless of recording or not. More... | |
bool | isOpen (void) const |
indicates if a macro recording in in progress More... | |
void | OnChange (Base::Subject< const char * > &rCaller, const char *sReason) |
Observes its parameter group. More... | |
void | open (MacroType eType, const char *sName) |
Opens a new Macro recording session Starts a session with the type and the name of the macro. More... | |
void | run (MacroType eType, const char *sName) |
void | setModule (const char *sModule) |
Set the active module This is normally done by the workbench switch. More... | |
Public Member Functions inherited from Base::Observer< const char * > | |
virtual const char * | Name (void) |
This method can be reimplemented from the concrete Observer and returns the name of the observer. More... | |
Observer () | |
A constructor. More... | |
virtual void | OnDestroy (Subject< const char * > &rCaller) |
This method need to be reimplemented from the concrete Observer and get called by the observed class. More... | |
virtual | ~Observer () |
A destructor. More... | |
Protected Member Functions | |
MacroManager () | |
~MacroManager () | |
Protected Attributes | |
bool | guiAsComment |
bool | localEnv |
QStringList | macroInProgress |
Container for the macro. More... | |
QString | macroName |
name of the macro More... | |
bool | openMacro |
Base::Reference< ParameterGrp > | params |
std::vector< std::pair< LineType, std::string > > | pendingLine |
PythonConsole * | pyConsole |
PythonDebugger * | pyDebugger |
bool | recordGui |
bool | scriptToPyConsole |
long | totalLines |
Friends | |
struct | ApplicationP |
Detailed Description
Macro recording and play back management The purpos of this class is to handle record function calls from a command and save it in a macro file (so far).
Member Enumeration Documentation
◆ LineType
Line type enumeration
Enumerator | |
---|---|
App | The line effects only the document and Application (FreeCAD) |
Gui | The line effects the Gui (FreeCADGui) |
Cmt | The line is handled as a comment. |
◆ MacroType
Macro type enumeration
Enumerator | |
---|---|
File | The macro will be saved in a file. |
User | The macro belongs to the Application and will be saved in the UserParameter. |
Doc | The macro belongs to the Document and will be saved and restored with the Document. |
Constructor & Destructor Documentation
◆ MacroManager()
|
protected |
◆ ~MacroManager()
|
protected |
References pyDebugger.
Member Function Documentation
◆ addLine()
insert a new line in the macro
References Cmt, Gui::getMainWindow(), guiAsComment, macroInProgress, openMacro, pendingLine, Gui::PythonConsole::printStatement(), pyConsole, recordGui, scriptToPyConsole, and totalLines.
Referenced by StdCmdViewIvIssueCamPos::activated(), Gui::Command::addModule(), PendingLine::cancel(), Gui::SelectionSingleton::clearCompleteSelection(), Gui::SelectionSingleton::clearSelection(), PendingLine::PendingLine(), Gui::Command::printCaller(), Gui::Application::sDoCommand(), and Gui::Application::sDoCommandGui().
◆ cancel()
void MacroManager::cancel | ( | void | ) |
cancels the recording session
References Base::Console(), Base::ConsoleSingleton::Log(), macroInProgress, macroName, and openMacro.
Referenced by commit(), and Gui::Dialog::DlgMacroRecordImp::on_buttonCancel_clicked().
◆ commit()
void MacroManager::commit | ( | void | ) |
close (and save) the recording session
References cancel(), Base::Console(), Base::ConsoleSingleton::Error(), Base::ConsoleSingleton::Log(), macroInProgress, macroName, and openMacro.
Referenced by draftguitools.gui_offset.Offset::action(), draftguitools.gui_ellipses.Ellipse::createObject(), draftguitools.gui_rectangles.Rectangle::createObject(), draftguitools.gui_texts.Text::createObject(), draftguitools.gui_shapestrings.ShapeString::createObject(), draftguitools.gui_dimensions.Dimension::createObject(), draftguitools.gui_dimensions.Dimension::createOnMeasures(), draftguitools.gui_stretch.Stretch::doStretch(), draftguitools.gui_fillets.Fillet::draw_arc(), draftguitools.gui_arcs.Arc::drawArc(), draftguitools.gui_polygons.Polygon::drawPolygon(), draftguitools.gui_lines.Line::finish(), draftguitools.gui_splines.BSpline::finish(), draftguitools.gui_beziers.BezCurve::finish(), draftguitools.gui_beziers.CubicBezCurve::finish(), draftguitools.gui_mirror.Mirror::mirror(), draftguitools.gui_move.Move::move_object(), draftguitools.gui_move.Move::move_subelements(), draftguitools.gui_offset.Offset::numericRadius(), Gui::Dialog::DlgMacroRecordImp::on_buttonStop_clicked(), draftguitools.gui_downgrade.Downgrade::proceed(), draftguitools.gui_draft2sketch.Draft2Sketch::proceed(), draftguitools.gui_upgrade.Upgrade::proceed(), draftguitools.gui_shape2dview.Shape2DView::proceed(), draftguitools.gui_join.Join::proceed(), draftguitools.gui_array_simple.Array::proceed(), draftguitools.gui_split.Split::proceed(), draftguitools.gui_pointarray.PointArray::proceed(), draftguitools.gui_patharray.PathArray::proceed(), draftguitools.gui_rotate.Rotate::rotate_object(), draftguitools.gui_rotate.Rotate::rotate_subelements(), draftguitools.gui_scale.Scale::scale_object(), draftguitools.gui_scale.Scale::scale_subelements(), and draftguitools.gui_scale.Scale::scale_with_clone().
◆ debugger()
PythonDebugger * MacroManager::debugger | ( | ) | const |
Get the Python debugger.
References pyDebugger.
Referenced by StdCmdMacroStartDebug::activated(), StdCmdMacroStopDebug::activated(), StdCmdMacroStepOver::activated(), StdCmdMacroStepInto::activated(), StdCmdMacroStopDebug::isActive(), StdCmdMacroStepOver::isActive(), StdCmdMacroStepInto::isActive(), and Gui::PythonEditorP::PythonEditorP().
◆ getLines()
long Gui::MacroManager::getLines | ( | ) | const |
Return the added lines regardless of recording or not.
◆ isOpen()
bool Gui::MacroManager::isOpen | ( | void | ) | const |
indicates if a macro recording in in progress
Referenced by Gui::Dialog::DlgMacroRecordImp::DlgMacroRecordImp(), Gui::Dialog::DlgMacroRecordImp::on_buttonCancel_clicked(), and Gui::Dialog::DlgMacroRecordImp::on_buttonStop_clicked().
◆ OnChange()
|
virtual |
Observes its parameter group.
Implements Base::Observer< const char * >.
References guiAsComment, localEnv, recordGui, and scriptToPyConsole.
◆ open()
void MacroManager::open | ( | MacroType | eType, |
const char * | sName | ||
) |
Opens a new Macro recording session Starts a session with the type and the name of the macro.
All user interactions will be recorded as long as the commit() or cancel() isn't called. There is only one recording session possible. Trying to open a second one causes an exception:
- Parameters
-
eType Type of the macro sName Name or path of the macro
References Base::Console(), File, Base::ConsoleSingleton::Log(), macroInProgress, macroName, and openMacro.
Referenced by Gui::Dialog::DlgMacroRecordImp::on_buttonStart_clicked().
◆ run()
void MacroManager::run | ( | MacroType | eType, |
const char * | sName | ||
) |
References App::GetApplication(), ParameterGrp::GetBool(), ParameterGrp::GetGroup(), App::Application::GetUserParameter(), Base::Interpreter(), localEnv, and Base::InterpreterSingleton::runFile().
Referenced by Gui::Dialog::DlgMacroExecuteImp::accept(), Gui::MacroCommand::activated(), Gui::PythonEditorView::executeScript(), and femsolver.task.Task::protector().
◆ setModule()
void MacroManager::setModule | ( | const char * | sModule | ) |
Set the active module This is normally done by the workbench switch.
It sets the actually active application module so when the macro gets started the right import can be issued.
References macroInProgress, and openMacro.
Referenced by Gui::Command::invoke().
Friends And Related Function Documentation
◆ ApplicationP
|
friend |
Member Data Documentation
◆ guiAsComment
|
protected |
Referenced by addLine(), and OnChange().
◆ localEnv
|
protected |
Referenced by OnChange(), and run().
◆ macroInProgress
|
protected |
Container for the macro.
Referenced by addLine(), cancel(), commit(), open(), and setModule().
◆ macroName
|
protected |
◆ openMacro
|
protected |
Referenced by addLine(), cancel(), commit(), open(), and setModule().
◆ params
|
protected |
Referenced by PathScripts.post.comparams_post.saveVals::retVals().
◆ pendingLine
|
protected |
Referenced by addLine().
◆ pyConsole
|
protected |
Referenced by addLine().
◆ pyDebugger
|
protected |
Referenced by debugger(), and ~MacroManager().
◆ recordGui
|
protected |
Referenced by addLine(), and OnChange().
◆ scriptToPyConsole
|
protected |
Referenced by addLine(), and OnChange().
◆ totalLines
|
protected |
Referenced by addLine().
The documentation for this class was generated from the following files:
- src/Gui/Macro.h
- src/Gui/Macro.cpp