more ui stuff
This commit is contained in:
24
settings.py
24
settings.py
@@ -1,5 +1,5 @@
|
||||
from textual.screen import ModalScreen
|
||||
from textual.widgets import Label, Select, TabbedContent, TabPane, Switch
|
||||
from textual.widgets import Label, Select, TabbedContent, TabPane, Switch, Input
|
||||
from textual.containers import Vertical, HorizontalGroup, VerticalGroup
|
||||
from textual.binding import Binding
|
||||
|
||||
@@ -25,6 +25,7 @@ class SettingsScreen(ModalScreen):
|
||||
.setting {
|
||||
padding: 0 2;
|
||||
content-align: center middle;
|
||||
margin-bottom: 1;
|
||||
|
||||
.setting-name {
|
||||
text-style: bold;
|
||||
@@ -39,9 +40,10 @@ class SettingsScreen(ModalScreen):
|
||||
VerticalGroup {
|
||||
width: 50%;
|
||||
min-width: 20;
|
||||
margin-right: 1;
|
||||
}
|
||||
|
||||
Select {
|
||||
Select, Input {
|
||||
max-width: 30;
|
||||
}
|
||||
}
|
||||
@@ -62,6 +64,9 @@ class SettingsScreen(ModalScreen):
|
||||
if event.switch.id == "word-wrap":
|
||||
self.app.query_one("#code-editor").soft_wrap = event.value
|
||||
self.app.config_handler.set("editor", "word_wrap", str(int(event.value)))
|
||||
elif event.switch.id == "plugins-enabled":
|
||||
self.app.config_handler.set("plugins", "enabled", str(int(event.value)))
|
||||
self.notify("Restart for changes to apply.", title="Restart Required", severity="warning")
|
||||
|
||||
def on_select_changed(self, event: Select.Changed):
|
||||
if event.select.id == "colour-theme":
|
||||
@@ -93,8 +98,21 @@ class SettingsScreen(ModalScreen):
|
||||
yield Label("Enable word wrap in the code editor.", classes="setting-desc")
|
||||
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():
|
||||
yield Label("Plugins Enabled", classes="setting-name")
|
||||
yield Label("Enable or disable Lua plugins. This requires a restart.", classes="setting-desc")
|
||||
yield Switch(value=True)
|
||||
yield Switch(value=bool(int(self.app.config_handler.get("plugins", "enabled"))), id="plugins-enabled")
|
||||
|
||||
with HorizontalGroup(classes="setting"):
|
||||
with VerticalGroup():
|
||||
yield Label("Plugins Log", classes="setting-name")
|
||||
yield Label("Show the plugin loader log on startup.", classes="setting-desc")
|
||||
yield Switch(value=bool(int(self.app.config_handler.get("plugins", "log"))), id="plugins-log")
|
||||
|
||||
with HorizontalGroup(classes="setting"):
|
||||
with VerticalGroup():
|
||||
yield Label("Log Timeout", classes="setting-name")
|
||||
yield Label("How many seconds before the log automatically closes. This gets overriden by the [b]Plugins Log[/] option. The window doesn't automatically close if there was an error.", classes="setting-desc")
|
||||
yield Input(value=self.app.config_handler.get("plugins", "log_timeout"), id="log-timeout", type="integer")
|
||||
Reference in New Issue
Block a user