continued adding support for other text editors, added a home screen
This commit is contained in:
10
settings.py
10
settings.py
@@ -1,5 +1,5 @@
|
||||
from textual.screen import ModalScreen
|
||||
from textual.widgets import Label, Select, TabbedContent, TabPane, Switch, Input, Rule, Static
|
||||
from textual.widgets import Label, Select, TextArea, TabbedContent, TabPane, Switch, Input, Rule, Static
|
||||
from textual.containers import Vertical, HorizontalGroup, VerticalGroup, VerticalScroll
|
||||
from textual.binding import Binding
|
||||
|
||||
@@ -70,11 +70,15 @@ class SettingsScreen(ModalScreen):
|
||||
self.dismiss()
|
||||
|
||||
def on_switch_changed(self, event: Switch.Changed):
|
||||
text_area = self.app.current_editor.query_one_optional(TextArea)
|
||||
|
||||
if event.switch.id == "word-wrap":
|
||||
self.app.query_one("#code-editor").soft_wrap = event.value
|
||||
if text_area:
|
||||
text_area.soft_wrap = event.value
|
||||
self.app.config_handler.set("editor", "word_wrap", str(int(event.value)))
|
||||
elif event.switch.id == "line-numbers":
|
||||
self.app.query_one("#code-editor").show_line_numbers = event.value
|
||||
if text_area:
|
||||
text_area.show_line_numbers = event.value
|
||||
self.app.config_handler.set("editor", "line_numbers", str(int(event.value)))
|
||||
elif event.switch.id == "plugins-enabled":
|
||||
self.app.config_handler.set("plugins", "enabled", str(int(event.value)))
|
||||
|
||||
Reference in New Issue
Block a user