Skip to content

Commit e9fbf63

Browse files
committed
Rename
1 parent 683e548 commit e9fbf63

File tree

3 files changed

+29
-34
lines changed

3 files changed

+29
-34
lines changed

tools/config_editor/app.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
print("Please install the \"textual-dev\" package before running this script.")
2828
quit()
2929

30-
from targets import TargetsScreen
30+
from settings import SettingsScreen
3131
from editor import EditorScreen
3232
from compile import CompileScreen
3333

@@ -40,38 +40,32 @@ class ConfigEditorApp(App):
4040
os.chdir(ROOT_PATH)
4141

4242
# Set the application options
43-
option_enable_copy = True
43+
setting_enable_copy = True
4444

4545
# Options to be set by the command line arguments
46-
option_target = None
47-
option_arduino_path = None
48-
option_arduino_branch = None
49-
option_idf_branch = None
50-
option_idf_commit = None
51-
option_debug_level = None
46+
setting_target = None
47+
setting_arduino_path = None
48+
setting_arduino_branch = None
49+
setting_idf_branch = None
50+
setting_idf_commit = None
51+
setting_debug_level = None
5252

5353
ENABLE_COMMAND_PALETTE = False
5454
CSS_PATH = "style.tcss"
5555
SCREENS = {
56-
"targets": TargetsScreen(),
56+
"settings": SettingsScreen(),
5757
"compile": CompileScreen(),
5858
"editor": EditorScreen(),
5959
}
6060

61-
def update_targets(self, targets: str) -> None:
62-
# Callback function to update the targets after returning from the targets screen
63-
print("Updating targets in app, received: " + targets)
64-
if targets:
65-
self.option_target = str(targets)
66-
6761
def on_button_pressed(self, event: Button.Pressed) -> None:
6862
# Event handler called when a button is pressed
6963
if event.button.id == "compile-button":
7064
print("Compile button pressed")
7165
self.push_screen("compile")
7266
elif event.button.id == "targets-button":
7367
print("Targets button pressed")
74-
self.push_screen("targets", self.update_targets)
68+
self.push_screen("settings")
7569
elif event.button.id == "options-button":
7670
print("Options button pressed")
7771
self.push_screen("editor")
@@ -94,12 +88,12 @@ def on_mount(self) -> None:
9488
self.title = "Configurator"
9589
self.sub_title = "Main Menu"
9690
print("App started. Initial Options:")
97-
print("Target: " + str(self.option_target))
98-
print("Arduino Path: " + str(self.option_arduino_path))
99-
print("Arduino Branch: " + str(self.option_arduino_branch))
100-
print("IDF Branch: " + str(self.option_idf_branch))
101-
print("IDF Commit: " + str(self.option_idf_commit))
102-
print("IDF Debug Level: " + str(self.option_debug_level))
91+
print("Target: " + str(self.setting_target))
92+
print("Arduino Path: " + str(self.setting_arduino_path))
93+
print("Arduino Branch: " + str(self.setting_arduino_branch))
94+
print("IDF Branch: " + str(self.setting_idf_branch))
95+
print("IDF Commit: " + str(self.setting_idf_commit))
96+
print("IDF Debug Level: " + str(self.setting_debug_level))
10397

10498
def arduino_default_path():
10599
sys_name = platform.system()
@@ -163,12 +157,12 @@ def main() -> None:
163157
args = parser.parse_args()
164158

165159
# Set the options in the app
166-
app.option_target = args.target
167-
app.option_arduino_path = args.arduino_path
168-
app.option_arduino_branch = args.arduino_branch
169-
app.option_idf_branch = args.idf_branch
170-
app.option_idf_commit = args.idf_commit
171-
app.option_debug_level = args.debug_level
160+
app.setting_target = args.target
161+
app.setting_arduino_path = args.arduino_path
162+
app.setting_arduino_branch = args.arduino_branch
163+
app.setting_idf_branch = args.idf_branch
164+
app.setting_idf_commit = args.idf_commit
165+
app.setting_debug_level = args.debug_level
172166

173167
# Main function to run the app
174168
app.run()

tools/config_editor/compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def compile_libs(self) -> None:
3434

3535
label = self.query_one("#compile-title", Static)
3636
self.child_process = None
37-
target = self.app.option_target
37+
target = self.app.setting_target
3838

3939
if os.path.exists(arduino_path):
4040
print("Starting compilation process. Using Arduino path: " + arduino_path)

tools/config_editor/targets.py renamed to tools/config_editor/settings.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
from textual.events import ScreenResume
66
from textual.widgets import Header, RadioButton, Button, RadioSet
77

8-
class TargetsScreen(Screen[str]):
9-
# Target selection screen
8+
class SettingsScreen(Screen):
9+
# Settings screen
1010

1111
# Temporary target string
1212
temp_target_str = ""
1313

1414
def update_targets(self) -> None:
1515
# Update the targets in the screen
16-
self.temp_target_str = str(self.app.option_target)
16+
self.temp_target_str = str(self.app.setting_target)
1717
print("Target updated in screen: " + self.temp_target_str)
1818

1919
def on_button_pressed(self, event: Button.Pressed) -> None:
@@ -25,10 +25,11 @@ def on_button_pressed(self, event: Button.Pressed) -> None:
2525
if radiobutton.value:
2626
self.temp_target_str = target_text
2727
print("Save button pressed. Selected target: " + self.temp_target_str)
28-
self.dismiss(self.temp_target_str)
28+
self.app.setting_target = str(self.temp_target_str)
29+
self.dismiss()
2930
elif event.button.id == "cancel-target-button":
3031
print("Cancel button pressed")
31-
self.dismiss("")
32+
self.dismiss()
3233

3334
@on(ScreenResume)
3435
def on_resume(self) -> None:

0 commit comments

Comments
 (0)