From 9ae8997e5f682bc16e58c0a0bba21794dbd705c5 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 6 Dec 2010 22:46:39 -0500 Subject: qtgui: created a forms module with a slider and text box, implemented in grc --- gr-qtgui/grc/.gitignore | 2 + gr-qtgui/grc/Makefile.am | 28 ++++++++ gr-qtgui/grc/qtgui_sink_x.xml | 124 +++++++++++++++++++++++++++++++++ gr-qtgui/grc/qtgui_variable_slider.xml | 114 ++++++++++++++++++++++++++++++ 4 files changed, 268 insertions(+) create mode 100644 gr-qtgui/grc/.gitignore create mode 100644 gr-qtgui/grc/Makefile.am create mode 100644 gr-qtgui/grc/qtgui_sink_x.xml create mode 100644 gr-qtgui/grc/qtgui_variable_slider.xml (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/.gitignore b/gr-qtgui/grc/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /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 000000000..226e9d137 --- /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 000000000..8182f8d94 --- /dev/null +++ b/gr-qtgui/grc/qtgui_sink_x.xml @@ -0,0 +1,124 @@ + + + + QT GUI Sink + qtgui_sink_x + Graphical Sinks + from gnuradio.qtgui import qtgui + from gnuradio.gr import firdes + import sip + 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) + set_frequency_range($fc, $bw) + + Type + type + complex + enum + + + + + Name + name + QT GUI Plot + string + + + FFT Size + fftsize + 1024 + int + + + Window Type + wintype + firdes.WIN_BLACKMAN_hARRIS + int + part + + + + Center Frequency (Hz) + fc + 0 + real + + + Bandwidth (Hz) + bw + samp_rate + real + + + Plot Frequency + plotfreq + True + bool + part + + + + + Plot Waterfall + plotwaterfall + True + bool + part + + + + + Plot Waterfall 3D + plotwaterfall3d + True + bool + part + + + + + Plot Time + plottime + True + bool + part + + + + + Plot Const + plotconst + True + bool + part + + + + + in + $type + $num_inputs + + + + diff --git a/gr-qtgui/grc/qtgui_variable_slider.xml b/gr-qtgui/grc/qtgui_variable_slider.xml new file mode 100644 index 000000000..37f102ecb --- /dev/null +++ b/gr-qtgui/grc/qtgui_variable_slider.xml @@ -0,0 +1,114 @@ + + + + QT GUI Variable Slider + variable_qtgui_slider + Variables + from gnuradio.qtgui import forms + from PyQt4.QtCore import Qt + self.$(id) = $(id) = $value + #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) + self.set_$(id)($value) + self._$(id)_slider.set_value($id) + self._$(id)_text_box.set_value($id) + + Label + label + + string + #if $label() then 'none' else 'part'# + + + Default Value + value + 50 + real + + + Start + start + 0 + real + + + Stop + stop + 100 + real + + + Step + step + 1 + real + part + + + Orientation + orient + Qt.Horizontal + enum + part + + + + + Converter + converver + float_converter + enum + + + + $start <= $value <= $stop + $start < $stop + +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. + + -- cgit From a284640decd1fd6634f35bd1e20fd69b9194a7b6 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 18 Jan 2011 22:42:48 -0800 Subject: qtgui: use pyqwt widgets in grc variable slider block --- gr-qtgui/grc/qtgui_variable_slider.xml | 68 +++++++++++++--------------------- 1 file changed, 26 insertions(+), 42 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_variable_slider.xml b/gr-qtgui/grc/qtgui_variable_slider.xml index 37f102ecb..5587fdc27 100644 --- a/gr-qtgui/grc/qtgui_variable_slider.xml +++ b/gr-qtgui/grc/qtgui_variable_slider.xml @@ -9,37 +9,35 @@ QT GUI Variable Slider variable_qtgui_slider Variables - from gnuradio.qtgui import forms - from PyQt4.QtCore import Qt + from PyQt4 import Qt + import PyQt4.Qwt5 as Qwt self.$(id) = $(id) = $value #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 = 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)) +#else +self._$(id)_tool_bar.addWidget(Qt.QLabel($id, self._$(id)_tool_bar)) +#end if +self._$(id)_counter = Qwt.QwtCounter(self._$(id)_tool_bar) +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)_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)) $(win).addWidget(self._$(id)_slider) self.layout.addLayout($win) self.set_$(id)($value) - self._$(id)_slider.set_value($id) - self._$(id)_text_box.set_value($id) + self._$(id)_counter.setValue($id) + self._$(id)_slider.setValue($id) Label label @@ -81,26 +79,12 @@ self.layout.addLayout($win) - - - Converter - converver - float_converter - enum - - $start <= $value <= $stop -- cgit From e30f0a7ca02801732ad7a25ab83e1d27dc45c6ce Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 20 Jan 2011 22:31:31 -0800 Subject: 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. --- gr-qtgui/grc/Makefile.am | 3 +- gr-qtgui/grc/qtgui_sink_x.xml | 18 ++++++-- gr-qtgui/grc/qtgui_tab_widget.xml | 84 ++++++++++++++++++++++++++++++++++ gr-qtgui/grc/qtgui_variable_slider.xml | 30 ++++++++---- 4 files changed, 121 insertions(+), 14 deletions(-) create mode 100644 gr-qtgui/grc/qtgui_tab_widget.xml (limited to 'gr-qtgui/grc') 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 @@ QT GUI Sink qtgui_sink_x Graphical Sinks + from PyQt4 import Qt from gnuradio.qtgui import qtgui from gnuradio.gr import firdes import sip - qtgui.$(type.fcn)( + #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) +self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget) +$(gui_hint()($win)) set_frequency_range($fc, $bw) Type @@ -114,11 +116,21 @@ self.layout.addWidget(self._$(id)_win) + + GUI Hint + gui_hint + + gui_hint + part + in $type $num_inputs +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. 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 @@ + + + + QT GUI Tab Widget + qtgui_tab_widget + from PyQt4 import Qt + #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)) + + Num Tabs + num_tabs + 1 + enum + + + + + + + + Label 0 + label0 + Tab 0 + string + #if int($num_tabs()) > 0 then 'none' else 'all'# + + + Label 1 + label1 + Tab 1 + string + #if int($num_tabs()) > 1 then 'none' else 'all'# + + + Label 2 + label2 + Tab 2 + string + #if int($num_tabs()) > 2 then 'none' else 'all'# + + + Label 3 + label3 + Tab 3 + string + #if int($num_tabs()) > 3 then 'none' else 'all'# + + + Label 4 + label4 + Tab 4 + string + #if int($num_tabs()) > 4 then 'none' else 'all'# + + + GUI Hint + gui_hint + + gui_hint + part + + +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. + + 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 @@ ################################################### --> - QT GUI Variable Slider + QT GUI Slider variable_qtgui_slider Variables from PyQt4 import Qt import PyQt4.Qwt5 as Qwt self.$(id) = $(id) = $value - #set $win = '_%s_sizer'%$id + #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) +$(gui_hint()($win)) self.set_$(id)($value) self._$(id)_counter.setValue($id) self._$(id)_slider.setValue($id) @@ -68,7 +68,6 @@ self.layout.addLayout($win) step 1 real - part Orientation @@ -87,6 +86,13 @@ self.layout.addLayout($win) scalepos:Qwt.QwtSlider.RightScale + + GUI Hint + gui_hint + + gui_hint + part + $start <= $value <= $stop $start < $stop @@ -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. -- cgit From 2c263e9640f2812b241d724286aaa1f13c57935f Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 21 Jan 2011 14:33:27 -0800 Subject: qtgui: work on variable chooser --- gr-qtgui/grc/Makefile.am | 1 + gr-qtgui/grc/qtgui_variable_chooser.xml | 85 +++++++++++++++++++++++++++++++++ gr-qtgui/grc/qtgui_variable_slider.xml | 2 +- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 gr-qtgui/grc/qtgui_variable_chooser.xml (limited to 'gr-qtgui/grc') 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 @@ + + + + QT GUI Chooser + variable_qtgui_chooser + Variables + from PyQt4 import Qt + import PyQt4.Qwt5 as Qwt + self.$(id) = $(id) = $value + #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)) + self.set_$(id)($value) + self._$(id)_chooser.setCurrentIndex( + self._$(id)_options.index($id) +) + + Label + label + + string + #if $label() then 'none' else 'part'# + + + + Type + type + real + enum + part + + + + + + + + Default Value + value + 50 + $type + + + + + + GUI Hint + gui_hint + + gui_hint + part + + +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. + + 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) -- cgit From 47f621a14c9a6e3696155dd5a223da40bcb7721c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 27 Feb 2011 23:18:11 -0800 Subject: grc: work on generator for gui flowgraphs to simplify generation generator does not differentiate between notebooks and controls, they are all block, but block are now sorted by variables present in the make also adjusted categories listed in the wx and qt widget related blocks --- gr-qtgui/grc/qtgui_sink_x.xml | 2 +- gr-qtgui/grc/qtgui_tab_widget.xml | 3 ++- gr-qtgui/grc/qtgui_variable_chooser.xml | 6 +++--- gr-qtgui/grc/qtgui_variable_slider.xml | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml index 6e5c9549b..7a5f5ec13 100644 --- a/gr-qtgui/grc/qtgui_sink_x.xml +++ b/gr-qtgui/grc/qtgui_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Sink qtgui_sink_x - Graphical Sinks + QT GUI Widgets from PyQt4 import Qt from gnuradio.qtgui import qtgui from gnuradio.gr import firdes diff --git a/gr-qtgui/grc/qtgui_tab_widget.xml b/gr-qtgui/grc/qtgui_tab_widget.xml index 66597b454..3c4edfd35 100644 --- a/gr-qtgui/grc/qtgui_tab_widget.xml +++ b/gr-qtgui/grc/qtgui_tab_widget.xml @@ -7,9 +7,10 @@ QT GUI Tab Widget qtgui_tab_widget + QT GUI Widgets from PyQt4 import Qt #set $win = 'self.%s'%$id -$win = Qt.QTabWidget(None) +Qt.QTabWidget(None) #for i, label in enumerate([$label0, $label1, $label2, $label3, $label4]) #if int($num_tabs()) > $i self.$(id)_widget_$(i) = Qt.QWidget() diff --git a/gr-qtgui/grc/qtgui_variable_chooser.xml b/gr-qtgui/grc/qtgui_variable_chooser.xml index 46e302bc7..d9c9c8f3f 100644 --- a/gr-qtgui/grc/qtgui_variable_chooser.xml +++ b/gr-qtgui/grc/qtgui_variable_chooser.xml @@ -1,14 +1,14 @@ QT GUI Chooser variable_qtgui_chooser - Variables + QT GUI Widgets from PyQt4 import Qt import PyQt4.Qwt5 as Qwt self.$(id) = $(id) = $value diff --git a/gr-qtgui/grc/qtgui_variable_slider.xml b/gr-qtgui/grc/qtgui_variable_slider.xml index 4eeb7a29b..68000fa2f 100644 --- a/gr-qtgui/grc/qtgui_variable_slider.xml +++ b/gr-qtgui/grc/qtgui_variable_slider.xml @@ -8,7 +8,7 @@ QT GUI Slider variable_qtgui_slider - Variables + QT GUI Widgets from PyQt4 import Qt import PyQt4.Qwt5 as Qwt self.$(id) = $(id) = $value -- cgit From c1ff442c8b450e7b0e41cd7b717d7368de3e6898 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 28 Feb 2011 11:09:40 -0800 Subject: grc-qtgui: work on variable chooser block --- gr-qtgui/grc/qtgui_tab_widget.xml | 5 +- gr-qtgui/grc/qtgui_variable_chooser.xml | 120 ++++++++++++++++++++++++++++---- 2 files changed, 108 insertions(+), 17 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_tab_widget.xml b/gr-qtgui/grc/qtgui_tab_widget.xml index 3c4edfd35..efdeaa19a 100644 --- a/gr-qtgui/grc/qtgui_tab_widget.xml +++ b/gr-qtgui/grc/qtgui_tab_widget.xml @@ -11,14 +11,13 @@ from PyQt4 import Qt #set $win = 'self.%s'%$id Qt.QTabWidget(None) -#for i, label in enumerate([$label0, $label1, $label2, $label3, $label4]) -#if int($num_tabs()) > $i +#set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_tabs())] +#for i, label in enumerate($all_labels) 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)) diff --git a/gr-qtgui/grc/qtgui_variable_chooser.xml b/gr-qtgui/grc/qtgui_variable_chooser.xml index d9c9c8f3f..7e3906902 100644 --- a/gr-qtgui/grc/qtgui_variable_chooser.xml +++ b/gr-qtgui/grc/qtgui_variable_chooser.xml @@ -21,17 +21,43 @@ $(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') - +#set $all_options = [$option0, $option1, $option2][:int($num_opts())] +#set $all_labels = [$label0, $label1, $label2][:int($num_opts())] +######################################################################## +## Create the options list +######################################################################## +#if $num_opts() +self._$(id)_options = ( + #for $ch in $all_options + $ch, + #end for +) +#else +self._$(id)_options = $options +#end if +######################################################################## +## Create a widget for each item +######################################################################## +#if $num_opts() +self._$(id)_labels = ( + #for i, $lbl in enumerate($all_labels) + #if $lbl() + $lbl, + #else + str(self._$(id)_options[$i]), + #end if + #end for +) +#elif $labels +self._$(id)_labels = $labels +#else +self._$(id)_labels = map(str, self._$(id)_options) +#end if +for label in self._$(id)_labels: + self._$(id)_chooser.addItem(label) self._$(id)_chooser.currentIndexChanged.connect( lambda i: self.set_$(id)(self._$(id)_options[i]) ) - $(gui_hint()($win)) self.set_$(id)($value) self._$(id)_chooser.setCurrentIndex( @@ -44,7 +70,6 @@ $(gui_hint()($win)) string #if $label() then 'none' else 'part'# - Type type @@ -56,16 +81,78 @@ $(gui_hint()($win)) - + + Num Options + num_opts + 3 + enum + + + + + Default Value value 50 $type - - - + + Options + options + [0, 1, 2] + raw + #if int($num_opts()) then 'all' else 'none'# + + + Labels + labels + [] + raw + #if int($num_opts()) then 'all' else 'none'# + + + Option 0 + option0 + 0 + $type + #if int($num_opts()) > 0 then 'none' else 'all'# + + + Label 0 + label0 + + string + $((int($num_opts()) > 0) and ($label0() and 'none' or 'part') or 'all') + + + Option 1 + option1 + 1 + $type + #if int($num_opts()) > 1 then 'none' else 'all'# + + + Label 1 + label1 + + string + $((int($num_opts()) > 1) and ($label1() and 'none' or 'part') or 'all') + + + Option 2 + option2 + 2 + $type + #if int($num_opts()) > 2 then 'none' else 'all'# + + + Label 2 + label2 + + string + $((int($num_opts()) > 2) and ($label2() and 'none' or 'part') or 'all') + GUI Hint gui_hint @@ -74,10 +161,15 @@ $(gui_hint()($win)) part -This block creates a variable with enumerated choices. \ +This block creates a variable with enumerated options. \ 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. +Choose the number of options available to your chooser. \ +When the label is left blank, the option will be used as the label. \ +Set the number of options to "list" to enter a single list of options and labels. \ +When the labels is an empty list, the options will be used 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. -- cgit From d829499725251ce5d1b9fd81a83cb92e0f3ebce3 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 28 Feb 2011 16:51:55 -0800 Subject: grc-qtgui: added radio button support, tweaks, more options --- gr-qtgui/grc/qtgui_variable_chooser.xml | 132 ++++++++++++++++++++++++++------ 1 file changed, 107 insertions(+), 25 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_variable_chooser.xml b/gr-qtgui/grc/qtgui_variable_chooser.xml index 7e3906902..632cfa099 100644 --- a/gr-qtgui/grc/qtgui_variable_chooser.xml +++ b/gr-qtgui/grc/qtgui_variable_chooser.xml @@ -12,39 +12,31 @@ from PyQt4 import Qt import PyQt4.Qwt5 as Qwt self.$(id) = $(id) = $value - #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) -#set $all_options = [$option0, $option1, $option2][:int($num_opts())] -#set $all_labels = [$label0, $label1, $label2][:int($num_opts())] + #slurp +#set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())] +#set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_opts())] ######################################################################## ## Create the options list ######################################################################## #if $num_opts() -self._$(id)_options = ( +self._$(id)_options = (#slurp #for $ch in $all_options - $ch, +$ch, #slurp #end for ) #else self._$(id)_options = $options #end if ######################################################################## -## Create a widget for each item +## Create the labels list ######################################################################## #if $num_opts() -self._$(id)_labels = ( +self._$(id)_labels = (#slurp #for i, $lbl in enumerate($all_labels) #if $lbl() - $lbl, +$lbl, #slurp #else - str(self._$(id)_options[$i]), +str(self._$(id)_options[$i]), #slurp #end if #end for ) @@ -53,16 +45,52 @@ self._$(id)_labels = $labels #else self._$(id)_labels = map(str, self._$(id)_options) #end if -for label in self._$(id)_labels: - self._$(id)_chooser.addItem(label) -self._$(id)_chooser.currentIndexChanged.connect( +######################################################################## +## Create the combo box +######################################################################## +#if $widget() == 'combo_box' +#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)_combo_box = Qt.QComboBox(None) +$(win).addWidget(self._$(id)_combo_box) +for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label) +self._$(id)_callback = lambda i: self._$(id)_combo_box.setCurrentIndex(self._$(id)_options.index(i)) +self._$(id)_callback(self.$id) +self._$(id)_combo_box.currentIndexChanged.connect( lambda i: self.set_$(id)(self._$(id)_options[i]) ) +#end if +######################################################################## +## Create the radio buttons +######################################################################## +#if $widget() == 'radio_buttons' +#set $win = 'self._%s_radio_group'%$id +#if $label() +$win = Qt.QGroupBox($label) +#else +$win = Qt.QGroupBox("$id") +#end if +self._$(id)_box = $(orient)() +self._$(id)_button_group = Qt.QButtonGroup() +$(win).setLayout(self._$(id)_box) +for i, label in enumerate(self._$(id)_labels): + radio_button = Qt.QRadioButton(label) + self._$(id)_box.addWidget(radio_button) + self._$(id)_button_group.addButton(radio_button, i) +self._$(id)_callback = lambda i: self._$(id)_button_group.button(self._$(id)_options.index(i)).setChecked(True) +self._$(id)_callback(self.$id) +self._$(id)_button_group.buttonClicked.connect( + lambda i: self.set_$(id)(self._$(id)_options[self._$(id)_button_group.checkedId()]) +) +#end if $(gui_hint()($win)) self.set_$(id)($value) - self._$(id)_chooser.setCurrentIndex( - self._$(id)_options.index($id) -) + self._$(id)_callback($id) Label label @@ -73,7 +101,7 @@ $(gui_hint()($win)) Type type - real + int enum part @@ -90,11 +118,13 @@ $(gui_hint()($win)) + + Default Value value - 50 + 0 $type @@ -153,6 +183,58 @@ $(gui_hint()($win)) string $((int($num_opts()) > 2) and ($label2() and 'none' or 'part') or 'all') + + Option 3 + option3 + 3 + $type + #if int($num_opts()) > 3 then 'none' else 'all'# + + + Label 3 + label3 + + string + $((int($num_opts()) > 3) and ($label3() and 'none' or 'part') or 'all') + + + Option 4 + option4 + 4 + $type + #if int($num_opts()) > 4 then 'none' else 'all'# + + + Label 4 + label4 + + string + $((int($num_opts()) > 4) and ($label4() and 'none' or 'part') or 'all') + + + Widget + widget + combo_box + enum + part + + + + + Orientation + orient + Qt.QVBoxLayout + enum + #if $widget() == 'radio_buttons' then 'part' else 'all'# + + + GUI Hint gui_hint -- cgit From c86fb3460c14cc308f0809e08f3fb460f70c08d9 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 28 Feb 2011 19:15:29 -0800 Subject: grc-qtgui: pick correct signal overload for variable chooser --- gr-qtgui/grc/qtgui_variable_chooser.xml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_variable_chooser.xml b/gr-qtgui/grc/qtgui_variable_chooser.xml index 632cfa099..b833fb8ad 100644 --- a/gr-qtgui/grc/qtgui_variable_chooser.xml +++ b/gr-qtgui/grc/qtgui_variable_chooser.xml @@ -62,8 +62,7 @@ for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label) self._$(id)_callback = lambda i: self._$(id)_combo_box.setCurrentIndex(self._$(id)_options.index(i)) self._$(id)_callback(self.$id) self._$(id)_combo_box.currentIndexChanged.connect( - lambda i: self.set_$(id)(self._$(id)_options[i]) -) + lambda i: self.set_$(id)(self._$(id)_options[i])) #end if ######################################################################## ## Create the radio buttons @@ -84,9 +83,8 @@ for i, label in enumerate(self._$(id)_labels): self._$(id)_button_group.addButton(radio_button, i) self._$(id)_callback = lambda i: self._$(id)_button_group.button(self._$(id)_options.index(i)).setChecked(True) self._$(id)_callback(self.$id) -self._$(id)_button_group.buttonClicked.connect( - lambda i: self.set_$(id)(self._$(id)_options[self._$(id)_button_group.checkedId()]) -) +self._$(id)_button_group.buttonClicked[int].connect( + lambda i: self.set_$(id)(self._$(id)_options[i])) #end if $(gui_hint()($win)) self.set_$(id)($value) -- cgit From 931332448227a6b509a9b39bb68044fa55d8b1cb Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 1 Mar 2011 00:32:55 -0800 Subject: grc-qtgui: added variable text box and static text widgets --- gr-qtgui/grc/Makefile.am | 6 +- gr-qtgui/grc/qtgui_chooser.xml | 256 +++++++++++++++++++++++++++++++ gr-qtgui/grc/qtgui_slider.xml | 108 ++++++++++++++ gr-qtgui/grc/qtgui_static_text.xml | 65 ++++++++ gr-qtgui/grc/qtgui_text_box.xml | 67 +++++++++ gr-qtgui/grc/qtgui_variable_chooser.xml | 257 -------------------------------- gr-qtgui/grc/qtgui_variable_slider.xml | 108 -------------- 7 files changed, 500 insertions(+), 367 deletions(-) create mode 100644 gr-qtgui/grc/qtgui_chooser.xml create mode 100644 gr-qtgui/grc/qtgui_slider.xml create mode 100644 gr-qtgui/grc/qtgui_static_text.xml create mode 100644 gr-qtgui/grc/qtgui_text_box.xml delete mode 100644 gr-qtgui/grc/qtgui_variable_chooser.xml delete mode 100644 gr-qtgui/grc/qtgui_variable_slider.xml (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am index e69d3a9af..1153fc976 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_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml new file mode 100644 index 000000000..5f383949e --- /dev/null +++ b/gr-qtgui/grc/qtgui_chooser.xml @@ -0,0 +1,256 @@ + + + + QT GUI Chooser + variable_qtgui_chooser + QT GUI Widgets + from PyQt4 import Qt + self.$(id) = $(id) = $value + #slurp +#set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())] +#set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_opts())] +######################################################################## +## Create the options list +######################################################################## +#if $num_opts() +self._$(id)_options = (#slurp + #for $ch in $all_options +$ch, #slurp + #end for +) +#else +self._$(id)_options = $options +#end if +######################################################################## +## Create the labels list +######################################################################## +#if $num_opts() +self._$(id)_labels = (#slurp + #for i, $lbl in enumerate($all_labels) + #if $lbl() +$lbl, #slurp + #else +str(self._$(id)_options[$i]), #slurp + #end if + #end for +) +#elif $labels +self._$(id)_labels = $labels +#else +self._$(id)_labels = map(str, self._$(id)_options) +#end if +######################################################################## +## Create the combo box +######################################################################## +#if $widget() == 'combo_box' +#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)_combo_box = Qt.QComboBox(None) +$(win).addWidget(self._$(id)_combo_box) +for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label) +self._$(id)_callback = lambda i: self._$(id)_combo_box.setCurrentIndex(self._$(id)_options.index(i)) +self._$(id)_callback(self.$id) +self._$(id)_combo_box.currentIndexChanged.connect( + lambda i: self.set_$(id)(self._$(id)_options[i])) +#end if +######################################################################## +## Create the radio buttons +######################################################################## +#if $widget() == 'radio_buttons' +#set $win = 'self._%s_radio_group'%$id +#if $label() +$win = Qt.QGroupBox($label) +#else +$win = Qt.QGroupBox("$id") +#end if +self._$(id)_box = $(orient)() +self._$(id)_button_group = Qt.QButtonGroup() +$(win).setLayout(self._$(id)_box) +for i, label in enumerate(self._$(id)_labels): + radio_button = Qt.QRadioButton(label) + self._$(id)_box.addWidget(radio_button) + self._$(id)_button_group.addButton(radio_button, i) +self._$(id)_callback = lambda i: self._$(id)_button_group.button(self._$(id)_options.index(i)).setChecked(True) +self._$(id)_callback(self.$id) +self._$(id)_button_group.buttonClicked[int].connect( + lambda i: self.set_$(id)(self._$(id)_options[i])) +#end if +$(gui_hint()($win)) + self.set_$(id)($value) + self._$(id)_callback($id) + + Label + label + + string + #if $label() then 'none' else 'part'# + + + Type + type + int + enum + part + + + + + + + Num Options + num_opts + 3 + enum + + + + + + + + + Default Value + value + 0 + $type + + + Options + options + [0, 1, 2] + raw + #if int($num_opts()) then 'all' else 'none'# + + + Labels + labels + [] + raw + #if int($num_opts()) then 'all' else 'none'# + + + Option 0 + option0 + 0 + $type + #if int($num_opts()) > 0 then 'none' else 'all'# + + + Label 0 + label0 + + string + $((int($num_opts()) > 0) and ($label0() and 'none' or 'part') or 'all') + + + Option 1 + option1 + 1 + $type + #if int($num_opts()) > 1 then 'none' else 'all'# + + + Label 1 + label1 + + string + $((int($num_opts()) > 1) and ($label1() and 'none' or 'part') or 'all') + + + Option 2 + option2 + 2 + $type + #if int($num_opts()) > 2 then 'none' else 'all'# + + + Label 2 + label2 + + string + $((int($num_opts()) > 2) and ($label2() and 'none' or 'part') or 'all') + + + Option 3 + option3 + 3 + $type + #if int($num_opts()) > 3 then 'none' else 'all'# + + + Label 3 + label3 + + string + $((int($num_opts()) > 3) and ($label3() and 'none' or 'part') or 'all') + + + Option 4 + option4 + 4 + $type + #if int($num_opts()) > 4 then 'none' else 'all'# + + + Label 4 + label4 + + string + $((int($num_opts()) > 4) and ($label4() and 'none' or 'part') or 'all') + + + Widget + widget + combo_box + enum + part + + + + + Orientation + orient + Qt.QVBoxLayout + enum + #if $widget() == 'radio_buttons' then 'part' else 'all'# + + + + + GUI Hint + gui_hint + + gui_hint + part + + +This block creates a variable with enumerated options. \ +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. + +Choose the number of options available to your chooser. \ +When the label is left blank, the option will be used as the label. \ +Set the number of options to "list" to enter a single list of options and labels. \ +When the labels is an empty list, the options will be used 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. + + diff --git a/gr-qtgui/grc/qtgui_slider.xml b/gr-qtgui/grc/qtgui_slider.xml new file mode 100644 index 000000000..68000fa2f --- /dev/null +++ b/gr-qtgui/grc/qtgui_slider.xml @@ -0,0 +1,108 @@ + + + + QT GUI Slider + variable_qtgui_slider + QT GUI Widgets + from PyQt4 import Qt + import PyQt4.Qwt5 as Qwt + self.$(id) = $(id) = $value + #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, None)) +#else +self._$(id)_tool_bar.addWidget(Qt.QLabel("$id", None)) +#end if +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) +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) +self._$(id)_slider.valueChanged.connect(self.set_$(id)) +$(win).addWidget(self._$(id)_slider) +$(gui_hint()($win)) + self.set_$(id)($value) + self._$(id)_counter.setValue($id) + self._$(id)_slider.setValue($id) + + Label + label + + string + #if $label() then 'none' else 'part'# + + + Default Value + value + 50 + real + + + Start + start + 0 + real + + + Stop + stop + 100 + real + + + Step + step + 1 + real + + + Orientation + orient + Qt.Horizontal + enum + part + + + + + GUI Hint + gui_hint + + gui_hint + part + + $start <= $value <= $stop + $start < $stop + +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. + + diff --git a/gr-qtgui/grc/qtgui_static_text.xml b/gr-qtgui/grc/qtgui_static_text.xml new file mode 100644 index 000000000..92346b071 --- /dev/null +++ b/gr-qtgui/grc/qtgui_static_text.xml @@ -0,0 +1,65 @@ + + + + QT GUI Static Text + variable_qtgui_static_text + QT GUI Widgets + from PyQt4 import Qt + self.$(id) = $(id) = $value + #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)) + self.set_$(id)($value) + self._$(id)_label.setText(str($id)) + + Label + label + + string + #if $label() then 'none' else 'part'# + + + Type + type + int + enum + part + + + + + + + Default Value + value + 0 + $type + + + GUI Hint + gui_hint + + gui_hint + part + + +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. + + diff --git a/gr-qtgui/grc/qtgui_text_box.xml b/gr-qtgui/grc/qtgui_text_box.xml new file mode 100644 index 000000000..4fd961f55 --- /dev/null +++ b/gr-qtgui/grc/qtgui_text_box.xml @@ -0,0 +1,67 @@ + + + + QT GUI Text Box + variable_qtgui_text_box + QT GUI Widgets + from PyQt4 import Qt + self.$(id) = $(id) = $value + #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)) + self.set_$(id)($value) + self._$(id)_line_edit.setText(str($id)) + + Label + label + + string + #if $label() then 'none' else 'part'# + + + Type + type + int + enum + part + + + + + + + Default Value + value + 0 + $type + + + GUI Hint + gui_hint + + gui_hint + part + + +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. + + diff --git a/gr-qtgui/grc/qtgui_variable_chooser.xml b/gr-qtgui/grc/qtgui_variable_chooser.xml deleted file mode 100644 index b833fb8ad..000000000 --- a/gr-qtgui/grc/qtgui_variable_chooser.xml +++ /dev/null @@ -1,257 +0,0 @@ - - - - QT GUI Chooser - variable_qtgui_chooser - QT GUI Widgets - from PyQt4 import Qt - import PyQt4.Qwt5 as Qwt - self.$(id) = $(id) = $value - #slurp -#set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())] -#set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_opts())] -######################################################################## -## Create the options list -######################################################################## -#if $num_opts() -self._$(id)_options = (#slurp - #for $ch in $all_options -$ch, #slurp - #end for -) -#else -self._$(id)_options = $options -#end if -######################################################################## -## Create the labels list -######################################################################## -#if $num_opts() -self._$(id)_labels = (#slurp - #for i, $lbl in enumerate($all_labels) - #if $lbl() -$lbl, #slurp - #else -str(self._$(id)_options[$i]), #slurp - #end if - #end for -) -#elif $labels -self._$(id)_labels = $labels -#else -self._$(id)_labels = map(str, self._$(id)_options) -#end if -######################################################################## -## Create the combo box -######################################################################## -#if $widget() == 'combo_box' -#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)_combo_box = Qt.QComboBox(None) -$(win).addWidget(self._$(id)_combo_box) -for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label) -self._$(id)_callback = lambda i: self._$(id)_combo_box.setCurrentIndex(self._$(id)_options.index(i)) -self._$(id)_callback(self.$id) -self._$(id)_combo_box.currentIndexChanged.connect( - lambda i: self.set_$(id)(self._$(id)_options[i])) -#end if -######################################################################## -## Create the radio buttons -######################################################################## -#if $widget() == 'radio_buttons' -#set $win = 'self._%s_radio_group'%$id -#if $label() -$win = Qt.QGroupBox($label) -#else -$win = Qt.QGroupBox("$id") -#end if -self._$(id)_box = $(orient)() -self._$(id)_button_group = Qt.QButtonGroup() -$(win).setLayout(self._$(id)_box) -for i, label in enumerate(self._$(id)_labels): - radio_button = Qt.QRadioButton(label) - self._$(id)_box.addWidget(radio_button) - self._$(id)_button_group.addButton(radio_button, i) -self._$(id)_callback = lambda i: self._$(id)_button_group.button(self._$(id)_options.index(i)).setChecked(True) -self._$(id)_callback(self.$id) -self._$(id)_button_group.buttonClicked[int].connect( - lambda i: self.set_$(id)(self._$(id)_options[i])) -#end if -$(gui_hint()($win)) - self.set_$(id)($value) - self._$(id)_callback($id) - - Label - label - - string - #if $label() then 'none' else 'part'# - - - Type - type - int - enum - part - - - - - - - Num Options - num_opts - 3 - enum - - - - - - - - - Default Value - value - 0 - $type - - - Options - options - [0, 1, 2] - raw - #if int($num_opts()) then 'all' else 'none'# - - - Labels - labels - [] - raw - #if int($num_opts()) then 'all' else 'none'# - - - Option 0 - option0 - 0 - $type - #if int($num_opts()) > 0 then 'none' else 'all'# - - - Label 0 - label0 - - string - $((int($num_opts()) > 0) and ($label0() and 'none' or 'part') or 'all') - - - Option 1 - option1 - 1 - $type - #if int($num_opts()) > 1 then 'none' else 'all'# - - - Label 1 - label1 - - string - $((int($num_opts()) > 1) and ($label1() and 'none' or 'part') or 'all') - - - Option 2 - option2 - 2 - $type - #if int($num_opts()) > 2 then 'none' else 'all'# - - - Label 2 - label2 - - string - $((int($num_opts()) > 2) and ($label2() and 'none' or 'part') or 'all') - - - Option 3 - option3 - 3 - $type - #if int($num_opts()) > 3 then 'none' else 'all'# - - - Label 3 - label3 - - string - $((int($num_opts()) > 3) and ($label3() and 'none' or 'part') or 'all') - - - Option 4 - option4 - 4 - $type - #if int($num_opts()) > 4 then 'none' else 'all'# - - - Label 4 - label4 - - string - $((int($num_opts()) > 4) and ($label4() and 'none' or 'part') or 'all') - - - Widget - widget - combo_box - enum - part - - - - - Orientation - orient - Qt.QVBoxLayout - enum - #if $widget() == 'radio_buttons' then 'part' else 'all'# - - - - - GUI Hint - gui_hint - - gui_hint - part - - -This block creates a variable with enumerated options. \ -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. - -Choose the number of options available to your chooser. \ -When the label is left blank, the option will be used as the label. \ -Set the number of options to "list" to enter a single list of options and labels. \ -When the labels is an empty list, the options will be used 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. - - diff --git a/gr-qtgui/grc/qtgui_variable_slider.xml b/gr-qtgui/grc/qtgui_variable_slider.xml deleted file mode 100644 index 68000fa2f..000000000 --- a/gr-qtgui/grc/qtgui_variable_slider.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - QT GUI Slider - variable_qtgui_slider - QT GUI Widgets - from PyQt4 import Qt - import PyQt4.Qwt5 as Qwt - self.$(id) = $(id) = $value - #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, None)) -#else -self._$(id)_tool_bar.addWidget(Qt.QLabel("$id", None)) -#end if -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) -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) -self._$(id)_slider.valueChanged.connect(self.set_$(id)) -$(win).addWidget(self._$(id)_slider) -$(gui_hint()($win)) - self.set_$(id)($value) - self._$(id)_counter.setValue($id) - self._$(id)_slider.setValue($id) - - Label - label - - string - #if $label() then 'none' else 'part'# - - - Default Value - value - 50 - real - - - Start - start - 0 - real - - - Stop - stop - 100 - real - - - Step - step - 1 - real - - - Orientation - orient - Qt.Horizontal - enum - part - - - - - GUI Hint - gui_hint - - gui_hint - part - - $start <= $value <= $stop - $start < $stop - -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. - - -- cgit From a09e0096cf717c137126cd5fb721c0331a1a8df6 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 1 Mar 2011 13:03:36 -0800 Subject: grc-qtgui: creaded check box widget with qtgui, cleanup label code --- gr-qtgui/grc/Makefile.am | 1 + gr-qtgui/grc/qtgui_check_box.xml | 83 ++++++++++++++++++++++++++++++++++++++ gr-qtgui/grc/qtgui_chooser.xml | 13 ++---- gr-qtgui/grc/qtgui_slider.xml | 7 ++-- gr-qtgui/grc/qtgui_static_text.xml | 8 ++-- gr-qtgui/grc/qtgui_text_box.xml | 8 ++-- 6 files changed, 99 insertions(+), 21 deletions(-) create mode 100644 gr-qtgui/grc/qtgui_check_box.xml (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am index 1153fc976..23e01a2c6 100644 --- a/gr-qtgui/grc/Makefile.am +++ b/gr-qtgui/grc/Makefile.am @@ -24,6 +24,7 @@ include $(top_srcdir)/Makefile.common grcblocksdir = $(grc_blocksdir) dist_grcblocks_DATA = \ + qtgui_check_box.xml \ qtgui_sink_x.xml \ qtgui_static_text.xml \ qtgui_tab_widget.xml \ diff --git a/gr-qtgui/grc/qtgui_check_box.xml b/gr-qtgui/grc/qtgui_check_box.xml new file mode 100644 index 000000000..95f4f968a --- /dev/null +++ b/gr-qtgui/grc/qtgui_check_box.xml @@ -0,0 +1,83 @@ + + + + QT GUI Check Box + variable_qtgui_check_box + QT GUI Widgets + from PyQt4 import Qt + self.$(id) = $(id) = $value + #set $win = '_%s_check_box'%$id +#if not $label() + #set $label = '"%s"'%$id +#end if +$win = Qt.QCheckBox($label) +self._$(id)_choices = {True: $true, False: $false} +self._$(id)_choices_inv = dict((v,k) for k,v in self._$(id)_choices.iteritems()) +self._$(id)_callback = lambda i: $(win).setChecked(self._$(id)_choices_inv[i]) +self._$(id)_callback(self.$id) +$(win).stateChanged.connect(lambda i: self.set_$(id)(self._$(id)_choices[bool(i)])) +$(gui_hint()($win)) + self.set_$(id)($value) + self._$(id)_callback($id) + + Label + label + + string + #if $label() then 'none' else 'part'# + + + Type + type + int + enum + part + + + + + + + + Default Value + value + True + $type + + + True + true + True + $type + + + False + false + False + $type + + + GUI Hint + gui_hint + + gui_hint + part + + $value in ($true, $false) + +This block creates a variable check box. \ +Leave the label blank to use the variable id as the label. + +A check box selects between two values of similar type. \ +Te values do not necessarily need to be of boolean type. + +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. + + diff --git a/gr-qtgui/grc/qtgui_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml index 5f383949e..0d95c7cda 100644 --- a/gr-qtgui/grc/qtgui_chooser.xml +++ b/gr-qtgui/grc/qtgui_chooser.xml @@ -14,6 +14,9 @@ #slurp #set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())] #set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_opts())] +#if not $label() + #set $label = '"%s"'%$id +#end if ######################################################################## ## Create the options list ######################################################################## @@ -50,11 +53,7 @@ self._$(id)_labels = map(str, self._$(id)_options) #if $widget() == 'combo_box' #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)_combo_box = Qt.QComboBox(None) $(win).addWidget(self._$(id)_combo_box) for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label) @@ -67,12 +66,8 @@ self._$(id)_combo_box.currentIndexChanged.connect( ## Create the radio buttons ######################################################################## #if $widget() == 'radio_buttons' -#set $win = 'self._%s_radio_group'%$id -#if $label() +#set $win = 'self._%s_group_box'%$id $win = Qt.QGroupBox($label) -#else -$win = Qt.QGroupBox("$id") -#end if self._$(id)_box = $(orient)() self._$(id)_button_group = Qt.QButtonGroup() $(win).setLayout(self._$(id)_box) diff --git a/gr-qtgui/grc/qtgui_slider.xml b/gr-qtgui/grc/qtgui_slider.xml index 68000fa2f..e29123878 100644 --- a/gr-qtgui/grc/qtgui_slider.xml +++ b/gr-qtgui/grc/qtgui_slider.xml @@ -16,11 +16,10 @@ $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, None)) -#else -self._$(id)_tool_bar.addWidget(Qt.QLabel("$id", None)) +#if not $label() + #set $label = '"%s"'%$id #end if +self._$(id)_tool_bar.addWidget(Qt.QLabel($label, None)) self._$(id)_counter = Qwt.QwtCounter(None) self._$(id)_counter.setRange($start, $stop, $step) self._$(id)_counter.setNumButtons(2) diff --git a/gr-qtgui/grc/qtgui_static_text.xml b/gr-qtgui/grc/qtgui_static_text.xml index 92346b071..f20bf7e69 100644 --- a/gr-qtgui/grc/qtgui_static_text.xml +++ b/gr-qtgui/grc/qtgui_static_text.xml @@ -13,11 +13,10 @@ self.$(id) = $(id) = $value #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)) +#if not $label() + #set $label = '"%s"'%$id #end if +$(win).addWidget(Qt.QLabel($label+" ", None)) self._$(id)_label = Qt.QLabel(str(self.$id)) self._$(id)_tool_bar.addWidget(self._$(id)_label) $(gui_hint()($win)) @@ -39,6 +38,7 @@ $(gui_hint()($win)) + diff --git a/gr-qtgui/grc/qtgui_text_box.xml b/gr-qtgui/grc/qtgui_text_box.xml index 4fd961f55..0d7fe36ee 100644 --- a/gr-qtgui/grc/qtgui_text_box.xml +++ b/gr-qtgui/grc/qtgui_text_box.xml @@ -13,11 +13,10 @@ self.$(id) = $(id) = $value #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)) +#if not $label() + #set $label = '"%s"'%$id #end if +$(win).addWidget(Qt.QLabel($label+" ", None)) self._$(id)_line_edit = Qt.QLineEdit(str(self.$id)) self._$(id)_tool_bar.addWidget(self._$(id)_line_edit) self._$(id)_line_edit.returnPressed.connect( @@ -41,6 +40,7 @@ $(gui_hint()($win)) + -- cgit From fb5d1b80dc97bf940079b5a4b3b3f35002cc60aa Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 1 Mar 2011 18:05:34 -0800 Subject: qtgui-grc: rename the text entry and label blocks --- gr-qtgui/grc/Makefile.am | 4 +-- gr-qtgui/grc/qtgui_entry.xml | 67 ++++++++++++++++++++++++++++++++++++++ gr-qtgui/grc/qtgui_label.xml | 65 ++++++++++++++++++++++++++++++++++++ gr-qtgui/grc/qtgui_static_text.xml | 65 ------------------------------------ gr-qtgui/grc/qtgui_text_box.xml | 67 -------------------------------------- 5 files changed, 134 insertions(+), 134 deletions(-) create mode 100644 gr-qtgui/grc/qtgui_entry.xml create mode 100644 gr-qtgui/grc/qtgui_label.xml delete mode 100644 gr-qtgui/grc/qtgui_static_text.xml delete mode 100644 gr-qtgui/grc/qtgui_text_box.xml (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am index 23e01a2c6..3045a8779 100644 --- a/gr-qtgui/grc/Makefile.am +++ b/gr-qtgui/grc/Makefile.am @@ -25,9 +25,9 @@ grcblocksdir = $(grc_blocksdir) dist_grcblocks_DATA = \ qtgui_check_box.xml \ + qtgui_entry.xml \ + qtgui_label.xml \ qtgui_sink_x.xml \ - qtgui_static_text.xml \ qtgui_tab_widget.xml \ - qtgui_text_box.xml \ qtgui_chooser.xml \ qtgui_slider.xml diff --git a/gr-qtgui/grc/qtgui_entry.xml b/gr-qtgui/grc/qtgui_entry.xml new file mode 100644 index 000000000..63c14ad8f --- /dev/null +++ b/gr-qtgui/grc/qtgui_entry.xml @@ -0,0 +1,67 @@ + + + + QT GUI Entry + variable_qtgui_entry + QT GUI Widgets + from PyQt4 import Qt + self.$(id) = $(id) = $value + #set $win = 'self._%s_tool_bar'%$id +$win = Qt.QToolBar(self) +#if not $label() + #set $label = '"%s"'%$id +#end if +$(win).addWidget(Qt.QLabel($label+" ", None)) +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)) + self.set_$(id)($value) + self._$(id)_line_edit.setText(str($id)) + + Label + label + + string + #if $label() then 'none' else 'part'# + + + Type + type + int + enum + part + + + + + + + + Default Value + value + 0 + $type + + + GUI Hint + gui_hint + + gui_hint + part + + +This block creates a variable with a text entry box. \ +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. + + diff --git a/gr-qtgui/grc/qtgui_label.xml b/gr-qtgui/grc/qtgui_label.xml new file mode 100644 index 000000000..90286d0b2 --- /dev/null +++ b/gr-qtgui/grc/qtgui_label.xml @@ -0,0 +1,65 @@ + + + + QT GUI Label + variable_qtgui_label + QT GUI Widgets + from PyQt4 import Qt + self.$(id) = $(id) = $value + #set $win = 'self._%s_tool_bar'%$id +$win = Qt.QToolBar(self) +#if not $label() + #set $label = '"%s"'%$id +#end if +$(win).addWidget(Qt.QLabel($label+" ", None)) +self._$(id)_label = Qt.QLabel(str(self.$id)) +self._$(id)_tool_bar.addWidget(self._$(id)_label) +$(gui_hint()($win)) + self.set_$(id)($value) + self._$(id)_label.setText(str($id)) + + Label + label + + string + #if $label() then 'none' else 'part'# + + + Type + type + int + enum + part + + + + + + + + Default Value + value + 0 + $type + + + GUI Hint + gui_hint + + gui_hint + part + + +This block creates a variable with a label widget for text. \ +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. + + diff --git a/gr-qtgui/grc/qtgui_static_text.xml b/gr-qtgui/grc/qtgui_static_text.xml deleted file mode 100644 index f20bf7e69..000000000 --- a/gr-qtgui/grc/qtgui_static_text.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - QT GUI Static Text - variable_qtgui_static_text - QT GUI Widgets - from PyQt4 import Qt - self.$(id) = $(id) = $value - #set $win = 'self._%s_tool_bar'%$id -$win = Qt.QToolBar(self) -#if not $label() - #set $label = '"%s"'%$id -#end if -$(win).addWidget(Qt.QLabel($label+" ", None)) -self._$(id)_label = Qt.QLabel(str(self.$id)) -self._$(id)_tool_bar.addWidget(self._$(id)_label) -$(gui_hint()($win)) - self.set_$(id)($value) - self._$(id)_label.setText(str($id)) - - Label - label - - string - #if $label() then 'none' else 'part'# - - - Type - type - int - enum - part - - - - - - - - Default Value - value - 0 - $type - - - GUI Hint - gui_hint - - gui_hint - part - - -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. - - diff --git a/gr-qtgui/grc/qtgui_text_box.xml b/gr-qtgui/grc/qtgui_text_box.xml deleted file mode 100644 index 0d7fe36ee..000000000 --- a/gr-qtgui/grc/qtgui_text_box.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - QT GUI Text Box - variable_qtgui_text_box - QT GUI Widgets - from PyQt4 import Qt - self.$(id) = $(id) = $value - #set $win = 'self._%s_tool_bar'%$id -$win = Qt.QToolBar(self) -#if not $label() - #set $label = '"%s"'%$id -#end if -$(win).addWidget(Qt.QLabel($label+" ", None)) -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)) - self.set_$(id)($value) - self._$(id)_line_edit.setText(str($id)) - - Label - label - - string - #if $label() then 'none' else 'part'# - - - Type - type - int - enum - part - - - - - - - - Default Value - value - 0 - $type - - - GUI Hint - gui_hint - - gui_hint - part - - -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. - - -- cgit From 47096a9ec323ad88c83afbaefa4686284449048c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 2 Mar 2011 22:13:11 -0800 Subject: qtgui-grc: add engineering notation to entry and label + other tweaks --- gr-qtgui/grc/qtgui_chooser.xml | 2 +- gr-qtgui/grc/qtgui_entry.xml | 17 +++++++++-------- gr-qtgui/grc/qtgui_label.xml | 15 ++++++++------- gr-qtgui/grc/qtgui_slider.xml | 2 +- 4 files changed, 19 insertions(+), 17 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml index 0d95c7cda..d06a229b4 100644 --- a/gr-qtgui/grc/qtgui_chooser.xml +++ b/gr-qtgui/grc/qtgui_chooser.xml @@ -53,7 +53,7 @@ self._$(id)_labels = map(str, self._$(id)_options) #if $widget() == 'combo_box' #set $win = 'self._%s_tool_bar'%$id $win = Qt.QToolBar(self) -$(win).addWidget(Qt.QLabel($label+" ", None)) +$(win).addWidget(Qt.QLabel($label+": ", None)) self._$(id)_combo_box = Qt.QComboBox(None) $(win).addWidget(self._$(id)_combo_box) for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label) diff --git a/gr-qtgui/grc/qtgui_entry.xml b/gr-qtgui/grc/qtgui_entry.xml index 63c14ad8f..32c879420 100644 --- a/gr-qtgui/grc/qtgui_entry.xml +++ b/gr-qtgui/grc/qtgui_entry.xml @@ -10,20 +10,21 @@ variable_qtgui_entry QT GUI Widgets from PyQt4 import Qt + from gnuradio import eng_notation self.$(id) = $(id) = $value #set $win = 'self._%s_tool_bar'%$id $win = Qt.QToolBar(self) #if not $label() #set $label = '"%s"'%$id #end if -$(win).addWidget(Qt.QLabel($label+" ", None)) +$(win).addWidget(Qt.QLabel($label+": ", None)) 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()))) + lambda: self.set_$(id)($(type.conv)(self._$(id)_line_edit.text().toAscii()))) $(gui_hint()($win)) self.set_$(id)($value) - self._$(id)_line_edit.setText(str($id)) + self._$(id)_line_edit.setText($(type.str)($id)) Label label @@ -37,11 +38,11 @@ $(gui_hint()($win)) int enum part - - - - - + + + + + Default Value diff --git a/gr-qtgui/grc/qtgui_label.xml b/gr-qtgui/grc/qtgui_label.xml index 90286d0b2..96354688e 100644 --- a/gr-qtgui/grc/qtgui_label.xml +++ b/gr-qtgui/grc/qtgui_label.xml @@ -10,18 +10,19 @@ variable_qtgui_label QT GUI Widgets from PyQt4 import Qt + from gnuradio import eng_notation self.$(id) = $(id) = $value #set $win = 'self._%s_tool_bar'%$id $win = Qt.QToolBar(self) #if not $label() #set $label = '"%s"'%$id #end if -$(win).addWidget(Qt.QLabel($label+" ", None)) +$(win).addWidget(Qt.QLabel($label+": ", None)) self._$(id)_label = Qt.QLabel(str(self.$id)) self._$(id)_tool_bar.addWidget(self._$(id)_label) $(gui_hint()($win)) self.set_$(id)($value) - self._$(id)_label.setText(str($id)) + self._$(id)_label.setText($(type.str)($id)) Label label @@ -35,11 +36,11 @@ $(gui_hint()($win)) int enum part - - - - - + + + + + Default Value diff --git a/gr-qtgui/grc/qtgui_slider.xml b/gr-qtgui/grc/qtgui_slider.xml index e29123878..e71382b12 100644 --- a/gr-qtgui/grc/qtgui_slider.xml +++ b/gr-qtgui/grc/qtgui_slider.xml @@ -19,7 +19,7 @@ $(win).addWidget(self._$(id)_tool_bar) #if not $label() #set $label = '"%s"'%$id #end if -self._$(id)_tool_bar.addWidget(Qt.QLabel($label, None)) +self._$(id)_tool_bar.addWidget(Qt.QLabel($label+": ", None)) self._$(id)_counter = Qwt.QwtCounter(None) self._$(id)_counter.setRange($start, $stop, $step) self._$(id)_counter.setNumButtons(2) -- cgit From 5bffcb2b1443f85bf695b48b57e6b16634ba331c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 3 Mar 2011 22:16:55 -0800 Subject: qtgui-grc: made slider widget components (counter/slider) optional --- gr-qtgui/grc/qtgui_slider.xml | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_slider.xml b/gr-qtgui/grc/qtgui_slider.xml index e71382b12..078e0df76 100644 --- a/gr-qtgui/grc/qtgui_slider.xml +++ b/gr-qtgui/grc/qtgui_slider.xml @@ -20,23 +20,31 @@ $(win).addWidget(self._$(id)_tool_bar) #set $label = '"%s"'%$id #end if self._$(id)_tool_bar.addWidget(Qt.QLabel($label+": ", None)) +#if int($widget.counter) 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)_counter.setValue(self.$id) self._$(id)_tool_bar.addWidget(self._$(id)_counter) self._$(id)_counter.valueChanged.connect(self.set_$(id)) +#end if +#if int($widget.slider) self._$(id)_slider = Qwt.QwtSlider(None) self._$(id)_slider.setRange($start, $stop, $step) -self._$(id)_slider.setValue($value) +self._$(id)_slider.setValue(self.$id) self._$(id)_slider.setOrientation(Qt.$orient) self._$(id)_slider.setScalePosition($orient.scalepos) self._$(id)_slider.valueChanged.connect(self.set_$(id)) $(win).addWidget(self._$(id)_slider) +#end if $(gui_hint()($win)) self.set_$(id)($value) - self._$(id)_counter.setValue($id) - self._$(id)_slider.setValue($id) + #if int($widget.counter) +self._$(id)_counter.setValue($id) +#end if +#if int($widget.slider) +self._$(id)_slider.setValue($id) +#end if Label label @@ -68,6 +76,16 @@ $(gui_hint()($win)) 1 real + + Widget + widget + all + enum + part + + + + Orientation orient -- cgit From 19c0865b4b6c94f86679151e9f52c99331b1f0b9 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 5 Mar 2011 20:37:40 -0800 Subject: qtgui-grc: moved slider to range, added knob and gui tweaks --- gr-qtgui/grc/Makefile.am | 4 +- gr-qtgui/grc/qtgui_range.xml | 184 ++++++++++++++++++++++++++++++++++++++++++ gr-qtgui/grc/qtgui_slider.xml | 125 ---------------------------- 3 files changed, 186 insertions(+), 127 deletions(-) create mode 100644 gr-qtgui/grc/qtgui_range.xml delete mode 100644 gr-qtgui/grc/qtgui_slider.xml (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am index 3045a8779..b3114268c 100644 --- a/gr-qtgui/grc/Makefile.am +++ b/gr-qtgui/grc/Makefile.am @@ -27,7 +27,7 @@ dist_grcblocks_DATA = \ qtgui_check_box.xml \ qtgui_entry.xml \ qtgui_label.xml \ + qtgui_range.xml \ qtgui_sink_x.xml \ qtgui_tab_widget.xml \ - qtgui_chooser.xml \ - qtgui_slider.xml + qtgui_chooser.xml diff --git a/gr-qtgui/grc/qtgui_range.xml b/gr-qtgui/grc/qtgui_range.xml new file mode 100644 index 000000000..12807ec84 --- /dev/null +++ b/gr-qtgui/grc/qtgui_range.xml @@ -0,0 +1,184 @@ + + + + QT GUI Range + variable_qtgui_range + QT GUI Widgets + from PyQt4 import Qt + import PyQt4.Qwt5 as Qwt + from gnuradio import eng_notation + self.$(id) = $(id) = $value + #set $win = 'self._%s_layout'%$id +#if not $label() + #set $label = '"%s"'%$id +#end if +######################################################################## +#if $widget() == "knob" +######################################################################## +$win = Qt.QVBoxLayout() +self._$(id)_knob = Qwt.QwtKnob(None) +self._$(id)_knob.setRange($start, $stop, $step) +self._$(id)_knob.setValue(self.$id) +self._$(id)_knob.valueChanged.connect(self.set_$(id)) +$(win).addWidget(self._$(id)_knob) +self._$(id)_label = Qt.QLabel($label, None) +self._$(id)_label.setAlignment(Qt.Qt.AlignTop | Qt.Qt.AlignHCenter) +$(win).addWidget(self._$(id)_label) +#end if +######################################################################## +#if $widget() == "counter" +######################################################################## +$win = Qt.QHBoxLayout() +$(win).addWidget(Qt.QLabel($label+": ", None)) +self._$(id)_counter = Qwt.QwtCounter(None) +self._$(id)_counter.setRange($start, $stop, $step) +self._$(id)_counter.setNumButtons(2) +self._$(id)_counter.setMinimumWidth($min_len) +self._$(id)_counter.setValue(self.$id) +$(win).addWidget(self._$(id)_counter) +self._$(id)_counter.valueChanged.connect(self.set_$(id)) +#end if +######################################################################## +#if $widget() == "slider" +######################################################################## +$win = $(orient.layout)() +self._$(id)_slider = Qwt.QwtSlider(None, Qt.$orient, $orient.scalepos, Qwt.QwtSlider.BgSlot) +self._$(id)_slider.setRange($start, $stop, $step) +self._$(id)_slider.setValue(self.$id) +self._$(id)_slider.$(orient.minfcn)($min_len) +self._$(id)_slider.valueChanged.connect(self.set_$(id)) +$(win).addWidget(self._$(id)_slider) +self._$(id)_num = Qt.QLabel(eng_notation.num_to_str($id), None) +$(win).addWidget(self._$(id)_num) +#end if +######################################################################## +#if $widget() == "counter_slider" +######################################################################## +$win = Qt.QVBoxLayout() +self._$(id)_tool_bar = Qt.QToolBar(self) +$(win).addWidget(self._$(id)_tool_bar) +self._$(id)_tool_bar.addWidget(Qt.QLabel($label+": ", None)) +self._$(id)_counter = Qwt.QwtCounter(None) +self._$(id)_counter.setRange($start, $stop, $step) +self._$(id)_counter.setNumButtons(2) +self._$(id)_counter.setValue(self.$id) +self._$(id)_tool_bar.addWidget(self._$(id)_counter) +self._$(id)_counter.valueChanged.connect(self.set_$(id)) +self._$(id)_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) +self._$(id)_slider.setRange($start, $stop, $step) +self._$(id)_slider.setValue(self.$id) +self._$(id)_slider.setMinimumWidth($min_len) +self._$(id)_slider.valueChanged.connect(self.set_$(id)) +$(win).addWidget(self._$(id)_slider) +#end if +$(gui_hint()($win)) + self.set_$(id)($value) + #if $widget() == "knob" +self._$(id)_knob.setValue($id) +#end if +#if $widget() == "counter" +self._$(id)_counter.setValue($id) +#end if +#if $widget() == "slider" +self._$(id)_slider.setValue($id) +self._$(id)_num.setText(eng_notation.num_to_str($id)) +#end if +#if $widget() == "counter_slider" +self._$(id)_counter.setValue($id) +self._$(id)_slider.setValue($id) +#end if + + Label + label + + string + #if $label() then 'none' else 'part'# + + + Default Value + value + 50 + real + + + Start + start + 0 + real + + + Stop + stop + 100 + real + + + Step + step + 1 + real + + + Widget + widget + counter_slider + enum + part + + + + + + + Orientation + orient + Qt.Horizontal + enum + #if $widget() == "slider" then 'part' else 'all'# + + + + + Minimum Length + min_len + 200 + int + #if $widget().split('_')[0] in ("slider", "counter") then 'part' else 'all'# + + + GUI Hint + gui_hint + + gui_hint + part + + $start <= $value <= $stop + $start < $stop + +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. + + diff --git a/gr-qtgui/grc/qtgui_slider.xml b/gr-qtgui/grc/qtgui_slider.xml deleted file mode 100644 index 078e0df76..000000000 --- a/gr-qtgui/grc/qtgui_slider.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - QT GUI Slider - variable_qtgui_slider - QT GUI Widgets - from PyQt4 import Qt - import PyQt4.Qwt5 as Qwt - self.$(id) = $(id) = $value - #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 not $label() - #set $label = '"%s"'%$id -#end if -self._$(id)_tool_bar.addWidget(Qt.QLabel($label+": ", None)) -#if int($widget.counter) -self._$(id)_counter = Qwt.QwtCounter(None) -self._$(id)_counter.setRange($start, $stop, $step) -self._$(id)_counter.setNumButtons(2) -self._$(id)_counter.setValue(self.$id) -self._$(id)_tool_bar.addWidget(self._$(id)_counter) -self._$(id)_counter.valueChanged.connect(self.set_$(id)) -#end if -#if int($widget.slider) -self._$(id)_slider = Qwt.QwtSlider(None) -self._$(id)_slider.setRange($start, $stop, $step) -self._$(id)_slider.setValue(self.$id) -self._$(id)_slider.setOrientation(Qt.$orient) -self._$(id)_slider.setScalePosition($orient.scalepos) -self._$(id)_slider.valueChanged.connect(self.set_$(id)) -$(win).addWidget(self._$(id)_slider) -#end if -$(gui_hint()($win)) - self.set_$(id)($value) - #if int($widget.counter) -self._$(id)_counter.setValue($id) -#end if -#if int($widget.slider) -self._$(id)_slider.setValue($id) -#end if - - Label - label - - string - #if $label() then 'none' else 'part'# - - - Default Value - value - 50 - real - - - Start - start - 0 - real - - - Stop - stop - 100 - real - - - Step - step - 1 - real - - - Widget - widget - all - enum - part - - - - - - Orientation - orient - Qt.Horizontal - enum - part - - - - - GUI Hint - gui_hint - - gui_hint - part - - $start <= $value <= $stop - $start < $stop - -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. - - -- cgit From 0f9de85118b29f9cd5e832ea05e6438adf89e0fb Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 7 Mar 2011 13:15:43 -0800 Subject: qtgui-grc: fix for list option working in chooser block --- gr-qtgui/grc/qtgui_chooser.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml index d06a229b4..6f405d99d 100644 --- a/gr-qtgui/grc/qtgui_chooser.xml +++ b/gr-qtgui/grc/qtgui_chooser.xml @@ -20,7 +20,7 @@ ######################################################################## ## Create the options list ######################################################################## -#if $num_opts() +#if int($num_opts()) self._$(id)_options = (#slurp #for $ch in $all_options $ch, #slurp @@ -32,7 +32,7 @@ self._$(id)_options = $options ######################################################################## ## Create the labels list ######################################################################## -#if $num_opts() +#if int($num_opts()) self._$(id)_labels = (#slurp #for i, $lbl in enumerate($all_labels) #if $lbl() @@ -42,7 +42,7 @@ str(self._$(id)_options[$i]), #slurp #end if #end for ) -#elif $labels +#elif $labels() self._$(id)_labels = $labels #else self._$(id)_labels = map(str, self._$(id)_options) -- cgit From 51bcf966e09e15bd97822608b236f02fd379ea87 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 7 Mar 2011 13:16:19 -0800 Subject: qtgui-grc: added read-only thermo widget to range block --- gr-qtgui/grc/qtgui_range.xml | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_range.xml b/gr-qtgui/grc/qtgui_range.xml index 12807ec84..4d28de223 100644 --- a/gr-qtgui/grc/qtgui_range.xml +++ b/gr-qtgui/grc/qtgui_range.xml @@ -21,21 +21,33 @@ #if $widget() == "knob" ######################################################################## $win = Qt.QVBoxLayout() -self._$(id)_knob = Qwt.QwtKnob(None) +self._$(id)_knob = Qwt.QwtKnob() self._$(id)_knob.setRange($start, $stop, $step) self._$(id)_knob.setValue(self.$id) self._$(id)_knob.valueChanged.connect(self.set_$(id)) $(win).addWidget(self._$(id)_knob) -self._$(id)_label = Qt.QLabel($label, None) +self._$(id)_label = Qt.QLabel($label) self._$(id)_label.setAlignment(Qt.Qt.AlignTop | Qt.Qt.AlignHCenter) $(win).addWidget(self._$(id)_label) #end if ######################################################################## +#if $widget() == "thermo" +######################################################################## +$win = $(orient.layout)() +$(win).addWidget(Qt.QLabel($label)) +self._$(id)_thermo = Qwt.QwtThermo() +self._$(id)_thermo.setScalePosition(Qwt.QwtThermo.$orient.scalepos) +self._$(id)_thermo.setRange($start, $stop) +self._$(id)_thermo.setValue(self.$id) +self._$(id)_thermo.$(orient.minfcn)($min_len) +$(win).addWidget(self._$(id)_thermo) +#end if +######################################################################## #if $widget() == "counter" ######################################################################## $win = Qt.QHBoxLayout() -$(win).addWidget(Qt.QLabel($label+": ", None)) -self._$(id)_counter = Qwt.QwtCounter(None) +$(win).addWidget(Qt.QLabel($label+": ")) +self._$(id)_counter = Qwt.QwtCounter() self._$(id)_counter.setRange($start, $stop, $step) self._$(id)_counter.setNumButtons(2) self._$(id)_counter.setMinimumWidth($min_len) @@ -47,13 +59,13 @@ self._$(id)_counter.valueChanged.connect(self.set_$(id)) #if $widget() == "slider" ######################################################################## $win = $(orient.layout)() -self._$(id)_slider = Qwt.QwtSlider(None, Qt.$orient, $orient.scalepos, Qwt.QwtSlider.BgSlot) +self._$(id)_slider = Qwt.QwtSlider(None, Qt.$orient, Qwt.QwtSlider.$orient.scalepos, Qwt.QwtSlider.BgSlot) self._$(id)_slider.setRange($start, $stop, $step) self._$(id)_slider.setValue(self.$id) self._$(id)_slider.$(orient.minfcn)($min_len) self._$(id)_slider.valueChanged.connect(self.set_$(id)) $(win).addWidget(self._$(id)_slider) -self._$(id)_num = Qt.QLabel(eng_notation.num_to_str($id), None) +self._$(id)_num = Qt.QLabel(eng_notation.num_to_str($id)) $(win).addWidget(self._$(id)_num) #end if ######################################################################## @@ -62,8 +74,8 @@ $(win).addWidget(self._$(id)_num) $win = Qt.QVBoxLayout() self._$(id)_tool_bar = Qt.QToolBar(self) $(win).addWidget(self._$(id)_tool_bar) -self._$(id)_tool_bar.addWidget(Qt.QLabel($label+": ", None)) -self._$(id)_counter = Qwt.QwtCounter(None) +self._$(id)_tool_bar.addWidget(Qt.QLabel($label+": ")) +self._$(id)_counter = Qwt.QwtCounter() self._$(id)_counter.setRange($start, $stop, $step) self._$(id)_counter.setNumButtons(2) self._$(id)_counter.setValue(self.$id) @@ -81,6 +93,9 @@ $(gui_hint()($win)) #if $widget() == "knob" self._$(id)_knob.setValue($id) #end if +#if $widget() == "thermo" +self._$(id)_thermo.setValue($id) +#end if #if $widget() == "counter" self._$(id)_counter.setValue($id) #end if @@ -133,24 +148,25 @@ self._$(id)_slider.setValue($id) + Orientation orient Qt.Horizontal enum - #if $widget() == "slider" then 'part' else 'all'# + #if $widget() in ("slider", "thermo") then 'part' else 'all'# @@ -160,7 +176,7 @@ self._$(id)_slider.setValue($id) min_len 200 int - #if $widget().split('_')[0] in ("slider", "counter") then 'part' else 'all'# + #if $widget().split('_')[0] in ("slider", "counter", "thermo") then 'part' else 'all'# GUI Hint -- cgit From 9121b75d68a0c90deee814edffe387480b52019b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 7 Mar 2011 18:40:57 -0800 Subject: qtgui-grc: minor tweaks to the various things --- gr-qtgui/grc/qtgui_chooser.xml | 4 ++-- gr-qtgui/grc/qtgui_entry.xml | 2 +- gr-qtgui/grc/qtgui_label.xml | 2 +- gr-qtgui/grc/qtgui_range.xml | 29 ++++++++++++++++++++--------- gr-qtgui/grc/qtgui_tab_widget.xml | 2 +- 5 files changed, 25 insertions(+), 14 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml index 6f405d99d..cb5090289 100644 --- a/gr-qtgui/grc/qtgui_chooser.xml +++ b/gr-qtgui/grc/qtgui_chooser.xml @@ -53,8 +53,8 @@ self._$(id)_labels = map(str, self._$(id)_options) #if $widget() == 'combo_box' #set $win = 'self._%s_tool_bar'%$id $win = Qt.QToolBar(self) -$(win).addWidget(Qt.QLabel($label+": ", None)) -self._$(id)_combo_box = Qt.QComboBox(None) +$(win).addWidget(Qt.QLabel($label+": ")) +self._$(id)_combo_box = Qt.QComboBox() $(win).addWidget(self._$(id)_combo_box) for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label) self._$(id)_callback = lambda i: self._$(id)_combo_box.setCurrentIndex(self._$(id)_options.index(i)) diff --git a/gr-qtgui/grc/qtgui_entry.xml b/gr-qtgui/grc/qtgui_entry.xml index 32c879420..1a98402a0 100644 --- a/gr-qtgui/grc/qtgui_entry.xml +++ b/gr-qtgui/grc/qtgui_entry.xml @@ -17,7 +17,7 @@ $win = Qt.QToolBar(self) #if not $label() #set $label = '"%s"'%$id #end if -$(win).addWidget(Qt.QLabel($label+": ", None)) +$(win).addWidget(Qt.QLabel($label+": ")) self._$(id)_line_edit = Qt.QLineEdit(str(self.$id)) self._$(id)_tool_bar.addWidget(self._$(id)_line_edit) self._$(id)_line_edit.returnPressed.connect( diff --git a/gr-qtgui/grc/qtgui_label.xml b/gr-qtgui/grc/qtgui_label.xml index 96354688e..5049118c4 100644 --- a/gr-qtgui/grc/qtgui_label.xml +++ b/gr-qtgui/grc/qtgui_label.xml @@ -17,7 +17,7 @@ $win = Qt.QToolBar(self) #if not $label() #set $label = '"%s"'%$id #end if -$(win).addWidget(Qt.QLabel($label+": ", None)) +$(win).addWidget(Qt.QLabel($label+": ")) self._$(id)_label = Qt.QLabel(str(self.$id)) self._$(id)_tool_bar.addWidget(self._$(id)_label) $(gui_hint()($win)) diff --git a/gr-qtgui/grc/qtgui_range.xml b/gr-qtgui/grc/qtgui_range.xml index 4d28de223..6b0555f98 100644 --- a/gr-qtgui/grc/qtgui_range.xml +++ b/gr-qtgui/grc/qtgui_range.xml @@ -11,7 +11,6 @@ QT GUI Widgets from PyQt4 import Qt import PyQt4.Qwt5 as Qwt - from gnuradio import eng_notation self.$(id) = $(id) = $value #set $win = 'self._%s_layout'%$id #if not $label() @@ -33,14 +32,22 @@ $(win).addWidget(self._$(id)_label) ######################################################################## #if $widget() == "thermo" ######################################################################## -$win = $(orient.layout)() -$(win).addWidget(Qt.QLabel($label)) +$win = Qt.QVBoxLayout() +self._$(id)_label = Qt.QLabel($label) self._$(id)_thermo = Qwt.QwtThermo() self._$(id)_thermo.setScalePosition(Qwt.QwtThermo.$orient.scalepos) self._$(id)_thermo.setRange($start, $stop) self._$(id)_thermo.setValue(self.$id) self._$(id)_thermo.$(orient.minfcn)($min_len) +#if 'horizontal' in $orient().lower() +self._$(id)_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter) +$(win).addWidget(self._$(id)_label) $(win).addWidget(self._$(id)_thermo) +#elif 'vertical' in $orient().lower() +self._$(id)_label.setAlignment(Qt.Qt.AlignTop) +$(win).addWidget(self._$(id)_thermo) +$(win).addWidget(self._$(id)_label) +#end if #end if ######################################################################## #if $widget() == "counter" @@ -58,15 +65,22 @@ self._$(id)_counter.valueChanged.connect(self.set_$(id)) ######################################################################## #if $widget() == "slider" ######################################################################## -$win = $(orient.layout)() +$win = Qt.QVBoxLayout() +self._$(id)_label = Qt.QLabel($label) self._$(id)_slider = Qwt.QwtSlider(None, Qt.$orient, Qwt.QwtSlider.$orient.scalepos, Qwt.QwtSlider.BgSlot) self._$(id)_slider.setRange($start, $stop, $step) self._$(id)_slider.setValue(self.$id) self._$(id)_slider.$(orient.minfcn)($min_len) self._$(id)_slider.valueChanged.connect(self.set_$(id)) +#if 'horizontal' in $orient().lower() +self._$(id)_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter) +$(win).addWidget(self._$(id)_label) $(win).addWidget(self._$(id)_slider) -self._$(id)_num = Qt.QLabel(eng_notation.num_to_str($id)) -$(win).addWidget(self._$(id)_num) +#elif 'vertical' in $orient().lower() +self._$(id)_label.setAlignment(Qt.Qt.AlignTop) +$(win).addWidget(self._$(id)_slider) +$(win).addWidget(self._$(id)_label) +#end if #end if ######################################################################## #if $widget() == "counter_slider" @@ -101,7 +115,6 @@ self._$(id)_counter.setValue($id) #end if #if $widget() == "slider" self._$(id)_slider.setValue($id) -self._$(id)_num.setText(eng_notation.num_to_str($id)) #end if #if $widget() == "counter_slider" self._$(id)_counter.setValue($id) @@ -161,14 +174,12 @@ self._$(id)_slider.setValue($id) Qt.Horizontal scalepos:BottomScale minfcn:setMinimumWidth - layout:Qt.QHBoxLayout diff --git a/gr-qtgui/grc/qtgui_tab_widget.xml b/gr-qtgui/grc/qtgui_tab_widget.xml index efdeaa19a..f90054109 100644 --- a/gr-qtgui/grc/qtgui_tab_widget.xml +++ b/gr-qtgui/grc/qtgui_tab_widget.xml @@ -10,7 +10,7 @@ QT GUI Widgets from PyQt4 import Qt #set $win = 'self.%s'%$id -Qt.QTabWidget(None) +Qt.QTabWidget() #set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_tabs())] #for i, label in enumerate($all_labels) self.$(id)_widget_$(i) = Qt.QWidget() -- cgit From 8f53f5a782a6500d191ba557b37e7e3785cf6e02 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 6 Apr 2011 00:22:29 -0400 Subject: gr-qtgui: removing references to 3D waterfall plot and changning QtGui API to remove bool that turns it on/off. --- gr-qtgui/grc/qtgui_sink_x.xml | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml index 7a5f5ec13..8c470a1a5 100644 --- a/gr-qtgui/grc/qtgui_sink_x.xml +++ b/gr-qtgui/grc/qtgui_sink_x.xml @@ -21,7 +21,6 @@ qtgui.$(type.fcn)( $name, \#name $plotfreq, \#plotfreq $plotwaterfall, \#plotwaterfall - $plotwaterfall3d, \#plotwaterfall3d $plottime, \#plottime $plotconst, \#plotconst ) @@ -89,15 +88,6 @@ $(gui_hint()($win)) - - Plot Waterfall 3D - plotwaterfall3d - True - bool - part - - - Plot Time plottime -- cgit From 371ca93c2a1506d22db69fb96b2cf7d4ed132535 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 24 Apr 2011 10:18:07 -0400 Subject: gr-qtgui: adding GRC component for time_sink block. --- gr-qtgui/grc/Makefile.am | 1 + gr-qtgui/grc/qtgui_time_sink_x.xml | 78 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 gr-qtgui/grc/qtgui_time_sink_x.xml (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am index b3114268c..ccd459a13 100644 --- a/gr-qtgui/grc/Makefile.am +++ b/gr-qtgui/grc/Makefile.am @@ -29,5 +29,6 @@ dist_grcblocks_DATA = \ qtgui_label.xml \ qtgui_range.xml \ qtgui_sink_x.xml \ + qtgui_time_sink_x.xml \ qtgui_tab_widget.xml \ qtgui_chooser.xml diff --git a/gr-qtgui/grc/qtgui_time_sink_x.xml b/gr-qtgui/grc/qtgui_time_sink_x.xml new file mode 100644 index 000000000..9c8da6fbc --- /dev/null +++ b/gr-qtgui/grc/qtgui_time_sink_x.xml @@ -0,0 +1,78 @@ + + + + QT GUI Time Sink + qtgui_time_sink_x + QT GUI Widgets + from PyQt4 import Qt + from gnuradio.qtgui import qtgui + from gnuradio.gr import firdes + import sip + #set $win = 'self._%s_win'%$id +qtgui.$(type.fcn)( + $size, \#size + $bw, \#bw + $name, \#name + $nconnections \#number of inputs +) +self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget) +$(gui_hint()($win)) + set_time_domain_axis($min, $max) + set_update_time($t) + set_title($which, $title) + set_color($which, $color) + + Type + type + complex + enum + + + + + Name + name + QT GUI Plot + string + + + Number of Points + size + 1024 + int + + + Bandwidth (Hz) + bw + samp_rate + real + + + Number of Inputs + nconnections + 1 + int + part + + + GUI Hint + gui_hint + + gui_hint + part + + + in + $type + $nconnections + + +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. + + -- cgit From 8584298ae45ad1a0210e5d4ed67cdfae64a93c7c Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 9 May 2011 16:33:39 +0100 Subject: gr-qtgui: adding the various windows as initial options for the qtgui sink in GRC. --- gr-qtgui/grc/qtgui_sink_x.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml index 8c470a1a5..83d6ec287 100644 --- a/gr-qtgui/grc/qtgui_sink_x.xml +++ b/gr-qtgui/grc/qtgui_sink_x.xml @@ -57,6 +57,26 @@ $(gui_hint()($win)) Blackman-harris firdes.WIN_BLACKMAN_hARRIS + + + + + Center Frequency (Hz) -- cgit From accb9f2fe8fd8f6a1e114adac5b15304b0e0012d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 20 Jul 2011 19:04:32 -0700 Subject: gr: squashed cmakelists.txt into one commit --- gr-qtgui/grc/CMakeLists.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gr-qtgui/grc/CMakeLists.txt (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/CMakeLists.txt b/gr-qtgui/grc/CMakeLists.txt new file mode 100644 index 000000000..023c38b01 --- /dev/null +++ b/gr-qtgui/grc/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright 2011 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. + +######################################################################## +FILE(GLOB xml_files "*.xml") +INSTALL(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "qtgui_python") -- cgit From 71c0f14a46f85027b95f2f5f6d3d219cc9e3783e Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 8 Oct 2011 17:11:12 -0700 Subject: gr: the CMakeLists.txt took a chill pill --- gr-qtgui/grc/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/CMakeLists.txt b/gr-qtgui/grc/CMakeLists.txt index 023c38b01..370a71725 100644 --- a/gr-qtgui/grc/CMakeLists.txt +++ b/gr-qtgui/grc/CMakeLists.txt @@ -18,5 +18,5 @@ # Boston, MA 02110-1301, USA. ######################################################################## -FILE(GLOB xml_files "*.xml") -INSTALL(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "qtgui_python") +file(GLOB xml_files "*.xml") +install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "qtgui_python") -- cgit From 00420d32081d8252bb37142b2be19a8a7c4dc4c4 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Thu, 8 Dec 2011 13:48:48 -0800 Subject: Removed autotools, gr-waveform, some cleanup Nick Foster owes Nick Corgan a six-pack of beer! --- gr-qtgui/grc/.gitignore | 2 -- gr-qtgui/grc/Makefile.am | 34 ---------------------------------- 2 files changed, 36 deletions(-) delete mode 100644 gr-qtgui/grc/.gitignore delete mode 100644 gr-qtgui/grc/Makefile.am (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/.gitignore b/gr-qtgui/grc/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/gr-qtgui/grc/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am deleted file mode 100644 index ccd459a13..000000000 --- a/gr-qtgui/grc/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright 2010-2011 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_check_box.xml \ - qtgui_entry.xml \ - qtgui_label.xml \ - qtgui_range.xml \ - qtgui_sink_x.xml \ - qtgui_time_sink_x.xml \ - qtgui_tab_widget.xml \ - qtgui_chooser.xml -- cgit From f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 13 Apr 2012 18:36:53 -0400 Subject: Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future. The sed script was provided by Moritz Fischer. --- gr-qtgui/grc/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/CMakeLists.txt b/gr-qtgui/grc/CMakeLists.txt index 370a71725..d56158ac7 100644 --- a/gr-qtgui/grc/CMakeLists.txt +++ b/gr-qtgui/grc/CMakeLists.txt @@ -1,17 +1,17 @@ # Copyright 2011 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, -- cgit From d3ad5ccae7f261654508d93815cb7e3d2112c4c5 Mon Sep 17 00:00:00 2001 From: Julien Olivain Date: Tue, 11 Dec 2012 10:12:39 -0500 Subject: qtgui: adds parameter in qtgui sink's GRC block to set the update rate. --- gr-qtgui/grc/qtgui_sink_x.xml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gr-qtgui/grc') diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml index 83d6ec287..6488ac04c 100644 --- a/gr-qtgui/grc/qtgui_sink_x.xml +++ b/gr-qtgui/grc/qtgui_sink_x.xml @@ -24,6 +24,7 @@ qtgui.$(type.fcn)( $plottime, \#plottime $plotconst, \#plotconst ) +self.$(id).set_update_time(1.0 / $rate) self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget) $(gui_hint()($win)) set_frequency_range($fc, $bw) @@ -133,6 +134,12 @@ $(gui_hint()($win)) gui_hint part + + Update Rate + rate + 10 + real + in $type -- cgit