The Python command class This is a special type of command class. More...
#include <Command.h>
Public Member Functions | |
| PythonCommand (const char *name, PyObject *pcPyCommand, const char *pActivationString) | |
| virtual | ~PythonCommand () |
Methods to get the properties of the command | |
| const char * | className () const |
| The C++ class name is needed as context for the translation framework. | |
| const char * | getAccel () const |
| const char * | getMenuText () const |
| const char * | getPixmap () const |
| const char * | getStatusTip () const |
| const char * | getToolTipText () const |
| const char * | getWhatsThis () const |
| void | languageChange () |
| Reassigns QAction stuff after the language has changed. | |
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 Action * | createAction (void) |
| Creates the used Action. | |
| const char * | getHelpUrl (void) |
| Get the help URL. | |
| virtual bool | isActive (void) |
| if the command is not always active | |
Protected Attributes | |
| PyObject * | _pcPyCommand |
| a pointer to the Python command object | |
| PyObject * | _pcPyResourceDict |
| the command object resource dictionary | |
| std::string | Activation |
| the activation sequence | |
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.
Definition at line 307 of file Command.h.
| PythonCommand::PythonCommand | ( | const char * | name, | |
| PyObject * | pcPyCommand, | |||
| const char * | pActivationString | |||
| ) |
Definition at line 692 of file Gui/Command.cpp.
References _pcPyCommand, _pcPyResourceDict, Activation, Base::Interpreter(), and Gui::Command::sGroup.
| virtual Gui::PythonCommand::~PythonCommand | ( | ) | [inline, virtual] |
| void PythonCommand::activated | ( | int | iMsg | ) | [protected, virtual] |
Method which gets called when activated.
Implements Gui::Command.
Definition at line 723 of file Gui/Command.cpp.
References _pcPyCommand, Activation, Base::Console(), Gui::Command::Doc, Gui::Command::doCommand(), Base::PyException::getStackTrace(), Base::Interpreter(), Gui::Command::sName, and Base::Exception::what().
| const char* Gui::PythonCommand::className | ( | ) | const [inline, virtual] |
The C++ class name is needed as context for the translation framework.
Implements Gui::CommandBase.
| Action * PythonCommand::createAction | ( | void | ) | [protected, virtual] |
Creates the used Action.
Reimplemented from Gui::Command.
Definition at line 788 of file Gui/Command.cpp.
References Gui::BitmapFactory(), getAccel(), Gui::getMainWindow(), getMenuText(), Gui::Command::getName(), getResource(), getStatusTip(), getToolTipText(), getWhatsThis(), Gui::BitmapFactoryInst::pixmap(), Gui::Action::setIcon(), Gui::Action::setShortcut(), Gui::Action::setStatusTip(), Gui::Action::setText(), Gui::Action::setToolTip(), Gui::Action::setWhatsThis(), and Gui::Action::statusTip().
| const char * PythonCommand::getAccel | ( | ) | const [virtual] |
Reimplemented from Gui::CommandBase.
Definition at line 835 of file Gui/Command.cpp.
References getResource().
Referenced by createAction().
| const char * PythonCommand::getHelpUrl | ( | void | ) | [protected] |
Get the help URL.
Definition at line 777 of file Gui/Command.cpp.
References _pcPyCommand, and Base::Interpreter().
| const char * PythonCommand::getMenuText | ( | ) | const [virtual] |
Reimplemented from Gui::CommandBase.
Definition at line 815 of file Gui/Command.cpp.
References getResource().
Referenced by createAction(), and languageChange().
| const char * PythonCommand::getPixmap | ( | ) | const [virtual] |
Reimplemented from Gui::CommandBase.
Definition at line 830 of file Gui/Command.cpp.
References getResource().
| const char * PythonCommand::getResource | ( | const char * | sName | ) | const [protected] |
Returns the resource values.
Definition at line 709 of file Gui/Command.cpp.
References _pcPyResourceDict.
Referenced by createAction(), getAccel(), getMenuText(), getPixmap(), getStatusTip(), getToolTipText(), and getWhatsThis().
| const char * PythonCommand::getStatusTip | ( | ) | const [virtual] |
Reimplemented from Gui::CommandBase.
Definition at line 825 of file Gui/Command.cpp.
References getResource().
Referenced by createAction(), and languageChange().
| const char * PythonCommand::getToolTipText | ( | ) | const [virtual] |
Reimplemented from Gui::CommandBase.
Definition at line 820 of file Gui/Command.cpp.
References getResource().
Referenced by createAction(), and languageChange().
| const char * PythonCommand::getWhatsThis | ( | ) | const [virtual] |
Reimplemented from Gui::CommandBase.
Definition at line 807 of file Gui/Command.cpp.
References Gui::Command::getName(), and getResource().
Referenced by createAction(), and languageChange().
| bool PythonCommand::isActive | ( | void | ) | [protected, virtual] |
if the command is not always active
Reimplemented from Gui::Command.
Definition at line 742 of file Gui/Command.cpp.
References _pcPyCommand, Py::Exception::clear(), macros::cmd, Py::Object::getAttr(), Py::Object::hasAttr(), and Py::Object::ptr().
| void PythonCommand::languageChange | ( | ) | [virtual] |
Reassigns QAction stuff after the language has changed.
Reimplemented from Gui::Command.
Definition at line 765 of file Gui/Command.cpp.
References Gui::CommandBase::_pcAction, getMenuText(), Gui::Command::getName(), getStatusTip(), getToolTipText(), getWhatsThis(), Gui::Action::setStatusTip(), Gui::Action::setText(), Gui::Action::setToolTip(), Gui::Action::setWhatsThis(), and Gui::Action::statusTip().
PyObject* Gui::PythonCommand::_pcPyCommand [protected] |
a pointer to the Python command object
Definition at line 345 of file Command.h.
Referenced by activated(), getHelpUrl(), isActive(), and PythonCommand().
PyObject* Gui::PythonCommand::_pcPyResourceDict [protected] |
the command object resource dictionary
Definition at line 347 of file Command.h.
Referenced by getResource(), and PythonCommand().
std::string Gui::PythonCommand::Activation [protected] |
the activation sequence
Definition at line 349 of file Command.h.
Referenced by activated(), and PythonCommand().
1.6.1