Python: Improve Struct mapping

When reading, create the local equivalent of a dataclass, so that access
doesn't require ["foo"] key syntax.

Also implement the copy protocol, so that we can safely make clones of
the references returned by the ListModel.
This commit is contained in:
Simon Hausmann 2024-03-09 20:56:37 +01:00
parent 0b6381d012
commit e3aab79fdb
7 changed files with 103 additions and 25 deletions

View file

@ -41,6 +41,7 @@ fn slint(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<brush::PyColor>()?;
m.add_class::<brush::PyBrush>()?;
m.add_class::<models::PyModelBase>()?;
m.add_class::<value::PyStruct>()?;
m.add_function(wrap_pyfunction!(run_event_loop, m)?)?;
m.add_function(wrap_pyfunction!(quit_event_loop, m)?)?;