Add Python typings for Rust declared types (#7575)

This comes with a bump of the Python version to 3.11
due to the need for typing.Self.
This commit is contained in:
Simon Hausmann 2025-02-09 16:06:34 +01:00 committed by GitHub
parent 30aefd4957
commit 94c655731f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 207 additions and 8 deletions

View file

@ -2,8 +2,12 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
use pyo3::prelude::*;
use pyo3_stub_gen::{
derive::gen_stub_pyclass, derive::gen_stub_pyclass_enum, derive::gen_stub_pymethods,
};
#[derive(Copy, Clone)]
#[gen_stub_pyclass_enum]
#[pyclass(name = "TimerMode")]
pub enum PyTimerMode {
/// A SingleShot timer is fired only once.
@ -21,11 +25,13 @@ impl From<PyTimerMode> for i_slint_core::timers::TimerMode {
}
}
#[gen_stub_pyclass]
#[pyclass(name = "Timer", unsendable)]
pub struct PyTimer {
timer: i_slint_core::timers::Timer,
}
#[gen_stub_pymethods]
#[pymethods]
impl PyTimer {
#[new]