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/qtgui_chooser.xml | 256 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 256 insertions(+)
create mode 100644 gr-qtgui/grc/qtgui_chooser.xml
(limited to 'gr-qtgui/grc/qtgui_chooser.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.
+
+
--
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/qtgui_chooser.xml | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
(limited to 'gr-qtgui/grc/qtgui_chooser.xml')
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)
--
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 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'gr-qtgui/grc/qtgui_chooser.xml')
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)
--
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/qtgui_chooser.xml')
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 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 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'gr-qtgui/grc/qtgui_chooser.xml')
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))
--
cgit