mirror of
https://github.com/dw-0/kiauh.git
synced 2026-02-02 23:47:46 +05:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f9d4c823a | ||
|
|
c8df9427b3 | ||
|
|
5414aba299 | ||
|
|
80948edbb4 | ||
|
|
a455edba93 | ||
|
|
810ab3a2fa | ||
|
|
6c9a78496a | ||
|
|
123ccde378 | ||
|
|
45fde808d2 | ||
|
|
8ba134f574 | ||
|
|
f951936b20 | ||
|
|
657d919378 | ||
|
|
24c9b9daa9 | ||
|
|
4c511017f1 | ||
|
|
372bab8847 | ||
|
|
d5062d41de | ||
|
|
e9459bd68e | ||
|
|
ee460663c9 | ||
|
|
6f0e0146ef | ||
|
|
229f317025 | ||
|
|
48c0ae7227 | ||
|
|
9c7b5fcb10 | ||
|
|
191bdd4874 |
@@ -143,7 +143,7 @@ changes!**
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th><h3><a href="https://github.com/fluidd-core/fluidd">Fluidd</a></h3></th>
|
<th><h3><a href="https://github.com/fluidd-core/fluidd">Fluidd</a></h3></th>
|
||||||
<th><h3><a href="https://github.com/jordanruthe/KlipperScreen">KlipperScreen</a></h3></th>
|
<th><h3><a href="https://github.com/KlipperScreen/KlipperScreen">KlipperScreen</a></h3></th>
|
||||||
<th><h3><a href="https://github.com/OctoPrint/OctoPrint">OctoPrint</a></h3></th>
|
<th><h3><a href="https://github.com/OctoPrint/OctoPrint">OctoPrint</a></h3></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -153,7 +153,7 @@ changes!**
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>by <a href="https://github.com/fluidd-core">fluidd-core</a></th>
|
<th>by <a href="https://github.com/fluidd-core">fluidd-core</a></th>
|
||||||
<th>by <a href="https://github.com/jordanruthe">jordanruthe</a></th>
|
<th>by <a href="https://github.com/alfrix">alfrix</a></th>
|
||||||
<th>by <a href="https://github.com/OctoPrint">OctoPrint</a></th>
|
<th>by <a href="https://github.com/OctoPrint">OctoPrint</a></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|||||||
2
kiauh.sh
2
kiauh.sh
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#=======================================================================#
|
#=======================================================================#
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -237,7 +237,6 @@ def install_input_shaper_deps() -> None:
|
|||||||
"If you agree, the following additional system packages will be installed:",
|
"If you agree, the following additional system packages will be installed:",
|
||||||
"● python3-numpy",
|
"● python3-numpy",
|
||||||
"● python3-matplotlib",
|
"● python3-matplotlib",
|
||||||
"● libatlas-base-dev",
|
|
||||||
"● libopenblas-dev",
|
"● libopenblas-dev",
|
||||||
"\n\n",
|
"\n\n",
|
||||||
"Also, the following Python package will be installed:",
|
"Also, the following Python package will be installed:",
|
||||||
@@ -253,7 +252,6 @@ def install_input_shaper_deps() -> None:
|
|||||||
apt_deps = (
|
apt_deps = (
|
||||||
"python3-numpy",
|
"python3-numpy",
|
||||||
"python3-matplotlib",
|
"python3-matplotlib",
|
||||||
"libatlas-base-dev",
|
|
||||||
"libopenblas-dev",
|
"libopenblas-dev",
|
||||||
)
|
)
|
||||||
check_install_dependencies({*apt_deps})
|
check_install_dependencies({*apt_deps})
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -236,9 +236,11 @@ class KlipperSelectMcuConnectionMenu(BaseMenu):
|
|||||||
if len(self.flash_options.mcu_list) < 1:
|
if len(self.flash_options.mcu_list) < 1:
|
||||||
Logger.print_warn("No MCUs found!")
|
Logger.print_warn("No MCUs found!")
|
||||||
Logger.print_warn("Make sure they are connected and repeat this step.")
|
Logger.print_warn("Make sure they are connected and repeat this step.")
|
||||||
|
time.sleep(3)
|
||||||
|
return
|
||||||
|
|
||||||
# if standalone is True, we only display the MCUs to the user and return
|
# if standalone is True, we only display the MCUs to the user and return
|
||||||
if self.__standalone and len(self.flash_options.mcu_list) > 0:
|
if self.__standalone:
|
||||||
Logger.print_ok("The following MCUs were found:", prefix=False)
|
Logger.print_ok("The following MCUs were found:", prefix=False)
|
||||||
for i, mcu in enumerate(self.flash_options.mcu_list):
|
for i, mcu in enumerate(self.flash_options.mcu_list):
|
||||||
print(f" ● MCU #{i}: {Color.CYAN}{mcu}{Color.RST}")
|
print(f" ● MCU #{i}: {Color.CYAN}{mcu}{Color.RST}")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -123,7 +123,7 @@ def create_example_moonraker_conf(
|
|||||||
scp = SimpleConfigParser()
|
scp = SimpleConfigParser()
|
||||||
scp.read_file(target)
|
scp.read_file(target)
|
||||||
trusted_clients: List[str] = [
|
trusted_clients: List[str] = [
|
||||||
f" {'.'.join(ip)}\n",
|
f"{'.'.join(ip)}",
|
||||||
*scp.getvals("authorization", "trusted_clients"),
|
*scp.getvals("authorization", "trusted_clients"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
|
|
||||||
from typing import List
|
from typing import List, Optional
|
||||||
|
|
||||||
from components.klipper.klipper import Klipper
|
from components.klipper.klipper import Klipper
|
||||||
from components.moonraker.moonraker import Moonraker
|
from components.moonraker.moonraker import Moonraker
|
||||||
@@ -27,6 +27,7 @@ def run_client_config_removal(
|
|||||||
client_config: BaseWebClientConfig,
|
client_config: BaseWebClientConfig,
|
||||||
kl_instances: List[Klipper],
|
kl_instances: List[Klipper],
|
||||||
mr_instances: List[Moonraker],
|
mr_instances: List[Moonraker],
|
||||||
|
svc: Optional[BackupService] = None,
|
||||||
) -> Message:
|
) -> Message:
|
||||||
completion_msg = Message(
|
completion_msg = Message(
|
||||||
title=f"{client_config.display_name} Removal Process completed",
|
title=f"{client_config.display_name} Removal Process completed",
|
||||||
@@ -36,12 +37,15 @@ def run_client_config_removal(
|
|||||||
if run_remove_routines(client_config.config_dir):
|
if run_remove_routines(client_config.config_dir):
|
||||||
completion_msg.text.append(f"● {client_config.display_name} removed")
|
completion_msg.text.append(f"● {client_config.display_name} removed")
|
||||||
|
|
||||||
BackupService().backup_printer_config_dir()
|
if svc is None:
|
||||||
|
svc = BackupService()
|
||||||
|
|
||||||
|
svc.backup_moonraker_conf()
|
||||||
completion_msg = remove_moonraker_config_section(
|
completion_msg = remove_moonraker_config_section(
|
||||||
completion_msg, client_config, mr_instances
|
completion_msg, client_config, mr_instances
|
||||||
)
|
)
|
||||||
|
|
||||||
|
svc.backup_printer_cfg()
|
||||||
completion_msg = remove_printer_config_section(
|
completion_msg = remove_printer_config_section(
|
||||||
completion_msg, client_config, kl_instances
|
completion_msg, client_config, kl_instances
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -41,6 +41,7 @@ def run_client_removal(
|
|||||||
)
|
)
|
||||||
mr_instances: List[Moonraker] = get_instances(Moonraker)
|
mr_instances: List[Moonraker] = get_instances(Moonraker)
|
||||||
kl_instances: List[Klipper] = get_instances(Klipper)
|
kl_instances: List[Klipper] = get_instances(Klipper)
|
||||||
|
svc = BackupService()
|
||||||
|
|
||||||
if backup_config:
|
if backup_config:
|
||||||
version = ""
|
version = ""
|
||||||
@@ -49,7 +50,6 @@ def run_client_removal(
|
|||||||
with open(src.joinpath(".version"), "r") as v:
|
with open(src.joinpath(".version"), "r") as v:
|
||||||
version = v.readlines()[0]
|
version = v.readlines()[0]
|
||||||
|
|
||||||
svc = BackupService()
|
|
||||||
target_path = svc.backup_root.joinpath(f"{client.client_dir.name}_{version}")
|
target_path = svc.backup_root.joinpath(f"{client.client_dir.name}_{version}")
|
||||||
success = svc.backup_file(
|
success = svc.backup_file(
|
||||||
source_path=client.config_file,
|
source_path=client.config_file,
|
||||||
@@ -67,7 +67,7 @@ def run_client_removal(
|
|||||||
if remove_client_nginx_logs(client, kl_instances):
|
if remove_client_nginx_logs(client, kl_instances):
|
||||||
completion_msg.text.append("● NGINX logs removed")
|
completion_msg.text.append("● NGINX logs removed")
|
||||||
|
|
||||||
BackupService().backup_moonraker_conf()
|
svc.backup_moonraker_conf()
|
||||||
section = f"update_manager {client_name}"
|
section = f"update_manager {client_name}"
|
||||||
handled_instances: List[Moonraker] = remove_config_section(
|
handled_instances: List[Moonraker] = remove_config_section(
|
||||||
section, mr_instances
|
section, mr_instances
|
||||||
@@ -83,6 +83,7 @@ def run_client_removal(
|
|||||||
client.client_config,
|
client.client_config,
|
||||||
kl_instances,
|
kl_instances,
|
||||||
mr_instances,
|
mr_instances,
|
||||||
|
svc,
|
||||||
)
|
)
|
||||||
if cfg_completion_msg.color == Color.GREEN:
|
if cfg_completion_msg.color == Color.GREEN:
|
||||||
completion_msg.text.extend(cfg_completion_msg.text[1:])
|
completion_msg.text.extend(cfg_completion_msg.text[1:])
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -11,6 +11,7 @@ from __future__ import annotations
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
from json import JSONDecodeError
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import PIPE, CalledProcessError, run
|
from subprocess import PIPE, CalledProcessError, run
|
||||||
from typing import List, get_args
|
from typing import List, get_args
|
||||||
@@ -77,10 +78,10 @@ def get_current_client_config() -> str:
|
|||||||
installed = [c for c in clients if c.client_config.config_dir.exists()]
|
installed = [c for c in clients if c.client_config.config_dir.exists()]
|
||||||
|
|
||||||
if not installed:
|
if not installed:
|
||||||
return Color.apply("-", Color.CYAN)
|
return str(Color.apply("-", Color.CYAN))
|
||||||
elif len(installed) == 1:
|
elif len(installed) == 1:
|
||||||
cfg = installed[0].client_config
|
cfg = installed[0].client_config
|
||||||
return Color.apply(cfg.display_name, Color.CYAN)
|
return str(Color.apply(cfg.display_name, Color.CYAN))
|
||||||
|
|
||||||
# at this point, both client config folders exists, so we need to check
|
# at this point, both client config folders exists, so we need to check
|
||||||
# which are actually included in the printer.cfg of all klipper instances
|
# which are actually included in the printer.cfg of all klipper instances
|
||||||
@@ -99,18 +100,18 @@ def get_current_client_config() -> str:
|
|||||||
|
|
||||||
# if both are included in the same file, we have a potential conflict
|
# if both are included in the same file, we have a potential conflict
|
||||||
if includes_mainsail and includes_fluidd:
|
if includes_mainsail and includes_fluidd:
|
||||||
return Color.apply("Conflict", Color.YELLOW)
|
return str(Color.apply("Conflict", Color.YELLOW))
|
||||||
|
|
||||||
if not mainsail_includes and not fluidd_includes:
|
if not mainsail_includes and not fluidd_includes:
|
||||||
# there are no includes at all, even though the client config folders exist
|
# there are no includes at all, even though the client config folders exist
|
||||||
return Color.apply("-", Color.CYAN)
|
return str(Color.apply("-", Color.CYAN))
|
||||||
elif len(fluidd_includes) > len(mainsail_includes):
|
elif len(fluidd_includes) > len(mainsail_includes):
|
||||||
# there are more instances that include fluidd than mainsail
|
# there are more instances that include fluidd than mainsail
|
||||||
return Color.apply(fluidd.client_config.display_name, Color.CYAN)
|
return str(Color.apply(fluidd.client_config.display_name, Color.CYAN))
|
||||||
else:
|
else:
|
||||||
# there are the same amount of non-conflicting includes for each config
|
# there are the same amount of non-conflicting includes for each config
|
||||||
# or more instances include mainsail than fluidd
|
# or more instances include mainsail than fluidd
|
||||||
return Color.apply(mainsail.client_config.display_name, Color.CYAN)
|
return str(Color.apply(mainsail.client_config.display_name, Color.CYAN))
|
||||||
|
|
||||||
|
|
||||||
def enable_mainsail_remotemode() -> None:
|
def enable_mainsail_remotemode() -> None:
|
||||||
@@ -154,15 +155,32 @@ def get_local_client_version(client: BaseWebClient) -> str | None:
|
|||||||
|
|
||||||
if not client.client_dir.exists():
|
if not client.client_dir.exists():
|
||||||
return None
|
return None
|
||||||
if not relinfo_file.is_file() and not version_file.is_file():
|
|
||||||
return "n/a"
|
|
||||||
|
|
||||||
|
# try to get version from release_info.json first
|
||||||
if relinfo_file.is_file():
|
if relinfo_file.is_file():
|
||||||
with open(relinfo_file, "r") as f:
|
try:
|
||||||
return str(json.load(f)["version"])
|
if relinfo_file.stat().st_size == 0:
|
||||||
else:
|
raise JSONDecodeError("Empty file", "", 0)
|
||||||
|
with open(relinfo_file, "r", encoding="utf-8") as f:
|
||||||
|
data = json.load(f)
|
||||||
|
raw_version = data.get("version")
|
||||||
|
if raw_version is not None:
|
||||||
|
parsed = str(raw_version).strip()
|
||||||
|
if parsed:
|
||||||
|
return parsed
|
||||||
|
except (JSONDecodeError, OSError):
|
||||||
|
Logger.print_error("Invalid 'release_info.json'")
|
||||||
|
|
||||||
|
# fallback to .version file
|
||||||
|
if version_file.is_file():
|
||||||
|
try:
|
||||||
with open(version_file, "r") as f:
|
with open(version_file, "r") as f:
|
||||||
return f.readlines()[0]
|
line = f.readline().strip()
|
||||||
|
return line or None
|
||||||
|
except OSError:
|
||||||
|
Logger.print_error("Unable to read '.version'")
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_remote_client_version(client: BaseWebClient) -> str | None:
|
def get_remote_client_version(client: BaseWebClient) -> str | None:
|
||||||
@@ -427,9 +445,9 @@ def get_client_port_selection(
|
|||||||
while True:
|
while True:
|
||||||
_type = "Reconfigure" if reconfigure else "Configure"
|
_type = "Reconfigure" if reconfigure else "Configure"
|
||||||
question = f"{_type} {client.display_name} for port"
|
question = f"{_type} {client.display_name} for port"
|
||||||
port_input = get_number_input(question, min_value=80, default=port)
|
port_input: int | None = get_number_input(question, min_value=80, default=port)
|
||||||
|
|
||||||
if port_input not in ports_in_use:
|
if port_input and port_input not in ports_in_use:
|
||||||
client_settings: WebUiSettings = settings[client.name]
|
client_settings: WebUiSettings = settings[client.name]
|
||||||
client_settings.port = port_input
|
client_settings.port = port_input
|
||||||
settings.save()
|
settings.save()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -97,7 +97,7 @@ class ClientInstallMenu(BaseMenu):
|
|||||||
self.message_service.set_message(message)
|
self.message_service.set_message(message)
|
||||||
|
|
||||||
def _get_current_port(self) -> int:
|
def _get_current_port(self) -> int:
|
||||||
curr_port = get_nginx_listen_port(self.client.nginx_config)
|
curr_port: int | None = get_nginx_listen_port(self.client.nginx_config)
|
||||||
if curr_port is None:
|
if curr_port is None:
|
||||||
# if the port is not found in the config file we use
|
# if the port is not found in the config file we use
|
||||||
# the default port from the kiauh settings as fallback
|
# the default port from the kiauh settings as fallback
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -58,7 +58,7 @@ class BackupMenu(BaseMenu):
|
|||||||
|
|
||||||
def print_menu(self) -> None:
|
def print_menu(self) -> None:
|
||||||
line1 = Color.apply(
|
line1 = Color.apply(
|
||||||
"INFO: Backups are located in '~/kiauh-backups'", Color.YELLOW
|
"INFO: Backups are located in '~/kiauh_backups'", Color.YELLOW
|
||||||
)
|
)
|
||||||
menu = textwrap.dedent(
|
menu = textwrap.dedent(
|
||||||
f"""
|
f"""
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -95,8 +95,8 @@ class MainMenu(BaseMenu):
|
|||||||
status_data: ComponentStatus = status_fn(*args)
|
status_data: ComponentStatus = status_fn(*args)
|
||||||
code: int = status_data.status
|
code: int = status_data.status
|
||||||
status: StatusText = StatusMap[code]
|
status: StatusText = StatusMap[code]
|
||||||
owner: str = trunc_string(status_data.owner, 23)
|
owner: str = trunc_string(status_data.owner, 23) if status_data.owner else '-'
|
||||||
repo: str = trunc_string(status_data.repo, 23)
|
repo: str = trunc_string(status_data.repo, 23) if status_data.repo else '-'
|
||||||
instance_count: int = status_data.instances
|
instance_count: int = status_data.instances
|
||||||
|
|
||||||
count_txt: str = ""
|
count_txt: str = ""
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -100,11 +100,11 @@ class SettingsMenu(BaseMenu):
|
|||||||
def trim_repo_url(repo: str) -> str:
|
def trim_repo_url(repo: str) -> str:
|
||||||
return repo.replace(".git", "").replace("https://", "").replace("git@", "")
|
return repo.replace(".git", "").replace("https://", "").replace("git@", "")
|
||||||
|
|
||||||
if not klipper_status.repo == "-":
|
if klipper_status.repo:
|
||||||
url = trim_repo_url(klipper_status.repo_url)
|
url = trim_repo_url(klipper_status.repo_url)
|
||||||
self.kl_repo_url = Color.apply(url, Color.CYAN)
|
self.kl_repo_url = Color.apply(url, Color.CYAN)
|
||||||
self.kl_branch = Color.apply(klipper_status.branch, Color.CYAN)
|
self.kl_branch = Color.apply(klipper_status.branch, Color.CYAN)
|
||||||
if not moonraker_status.repo == "-":
|
if moonraker_status.repo:
|
||||||
url = trim_repo_url(moonraker_status.repo_url)
|
url = trim_repo_url(moonraker_status.repo_url)
|
||||||
self.mr_repo_url = Color.apply(url, Color.CYAN)
|
self.mr_repo_url = Color.apply(url, Color.CYAN)
|
||||||
self.mr_branch = Color.apply(moonraker_status.branch, Color.CYAN)
|
self.mr_branch = Color.apply(moonraker_status.branch, Color.CYAN)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -257,14 +257,14 @@ class UpdateMenu(BaseMenu):
|
|||||||
|
|
||||||
def _format_local_status(self, local_version, remote_version) -> str:
|
def _format_local_status(self, local_version, remote_version) -> str:
|
||||||
color = Color.RED
|
color = Color.RED
|
||||||
if not local_version:
|
if local_version is None:
|
||||||
color = Color.RED
|
color = Color.RED
|
||||||
elif local_version == remote_version:
|
elif local_version == remote_version:
|
||||||
color = Color.GREEN
|
color = Color.GREEN
|
||||||
elif local_version != remote_version:
|
elif local_version != remote_version:
|
||||||
color = Color.YELLOW
|
color = Color.YELLOW
|
||||||
|
|
||||||
return Color.apply(local_version or "-", color)
|
return str(Color.apply(local_version or '-', color))
|
||||||
|
|
||||||
def _set_status_data(self, name: str, status_fn: Callable, *args) -> None:
|
def _set_status_data(self, name: str, status_fn: Callable, *args) -> None:
|
||||||
comp_status: ComponentStatus = status_fn(*args)
|
comp_status: ComponentStatus = status_fn(*args)
|
||||||
@@ -290,7 +290,13 @@ class UpdateMenu(BaseMenu):
|
|||||||
return self.status_data[name]["installed"]
|
return self.status_data[name]["installed"]
|
||||||
|
|
||||||
def _is_update_available(self, name: str) -> bool:
|
def _is_update_available(self, name: str) -> bool:
|
||||||
return self.status_data[name]["local"] != self.status_data[name]["remote"]
|
local = self.status_data[name]["local"]
|
||||||
|
remote = self.status_data[name]["remote"]
|
||||||
|
|
||||||
|
if local is None or remote is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return local != remote
|
||||||
|
|
||||||
def _run_update_routine(self, name: str, update_fn: Callable, *args) -> None:
|
def _run_update_routine(self, name: str, update_fn: Callable, *args) -> None:
|
||||||
display_name = self.status_data[name]["display_name"]
|
display_name = self.status_data[name]["display_name"]
|
||||||
@@ -306,6 +312,27 @@ class UpdateMenu(BaseMenu):
|
|||||||
|
|
||||||
update_fn(*args)
|
update_fn(*args)
|
||||||
|
|
||||||
|
self._refresh_component_status(name)
|
||||||
|
|
||||||
|
def _refresh_component_status(self, name: str) -> None:
|
||||||
|
"""Refresh the status data for a component after an update."""
|
||||||
|
if name == "klipper":
|
||||||
|
self._set_status_data("klipper", get_klipper_status)
|
||||||
|
elif name == "moonraker":
|
||||||
|
self._set_status_data("moonraker", get_moonraker_status)
|
||||||
|
elif name == "mainsail":
|
||||||
|
self._set_status_data("mainsail", get_client_status, self.mainsail_data, True)
|
||||||
|
elif name == "mainsail_config":
|
||||||
|
self._set_status_data("mainsail_config", get_client_config_status, self.mainsail_data)
|
||||||
|
elif name == "fluidd":
|
||||||
|
self._set_status_data("fluidd", get_client_status, self.fluidd_data, True)
|
||||||
|
elif name == "fluidd_config":
|
||||||
|
self._set_status_data("fluidd_config", get_client_config_status, self.fluidd_data)
|
||||||
|
elif name == "klipperscreen":
|
||||||
|
self._set_status_data("klipperscreen", get_klipperscreen_status)
|
||||||
|
elif name == "crowsnest":
|
||||||
|
self._set_status_data("crowsnest", get_crowsnest_status)
|
||||||
|
|
||||||
def _run_system_updates(self) -> None:
|
def _run_system_updates(self) -> None:
|
||||||
if not self.packages:
|
if not self.packages:
|
||||||
Logger.print_info("No system upgrades available!")
|
Logger.print_info("No system upgrades available!")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -22,6 +22,7 @@ from utils.instance_utils import get_instances
|
|||||||
class BackupService:
|
class BackupService:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._backup_root = Path.home().joinpath("kiauh_backups")
|
self._backup_root = Path.home().joinpath("kiauh_backups")
|
||||||
|
self._timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def backup_root(self) -> Path:
|
def backup_root(self) -> Path:
|
||||||
@@ -29,7 +30,7 @@ class BackupService:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def timestamp(self) -> str:
|
def timestamp(self) -> str:
|
||||||
return datetime.now().strftime("%Y%m%d-%H%M%S")
|
return self._timestamp
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# GENERIC BACKUP METHODS
|
# GENERIC BACKUP METHODS
|
||||||
@@ -62,16 +63,21 @@ class BackupService:
|
|||||||
target_name
|
target_name
|
||||||
or f"{source_path.stem}_{self.timestamp}{source_path.suffix}"
|
or f"{source_path.stem}_{self.timestamp}{source_path.suffix}"
|
||||||
)
|
)
|
||||||
if target_path is not None:
|
|
||||||
backup_path = self._backup_root.joinpath(target_path, filename)
|
|
||||||
else:
|
|
||||||
backup_path = self._backup_root.joinpath(filename)
|
|
||||||
|
|
||||||
backup_path.mkdir(parents=True, exist_ok=True)
|
backup_dir = self._backup_root
|
||||||
shutil.copy2(source_path, backup_path)
|
if target_path is not None:
|
||||||
|
backup_dir = self._backup_root.joinpath(target_path)
|
||||||
|
|
||||||
|
backup_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
target_path = backup_dir.joinpath(filename)
|
||||||
|
if target_path.exists():
|
||||||
|
Logger.print_info(f"File '{target_path}' already exists. Skipping ...")
|
||||||
|
return True
|
||||||
|
|
||||||
|
shutil.copy2(source_path, target_path)
|
||||||
|
|
||||||
Logger.print_ok(
|
Logger.print_ok(
|
||||||
f"Successfully backed up '{source_path}' to '{backup_path}'"
|
f"Successfully backed up '{source_path}' to '{target_path}'"
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -109,7 +115,27 @@ class BackupService:
|
|||||||
else:
|
else:
|
||||||
backup_path = self._backup_root.joinpath(backup_dir_name)
|
backup_path = self._backup_root.joinpath(backup_dir_name)
|
||||||
|
|
||||||
shutil.copytree(source_path, backup_path)
|
if backup_path.exists():
|
||||||
|
Logger.print_info(f"Reusing existing backup directory '{backup_path}'")
|
||||||
|
for item in source_path.rglob("*"):
|
||||||
|
relative_path = item.relative_to(source_path)
|
||||||
|
target_item = backup_path.joinpath(relative_path)
|
||||||
|
if item.is_file():
|
||||||
|
if not target_item.exists():
|
||||||
|
target_item.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
shutil.copy2(item, target_item)
|
||||||
|
else:
|
||||||
|
Logger.print_info(f"File '{target_item}' already exists. Skipping...")
|
||||||
|
elif item.is_dir():
|
||||||
|
target_item.mkdir(parents=True, exist_ok=True)
|
||||||
|
else:
|
||||||
|
shutil.copytree(
|
||||||
|
source_path,
|
||||||
|
backup_path,
|
||||||
|
dirs_exist_ok=True,
|
||||||
|
symlinks=True,
|
||||||
|
ignore_dangling_symlinks=True,
|
||||||
|
)
|
||||||
|
|
||||||
Logger.print_ok(
|
Logger.print_ok(
|
||||||
f"Successfully backed up '{source_path}' to '{backup_path}'"
|
f"Successfully backed up '{source_path}' to '{backup_path}'"
|
||||||
@@ -125,27 +151,29 @@ class BackupService:
|
|||||||
################################################
|
################################################
|
||||||
|
|
||||||
def backup_printer_cfg(self):
|
def backup_printer_cfg(self):
|
||||||
|
"""Backup printer.cfg files of all Klipper instances.
|
||||||
|
Files are backed up to:
|
||||||
|
{backup_root}/{instance_data_dir_name}/printer_{timestamp}.cfg
|
||||||
|
"""
|
||||||
klipper_instances: List[Klipper] = get_instances(Klipper)
|
klipper_instances: List[Klipper] = get_instances(Klipper)
|
||||||
for instance in klipper_instances:
|
for instance in klipper_instances:
|
||||||
target_path: Path = self._backup_root.joinpath(
|
target_path: Path = self._backup_root.joinpath(instance.data_dir.name)
|
||||||
instance.data_dir.name, f"config_{self.timestamp}"
|
|
||||||
)
|
|
||||||
self.backup_file(
|
self.backup_file(
|
||||||
source_path=instance.cfg_file,
|
source_path=instance.cfg_file,
|
||||||
target_path=target_path,
|
target_path=target_path,
|
||||||
target_name=instance.cfg_file.name,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def backup_moonraker_conf(self):
|
def backup_moonraker_conf(self):
|
||||||
|
"""Backup moonraker.conf files of all Moonraker instances.
|
||||||
|
Files are backed up to:
|
||||||
|
{backup_root}/{instance_data_dir_name}/moonraker_{timestamp}.conf
|
||||||
|
"""
|
||||||
moonraker_instances: List[Moonraker] = get_instances(Moonraker)
|
moonraker_instances: List[Moonraker] = get_instances(Moonraker)
|
||||||
for instance in moonraker_instances:
|
for instance in moonraker_instances:
|
||||||
target_path: Path = self._backup_root.joinpath(
|
target_path: Path = self._backup_root.joinpath(instance.data_dir.name)
|
||||||
instance.data_dir.name, f"config_{self.timestamp}"
|
|
||||||
)
|
|
||||||
self.backup_file(
|
self.backup_file(
|
||||||
source_path=instance.cfg_file,
|
source_path=instance.cfg_file,
|
||||||
target_path=target_path,
|
target_path=target_path,
|
||||||
target_name=instance.cfg_file.name,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def backup_printer_config_dir(self) -> None:
|
def backup_printer_config_dir(self) -> None:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -254,32 +254,34 @@ class KiauhSettings:
|
|||||||
section: str,
|
section: str,
|
||||||
option: str,
|
option: str,
|
||||||
getter: Callable[[str, str, T | None], T],
|
getter: Callable[[str, str, T | None], T],
|
||||||
fallback: T = None,
|
fallback: T | None = None,
|
||||||
silent: bool = False,
|
silent: bool = False,
|
||||||
) -> T:
|
) -> T | None:
|
||||||
if not self.__check_option_exists(section, option, fallback, silent):
|
if not self.__check_option_exists(section, option, fallback, silent):
|
||||||
return fallback
|
return fallback
|
||||||
return getter(section, option, fallback)
|
return getter(section, option, fallback)
|
||||||
|
|
||||||
def __set_repo_state(self, section: str, repos: List[str]) -> List[Repository]:
|
def __set_repo_state(self, section: str, repos: List[str]) -> List[Repository]:
|
||||||
_repos: List[Repository] = []
|
_repos: List[Repository] = []
|
||||||
for repo in repos:
|
for raw in repos:
|
||||||
try:
|
line = raw.strip()
|
||||||
if repo.strip().startswith("#") or repo.strip().startswith(";"):
|
|
||||||
continue
|
|
||||||
if "," in repo:
|
|
||||||
url, branch = repo.strip().split(",")
|
|
||||||
|
|
||||||
if not branch:
|
if not line or line.startswith("#") or line.startswith(";"):
|
||||||
branch = "master"
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
|
if "," in line:
|
||||||
|
url_part, branch_part = line.split(",")
|
||||||
|
url = url_part.strip()
|
||||||
|
branch = branch_part.strip() or "master"
|
||||||
else:
|
else:
|
||||||
url = repo.strip()
|
url = line
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
|
||||||
# url must not be empty otherwise it's considered
|
# url must not be empty otherwise it's considered
|
||||||
# as an unrecoverable, invalid configuration
|
# as an unrecoverable, invalid configuration
|
||||||
if not url:
|
if not url:
|
||||||
raise InvalidValueError(section, "repositories", repo)
|
raise InvalidValueError(section, "repositories", line)
|
||||||
|
|
||||||
_repos.append(Repository(url.strip(), branch.strip()))
|
_repos.append(Repository(url.strip(), branch.strip()))
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import re
|
|||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Callable, Dict, List, Optional, Set, Union
|
from typing import Any, Callable, Dict, List, Set, Union
|
||||||
|
|
||||||
# definition of section line:
|
# definition of section line:
|
||||||
# - the line MUST start with an opening square bracket - it is the first section marker
|
# - the line MUST start with an opening square bracket - it is the first section marker
|
||||||
@@ -91,6 +91,9 @@ class LineType(Enum):
|
|||||||
BLANK = "blank"
|
BLANK = "blank"
|
||||||
|
|
||||||
|
|
||||||
|
_UNSET = object()
|
||||||
|
|
||||||
|
|
||||||
class NoSectionError(Exception):
|
class NoSectionError(Exception):
|
||||||
"""Raised when a section is not defined"""
|
"""Raised when a section is not defined"""
|
||||||
|
|
||||||
@@ -342,7 +345,7 @@ class SimpleConfigParser:
|
|||||||
for line in file:
|
for line in file:
|
||||||
self._parse_line(line)
|
self._parse_line(line)
|
||||||
|
|
||||||
def write_file(self, path: Union[str, Path]) -> None:
|
def write_file(self, path: str | Path) -> None:
|
||||||
"""Write the config to a file"""
|
"""Write the config to a file"""
|
||||||
if path is None:
|
if path is None:
|
||||||
raise ValueError("File path cannot be None")
|
raise ValueError("File path cannot be None")
|
||||||
@@ -418,9 +421,7 @@ class SimpleConfigParser:
|
|||||||
"""Check if an option exists in a section"""
|
"""Check if an option exists in a section"""
|
||||||
return self.has_section(section) and option in self.get_options(section)
|
return self.has_section(section) and option in self.get_options(section)
|
||||||
|
|
||||||
def set_option(
|
def set_option(self, section: str, option: str, value: str | List[str]) -> None:
|
||||||
self, section: str, option: str, value: Union[str, List[str]]
|
|
||||||
) -> None:
|
|
||||||
"""
|
"""
|
||||||
Set the value of an option in a section. If the section does not exist,
|
Set the value of an option in a section. If the section does not exist,
|
||||||
it is created. If the option does not exist, it is created.
|
it is created. If the option does not exist, it is created.
|
||||||
@@ -467,8 +468,8 @@ class SimpleConfigParser:
|
|||||||
elif opt and isinstance(opt, Option) and isinstance(value, str):
|
elif opt and isinstance(opt, Option) and isinstance(value, str):
|
||||||
curr_val = opt.value
|
curr_val = opt.value
|
||||||
new_val = value
|
new_val = value
|
||||||
opt.value = value
|
opt.value = new_val
|
||||||
opt.raw.replace(curr_val, new_val)
|
opt.raw = opt.raw.replace(curr_val, new_val)
|
||||||
|
|
||||||
elif opt and isinstance(opt, MultiLineOption) and isinstance(value, list):
|
elif opt and isinstance(opt, MultiLineOption) and isinstance(value, list):
|
||||||
# note: we completely replace the existing values
|
# note: we completely replace the existing values
|
||||||
@@ -561,7 +562,7 @@ class SimpleConfigParser:
|
|||||||
else self._find_option_by_name(option, section=sects[0])
|
else self._find_option_by_name(option, section=sects[0])
|
||||||
)
|
)
|
||||||
|
|
||||||
def getval(self, section: str, option: str, fallback: Optional[str] = None) -> str:
|
def getval(self, section: str, option: str, fallback: str | _UNSET = _UNSET) -> str:
|
||||||
"""
|
"""
|
||||||
Return the value of the given option in the given section
|
Return the value of the given option in the given section
|
||||||
|
|
||||||
@@ -576,12 +577,12 @@ class SimpleConfigParser:
|
|||||||
return opt.value if opt else ""
|
return opt.value if opt else ""
|
||||||
|
|
||||||
except (NoSectionError, NoOptionError):
|
except (NoSectionError, NoOptionError):
|
||||||
if fallback is None:
|
if fallback is _UNSET:
|
||||||
raise
|
raise
|
||||||
return fallback
|
return fallback
|
||||||
|
|
||||||
def getvals(
|
def getvals(
|
||||||
self, section: str, option: str, fallback: Optional[List[str]] = None
|
self, section: str, option: str, fallback: List[str] | _UNSET = _UNSET
|
||||||
) -> List[str]:
|
) -> List[str]:
|
||||||
"""
|
"""
|
||||||
Return the values of the given multi-line option in the given section
|
Return the values of the given multi-line option in the given section
|
||||||
@@ -597,22 +598,22 @@ class SimpleConfigParser:
|
|||||||
return [v.value for v in opt.values] if opt else []
|
return [v.value for v in opt.values] if opt else []
|
||||||
|
|
||||||
except (NoSectionError, NoOptionError):
|
except (NoSectionError, NoOptionError):
|
||||||
if fallback is None:
|
if fallback is _UNSET:
|
||||||
raise
|
raise
|
||||||
return fallback
|
return fallback
|
||||||
|
|
||||||
def getint(self, section: str, option: str, fallback: Optional[int] = None) -> int:
|
def getint(self, section: str, option: str, fallback: int | _UNSET = _UNSET) -> int:
|
||||||
"""Return the value of the given option in the given section as an int"""
|
"""Return the value of the given option in the given section as an int"""
|
||||||
return self._get_conv(section, option, int, fallback=fallback)
|
return self._get_conv(section, option, int, fallback=fallback)
|
||||||
|
|
||||||
def getfloat(
|
def getfloat(
|
||||||
self, section: str, option: str, fallback: Optional[float] = None
|
self, section: str, option: str, fallback: float | _UNSET = _UNSET
|
||||||
) -> float:
|
) -> float:
|
||||||
"""Return the value of the given option in the given section as a float"""
|
"""Return the value of the given option in the given section as a float"""
|
||||||
return self._get_conv(section, option, float, fallback=fallback)
|
return self._get_conv(section, option, float, fallback=fallback)
|
||||||
|
|
||||||
def getboolean(
|
def getboolean(
|
||||||
self, section: str, option: str, fallback: Optional[bool] = None
|
self, section: str, option: str, fallback: bool | _UNSET = _UNSET
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Return the value of the given option in the given section as a boolean"""
|
"""Return the value of the given option in the given section as a boolean"""
|
||||||
return self._get_conv(
|
return self._get_conv(
|
||||||
@@ -631,14 +632,14 @@ class SimpleConfigParser:
|
|||||||
self,
|
self,
|
||||||
section: str,
|
section: str,
|
||||||
option: str,
|
option: str,
|
||||||
conv: Callable[[str], Union[int, float, bool]],
|
conv: Callable[[str], int | float | bool],
|
||||||
fallback: Optional[Any] = None,
|
fallback: Any = _UNSET,
|
||||||
) -> Union[int, float, bool]:
|
) -> int | float | bool:
|
||||||
"""Return the value of the given option in the given section as a converted value"""
|
"""Return the value of the given option in the given section as a converted value"""
|
||||||
try:
|
try:
|
||||||
return conv(self.getval(section, option, fallback))
|
return conv(self.getval(section, option, fallback))
|
||||||
except (ValueError, TypeError, AttributeError) as e:
|
except (ValueError, TypeError, AttributeError) as e:
|
||||||
if fallback is not None:
|
if fallback is not _UNSET:
|
||||||
return fallback
|
return fallback
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Cannot convert {self.getval(section, option)} to {conv.__name__}"
|
f"Cannot convert {self.getval(section, option)} to {conv.__name__}"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -26,7 +26,7 @@ class ComponentStatus:
|
|||||||
owner: str | None = None
|
owner: str | None = None
|
||||||
repo: str | None = None
|
repo: str | None = None
|
||||||
repo_url: str | None = None
|
repo_url: str | None = None
|
||||||
branch: str = ""
|
branch: str | None = None
|
||||||
local: str | None = None
|
local: str | None = None
|
||||||
remote: str | None = None
|
remote: str | None = None
|
||||||
instances: int | None = None
|
instances: int | None = None
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class ShellCommand:
|
|||||||
self.gcode = self.printer.lookup_object("gcode")
|
self.gcode = self.printer.lookup_object("gcode")
|
||||||
cmd = config.get("command")
|
cmd = config.get("command")
|
||||||
cmd = os.path.expanduser(cmd)
|
cmd = os.path.expanduser(cmd)
|
||||||
|
cmd = os.path.expandvars(cmd)
|
||||||
self.command = shlex.split(cmd)
|
self.command = shlex.split(cmd)
|
||||||
self.timeout = config.getfloat("timeout", 2.0, above=0.0)
|
self.timeout = config.getfloat("timeout", 2.0, above=0.0)
|
||||||
self.verbose = config.getboolean("verbose", True)
|
self.verbose = config.getboolean("verbose", True)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -97,7 +97,7 @@ class GcodeShellCmdExtension(BaseExtension):
|
|||||||
|
|
||||||
def install_example_cfg(self, instances: List[Klipper]):
|
def install_example_cfg(self, instances: List[Klipper]):
|
||||||
cfg_dirs = [instance.base.cfg_dir for instance in instances]
|
cfg_dirs = [instance.base.cfg_dir for instance in instances]
|
||||||
# copy extension to klippy/extras
|
# copy extension to config directories
|
||||||
for cfg_dir in cfg_dirs:
|
for cfg_dir in cfg_dirs:
|
||||||
Logger.print_status(f"Create shell_command.cfg in '{cfg_dir}' ...")
|
Logger.print_status(f"Create shell_command.cfg in '{cfg_dir}' ...")
|
||||||
if check_file_exist(cfg_dir.joinpath("shell_command.cfg")):
|
if check_file_exist(cfg_dir.joinpath("shell_command.cfg")):
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2023 - 2024 Staubgeborener and Tylerjet #
|
# Copyright (C) 2023 - 2026 Staubgeborener and Tylerjet #
|
||||||
# https://github.com/Staubgeborener/klipper-backup #
|
# https://github.com/Staubgeborener/klipper-backup #
|
||||||
# https://klipperbackup.xyz #
|
# https://klipperbackup.xyz #
|
||||||
# #
|
# #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2023 - 2024 Staubgeborener and Tylerjet #
|
# Copyright (C) 2023 - 2026 Staubgeborener and Tylerjet #
|
||||||
# https://github.com/Staubgeborener/klipper-backup #
|
# https://github.com/Staubgeborener/klipper-backup #
|
||||||
# https://klipperbackup.xyz #
|
# https://klipperbackup.xyz #
|
||||||
# #
|
# #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
from pathlib import Path
|
||||||
from subprocess import CalledProcessError, run
|
from subprocess import CalledProcessError, run
|
||||||
from typing import List, Tuple
|
from typing import List, Tuple
|
||||||
|
|
||||||
@@ -311,13 +312,19 @@ class SpoolmanExtension(BaseExtension):
|
|||||||
mrsvc.load_instances()
|
mrsvc.load_instances()
|
||||||
mr_instances = mrsvc.get_all_instances()
|
mr_instances = mrsvc.get_all_instances()
|
||||||
for instance in mr_instances:
|
for instance in mr_instances:
|
||||||
asvc_path = instance.data_dir.joinpath("moonraker.asvc")
|
asvc_path: Path = instance.data_dir.joinpath("moonraker.asvc")
|
||||||
if asvc_path.exists():
|
if asvc_path.exists() and asvc_path.is_file():
|
||||||
if "Spoolman" in open(asvc_path).read():
|
with open(asvc_path, "a+") as f:
|
||||||
Logger.print_info(f"Spoolman already in {asvc_path}. Skipping...")
|
if "Spoolman" in f.read():
|
||||||
|
Logger.print_info(
|
||||||
|
f"Spoolman already in {asvc_path}. Skipping..."
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
with open(asvc_path, "a") as f:
|
content: List[str] = f.readlines()
|
||||||
|
if content and not content[-1].endswith("\n"):
|
||||||
|
f.write("\n")
|
||||||
|
|
||||||
f.write("Spoolman\n")
|
f.write("Spoolman\n")
|
||||||
|
|
||||||
Logger.print_ok(f"Spoolman added to {asvc_path}!")
|
Logger.print_ok(f"Spoolman added to {asvc_path}!")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user