mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-24 00:03:42 +05:00
refactor(Moonraker): skip selection dialog if there is only 1 klipper instance
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -103,26 +103,30 @@ def install_moonraker(
|
|||||||
moonraker_instances: List[Moonraker],
|
moonraker_instances: List[Moonraker],
|
||||||
klipper_instances: List[Klipper],
|
klipper_instances: List[Klipper],
|
||||||
) -> None:
|
) -> None:
|
||||||
print_moonraker_overview(
|
selected_klipper_instance = 0
|
||||||
klipper_instances, moonraker_instances, show_index=True, show_select_all=True
|
if len(klipper_instances) > 1:
|
||||||
)
|
print_moonraker_overview(
|
||||||
|
klipper_instances,
|
||||||
options = [str(i) for i in range(len(klipper_instances))]
|
moonraker_instances,
|
||||||
options.extend(["a", "A", "b", "B"])
|
show_index=True,
|
||||||
question = "Select Klipper instance to setup Moonraker for"
|
show_select_all=True,
|
||||||
selection = get_selection_input(question, options).lower()
|
)
|
||||||
|
options = [str(i) for i in range(len(klipper_instances))]
|
||||||
|
options.extend(["a", "A", "b", "B"])
|
||||||
|
question = "Select Klipper instance to setup Moonraker for"
|
||||||
|
selected_klipper_instance = get_selection_input(question, options).lower()
|
||||||
|
|
||||||
instance_names = []
|
instance_names = []
|
||||||
if selection == "b":
|
if selected_klipper_instance == "b":
|
||||||
Logger.print_status(EXIT_MOONRAKER_SETUP)
|
Logger.print_status(EXIT_MOONRAKER_SETUP)
|
||||||
return
|
return
|
||||||
|
|
||||||
elif selection == "a":
|
elif selected_klipper_instance == "a":
|
||||||
for instance in klipper_instances:
|
for instance in klipper_instances:
|
||||||
instance_names.append(instance.suffix)
|
instance_names.append(instance.suffix)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
index = int(selection)
|
index = int(selected_klipper_instance)
|
||||||
instance_names.append(klipper_instances[index].suffix)
|
instance_names.append(klipper_instances[index].suffix)
|
||||||
|
|
||||||
create_example_cfg = get_confirm("Create example moonraker.conf?")
|
create_example_cfg = get_confirm("Create example moonraker.conf?")
|
||||||
|
|||||||
Reference in New Issue
Block a user