mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 04:48:27 +00:00
Python: Add support for assigning colors directly to brushes
This commit is contained in:
parent
3c9b57ecf8
commit
3e66b98121
3 changed files with 12 additions and 2 deletions
|
|
@ -75,6 +75,10 @@ impl FromPyObject<'_> for PyValue {
|
|||
ob.extract::<PyRef<'_, crate::brush::PyBrush>>()
|
||||
.map(|pybrush| slint_interpreter::Value::Brush(pybrush.brush.clone()))
|
||||
})
|
||||
.or_else(|_| {
|
||||
ob.extract::<PyRef<'_, crate::brush::PyColor>>()
|
||||
.map(|pycolor| slint_interpreter::Value::Brush(pycolor.color.clone().into()))
|
||||
})
|
||||
.or_else(|_| {
|
||||
ob.extract::<PyRef<'_, crate::models::PyModelBase>>()
|
||||
.map(|pymodel| slint_interpreter::Value::Model(pymodel.as_model()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue