Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion arcade/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
from arcade.gui.widgets import UIInteractiveWidget
from arcade.gui.widgets import UILayout
from arcade.gui.widgets import UISpace
from arcade.gui.view import UIView
from arcade.gui.widgets.dropdown import UIDropdown
from arcade.gui.widgets import UISpriteWidget
from arcade.gui.widgets import UIWidget
from arcade.gui.widgets.buttons import (
UITextureButton,
UITextureButtonStyle,
UIFlatButton,
)
from arcade.gui.widgets.dropdown import UIDropdown
from arcade.gui.widgets.image import UIImage
from arcade.gui.widgets.layout import UIBoxLayout, UIAnchorLayout, UIGridLayout
from arcade.gui.widgets.slider import UIBaseSlider, UISlider, UITextureSlider, UISliderStyle
Expand Down Expand Up @@ -66,6 +67,7 @@
"UIInputText",
"UILayout",
"UILabel",
"UIView",
"UIMouseEvent",
"UIMouseDragEvent",
"UIMouseMovementEvent",
Expand Down
24 changes: 24 additions & 0 deletions arcade/gui/view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from arcade import View
from arcade.gui import UIManager


class UIView(View):
"""This view provides basic GUI setup.

This is a convenience class, which adds the UIManager to the view under `self.ui`.
The UIManager is enabled when the view is shown and disabled when the view is hidden.

If you override ``on_show_view`` or ``on_show_view``,
don't forget to call super().on_show_view() or super().on_hide_view().

"""

def __init__(self):
super().__init__()
self.ui = UIManager()

def on_show_view(self):
self.ui.enable()

def on_hide_view(self):
self.ui.disable()
1 change: 1 addition & 0 deletions util/update_quick_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
'gui/surface.py': ['GUI', 'gui.rst'],
'gui/ui_manager.py': ['GUI', 'gui.rst'],
'gui/nine_patch.py': ['GUI', 'gui.rst'],
'gui/view.py': ['GUI', 'gui.rst'],
'widgets/__init__.py': ['GUI Widgets', 'gui_widgets.rst'],
'widgets/buttons.py': ['GUI Widgets', 'gui_widgets.rst'],
'widgets/dropdown.py': ['GUI Widgets', 'gui_widgets.rst'],
Expand Down