magicgui icon indicating copy to clipboard operation
magicgui copied to clipboard

None vs UNSET as default value setting

Open gselzer opened this issue 3 years ago • 0 comments

Describe the bug A clear and concise description of what the bug is.

Some widgets, such as RangeEdit, seem to prefer value=None upon creation with no starting value. Other widgets like CheckBox, who are backed in their instantiation with QBaseValueWidget._mgui_set_value(), seem to instead prefer UNSET. This prevents me from writing something like this without an error as to the type of widget that is chosen for my return type.

To Reproduce Steps to reproduce the behavior:

The cleanest way to reproduce this is to checkout this commit on my experimental branch and run tests/test_return_widgets.py. To see how changing the value of the return widgets affects passing tests, change this line. Leaving this line in tests value=None, removing it will test value=UNSET.

Expected behavior A clear and concise description of what you expected to happen.

I would expect that all widgets prefer one (most likely UNSET) over the other.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: Ubuntu, WSL 2 on Windows 11
  • backend: Qt 5.12.3
  • magicgui version 0.3.5

gselzer avatar Jan 20 '22 22:01 gselzer