Skip to content

Commit

Permalink
Small cleanup (#2460)
Browse files Browse the repository at this point in the history
  • Loading branch information
eruvanos authored Nov 19, 2024
1 parent 9d13188 commit 84e8789
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 0 additions & 1 deletion arcade/camera/camera_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,6 @@ def projection(self) -> Rect:

@projection.setter
def projection(self, value: Rect) -> None:

# Unpack and validate
if not value:
raise ZeroProjectionDimension((f"Projection area is 0, {value.lrbt}"))
Expand Down
2 changes: 1 addition & 1 deletion arcade/future/splash.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ArcadeSplash(View):
dark_mode: If True, the splash screen will be shown in dark mode. (Default False)
"""

def __init__(self, view: View, duration: int = 3, dark_mode: bool = False):
def __init__(self, view: View, duration: float = 1.5, dark_mode: bool = False):
super().__init__()
self._next_view = view
self._duration = duration
Expand Down
11 changes: 8 additions & 3 deletions arcade/gui/ui_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def on_draw():

_enabled = False

DEFAULT_LAYER = 0
OVERLAY_LAYER = 10

def __init__(self, window: Optional[arcade.Window] = None):
Expand All @@ -103,7 +104,7 @@ def __init__(self, window: Optional[arcade.Window] = None):

self.register_event_type("on_event")

def add(self, widget: W, *, index=None, layer=0) -> W:
def add(self, widget: W, *, index=None, layer=DEFAULT_LAYER) -> W:
"""Add a widget to the :class:`UIManager`.
Added widgets will receive ui events and be rendered.
Expand Down Expand Up @@ -141,7 +142,9 @@ def remove(self, child: UIWidget):
child.parent = None
self.trigger_render()

def walk_widgets(self, *, root: Optional[UIWidget] = None, layer=0) -> Iterable[UIWidget]:
def walk_widgets(
self, *, root: Optional[UIWidget] = None, layer=DEFAULT_LAYER
) -> Iterable[UIWidget]:
"""Walks through widget tree, in reverse draw order (most top drawn widget first)
Args:
Expand All @@ -165,7 +168,9 @@ def clear(self):
for widget in layer[:]:
self.remove(widget)

def get_widgets_at(self, pos: Point2, cls: type[W] = UIWidget, layer=0) -> Iterable[W]:
def get_widgets_at(
self, pos: Point2, cls: type[W] = UIWidget, layer=DEFAULT_LAYER
) -> Iterable[W]:
"""Yields all widgets containing a position, returns first top laying widgets
which is instance of cls.
Expand Down

0 comments on commit 84e8789

Please sign in to comment.