Commit 133b632b authored by Locatelli's avatar Locatelli
Browse files

Add save file button

parent 7492e13a
......@@ -94,4 +94,11 @@ void PlotToolBar::ratio(bool on) throw (Error) {
m_Plotwindow->ratio(on);
}
/*
* filesave
*/
void PlotToolBar::filesave() throw (Error) {
m_Plotwindow->filesave();
}
}
......@@ -89,6 +89,12 @@ public:
*/
void ratio(bool on) throw (Error);
/*!
* \brief Image File save
* \throws Error
*/
void filesave() throw (Error);
/*!
* \brief Get grid state
* \return state
......
......@@ -252,6 +252,13 @@ void PlotWindow::ratio(bool on) throw (Error) {
m_Plot->aspectRatio(on);
}
/*
* filesave
*/
void PlotWindow::filesave() throw (Error) {
m_MplFigure->filesave();
}
/*
* getPlot
*/
......
......@@ -157,6 +157,12 @@ public:
*/
void ratio(bool on) throw (Error);
/*!
* \brief Image File save
* \throws Error
*/
void filesave() throw (Error);
/*!
* \brief set the window title
* \param[in] title the title of window
......
......@@ -207,5 +207,18 @@ void MplFigure::pan(bool on) throw (Error) {
}
}
/*
* filesave
*/
void MplFigure::filesave() throw (Error) {
MplLock lock;
try {
m_Toolbar.attr("save_figure")();
} catch (...) {
throw Error("MplFigure", "filesave", "Error when executing save_figure method");
}
}
}
}
......@@ -102,6 +102,12 @@ public:
*/
void zoom(bool on) throw (Error);
/*!
* \brief Image File save
* \throws Error
*/
void filesave() throw (Error);
/*!
* \brief getter
* \return Matplotlib Figure object
......
......@@ -80,6 +80,12 @@ QtToolBar::QtToolBar(plot::PlotToolBar* plotToolBar) : QToolBar(), m_PlotToolBar
m_RatioAction->setCheckable(true);
connect(m_RatioAction, &QAction::triggered, this, &QtToolBar::ratio);
addSeparator();
QIcon filesaveIcon("/users/locatelli/nomad/ploty2/icons/filesave.png");
m_FileSaveAction = addAction(filesaveIcon, "Save the figure");
connect(m_FileSaveAction, &QAction::triggered, this, &QtToolBar::filesave);
}
/*
......@@ -93,6 +99,7 @@ QtToolBar::~QtToolBar() {
delete m_GridAction;
delete m_LogAction;
delete m_RatioAction;
delete m_FileSaveAction;
}
/*
......@@ -185,6 +192,18 @@ void QtToolBar::ratio(bool on) {
}
}
/*
* filesave
*/
void QtToolBar::filesave() {
try {
m_PlotToolBar->filesave();
}
catch(...) {
throw Error("QtToolBar", "filesave", "Error executin filesave");
}
}
/*
* switchPlot
*/
......
......@@ -102,6 +102,11 @@ public:
*/
void ratio(bool on);
/*!
* \brief Image File save
*/
void filesave();
private:
QAction* m_BackAction; //! Back button
......@@ -111,6 +116,7 @@ private:
QAction* m_GridAction; //! Grid button
QAction* m_LogAction; //! Log button
QAction* m_RatioAction; //! Ratio button
QAction* m_FileSaveAction; //! File save button
plot::PlotToolBar* m_PlotToolBar; //! Link to ToolBar object
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment