Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and JackAshwell11 committed Dec 5, 2024
1 parent 7f44a32 commit 5650b30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 2 additions & 4 deletions src/hades/progress_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
from arcade import color
from arcade.gui import UIAnchorLayout, UIBoxLayout, UISpace

# Custom
from hades_extensions.ecs.components import Stat

if TYPE_CHECKING:
from arcade.types.color import RGBA255

from hades.sprite import HadesSprite
from hades_extensions.ecs.components import Stat

__all__ = (
"PROGRESS_BAR_DISTANCE",
Expand Down Expand Up @@ -107,7 +105,7 @@ def __init__(self: ProgressBarGroup, sprite: HadesSprite) -> None:
sprite.constructor.progress_bars[component_type][0],
ProgressBar(
cast(
Stat,
"Stat",
sprite.registry.get_component(
sprite.game_object_id,
component_type,
Expand Down
14 changes: 7 additions & 7 deletions src/hades/views/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def use(self: InventoryItemButton) -> None:
if not self.sprite_object:
error = "No sprite object set for this item."
raise ValueError(error)
view = cast(PlayerView, get_window().current_view)
view = cast("PlayerView", get_window().current_view)
view.registry.get_system(InventorySystem).use_item(
view.game_object_id,
self.sprite_object.game_object_id,
Expand Down Expand Up @@ -287,7 +287,7 @@ def update_description(self: UpgradesItemButton) -> None:
return

# Get the required components
view = cast(PlayerView, get_window().current_view)
view = cast("PlayerView", get_window().current_view)
component = view.registry.get_component(
view.game_object_id,
self.target_component,
Expand Down Expand Up @@ -333,7 +333,7 @@ def use(self: UpgradesItemButton) -> None:
if not self.target_component or not self.target_functions:
error = "No target component or functions set for this item."
raise ValueError(error)
view = cast(PlayerView, get_window().current_view)
view = cast("PlayerView", get_window().current_view)
view.registry.get_system(UpgradeSystem).upgrade_component(
view.game_object_id,
self.target_component,
Expand Down Expand Up @@ -454,9 +454,9 @@ def item_clicked(event: UIOnClickEvent) -> None:
"""
# Get the item that was clicked and either show its stats or use it
# depending on what button was clicked
item = cast(ItemButton, event.source.parent.parent)
item = cast("ItemButton", event.source.parent.parent)
if isinstance(event.source, UITextureButton):
cast(PlayerView, get_window().current_view).stats_layout.set_info(
cast("PlayerView", get_window().current_view).stats_layout.set_info(
*item.get_info(),
)
else:
Expand Down Expand Up @@ -523,10 +523,10 @@ def set_info(
description: The description of the stats layout.
texture: The texture to display in the stats layout.
"""
title_obj = cast(UILabel, self.children[0])
title_obj = cast("UILabel", self.children[0])
title_obj.text = title
title_obj.fit_content()
description_obj = cast(UILabel, self.children[4])
description_obj = cast("UILabel", self.children[4])
description_obj.text = description
description_obj.fit_content()
self.children[2].with_background(texture=texture)
Expand Down

0 comments on commit 5650b30

Please sign in to comment.