FreeCAD C++
|
#include <Gui/Command.h>
The Python command class This is a special type of command class. It's used to bind a Python command class into the FreeCAD command framework. An object of this class gets a reference to the Python command object and manages all the passing between the C++ and the Python world. This includes everything like setting resources such as bitmaps, activation or bindings to the user interface.
Public Member Functions | |
Methods to get the properties of the command | |
void | languageChange () |
Reassigns QAction stuff after the language has changed. | |
const char * | className () const |
const char * | getWhatsThis () const |
const char * | getMenuText () const |
const char * | getToolTipText () const |
const char * | getStatusTip () const |
const char * | getPixmap () const |
const char * | getAccel () const |
bool | isCheckable () const |
bool | isChecked () const |
![]() | |
const char * | beginCmdHelp (void) |
returns the begin of a online help page | |
const char * | endCmdHelp (void) |
returns the end of a online help page | |
bool | hasActiveDocument (void) const |
true when there is a document | |
bool | hasObject (const char *Name) |
true when there is a document and a Feature with Name | |
const char * | getAppModuleName (void) const |
returns the name to which the command belongs | |
void | setAppModuleName (const char *) |
const char * | getName () const |
Get the command name. | |
const char * | getGroupName () const |
Get the name of the grouping of the command. | |
void | setGroupName (const char *) |
void | adjustCameraPosition () |
void | testActive (void) |
Get somtile called to check the state of the command. | |
void | setEnabled (bool) |
Enables or disables the command. | |
void | invoke (int) |
get called by the QAction | |
void | addTo (QWidget *) |
adds this command to arbitrary widgets | |
void | addToGroup (ActionGroup *, bool checkable) |
Gui::Document * | getActiveGuiDocument (void) const |
Get pointer to the active gui document. | |
App::Document * | getDocument (const char *Name=0) const |
bool | isViewOfType (Base::Type t) const |
checks if the active view is of a special type or derived | |
App::DocumentObject * | getObject (const char *Name) const |
returns the named feature or the active one from the active document or NULL | |
std::string | getUniqueObjectName (const char *BaseName) const |
Get unique Feature name from the active document. | |
void | updateAction (int mode) |
Updates the QAction with respect to the passed mode. | |
const std::string | strToPython (const char *Str) |
translate a string to a python string literal (needed e.g. in file names for windows...) | |
const std::string | strToPython (const std::string &Str) |
![]() | |
Action * | getAction () const |
void | setWhatsThis (const char *) |
void | setMenuText (const char *) |
void | setToolTipText (const char *) |
void | setStatusTip (const char *) |
void | setPixmap (const char *) |
void | setAccel (const char *) |
Protected Member Functions | |
const char * | getResource (const char *sName) const |
Returns the resource values. | |
Methods reimplemented for Command Framework | |
virtual void | activated (int iMsg) |
Method which gets called when activated. | |
virtual bool | isActive (void) |
if the command is not always active | |
const char * | getHelpUrl (void) const |
Get the help URL. | |
virtual Action * | createAction (void) |
Creates the used Action. | |
![]() | |
void | applyCommandData (const char *context, Action *) |
Applies the menu text, tool and status tip to the passed action object. | |
const char * | keySequenceToAccel (int) const |
![]() |
Protected Attributes | |
PyObject * | _pcPyCommand |
a pointer to the Python command object | |
PyObject * | _pcPyResourceDict |
the command object resource dictionary | |
std::string | Activation |
the activation sequence | |
![]() | |
const char * | sAppModule |
const char * | sGroup |
const char * | sName |
const char * | sHelpUrl |
int | eType |
![]() | |
Action * | _pcAction |
const char * | sMenuText |
const char * | sToolTipText |
const char * | sWhatsThis |
const char * | sStatusTip |
const char * | sPixmap |
const char * | sAccel |
Additional Inherited Members | |
![]() | |
enum | DoCmd_Type { Doc, App, Gui } |
types of application level actions for DoCommand() More... | |
![]() | |
static Application * | getGuiApplication (void) |
Get pointer to the Application Window. | |
static Gui::SelectionSingleton & | getSelection (void) |
Get a reference to the selection. | |
static void | openCommand (const char *sName=0) |
Open a new Undo transaction on the active document. | |
static void | commitCommand (void) |
Commit the Undo transaction on the active document. | |
static void | abortCommand (void) |
Abort the Undo transaction on the active document. | |
static bool | hasPendingCommand (void) |
Check if an Undo transaction is open on the active document. | |
static void | updateActive (void) |
Updates the (active) document (propagate changes) | |
static void | updateAll (std::list< Gui::Document * > cList) |
Updates the (all or listed) documents (propagate changes) | |
static bool | isActiveObjectValid (void) |
Checks if the active object of the active document is valid. | |
static void | blockCommand (bool) |
Blocks all command objects. | |
static void | doCommand (DoCmd_Type eType, const char *sCmd,...) |
Run a App level Action. | |
static void | runCommand (DoCmd_Type eType, const char *sCmd) |
static void | runCommand (DoCmd_Type eType, const QByteArray &sCmd) |
static void | addModule (DoCmd_Type eType, const char *sModuleName) |
import an external (or own) module only once | |
static std::string | assureWorkbench (const char *sName) |
assures the switch to a certain workbench, if already in the workbench, does nothing. | |
static void | copyVisual (const char *to, const char *attr, const char *from) |
static void | copyVisual (const char *to, const char *attr_to, const char *from, const char *attr_from) |
static std::string | getPythonTuple (const std::string &name, const std::vector< std::string > &subnames) |
Get Python tuple from object and sub-elements. | |
![]() | |
enum | CmdType { AlterDoc = 1, Alter3DView = 2, AlterSelection = 4, ForEdit = 8 } |