diff options
author | Josh Blum <josh@joshknows.com> | 2011-03-01 00:32:55 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-03-01 17:02:07 -0800 |
commit | 931332448227a6b509a9b39bb68044fa55d8b1cb (patch) | |
tree | 8475c6b2c13e57a8eb9148ca65a91ed648bc4c51 | |
parent | c86fb3460c14cc308f0809e08f3fb460f70c08d9 (diff) |
grc-qtgui: added variable text box and static text widgets
-rw-r--r-- | gr-qtgui/grc/Makefile.am | 6 | ||||
-rw-r--r-- | gr-qtgui/grc/qtgui_chooser.xml (renamed from gr-qtgui/grc/qtgui_variable_chooser.xml) | 5 | ||||
-rw-r--r-- | gr-qtgui/grc/qtgui_slider.xml (renamed from gr-qtgui/grc/qtgui_variable_slider.xml) | 0 | ||||
-rw-r--r-- | gr-qtgui/grc/qtgui_static_text.xml | 65 | ||||
-rw-r--r-- | gr-qtgui/grc/qtgui_text_box.xml | 67 |
5 files changed, 138 insertions, 5 deletions
diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am index e69d3a9aff..1153fc976a 100644 --- a/gr-qtgui/grc/Makefile.am +++ b/gr-qtgui/grc/Makefile.am @@ -25,6 +25,8 @@ grcblocksdir = $(grc_blocksdir) dist_grcblocks_DATA = \ qtgui_sink_x.xml \ + qtgui_static_text.xml \ qtgui_tab_widget.xml \ - qtgui_variable_chooser.xml \ - qtgui_variable_slider.xml + qtgui_text_box.xml \ + qtgui_chooser.xml \ + qtgui_slider.xml diff --git a/gr-qtgui/grc/qtgui_variable_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml index b833fb8ade..5f383949e7 100644 --- a/gr-qtgui/grc/qtgui_variable_chooser.xml +++ b/gr-qtgui/grc/qtgui_chooser.xml @@ -10,7 +10,6 @@ <key>variable_qtgui_chooser</key> <category>QT GUI Widgets</category> <import>from PyQt4 import Qt</import> - <import>import PyQt4.Qwt5 as Qwt</import> <var_make>self.$(id) = $(id) = $value</var_make> <make>#slurp #set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())] @@ -102,8 +101,8 @@ $(gui_hint()($win))</make> <value>int</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>Float</name><key>real</key></option> + <option><name>Integer</name><key>int</key></option> <option><name>String</name><key>string</key></option> <option><name>Any</name><key>raw</key></option> </param> diff --git a/gr-qtgui/grc/qtgui_variable_slider.xml b/gr-qtgui/grc/qtgui_slider.xml index 68000fa2f6..68000fa2f6 100644 --- a/gr-qtgui/grc/qtgui_variable_slider.xml +++ b/gr-qtgui/grc/qtgui_slider.xml diff --git a/gr-qtgui/grc/qtgui_static_text.xml b/gr-qtgui/grc/qtgui_static_text.xml new file mode 100644 index 0000000000..92346b0716 --- /dev/null +++ b/gr-qtgui/grc/qtgui_static_text.xml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Variable Static Text: +## a gui static text form +################################################### + --> +<block> + <name>QT GUI Static Text</name> + <key>variable_qtgui_static_text</key> + <category>QT GUI Widgets</category> + <import>from PyQt4 import Qt</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)_label = Qt.QLabel(str(self.$id)) +self._$(id)_tool_bar.addWidget(self._$(id)_label) +$(gui_hint()($win))</make> + <callback>self.set_$(id)($value)</callback> + <callback>self._$(id)_label.setText(str($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>int</value> + <type>enum</type> + <hide>part</hide> + <option><name>Float</name><key>real</key><opt>conv:float</opt></option> + <option><name>Integer</name><key>int</key><opt>conv:int</opt></option> + <option><name>String</name><key>string</key><opt>conv:str</opt></option> + <option><name>Any</name><key>raw</key><opt>conv:eval</opt></option> + </param> + <param> + <name>Default Value</name> + <key>value</key> + <value>0</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 a static text widget. \ +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_text_box.xml b/gr-qtgui/grc/qtgui_text_box.xml new file mode 100644 index 0000000000..4fd961f550 --- /dev/null +++ b/gr-qtgui/grc/qtgui_text_box.xml @@ -0,0 +1,67 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Variable Text Box: +## a gui text box form +################################################### + --> +<block> + <name>QT GUI Text Box</name> + <key>variable_qtgui_text_box</key> + <category>QT GUI Widgets</category> + <import>from PyQt4 import Qt</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)_line_edit = Qt.QLineEdit(str(self.$id)) +self._$(id)_tool_bar.addWidget(self._$(id)_line_edit) +self._$(id)_line_edit.returnPressed.connect( + lambda: self.set_$(id)($(type.conv)(self._$(id)_line_edit.text()))) +$(gui_hint()($win))</make> + <callback>self.set_$(id)($value)</callback> + <callback>self._$(id)_line_edit.setText(str($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>int</value> + <type>enum</type> + <hide>part</hide> + <option><name>Float</name><key>real</key><opt>conv:float</opt></option> + <option><name>Integer</name><key>int</key><opt>conv:int</opt></option> + <option><name>String</name><key>string</key><opt>conv:str</opt></option> + <option><name>Any</name><key>raw</key><opt>conv:eval</opt></option> + </param> + <param> + <name>Default Value</name> + <key>value</key> + <value>0</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 text box entry. \ +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> |