started work on settings menu
This commit is contained in:
3
main.py
3
main.py
@@ -10,6 +10,7 @@ from pathlib import Path
|
||||
|
||||
from assets.theme_mappings import theme_mappings
|
||||
from plugin_loader import PluginLoader
|
||||
from settings import SettingsScreen
|
||||
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
@@ -349,6 +350,8 @@ class Berry(App):
|
||||
#else:
|
||||
# self.query_one("#terminal").start()
|
||||
|
||||
self.push_screen(SettingsScreen())
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = Berry("./")
|
||||
app.run()
|
||||
60
settings.py
Normal file
60
settings.py
Normal file
@@ -0,0 +1,60 @@
|
||||
from textual.screen import ModalScreen
|
||||
from textual.widgets import Label, TabbedContent, TabPane, Checkbox
|
||||
from textual.containers import Vertical, HorizontalGroup, VerticalGroup
|
||||
from textual.binding import Binding
|
||||
|
||||
|
||||
class SettingsScreen(ModalScreen):
|
||||
border_title = "Settings"
|
||||
DEFAULT_CSS = """
|
||||
SettingsScreen {
|
||||
align: center middle;
|
||||
|
||||
#window {
|
||||
border: panel $primary;
|
||||
background: $background;
|
||||
width: 65%;
|
||||
height: 65%;
|
||||
padding: 1;
|
||||
}
|
||||
|
||||
TabPane {
|
||||
padding: 1;
|
||||
}
|
||||
|
||||
.setting {
|
||||
padding: 0 2;
|
||||
.setting-name {
|
||||
text-style: bold;
|
||||
}
|
||||
.setting-desc {
|
||||
text-style: dim;
|
||||
text-wrap: wrap;
|
||||
width: 1fr;
|
||||
}
|
||||
VerticalGroup {
|
||||
max-width: 30%;
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
BINDINGS = [
|
||||
Binding("escape", "close", "Close")
|
||||
]
|
||||
|
||||
def action_close(self):
|
||||
self.dismiss()
|
||||
|
||||
def compose(self):
|
||||
with Vertical(id="window") as window:
|
||||
window.border_title = "Settings"
|
||||
with TabbedContent():
|
||||
yield TabPane("Appearance")
|
||||
with TabPane("Editor"):
|
||||
with HorizontalGroup(classes="setting"):
|
||||
with VerticalGroup():
|
||||
yield Label("Word Wrap", classes="setting-name")
|
||||
yield Label("Enable word wrap in the code editor.", classes="setting-desc")
|
||||
yield Checkbox(value=True)
|
||||
yield TabPane("Plugins")
|
||||
Reference in New Issue
Block a user