1import fsui 2from launcher.launcher_settings import LauncherSettings 3from launcher.settings.option_ui import OptionUI 4from launcher.settings.settings_header import SettingsHeader 5 6 7class SettingsPage(fsui.Panel): 8 def __init__(self, parent): 9 super().__init__(parent) 10 self.layout = fsui.VerticalLayout() 11 self.layout.padding_top = 20 12 self.layout.padding_bottom = 20 13 self.layout.padding_left = 20 14 self.layout.padding_right = 20 15 self.icon_header = None 16 self.options_on_page = set() 17 18 def add_header(self, icon, title, subtitle=""): 19 self.icon_header = SettingsHeader(self, icon, title, subtitle) 20 self.layout.add(self.icon_header, fill=True, margin_bottom=20) 21 22 def add_option(self, name, description=""): 23 group = OptionUI.create_group(self, name, description=description) 24 self.layout.add(group, fill=True, margin_top=10, margin_bottom=10) 25 self.options_on_page.add(name) 26 return group 27 28 def add_section(self, title): 29 label = fsui.HeadingLabel(self, title) 30 self.layout.add(label, margin_top=20, margin_bottom=20) 31 32 def reset_to_defaults(self): 33 for option in self.options_on_page: 34 LauncherSettings.set(option, "") 35