2020from arcade .clock import GLOBAL_CLOCK , GLOBAL_FIXED_CLOCK , _setup_clock , _setup_fixed_clock
2121from arcade .color import TRANSPARENT_BLACK
2222from arcade .context import ArcadeContext
23- from arcade .sections import SectionManager
2423from arcade .types import LBWH , Color , Rect , RGBANormalized , RGBOrA255
2524from arcade .utils import is_raspberry_pi
2625from arcade .window_commands import get_display_size , set_window
@@ -979,37 +978,21 @@ def show_view(self, new_view: View) -> None:
979978 # remove previously shown view's handlers
980979 if self ._current_view is not None :
981980 self ._current_view .on_hide_view ()
982- if self ._current_view .has_sections :
983- self .remove_handlers (self ._current_view .section_manager )
984981 self .remove_handlers (self ._current_view )
985982
986983 # push new view's handlers
987984 self ._current_view = new_view
988- if new_view .has_sections :
989- section_manager_managed_events = new_view .section_manager .managed_events
990- section_handlers = {
991- event_type : getattr (new_view .section_manager , event_type , None )
992- for event_type in section_manager_managed_events
993- }
994- if section_handlers :
995- self .push_handlers (** section_handlers )
996- else :
997- section_manager_managed_events = set ()
998985
999986 # Note: Excluding on_show because this even can trigger multiple times.
1000987 # It should only be called once when the view is shown.
1001988 view_handlers = {
1002989 event_type : getattr (new_view , event_type , None )
1003990 for event_type in self .event_types
1004- if event_type != "on_show"
1005- and event_type not in section_manager_managed_events
1006- and hasattr (new_view , event_type )
991+ if event_type != "on_show" and hasattr (new_view , event_type )
1007992 }
1008993 if view_handlers :
1009994 self .push_handlers (** view_handlers )
1010995 self ._current_view .on_show_view ()
1011- if self ._current_view .has_sections :
1012- self ._current_view .section_manager .on_show_view ()
1013996
1014997 # Note: After the View has been pushed onto pyglet's stack of event handlers
1015998 # (via push_handlers()), pyglet
@@ -1028,18 +1011,9 @@ def hide_view(self) -> None:
10281011 return
10291012
10301013 self ._current_view .on_hide_view ()
1031- if self ._current_view .has_sections :
1032- self ._current_view .section_manager .on_hide_view ()
1033- self .remove_handlers (self ._current_view .section_manager )
10341014 self .remove_handlers (self ._current_view )
10351015 self ._current_view = None
10361016
1037- # def _create(self) -> None:
1038- # super()._create()
1039-
1040- # def _recreate(self, changes) -> None:
1041- # super()._recreate(changes)
1042-
10431017 def flip (self ) -> None :
10441018 """
10451019 Present the rendered content to the screen.
@@ -1249,7 +1223,7 @@ class View:
12491223 Subclassing the window is very inflexible since you can't easily switch
12501224 your update and draw logic.
12511225
1252- A view is a way to encapsulate that logic so you can easily switch between
1226+ A view is a way to encapsulate that logic, so you can easily switch between
12531227 different parts of your game. Maybe you have a title screen, a game screen,
12541228 and a game over screen. Each of these could be a different view.
12551229
@@ -1261,46 +1235,6 @@ class View:
12611235
12621236 def __init__ (self , window : Window | None = None ) -> None :
12631237 self .window = arcade .get_window () if window is None else window
1264- self .key : int | None = None
1265- self ._section_manager : SectionManager | None = None
1266-
1267- @property
1268- def section_manager (self ) -> SectionManager :
1269- """The section manager for this view.
1270-
1271- If the view has section manager one will be created.
1272- """
1273- if self ._section_manager is None :
1274- self ._section_manager = SectionManager (self )
1275- return self ._section_manager
1276-
1277- @property
1278- def has_sections (self ) -> bool :
1279- """Returns ``True`` if this view has sections."""
1280- if self ._section_manager is None :
1281- return False
1282- else :
1283- return self .section_manager .has_sections
1284-
1285- def add_section (
1286- self ,
1287- section : arcade .Section ,
1288- at_index : int | None = None ,
1289- at_draw_order : int | None = None ,
1290- ) -> None :
1291- """
1292- Adds a section to the view Section Manager.
1293-
1294- Args:
1295- section:
1296- The section to add to this section manager
1297- at_index (optional):
1298- The index to insert the section for event capture and
1299- update events. If ``None`` it will be added at the end.
1300- at_draw_order (optional):
1301- Inserts the section in a specific draw order. Overwrites section.draw_order
1302- """
1303- self .section_manager .add_section (section , at_index , at_draw_order )
13041238
13051239 def clear (
13061240 self ,
0 commit comments