summaryrefslogtreecommitdiff
path: root/gr-qtgui
diff options
context:
space:
mode:
authorJosh Blum2011-01-20 22:31:31 -0800
committerJosh Blum2011-03-01 17:02:06 -0800
commite30f0a7ca02801732ad7a25ab83e1d27dc45c6ce (patch)
tree4dce85c1bac97c380c243195ac8d05afa5afc7b2 /gr-qtgui
parenta284640decd1fd6634f35bd1e20fd69b9194a7b6 (diff)
downloadgnuradio-e30f0a7ca02801732ad7a25ab83e1d27dc45c6ce.tar.gz
gnuradio-e30f0a7ca02801732ad7a25ab83e1d27dc45c6ce.tar.bz2
gnuradio-e30f0a7ca02801732ad7a25ab83e1d27dc45c6ce.zip
grc: added tabbed widget in qtgui for grc
created gui_hint type to handle tab descriptor + position markup, and to handle the generation of the name of the parent widget. No support python modules required in gr-qtgui.
Diffstat (limited to 'gr-qtgui')
-rw-r--r--gr-qtgui/Makefile.am1
-rw-r--r--gr-qtgui/grc/Makefile.am3
-rw-r--r--gr-qtgui/grc/qtgui_sink_x.xml18
-rw-r--r--gr-qtgui/grc/qtgui_tab_widget.xml84
-rw-r--r--gr-qtgui/grc/qtgui_variable_slider.xml30
5 files changed, 121 insertions, 15 deletions
diff --git a/gr-qtgui/Makefile.am b/gr-qtgui/Makefile.am
index 66746e5e8..30b249589 100644
--- a/gr-qtgui/Makefile.am
+++ b/gr-qtgui/Makefile.am
@@ -26,5 +26,4 @@ DIST_SUBDIRS = src
if PYTHON
SUBDIRS += grc
-SUBDIRS += python
endif
diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am
index 226e9d137..132d1a2e0 100644
--- a/gr-qtgui/grc/Makefile.am
+++ b/gr-qtgui/grc/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2010 Free Software Foundation, Inc.
+# Copyright 2010-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -25,4 +25,5 @@ grcblocksdir = $(grc_blocksdir)
dist_grcblocks_DATA = \
qtgui_sink_x.xml \
+ qtgui_tab_widget.xml \
qtgui_variable_slider.xml
diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml
index 8182f8d94..6e5c9549b 100644
--- a/gr-qtgui/grc/qtgui_sink_x.xml
+++ b/gr-qtgui/grc/qtgui_sink_x.xml
@@ -8,10 +8,12 @@
<name>QT GUI Sink</name>
<key>qtgui_sink_x</key>
<category>Graphical Sinks</category>
+ <import>from PyQt4 import Qt</import>
<import>from gnuradio.qtgui import qtgui</import>
<import>from gnuradio.gr import firdes</import>
<import>import sip</import>
- <make>qtgui.$(type.fcn)(
+ <make>#set $win = 'self._%s_win'%$id
+qtgui.$(type.fcn)(
$fftsize, \#fftsize
$wintype, \#wintype
$fc, \#fc
@@ -23,8 +25,8 @@
$plottime, \#plottime
$plotconst, \#plotconst
)
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), QtGui.QWidget)
-self.layout.addWidget(self._$(id)_win)</make>
+self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
+$(gui_hint()($win))</make>
<callback>set_frequency_range($fc, $bw)</callback>
<param>
<name>Type</name>
@@ -114,11 +116,21 @@ self.layout.addWidget(self._$(id)_win)</make>
<option><name>On</name><key>True</key></option>
<option><name>Off</name><key>False</key></option>
</param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
<sink>
<name>in</name>
<type>$type</type>
<nports>$num_inputs</nports>
</sink>
<doc>
+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_tab_widget.xml b/gr-qtgui/grc/qtgui_tab_widget.xml
new file mode 100644
index 000000000..66597b454
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_tab_widget.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##WX GUI Notebook
+###################################################
+ -->
+<block>
+ <name>QT GUI Tab Widget</name>
+ <key>qtgui_tab_widget</key>
+ <import>from PyQt4 import Qt</import>
+ <make>#set $win = 'self.%s'%$id
+$win = Qt.QTabWidget(None)
+#for i, label in enumerate([$label0, $label1, $label2, $label3, $label4])
+#if int($num_tabs()) > $i
+self.$(id)_widget_$(i) = Qt.QWidget()
+self.$(id)_layout_$(i) = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.$(id)_widget_$(i))
+self.$(id)_grid_layout_$(i) = Qt.QGridLayout()
+self.$(id)_layout_$(i).addLayout(self.$(id)_grid_layout_$(i))
+$(win).addTab(self.$(id)_widget_$(i), $label)
+#end if
+#end for
+$(gui_hint()($win))</make>
+ <param>
+ <name>Num Tabs</name>
+ <key>num_tabs</key>
+ <value>1</value>
+ <type>enum</type>
+ <option><name>1</name><key>1</key></option>
+ <option><name>2</name><key>2</key></option>
+ <option><name>3</name><key>3</key></option>
+ <option><name>4</name><key>4</key></option>
+ <option><name>5</name><key>5</key></option>
+ </param>
+ <param>
+ <name>Label 0</name>
+ <key>label0</key>
+ <value>Tab 0</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 0 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 1</name>
+ <key>label1</key>
+ <value>Tab 1</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 1 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 2</name>
+ <key>label2</key>
+ <value>Tab 2</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 2 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 3</name>
+ <key>label3</key>
+ <value>Tab 3</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 3 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 4</name>
+ <key>label4</key>
+ <value>Tab 4</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 4 then 'none' else 'all'#</hide>
+ </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 tabbed widget to organize other widgets. \
+The ID of this block can be used as the tab_id in the GUI hints of other widgets.
+
+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 5587fdc27..239d90903 100644
--- a/gr-qtgui/grc/qtgui_variable_slider.xml
+++ b/gr-qtgui/grc/qtgui_variable_slider.xml
@@ -6,35 +6,35 @@
###################################################
-->
<block>
- <name>QT GUI Variable Slider</name>
+ <name>QT GUI Slider</name>
<key>variable_qtgui_slider</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 = '_%s_sizer'%$id
+ <make>#set $win = '_%s_layout'%$id
$win = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom)
self._$(id)_tool_bar = Qt.QToolBar(self)
$(win).addWidget(self._$(id)_tool_bar)
#if $label()
-self._$(id)_tool_bar.addWidget(Qt.QLabel($label, self._$(id)_tool_bar))
+self._$(id)_tool_bar.addWidget(Qt.QLabel($label, None))
#else
-self._$(id)_tool_bar.addWidget(Qt.QLabel($id, self._$(id)_tool_bar))
+self._$(id)_tool_bar.addWidget(Qt.QLabel($id, None))
#end if
-self._$(id)_counter = Qwt.QwtCounter(self._$(id)_tool_bar)
+self._$(id)_counter = Qwt.QwtCounter(None)
self._$(id)_counter.setRange($start, $stop, $step)
self._$(id)_counter.setNumButtons(2)
self._$(id)_counter.setValue($value)
self._$(id)_tool_bar.addWidget(self._$(id)_counter)
-$(win).connect(self._$(id)_counter, Qt.SIGNAL('valueChanged(double)'), self.set_$(id))
-self._$(id)_slider = Qwt.QwtSlider(self._$(id)_tool_bar)
+self._$(id)_counter.valueChanged.connect(self.set_$(id))
+self._$(id)_slider = Qwt.QwtSlider(None)
self._$(id)_slider.setRange($start, $stop, $step)
self._$(id)_slider.setValue($value)
self._$(id)_slider.setOrientation(Qt.$orient)
self._$(id)_slider.setScalePosition($orient.scalepos)
-$(win).connect(self._$(id)_slider, Qt.SIGNAL('valueChanged(double)'), self.set_$(id))
+self._$(id)_slider.valueChanged.connect(self.set_$(id))
$(win).addWidget(self._$(id)_slider)
-self.layout.addLayout($win)</make>
+$(gui_hint()($win))</make>
<callback>self.set_$(id)($value)</callback>
<callback>self._$(id)_counter.setValue($id)</callback>
<callback>self._$(id)_slider.setValue($id)</callback>
@@ -68,7 +68,6 @@ self.layout.addLayout($win)</make>
<key>step</key>
<value>1</value>
<type>real</type>
- <hide>part</hide>
</param>
<param>
<name>Orientation</name>
@@ -87,6 +86,13 @@ self.layout.addLayout($win)</make>
<opt>scalepos:Qwt.QwtSlider.RightScale</opt>
</option>
</param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
<check>$start &lt;= $value &lt;= $stop</check>
<check>$start &lt; $stop</check>
<doc>
@@ -94,5 +100,9 @@ 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.
+
+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>