mirror of
https://github.com/csd4ni3l/shatterstack.git
synced 2026-01-01 12:33:48 +01:00
Add controller support
This commit is contained in:
@@ -6,7 +6,6 @@ from utils.constants import button_style, dropdown_style, slider_style, settings
|
||||
from utils.utils import FakePyPresence
|
||||
from utils.preload import button_texture, button_hovered_texture, theme_sound
|
||||
|
||||
from arcade.gui import UIBoxLayout, UIAnchorLayout
|
||||
from arcade.gui.experimental.focus import UIFocusGroup
|
||||
|
||||
class Settings(arcade.gui.UIView):
|
||||
@@ -30,16 +29,16 @@ class Settings(arcade.gui.UIView):
|
||||
self.modified_settings = {}
|
||||
|
||||
def create_layouts(self):
|
||||
self.anchor = self.add_widget(UIAnchorLayout(size_hint=(1, 1)))
|
||||
self.anchor = self.add_widget(UIFocusGroup(size_hint=(1, 1)))
|
||||
|
||||
self.box = UIBoxLayout(space_between=50, align="center", vertical=False)
|
||||
self.box = arcade.gui.UIBoxLayout(space_between=50, align="center", vertical=False)
|
||||
self.anchor.add(self.box, anchor_x="center", anchor_y="top", align_x=10, align_y=-75)
|
||||
|
||||
self.top_box = UIBoxLayout(space_between=self.window.width / 160, vertical=False)
|
||||
self.top_box = arcade.gui.UIBoxLayout(space_between=self.window.width / 160, vertical=False)
|
||||
self.anchor.add(self.top_box, anchor_x="left", anchor_y="top", align_x=10, align_y=-10)
|
||||
|
||||
self.key_layout = self.box.add(UIBoxLayout(space_between=20, align='left'))
|
||||
self.value_layout = self.box.add(UIBoxLayout(space_between=13, align='left'))
|
||||
self.key_layout = self.box.add(arcade.gui.UIBoxLayout(space_between=20, align='left'))
|
||||
self.value_layout = self.box.add(arcade.gui.UIBoxLayout(space_between=13, align='left'))
|
||||
|
||||
def on_show_view(self):
|
||||
super().on_show_view()
|
||||
@@ -67,6 +66,8 @@ class Settings(arcade.gui.UIView):
|
||||
|
||||
self.top_box.add(category_button)
|
||||
|
||||
self.anchor.detect_focusable_widgets()
|
||||
|
||||
def display_category(self, category):
|
||||
if hasattr(self, 'apply_button'):
|
||||
self.anchor.remove(self.apply_button)
|
||||
@@ -135,6 +136,8 @@ class Settings(arcade.gui.UIView):
|
||||
self.apply_button.on_click = lambda e: self.apply_settings()
|
||||
self.anchor.add(self.apply_button, anchor_x="right", anchor_y="bottom", align_x=-10, align_y=10)
|
||||
|
||||
self.anchor.detect_focusable_widgets()
|
||||
|
||||
def apply_settings(self):
|
||||
for config_key, value in self.modified_settings.items():
|
||||
self.settings_dict[config_key] = value
|
||||
|
||||
Reference in New Issue
Block a user