diff --git a/doc/Doxyfile.extra.in b/doc/Doxyfile.extra.in index b0c1b6c220c506b717de3c0063c788366bb2e084..190ce9d63e240c98d5884d17b03c0b98d93bd335 100644 --- a/doc/Doxyfile.extra.in +++ b/doc/Doxyfile.extra.in @@ -7,3 +7,5 @@ INPUT = @CMAKE_SOURCE_DIR@/include \ TAGFILES = @GEPETTO_VIEWER_DOXYGENDOCDIR@/gepetto-viewer.doxytag=@GEPETTO_VIEWER_DOXYGENDOCDIR@ GENERATE_TREEVIEW = NO + +EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/ diff --git a/include/gepetto/gui/mainwindow.hh b/include/gepetto/gui/mainwindow.hh index 3ea06c6403c4cb80dd930bf01dd0bfd572adf811..c8a806f6bb6b63f3762ea9606f1279bc8a917eb0 100644 --- a/include/gepetto/gui/mainwindow.hh +++ b/include/gepetto/gui/mainwindow.hh @@ -65,6 +65,7 @@ namespace gepetto { signals: void sendToBackground (WorkItem* item); void createView (QString name); + /// Triggered when an OSGWidget is created. void viewCreated (OSGWidget* widget); void refresh (); void applyCurrentConfiguration(); diff --git a/include/gepetto/gui/pythonwidget.hh b/include/gepetto/gui/pythonwidget.hh index 03e4de5c53e15875d65df755dfd3b3dbd9850ce6..0691f5843f3ee38248bd439c557e08f3ecda5036 100644 --- a/include/gepetto/gui/pythonwidget.hh +++ b/include/gepetto/gui/pythonwidget.hh @@ -17,6 +17,37 @@ namespace gepetto { namespace gui { + /// \defgroup plugin Plugin interfaces + + + /// \ingroup plugin + /// 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 \code gepetto.gui=true \endcode in your + /// configuration file, then the Plugin class will be accessed via: + /// + /// \code{py} + /// from gepetto.gui import Plugin + /// pluginInstance = Plugin(mainWindow) + /// \endcode + /// + /// It may interact with the interface in two following ways. + /// + /// pyplugin_dockwidget Add a dock widget: + /// + /// 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. + /// + /// pyplugin_signals Signals and slots: + /// + /// The following method will be automatically connected to Qt signals: + /// \li MainWindow::viewCreated(OSGWidget*) -> Plugin.osgWidget + /// + /// \sa See example \ref pyplugins/gepetto/gui/pythonwidget.py class PythonWidget : public QDockWidget { Q_OBJECT @@ -30,7 +61,7 @@ namespace gepetto { /// /// This is mostly equivalent to running the following code in the Python /// console - /// \code[py] + /// \code{py} /// import modulename /// pluginInstance = modulename.Plugin(mainWindow) /// mainWindow.addDockWidget (1, pluginInstance) @@ -57,6 +88,11 @@ namespace gepetto { public slots: void browseFile(); }; + + /// \example pyplugins/gepetto/gui/pythonwidget.py + /// This is an example Python Plugin for \link hpp::gui::PythonWidget \endlink. Two classes are defined: + /// \b _NodeCreator and \b Plugin. Two signals are used: \a mainWindow.refresh() + /// and \a osgWidget. } // namespace gui } // namespace gepetto diff --git a/include/gepetto/gui/settings.hh b/include/gepetto/gui/settings.hh index 80157977eaf32474e60132d466a433117df12885..cc8c46e8f8dc289fee80e18c7bdaf7cce1f98f78 100644 --- a/include/gepetto/gui/settings.hh +++ b/include/gepetto/gui/settings.hh @@ -12,6 +12,12 @@ namespace gepetto { namespace gui { class MainWindow; + /// Settings manager for the interface. + /// + /// This struct is responsible for parsing configuration files as follow: + /// - Robots file: Settings::readRobotFile() + /// - Environments file: Settings::readEnvFile() + /// - Configuration file: Settings::readSettingFile() struct Settings { std::string configurationFile; std::string predifinedRobotConf; @@ -52,11 +58,33 @@ namespace gepetto { std::ostream& print (std::ostream& os); - private: + /// \note Prefer using Settings::fromFiles() void readRobotFile (); + /// \note Prefer using Settings::fromFiles() void readEnvFile (); + /// Read the settings file. + /// + /// Here is the syntax: + /// \code + /// ; Comments starts with a ; You may uncomment to see the effect. + /// + /// [plugins] + /// ; Put a list of C++ plugins followed by '=true'. For instance, HPP users may have + /// ; libhppwidgetsplugin.so=true + /// ; libhppcorbaserverplugin.so=true + /// + /// [pyplugins] + /// ; Put a list of Python plugins followed by '=true'. For instance, the example plugin can be loaded with + /// ; gepetto.plugin=true + /// + /// ; WARNING: Any comment in this file may be removed by the GUI if you regenerate a configuration file. + /// \endcode + /// \note Details on plugin interface can be found in PluginInterface, resp. PythonWidget, class + /// for C++, resp. Python, plugins. + /// \note Prefer using Settings::fromFiles() void readSettingFile (); + private: void writeRobotFile (); void writeEnvFile (); void writeSettingFile (); diff --git a/pyplugins/CMakeLists.txt b/pyplugins/CMakeLists.txt index 786e23906b0be9b296b2e4c89926f3c37fbff0fe..d1404b0dd7652dad563ec29b9f15c2ad4eda1dfc 100644 --- a/pyplugins/CMakeLists.txt +++ b/pyplugins/CMakeLists.txt @@ -17,7 +17,7 @@ INSTALL( FILES - ${CMAKE_CURRENT_SOURCE_DIR}/gepetto/gui/plugin.py + ${CMAKE_CURRENT_SOURCE_DIR}/gepetto/gui/pythonwidget.py ${CMAKE_CURRENT_SOURCE_DIR}/gepetto/gui/__init__.py DESTINATION ${PYTHON_SITELIB}/gepetto/gui ) diff --git a/pyplugins/gepetto/gui/__init__.py b/pyplugins/gepetto/gui/__init__.py index 1cdff06c07c862726665369ec57ae886979e7c5e..2854c2e441010d67b3645c2220bb0fb6d3756530 100644 --- a/pyplugins/gepetto/gui/__init__.py +++ b/pyplugins/gepetto/gui/__init__.py @@ -1 +1 @@ -from plugin import Plugin +from pythonwidget import Plugin diff --git a/pyplugins/gepetto/gui/plugin.py b/pyplugins/gepetto/gui/pythonwidget.py similarity index 96% rename from pyplugins/gepetto/gui/plugin.py rename to pyplugins/gepetto/gui/pythonwidget.py index a6c362d7e535ad9eb71f042639dd3e0663451bb8..e7d12648f2773866a1ac9f939d6204d22e8d5659 100644 --- a/pyplugins/gepetto/gui/plugin.py +++ b/pyplugins/gepetto/gui/pythonwidget.py @@ -58,7 +58,10 @@ class _NodeCreator (QtGui.QWidget): self.client.gui.addToGroup(str(self.nodeName.text), str(self.groupNodes.currentText)) class Plugin(QtGui.QDockWidget): - """ Example of plugin of the Gepetto Viewer GUI """ + """ + Example of plugin of the Gepetto Viewer GUI. This can interact with + PythonWidget C++ class. + """ def __init__ (self, mainWindow, flags = None): if flags is None: super(Plugin, self).__init__ ("Gepetto Viewer plugin", mainWindow)