Skip to content

Commit

Permalink
Fix (still pointless) settings screen
Browse files Browse the repository at this point in the history
  • Loading branch information
froggleston committed Dec 18, 2024
1 parent 5c36555 commit fc9ccce
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions ftui/screens/settings_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ def compose(self) -> ComposeResult:

yield Footer()

#def on_mount(self):
# self.update_settings(self.app.settings)
def on_mount(self):
self.update_settings(self.app.settings)

@on(ScreenResume)
def on_resume(self):
self.update_settings(self.app.settings)
# @on(ScreenResume)
# def on_resume(self):
# self.update_settings(self.app.settings)

@on(Button.Pressed, "#bot-save-settings-button")
def save_settings_button_pressed(self) -> None:
Expand All @@ -58,7 +58,7 @@ def update_settings(self, s):
settings_right.mount(c)
elif isinstance(s[setting], str):
# output textbox
c = Horizontal(id=f"settings-{setting}")
c = Horizontal(id=f"settings-txt-{setting}")
c.mount(Label(setting), Input(s[setting]))
settings_right.mount(c)
elif isinstance(s[setting], dict):
Expand All @@ -67,12 +67,15 @@ def update_settings(self, s):
elif isinstance(s[setting], list):
if setting == "servers":
# output server list
c = Container(id=f"settings-{setting}")
settings_left.mount(c)
try:
settings_servers = self.query_one(f"#settings-{setting}")
except Exception:
settings_servers = Container(id=f"settings-{setting}")
settings_left.mount(settings_servers)

for server in s[setting]:
t = Checkbox(
f"{server['name']} [{server['ip']}:{server['port']}]",
server.get("enabled", True),
)
c.mount(t)
settings_servers.mount(t)

0 comments on commit fc9ccce

Please sign in to comment.