diff --git a/arcade/gui/constructs.py b/arcade/gui/constructs.py index 256bb99ad..05d407fa8 100644 --- a/arcade/gui/constructs.py +++ b/arcade/gui/constructs.py @@ -44,7 +44,7 @@ def __init__( raise ValueError("At least a single value has to be available for `buttons`") super().__init__(size_hint=(1, 1)) - self.register_event_type("on_action") # type: ignore # https://github.com/pyglet/pyglet/pull/1173 # noqa + self.register_event_type("on_action") space = 20 @@ -135,7 +135,7 @@ def __init__( space_between=space_between, **kwargs, ) - self.register_event_type("on_action") # type: ignore # https://github.com/pyglet/pyglet/pull/1173 # noqa + self.register_event_type("on_action") self.button_factory = button_factory @@ -154,7 +154,7 @@ def add_button( multiline: Whether the button is multiline or not. """ button = self.button_factory(text=label, style=style, multiline=multiline) - button.on_click = self._on_click # type: ignore + button.on_click = self._on_click self.add(button) return button diff --git a/arcade/gui/property.py b/arcade/gui/property.py index 10facc1b0..87c8b6367 100644 --- a/arcade/gui/property.py +++ b/arcade/gui/property.py @@ -312,13 +312,13 @@ def __delitem__(self, key): self.dispatch() @override - def __iadd__(self, *args): # type: ignore + def __iadd__(self, *args): list.__iadd__(self, *args) self.dispatch() return self @override - def __imul__(self, *args): # type: ignore + def __imul__(self, *args): list.__imul__(self, *args) self.dispatch() return self @@ -373,7 +373,7 @@ def reverse(self): self.dispatch() -class ListProperty(Property): +class ListProperty(Property, Generic[P]): """Property that represents a list. Only list are allowed. Any other classes are forbidden. @@ -383,7 +383,7 @@ def __init__(self): super().__init__(default_factory=_ObservableList) @override - def set(self, instance, value: dict): + def set(self, instance, value: list): """Set value for owner instance, wraps the list into an observable list.""" - value = _ObservableList(self, instance, value) # type: ignore + value = _ObservableList(self, instance, value) super().set(instance, value) diff --git a/arcade/gui/ui_manager.py b/arcade/gui/ui_manager.py index 821cab46e..676018cea 100644 --- a/arcade/gui/ui_manager.py +++ b/arcade/gui/ui_manager.py @@ -405,11 +405,11 @@ def on_mouse_scroll(self, x, y, scroll_x, scroll_y): def on_key_press(self, symbol: int, modifiers: int): """Converts key press event to UI event and dispatches it.""" - return self.dispatch_ui_event(UIKeyPressEvent(self, symbol, modifiers)) # type: ignore + return self.dispatch_ui_event(UIKeyPressEvent(self, symbol, modifiers)) def on_key_release(self, symbol: int, modifiers: int): """Converts key release event to UI event and dispatches it.""" - return self.dispatch_ui_event(UIKeyReleaseEvent(self, symbol, modifiers)) # type: ignore + return self.dispatch_ui_event(UIKeyReleaseEvent(self, symbol, modifiers)) def on_text(self, text): """Converts text event to UI event and dispatches it.""" @@ -442,7 +442,7 @@ def on_resize(self, width, height): self.trigger_render() @property - def rect(self) -> Rect: # type: ignore + def rect(self) -> Rect: """The rect of the UIManager, which is the window size.""" return LBWH(0, 0, *self.window.get_size()) diff --git a/arcade/gui/widgets/__init__.py b/arcade/gui/widgets/__init__.py index dbb289eeb..429854249 100644 --- a/arcade/gui/widgets/__init__.py +++ b/arcade/gui/widgets/__init__.py @@ -97,8 +97,8 @@ def __init__( self.size_hint_min = size_hint_min self.size_hint_max = size_hint_max - self.register_event_type("on_event") # type: ignore # https://github.com/pyglet/pyglet/pull/1173 # noqa - self.register_event_type("on_update") # type: ignore # https://github.com/pyglet/pyglet/pull/1173 # noqa + self.register_event_type("on_event") + self.register_event_type("on_update") for child in children: self.add(child) @@ -558,7 +558,7 @@ def __init__( size_hint_max=size_hint_max, **kwargs, ) - self.register_event_type("on_click") # type: ignore + self.register_event_type("on_click") self.interaction_buttons = interaction_buttons diff --git a/arcade/gui/widgets/dropdown.py b/arcade/gui/widgets/dropdown.py index 08e37c152..288f84707 100644 --- a/arcade/gui/widgets/dropdown.py +++ b/arcade/gui/widgets/dropdown.py @@ -99,7 +99,7 @@ def __init__( # add children after super class setup self.add(self._default_button) - self.register_event_type("on_change") # type: ignore # https://github.com/pyglet/pyglet/pull/1173 # noqa + self.register_event_type("on_change") self.with_border(color=arcade.color.RED) diff --git a/arcade/gui/widgets/slider.py b/arcade/gui/widgets/slider.py index 5569d624e..5f96a0baf 100644 --- a/arcade/gui/widgets/slider.py +++ b/arcade/gui/widgets/slider.py @@ -92,7 +92,7 @@ def __init__( bind(self, "pressed", self.trigger_render) bind(self, "disabled", self.trigger_render) - self.register_event_type("on_change") # type: ignore # https://github.com/pyglet/pyglet/pull/1173 # noqa + self.register_event_type("on_change") def _x_for_value(self, value: float): """Provides the x coordinate for the given value.""" diff --git a/arcade/gui/widgets/toggle.py b/arcade/gui/widgets/toggle.py index 1d407a452..6f9e2463e 100644 --- a/arcade/gui/widgets/toggle.py +++ b/arcade/gui/widgets/toggle.py @@ -84,7 +84,7 @@ def __init__( ) self.value = value - self.register_event_type("on_change") # type: ignore # https://github.com/pyglet/pyglet/pull/1173 # noqa + self.register_event_type("on_change") bind(self, "value", self.trigger_render) bind(self, "value", self._dispatch_on_change_event)