Skip to content

Commit 6c43039

Browse files
committed
qtvcp -macroTab: honour legacy radio button definitions
And fix setting of true state
1 parent 1b88677 commit 6c43039

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

docs/src/gui/qtvcp-widgets.adoc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,10 +1363,13 @@ This must be the _second line_ in the O-word file.
13631363

13641364
It is a *comma separated list of the default values for each variable* in the O-word function.
13651365

1366-
If you use the word `radiotrue` or `radiofalse` in the list, a `*radiobutton*` will be shown. +
1366+
If you use the word `radiotrue`, `radiofalse`, `true` or `false` in the list, a `*radiobutton*` will be shown. +
13671367
If you use the word `checktrue` or `checkfalse` in the list, a `*checkbox*` will be shown. +
1368-
If you use the word `true` or `false` in the list, a `*Checkable Pushbutton*` will be shown. +
1369-
If the default has a decimal, macroTab assumes ypu want a float value otherwise an integer.
1368+
If you use the word `buttontrue` or `buttonfalse` in the list, a `*Checkable Pushbutton*` will be shown. +
1369+
If the default has a decimal, macroTab assumes you want a float value otherwise an integer.
1370+
1371+
NOTE: When using radiobuttons, only set one radiobutton as true. Radio button are used for exclusive
1372+
choices.
13701373

13711374
.`MACROIMAGE`
13721375

lib/python/qtvcp/widgets/macro_widget.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,27 +246,30 @@ def checkIfFloat(val):
246246
l = QtWidgets.QLabel(name[0])
247247

248248
# make appropriate entries:
249-
# radio buttons?
249+
# radio/check/push buttons?
250250
if 'false' in name[1].lower() or 'true' in name[1].lower():
251251
if 'check' in name[1].lower():
252252
self['%s%d' % (tName, n)] = QtWidgets.QCheckBox()
253-
if name[1].lower() == 'true':
253+
if 'true' in name[1].lower():
254254
self['%s%d' % (tName, n)].setChecked(True)
255255
elif 'radio' in name[1].lower():
256256
self['%s%d' % (tName, n)] = QtWidgets.QRadioButton()
257-
if name[1].lower() == 'true':
257+
if 'true' in name[1].lower():
258258
self['%s%d' % (tName, n)].setChecked(True)
259-
else:
259+
elif 'button' in name[1].lower():
260260
self['%s%d' % (tName, n)] = QtWidgets.QPushButton()
261261
self['%s%d' % (tName, n)].setCheckable(True)
262-
if name[1].lower() == 'true':
262+
if 'true' in name[1].lower():
263+
self['%s%d' % (tName, n)].setChecked(True)
264+
# legacy default
265+
else:
266+
self['%s%d' % (tName, n)] = QtWidgets.QRadioButton()
267+
if 'true' in name[1].lower():
263268
self['%s%d' % (tName, n)].setChecked(True)
264269

265270
# line edits that will pop an entry dialog:
266271
else:
267272
if checkIfFloat(name[1]):
268-
#self['%s%d' % (tName, n)] = QtWidgets.QLineEdit()
269-
#self['%s%d' % (tName, n)].setText(name[1])
270273
self['%s%d' % (tName, n)] = TouchDoubleSpinBox()
271274
self['%s%d' % (tName, n)].callDialog = self.getNumbers
272275
self['%s%d' % (tName, n)].setValue(float(name[1]))
@@ -285,7 +288,6 @@ def checkIfFloat(val):
285288

286289
self['%s%d' % (tName, n)]._label = name[0]
287290
self['%s%d' % (tName, n)]._tabName = tName
288-
#self.set_style(self['%s%d' % (tName, n)])
289291
self['%s%d' % (tName, n)].keyboard_type = 'numeric'
290292

291293
hbox2.addWidget(l)

0 commit comments

Comments
 (0)