#include <gepetto/gui/pythonwidget.hh>
Public Slots | |
void | loadModulePlugin (QString moduleName) |
void | unloadModulePlugin (QString moduleName) |
void | loadScriptPlugin (QString moduleName, QString fileName) |
void | runScript (QString fileName) |
void | browseFile () |
Public Member Functions | |
PythonWidget (QWidget *parent=0) | |
void | addToContext (QString const &name, QObject *obj) |
virtual | ~PythonWidget () |
QVariantList | callPluginMethod (const QString &method, const QVariantList &args=QVariantList(), const QVariantMap &kwargs=QVariantMap()) const |
void | saveHistory (QSettings &settings) |
void | restoreHistory (QSettings &settings) |
bool | hasPlugin (const QString &name) |
Python plugin interface
A Python plugin is a Python module containing a class Plugin, with a constructor taking a pointer to the MainWindow as input.
For instance, if you have
in your configuration file (Settings::readSettingFile), then the Plugin class will be accessed by the GUI in a way similar to:
Plugin can interact with the interface in following ways.
Your plugin may inherits from class PythonQt.QtGui.QDockWidget
. In this case, an instance of the Plugin will be added to the MainWindow as a QDockWidget
.
The most important signals and slots you should know about are listed here. A more up-to-date list of the available_in_python
The following method will be automatically connected to Qt signals:
Plugin.osgWidget
when a new OSGWidget is created (MainWindow::viewCreated(OSGWidget*)). Plugin.resetConnection
triggered when CORBA connection should be reset. This is mandatory is you have a CORBA Client Plugin.refreshInterface
triggered when users request to refresh the interface.Logging can be done from Python through:
|
explicit |
|
virtual |
void gepetto::gui::PythonWidget::addToContext | ( | QString const & | name, |
QObject * | obj | ||
) |
|
slot |
QVariantList gepetto::gui::PythonWidget::callPluginMethod | ( | const QString & | method, |
const QVariantList & | args = QVariantList() , |
||
const QVariantMap & | kwargs = QVariantMap() |
||
) | const |
Calls a method on each plugin that has it.
bool gepetto::gui::PythonWidget::hasPlugin | ( | const QString & | name | ) |
|
slot |
Load a plugin by importing a module
This is mostly equivalent to running the following code in the Python console
|
slot |
void gepetto::gui::PythonWidget::restoreHistory | ( | QSettings & | settings | ) |
|
slot |
void gepetto::gui::PythonWidget::saveHistory | ( | QSettings & | settings | ) |
|
slot |