Add support for mapping image properties

This exposes a slint.Image class, which has a load_from_path class
method as well as size/width/height properties.

cc #4202
This commit is contained in:
Simon Hausmann 2024-02-06 11:52:28 +01:00 committed by Simon Hausmann
parent 9aa931f1f8
commit 93efd74e24
6 changed files with 97 additions and 3 deletions

View file

@ -86,3 +86,17 @@ impl From<slint_interpreter::SetCallbackError> for PySetCallbackError {
Self(err)
}
}
pub struct PyLoadImageError(pub slint_interpreter::LoadImageError);
impl From<PyLoadImageError> for PyErr {
fn from(err: PyLoadImageError) -> Self {
pyo3::exceptions::PyRuntimeError::new_err(err.0.to_string())
}
}
impl From<slint_interpreter::LoadImageError> for PyLoadImageError {
fn from(err: slint_interpreter::LoadImageError) -> Self {
Self(err)
}
}