actually load the settings when you open the app
This commit is contained in:
24
main.py
24
main.py
@@ -11,6 +11,7 @@ from pathlib import Path
|
||||
from assets.theme_mappings import theme_mappings
|
||||
from plugin_loader import PluginLoader
|
||||
from settings import SettingsScreen
|
||||
from settings_store import ConfigHandler
|
||||
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
@@ -43,6 +44,7 @@ class Berry(App):
|
||||
def __init__(self, path: str):
|
||||
super().__init__()
|
||||
self.path = path
|
||||
self.config_handler = ConfigHandler(self)
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Header()
|
||||
@@ -80,7 +82,25 @@ class Berry(App):
|
||||
self.push_screen(SettingsScreen())
|
||||
|
||||
def get_system_commands(self, screen):
|
||||
yield from super().get_system_commands(screen)
|
||||
yield SystemCommand(
|
||||
"Quit the application",
|
||||
"Quit the application as soon as possible",
|
||||
self.action_quit,
|
||||
)
|
||||
|
||||
if screen.query("HelpPanel"):
|
||||
yield SystemCommand(
|
||||
"Hide keys and help panel",
|
||||
"Hide the keys and widget help panel",
|
||||
self.action_hide_help_panel,
|
||||
)
|
||||
else:
|
||||
yield SystemCommand(
|
||||
"Show keys and help panel",
|
||||
"Show help for the focused widget and a summary of available keys",
|
||||
self.action_show_help_panel,
|
||||
)
|
||||
|
||||
yield SystemCommand("Settings", "Open the settings menu", self.action_settings)
|
||||
|
||||
def on_input_submitted(self, event: Input.Submitted):
|
||||
@@ -358,6 +378,8 @@ class Berry(App):
|
||||
#else:
|
||||
# self.query_one("#terminal").start()
|
||||
|
||||
self.config_handler.apply_settings()
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = Berry("./")
|
||||
app.run()
|
||||
Reference in New Issue
Block a user