chore: fix formatting/wording

also add a quick check if the klipper env exists

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2025-03-13 17:57:31 +01:00
parent f76f265199
commit f874709431
2 changed files with 24 additions and 13 deletions

View File

@@ -43,7 +43,11 @@ from utils.common import check_install_dependencies, get_install_status
from utils.fs_utils import check_file_exist from utils.fs_utils import check_file_exist
from utils.input_utils import get_confirm, get_number_input, get_string_input from utils.input_utils import get_confirm, get_number_input, get_string_input
from utils.instance_utils import get_instances from utils.instance_utils import get_instances
from utils.sys_utils import cmd_sysctl_service, parse_packages_from_file, install_python_packages from utils.sys_utils import (
cmd_sysctl_service,
install_python_packages,
parse_packages_from_file,
)
def get_klipper_status() -> ComponentStatus: def get_klipper_status() -> ComponentStatus:
@@ -214,22 +218,29 @@ def install_klipper_packages() -> None:
def install_input_shaper_deps() -> None: def install_input_shaper_deps() -> None:
if not KLIPPER_ENV_DIR.exists():
Logger.print_warn("Required Klipper python environment not found!")
return
Logger.print_dialog( Logger.print_dialog(
DialogType.CUSTOM, DialogType.CUSTOM,
[ [
"Resonance measurements and shaper auto-calibration require additional " "Resonance measurements and shaper auto-calibration require additional "
"software dependencies not installed by default. " "software dependencies which are not installed by default. "
"If you agree, the following additional debian packages will be installed:", "If you agree, the following additional system packages will be installed:",
"● python3-numpy",
"● python3-matplotlib",
"● libatlas-base-dev",
"● libopenblas-dev",
"\n\n", "\n\n",
"python3-numpy python3-matplotlib libatlas-base-dev libopenblas-dev", "Also, the following Python package will be installed:",
"\n\n", "● numpy",
"And also the following pip package will be installed: "
"\n\n",
"numpy",
], ],
custom_title="Install Input Shaper Dependencies", custom_title="Install Input Shaper Dependencies",
) )
if not get_confirm("Do you want to install required packages?", default_choice=False): if not get_confirm(
"Do you want to install the required packages?", default_choice=False
):
return return
apt_deps = ( apt_deps = (
@@ -239,7 +250,7 @@ def install_input_shaper_deps() -> None:
"libopenblas-dev", "libopenblas-dev",
) )
check_install_dependencies({*apt_deps}) check_install_dependencies({*apt_deps})
py_deps = ("numpy",) py_deps = ("numpy",)
install_python_packages(KLIPPER_ENV_DIR, {*py_deps}) install_python_packages(KLIPPER_ENV_DIR, {*py_deps})

View File

@@ -67,8 +67,8 @@ class AdvancedMenu(BaseMenu):
║ 3) [Build + Flash] │ ║ ║ 3) [Build + Flash] │ ║
║ 4) [Get MCU ID] │ System: ║ ║ 4) [Get MCU ID] │ System: ║
║ │ 8) [Change hostname] ║ ║ │ 8) [Change hostname] ║
║ Extra dependencies: │ ║ ║ Extra Dependencies: │ ║
║ 5) [Input shaper] │ ║ ║ 5) [Input Shaper] │ ║
╟───────────────────────────┴───────────────────────────╢ ╟───────────────────────────┴───────────────────────────╢
""" """
)[1:] )[1:]