Skip to content

Commit

Permalink
GUI: 3.0 cleanup (#2371)
Browse files Browse the repository at this point in the history
* Remove unlisted old examples
* Fix scroll example
* Inform about UIView in gui.concepts
  • Loading branch information
eruvanos authored Sep 22, 2024
1 parent 0ed4661 commit c650082
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 208 deletions.
60 changes: 0 additions & 60 deletions arcade/examples/gui/dropdown.py

This file was deleted.

8 changes: 4 additions & 4 deletions arcade/examples/gui/exp_scroll_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ def __init__(self):
h_scroll_area = UIBoxLayout(vertical=True, size_hint=(0.8, 0.8))
content_right.add(h_scroll_area, anchor_x="center", anchor_y="center")

scroll_layout = h_scroll_area.add(UIScrollArea(size_hint=(1, 1)))
scroll_layout.with_border(color=arcade.uicolor.WHITE_CLOUDS)
scroll_layout.add(horizontal_list)
h_scroll_layout = h_scroll_area.add(UIScrollArea(size_hint=(1, 1)))
h_scroll_layout.with_border(color=arcade.uicolor.WHITE_CLOUDS)
h_scroll_layout.add(horizontal_list)

h_scroll_area.add(UIScrollBar(scroll_layout, vertical=False))
h_scroll_area.add(UIScrollBar(h_scroll_layout, vertical=False))

def on_key_press(self, symbol: int, modifiers: int) -> bool | None:
if symbol == arcade.key.ESCAPE:
Expand Down
79 changes: 0 additions & 79 deletions arcade/examples/gui/grid_layout.py

This file was deleted.

64 changes: 0 additions & 64 deletions arcade/examples/gui/side_bars_with_box_layout.py

This file was deleted.

5 changes: 4 additions & 1 deletion arcade/gui/experimental/scroll_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,13 @@ def do_layout(self):
if new_rect != child.rect:
child.rect = new_rect

total_min_x = round(total_min_x)
total_min_y = round(total_min_y)

# resize surface to fit all children
if self.surface.size != (total_min_x, total_min_y):
self.surface.resize(
size=(round(total_min_x), round(total_min_y)), pixel_ratio=self.surface.pixel_ratio
size=(total_min_x, total_min_y), pixel_ratio=self.surface.pixel_ratio
)
self.scroll_x = 0
self.scroll_y = 0
Expand Down
6 changes: 6 additions & 0 deletions doc/programming_guide/gui/concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ And disable it with :py:meth:`~arcade.gui.UIManager.disable()` within :py:meth:`

To draw the GUI, call :py:meth:`~arcade.gui.UIManager.draw` within the :py:meth:`~arcade.View.on_draw` method.

The :py:class`~arcade.gui.UIView` class is a subclass of :py:class:`~arcade.View` and provides
a convenient way to use the GUI. It instanciates a :py:class:`~arcade.gui.UIManager` which can be accessed
via the :py:attr:`~arcade.gui.UIView.ui` attribute.
It automatically enables and disables the
:py:class:`~arcade.gui.UIManager` when the view is shown or hidden.


UIWidget
````````
Expand Down

0 comments on commit c650082

Please sign in to comment.