66from utils .utils import FakePyPresence
77from utils .preload import button_texture , button_hovered_texture
88
9- from arcade .gui import UIBoxLayout , UIAnchorLayout
109from arcade .gui .experimental .focus import UIFocusGroup
1110
1211class Settings (arcade .gui .UIView ):
@@ -30,17 +29,16 @@ def __init__(self, pypresence_client):
3029 self .modified_settings = {}
3130
3231 def create_layouts (self ):
33- self .root = self .add_widget (UIFocusGroup ())
34- self .anchor = self .root .add (UIAnchorLayout (size_hint = (1 , 1 )))
32+ self .anchor = self .add_widget (UIFocusGroup (size_hint = (1 , 1 )))
3533
36- self .box = UIBoxLayout (space_between = 50 , align = "center" , vertical = False )
34+ self .box = arcade . gui . UIBoxLayout (space_between = 50 , align = "center" , vertical = False )
3735 self .anchor .add (self .box , anchor_x = "center" , anchor_y = "top" , align_x = 10 , align_y = - 75 )
3836
39- self .top_box = UIBoxLayout (space_between = self .window .width / 160 , vertical = False )
37+ self .top_box = arcade . gui . UIBoxLayout (space_between = self .window .width / 160 , vertical = False )
4038 self .anchor .add (self .top_box , anchor_x = "left" , anchor_y = "top" , align_x = 10 , align_y = - 10 )
4139
42- self .key_layout = self .box .add (UIBoxLayout (space_between = 20 , align = 'left' ))
43- self .value_layout = self .box .add (UIBoxLayout (space_between = 13 , align = 'left' ))
40+ self .key_layout = self .box .add (arcade . gui . UIBoxLayout (space_between = 20 , align = 'left' ))
41+ self .value_layout = self .box .add (arcade . gui . UIBoxLayout (space_between = 13 , align = 'left' ))
4442
4543 def on_show_view (self ):
4644 super ().on_show_view ()
@@ -68,7 +66,7 @@ def display_categories(self):
6866
6967 self .top_box .add (category_button )
7068
71- self .root .detect_focusable_widgets ()
69+ self .anchor .detect_focusable_widgets ()
7270
7371 def display_category (self , category ):
7472 if hasattr (self , 'apply_button' ):
@@ -96,7 +94,7 @@ def display_category(self, category):
9694 self .value_layout .add (dropdown )
9795
9896 elif setting_dict ['type' ] == "bool" :
99- button_layout = self .value_layout .add (arcade .gui .UIBoxLayout (space_between = 50 , vertical = False ))
97+ button_layout = self .value_layout .add (arcade .gui .arcade . gui . UIBoxLayout (space_between = 50 , vertical = False ))
10098
10199 on_radiobutton = arcade .gui .UITextureButton (texture = button_texture , texture_hovered = button_hovered_texture , text = "ON" , style = button_style , width = 150 , height = 50 )
102100 self .on_radiobuttons [setting ] = on_radiobutton
@@ -139,7 +137,7 @@ def display_category(self, category):
139137 self .apply_button .on_click = lambda event : self .apply_settings ()
140138 self .anchor .add (self .apply_button , anchor_x = "right" , anchor_y = "bottom" , align_x = - 10 , align_y = 10 )
141139
142- self .root .detect_focusable_widgets ()
140+ self .anchor .detect_focusable_widgets ()
143141
144142 def apply_settings (self ):
145143 for config_key , value in self .modified_settings .items ():
@@ -272,7 +270,7 @@ def credits(self):
272270
273271 self .key_layout .add (self .credits_label )
274272
275- self .root .detect_focusable_widgets ()
273+ self .anchor .detect_focusable_widgets ()
276274
277275 def set_highlighted_style (self , element ):
278276 element .texture = button_hovered_texture
0 commit comments