Philipp Hörist pushed to branch translation at gajim / gajim
Commits:
87896887 by Philipp Hörist at 2025-06-27T09:31:27+02:00
cfix: type fixes
- - - - -
1 changed file:
- gajim/gtk/util/classes.py
Changes:
=====================================
gajim/gtk/util/classes.py
=====================================
@@ -5,11 +5,12 @@
from __future__ import annotations
from typing import Any
+from typing import TypeVar
import sys
import xml.etree.ElementTree as ET
-from gi._gtktemplate import register_template
+from gi._gtktemplate import register_template # pyright: ignore
from gi.repository import Gio
from gi.repository import GLib
from gi.repository import GObject
@@ -17,6 +18,8 @@
from gajim.common.i18n import _
+_T = TypeVar("_T")
+
class SignalManager:
def __init__(self) -> None:
@@ -56,12 +59,14 @@ def _disconnect_object(self, obj: GObject.Object) -> None:
class GajimTemplate(Gtk.Template):
- def __call__(self, cls: Any) -> Any:
- if sys.platform != "win32":
+ filename: Any
+
+ def __call__(self, cls: type[_T]) -> type[_T]:
+ if sys.platform == "win32":
return super().__call__(cls)
- if not isinstance(cls, type) or not issubclass(cls, Gtk.Widget):
- raise TypeError("Can only use @Gtk.Template on Widgets")
+ assert isinstance(cls, type)
+ assert issubclass(cls, Gtk.Widget)
if "__gtype_name__" not in cls.__dict__:
raise TypeError(
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/878968873bf0143dfcf0195a17489fc78add2d20
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/878968873bf0143dfcf0195a17489fc78add2d20
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]