mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
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:
parent
30aefd4957
commit
94c655731f
11 changed files with 207 additions and 8 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue