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_check_box.xml | 83 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 gr-qtgui/grc/qtgui_check_box.xml (limited to 'gr-qtgui/grc/qtgui_check_box.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. + + -- cgit