GCC Code Coverage Report


Directory: ./
File: src/gui/python-decorator.hh
Date: 2024-12-20 15:53:58
Exec Total Coverage
Lines: 0 13 0.0%
Branches: 0 12 0.0%

Line Branch Exec Source
1 // Copyright (c) 2015-2018, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of gepetto-viewer.
5 // gepetto-viewer is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // gepetto-viewer is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // gepetto-viewer. If not, see <http://www.gnu.org/licenses/>.
16
17 #ifndef GEPETTO_GUI_PYTHON_DECORATOR_HH
18 #define GEPETTO_GUI_PYTHON_DECORATOR_HH
19
20 #include <PythonQt.h>
21
22 #include <boost/python.hpp>
23 #include <gepetto/gui/mainwindow.hh>
24 #include <gepetto/gui/osgwidget.hh>
25 #include <gepetto/gui/windows-manager.hh>
26
27 namespace gepetto {
28 namespace gui {
29 class PythonDecorator : public QObject {
30 Q_OBJECT
31
32 public slots:
33 /// \name MainWindow
34 /// \{
35
36 MainWindow* static_MainWindow_instance() const {
37 return MainWindow::instance();
38 }
39
40 QList<OSGWidget*> osgWindows(MainWindow* w) const { return w->osgWindows(); }
41
42 PyObject* osg(MainWindow* w) const {
43 boost::python::object obj(boost::python::ptr(w->osg().get()));
44 boost::python::incref(obj.ptr());
45 return obj.ptr();
46 }
47
48 QObject* getFromSlot(MainWindow* w, const char* slot) const {
49 return w->getFromSlot(slot);
50 }
51
52 OSGWidget* createView(MainWindow* w, const QString& name) const {
53 return w->createView(name.toStdString());
54 }
55
56 /// \}
57
58 /// \name OSGWidget
59 /// \{
60
61 QString windowID(OSGWidget* o) const {
62 return QString::fromStdString(o->windowID());
63 }
64
65 /// \}
66 };
67 } // namespace gui
68 } // namespace gepetto
69
70 #endif // GEPETTO_GUI_PYTHON_DECORATOR_HH
71