mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
parent
f62d5e0d4b
commit
80fda11e0f
8 changed files with 289 additions and 12 deletions
|
@ -43,7 +43,9 @@ impl<'a> ToPyObject for PyValueRef<'a> {
|
|||
.map(|(name, val)| (name.to_string().into_py(py), PyValueRef(val).into_py(py)))
|
||||
.into_py_dict(py)
|
||||
.into_py(py),
|
||||
slint_interpreter::Value::Brush(_) => todo!(),
|
||||
slint_interpreter::Value::Brush(brush) => {
|
||||
crate::brush::PyBrush::from(brush.clone()).into_py(py)
|
||||
}
|
||||
_ => todo!(),
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +68,10 @@ impl FromPyObject<'_> for PyValue {
|
|||
ob.extract::<PyRef<'_, crate::image::PyImage>>()
|
||||
.map(|pyimg| slint_interpreter::Value::Image(pyimg.image.clone()))
|
||||
})
|
||||
.or_else(|_| {
|
||||
ob.extract::<PyRef<'_, crate::brush::PyBrush>>()
|
||||
.map(|pybrush| slint_interpreter::Value::Brush(pybrush.brush.clone()))
|
||||
})
|
||||
.or_else(|_| {
|
||||
ob.extract::<&PyDict>().and_then(|dict| {
|
||||
let dict_items: Result<Vec<(String, slint_interpreter::Value)>, PyErr> = dict
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue