diff --git a/examples/pyplugin/qcustomplot_example.py b/examples/pyplugin/qcustomplot_example.py index fb4ca9ca08cd2aedb410b97a4ee501c0c37df731..ff412be596a04f103f2f86db66adec86494665da 100644 --- a/examples/pyplugin/qcustomplot_example.py +++ b/examples/pyplugin/qcustomplot_example.py @@ -24,6 +24,7 @@ class Plot (QtGui.QWidget): self.qcp.setInteraction(2, True) # iRangeZoom self.qcp.setAutoAddPlottableToLegend(True) self.qcp.legend().setVisible(True) + self.qcp.connect (Qt.SIGNAL("mouseDoubleClick(QMouseEvent*)"), self.doubleClick) # The timer user refresh the interface self.timer = Qt.QTimer(self) @@ -31,6 +32,11 @@ class Plot (QtGui.QWidget): self.timer.setInterval(100) self.timer.connect(Qt.SIGNAL("timeout()"), self._step) + def doubleClick (self, event): + x = self.qcp.xAxis().pixelToCoord (event.posF().x()) + y = self.qcp.yAxis().pixelToCoord (event.posF().y()) + print("You double-clicked at ({0}, {1})".format(x, y)) + def makeCurves(self): self.qcp.clearGraphs() self.legends = [ "sin", "cos" ] diff --git a/idl/gepetto/viewer/graphical-interface.idl b/idl/gepetto/viewer/graphical-interface.idl index a589289dacc78524eb8c0330e08071c32cd2f030..609856d053572fe7f3ec01e28624320d5950c546 100644 --- a/idl/gepetto/viewer/graphical-interface.idl +++ b/idl/gepetto/viewer/graphical-interface.idl @@ -24,6 +24,7 @@ typedef unsigned long WindowID; typedef sequence <string> Names_t; /// Sequence of names typedef sequence<float> floatSeq; typedef sequence<Position> PositionSeq; +typedef sequence<Transform> TransformSeq; /// IDL of the graphical interface. /// It contains the following groups: @@ -348,6 +349,10 @@ typedef sequence<Position> PositionSeq; /// \param input configuration : Float[7] new configuration. boolean applyConfiguration(in string nodeName, in Transform configuration) raises (Error); + /// Same as \ref applyConfiguration on a list of node name and configuration. + /// Both input list should be of same length. + boolean applyConfigurations(in Names_t nodeName, in TransformSeq configuration) raises (Error); + /// Change configurations according to the last applyConfigurations.d void refresh() raises (Error); diff --git a/include/gepetto/gui/action-search-bar.hh b/include/gepetto/gui/action-search-bar.hh index 1d7337975ae5d3e90ef000b71e9a179eddf67b9d..45d6bdb98cacbf034097470775491853759691af 100644 --- a/include/gepetto/gui/action-search-bar.hh +++ b/include/gepetto/gui/action-search-bar.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_ACTION_SEARCH_BAR_HH #define GEPETTO_GUI_ACTION_SEARCH_BAR_HH diff --git a/include/gepetto/gui/bodytreewidget.hh b/include/gepetto/gui/bodytreewidget.hh index 579d21a7f380f2814e2251641675e54b395e1cfa..be9c6f9ef31ef0dff233f598ad8eef698ad6609a 100644 --- a/include/gepetto/gui/bodytreewidget.hh +++ b/include/gepetto/gui/bodytreewidget.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_BODYTREEWIDGET_HH #define GEPETTO_GUI_BODYTREEWIDGET_HH diff --git a/include/gepetto/gui/color-map.hh b/include/gepetto/gui/color-map.hh index 9cbed3c79bb2710126d7cb08b816ddc434937d77..14d8b8023694f2db2f890d89e3da0ae2cca9e6f3 100644 --- a/include/gepetto/gui/color-map.hh +++ b/include/gepetto/gui/color-map.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_COLORMAP_HH #define GEPETTO_GUI_COLORMAP_HH diff --git a/include/gepetto/gui/dialog/dialogloadenvironment.hh b/include/gepetto/gui/dialog/dialogloadenvironment.hh index e2081cd18fc74d15ccdfec7b1de988a46b43918d..80af0f2ac07f293053f122d48d1b822190a8ecd6 100644 --- a/include/gepetto/gui/dialog/dialogloadenvironment.hh +++ b/include/gepetto/gui/dialog/dialogloadenvironment.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_DIALOGLOADENVIRONMENT_HH #define GEPETTO_GUI_DIALOGLOADENVIRONMENT_HH diff --git a/include/gepetto/gui/dialog/dialogloadrobot.hh b/include/gepetto/gui/dialog/dialogloadrobot.hh index e98e5a2d62bad992504dbf4d8c4392c1a9167b6a..bba9f20c2a63a37d6c9ea6dfeb6aee7e58bbfda1 100644 --- a/include/gepetto/gui/dialog/dialogloadrobot.hh +++ b/include/gepetto/gui/dialog/dialogloadrobot.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_DIALOGLOADROBOT_HH #define GEPETTO_GUI_DIALOGLOADROBOT_HH diff --git a/include/gepetto/gui/dialog/pluginmanagerdialog.hh b/include/gepetto/gui/dialog/pluginmanagerdialog.hh index 8779082f0ffd506614aed7b0d0eb935abdfa74b1..00474542a0a73a9b143060288ec73aacc834e235 100644 --- a/include/gepetto/gui/dialog/pluginmanagerdialog.hh +++ b/include/gepetto/gui/dialog/pluginmanagerdialog.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_PLUGINMANAGERDIALOG_HH #define GEPETTO_GUI_PLUGINMANAGERDIALOG_HH diff --git a/include/gepetto/gui/doc.hh b/include/gepetto/gui/doc.hh index 1ab33e0aca6e5c8cdd1e3fdd236ec25a75641e9c..e0dbcec9d0455a85064abcf6c34c9e865562f773 100644 --- a/include/gepetto/gui/doc.hh +++ b/include/gepetto/gui/doc.hh @@ -10,6 +10,10 @@ /// To get some help on the command line options, use /// \code{bash} gepetto-gui --help \endcode /// +/// \section gui_settings Configuration files +/// +/// See gepetto::gui::Settings::readSettingFile for more details on configuration files. +/// /// \section gui_extending_interface Extending the interface /// /// There are two ways of extending the interface: Python and C++. Python diff --git a/include/gepetto/gui/fwd.hh b/include/gepetto/gui/fwd.hh index cdf951bf982565b5b9365419132cefff23d2593d..1f08e99a8f587ca55d6ac0129ce933315f6eeffe 100644 --- a/include/gepetto/gui/fwd.hh +++ b/include/gepetto/gui/fwd.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_FWD_HH #define GEPETTO_GUI_FWD_HH diff --git a/include/gepetto/gui/ledindicator.hh b/include/gepetto/gui/ledindicator.hh index b9dfa1f83833bb7fa19b28e049bce209eb3cbde3..58148a958fecd9c1b6f1986174bb59016d38b496 100644 --- a/include/gepetto/gui/ledindicator.hh +++ b/include/gepetto/gui/ledindicator.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_LEDINDICATOR_HH #define GEPETTO_GUI_LEDINDICATOR_HH diff --git a/include/gepetto/gui/mainwindow.hh b/include/gepetto/gui/mainwindow.hh index 945372354be51f6342007ceedb0045e66d0fb636..618f6d4b56a57e3403e7b938be50bb4b4915339e 100644 --- a/include/gepetto/gui/mainwindow.hh +++ b/include/gepetto/gui/mainwindow.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_MAINWINDOW_HH #define GEPETTO_GUI_MAINWINDOW_HH @@ -70,10 +86,6 @@ namespace gepetto { return selectionHandler_; } - /// Get the central widget. - /// \deprecated Use \ref osgWindows instead - OSGWidget* centralWidget() const GEPETTO_VIEWER_CORBA_DEPRECATED; - /// Get the list of windows. QList <OSGWidget*> osgWindows () const; diff --git a/include/gepetto/gui/meta.hh b/include/gepetto/gui/meta.hh index 1f1029a5903e94c2748a557130e65a6585ef6858..b014a41e286106673451de6bc905084d1ef415e9 100644 --- a/include/gepetto/gui/meta.hh +++ b/include/gepetto/gui/meta.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_META_HH #define GEPETTO_GUI_META_HH diff --git a/include/gepetto/gui/node-action.hh b/include/gepetto/gui/node-action.hh index 89f5efe1b1e3c75e8cee561e37a58b5cd6dff68e..607523e643d718e96de8e7d2dc20769726a997ac 100644 --- a/include/gepetto/gui/node-action.hh +++ b/include/gepetto/gui/node-action.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_NODE_ACTION_HH #define GEPETTO_GUI_NODE_ACTION_HH diff --git a/include/gepetto/gui/omniorb/omniorbthread.hh b/include/gepetto/gui/omniorb/omniorbthread.hh index 894f3c6f89b20e6f0e05724f6d0d458356109658..47dfe2ac249e58ec34c2a5173772836fe32115b6 100644 --- a/include/gepetto/gui/omniorb/omniorbthread.hh +++ b/include/gepetto/gui/omniorb/omniorbthread.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_OMNIORBTHREAD_HH #define GEPETTO_GUI_OMNIORBTHREAD_HH diff --git a/include/gepetto/gui/omniorb/url.hh b/include/gepetto/gui/omniorb/url.hh index 4e0507e68b564d73ab410b2943a68293887bbc71..fed02d2d193f2eb3e0d758badf5dca7a1db76283 100644 --- a/include/gepetto/gui/omniorb/url.hh +++ b/include/gepetto/gui/omniorb/url.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_OMNIORB_URL_HH #define GEPETTO_GUI_OMNIORB_URL_HH diff --git a/include/gepetto/gui/osgwidget.hh b/include/gepetto/gui/osgwidget.hh index 3060db2a10b564c8134b35c808bdff4c7a1988d7..6583b465ee82447c527735bc00e3530207f7e51e 100644 --- a/include/gepetto/gui/osgwidget.hh +++ b/include/gepetto/gui/osgwidget.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_OSGWIDGET_HH #define GEPETTO_GUI_OSGWIDGET_HH @@ -14,6 +30,9 @@ #include <gepetto/gui/fwd.hh> #include <gepetto/gui/windows-manager.hh> +class QProcess; +class QTextBrowser; + namespace gepetto { namespace gui { /// Widget that displays scenes. @@ -40,11 +59,15 @@ namespace gepetto { virtual void onHome(); void addFloor(); - void attachToWindow (const std::string nodeName); + + void toggleCapture (bool active); protected: virtual void paintEvent(QPaintEvent* event); + private slots: + void readyReadProcessOutput (); + private: osg::ref_ptr<osgQt::GraphicsWindowQt> graphicsWindow_; WindowsManagerPtr_t wsm_; @@ -55,6 +78,11 @@ namespace gepetto { osgViewer::ViewerRefPtr viewer_; osg::ref_ptr <osgViewer::ScreenCaptureHandler> screenCapture_; + // To record movies. + QProcess* process_; + QDialog* showPOutput_; + QTextBrowser* pOutput_; + friend class PickHandler; }; } // namespace gui diff --git a/include/gepetto/gui/pick-handler.hh b/include/gepetto/gui/pick-handler.hh index 2d5f1b2efd4f8dbc467be4615cbcb24df48c0b57..d0a5e50acff9c94e7c090de94a187c93bc18338b 100644 --- a/include/gepetto/gui/pick-handler.hh +++ b/include/gepetto/gui/pick-handler.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_PICK_HANDLER_HH #define GEPETTO_GUI_PICK_HANDLER_HH diff --git a/include/gepetto/gui/plugin-interface.hh b/include/gepetto/gui/plugin-interface.hh index 5e5f2394aec6e0960d3c699a54a71cdb9edfb4b0..71206f9b797c76bb019d78effc21ca2fe6c3650a 100644 --- a/include/gepetto/gui/plugin-interface.hh +++ b/include/gepetto/gui/plugin-interface.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_PLUGININTERFACE_HH #define GEPETTO_GUI_PLUGININTERFACE_HH diff --git a/include/gepetto/gui/pythonwidget.hh b/include/gepetto/gui/pythonwidget.hh index 53f5887d703ed89f53eda3d7d05e8e097364fee9..f2309f84db69a1de3b6b5d0966f9cc8a1955dcee 100644 --- a/include/gepetto/gui/pythonwidget.hh +++ b/include/gepetto/gui/pythonwidget.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_PYTHONWIDGET_HH #define GEPETTO_GUI_PYTHONWIDGET_HH @@ -12,6 +28,7 @@ #include <QDockWidget> #include <QLayout> #include <QPushButton> +#include <QSettings> class PythonQtObjectPtr; class PythonQtScriptingConsole; @@ -82,6 +99,9 @@ namespace gepetto { const QVariantList& args = QVariantList(), const QVariantMap& kwargs = QVariantMap()) const; + void saveHistory (QSettings& settings); + void restoreHistory (QSettings& settings); + public slots: /// Load a plugin by importing a module /// diff --git a/include/gepetto/gui/qt-osg-keyboard.hh b/include/gepetto/gui/qt-osg-keyboard.hh index 73c6c323e0e900d2fcbafca9608f6bf6ff543935..edd5f030565a4218b542d6fa93262a9e4ae00745 100644 --- a/include/gepetto/gui/qt-osg-keyboard.hh +++ b/include/gepetto/gui/qt-osg-keyboard.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_QT_OSG_KEYBOARD_HH__ # define GEPETTO_GUI_QT_OSG_KEYBOARD_HH__ diff --git a/include/gepetto/gui/safeapplication.hh b/include/gepetto/gui/safeapplication.hh index 7765042810d94f780f7463db21301c095ca1f656..1da815d9a8c7373ebe155aaec3b654aeae157136 100644 --- a/include/gepetto/gui/safeapplication.hh +++ b/include/gepetto/gui/safeapplication.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_SAFEAPPLICATION_HH #define GEPETTO_GUI_SAFEAPPLICATION_HH diff --git a/include/gepetto/gui/selection-event.hh b/include/gepetto/gui/selection-event.hh index 3ad9b8f4c489e3ba5d3aaf708b39ed3446c6b409..2dbcba3c2a08b2c6e111eb96a558cd7413710096 100644 --- a/include/gepetto/gui/selection-event.hh +++ b/include/gepetto/gui/selection-event.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_SELECTION_EVENT_HH #define GEPETTO_GUI_SELECTION_EVENT_HH diff --git a/include/gepetto/gui/selection-handler.hh b/include/gepetto/gui/selection-handler.hh index 14312306b4fa9a9610abef3a1dfacd1dd7f5a936..464518d2b4f49fa4f7836ff1c4f89f280b2e17f5 100644 --- a/include/gepetto/gui/selection-handler.hh +++ b/include/gepetto/gui/selection-handler.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_SELECTION_HANDLER_H__ # define GEPETTO_GUI_SELECTION_HANDLER_H__ diff --git a/include/gepetto/gui/settings.hh b/include/gepetto/gui/settings.hh index 67c5740d4f07c583ca9162efaef6bb809a814eff..9cd4979d95ca13702249f2eb853507bc19392e8b 100644 --- a/include/gepetto/gui/settings.hh +++ b/include/gepetto/gui/settings.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_SETTINGS_HH #define GEPETTO_GUI_SETTINGS_HH @@ -22,6 +38,7 @@ namespace gepetto { std::string configurationFile; std::string predifinedRobotConf; std::string predifinedEnvConf; + std::string stateConf; bool verbose; bool noPlugin; @@ -95,6 +112,10 @@ namespace gepetto { /// \note Prefer using Settings::fromFiles() void readSettingFile (); + void saveState () const; + void restoreState () const; + void restoreDockWidgetsState () const; + private: void writeRobotFile (); void writeEnvFile (); diff --git a/include/gepetto/gui/shortcut-factory.hh b/include/gepetto/gui/shortcut-factory.hh index 9cbc380aa59af2c1ecb4090f7fb9e38c6b3d0d1d..96b973104413b46e6d9b74fa2df546faa998c2f2 100644 --- a/include/gepetto/gui/shortcut-factory.hh +++ b/include/gepetto/gui/shortcut-factory.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_SHORTCUT_FACTORY_HH_ # define GEPETTO_GUI_SHORTCUT_FACTORY_HH_ diff --git a/include/gepetto/gui/tree-item.hh b/include/gepetto/gui/tree-item.hh index 9ea242728b6fc471ab8c55fdaf8cf0d9fe7242af..af0cc5a58e70601a1c295e45365b729f8250ff3d 100644 --- a/include/gepetto/gui/tree-item.hh +++ b/include/gepetto/gui/tree-item.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_TREEITEM_HH #define GEPETTO_GUI_TREEITEM_HH diff --git a/include/gepetto/gui/ui/mainwindow.ui b/include/gepetto/gui/ui/mainwindow.ui index 6ac572e4806309e7e1f1eddbb6c90b365e1f5328..5fafe64aa9fac7900688789b1ddc309af7a3aa32 100644 --- a/include/gepetto/gui/ui/mainwindow.ui +++ b/include/gepetto/gui/ui/mainwindow.ui @@ -208,6 +208,7 @@ <addaction name="actionSelection"/> <addaction name="actionHome"/> <addaction name="actionAdd_floor"/> + <addaction name="actionRecordMovie"/> </widget> <widget class="QDockWidget" name="dockWidget_log"> <property name="windowIcon"> @@ -398,6 +399,22 @@ <string>Add a floor</string> </property> </action> + <action name="actionRecordMovie"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="icon"> + <iconset theme="media-record"> + <normaloff/> + </iconset> + </property> + <property name="text"> + <string>Scene capture.</string> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Record the central widget as a sequence of images. You can find the images in /tmp/gepetto-gui/record/img_%d.jpeg</p></body></html></string> + </property> + </action> <action name="actionAbout"> <property name="text"> <string>&About...</string> @@ -433,7 +450,9 @@ </action> <action name="actionClose_connections"> <property name="icon"> - <iconset theme="network-disconnect"/> + <iconset theme="network-disconnect"> + <normaloff/> + </iconset> </property> <property name="text"> <string>Close connections</string> diff --git a/include/gepetto/gui/windows-manager.hh b/include/gepetto/gui/windows-manager.hh index d4872efae4d8fcf6314fc5276079d10ff253a317..0abaded93fd0f1c33c8abde9e0e2223f0bbb8659 100644 --- a/include/gepetto/gui/windows-manager.hh +++ b/include/gepetto/gui/windows-manager.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_WINDOWSMANAGER_HH #define GEPETTO_GUI_WINDOWSMANAGER_HH diff --git a/include/gepetto/viewer/corba/se3.hh b/include/gepetto/viewer/corba/se3.hh index f9aa02cb7eb695a024fa494e7f3eb4672b30f7ce..41019809e748e3c3c01d8ac12f52a62330d6432f 100644 --- a/include/gepetto/viewer/corba/se3.hh +++ b/include/gepetto/viewer/corba/se3.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef __se3_se3_hpp__ #define __se3_se3_hpp__ #include <Eigen/Geometry> diff --git a/include/gepetto/viewer/corba/windows-manager.hh b/include/gepetto/viewer/corba/windows-manager.hh index 21874f70a6450ba8d6d2dc8f54fd59246a4c0c08..a2de9af3f2647d93e9a31a63b8ebc584f0775984 100644 --- a/include/gepetto/viewer/corba/windows-manager.hh +++ b/include/gepetto/viewer/corba/windows-manager.hh @@ -223,6 +223,7 @@ namespace graphics { virtual bool deleteNode (const std::string& nodeName, bool all); virtual bool applyConfiguration(const std::string& nodeName, const Configuration& configuration); + virtual bool applyConfigurations(const std::vector<std::string>& nodeName, const std::vector<Configuration>& configuration); virtual bool addLandmark(const std::string& nodeName, float size); virtual bool deleteLandmark(const std::string& nodeName); diff --git a/plugins/pyqcustomplot/decorator.cc b/plugins/pyqcustomplot/decorator.cc index b29e792b10971bda03b6d8dc97796047196f01f0..a1d9fb11dbf2be7395ebd90805143d2ef16b0e81 100644 --- a/plugins/pyqcustomplot/decorator.cc +++ b/plugins/pyqcustomplot/decorator.cc @@ -23,12 +23,8 @@ void registerQCustomPlot () PythonQt::self()->addDecorators (new QCustomPlotDecorator ()); PythonQt::self()->registerCPPClass ("QCPPainter" , "QPainter", "QCustomPlot"); PythonQt::self()->registerCPPClass ("QCustomPlot" , "QWidget" , "QCustomPlot"); - // PythonQt::self()->registerCPPClass ("QCPLayoutElement" , "QGraphicsScene", "QCustomPlot"); - // PythonQt::self()->registerCPPClass ("QCPLayout" , "QGraphicsItem" , "QCustomPlot"); - // PythonQt::self()->registerCPPClass ("QCPAxis" , "QGraphicsItem" , "QCustomPlot"); // PythonQt::self()->registerCPPClass ("QCPAxisRect" , "QGraphicsItem" , "QCustomPlot"); // PythonQt::self()->registerCPPClass ("QCPAxisPainterPrivate", "QGraphicsItem" , "QCustomPlot"); - PythonQt::self()->registerCPPClass ("QCPGraph" , "QCPAbstractPlottable" , "QCustomPlot"); // PythonQt::self()->registerCPPClass ("QCPItemPosition" , "QGraphicsItem" , "QCustomPlot"); PythonQt::self()->registerCPPClass ("QCPLayer" , "QObject" , "QCustomPlot"); // PythonQt::self()->registerCPPClass ("QCPPlotTitle" , "QGraphicsItem" , "QCustomPlot"); @@ -44,9 +40,17 @@ void registerQCustomPlot () PythonQt::self()->registerCPPClass ("QCPItemEllipse" , "QCPAbstractItem" , "QCustomPlot"); PythonQt::self()->registerCPPClass ("QCPAbstractPlottable" , "QCPLayerable" , "QCustomPlot"); + PythonQt::self()->registerCPPClass ("QCPBars" , "QCPAbstractPlottable" , "QCustomPlot"); + // PythonQt::self()->registerCPPClass ("QCPColorMap" , "QCPAbstractPlottable" , "QCustomPlot"); + PythonQt::self()->registerCPPClass ("QCPCurve" , "QCPAbstractPlottable" , "QCustomPlot"); + // PythonQt::self()->registerCPPClass ("QCPFinancial" , "QCPAbstractPlottable" , "QCustomPlot"); + PythonQt::self()->registerCPPClass ("QCPGraph" , "QCPAbstractPlottable" , "QCustomPlot"); + // PythonQt::self()->registerCPPClass ("QCPStatisticalBox" , "QCPAbstractPlottable" , "QCustomPlot"); PythonQt::self()->registerCPPClass ("QCPLayoutElement" , "QCPLayerable" , "QCustomPlot"); PythonQt::self()->registerCPPClass ("QCPLayout" , "QCPLayoutElement" , "QCustomPlot"); PythonQt::self()->registerCPPClass ("QCPLayoutGrid" , "QCPLayout" , "QCustomPlot"); PythonQt::self()->registerCPPClass ("QCPLegend" , "QCPLayoutGrid" , "QCustomPlot"); + + PythonQt::self()->registerCPPClass ("QCPAxis" , "QCPLayerable" , "QCustomPlot"); } diff --git a/plugins/pyqcustomplot/decorator.hh b/plugins/pyqcustomplot/decorator.hh index 14dcd919ecbb0241e57f9f92cd7b17a2ea283fdc..b2ef2341bf087abbad4144c0621ade4491bdebf5 100644 --- a/plugins/pyqcustomplot/decorator.hh +++ b/plugins/pyqcustomplot/decorator.hh @@ -8,35 +8,33 @@ class QCustomPlotDecorator : public QObject { Q_OBJECT public Q_SLOTS: - // add a constructor - QCustomPlot* new_QCustomPlot() + /// \name QCustomPlot + /// \{ + QCustomPlot* new_QCustomPlot(QWidget* parent = 0) { - return new QCustomPlot(); + return new QCustomPlot(parent); } - //wrapper functions void delete_QCustomPlot(QCustomPlot* o) //delete QCustomPlot object { delete o; } - void clearGraphs(QCustomPlot* o) //add a graph inside the QCustomPlot object + void clearGraphs(QCustomPlot* o) { o->clearGraphs(); } - QCPGraph* addGraph(QCustomPlot* o) //add a graph inside the QCustomPlot object + + QCPGraph* addGraph(QCustomPlot* o) { return o->addGraph(); } - QCPGraph* graph(QCustomPlot* o, int graphnum) - { - return o->graph(graphnum); - } - void setData (QCustomPlot* o,int graphnum, const QVector<double> &keys, const QVector<double> &values) //set data to a certain graph. Deletes existing data inside the graph + void addPlottable(QCustomPlot* o, QCPAbstractPlottable* ap) { - o->graph(graphnum)->setData(keys,values); + o->addPlottable(ap); } - void addData (QCustomPlot* o,int graphnum, const QVector<double> &keys, const QVector<double> &values) //set data to a certain graph. Deletes existing data inside the graph + + QCPGraph* graph(QCustomPlot* o, int graphnum) { - o->graph(graphnum)->addData(keys,values); + return o->graph(graphnum); } void replot (QCustomPlot* o) //replot object to visualise new data { @@ -54,205 +52,145 @@ class QCustomPlotDecorator : public QObject { o->rescaleAxes(v); } - void plotLayout_insertRow(QCustomPlot* o, int row) //insert row above graph - { - o->plotLayout()->insertRow(row); - } - void plotLayout_insertColumn(QCustomPlot* o, int column) //insert column above graph - { - o->plotLayout()->insertColumn(column); - } - void plotLayout_addElement(QCustomPlot* o, int row, int column, QCPLayoutElement *element) //add text to graph at row,column - { - o->plotLayout()->addElement(row,column,element); - } + QCPLayoutGrid* plotLayout (QCustomPlot* o) { return o->plotLayout (); } void setAutoAddPlottableToLegend (QCustomPlot* o, bool v) { o->setAutoAddPlottableToLegend (v); } - QCPLegend* legend (QCustomPlot* o) - { - return o->legend; - } - //------------------------------------------------------- Axis adjustment stuff------------------------------------------------ - //xAxis stuff - void xAxis_setLabel(QCustomPlot* o, const QString text) - { - o->xAxis->setLabel(text); - } - void xAxis_setVisible(QCustomPlot* o, bool visible) - { - o->setVisible(visible); - } - void xAxis_setRange(QCustomPlot* o, double position, double size) - { - o->xAxis->setRange(position, size); - } - void xAxis_setAutoTicks(QCustomPlot* o, bool on) - { - o->xAxis->setAutoSubTicks(on); - } - void xAxis_setAutoTickLabels(QCustomPlot* o, bool on) - { - o->xAxis->setAutoTickLabels(on); - } - void xAxis_setTickVector(QCustomPlot* o, const QVector<double> &ticks) - { - o->xAxis->setTickVector(ticks); - } - void xAxis_setTickVectorLabels(QCustomPlot* o, const QVector<QString> &labels) - { - o->xAxis->setTickVectorLabels(labels); - } - void xAxis_setTickLength(QCustomPlot* o, int inside, int outside) - { - o->xAxis->setTickLength(inside,outside); - } - void xAxis_setSubTickLength(QCustomPlot* o, int inside, int outside) - { - o->xAxis->setSubTickLength(inside, outside); - } - //xAxis2 stuff - void xAxis2_setLabel(QCustomPlot* o, const QString text) - { - o->xAxis2->setLabel(text); - } - void xAxis2_setVisible(QCustomPlot* o, bool visible) - { - o->setVisible(visible); - } - void xAxis2_setRange(QCustomPlot* o, double position, double size) - { - o->xAxis2->setRange(position, size); - } - void xAxis2_setAutoTicks(QCustomPlot* o, bool on) - { - o->xAxis2->setAutoSubTicks(on); - } - void xAxis2_setAutoTickLabels(QCustomPlot* o, bool on) - { - o->xAxis2->setAutoTickLabels(on); - } - void xAxis2_setTickVector(QCustomPlot* o, const QVector<double> &ticks) - { - o->xAxis2->setTickVector(ticks); - } - void xAxis2_setTickVectorLabels(QCustomPlot* o, const QVector<QString> &labels) - { - o->xAxis2->setTickVectorLabels(labels); - } - void xAxis2_setTickLength(QCustomPlot* o, int inside, int outside) - { - o->xAxis2->setTickLength(inside,outside); - } - void xAxis2_setSubTickLength(QCustomPlot* o, int inside, int outside) - { - o->xAxis2->setSubTickLength(inside, outside); - } - //yAxis stuff - void yAxis_setLabel(QCustomPlot* o, const QString text) - { - o->yAxis->setLabel(text); - } - void yAxis_setVisible(QCustomPlot* o, bool visible) - { - o->setVisible(visible); - } - void yAxis_setRange(QCustomPlot* o, double position, double size) + /// \param interaction See QCP::Interaction + void setInteraction(QCustomPlot* o, int interaction, bool enabled = true) { - o->yAxis->setRange(position, size); + o->setInteraction((QCP::Interaction)interaction, enabled); } - void yAxis_setAutoTicks(QCustomPlot* o, bool on) + QCPAxis* xAxis (QCustomPlot* o) { return o->xAxis ; } + QCPAxis* xAxis2 (QCustomPlot* o) { return o->xAxis2; } + QCPAxis* yAxis (QCustomPlot* o) { return o->yAxis ; } + QCPAxis* yAxis2 (QCustomPlot* o) { return o->yAxis2; } + QCPLegend* legend (QCustomPlot* o) { return o->legend; } + /// \} + + /// \name QCPAxis + /// \{ + void setLabel(QCPAxis* a, const QString text) { - o->yAxis->setAutoSubTicks(on); + a->setLabel(text); } - void yAxis_setAutoTickLabels(QCustomPlot* o, bool on) + void setRange(QCPAxis* a, double position, double size) { - o->yAxis->setAutoTickLabels(on); + a->setRange(position, size); } - void yAxis_setTickVector(QCustomPlot* o, const QVector<double> &ticks) + void setAutoTicks(QCPAxis* a, bool on) { - o->yAxis->setTickVector(ticks); + a->setAutoSubTicks(on); } - void yAxis_setTickVectorLabels(QCustomPlot* o, const QVector<QString> &labels) + void setAutoTickLabels(QCPAxis* a, bool on) { - o->yAxis->setTickVectorLabels(labels); + a->setAutoTickLabels(on); } - void yAxis_setTickLength(QCustomPlot* o, int inside, int outside) + void setTickVector(QCPAxis* a, const QVector<double> &ticks) { - o->yAxis->setTickLength(inside,outside); + a->setTickVector(ticks); } - void yAxis_setSubTickLength(QCustomPlot* o, int inside, int outside) + void setTickVectorLabels(QCPAxis* a, const QVector<QString> &labels) { - o->yAxis->setSubTickLength(inside, outside); + a->setTickVectorLabels(labels); } - //yAxis2 stuff - void yAxis2_setLabel(QCustomPlot* o, const QString text) + void setTickLength(QCPAxis* a, int inside, int outside) { - o->yAxis2->setLabel(text); + a->setTickLength(inside,outside); } - void yAxis2_setVisible(QCustomPlot* o, bool visible) + void setSubTickLength(QCPAxis* a, int inside, int outside) { - o->setVisible(visible); + a->setSubTickLength(inside, outside); } - void yAxis2_setRange(QCustomPlot* o, double position, double size) + double pixelToCoord(QCPAxis* a, double pixel) { - o->yAxis2->setRange(position, size); + return a->pixelToCoord(pixel); } - void yAxis2_setAutoTicks(QCustomPlot* o, bool on) + /// \} + + /// \name QCPGraph + /// \{ + QCPGraph* new_QCPGraph (QCPAxis* key, QCPAxis* value) { return new QCPGraph (key, value); } + void delete_QCPGraph (QCPGraph* g) { delete g; } + void setData (QCPGraph* g, const QVector<double> &keys, const QVector<double> &values) { - o->yAxis2->setAutoSubTicks(on); + g->setData(keys,values); } - void yAxis2_setAutoTickLabels(QCustomPlot* o, bool on) + void addData (QCPGraph* g, const QVector<double> &keys, const QVector<double> &values) { - o->yAxis2->setAutoTickLabels(on); + g->addData(keys,values); } - void yAxis2_setTickVector(QCustomPlot* o, const QVector<double> &ticks) + void clearData (QCPGraph* o) { o->clearData (); } + /// \} + + /// \name QCPCurve + /// \{ + QCPCurve* new_QCPCurve (QCPAxis* key, QCPAxis* value) { return new QCPCurve (key, value); } + void delete_QCPCurve (QCPCurve* g) { delete g; } + void setData (QCPCurve* c, const QVector<double> &keys, const QVector<double> &values) { - o->yAxis2->setTickVector(ticks); + c->setData(keys,values); } - void yAxis2_setTickVectorLabels(QCustomPlot* o, const QVector<QString> &labels) + void addData (QCPCurve* c, const QVector<double> &ts, const QVector<double> &keys, const QVector<double> &values) { - o->yAxis2->setTickVectorLabels(labels); + c->addData(ts, keys,values); } - void yAxis2_setTickLength(QCustomPlot* o, int inside, int outside) + void clearData (QCPCurve* o) { o->clearData (); } + /// \} + + /// \name QCPBars + /// \{ + QCPBars* new_QCPBars (QCPAxis* key, QCPAxis* value) { return new QCPBars (key, value); } + void delete_QCPBars (QCPBars* g) { delete g; } + void setData (QCPBars* c, const QVector<double> &keys, const QVector<double> &values) { - o->yAxis2->setTickLength(inside,outside); + c->setData(keys,values); } - void yAxis2_setSubTickLength(QCustomPlot* o, int inside, int outside) + void addData (QCPBars* c, const QVector<double> &keys, const QVector<double> &values) { - o->yAxis2->setSubTickLength(inside, outside); + c->addData(keys,values); } - //Interaction - void setInteraction(QCustomPlot* o, int interaction, bool enabled = true) + void clearData (QCPBars* o) { o->clearData (); } + /// \} + + /// \name QCPAbstractPlottable + /// \{ + void rescaleAxes(QCPAbstractPlottable* ap, bool v = true) { - o->setInteraction((QCP::Interaction)interaction, enabled); + ap->rescaleAxes(v); } - //QCPGraph - void rescaleAxes(QCPGraph* g, bool v = true) + void setName (QCPAbstractPlottable* ap, const QString &n) { - g->rescaleAxes(v); + ap->setName(n); } - void setData (QCPGraph* g, const QVector<double> &keys, const QVector<double> &values) + void setPen (QCPAbstractPlottable* ap, const QPen &pen) { - g->setData(keys,values); + ap->setPen(pen); } - void addData (QCPGraph* g, const QVector<double> &keys, const QVector<double> &values) + /// \} + + /// \name QCPLayerable + /// \{ + void setVisible (QCPLayerable* l, const bool &v) { - g->addData(keys,values); + l->setVisible(v); } - void setPen (QCPGraph* g, const QPen &pen) + /// \} + + /// \name QCPLayoutGrid + /// \{ + void insertRow (QCPLayoutGrid* lg, int row) //insert row above graph { - g->setPen(pen); + lg->insertRow(row); } - //QCPAbstractPlottable - void setName (QCPAbstractPlottable* ap, const QString &n) + void insertColumn (QCPLayoutGrid* lg, int column) //insert column above graph { - ap->setName(n); + lg->insertColumn(column); } - //QCPLayerable - void setVisible (QCPLayerable* l, const bool &v) + void addElement (QCPLayoutGrid* lg, int row, int column, QCPLayoutElement *element) //add text to graph at row,column { - l->setVisible(v); + lg->addElement(row,column,element); } + /// \} }; diff --git a/plugins/pyqcustomplot/plugin.hh b/plugins/pyqcustomplot/plugin.hh index b0d551137f1a9357257a36d59cf6f51f66a19793..990b4286fa14b6237179fb83c60aa5dee5c022fe 100644 --- a/plugins/pyqcustomplot/plugin.hh +++ b/plugins/pyqcustomplot/plugin.hh @@ -24,6 +24,8 @@ namespace PyQCustomPlot { /// \ingroup pluginlist /// Provide bindings of QCustomPlot library in PythonQt terminal. + /// See QCustomPlotDecorator for the API available in Python. + /// /// Add the following to your settings file to activate it. /// /// [plugins] diff --git a/pyplugins/gepetto/gui/blenderexport.py b/pyplugins/gepetto/gui/blenderexport.py index 71e4895d22463954e365f109daee5e41fbe8f9f5..175cd7b3761aeaa955141a8abeb3b477b089cca7 100644 --- a/pyplugins/gepetto/gui/blenderexport.py +++ b/pyplugins/gepetto/gui/blenderexport.py @@ -87,11 +87,9 @@ class _Widget (QtGui.QWidget): ### gepetto.gui.blenderexport=true ### class Plugin(QtGui.QDockWidget): - def __init__ (self, mainWindow, flags = None): - if flags is None: - super(Plugin, self).__init__ ("Blender export plugin", mainWindow) - else: - super(Plugin, self).__init__ ("Blender export plugin", mainWindow, flags) + def __init__ (self, mainWindow): + super(Plugin, self).__init__ ("Blender export plugin", mainWindow) + self.setObjectName ("gepetto.gui.blenderexport") self.resetConnection() # Initialize the widget mainWidget = _Widget(self, self) diff --git a/pyplugins/gepetto/gui/pythonwidget.py b/pyplugins/gepetto/gui/pythonwidget.py index 33d614e5189d69d2750ae366f30c372663a39c40..2ba8f460bb6f5e96ee4f00d4d3e9b6df2ca27bac 100644 --- a/pyplugins/gepetto/gui/pythonwidget.py +++ b/pyplugins/gepetto/gui/pythonwidget.py @@ -81,11 +81,8 @@ class Plugin(QtGui.QDockWidget): 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) - else: - super(Plugin, self).__init__ ("Gepetto Viewer plugin", mainWindow, flags) + def __init__ (self, mainWindow): + super(Plugin, self).__init__ ("Gepetto Viewer plugin", mainWindow) self.setObjectName("Gepetto Viewer plugin") self.client = Client() # Initialize the widget diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6a28e2651803b09d3d22a53347f64a0a26416424..67590837dc5888dafffd325a84e64a276de0a49f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -106,16 +106,9 @@ INSTALL( INSTALL( FILES ${CMAKE_CURRENT_SOURCE_DIR}/gepetto/corbaserver/__init__.py - DESTINATION ${PYTHON_SITELIB}/gepetto/corbaserver - ) -INSTALL( - FILES ${CMAKE_CURRENT_SOURCE_DIR}/gepetto/corbaserver/client.py - DESTINATION ${PYTHON_SITELIB}/gepetto/corbaserver - ) -INSTALL( - FILES ${CMAKE_CURRENT_SOURCE_DIR}/gepetto/corbaserver/exporttoblender.py + ${CMAKE_CURRENT_SOURCE_DIR}/gepetto/corbaserver/tools.py DESTINATION ${PYTHON_SITELIB}/gepetto/corbaserver ) INSTALL( diff --git a/src/gepetto/corbaserver/tools.py b/src/gepetto/corbaserver/tools.py new file mode 100644 index 0000000000000000000000000000000000000000..826110c48ac1e29593bf8da6a1e5b660d3ece7d8 --- /dev/null +++ b/src/gepetto/corbaserver/tools.py @@ -0,0 +1,136 @@ +from gepetto.color import Color + +import numpy as np +from math import pi, sqrt, cos, sin + +def _pointsTorus(R, r, nR, nr): + pts = [] + twopi = 2 * pi + for j in range(nR): + for i in range(nr + 1): + s = i % nr + phi = s* twopi /nr + for k in (1, 0): + t = (j + k) % nR + + theta = t* twopi /nR + y = (R+r*cos(phi))*cos(theta); + z = -(R+r*cos(phi))*sin(theta); + x = r * sin(phi); + pts.append ((x, y, z)) + return pts + +def _pointsCone(r, L, nr, R): + pts = [] + twopi = 2 * pi + for j in range(nr+1): + t = j % nr + theta = t* twopi /nr + pts.append ((0., R, L)) + pts.append ((r*cos(theta), R + r*sin(theta), 0.)) + return pts + +def _pointsCircularArrow (R, r, nR, nr): + ptsCone = _pointsCone (1.5*r, 3*r, nr, R) + ptsTorus = _pointsTorus (R, r, nR, nr) + return ptsCone + ptsTorus, len(ptsCone) + +# Compute a transformation which rotates (1, 0, 0) to v +# Return (norm_v, T) +# When norm_v == 0, T is None +def _tranformFromXvector (v): + norm_v = np.linalg.norm(v) + if norm_v == 0: + # self.plugin.gui.gui.resizeArrow (n, self.radius, norm_v) + return 0, None + # x = (1, 0, 0) + u = v / norm_v + if u[0] < -1 + 1e-6: # Nearly opposite vectors + m = np.array ( ( (1, 0, 0), u ) ) + U, S, V = np.linalg.svd (m) + c = max (u[0], -1) + w2 = (1 + c) / 2 + s = sqrt(1 - w2) + t = (0,0,0, V[0,2]/s, V[1,2]/s, V[2,2]/s, w2) + else: + s = sqrt(2 * (1 + u[0])) + # axis = (0, -u[2]/s, u[1]/s) # x ^ u + t = (0,0,0, 0, -u[2]/s, u[1]/s, s/2) + return norm_v, t + +class Angular: + ## \param majorRadius, majorN radius and discretisation of the circle that is + ## the center of the torus + ## \param minorRadius, minorN radius and discretisation of the circle that is + ## a section of the torus + def __init__ (self, nodeName, color = Color.red, majorRadius = 0.1, minorRadius = 0.005, majorN = 100, minorN = 20): + self.name = nodeName + self.R = majorRadius + self.r = minorRadius + self.nR = majorN + self.nr = minorN + self.color = color + + def create (self, gui): + pts, self.minC = _pointsCircularArrow (self.R, self.r, self.nR, self.nr) + gui.addCurve (self.name, pts, self.color) + gui.setCurveMode (self.name, "quad_strip") + self.maxC = len(pts) + def remove (self, gui): + gui.deleteNode (self.name, False) + + ## \param factor the norm of the vector is divided by this value + def set(self, gui, v, factor = pi): + norm, pos = _tranformFromXvector (v) + count = min (self.minC + int (norm * (self.maxC-self.minC) / factor), self.maxC) + gui.setCurvePointsSubset (self.name, 0, count) + if pos is not None: gui.applyConfiguration (self.name, pos) + +class Linear: + ## \param majorRadius, majorN radius and discretisation of the circle that is + ## the center of the torus + ## \param minorRadius, minorN radius and discretisation of the circle that is + ## a section of the torus + def __init__ (self, nodeName, color = Color.red, radius = 0.005): + self.name = nodeName + self.R = radius + self.color = color + + def create (self, gui): + gui.addArrow (self.name, self.R, 1, self.color) + def remove (self, gui): + gui.deleteNode (self.name, False) + + ## \param factor the norm of the vector is divided by this value + def set(self, gui, v, factor = 1.): + norm, pos = _tranformFromXvector (v) + gui.resizeArrow (self.name, self.R, norm / factor) + if pos is not None: gui.applyConfiguration (self.name, pos) + + +## Represents a 6D vector using an arrow with the 3 first +## values and a circular arrow with the 3 last values. +## It is useful to plot velocities of a body, forces and torques... +class Vector6: + suffixLin = "linear" + suffixAng = "angular" + + ## \param groupName name of an **existing** group + def __init__ (self, groupName, angFactor = pi, linFactor = 1.): + self.name = groupName + self.linear = Linear (self.name + '/' + VelGetter.suffixLin) + self.angular = Angular (self.name + '/' + VelGetter.suffixAng) + self.angF = angFactor + self.linF = linFactor + + def create (self, gui): + self.linear .create(gui) + self.angular.create(gui) + + def remove (self, gui): + self.linear .remove(gui) + self.angular.remove(gui) + + def set (self, gui, v): + self.linear .set (gui, v[0:3], self.linF) + self.angular.set (gui, v[3:6], self.angF) diff --git a/src/graphical-interface.impl.cpp b/src/graphical-interface.impl.cpp index 8b93272434d85f9a99b717e73d1c2c62c97e36b9..4cfa29e163418f02bda716e88b232e449b97dfc4 100644 --- a/src/graphical-interface.impl.cpp +++ b/src/graphical-interface.impl.cpp @@ -46,7 +46,7 @@ namespace graphics { } enum ArgType { STRING, STRING_LIST, OUT_STRING_LIST, COLOR, - TRANSFORM, POSITION, POSITION_SEQ, + TRANSFORM, TRANSFORM_SEQ, POSITION, POSITION_SEQ, FLOAT, SHORT, LONG, WINDOW_ID, BOOL, VOID, GLMODE }; @@ -71,6 +71,16 @@ namespace graphics { return ret; } }; + template <> struct traits<TRANSFORM_SEQ> { + typedef const GraphicalInterface::TransformSeq& In_t; + typedef std::vector<Configuration> Out_t; + static Out_t op (In_t in) { + Out_t out (in.length()); + for (CORBA::ULong i = 0; i < in.length (); ++i) + out[i] = traits<TRANSFORM>::op (in[i]); + return out; + } + }; template <> struct traits<POSITION> { typedef osgVector3 Out_t; typedef const GraphicalInterface::Position In_t; @@ -369,6 +379,8 @@ namespace graphics { BIND_TO_WINDOWS_MANAGER_2(BOOL, applyConfiguration, STRING, TRANSFORM) + BIND_TO_WINDOWS_MANAGER_2(BOOL, applyConfigurations, STRING_LIST, TRANSFORM_SEQ) + BIND_TO_WINDOWS_MANAGER_2(BOOL, addLandmark, STRING, FLOAT) BIND_TO_WINDOWS_MANAGER_1(BOOL, deleteLandmark, STRING) diff --git a/src/graphical-interface.impl.hh b/src/graphical-interface.impl.hh index 62d56e03ba0f8bbb10d3c845218373edb515e3b4..76f94a6631f96b76fdd64a8e06293cb9023d0b82 100644 --- a/src/graphical-interface.impl.hh +++ b/src/graphical-interface.impl.hh @@ -37,6 +37,7 @@ private: public: typedef CORBA::ULong WindowID; typedef gepetto::corbaserver::Transform Transform; + typedef gepetto::corbaserver::TransformSeq TransformSeq; typedef gepetto::corbaserver::PositionSeq PositionSeq; typedef gepetto::corbaserver::Position Position; typedef gepetto::corbaserver::Position_slice Position_slice; @@ -136,6 +137,7 @@ public: virtual bool removeFromGroup (const char* nodeNameCorba,const char* groupNameCorba) throw (Error); virtual bool applyConfiguration(const char* nodeNameCorba, const value_type* configuration) throw (Error); + virtual bool applyConfigurations(const Names_t& nodeNameCorba, const TransformSeq& configuration) throw (Error); virtual bool addLandmark(const char* nodeNameCorba, float size) throw (Error); virtual bool deleteLandmark(const char* nodeNameCorba) throw (Error); diff --git a/src/gui/action-search-bar.cc b/src/gui/action-search-bar.cc index b77f3518fa548c5c62cc4cddcb359b1b037741ea..a628e902a74bc9a1012ad6f95b1f5c3ed422309a 100644 --- a/src/gui/action-search-bar.cc +++ b/src/gui/action-search-bar.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include <gepetto/gui/action-search-bar.hh> #include <QDebug> diff --git a/src/gui/bodytreewidget.cc b/src/gui/bodytreewidget.cc index e0b5ac6083319bd871607d11467a82f98d4d33d1..dd62091282543ac2cf1063d4951affbed557e992 100644 --- a/src/gui/bodytreewidget.cc +++ b/src/gui/bodytreewidget.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include <gepetto/gui/bodytreewidget.hh> #include <gepetto/gui/tree-item.hh> diff --git a/src/gui/dialog/dialogloadenvironment.cc b/src/gui/dialog/dialogloadenvironment.cc index 06457c364fd59a6c4502a649e24fcdf473023f71..f7a60f2442fdd8b418284dd51a9d3402b42f1d8c 100644 --- a/src/gui/dialog/dialogloadenvironment.cc +++ b/src/gui/dialog/dialogloadenvironment.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/dialog/dialogloadenvironment.hh" #include "ui_dialogloadenvironment.h" diff --git a/src/gui/dialog/dialogloadrobot.cc b/src/gui/dialog/dialogloadrobot.cc index 2c4ef17d8ab2068e0c85aaae7e3caf0b8da9d629..d1f1f93f833c181eb2bba45644a461eeea39c10b 100644 --- a/src/gui/dialog/dialogloadrobot.cc +++ b/src/gui/dialog/dialogloadrobot.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/dialog/dialogloadrobot.hh" #include "ui_dialogloadrobot.h" diff --git a/src/gui/dialog/pluginmanagerdialog.cc b/src/gui/dialog/pluginmanagerdialog.cc index 16a776c7cd6bb3e15a999ce207e17b25a280c239..db5c6884f1d0a433df3766cea471b3a745a8f5bd 100644 --- a/src/gui/dialog/pluginmanagerdialog.cc +++ b/src/gui/dialog/pluginmanagerdialog.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/dialog/pluginmanagerdialog.hh" #include "ui_pluginmanagerdialog.h" diff --git a/src/gui/ledindicator.cc b/src/gui/ledindicator.cc index 7a56f2f409bd4f82d4a75da0c8be165589602d18..8d4ffdd81cb730b05d28818522f3687831223d43 100644 --- a/src/gui/ledindicator.cc +++ b/src/gui/ledindicator.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/ledindicator.hh" #include <QPainter> diff --git a/src/gui/main.cc.in b/src/gui/main.cc.in index f5bdb13c006dcf3fa5d1a6e39c9b99df4a411f02..2dd85cfc208ddef9b2721d1b2f131619238a9a84 100644 --- a/src/gui/main.cc.in +++ b/src/gui/main.cc.in @@ -24,7 +24,7 @@ Q_DECLARE_METATYPE(QItemSelection) void setupApplication () { QCoreApplication::setOrganizationName("gepetto-gui"); - QCoreApplication::setOrganizationDomain("https://github.com/jmirabel/gepetto-viewer-corba"); + QCoreApplication::setOrganizationDomain("https://github.com/humanoid-path-planner/gepetto-viewer-corba"); QCoreApplication::setApplicationName("gepetto-gui"); QCoreApplication::setApplicationVersion("@PROJECT_VERSION@"); @@ -83,8 +83,11 @@ int main(int argc, char *argv[]) w.setWindowIcon (pixmap); settings.setMainWindow (&w); settings.initPlugins (); + settings.restoreState (); w.connect (&a, SIGNAL (log(QString)), SLOT (logError(const QString&))); w.show(); splash.finish(&w); - return a.exec(); + int retCode = a.exec(); + settings.saveState (); + return retCode; } diff --git a/src/gui/mainwindow.cc b/src/gui/mainwindow.cc index 5973824fe7d8831e33b5961fab427a84e621357e..6907c93faa561edc4940babb12bbe2345b6aca08 100644 --- a/src/gui/mainwindow.cc +++ b/src/gui/mainwindow.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/mainwindow.hh" #include "ui_mainwindow.h" @@ -135,11 +151,6 @@ namespace gepetto { return osgViewerManagers_; } - OSGWidget *MainWindow::centralWidget() const - { - return centralWidget_; - } - BodyTreeWidget *MainWindow::bodyTree() const { return ui_->bodyTreeContent; @@ -237,7 +248,8 @@ namespace gepetto { emit refresh (); } - void MainWindow::createDefaultView() { + void MainWindow::createDefaultView() + { std::stringstream ss; ss << "hpp_gui_window_" << osgWindows_.size(); createView (ss.str()); } @@ -246,6 +258,7 @@ namespace gepetto { { QDockWidget* dockOSG = new QDockWidget ( tr("Window ") + osgWidget->objectName(), this); + dockOSG->setObjectName ("gepetto-gui.osg." + osgWidget->objectName()); dockOSG->setWidget(osgWidget); connect(dockOSG,SIGNAL(visibilityChanged(bool)),SLOT(dockVisibilityChanged(bool))); addDockWidget(Qt::RightDockWidgetArea, dockOSG); @@ -257,11 +270,12 @@ namespace gepetto { osg()->addSceneToWindow("hpp-gui", centralWidget_->windowID()); connect(ui_->actionAdd_floor, SIGNAL (triggered()), centralWidget_, SLOT (addFloor())); - - actionSearchBar_->addAction(new NodeAction("Attach camera to selected node", osgWidget, this)); + connect(ui_->actionRecordMovie, SIGNAL (toggled(bool)), centralWidget_, SLOT (toggleCapture(bool))); } + actionSearchBar_->addAction(new NodeAction("Attach camera " + osgWidget->objectName() + " to selected node", osgWidget, this)); osgWidget->addAction(actionSearchBar_->showAction()); osgWindows_.append(osgWidget); + settings_->restoreDockWidgetsState (); } void MainWindow::openLoadRobotDialog() @@ -392,7 +406,7 @@ namespace gepetto { void MainWindow::dockVisibilityChanged(bool visible) { - QWidget* cw = QMainWindow::centralWidget(); + QWidget* cw = centralWidget(); if (visible && cw->isVisible()) cw->hide(); else { diff --git a/src/gui/node-action.cc b/src/gui/node-action.cc index d3eaf15f065afa07b578c51c58d34906f263271f..a6cc3198f6e58b0cee8532c8dbdaf8de946e8a63 100644 --- a/src/gui/node-action.cc +++ b/src/gui/node-action.cc @@ -79,7 +79,7 @@ namespace gepetto { n->setVisibilityMode(graphics::ALWAYS_ON_TOP); break; case ATTACH_TO_WINDOW: - window_->attachToWindow(n->getID()); + window_->osg()->addSceneToWindow(n->getID(), window_->windowID()); break; case ATTACH_CAMERA_TO_NODE: window_->osg()->osgFrameMutex().lock(); diff --git a/src/gui/omniorbthread.cc b/src/gui/omniorbthread.cc index a2a41bad2c49e39bd9505cfbc7d8920140b0389c..17c5ed923ca20b96257f7ff6c7adac53b0d27964 100644 --- a/src/gui/omniorbthread.cc +++ b/src/gui/omniorbthread.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/omniorb/omniorbthread.hh" #include <gepetto/viewer/corba/server.hh> diff --git a/src/gui/osgwidget.cc b/src/gui/osgwidget.cc index e1d554a3f7510228d40876d1725d63e8627494d8..e5311951812661709a68509ab641c18fe44c96b8 100644 --- a/src/gui/osgwidget.cc +++ b/src/gui/osgwidget.cc @@ -1,9 +1,28 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/osgwidget.hh" #include "gepetto/gui/mainwindow.hh" #include <gepetto/gui/pick-handler.hh> #include <boost/regex.hpp> +#include <QProcess> +#include <QTextBrowser> + #include <osg/Camera> #include <osg/DisplaySettings> @@ -87,6 +106,9 @@ namespace gepetto { , wm_ () , viewer_ (new osgViewer::Viewer) , screenCapture_ () + , process_ (new QProcess (this)) + , showPOutput_ (new QDialog (this, Qt::Dialog | Qt::WindowCloseButtonHint | Qt::WindowMinMaxButtonsHint)) + , pOutput_ (new QTextBrowser()) { osg::DisplaySettings* ds = osg::DisplaySettings::instance().get(); osg::ref_ptr <osg::GraphicsContext::Traits> traits_ptr (new osg::GraphicsContext::Traits(ds)); @@ -142,6 +164,13 @@ namespace gepetto { connect( &timer_, SIGNAL(timeout()), this, SLOT(update()) ); timer_.start(parent->settings_->refreshRate); + + // Setup widgets to record movies. + process_->setProcessChannelMode(QProcess::MergedChannels); + connect (process_, SIGNAL (readyReadStandardOutput ()), SLOT (readyReadProcessOutput())); + showPOutput_->setModal(false); + showPOutput_->setLayout(new QHBoxLayout ()); + showPOutput_->layout()->addWidget(pOutput_); } OSGWidget::~OSGWidget() @@ -185,9 +214,48 @@ namespace gepetto { wsm_->addFloor("hpp-gui/floor"); } - void OSGWidget::attachToWindow(const std::string nodeName) + void OSGWidget::toggleCapture (bool active) + { + MainWindow* main = MainWindow::instance(); + if (active) { + QDir tmp ("/tmp"); + tmp.mkpath ("gepetto-gui/record"); tmp.cd("gepetto-gui/record"); + foreach (QString f, tmp.entryList(QStringList() << "img_0_*.jpeg", QDir::Files)) + tmp.remove(f); + QString path = tmp.absoluteFilePath("img"); + const char* ext = "jpeg"; + osg ()->startCapture(windowID(), path.toLocal8Bit().data(), ext); + main->log("Saving images to " + path + "_*." + ext); + } else { + osg()->stopCapture(windowID()); + QString outputFile = QFileDialog::getSaveFileName(this, tr("Save video to"), "untitled.mp4"); + if (!outputFile.isNull()) { + if (QFile::exists(outputFile)) + QFile::remove(outputFile); + QString avconv = "avconv"; + + QStringList args; + QString input = "/tmp/gepetto-gui/record/img_0_%d.jpeg"; + args << "-r" << "50" + << "-i" << input + << "-vf" << "scale=trunc(iw/2)*2:trunc(ih/2)*2" + << "-r" << "25" + << "-vcodec" << "libx264" + << outputFile; + qDebug () << args; + + showPOutput_->setWindowTitle(avconv + " " + args.join(" ")); + pOutput_->clear(); + showPOutput_->resize(main->size() / 2); + showPOutput_->show(); + process_->start(avconv, args); + } + } + } + + void OSGWidget::readyReadProcessOutput() { - wsm_->addSceneToWindow(nodeName, wid_); + pOutput_->append(process_->readAll()); } } // namespace gui } // namespace gepetto diff --git a/src/gui/pick-handler.cc b/src/gui/pick-handler.cc index 50c590ffa2b0cf083a6791df77d76deb3981d10c..3d8745dd19204876c899e3aafb1841252d2b7fdd 100644 --- a/src/gui/pick-handler.cc +++ b/src/gui/pick-handler.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/pick-handler.hh" #include <QDebug> diff --git a/src/gui/python-decorator.hh b/src/gui/python-decorator.hh index f4e727af2473350077678efb5c526d4ea96efc92..4a8a2971e1e994017008b1ff5e127d831713649f 100644 --- a/src/gui/python-decorator.hh +++ b/src/gui/python-decorator.hh @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #ifndef GEPETTO_GUI_PYTHON_DECORATOR_HH #define GEPETTO_GUI_PYTHON_DECORATOR_HH diff --git a/src/gui/pythonwidget.cc b/src/gui/pythonwidget.cc index 1ab934e1885d68eaa14bb0de38692831a8a54ef2..bfd33c39f4fe7e4484a3e3bc3f178831216870f6 100644 --- a/src/gui/pythonwidget.cc +++ b/src/gui/pythonwidget.cc @@ -1,7 +1,24 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/pythonwidget.hh" #include <QAction> #include <QFileDialog> +#include <QSettings> #include <PythonQt.h> #include <PythonQt_QtAll.h> #include <gui/PythonQtScriptingConsole.h> @@ -41,6 +58,7 @@ namespace gepetto { PythonWidget::PythonWidget(QWidget *parent) : QDockWidget("&PythonQt console", parent) { + setObjectName ("gepetto-gui.pythonqtconsole"); PythonQt::init(PythonQt::RedirectStdOut); PythonQt_init_QtBindings(); PythonQtObjectPtr mainContext = PythonQt::self()->getMainModule(); @@ -102,6 +120,32 @@ namespace gepetto { fd->deleteLater(); } + void PythonWidget::saveHistory (QSettings& settings) + { + settings.beginGroup("pythonqt"); + QStringList history = console_->history (); + int limit = 200; + int start = std::max(history.length() - limit, 0); + QList<QVariant> h; + foreach (QString s, history.mid(start)) { + h << s; + } + settings.setValue("history", h); + settings.endGroup(); + } + + void PythonWidget::restoreHistory (QSettings& settings) + { + settings.beginGroup("pythonqt"); + QList<QVariant> h = settings.value("history").toList(); + QStringList history; + foreach(QVariant v, h) { + history << v.toString(); + } + console_->setHistory (history); + settings.endGroup(); + } + void PythonWidget::loadScriptPlugin(QString moduleName, QString fileName) { PythonQt* pqt = PythonQt::self(); diff --git a/src/gui/safeapplication.cc b/src/gui/safeapplication.cc index 1f37547655ea6851043a5aacccab668f92bee678..20d094765ec34d8d1fd50f432037749fe103d0c5 100644 --- a/src/gui/safeapplication.cc +++ b/src/gui/safeapplication.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/safeapplication.hh" #include <QDebug> diff --git a/src/gui/selection-handler.cc b/src/gui/selection-handler.cc index 06fe1e2672672e853a120ac927475f3c57b1a6ac..75b68b44077a520e8dba1ab9066e0d325c39dd98 100644 --- a/src/gui/selection-handler.cc +++ b/src/gui/selection-handler.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include <QHBoxLayout> #include <QLabel> #include <QVector3D> diff --git a/src/gui/settings.cc b/src/gui/settings.cc index c26a8f5910e6c376ebc39d9194030d671e1f38c5..0a752bd1e39e0916b6727c2e179c1f9fd2c88762 100644 --- a/src/gui/settings.cc +++ b/src/gui/settings.cc @@ -37,6 +37,7 @@ namespace gepetto { : configurationFile ("settings") , predifinedRobotConf ("robots") , predifinedEnvConf ("environments") + , stateConf (".state") , verbose (false) , noPlugin (false) , startGepettoCorbaServer (true) @@ -93,7 +94,7 @@ namespace gepetto { osg::ApplicationUsage::Type help (arguments.readHelpType()); au->addCommandLineOption("-v or --verbose", "Activate verbose output"); - au->addCommandLineOption("-g or --generate-config-files", "generate configuration files and quit"); + au->addCommandLineOption("-g or --generate-config-files", "generate configuration files in " + installDirectory.toStdString() + "/etc and quit"); au->addCommandLineOption("-c or --config-file", "set the configuration file (do not include .conf)", configurationFile); au->addCommandLineOption("--predefined-robots", "set the predefined robots configuration file (do not include .conf)", predifinedRobotConf); au->addCommandLineOption("--predefined-environments", "set the predefined environments configuration file (do not include .conf)", predifinedEnvConf); @@ -198,6 +199,58 @@ namespace gepetto { #endif } + void Settings::restoreState () const + { + QSettings settings (QSettings::SystemScope, + QCoreApplication::organizationName (), + getQSettingsFileName (stateConf)); + if (settings.status() != QSettings::NoError) { + qDebug () << "Could not restore the window state from" << settings.fileName(); + } else { + settings.beginGroup("mainWindow"); + mw->restoreGeometry (settings.value("geometry").toByteArray()); + mw->restoreState (settings.value("state").toByteArray()); + mw->centralWidget()->setVisible (settings.value("centralWidgetVisibility", true).toBool()); + settings.endGroup(); +#if GEPETTO_GUI_HAS_PYTHONQT + mw->pythonWidget()->restoreHistory(settings); +#endif + } + } + + void Settings::restoreDockWidgetsState () const + { + QSettings settings (QSettings::SystemScope, + QCoreApplication::organizationName (), + getQSettingsFileName (stateConf)); + if (settings.status() != QSettings::NoError) { + qDebug () << "Could not restore the dock widget state from" << settings.fileName(); + } else { + settings.beginGroup("mainWindow"); + mw->restoreState (settings.value("state").toByteArray()); + settings.endGroup(); + } + } + + void Settings::saveState () const + { + QSettings settings (QSettings::SystemScope, + QCoreApplication::organizationName (), + getQSettingsFileName (stateConf)); + if (settings.status() != QSettings::NoError) { + qDebug () << "Could not save the window state to" << settings.fileName(); + } else { + settings.beginGroup("mainWindow"); + settings.setValue("geometry", mw->saveGeometry()); + settings.setValue("state" , mw->saveState()); + settings.setValue("centralWidgetVisibility", mw->centralWidget()->isVisible ()); + settings.endGroup(); +#if GEPETTO_GUI_HAS_PYTHONQT + mw->pythonWidget()->saveHistory(settings); +#endif + } + } + void Settings::setMainWindow(gepetto::gui::MainWindow *main) { mw = main; diff --git a/src/gui/shortcut-factory.cc b/src/gui/shortcut-factory.cc index bc602d7d90ccda1c86a7b7828bcd891cdc7e422b..39bccfa7caeffecd03b0496760ea902e1c8dd5a1 100644 --- a/src/gui/shortcut-factory.cc +++ b/src/gui/shortcut-factory.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include <iostream> #include <QScrollArea> #include <QLabel> diff --git a/src/gui/tree-item.cc b/src/gui/tree-item.cc index 11c2d59750a6b5ec52e1b7e5f3fe343c93d08dc6..75fbf0f5f2293f8f1bbf0184c25b047d2ea3a86c 100644 --- a/src/gui/tree-item.cc +++ b/src/gui/tree-item.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/tree-item.hh" #include <QDebug> @@ -90,11 +106,6 @@ namespace gepetto { mode.toLocal8Bit().data()); } - void BodyTreeItem::attachToWindow(unsigned int windowID) - { - MainWindow::instance()->osg()->addSceneToWindow (node_->getID(), windowID); - } - void BodyTreeItem::removeFromGroup() { if (parentGroup_.empty()) return; diff --git a/src/gui/windows-manager.cc b/src/gui/windows-manager.cc index 1f58fd4d43aef335c8ba208cb51db8de27b0e68b..7e1b0f0a285ac8a44abb7056e61306f3f7f6f93f 100644 --- a/src/gui/windows-manager.cc +++ b/src/gui/windows-manager.cc @@ -1,3 +1,19 @@ +// Copyright (c) 2015-2018, LAAS-CNRS +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of gepetto-viewer-corba. +// gepetto-viewer-corba is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// gepetto-viewer-corba is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>. + #include "gepetto/gui/windows-manager.hh" #include <gepetto/viewer/window-manager.h> diff --git a/src/windows-manager.cpp b/src/windows-manager.cpp index 34be9af17b77be0b1ca6ce8010e7c140c9f218b1..8ec5df35c46322565bba7b805b4180d2acbc4bd8 100644 --- a/src/windows-manager.cpp +++ b/src/windows-manager.cpp @@ -956,6 +956,35 @@ namespace graphics { return true; } + bool WindowsManager::applyConfigurations (const std::vector<std::string>& nodeNames, + const std::vector<Configuration>& configurations) + { + if (nodeNames.size() != configurations.size()) + throw std::invalid_argument ("Number of node names and configurations must be equal."); + + newNodeConfigurations_.reserve ( + newNodeConfigurations_.capacity() + nodeNames.size()); + + bool success = true; + scoped_lock lock(configListMtx_); + for (std::size_t i = 0; i < nodeNames.size(); ++i) { + NodePtr_t updatedNode = getNode (nodeNames[i], false); + if (!updatedNode) { + success = false; + continue; + } + + NodeConfiguration newNodeConfiguration; + newNodeConfiguration.node = updatedNode; + newNodeConfiguration.position = configurations[i].position; + newNodeConfiguration.quat = configurations[i].quat; + + newNodeConfigurations_.push_back (newNodeConfiguration); + } + + return success; + } + bool WindowsManager::addLandmark (const std::string& nodeName, float size) {