blob: e2912387806622362355705efa315752f76c0989 (
plain)
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
101
102
103
104
105
106
107
|
<?xml version="1.0"?>
<!--
###################################################
##Variable Slider:
## a combined slider and text box form
###################################################
-->
<block>
<name>QT GUI Slider</name>
<key>variable_qtgui_slider</key>
<category>QT GUI Widgets</category>
<import>from PyQt4 import Qt</import>
<import>import PyQt4.Qwt5 as Qwt</import>
<var_make>self.$(id) = $(id) = $value</var_make>
<make>#set $win = '_%s_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))
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))</make>
<callback>self.set_$(id)($value)</callback>
<callback>self._$(id)_counter.setValue($id)</callback>
<callback>self._$(id)_slider.setValue($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>Default Value</name>
<key>value</key>
<value>50</value>
<type>real</type>
</param>
<param>
<name>Start</name>
<key>start</key>
<value>0</value>
<type>real</type>
</param>
<param>
<name>Stop</name>
<key>stop</key>
<value>100</value>
<type>real</type>
</param>
<param>
<name>Step</name>
<key>step</key>
<value>1</value>
<type>real</type>
</param>
<param>
<name>Orientation</name>
<key>orient</key>
<value>Qt.Horizontal</value>
<type>enum</type>
<hide>part</hide>
<option>
<name>Horizontal</name>
<key>Qt.Horizontal</key>
<opt>scalepos:Qwt.QwtSlider.BottomScale</opt>
</option>
<option>
<name>Vertical</name>
<key>Qt.Vertical</key>
<opt>scalepos:Qwt.QwtSlider.RightScale</opt>
</option>
</param>
<param>
<name>GUI Hint</name>
<key>gui_hint</key>
<value></value>
<type>gui_hint</type>
<hide>part</hide>
</param>
<check>$start <= $value <= $stop</check>
<check>$start < $stop</check>
<doc>
This block creates a variable with a slider. \
Leave the label blank to use the variable id as the label. \
The value must be a real number. \
The value must be between the start and the stop.
The GUI hint can be used to position the widget within the application. \
The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
Both the tab specification and the grid position are optional.
</doc>
</block>
|