Skip to content

Commit 21092e4

Browse files
committed
Misc improvements
1 parent 6921aee commit 21092e4

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

tools/config_editor/app.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66

77
import os
88

9-
from rich.console import RenderableType
10-
11-
from textual.app import App, ComposeResult
12-
from textual.containers import Container
13-
from textual.widgets import Button, Header, RichLog, Label
9+
try:
10+
from rich.console import RenderableType
11+
from textual.app import App, ComposeResult
12+
from textual.containers import Container
13+
from textual.widgets import Button, Header, RichLog, Label
14+
except ImportError:
15+
print("Please install the 'textual-dev' package before running this script.")
16+
quit()
1417

1518
from targets import TargetsScreen
1619
from editor import EditorScreen

tools/config_editor/targets.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class TargetsScreen(Screen[dict]):
1010

1111
def update_targets(self) -> None:
1212
self.temp_target_dict = dict(self.app.target_dict)
13+
print("Targets updated:")
14+
print(self.temp_target_dict)
1315

1416
def on_button_pressed(self, event: Button.Pressed) -> None:
1517
"""Event handler called when a button is pressed."""
@@ -28,7 +30,6 @@ def on_button_pressed(self, event: Button.Pressed) -> None:
2830
self.dismiss({})
2931

3032
def compose(self) -> ComposeResult:
31-
self.update_targets()
3233
yield Header()
3334
with Container(id="target-selection-container"):
3435
with VerticalScroll(id="target-scroll-container"):
@@ -53,8 +54,6 @@ def on_mount(self) -> None:
5354
def on_resume(self) -> None:
5455
print("Targets screen resumed")
5556
self.update_targets()
56-
print(self.temp_target_dict)
5757
for checkbox in self.query("Checkbox"):
5858
target_text = checkbox.id[:-9]
5959
checkbox.value = self.temp_target_dict[target_text]
60-

0 commit comments

Comments
 (0)