Upgrade to PyO3 0.23

This commit is contained in:
Simon Hausmann 2025-04-03 10:55:55 +02:00 committed by Simon Hausmann
parent ad74c31ed4
commit 0c51f69b0a
6 changed files with 45 additions and 39 deletions

View file

@ -33,6 +33,7 @@ struct RgbColor {
}
#[derive(FromPyObject)]
#[pyclass]
enum PyColorInput {
ColorStr(String),
// This variant must come before RgbColor
@ -73,6 +74,7 @@ pub struct PyColor {
#[pymethods]
impl PyColor {
#[new]
#[pyo3(signature = (maybe_value=None))]
fn py_new(maybe_value: Option<PyColorInput>) -> PyResult<Self> {
let Some(value) = maybe_value else {
return Ok(Self { color: Default::default() });
@ -168,6 +170,7 @@ impl From<slint_interpreter::Color> for PyColor {
}
#[derive(FromPyObject)]
#[pyclass]
enum PyBrushInput {
SolidColor(PyColor),
}
@ -191,6 +194,7 @@ pub struct PyBrush {
#[pymethods]
impl PyBrush {
#[new]
#[pyo3(signature = (maybe_value=None))]
fn py_new(maybe_value: Option<PyBrushInput>) -> PyResult<Self> {
let Some(value) = maybe_value else {
return Ok(Self { brush: Default::default() });