discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] [GRC] Print samples when saving screenshot


From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] [GRC] Print samples when saving screenshot
Date: Thu, 14 Apr 2016 10:04:02 -0400



On Tue, Apr 12, 2016 at 4:55 PM, Merlin Chlosta <address@hidden> wrote:
Hi all,

GRC is very handy and so is the screenshot function. It's much faster to take a screenshot than to record all data and plot it afterwards. However I found myself taking a lot of screenshots twice because e.g. the label was wrong. Also the plots did not meet my requirements for printing, so I had to go for the record-everything-method anyway.

I think GRC could print out the samples when saving a screenshot. You'll then have 1. a fast tool to snapshot your signals and 2. accurate data in case you need further analysis or different plot style.

I hacked this into the gr-qtgui code, see below. Any comments on this? I'm pretty sure it's not done right.

What do you think of this feature? Does this already exist and I did not find it?

--Merlin Chlosta

Merlin,

I'm certainly not opposed to this idea. Would you create a pull request against https://github.com/gnuradio/gnuradio? It's much easier for us to track and trade ideas on features like this in that forum rather than email.

See this page for information on that if you're not familiar with that process:
http://gnuradio.org/redmine/projects/gnuradio/wiki/Development


I also want to point out the QTGUI Theme concept we now have. In GRC, you can set the theme on a per-flowgraph basis by setting the QSS Theme line in the flowgraph's Options block. Or you can do it globally by making a theme the default by going to Tools -> Set Default QT GUI Theme.

Themes are located in $prefix/share/gnuradio/themes

The one I want to point you towards specifically is "projector.qss" which we put together during the last GRCon15 hackfest to make the lines and fonts large enough to show results on a projector. It also helps when saving files for later use in papers/presentations.

Tom


 
---
commit 5df55a2ec563002161d43cca53aad119a32a38f2
Author: Merlin Chlosta <address@hidden>
Date:   Tue Apr 12 22:41:37 2016 +0200

    DisplayForm: Print samples when saving screenshot

diff --git a/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h
index eba12e2..1e946f8 100644
--- a/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h
+++ b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h
@@ -127,6 +127,8 @@ public:

   virtual void replot() = 0;

+  std::vector<QwtPlotCurve*> d_plot_curve;
+
   const QColor getLineColor1 () const;
   const QColor getLineColor2 () const;
   const QColor getLineColor3 () const;
@@ -284,7 +286,6 @@ protected slots:

 protected:
   int d_nplots;
-  std::vector<QwtPlotCurve*> d_plot_curve;

   QwtPlotPanner* d_panner;
   QwtPlotZoomer* d_zoomer;
diff --git a/gr-qtgui/include/gnuradio/qtgui/displayform.h b/gr-qtgui/include/gnuradio/qtgui/displayform.h
index 1da1383..c23067a 100644
--- a/gr-qtgui/include/gnuradio/qtgui/displayform.h
+++ b/gr-qtgui/include/gnuradio/qtgui/displayform.h
@@ -30,6 +30,7 @@

 #include <qwt_plot_grid.h>
 #include <qwt_plot_layout.h>
+#include <qwt_plot_curve.h>

 #include <gnuradio/qtgui/DisplayPlot.h>
 #include <gnuradio/qtgui/form_menus.h>
diff --git a/gr-qtgui/lib/displayform.cc b/gr-qtgui/lib/displayform.cc
index 13c2d8a..3f78502 100644
--- a/gr-qtgui/lib/displayform.cc
+++ b/gr-qtgui/lib/displayform.cc
@@ -359,6 +359,17 @@ DisplayForm::saveFigure()
 {
   QPixmap qpix = QPixmap::grabWidget(this);

+  std::vector<QwtPlotCurve*> plot_curve = getPlot()->d_plot_curve;
+
+  std::cout << "Screenshot:" << std::endl;
+  for (int plot = 0; plot < plot_curve.size(); plot++) {
+    std::cout << "Plot curve #" << plot << std::endl;
+    for (int i = 0; i < plot_curve[plot]->dataSize(); i++) {
+      std::cout << plot_curve[plot]->y(i) << ", ";
+    }
+    std::cout << std::endl;
+  }
+
   QString types = QString(tr("JPEG file (*.jpg);;Portable Network Graphics file (*.png);;Bitmap file (*.bmp);;TIFF file (*.tiff)"));

   QString filename, filetype;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]