The script command class This is a special type of command class. More...
#include <Command.h>
Public Member Functions | |
const char * | className () const |
The C++ class name is needed as context for the translation framework. | |
const char * | getScriptName () const |
Returns the script name. | |
void | languageChange () |
Ignore when language has changed. | |
MacroCommand (const char *name) | |
virtual | ~MacroCommand () |
Methods to set the properties of the Script Command | |
void | setScriptName (const char *) |
Sets the script name. | |
Static Public Member Functions | |
Methods to load and save macro commands. | |
static void | load () |
Loads all macros command from the preferences. | |
static void | save () |
Saves all macros command to the preferences. | |
Protected Member Functions | |
methods reimplemented for Command Framework | |
void | activated (int iMsg) |
Method which get called when activated. | |
Action * | createAction (void) |
Creates the used Action. | |
Protected Attributes | |
const char * | sScriptName |
The script command class This is a special type of command class.
Its used to bind a macro or Python script to the FreeCAD command framework. An object of this class gets a string to the place where the script is in the file system. Unlike the other commands the resources can be set by several methods.
Definition at line 362 of file Command.h.
MacroCommand::MacroCommand | ( | const char * | name | ) |
Definition at line 598 of file Gui/Command.cpp.
Referenced by load().
virtual Gui::MacroCommand::~MacroCommand | ( | ) | [inline, virtual] |
void MacroCommand::activated | ( | int | iMsg | ) | [protected, virtual] |
Method which get called when activated.
Implements Gui::Command.
Definition at line 608 of file Gui/Command.cpp.
References Gui::MacroManager::File, App::GetApplication(), Gui::Application::getDocument(), App::Application::GetParameterGroupByPath(), App::Application::getUserAppDataDir(), Gui::Application::Instance, Gui::Application::macroManager(), Gui::MacroManager::run(), and sScriptName.
const char* Gui::MacroCommand::className | ( | ) | const [inline, virtual] |
The C++ class name is needed as context for the translation framework.
Implements Gui::CommandBase.
Action * MacroCommand::createAction | ( | void | ) | [protected, virtual] |
Creates the used Action.
Reimplemented from Gui::Command.
Definition at line 622 of file Gui/Command.cpp.
References Gui::BitmapFactory(), Gui::getMainWindow(), Gui::CommandBase::sAccel, Gui::Action::setIcon(), Gui::Action::setShortcut(), Gui::Action::setStatusTip(), Gui::Action::setText(), Gui::Action::setToolTip(), Gui::Action::setWhatsThis(), Gui::CommandBase::sMenuText, Gui::CommandBase::sPixmap, Gui::CommandBase::sStatusTip, Gui::CommandBase::sToolTipText, and Gui::CommandBase::sWhatsThis.
const char* Gui::MacroCommand::getScriptName | ( | ) | const [inline] |
Returns the script name.
Definition at line 379 of file Command.h.
References sScriptName.
Referenced by Gui::Dialog::DlgCustomActionsImp::on_actionListWidget_itemActivated(), and save().
void Gui::MacroCommand::languageChange | ( | ) | [inline, virtual] |
Ignore when language has changed.
Reimplemented from Gui::Command.
void MacroCommand::load | ( | ) | [static] |
Loads all macros command from the preferences.
Definition at line 645 of file Gui/Command.cpp.
References Gui::CommandManager::addCommand(), Gui::Application::commandManager(), App::GetApplication(), App::Application::GetParameterGroupByPath(), Gui::Application::Instance, MacroCommand(), macros::macros, Gui::CommandBase::setAccel(), Gui::CommandBase::setMenuText(), Gui::CommandBase::setPixmap(), setScriptName(), Gui::CommandBase::setStatusTip(), Gui::CommandBase::setToolTipText(), and Gui::CommandBase::setWhatsThis().
Referenced by Gui::Application::Application().
void MacroCommand::save | ( | void | ) | [static] |
Saves all macros command to the preferences.
Definition at line 667 of file Gui/Command.cpp.
References Gui::Application::commandManager(), Gui::CommandBase::getAccel(), App::GetApplication(), Gui::CommandManager::getGroupCommands(), Gui::CommandBase::getMenuText(), Gui::Command::getName(), App::Application::GetParameterGroupByPath(), Gui::CommandBase::getPixmap(), getScriptName(), Gui::CommandBase::getStatusTip(), Gui::CommandBase::getToolTipText(), Gui::CommandBase::getWhatsThis(), Gui::Application::Instance, and macros::macros.
void MacroCommand::setScriptName | ( | const char * | s | ) |
Sets the script name.
Definition at line 636 of file Gui/Command.cpp.
References sScriptName.
Referenced by load(), Gui::Dialog::DlgCustomActionsImp::on_buttonAddAction_clicked(), and Gui::Dialog::DlgCustomActionsImp::on_buttonReplaceAction_clicked().
const char* Gui::MacroCommand::sScriptName [protected] |
Definition at line 400 of file Command.h.
Referenced by activated(), getScriptName(), and setScriptName().