Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
Ploty2
Commits
133b632b
Commit
133b632b
authored
Mar 13, 2019
by
Locatelli
Browse files
Add save file button
parent
7492e13a
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/plot/PlotToolBar.cpp
View file @
133b632b
...
...
@@ -94,4 +94,11 @@ void PlotToolBar::ratio(bool on) throw (Error) {
m_Plotwindow
->
ratio
(
on
);
}
/*
* filesave
*/
void
PlotToolBar
::
filesave
()
throw
(
Error
)
{
m_Plotwindow
->
filesave
();
}
}
src/plot/PlotToolBar.h
View file @
133b632b
...
...
@@ -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
...
...
src/plot/PlotWindow.cpp
View file @
133b632b
...
...
@@ -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
*/
...
...
src/plot/PlotWindow.h
View file @
133b632b
...
...
@@ -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
...
...
src/view/mpl/MplFigure.cpp
View file @
133b632b
...
...
@@ -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"
);
}
}
}
}
src/view/mpl/MplFigure.h
View file @
133b632b
...
...
@@ -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
...
...
src/view/qt/QtToolBar.cpp
View file @
133b632b
...
...
@@ -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
*/
...
...
src/view/qt/QtToolBar.h
View file @
133b632b
...
...
@@ -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
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment