1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
<?xml version="1.0"?>
<!--
Copyright 2014 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 2 of the License, or (at your
option) any later version.
GNU Radio Companion 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
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-->
<!--
###################################################
##Variable Check Box:
## a gui check box form
###################################################
-->
<block>
<name>QT GUI Check Box</name>
<key>variable_qtgui_check_box</key>
<import>from PyQt4 import Qt</import>
<var_make>self.$(id) = $(id) = $value</var_make>
<make>#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: Qt.QMetaObject.invokeMethod($(win), "setChecked", Qt.Q_ARG("bool", 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))</make>
<callback>self.set_$(id)($value)</callback>
<callback>self._$(id)_callback($id)</callback>
<param>
<name>Label</name>
<key>label</key>
<value></value>
<type>string</type>
<hide>#if $label() then 'none' else 'part'#</hide>
</param>
<param>
<name>Type</name>
<key>type</key>
<value>int</value>
<type>enum</type>
<hide>part</hide>
<option><name>Float</name><key>real</key><opt>conv:float</opt></option>
<option><name>Integer</name><key>int</key><opt>conv:int</opt></option>
<option><name>String</name><key>string</key><opt>conv:str</opt></option>
<option><name>Boolean</name><key>bool</key><opt>conv:bool</opt></option>
<option><name>Any</name><key>raw</key><opt>conv:eval</opt></option>
</param>
<param>
<name>Default Value</name>
<key>value</key>
<value>True</value>
<type>$type</type>
</param>
<param>
<name>True</name>
<key>true</key>
<value>True</value>
<type>$type</type>
</param>
<param>
<name>False</name>
<key>false</key>
<value>False</value>
<type>$type</type>
</param>
<param>
<name>GUI Hint</name>
<key>gui_hint</key>
<value></value>
<type>gui_hint</type>
<hide>part</hide>
</param>
<check>$value in ($true, $false)</check>
<doc>
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.
</doc>
</block>
|