enthought / enthought/traitsui

CheckListEditor could leave view in an inconsistent state when trait changes externally

Open
#852 0 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

If the trait being edited is changed externally to the simple `CheckListEditor` such that:
(1) There are no items in the new trait value, OR
(2) The new trait value has items but the first item is not one of the values defined in the editor

Then the view could be left in a state that is inconsistent with the underlying trait being edited.

In particular, the following exceptions should be handled with actions to either realign the view with the trait or if nothing reasonable can be done, warn about the incident:
https://github.com/enthought/traitsui/blob/64858b8c9ce9189a8c9cfde60610e4bd12f30962/traitsui/qt4/check_list_editor.py#L127-L132
https://github.com/enthought/traitsui/blob/64858b8c9ce9189a8c9cfde60610e4bd12f30962/traitsui/wx/check_list_editor.py#L141-L146

For scenario (1), it maybe possible to call `QtComboBox.setCurrentText(-1)` and `wx.Choice.SetSelection(wx.NOT_FOUND)` instead.

Related to discussion from https://github.com/enthought/traitsui/pull/837#issuecomment-635917510 onwards.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.