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
57b5b3f8
Commit
57b5b3f8
authored
7 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add Matplotlib python widget
parent
3dcf1cae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyplugins/CMakeLists.txt
+2
-0
2 additions, 0 deletions
pyplugins/CMakeLists.txt
pyplugins/gepetto/gui/matplotlib_example.py
+36
-0
36 additions, 0 deletions
pyplugins/gepetto/gui/matplotlib_example.py
pyplugins/gepetto/gui/matplotlibwidget.py
+24
-0
24 additions, 0 deletions
pyplugins/gepetto/gui/matplotlibwidget.py
with
62 additions
and
0 deletions
pyplugins/CMakeLists.txt
+
2
−
0
View file @
57b5b3f8
...
...
@@ -19,6 +19,8 @@ INSTALL(
FILES
${
CMAKE_CURRENT_SOURCE_DIR
}
/gepetto/gui/pythonwidget.py
${
CMAKE_CURRENT_SOURCE_DIR
}
/gepetto/gui/blenderexport.py
${
CMAKE_CURRENT_SOURCE_DIR
}
/gepetto/gui/matplotlibwidget.py
${
CMAKE_CURRENT_SOURCE_DIR
}
/gepetto/gui/matplotlib_example.py
${
CMAKE_CURRENT_SOURCE_DIR
}
/gepetto/gui/__init__.py
DESTINATION
${
PYTHON_SITELIB
}
/gepetto/gui
)
This diff is collapsed.
Click to expand it.
pyplugins/gepetto/gui/matplotlib_example.py
0 → 100644
+
36
−
0
View file @
57b5b3f8
from
PythonQt
import
QtGui
,
Qt
from
gepetto.corbaserver
import
Client
import
numpy
as
np
from
gepetto.gui.matplotlibwidget
import
MatplotlibWidget
class
Plugin
(
QtGui
.
QDockWidget
):
"""
Example of plugin using matplotlib
"""
def
__init__
(
self
,
mainWindow
,
flags
=
None
):
if
flags
is
None
:
super
(
Plugin
,
self
).
__init__
(
"
Matplotlib example plugin
"
,
mainWindow
)
else
:
super
(
Plugin
,
self
).
__init__
(
"
Matplotlib example plugin
"
,
mainWindow
,
flags
)
self
.
setObjectName
(
"
Matplotlib example plugin
"
)
self
.
client
=
Client
()
# This avoids having a widget bigger than what it needs. It avoids having
# a big dock widget and a small osg widget when creating the main osg widget.
p
=
Qt
.
QSizePolicy
.
Ignored
self
.
testWidget
=
MatplotlibWidget
(
self
,
True
)
self
.
testWidget
.
setSizePolicy
(
Qt
.
QSizePolicy
(
p
,
p
))
self
.
setWidget
(
self
.
testWidget
)
# Plot something
x
=
np
.
linspace
(
0
,
10
,
num
=
100
)
y
=
np
.
sin
(
x
)
self
.
testWidget
.
figure
.
gca
().
plot
(
x
,
y
)
### If present, this function is called when a new OSG Widget is created.
def
osgWidget
(
self
,
osgWindow
):
pass
def
resetConnection
(
self
):
self
.
client
=
Client
()
This diff is collapsed.
Click to expand it.
pyplugins/gepetto/gui/matplotlibwidget.py
0 → 100644
+
24
−
0
View file @
57b5b3f8
from
matplotlib.figure
import
Figure
import
matplotlib.pyplot
as
plt
from
pythonqt.matplotlib.backends.backend_qt4agg
import
FigureCanvasQTAgg
,
NavigationToolbar2QT
from
PythonQt
import
QtGui
,
Qt
from
gepetto.corbaserver
import
Client
import
numpy
as
np
### This class represents one special tab of the new QDockWidget
class
MatplotlibWidget
(
QtGui
.
QWidget
):
def
__init__
(
self
,
parent
,
withToolbar
=
False
):
super
(
MatplotlibWidget
,
self
).
__init__
(
parent
)
box
=
QtGui
.
QVBoxLayout
(
self
)
# Create a figure
self
.
figure
=
Figure
(
figsize
=
(
5
,
5
),
dpi
=
96
)
# self.figure = Figure()
self
.
canvas
=
FigureCanvasQTAgg
(
self
.
figure
)
box
.
addWidget
(
self
.
canvas
)
if
withToolbar
:
self
.
toolbar
=
NavigationToolbar2QT
(
self
.
canvas
,
parent
,
False
)
box
.
addWidget
(
self
.
toolbar
)
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