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
f06810c1
Commit
f06810c1
authored
6 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Improve QCustomPlot python bindings
parent
f9c05e26
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
plugins/pyqcustomplot/decorator.cc
+2
-1
2 additions, 1 deletion
plugins/pyqcustomplot/decorator.cc
plugins/pyqcustomplot/decorator.hh
+45
-140
45 additions, 140 deletions
plugins/pyqcustomplot/decorator.hh
plugins/pyqcustomplot/plugin.hh
+2
-0
2 additions, 0 deletions
plugins/pyqcustomplot/plugin.hh
with
49 additions
and
141 deletions
plugins/pyqcustomplot/decorator.cc
+
2
−
1
View file @
f06810c1
...
...
@@ -25,7 +25,6 @@ void registerQCustomPlot ()
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"
);
...
...
@@ -49,4 +48,6 @@ void registerQCustomPlot ()
PythonQt
::
self
()
->
registerCPPClass
(
"QCPLayout"
,
"QCPLayoutElement"
,
"QCustomPlot"
);
PythonQt
::
self
()
->
registerCPPClass
(
"QCPLayoutGrid"
,
"QCPLayout"
,
"QCustomPlot"
);
PythonQt
::
self
()
->
registerCPPClass
(
"QCPLegend"
,
"QCPLayoutGrid"
,
"QCustomPlot"
);
PythonQt
::
self
()
->
registerCPPClass
(
"QCPAxis"
,
"QCPLayerable"
,
"QCustomPlot"
);
}
This diff is collapsed.
Click to expand it.
plugins/pyqcustomplot/decorator.hh
+
45
−
140
View file @
f06810c1
...
...
@@ -9,15 +9,16 @@ class QCustomPlotDecorator : public QObject
Q_OBJECT
public
Q_SLOTS
:
// add a constructor
QCustomPlot
*
new_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
;
}
/// \name QCustomPlot
/// \{
void
clearGraphs
(
QCustomPlot
*
o
)
//add a graph inside the QCustomPlot object
{
o
->
clearGraphs
();
...
...
@@ -74,161 +75,58 @@ class QCustomPlotDecorator : public QObject
{
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
)
{
o
->
yAxis
->
setRange
(
position
,
size
);
}
void
yAxis_setAutoTicks
(
QCustomPlot
*
o
,
bool
on
)
{
o
->
yAxis
->
setAutoSubTicks
(
on
);
}
void
yAxis_setAutoTickLabels
(
QCustomPlot
*
o
,
bool
on
)
{
o
->
yAxis
->
setAutoTickLabels
(
on
);
}
void
yAxis_setTickVector
(
QCustomPlot
*
o
,
const
QVector
<
double
>
&
ticks
)
{
o
->
yAxis
->
setTickVector
(
ticks
);
}
void
yAxis_setTickVectorLabels
(
QCustomPlot
*
o
,
const
QVector
<
QString
>
&
labels
)
{
o
->
yAxis
->
setTickVectorLabels
(
labels
);
}
void
yAxis_setTickLength
(
QCustomPlot
*
o
,
int
inside
,
int
outside
)
{
o
->
yAxis
->
setTickLength
(
inside
,
outside
);
}
void
yAxis_setSubTickLength
(
QCustomPlot
*
o
,
int
inside
,
int
outside
)
{
o
->
yAxis
->
setSubTickLength
(
inside
,
outside
);
}
//yAxis2 stuff
void
yAxis2_setLabel
(
QCustomPlot
*
o
,
const
QString
text
)
void
setInteraction
(
QCustomPlot
*
o
,
int
interaction
,
bool
enabled
=
true
)
{
o
->
yAxis2
->
setLabel
(
text
);
o
->
setInteraction
((
QCP
::
Interaction
)
interaction
,
enabled
);
}
void
yAxis2_setVisible
(
QCustomPlot
*
o
,
bool
visible
)
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
;
}
/// \}
/// \name QCPAxis
/// \{
void
setLabel
(
QCPAxis
*
a
,
const
QString
text
)
{
o
->
set
Visible
(
visible
);
a
->
set
Label
(
text
);
}
void
yAxis2_
setRange
(
QC
ustomPlot
*
o
,
double
position
,
double
size
)
void
setRange
(
QC
PAxis
*
a
,
double
position
,
double
size
)
{
o
->
yAxis2
->
setRange
(
position
,
size
);
a
->
setRange
(
position
,
size
);
}
void
yAxis2_
setAutoTicks
(
QC
ustomPlot
*
o
,
bool
on
)
void
setAutoTicks
(
QC
PAxis
*
a
,
bool
on
)
{
o
->
yAxis2
->
setAutoSubTicks
(
on
);
a
->
setAutoSubTicks
(
on
);
}
void
yAxis2_
setAutoTickLabels
(
QC
ustomPlot
*
o
,
bool
on
)
void
setAutoTickLabels
(
QC
PAxis
*
a
,
bool
on
)
{
o
->
yAxis2
->
setAutoTickLabels
(
on
);
a
->
setAutoTickLabels
(
on
);
}
void
yAxis2_
setTickVector
(
QC
ustomPlot
*
o
,
const
QVector
<
double
>
&
ticks
)
void
setTickVector
(
QC
PAxis
*
a
,
const
QVector
<
double
>
&
ticks
)
{
o
->
yAxis2
->
setTickVector
(
ticks
);
a
->
setTickVector
(
ticks
);
}
void
yAxis2_
setTickVectorLabels
(
QC
ustomPlot
*
o
,
const
QVector
<
QString
>
&
labels
)
void
setTickVectorLabels
(
QC
PAxis
*
a
,
const
QVector
<
QString
>
&
labels
)
{
o
->
yAxis2
->
setTickVectorLabels
(
labels
);
a
->
setTickVectorLabels
(
labels
);
}
void
yAxis2_
setTickLength
(
QC
ustomPlot
*
o
,
int
inside
,
int
outside
)
void
setTickLength
(
QC
PAxis
*
a
,
int
inside
,
int
outside
)
{
o
->
yAxis2
->
setTickLength
(
inside
,
outside
);
a
->
setTickLength
(
inside
,
outside
);
}
void
yAxis2_
setSubTickLength
(
QC
ustomPlot
*
o
,
int
inside
,
int
outside
)
void
setSubTickLength
(
QC
PAxis
*
a
,
int
inside
,
int
outside
)
{
o
->
yAxis2
->
setSubTickLength
(
inside
,
outside
);
a
->
setSubTickLength
(
inside
,
outside
);
}
//Interaction
void
setInteraction
(
QCustomPlot
*
o
,
int
interaction
,
bool
enabled
=
true
)
double
pixelToCoord
(
QCPAxis
*
a
,
double
pixel
)
{
o
->
setInteraction
((
QCP
::
Interaction
)
interaction
,
enabled
);
return
a
->
pixelToCoord
(
pixel
);
}
//QCPGraph
/// \}
/// \name QCPGraph
/// \{
void
rescaleAxes
(
QCPGraph
*
g
,
bool
v
=
true
)
{
g
->
rescaleAxes
(
v
);
...
...
@@ -245,14 +143,21 @@ class QCustomPlotDecorator : public QObject
{
g
->
setPen
(
pen
);
}
//QCPAbstractPlottable
/// \}
/// \name QCPAbstractPlottable
/// \{
void
setName
(
QCPAbstractPlottable
*
ap
,
const
QString
&
n
)
{
ap
->
setName
(
n
);
}
//QCPLayerable
/// \}
/// \name QCPLayerable
/// \{
void
setVisible
(
QCPLayerable
*
l
,
const
bool
&
v
)
{
l
->
setVisible
(
v
);
}
/// \}
};
This diff is collapsed.
Click to expand it.
plugins/pyqcustomplot/plugin.hh
+
2
−
0
View file @
f06810c1
...
...
@@ -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]
...
...
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