Skip to content

Commit

Permalink
typing: Gtk4: Return correct type for Gtk.Template
Browse files Browse the repository at this point in the history
  • Loading branch information
lovetox committed Nov 1, 2024
1 parent 59b3ff6 commit 27b22bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/gi-stubs/repository/_Gtk4.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ from gi.repository import Gsk
from gi.repository import Pango

_SomeSurface = TypeVar("_SomeSurface", bound=cairo.Surface)
T = TypeVar("T")

# override
CellRendererT = TypeVar(
Expand Down Expand Up @@ -29147,7 +29148,7 @@ class Template:
def from_resource(cls, resource_path: str) -> Template: ...
@classmethod
def from_string(cls, string: str) -> Template: ...
def __call__(self, cls) -> Template: ...
def __call__(self, cls: T) -> T: ...

class Callback:
def __init__(self, name: str = ...) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion tools/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def _build(parent: ObjectT, namespace: str, overrides: dict[str, str]) -> str:
ns = set()
ret = _gi_build_stub(parent, namespace, dir(parent), ns, overrides, None, "")

typevars: list[str] = []
typevars: list[str] = ['T = typing.TypeVar("T")']
imports: list[str] = []
if "cairo" in ns:
imports = ["import cairo"]
Expand Down

0 comments on commit 27b22bd

Please sign in to comment.