gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
pythonwidget.hh
Go to the documentation of this file.
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_PYTHONWIDGET_HH
18#define GEPETTO_GUI_PYTHONWIDGET_HH
19
20#include <gepetto/gui/fwd.hh>
21// This include must be include before any other Qt include for GLDEBUGPROC
23
24#if !GEPETTO_GUI_HAS_PYTHONQT
25#error "gepetto-viewer was not compile with PythonQt dependency."
26#endif
27
28#include <QDockWidget>
29#include <QLayout>
30#include <QPushButton>
31#include <QSettings>
32#include <QVariant>
33
34class PythonQtObjectPtr;
35class PythonQtScriptingConsole;
36
37namespace gepetto {
38namespace gui {
90class PythonWidget : public QDockWidget {
91 Q_OBJECT
92 public:
93 explicit PythonWidget(QWidget* parent = 0);
94 void addToContext(QString const& name, QObject* obj);
95 virtual ~PythonWidget();
96
99 QVariantList callPluginMethod(
100 const QString& method, const QVariantList& args = QVariantList(),
101 const QVariantMap& kwargs = QVariantMap()) const;
102
103 void saveHistory(QSettings& settings);
104 void restoreHistory(QSettings& settings);
105
106 bool hasPlugin(const QString& name);
107
108 public slots:
122 void loadModulePlugin(QString moduleName);
123 void unloadModulePlugin(QString moduleName);
124 void loadScriptPlugin(QString moduleName, QString fileName);
125 void runScript(QString fileName);
126
127 private:
128 void loadPlugin(QString moduleName, PythonQtObjectPtr module);
129 void unloadModulePlugin(PythonQtObjectPtr module);
130
131 void addSignalHandlersToPlugin(PythonQtObjectPtr plugin);
132
133 PythonQtScriptingConsole* console_;
134 QPushButton* button_;
135 QMap<QString, PythonQtObjectPtr> modules_;
136
137 signals:
138
139 public slots:
141};
152} // namespace gui
153} // namespace gepetto
154
155#endif // GEPETTO_GUI_PYTHONWIDGET_HH
Definition pythonwidget.hh:90
void saveHistory(QSettings &settings)
PythonWidget(QWidget *parent=0)
void addToContext(QString const &name, QObject *obj)
void runScript(QString fileName)
void loadModulePlugin(QString moduleName)
QVariantList callPluginMethod(const QString &method, const QVariantList &args=QVariantList(), const QVariantMap &kwargs=QVariantMap()) const
void unloadModulePlugin(QString moduleName)
bool hasPlugin(const QString &name)
void restoreHistory(QSettings &settings)
void loadScriptPlugin(QString moduleName, QString fileName)
Definition action-search-bar.hh:27