Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gepetto-viewer-corba
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gepetto
gepetto-viewer-corba
Commits
b4783a20
Commit
b4783a20
authored
8 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Expose resetConnection signal to Python and update the doc.
parent
e92240e9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/gepetto/gui/pythonwidget.hh
+31
-7
31 additions, 7 deletions
include/gepetto/gui/pythonwidget.hh
pyplugins/gepetto/gui/pythonwidget.py
+1
-0
1 addition, 0 deletions
pyplugins/gepetto/gui/pythonwidget.py
src/gui/pythonwidget.cc
+9
-1
9 additions, 1 deletion
src/gui/pythonwidget.cc
with
41 additions
and
8 deletions
include/gepetto/gui/pythonwidget.hh
+
31
−
7
View file @
b4783a20
...
...
@@ -23,29 +23,46 @@ namespace gepetto {
/// \ingroup plugin
/// Python plugin interface
///
/// ## Overview
///
/// A Python plugin is a Python module containing a class Plugin, with a
/// constructor taking a pointer to the MainWindow as input.
///
/// For instance, if you have \code gepetto.gui=true \endcode in your
/// configuration file, then the Plugin class will be accessed via:
/// For instance, if you have
/// \code
/// [pyplugins]
/// module.submodule=true
/// \endcode
/// in your configuration file (Settings::readSettingFile), then the Plugin
/// class will be accessed by the GUI in a way similar to:
///
/// \code{py}
/// from
gepetto.gui
import Plugin
/// from
module.submodule
import Plugin
/// pluginInstance = Plugin(mainWindow)
/// \endcode
///
/// It may interact with the interface in
two
following ways.
/// It may interact with the interface in following ways.
///
///
pyplugin_dockwidget
Add a dock widget:
///
###
Add a dock widget:
///
/// Your plugin may inherits from class PythonQt.QtGui.QDockWidget.
/// In this case, an instance of the Plugin will be added to the MainWindow
/// as a QDockWidget.
///
///
pyplugin_signals
Signals and slots:
///
###
Signals and slots:
///
/// The following method will be automatically connected to Qt signals:
/// \li MainWindow::viewCreated(OSGWidget*) -> Plugin.osgWidget
/// \li \c Plugin.osgWidget when a new OSGWidget is created (MainWindow::viewCreated(OSGWidget*))
/// \li \c Plugin.resetConnection triggered when CORBA connection should be reset.
///
/// ### Logging
///
/// Logging can be done from Python through:
/// \li MainWindow::log(const QString&)
/// \li MainWindow::logError(const QString&)
/// \li MainWindow::logJobStarted, MainWindow::logJobDone and
/// MainWindow::logJobFailed to inform users when
/// something may take some time.
///
/// \sa See example \ref pyplugins/gepetto/gui/pythonwidget.py
class
PythonWidget
:
public
QDockWidget
...
...
@@ -93,6 +110,13 @@ namespace gepetto {
/// This is an example Python Plugin for \link hpp::gui::PythonWidget \endlink. Two classes are defined:
/// \b _NodeCreator and \b Plugin. Two signals are used: \a mainWindow.refresh()
/// and \a osgWidget.
/// Add this to your configuration file to load this plugin
/// \code
/// [pyplugins]
/// gepetto.gui=true
/// \endcode
/// Then right-click on a tool bar, menu bar or title bar of dock widgets
/// to open your window.
}
// namespace gui
}
// namespace gepetto
...
...
This diff is collapsed.
Click to expand it.
pyplugins/gepetto/gui/pythonwidget.py
+
1
−
0
View file @
b4783a20
...
...
@@ -53,6 +53,7 @@ class _NodeCreator (QtGui.QWidget):
def
createGroup
(
self
):
self
.
client
.
gui
.
createGroup
(
str
(
self
.
nodeName
.
text
))
self
.
groupNodes
.
addItem
(
self
.
nodeName
.
text
)
def
addToGroup
(
self
):
self
.
client
.
gui
.
addToGroup
(
str
(
self
.
nodeName
.
text
),
str
(
self
.
groupNodes
.
currentText
))
...
...
This diff is collapsed.
Click to expand it.
src/gui/pythonwidget.cc
+
9
−
1
View file @
b4783a20
...
...
@@ -128,8 +128,16 @@ namespace gepetto {
void
PythonWidget
::
addSignalHandlersToPlugin
(
PythonQtObjectPtr
plugin
)
{
MainWindow
*
main
=
MainWindow
::
instance
();
addSignalHandler
(
plugin
,
"osgWidget"
,
MainWindow
::
instance
(),
SIGNAL
(
viewCreated
(
OSGWidget
*
)));
main
,
SIGNAL
(
viewCreated
(
OSGWidget
*
)));
QAction
*
reconnect
=
main
->
findChild
<
QAction
*>
(
"actionReconnect"
);
if
(
reconnect
)
addSignalHandler
(
plugin
,
"resetConnection"
,
reconnect
,
SIGNAL
(
triggered
()));
else
qDebug
()
<<
"Could not find actionReconnect button. The plugin will"
<<
"not be able to reset CORBA connections"
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment