diff options
author | Josh Blum | 2011-01-21 14:33:27 -0800 |
---|---|---|
committer | Josh Blum | 2011-03-01 17:02:06 -0800 |
commit | 2c263e9640f2812b241d724286aaa1f13c57935f (patch) | |
tree | 98f0fd3b2d3daccac249f6be4dc16c085e4b1909 | |
parent | e30f0a7ca02801732ad7a25ab83e1d27dc45c6ce (diff) | |
download | gnuradio-2c263e9640f2812b241d724286aaa1f13c57935f.tar.gz gnuradio-2c263e9640f2812b241d724286aaa1f13c57935f.tar.bz2 gnuradio-2c263e9640f2812b241d724286aaa1f13c57935f.zip |
qtgui: work on variable chooser
-rw-r--r-- | gr-qtgui/grc/Makefile.am | 1 | ||||
-rw-r--r-- | gr-qtgui/grc/qtgui_variable_chooser.xml | 85 | ||||
-rw-r--r-- | gr-qtgui/grc/qtgui_variable_slider.xml | 2 | ||||
-rw-r--r-- | grc/blocks/options.xml | 1 |
4 files changed, 87 insertions, 2 deletions
diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am index 132d1a2e0..e69d3a9af 100644 --- a/gr-qtgui/grc/Makefile.am +++ b/gr-qtgui/grc/Makefile.am @@ -26,4 +26,5 @@ grcblocksdir = $(grc_blocksdir) dist_grcblocks_DATA = \ qtgui_sink_x.xml \ qtgui_tab_widget.xml \ + qtgui_variable_chooser.xml \ qtgui_variable_slider.xml diff --git a/gr-qtgui/grc/qtgui_variable_chooser.xml b/gr-qtgui/grc/qtgui_variable_chooser.xml new file mode 100644 index 000000000..46e302bc7 --- /dev/null +++ b/gr-qtgui/grc/qtgui_variable_chooser.xml @@ -0,0 +1,85 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Variable Slider: +## a combined slider and text box form +################################################### + --> +<block> + <name>QT GUI Chooser</name> + <key>variable_qtgui_chooser</key> + <category>Variables</category> + <import>from PyQt4 import Qt</import> + <import>import PyQt4.Qwt5 as Qwt</import> + <var_make>self.$(id) = $(id) = $value</var_make> + <make>#set $win = 'self._%s_tool_bar'%$id +$win = Qt.QToolBar(self) +#if $label() +$(win).addWidget(Qt.QLabel($label, None)) +#else +$(win).addWidget(Qt.QLabel("$id", None)) +#end if +self._$(id)_chooser = Qt.QComboBox(None) +$(win).addWidget(self._$(id)_chooser) + +self._$(id)_options = ['a', 'b', 'c'] + +self._$(id)_chooser.addItem('A') +self._$(id)_chooser.addItem('B') +self._$(id)_chooser.addItem('C') + +self._$(id)_chooser.currentIndexChanged.connect( + lambda i: self.set_$(id)(self._$(id)_options[i]) +) + +$(gui_hint()($win))</make> + <callback>self.set_$(id)($value)</callback> + <callback>self._$(id)_chooser.setCurrentIndex( + self._$(id)_options.index($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>Type</name> + <key>type</key> + <value>real</value> + <type>enum</type> + <hide>part</hide> + <option><name>Real</name><key>real</key></option> + <option><name>Int</name><key>int</key></option> + <option><name>String</name><key>string</key></option> + <option><name>Any</name><key>raw</key></option> + </param> + + <param> + <name>Default Value</name> + <key>value</key> + <value>50</value> + <type>$type</type> + </param> + + + + <param> + <name>GUI Hint</name> + <key>gui_hint</key> + <value></value> + <type>gui_hint</type> + <hide>part</hide> + </param> + <doc> +This block creates a variable with enumerated choices. \ +The gui widget is implemented as a combo box or radio button group. \ +Leave the label blank to use the variable id as the label. + +The GUI hint can be used to position the widget within the application. \ +The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \ +Both the tab specification and the grid position are optional. + </doc> +</block> diff --git a/gr-qtgui/grc/qtgui_variable_slider.xml b/gr-qtgui/grc/qtgui_variable_slider.xml index 239d90903..4eeb7a29b 100644 --- a/gr-qtgui/grc/qtgui_variable_slider.xml +++ b/gr-qtgui/grc/qtgui_variable_slider.xml @@ -19,7 +19,7 @@ $(win).addWidget(self._$(id)_tool_bar) #if $label() self._$(id)_tool_bar.addWidget(Qt.QLabel($label, None)) #else -self._$(id)_tool_bar.addWidget(Qt.QLabel($id, None)) +self._$(id)_tool_bar.addWidget(Qt.QLabel("$id", None)) #end if self._$(id)_counter = Qwt.QwtCounter(None) self._$(id)_counter.setRange($start, $stop, $step) diff --git a/grc/blocks/options.xml b/grc/blocks/options.xml index ed4d3c1d8..e6c7e0287 100644 --- a/grc/blocks/options.xml +++ b/grc/blocks/options.xml @@ -60,7 +60,6 @@ else: self.stop(); self.wait()</callback> <key>generate_options</key> <value>wx_gui</value> <type>enum</type> - <hide>#if $generate_options() == 'wx_gui' then 'part' else 'none'#</hide> <option> <name>WX GUI</name> <key>wx_gui</key> |