Python: Include @slint.callback in the doc reference

(Docs to be written)

- Also fix eq signature and avoid Self to fix links and mypy
This commit is contained in:
Simon Hausmann 2025-02-11 19:31:18 +01:00 committed by Simon Hausmann
parent ee1d8eaa1c
commit 3b367dcc0b
2 changed files with 21 additions and 15 deletions

View file

@ -317,4 +317,5 @@ def set_xdg_app_id(app_id: str):
native.set_xdg_app_id(app_id)
__all__ = ["CompileError", "Component", "load_file", "loader", "Image", "Color",
"Brush", "Model", "ListModel", "Timer", "TimerMode", "set_xdg_app_id"]
"Brush", "Model", "ListModel", "Timer", "TimerMode", "set_xdg_app_id",
"callback"]

View file

@ -9,7 +9,8 @@ import datetime
import os
import pathlib
import typing
from typing import Self
from typing import Any, overload
from collections.abc import Callable
from enum import Enum, auto
@ -31,25 +32,25 @@ class Color:
blue: builtins.int
alpha: builtins.int
def __new__(cls,maybe_value:typing.Optional[builtins.str | RgbaColor | RgbColor]): ...
def brighter(self, factor:builtins.float) -> Self:
def brighter(self, factor:builtins.float) -> "Color":
...
def darker(self, factor:builtins.float) -> Self:
def darker(self, factor:builtins.float) -> "Color":
...
def transparentize(self, factor:builtins.float) -> Self:
def transparentize(self, factor:builtins.float) -> "Color":
...
def mix(self, other:Self, factor:builtins.float) -> Self:
def mix(self, other:"Image", factor:builtins.float) -> "Color":
...
def with_alpha(self, alpha:builtins.float) -> Self:
def with_alpha(self, alpha:builtins.float) -> "Color":
...
def __str__(self) -> builtins.str:
...
def __eq__(self, other:Self) -> builtins.bool:
def __eq__(self, other:object) -> builtins.bool:
...
@ -63,19 +64,19 @@ class Brush:
def is_opaque(self) -> builtins.bool:
...
def brighter(self, factor:builtins.float) -> Self:
def brighter(self, factor:builtins.float) -> "Brush":
...
def darker(self, factor:builtins.float) -> Self:
def darker(self, factor:builtins.float) -> "Brush":
...
def transparentize(self, amount:builtins.float) -> Self:
def transparentize(self, amount:builtins.float) -> "Brush":
...
def with_alpha(self, alpha:builtins.float) -> Self:
def with_alpha(self, alpha:builtins.float) -> "Brush":
...
def __eq__(self, other:Self) -> builtins.bool:
def __eq__(self, other:object) -> builtins.bool:
...
@ -90,14 +91,14 @@ class Image:
path: typing.Optional[builtins.str]
def __new__(cls,): ...
@staticmethod
def load_from_path(path:builtins.str | os.PathLike | pathlib.Path) -> Self:
def load_from_path(path:builtins.str | os.PathLike | pathlib.Path) -> "Image":
r"""
Loads the image from the specified path. Returns None if the image can't be loaded.
"""
...
@staticmethod
def load_from_svg_data(data:typing.Sequence[builtins.int]) -> Self:
def load_from_svg_data(data:typing.Sequence[builtins.int]) -> "Image":
r"""
Creates a new image from a string that describes the image in SVG format.
"""
@ -131,4 +132,8 @@ class Timer:
...
@overload
def callback(func: Callable[..., Any], /) -> Callable[..., Any]: ...
@overload
def callback(*, global_name: typing.Optional[str], name: typing.Optional[str]) -> Callable[..., Any]: ...