diff options
author | Josh Blum <josh@joshknows.com> | 2010-12-06 22:46:39 -0500 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-03-01 17:02:06 -0800 |
commit | 9ae8997e5f682bc16e58c0a0bba21794dbd705c5 (patch) | |
tree | 8ffd4f98e92a1e9261f88574d0c2679b11cabaec /gr-qtgui/grc | |
parent | 0e076c5835ea624c25e7be964e946d9f6425f414 (diff) |
qtgui: created a forms module with a slider and text box, implemented in grc
Diffstat (limited to 'gr-qtgui/grc')
-rw-r--r-- | gr-qtgui/grc/.gitignore | 2 | ||||
-rw-r--r-- | gr-qtgui/grc/Makefile.am | 28 | ||||
-rw-r--r-- | gr-qtgui/grc/qtgui_sink_x.xml | 124 | ||||
-rw-r--r-- | gr-qtgui/grc/qtgui_variable_slider.xml | 114 |
4 files changed, 268 insertions, 0 deletions
diff --git a/gr-qtgui/grc/.gitignore b/gr-qtgui/grc/.gitignore new file mode 100644 index 0000000000..b336cc7cec --- /dev/null +++ b/gr-qtgui/grc/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am new file mode 100644 index 0000000000..226e9d137d --- /dev/null +++ b/gr-qtgui/grc/Makefile.am @@ -0,0 +1,28 @@ +# +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common + +grcblocksdir = $(grc_blocksdir) + +dist_grcblocks_DATA = \ + qtgui_sink_x.xml \ + qtgui_variable_slider.xml diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml new file mode 100644 index 0000000000..8182f8d944 --- /dev/null +++ b/gr-qtgui/grc/qtgui_sink_x.xml @@ -0,0 +1,124 @@ +<?xml version="1.0"?> +<!-- +################################################### +##QT GUI Sink +################################################### + --> +<block> + <name>QT GUI Sink</name> + <key>qtgui_sink_x</key> + <category>Graphical Sinks</category> + <import>from gnuradio.qtgui import qtgui</import> + <import>from gnuradio.gr import firdes</import> + <import>import sip</import> + <make>qtgui.$(type.fcn)( + $fftsize, \#fftsize + $wintype, \#wintype + $fc, \#fc + $bw, \#bw + $name, \#name + $plotfreq, \#plotfreq + $plotwaterfall, \#plotwaterfall + $plotwaterfall3d, \#plotwaterfall3d + $plottime, \#plottime + $plotconst, \#plotconst +) +self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), QtGui.QWidget) +self.layout.addWidget(self._$(id)_win)</make> + <callback>set_frequency_range($fc, $bw)</callback> + <param> + <name>Type</name> + <key>type</key> + <value>complex</value> + <type>enum</type> + <option><name>Complex</name><key>complex</key><opt>fcn:sink_c</opt></option> + <option><name>Float</name><key>float</key><opt>fcn:sink_f</opt></option> + </param> + <param> + <name>Name</name> + <key>name</key> + <value>QT GUI Plot</value> + <type>string</type> + </param> + <param> + <name>FFT Size</name> + <key>fftsize</key> + <value>1024</value> + <type>int</type> + </param> + <param> + <name>Window Type</name> + <key>wintype</key> + <value>firdes.WIN_BLACKMAN_hARRIS</value> + <type>int</type> + <hide>part</hide> + <option> + <name>Blackman-harris</name> + <key>firdes.WIN_BLACKMAN_hARRIS</key> + </option> + </param> + <param> + <name>Center Frequency (Hz)</name> + <key>fc</key> + <value>0</value> + <type>real</type> + </param> + <param> + <name>Bandwidth (Hz)</name> + <key>bw</key> + <value>samp_rate</value> + <type>real</type> + </param> + <param> + <name>Plot Frequency</name> + <key>plotfreq</key> + <value>True</value> + <type>bool</type> + <hide>part</hide> + <option><name>On</name><key>True</key></option> + <option><name>Off</name><key>False</key></option> + </param> + <param> + <name>Plot Waterfall</name> + <key>plotwaterfall</key> + <value>True</value> + <type>bool</type> + <hide>part</hide> + <option><name>On</name><key>True</key></option> + <option><name>Off</name><key>False</key></option> + </param> + <param> + <name>Plot Waterfall 3D</name> + <key>plotwaterfall3d</key> + <value>True</value> + <type>bool</type> + <hide>part</hide> + <option><name>On</name><key>True</key></option> + <option><name>Off</name><key>False</key></option> + </param> + <param> + <name>Plot Time</name> + <key>plottime</key> + <value>True</value> + <type>bool</type> + <hide>part</hide> + <option><name>On</name><key>True</key></option> + <option><name>Off</name><key>False</key></option> + </param> + <param> + <name>Plot Const</name> + <key>plotconst</key> + <value>True</value> + <type>bool</type> + <hide>part</hide> + <option><name>On</name><key>True</key></option> + <option><name>Off</name><key>False</key></option> + </param> + <sink> + <name>in</name> + <type>$type</type> + <nports>$num_inputs</nports> + </sink> + <doc> + </doc> +</block> diff --git a/gr-qtgui/grc/qtgui_variable_slider.xml b/gr-qtgui/grc/qtgui_variable_slider.xml new file mode 100644 index 0000000000..37f102ecb8 --- /dev/null +++ b/gr-qtgui/grc/qtgui_variable_slider.xml @@ -0,0 +1,114 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Variable Slider: +## a combined slider and text box form +################################################### + --> +<block> + <name>QT GUI Variable Slider</name> + <key>variable_qtgui_slider</key> + <category>Variables</category> + <import>from gnuradio.qtgui import forms</import> + <import>from PyQt4.QtCore import Qt</import> + <var_make>self.$(id) = $(id) = $value</var_make> + <make>#set $win = '_%s_sizer'%$id +$win = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom) +self._$(id)_text_box = forms.text_box( + parent=self, + value=self.$id, + callback=self.set_$(id), + #if $label() + label=$label, + #else + label='$id', + #end if + converter=forms.$(converver)(), +) +$(win).addWidget(self._$(id)_text_box) +self._$(id)_slider = forms.slider( + value=self.$id, + callback=self.set_$(id), + start=$start, + stop=$stop, + step=$step, + orient=$orient, + cast=$(converver.slider_cast), +) +$(win).addWidget(self._$(id)_slider) +self.layout.addLayout($win)</make> + <callback>self.set_$(id)($value)</callback> + <callback>self._$(id)_slider.set_value($id)</callback> + <callback>self._$(id)_text_box.set_value($id)</callback> + <param> + <name>Label</name> + <key>label</key> + <value></value> + <type>string</type> + <hide>#if $label() then 'none' else 'part'#</hide> + </param> + <param> + <name>Default Value</name> + <key>value</key> + <value>50</value> + <type>real</type> + </param> + <param> + <name>Start</name> + <key>start</key> + <value>0</value> + <type>real</type> + </param> + <param> + <name>Stop</name> + <key>stop</key> + <value>100</value> + <type>real</type> + </param> + <param> + <name>Step</name> + <key>step</key> + <value>1</value> + <type>real</type> + <hide>part</hide> + </param> + <param> + <name>Orientation</name> + <key>orient</key> + <value>Qt.Horizontal</value> + <type>enum</type> + <hide>part</hide> + <option> + <name>Horizontal</name> + <key>Qt.Horizontal</key> + </option> + <option> + <name>Vertical</name> + <key>Qt.Vertical</key> + </option> + </param> + <param> + <name>Converter</name> + <key>converver</key> + <value>float_converter</value> + <type>enum</type> + <option> + <name>Float</name> + <key>float_converter</key> + <opt>slider_cast:float</opt> + </option> + <option> + <name>Integer</name> + <key>int_converter</key> + <opt>slider_cast:int</opt> + </option> + </param> + <check>$start <= $value <= $stop</check> + <check>$start < $stop</check> + <doc> +This block creates a variable with a slider. \ +Leave the label blank to use the variable id as the label. \ +The value must be a real number. \ +The value must be between the start and the stop. + </doc> +</block> |