Commit 94da3c44 authored by Locatelli's avatar Locatelli
Browse files

Create custom PythonObject for managing delete

parent a7fdb7f2
......@@ -49,7 +49,7 @@ MplEventManager::MplEventManager() {
*/
MplEventManager::~MplEventManager() {
MplLock lock;
m_ModuleEvent = bp::object();
m_ModuleEvent.reset();
}
/*
......@@ -95,31 +95,31 @@ MplEventManager* MplEventManager::getInstance() {
/*
* subscriberXLimChanged
*/
void MplEventManager::subscribeXLimChanged(bp::object* obj, MplEventSubscriber* subscriber) throw (Error) {
void MplEventManager::subscribeXLimChanged(const view::mpl::PythonObject& obj, MplEventSubscriber* subscriber) throw (Error) {
MplLock mpllock;
unique_lock<recursive_mutex> lock(m_XLimChangedMutex);
if (m_XLimChangedSubcribers.find(obj) == m_XLimChangedSubcribers.end()) {
if (m_XLimChangedSubcribers.find(&obj) == m_XLimChangedSubcribers.end()) {
// Connect pick event
auto args = bp::make_tuple("xlim_changed", m_ModuleEvent.attr("xlim_changed"));
uint32 eventid = bp::extract<uint32>(obj->attr("callbacks").attr("connect")(*args));
uint32 eventid = bp::extract<uint32>(obj.attr("callbacks").attr("connect")(*args));
// Add to map
m_XLimChangedSubcribers[obj] = subscriber;
m_XLimChanged[obj] = eventid;
m_XLimChangedSubcribers[&obj] = subscriber;
m_XLimChanged[&obj] = eventid;
}
}
/*
* unsubscriberXLimChanged
*/
void MplEventManager::unsubscribeXLimChanged(bp::object* obj) throw (Error) {
void MplEventManager::unsubscribeXLimChanged(const view::mpl::PythonObject& obj) throw (Error) {
MplLock mpllock;
unique_lock<recursive_mutex> lock(m_XLimChangedMutex);
// remove subscriber from map
if (m_XLimChangedSubcribers.find(obj) != m_XLimChangedSubcribers.end()) {
auto args = bp::make_tuple(m_XLimChanged[obj]);
obj->attr("callbacks").attr("disconnect")(*args);
m_XLimChangedSubcribers.erase(obj);
m_XLimChanged.erase(obj);
if (m_XLimChangedSubcribers.find(&obj) != m_XLimChangedSubcribers.end()) {
auto args = bp::make_tuple(m_XLimChanged[&obj]);
obj.attr("callbacks").attr("disconnect")(*args);
m_XLimChangedSubcribers.erase(&obj);
m_XLimChanged.erase(&obj);
}
}
......@@ -144,31 +144,31 @@ void MplEventManager::xlimChanged(PyObject *self, PyObject* event) {
/*
* subscriberYLimChanged
*/
void MplEventManager::subscribeYLimChanged(bp::object* obj, MplEventSubscriber* subscriber) throw (Error) {
void MplEventManager::subscribeYLimChanged(const view::mpl::PythonObject& obj, MplEventSubscriber* subscriber) throw (Error) {
MplLock mpllock;
unique_lock<recursive_mutex> lock(m_YLimChangedMutex);
if (m_YLimChangedSubcribers.find(obj) == m_YLimChangedSubcribers.end()) {
if (m_YLimChangedSubcribers.find(&obj) == m_YLimChangedSubcribers.end()) {
// Connect pick event
auto args = bp::make_tuple("ylim_changed", m_ModuleEvent.attr("ylim_changed"));
int32 eventid = bp::extract<int32>(obj->attr("callbacks").attr("connect")(*args));
int32 eventid = bp::extract<int32>(obj.attr("callbacks").attr("connect")(*args));
// Add to map
m_YLimChangedSubcribers[obj] = subscriber;
m_YLimChanged[obj] = eventid;
m_YLimChangedSubcribers[&obj] = subscriber;
m_YLimChanged[&obj] = eventid;
}
}
/*
* unsubscriberYLimChanged
*/
void MplEventManager::unsubscribeYLimChanged(bp::object* obj) throw (Error) {
void MplEventManager::unsubscribeYLimChanged(const view::mpl::PythonObject& obj) throw (Error) {
MplLock mpllock;
unique_lock<recursive_mutex> lock(m_YLimChangedMutex);
// remove subscriber from map
if (m_YLimChangedSubcribers.find(obj) != m_YLimChangedSubcribers.end()) {
auto args = bp::make_tuple(m_YLimChanged[obj]);
obj->attr("callbacks").attr("disconnect")(*args);
m_YLimChangedSubcribers.erase(obj);
m_YLimChanged.erase(obj);
if (m_YLimChangedSubcribers.find(&obj) != m_YLimChangedSubcribers.end()) {
auto args = bp::make_tuple(m_YLimChanged[&obj]);
obj.attr("callbacks").attr("disconnect")(*args);
m_YLimChangedSubcribers.erase(&obj);
m_YLimChanged.erase(&obj);
}
}
......
......@@ -23,6 +23,7 @@
#include <map>
#include <mutex>
#include "view/mpl/Mpl.h"
#include "view/mpl/PythonObject.h"
#include "MplEventSubscriber.h"
#include "Trace.h"
......@@ -63,13 +64,13 @@ public:
* \param[in] subscriber The subscriber for this event
* \throws Error
*/
void subscribeXLimChanged(bp::object* obj, MplEventSubscriber* subscriber) throw (Error);
void subscribeXLimChanged(const view::mpl::PythonObject& obj, MplEventSubscriber* subscriber) throw (Error);
/*!
* \brief Unsubscribe to a xlim changed event
* \param[in] obj Python Object reference
*/
void unsubscribeXLimChanged(bp::object* obj) throw (Error);
void unsubscribeXLimChanged(const view::mpl::PythonObject& obj) throw (Error);
/*!
* \brief Subscribe to a xlim changed event
......@@ -98,13 +99,13 @@ public:
* \param[in] subscriber The subscriber for this event
* \throws Error
*/
void subscribeYLimChanged(bp::object* obj, MplEventSubscriber* subscriber) throw (Error);
void subscribeYLimChanged(const view::mpl::PythonObject& obj, MplEventSubscriber* subscriber) throw (Error);
/*!
* \brief Unsubscribe to a ylim changed event
* \param[in] obj Python Object reference
*/
void unsubscribeYLimChanged(bp::object* obj) throw (Error);
void unsubscribeYLimChanged(const view::mpl::PythonObject& obj) throw (Error);
/*!
* \brief Subscribe to a ylim changed event
......@@ -148,16 +149,16 @@ private:
std::shared_ptr<view::mpl::Mpl> m_mpl; //! Mpl object (python matplotlib)
bp::object m_ModuleEvent; // Custom Ploty2 module for getting mpl gui event
view::mpl::PythonObject m_ModuleEvent; // Custom Ploty2 module for getting mpl gui event
bool m_BypassXLimChanged; //! By pass xlim changed event flag
std::map<bp::object*, MplEventSubscriber*> m_XLimChangedSubcribers; //! Map of xlim changed event subscriber
std::map<bp::object*, int32> m_XLimChanged; //! Map of xlim changed event subscriber
std::map<const view::mpl::PythonObject*, MplEventSubscriber*> m_XLimChangedSubcribers; //! Map of xlim changed event subscriber
std::map<const view::mpl::PythonObject*, int32> m_XLimChanged; //! Map of xlim changed event subscriber
std::recursive_mutex m_XLimChangedMutex; //! Mutex on the PickEvent Subcribers
bool m_BypassYLimChanged; //! By pass ylim changed event flag
std::map<bp::object*, MplEventSubscriber*> m_YLimChangedSubcribers; //! Map of ylim changed event subscriber
std::map<bp::object*, int32> m_YLimChanged; //! Map of ylim changed event subscriber
std::map<const view::mpl::PythonObject*, MplEventSubscriber*> m_YLimChangedSubcribers; //! Map of ylim changed event subscriber
std::map<const view::mpl::PythonObject*, int32> m_YLimChanged; //! Map of ylim changed event subscriber
std::recursive_mutex m_YLimChangedMutex; //! Mutex on the PickEvent Subcribers
};
......
......@@ -52,8 +52,8 @@ Plot2D::Plot2D(const std::string& plotkey, view::mpl::Mpl& mpl, PlotWindow* plot
Plot2D::~Plot2D() {
if (m_PlotWindow != nullptr) {
// Unsubscribe limits changed events
manager::mpl::MplEventManager::getInstance()->unsubscribeXLimChanged(&m_MplPlot2D.getMainAxis());
manager::mpl::MplEventManager::getInstance()->unsubscribeYLimChanged(&m_MplPlot2D.getMainAxis());
manager::mpl::MplEventManager::getInstance()->unsubscribeXLimChanged(m_MplPlot2D.getMainAxis());
manager::mpl::MplEventManager::getInstance()->unsubscribeYLimChanged(m_MplPlot2D.getMainAxis());
}
}
......@@ -204,8 +204,8 @@ void Plot2D::display() throw (Error) {
}
// Subscribe for event manager
manager::mpl::MplEventManager::getInstance()->subscribeXLimChanged(&m_MplPlot2D.getMainAxis(), this);
manager::mpl::MplEventManager::getInstance()->subscribeYLimChanged(&m_MplPlot2D.getMainAxis(), this);
manager::mpl::MplEventManager::getInstance()->subscribeXLimChanged(m_MplPlot2D.getMainAxis(), this);
manager::mpl::MplEventManager::getInstance()->subscribeYLimChanged(m_MplPlot2D.getMainAxis(), this);
}
///////////////////////////////////////////////////////////////////////////////////////
......
......@@ -67,7 +67,7 @@ void PlotWindow::create(QApplication& app, std::shared_ptr<cameo::application::S
try {
m_MplFigure = make_unique<view::mpl::MplFigure>(*m_Mpl, true);
m_QtWindow = make_unique<view::qt::QtWindow>(view::extract<QWidget>(m_MplFigure->getCanvas()), app, subscriber);
m_QtWindow = make_unique<view::qt::QtWindow>(view::extract<QWidget>(m_MplFigure->getCanvas()()), app, subscriber);
manager::InterfaceManager::getInstance()->init(m_QtWindow.get());
......
......@@ -60,7 +60,7 @@ Mpl::Mpl() throw (Error) {
PyEval_InitThreads();
// Import the matplotlib module
bp::object matplotlib;
PythonObject matplotlib;
try {
matplotlib = bp::import(bp::str("matplotlib"));
} catch(...) {
......@@ -105,7 +105,7 @@ Mpl::Mpl() throw (Error) {
}
try {
bp::object widgetsModule = bp::import(bp::str("matplotlib.colors"));
PythonObject widgetsModule = bp::import(bp::str("matplotlib.colors"));
m_NormalNorm = widgetsModule.attr("Normalize")();
m_LogNorm = widgetsModule.attr("LogNorm")();
} catch (...) {
......@@ -151,16 +151,16 @@ Mpl::Mpl() throw (Error) {
*/
Mpl::~Mpl() {
{
m_PyPlot = bp::object();
m_FigureModule = bp::object();
m_LinesModule = bp::object();
m_TextModule = bp::object();
m_NormalNorm = bp::object();
m_LogNorm = bp::object();
m_BackendsModule = bp::object();
m_WidgetsModule = bp::object();
m_PatchesModule = bp::object();
m_GarbageCollector = bp::object();
m_PyPlot.reset();
m_FigureModule.reset();
m_LinesModule.reset();
m_TextModule.reset();
m_NormalNorm.reset();
m_LogNorm.reset();
m_BackendsModule.reset();
m_WidgetsModule.reset();
m_PatchesModule.reset();
m_GarbageCollector.reset();
}
Py_Finalize();
}
......@@ -168,7 +168,7 @@ Mpl::~Mpl() {
/*
* close
*/
void Mpl::close(const bp::object& figure) throw (Error) {
void Mpl::close(const PythonObject& figure) throw (Error) {
MplLock lock;
// Create matplotlib figure object
......@@ -194,10 +194,10 @@ void Mpl::garbageCollect() throw (Error) {
/*
* xlabel
*/
void Mpl::xlabel(const bp::object& axis, const std::string& name) throw (Error) {
void Mpl::xlabel(const PythonObject& axis, const std::string& name) throw (Error) {
mpl::MplLock lock;
try {
bp::call_method<void, const char *>(axis.ptr(), "set_xlabel", name.c_str());
bp::call_method<void, const char *>(axis().ptr(), "set_xlabel", name.c_str());
} catch (...) {
throw Error("Mpl", "xlabel", "Error when executing xlabel method");
}
......@@ -206,10 +206,10 @@ void Mpl::xlabel(const bp::object& axis, const std::string& name) throw (Error)
/*
* ylabel
*/
void Mpl::ylabel(const bp::object& axis, const std::string& name) throw (Error) {
void Mpl::ylabel(const PythonObject& axis, const std::string& name) throw (Error) {
mpl::MplLock lock;
try {
bp::call_method<void, const char *>(axis.ptr(), "set_ylabel", name.c_str());
bp::call_method<void, const char *>(axis().ptr(), "set_ylabel", name.c_str());
} catch (...) {
throw Error("Mpl", "ylabel", "Error when executing ylabel method");
}
......@@ -218,7 +218,7 @@ void Mpl::ylabel(const bp::object& axis, const std::string& name) throw (Error)
/*
* grid
*/
void Mpl::grid(const bp::object& axis, bool show) throw (Error) {
void Mpl::grid(const PythonObject& axis, bool show) throw (Error) {
mpl::MplLock lock;
bp::tuple args;
if (show == true) {
......@@ -237,7 +237,7 @@ void Mpl::grid(const bp::object& axis, bool show) throw (Error) {
/*
* savefig
*/
void Mpl::savefig(const bp::object& figure, const std::string& filename, uint32 dpi, float64 pad) throw (Error) {
void Mpl::savefig(const PythonObject& figure, const std::string& filename, uint32 dpi, float64 pad) throw (Error) {
mpl::MplLock lock;
auto args = bp::make_tuple(filename);
bp::dict kwargs;
......@@ -257,7 +257,7 @@ void Mpl::savefig(const bp::object& figure, const std::string& filename, uint32
/*
* get_xlim
*/
std::pair<float64, float64> Mpl::get_xlim(const bp::object& axis) throw (Error) {
std::pair<float64, float64> Mpl::get_xlim(const PythonObject& axis) throw (Error) {
mpl::MplLock lock;
try {
bp::tuple res(axis.attr("get_xlim")());
......@@ -272,10 +272,10 @@ std::pair<float64, float64> Mpl::get_xlim(const bp::object& axis) throw (Error)
/*
* get_ylim
*/
std::pair<float64, float64> Mpl::get_ylim(const bp::object& axis) throw (Error) {
std::pair<float64, float64> Mpl::get_ylim(const PythonObject& axis) throw (Error) {
mpl::MplLock lock;
try {
bp::object res = axis.attr("get_ylim")();
bp::tuple res(axis.attr("get_ylim")());
float64 min = bp::extract<float64>(res[0]);
float64 max = bp::extract<float64>(res[1]);
return std::make_pair(min, max);
......@@ -287,7 +287,7 @@ std::pair<float64, float64> Mpl::get_ylim(const bp::object& axis) throw (Error)
/*
* set_xdata
*/
void Mpl::set_xdata(const bp::object& line, const std::vector<float64> &x) throw (Error) {
void Mpl::set_xdata(const PythonObject& line, const std::vector<float64> &x) throw (Error) {
mpl::MplLock lock;
// using numpy arrays
boost::python::list xarray;
......@@ -309,7 +309,7 @@ void Mpl::set_xdata(const bp::object& line, const std::vector<float64> &x) throw
/*
* set_ydata
*/
void Mpl::set_ydata(const bp::object& line, const std::vector<float64> &y) throw (Error) {
void Mpl::set_ydata(const PythonObject& line, const std::vector<float64> &y) throw (Error) {
mpl::MplLock lock;
// using numpy arrays
boost::python::list yarray;
......@@ -330,7 +330,7 @@ void Mpl::set_ydata(const bp::object& line, const std::vector<float64> &y) throw
/*
* set_xlim
*/
void Mpl::set_xlim(const bp::object& axis, float64 min, float64 max, float64 marge) throw (Error) {
void Mpl::set_xlim(const PythonObject& axis, float64 min, float64 max, float64 marge) throw (Error) {
mpl::MplLock lock;
float64 tot = max - min;
min -= tot * marge;
......@@ -347,7 +347,7 @@ void Mpl::set_xlim(const bp::object& axis, float64 min, float64 max, float64 mar
/*
* set_ylim
*/
void Mpl::set_ylim(const bp::object& axis, float64 min, float64 max, float64 marge) throw (Error) {
void Mpl::set_ylim(const PythonObject& axis, float64 min, float64 max, float64 marge) throw (Error) {
mpl::MplLock lock;
float64 tot = max - min;
min -= tot * marge;
......
......@@ -25,6 +25,7 @@
#include <vector>
#include "Error.h"
#include "Trace.h"
#include "PythonObject.h"
namespace bp = boost::python;
......@@ -52,7 +53,7 @@ public:
* \brief close plot window (figure and a set of subplots)
* \throws Error
*/
void close(const bp::object& figure) throw (Error);
void close(const PythonObject& figure) throw (Error);
/*!
* \brief close plot window (figure and a set of subplots)
......@@ -66,7 +67,7 @@ public:
* \param[in] name the label
* \throws Error
*/
void xlabel(const bp::object& axis, const std::string& name) throw (Error);
void xlabel(const PythonObject& axis, const std::string& name) throw (Error);
/*!
* \brief set title of the y label
......@@ -74,7 +75,7 @@ public:
* \param[in] name the label
* \throws Error
*/
void ylabel(const bp::object& axis, const std::string& name) throw (Error);
void ylabel(const PythonObject& axis, const std::string& name) throw (Error);
/*!
* \brief refresh x data of the plot
......@@ -82,7 +83,7 @@ public:
* \param[in] x data
* \throws Error
*/
void set_xdata(const bp::object& line, const std::vector<float64> &x) throw (Error);
void set_xdata(const PythonObject& line, const std::vector<float64> &x) throw (Error);
/*!
* \brief refresh y data of the plot
......@@ -90,7 +91,7 @@ public:
* \param[in] y data
* \throws Error
*/
void set_ydata(const bp::object& line, const std::vector<float64> &y) throw (Error);
void set_ydata(const PythonObject& line, const std::vector<float64> &y) throw (Error);
/*!
* \brief refresh x limit of the plot
......@@ -98,7 +99,7 @@ public:
* \param[in] max the maximum value
* \throws Error
*/
void set_xlim(const bp::object& axis, float64 min, float64 max, float64 marge) throw (Error);
void set_xlim(const PythonObject& axis, float64 min, float64 max, float64 marge) throw (Error);
/*!
* \brief refresh y limit of the plot
......@@ -108,7 +109,7 @@ public:
* \param[in] marge the +/- purcent to set out out those limites
* \throws Error
*/
void set_ylim(const bp::object& axis, float64 min, float64 max, float64 marge) throw (Error);
void set_ylim(const PythonObject& axis, float64 min, float64 max, float64 marge) throw (Error);
/*!
* \brief Get the actual X limits
......@@ -116,7 +117,7 @@ public:
* \return The Limits
* \throws Error
*/
std::pair<float64, float64> get_xlim(const bp::object& axis) throw (Error);
std::pair<float64, float64> get_xlim(const PythonObject& axis) throw (Error);
/*!
* \brief Get the actual Y limits
......@@ -124,7 +125,7 @@ public:
* \return The Limits
* \throws Error
*/
std::pair<float64, float64> get_ylim(const bp::object& axis) throw (Error);
std::pair<float64, float64> get_ylim(const PythonObject& axis) throw (Error);
/*!
* \brief show the plot grid
......@@ -132,7 +133,7 @@ public:
* \param[in] show the state of grid
* \throws Error
*/
void grid(const bp::object& axis, bool show) throw (Error);
void grid(const PythonObject& axis, bool show) throw (Error);
/*!
* \brief Save png image on the disk
......@@ -142,21 +143,21 @@ public:
* \param[in] pad The padding around the edge of each axes
* \throws Error
*/
void savefig(const bp::object& figure, const std::string& filename, uint32 dpi, float64 pad) throw (Error);
void savefig(const PythonObject& figure, const std::string& filename, uint32 dpi, float64 pad) throw (Error);
/*!
* \brief getter
* \return Matplotlib pyplot Python module object
*/
const bp::object& getPyPlot() {
return m_PyPlot;
}
// /*!
// * \brief getter
// * \return Matplotlib pyplot Python module object
// */
// const PythonObject& getPyPlot() {
// return m_PyPlot();
// }
/*!
* \brief getter
* \return Matplotlib pyplot Python module object
*/
const bp::object& getLinesModule() {
const PythonObject& getLinesModule() const {
return m_LinesModule;
}
......@@ -164,7 +165,7 @@ public:
* \brief getter
* \return Matplotlib pyplot Python module object
*/
const bp::object& getFigureModule() {
const PythonObject& getFigureModule() const {
return m_FigureModule;
}
......@@ -172,7 +173,7 @@ public:
* \brief getter
* \return Matplotlib pyplot Python module object
*/
const bp::object& getTextModule() {
const PythonObject& getTextModule() const {
return m_TextModule;
}
......@@ -180,7 +181,7 @@ public:
* \brief getter
* \return Matplotlib pyplot Python module object
*/
const bp::object& getNormalNorm() {
const PythonObject& getNormalNorm() const {
return m_NormalNorm;
}
......@@ -188,7 +189,7 @@ public:
* \brief getter
* \return Matplotlib pyplot Python module object
*/
const bp::object& getLogNorm() {
const PythonObject& getLogNorm() const {
return m_LogNorm;
}
......@@ -196,7 +197,7 @@ public:
* \brief getter
* \return Matplotlib pyplot Python module object
*/
const bp::object& getBackendsModule() {
const PythonObject& getBackendsModule() const {
return m_BackendsModule;
}
......@@ -204,7 +205,7 @@ public:
* \brief getter
* \return Matplotlib pyplot Python module object
*/
const bp::object& getWidgetsModule() {
const PythonObject& getWidgetsModule() const {
return m_WidgetsModule;
}
......@@ -212,7 +213,7 @@ public:
* \brief getter
* \return Matplotlib pyplot Python module object
*/
const bp::object& getPatchesModule() {
const PythonObject& getPatchesModule() const {
return m_PatchesModule;
}
......@@ -223,16 +224,16 @@ public:
private:
bp::object m_PyPlot; //! Matplotlib pyplot Python module object
bp::object m_FigureModule; //! Matplotlib figure module
bp::object m_LinesModule; //! Matplotlib lines module
bp::object m_TextModule; //! Matplotlib text module
bp::object m_NormalNorm; //! Normal normalization object
bp::object m_LogNorm; //! Log normalization object
bp::object m_BackendsModule; //! Matplotlib Backends module
bp::object m_WidgetsModule; //! Matplotlib widgets module
bp::object m_PatchesModule; //! Matplotlib patches module
bp::object m_GarbageCollector; //! Garbage collector module
PythonObject m_PyPlot; //! Matplotlib pyplot Python module object
PythonObject m_FigureModule; //! Matplotlib figure module
PythonObject m_LinesModule; //! Matplotlib lines module
PythonObject m_TextModule; //! Matplotlib text module
PythonObject m_NormalNorm; //! Normal normalization object
PythonObject m_LogNorm; //! Log normalization object
PythonObject m_BackendsModule; //! Matplotlib Backends module
PythonObject m_WidgetsModule; //! Matplotlib widgets module
PythonObject m_PatchesModule; //! Matplotlib patches module
PythonObject m_GarbageCollector; //! Garbage collector module
};
......
......@@ -49,10 +49,10 @@ MplFigure::MplFigure(Mpl& mpl, bool usetoolbar) : m_Mpl(mpl) {
// Get matplotlib BackEnd for qt5
try {
m_Canvas = mpl.getBackendsModule().attr("FigureCanvas")(m_Figure);
bp::object parent;
m_Canvas = mpl.getBackendsModule().attr("FigureCanvas")(m_Figure());
PythonObject parent;
if (usetoolbar == true) {
auto args = bp::make_tuple(m_Canvas, parent, false);
auto args = bp::make_tuple(m_Canvas(), parent(), false);
m_Toolbar = mpl.getBackendsModule().attr("NavigationToolbar2QT")(*args);
}
} catch (...) {
......@@ -72,9 +72,9 @@ MplFigure::~MplFigure() {
}
m_Figure = bp::object ();
m_Canvas = bp::object ();
m_Toolbar = bp::object ();
m_Figure.reset();
m_Canvas.reset();
m_Toolbar.reset();
try {
m_Mpl.garbageCollect();
......@@ -91,7 +91,7 @@ void MplFigure::title(const std::string& name) throw (Error) {
MplLock lock;
try {
bp::call_method<void, const char *>(m_Figure.ptr(), "suptitle", name.c_str());
bp::call_method<void, const char *>(m_Figure().ptr(), "suptitle", name.c_str());
} catch (...) {
throw Error("MplFigure", "title", "Error when executing set_title method");
}
......@@ -100,7 +100,7 @@ void MplFigure::title(const std::string& name) throw (Error) {
/*
* gridSpec
*/
boost::python::object MplFigure::gridSpec(int32 nrows, int32 ncols, const std::vector<int32>& height_ratios,
PythonObject MplFigure::gridSpec(int32 nrows, int32 ncols, const std::vector<int32>& height_ratios,
const std::vector<int32>& width_ratios, float64 wspace, float64 hspace) throw (Error) {
mpl::MplLock lock;
......@@ -122,7 +122,7 @@ boost::python::object MplFigure::gridSpec(int32 nrows, int32 ncols, const std::v
}
kwargs["wspace"] = wspace;
kwargs["hspace"] = hspace;
bp::object gs;
PythonObject gs;
try {
gs = m_Figure.attr("add_gridspec")(*args, **kwargs);
} catch (...) {
......@@ -134,10 +134,10 @@ boost::python::object MplFigure::gridSpec(int32 nrows, int32 ncols, const std::v
/*