0.1.6 — form, field, and validation fixes
Fixed
tristateworks on acheckboxform editor.0.1.5fixedbs.Checkbox(tristate=True)itself, but a checkbox built by aForm(or by
DataTable's add/edit dialog) still started unchecked: the form supplied an explicitvalue=Falsethat overrode the indeterminate default. (#358)editor_optionsmay set any of the editor's public keyword arguments. Naming one the form also fills —label,options, or a boolean editor's caption — raisedTypeError: got multiple values for keyword argument. Those options now override the form's default instead of colliding with it. Avalueoption seeds the editor only when the form'sdatacarries nothing for that key. (#358)- A falsy value no longer disappears from a text field.
bs.TextField,bs.PasswordField, andbs.PathFieldtested the initial value for
truthiness, sovalue=0rendered an empty field — and in aForm, the blank was written back over the record's value. - A form no longer changes the type of the data it was given. Values that are not text — a
Decimal, adate— keep their type inform.datainstead of being converted to strings at construction. - Option dicts aimed at a built widget no longer collide with the framework's own arguments. The same defect appeared in
MenuButton(menu_options=),ButtonGroup.add()/add_all(),RadioGroup.add()/ToggleGroup.add(), andToolbar/StatusBar
add_widget(). In each, your options now win; the few keys a widget must own — where it is parented, how it tracks its selection, the callback that emits its events — raise a clear error naming what to use instead. - A
ButtonGroupbutton given both a caption and an icon renders as both. Supplying the caption astextproduced an icon-only button with its label crammed into zero padding. - A required field with a placeholder no longer passes validation while empty. A field showing only its placeholder was treated as though the hint had been typed, so
requiredreported it valid — and a form with an untouched required field validated and submitted. textno longer reports the placeholder as content. A field showing only its placeholder returned the hint fromtextwhilevaluereported empty; the two now agree on whether the field holds anything.requiredsurvives an unrecognizededitor=name. An editor name the form does not know falls back to a text field, but therequiredrule was dropped on the way, so a misspelled editor silently let an empty field submit. (#366)- A searchable
Selectno longer changes its value when you just look. Opening the drop-down and dismissing it without typing or choosing anything replaced the field's value with the first option in the list. (#355) Selectvalidation rules run against the selected value, not its label. On a decoupled option list — where an option displays'United States'and stores'US'— every rule saw the label, so a rule checking the value rejected valid selections. (#355)- A
Decimalvalue now respectsvalue_format. It matched none of the formatter's numeric branches, so the format was silently ignored: a currency field seeded with aDecimaldisplayed the raw number and only started formatting once you edited it.Decimalis handed to the formatter as-is rather than converted, so a value keeps the precision it was given.
Added
Select.validate()— run a select's validation rules on demand, matching the other field widgets.add_validation_rulealready pointed at it. (#355)
Changed
- A format rule no longer rejects an empty field.
email,pattern, andstringLengthdescribe what a value must look like, not that one must be present, so they now pass on an empty field — matchingrange, which already behaved this way. Previously a field with norequired=reported an error while untouched andForm.validate()refused to submit, leaving no way forward but typing into a field the form called optional. If you used a format rule as a presence check —stringLength(min=1), or a pattern that cannot match the empty string — addrequiredto keep that behavior.compareandcustomare unaffected; both still run on an empty value. (#366) - A
Selectno longer rejects a value that is not in its option list. Opening an editor on a stored record whose option had since been retired raisedValueError: '…' is not one of the options— in aForm, and inDataTable's add/edit dialog, on ordinary data drift. A later programmatic write of the same value was silently dropped instead, so one value produced two different wrong answers. Such a value is now displayed as given, reads back with its own type, and is not added to the list, so a user cannot pick it. Use a'custom'validation rule to report one.SelectButton, which maps a value to an option's label and has no text entry, still rejects. (#355)
What's Changed
- fix(form): tristate checkbox editor, editor_options collisions, falsy and typed values by @israel-dryer in #362
- fix(widgets): option dicts no longer collide with framework kwargs by @israel-dryer in #363
- fix(fields): a visible placeholder no longer counts as content by @israel-dryer in #364
- chore(tests): remove the legacy tests/features visual scripts by @israel-dryer in #365
- fix(validation): an empty field is not a malformed one by @israel-dryer in #367
- fix(select): a retired value displays instead of crashing the editor by @israel-dryer in #368
- docs: drop the Qt licensing line from the homepage blurb by @israel-dryer in #370
- fix(i18n): a Decimal value respects value_format by @israel-dryer in #371
Full Changelog: v0.1.5...v0.1.6