Open
Description
Reported on Discord by "willow <3", and verified by me.
The Pack documentation says that none
is allowed as the value of several properties. However, I can't find any tests for this, and it doesn't actually work.
For example, if you call Pack(visibility="none")
, you get this error:
Traceback (most recent call last):
File "c:\users\smith\cygwin\.venv\bw-dev\lib\site-packages\travertino\declaration.py", line 178, in setter
value = choices.validate(value)
File "c:\users\smith\cygwin\.venv\bw-dev\lib\site-packages\travertino\declaration.py", line 57, in validate
raise ValueError("'{0}' is not a valid initial value".format(value))
ValueError: 'None' is not a valid initial value
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\smith\cygwin\git\beeware\toga\src\winforms\toga_winforms\app.py", line 216, in run_app
self.create()
File "c:\users\smith\cygwin\git\beeware\toga\src\winforms\toga_winforms\app.py", line 113, in create
self.interface.startup()
File "C:\Users\smith\cygwin\git\beeware\beeware-chaquopy-test\src\helloworld\app.py", line 21, in startup
style=Pack(visibility="none")),
File "c:\users\smith\cygwin\.venv\bw-dev\lib\site-packages\travertino\declaration.py", line 73, in __init__
self.update(**style)
File "c:\users\smith\cygwin\.venv\bw-dev\lib\site-packages\travertino\declaration.py", line 97, in update
setattr(self, name, value)
File "c:\users\smith\cygwin\.venv\bw-dev\lib\site-packages\travertino\declaration.py", line 180, in setter
raise ValueError("Invalid value '{}' for property '{}'; Valid values are: {}".format(
ValueError: Invalid value 'none' for property 'visibility'; Valid values are: hidden, none, visible
Passing a Python None
gives the same error message, except for the capitalization of 'none'
.
It looks like the problem is that the string "none" is being converted to a Python None
, and then compared to the available choices, one of which is the string "none".
However, in the case of visibility
, for consistency with CSS, instead of none
it would be better to use hidden
, which is already implemented and tested, but not documented.
Environment:
- Operating System: Windows 10
- Python version: 3.8.7
- Software versions:
- Briefcase: 0.3.7 main branch
- Toga: 0.3.0.dev35 main branch