Gui::Dialog::DlgMacroExecuteImp Class Reference

The DlgMacroExecuteImp class implements a dialog to execute or edit a recorded macro. More...

#include <DlgMacroExecuteImp.h>

Public Slots

void on_addonsButton_clicked ()
 convenience link button to open tools -> addon manager from within macro dialog More...
 
void on_createButton_clicked ()
 Creates a new macro file. More...
 
void on_deleteButton_clicked ()
 Deletes the selected macro file from your harddisc. More...
 
void on_duplicateButton_clicked ()
 Duplicates selected macro New file has same name as original but with "@" and 3-digit number appended Begins with "@001" and increments until available name is found "MyMacro.FCMacro" becomes "MyMacro@001.FCMacro" "MyMacro@002.FCMacro.py" becomes "MyMacro@003.FCMacro.py" unless there is no already existing "MyMacro@001.FCMacro.py". More...
 
void on_editButton_clicked ()
 Opens the macro file in an editor. More...
 
void on_fileChooser_fileNameChanged (const QString &)
 Specify the location of your macro files. More...
 
void on_renameButton_clicked ()
 renames the selected macro More...
 
void on_toolbarButton_clicked ()
 Walk user through process of adding macro to global custom toolbar We create a custom customize dialog with instructions embedded within the dialog itself for the user, and the buttons to push in red text There are 2 dialogs we need to create: the macros dialog and the toolbar dialog. More...
 

Public Member Functions

void accept ()
 Executes the selected macro file. More...
 
 DlgMacroExecuteImp (QWidget *parent=nullptr, Qt::WindowFlags fl=Qt::WindowFlags())
 Constructs a DlgMacroExecuteImp which is a child of 'parent', with the name 'name' and widget flags set to 'f'. More...
 
 ~DlgMacroExecuteImp ()
 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 Slots

void on_systemMacroListBox_currentItemChanged (QTreeWidgetItem *)
 
void on_tabMacroWidget_currentChanged (int index)
 
void on_userMacroListBox_currentItemChanged (QTreeWidgetItem *)
 Selects a macro file in the list view. More...
 

Protected Member Functions

void fillUpList (void)
 Fills up the list with all macro files found in the specified location. More...
 

Protected Attributes

QString macroPath
 

Additional Inherited Members

- Static Public Member Functions inherited from Gui::WindowParameter
static ParameterGrp::handle getDefaultParameter (void)
 get the parameters More...
 

Detailed Description

The DlgMacroExecuteImp class implements a dialog to execute or edit a recorded macro.

Author
Jürgen Riegel

Constructor & Destructor Documentation

◆ DlgMacroExecuteImp()

DlgMacroExecuteImp::DlgMacroExecuteImp ( QWidget parent = nullptr,
Qt::WindowFlags  fl = Qt::WindowFlags() 
)

Constructs a DlgMacroExecuteImp which is a child of 'parent', with the name 'name' and widget flags set to 'f'.

The dialog will by default be modeless, unless you set 'modal' to true to construct a modal dialog.

References fillUpList(), ParameterGrp::GetASCII(), App::Application::getUserMacroDir(), Gui::WindowParameter::getWindowParameter(), and macroPath.

◆ ~DlgMacroExecuteImp()

DlgMacroExecuteImp::~DlgMacroExecuteImp ( )

Destroys the object and frees any allocated resources.

Member Function Documentation

◆ accept()

◆ fillUpList()

void DlgMacroExecuteImp::fillUpList ( void  )
protected

Fills up the list with all macro files found in the specified location.

References App::Application::getHomePath(), and macroPath.

Referenced by DlgMacroExecuteImp(), on_addonsButton_clicked(), on_duplicateButton_clicked(), and on_fileChooser_fileNameChanged().

◆ on_addonsButton_clicked

void DlgMacroExecuteImp::on_addonsButton_clicked ( )
slot

convenience link button to open tools -> addon manager from within macro dialog

References Gui::Application::commandManager(), fillUpList(), Gui::Application::Instance, and Gui::CommandManager::runCommandByName().

◆ on_createButton_clicked

◆ on_deleteButton_clicked

void DlgMacroExecuteImp::on_deleteButton_clicked ( )
slot

Deletes the selected macro file from your harddisc.

References macroPath, and Gui::Dialog::MacroItem::systemWide.

◆ on_duplicateButton_clicked

void DlgMacroExecuteImp::on_duplicateButton_clicked ( )
slot

Duplicates selected macro New file has same name as original but with "@" and 3-digit number appended Begins with "@001" and increments until available name is found "MyMacro.FCMacro" becomes "MyMacro@001.FCMacro" "MyMacro@002.FCMacro.py" becomes "MyMacro@003.FCMacro.py" unless there is no already existing "MyMacro@001.FCMacro.py".

References fillUpList(), App::GetApplication(), ParameterGrp::GetBool(), App::Application::GetParameterGroupByPath(), draftfunctions.svgtext::getText(), macroPath, and ParameterGrp::SetBool().

◆ on_editButton_clicked

◆ on_fileChooser_fileNameChanged

void DlgMacroExecuteImp::on_fileChooser_fileNameChanged ( const QString &  fn)
slot

Specify the location of your macro files.

The default location is FreeCAD's home path.

References fillUpList(), Gui::WindowParameter::getWindowParameter(), macroPath, and ParameterGrp::SetASCII().

◆ on_renameButton_clicked

void DlgMacroExecuteImp::on_renameButton_clicked ( )
slot

◆ on_systemMacroListBox_currentItemChanged

void DlgMacroExecuteImp::on_systemMacroListBox_currentItemChanged ( QTreeWidgetItem item)
protectedslot

◆ on_tabMacroWidget_currentChanged

void DlgMacroExecuteImp::on_tabMacroWidget_currentChanged ( int  index)
protectedslot

◆ on_toolbarButton_clicked

void DlgMacroExecuteImp::on_toolbarButton_clicked ( )
slot

Walk user through process of adding macro to global custom toolbar We create a custom customize dialog with instructions embedded within the dialog itself for the user, and the buttons to push in red text There are 2 dialogs we need to create: the macros dialog and the toolbar dialog.

advise user of what we are doing, offer chance to cancel unless user already said not to show this messagebox again

check if user already has custom toolbar, so we can tailor instructions accordingly

check if user already has this macro command created, if so skip dialog 1

first the custom macros page dialog

title is normally "Customize"

normally the groupbox title is "Setup Custom Macros", but we change it here

now for the toolbar selection dialog

tailor instructions depending on whether user already has custom toolbar created if not, they need to click New button to create one first

find the Global workbench and select it for the user

"label" normally says "Note: the changes become active the next time you load the appropriate workbench"

find Macros category and select it for the user

expand custom toolbar items

preselect macro command for user

References Gui::Application::commandManager(), Base::Console(), App::GetApplication(), ParameterGrp::GetBool(), Gui::CommandManager::getGroupCommands(), Gui::CommandBase::getMenuText(), App::Application::GetParameterGroupByPath(), Gui::MacroCommand::getScriptName(), Gui::Application::Instance, ParameterGrp::SetBool(), and Base::ConsoleSingleton::Warning().

◆ on_userMacroListBox_currentItemChanged

void DlgMacroExecuteImp::on_userMacroListBox_currentItemChanged ( QTreeWidgetItem item)
protectedslot

Selects a macro file in the list view.

Member Data Documentation

◆ macroPath


The documentation for this class was generated from the following files: