mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
Python: Add more type stubs to the internal Rust API
This commit is contained in:
parent
7c75720c9a
commit
c111098e49
4 changed files with 29 additions and 1 deletions
|
@ -3,9 +3,11 @@
|
|||
|
||||
use pyo3::prelude::*;
|
||||
use pyo3::types::PyDict;
|
||||
use pyo3_stub_gen::{derive::gen_stub_pyclass, derive::gen_stub_pymethods};
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[gen_stub_pyclass]
|
||||
pub struct PyValue(pub slint_interpreter::Value);
|
||||
struct PyValueRef<'a>(&'a slint_interpreter::Value);
|
||||
|
||||
|
@ -120,12 +122,14 @@ impl From<slint_interpreter::Value> for PyValue {
|
|||
}
|
||||
}
|
||||
|
||||
#[gen_stub_pyclass]
|
||||
#[pyclass(subclass, unsendable)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct PyStruct {
|
||||
data: slint_interpreter::Struct,
|
||||
}
|
||||
|
||||
#[gen_stub_pymethods]
|
||||
#[pymethods]
|
||||
impl PyStruct {
|
||||
#[new]
|
||||
|
@ -171,11 +175,13 @@ impl From<slint_interpreter::Struct> for PyStruct {
|
|||
}
|
||||
}
|
||||
|
||||
#[gen_stub_pyclass]
|
||||
#[pyclass(unsendable)]
|
||||
struct PyStructFieldIterator {
|
||||
inner: std::collections::hash_map::IntoIter<String, slint_interpreter::Value>,
|
||||
}
|
||||
|
||||
#[gen_stub_pymethods]
|
||||
#[pymethods]
|
||||
impl PyStructFieldIterator {
|
||||
fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue