actually load the settings when you open the app
This commit is contained in:
12
settings.py
12
settings.py
@@ -3,10 +3,6 @@ from textual.widgets import Label, Select, TabbedContent, TabPane, Switch
|
||||
from textual.containers import Vertical, HorizontalGroup, VerticalGroup
|
||||
from textual.binding import Binding
|
||||
|
||||
from settings_store import ConfigHandler
|
||||
|
||||
import os
|
||||
|
||||
|
||||
class SettingsScreen(ModalScreen):
|
||||
border_title = "Settings"
|
||||
@@ -58,7 +54,6 @@ class SettingsScreen(ModalScreen):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.config_handler = ConfigHandler()
|
||||
|
||||
def action_close(self):
|
||||
self.dismiss()
|
||||
@@ -66,13 +61,12 @@ class SettingsScreen(ModalScreen):
|
||||
def on_switch_changed(self, event: Switch.Changed):
|
||||
if event.switch.id == "word-wrap":
|
||||
self.app.query_one("#code-editor").soft_wrap = event.value
|
||||
self.config_handler.set("editor", "word_wrap", str(int(event.value)))
|
||||
self.notify(str(int(event.value)))
|
||||
self.app.config_handler.set("editor", "word_wrap", str(int(event.value)))
|
||||
|
||||
def on_select_changed(self, event: Select.Changed):
|
||||
if event.select.id == "colour-theme":
|
||||
self.app.theme = event.value
|
||||
self.config_handler.set("appearance", "colour_theme", str(event.value))
|
||||
self.app.config_handler.set("appearance", "colour_theme", str(event.value))
|
||||
|
||||
def compose(self):
|
||||
with Vertical(id="window") as window:
|
||||
@@ -97,7 +91,7 @@ class SettingsScreen(ModalScreen):
|
||||
with VerticalGroup():
|
||||
yield Label("Word Wrap", classes="setting-name")
|
||||
yield Label("Enable word wrap in the code editor.", classes="setting-desc")
|
||||
yield Switch(value=bool(int(self.config_handler.get("editor", "word_wrap"))), id="word-wrap")
|
||||
yield Switch(value=bool(int(self.app.config_handler.get("editor", "word_wrap"))), id="word-wrap")
|
||||
with TabPane("Plugins"):
|
||||
with HorizontalGroup(classes="setting"):
|
||||
with VerticalGroup():
|
||||
|
||||
Reference in New Issue
Block a user