mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-25 08:43:36 +05:00
Compare commits
2 Commits
8317ee9d8a
...
v6.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8f713c00e | ||
|
|
95cf809378 |
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"CurrentProjectSetting": null
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"ExpandedNodes": [
|
|
||||||
"",
|
|
||||||
"\\kiauh",
|
|
||||||
"\\kiauh\\components\\droidklipp",
|
|
||||||
"\\kiauh\\core",
|
|
||||||
"\\kiauh\\core\\menus"
|
|
||||||
],
|
|
||||||
"SelectedNode": "\\kiauh\\core\\menus\\main_menu.py",
|
|
||||||
"PreviewInSolutionExplorer": false
|
|
||||||
}
|
|
||||||
Binary file not shown.
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
Binary file not shown.
@@ -71,14 +71,14 @@ sudo apt-get update && sudo apt-get install git -y
|
|||||||
Once git is installed, use the following command to download KIAUH into your home-directory:
|
Once git is installed, use the following command to download KIAUH into your home-directory:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cd ~ && git clone https://github.com/CodeMasterCody3D/kiauhPlusDroidKlipp.git
|
cd ~ && git clone https://github.com/dw-0/kiauh.git
|
||||||
```
|
```
|
||||||
|
|
||||||
* **Step 3:** \
|
* **Step 3:** \
|
||||||
Finally, start KIAUH by running the next command:
|
Finally, start KIAUH by running the next command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
./kiauhPlusDroidKlipp/kiauh.sh
|
./kiauh/kiauh.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
* **Step 4:** \
|
* **Step 4:** \
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ repositories:
|
|||||||
https://github.com/Klipper3d/klipper
|
https://github.com/Klipper3d/klipper
|
||||||
|
|
||||||
[moonraker]
|
[moonraker]
|
||||||
|
# Moonraker supports two optional Python packages that can be used to reduce its CPU load
|
||||||
|
# If set to true, those packages will be installed during the Moonraker installation
|
||||||
|
optional_speedups: True
|
||||||
|
|
||||||
# add custom repositories here, if at least one is given, the first in the list will be used by default
|
# add custom repositories here, if at least one is given, the first in the list will be used by default
|
||||||
# otherwise the official repository is used
|
# otherwise the official repository is used
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
import os
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
def install_droidklipp():
|
|
||||||
try:
|
|
||||||
print("Are you sure you want to install DroidKlipp? (Y/N)")
|
|
||||||
user_confirmation = input().strip().lower()
|
|
||||||
|
|
||||||
if user_confirmation != 'y':
|
|
||||||
print("DroidKlipp installation aborted.")
|
|
||||||
return
|
|
||||||
|
|
||||||
print("Installing DroidKlipp...")
|
|
||||||
subprocess.run(['sudo', 'apt', 'install', '-y', 'adb', 'tmux'], check=True)
|
|
||||||
|
|
||||||
# Define the DroidKlipp repository URL and directory
|
|
||||||
droidklipp_repo_url = "https://github.com/CodeMasterCody3D/DroidKlipp.git"
|
|
||||||
droidklipp_dir = os.path.expanduser('~/DroidKlipp')
|
|
||||||
|
|
||||||
# Check if DroidKlipp directory exists, if not create it
|
|
||||||
if not os.path.isdir(droidklipp_dir):
|
|
||||||
print("DroidKlipp folder not found, creating directory...")
|
|
||||||
os.makedirs(droidklipp_dir)
|
|
||||||
|
|
||||||
# Clone the repository if not already cloned
|
|
||||||
if not os.path.isdir(os.path.join(droidklipp_dir, '.git')):
|
|
||||||
print("Cloning the DroidKlipp repository...")
|
|
||||||
subprocess.run(['git', 'clone', droidklipp_repo_url, droidklipp_dir], check=True)
|
|
||||||
else:
|
|
||||||
print("DroidKlipp repository already exists.")
|
|
||||||
|
|
||||||
# Change to the DroidKlipp directory
|
|
||||||
os.chdir(droidklipp_dir)
|
|
||||||
|
|
||||||
# Set executable permissions for the installation script
|
|
||||||
subprocess.run(['sudo', 'chmod', '+x', 'droidklipp.sh'], check=True)
|
|
||||||
|
|
||||||
# Run the installation script
|
|
||||||
subprocess.run(['./droidklipp.sh'], check=True)
|
|
||||||
|
|
||||||
print("DroidKlipp installation complete!")
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
print(f"Error during installation: {e}")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Unexpected error: {e}")
|
|
||||||
|
|
||||||
# Ensure you call this with proper confirmation before installation
|
|
||||||
@@ -277,7 +277,7 @@ class KlipperSetupService:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
install_klipper_packages()
|
install_klipper_packages()
|
||||||
if create_python_venv(KLIPPER_ENV_DIR):
|
if create_python_venv(KLIPPER_ENV_DIR, False, False, self.settings.klipper.use_python_binary):
|
||||||
install_python_requirements(KLIPPER_ENV_DIR, KLIPPER_REQ_FILE)
|
install_python_requirements(KLIPPER_ENV_DIR, KLIPPER_REQ_FILE)
|
||||||
except Exception:
|
except Exception:
|
||||||
Logger.print_error("Error during installation of Klipper requirements!")
|
Logger.print_error("Error during installation of Klipper requirements!")
|
||||||
|
|||||||
@@ -315,11 +315,12 @@ class MoonrakerSetupService:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
install_moonraker_packages()
|
install_moonraker_packages()
|
||||||
if create_python_venv(MOONRAKER_ENV_DIR):
|
if create_python_venv(MOONRAKER_ENV_DIR, False, False, self.settings.moonraker.use_python_binary):
|
||||||
install_python_requirements(MOONRAKER_ENV_DIR, MOONRAKER_REQ_FILE)
|
install_python_requirements(MOONRAKER_ENV_DIR, MOONRAKER_REQ_FILE)
|
||||||
install_python_requirements(
|
if self.settings.moonraker.optional_speedups:
|
||||||
MOONRAKER_ENV_DIR, MOONRAKER_SPEEDUPS_REQ_FILE
|
install_python_requirements(
|
||||||
)
|
MOONRAKER_ENV_DIR, MOONRAKER_SPEEDUPS_REQ_FILE
|
||||||
|
)
|
||||||
self.__install_polkit()
|
self.__install_polkit()
|
||||||
except Exception:
|
except Exception:
|
||||||
Logger.print_error("Error during installation of Moonraker requirements!")
|
Logger.print_error("Error during installation of Moonraker requirements!")
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ from __future__ import annotations
|
|||||||
import textwrap
|
import textwrap
|
||||||
from typing import Type
|
from typing import Type
|
||||||
|
|
||||||
from components.droidklipp.droidklipp import install_droidklipp
|
|
||||||
from components.crowsnest.crowsnest import install_crowsnest
|
from components.crowsnest.crowsnest import install_crowsnest
|
||||||
from components.klipper.services.klipper_setup_service import KlipperSetupService
|
from components.klipper.services.klipper_setup_service import KlipperSetupService
|
||||||
from components.klipperscreen.klipperscreen import install_klipperscreen
|
from components.klipperscreen.klipperscreen import install_klipperscreen
|
||||||
@@ -42,6 +41,7 @@ class InstallMenu(BaseMenu):
|
|||||||
|
|
||||||
def set_previous_menu(self, previous_menu: Type[BaseMenu] | None) -> None:
|
def set_previous_menu(self, previous_menu: Type[BaseMenu] | None) -> None:
|
||||||
from core.menus.main_menu import MainMenu
|
from core.menus.main_menu import MainMenu
|
||||||
|
|
||||||
self.previous_menu = previous_menu if previous_menu is not None else MainMenu
|
self.previous_menu = previous_menu if previous_menu is not None else MainMenu
|
||||||
|
|
||||||
def set_options(self) -> None:
|
def set_options(self) -> None:
|
||||||
@@ -53,9 +53,7 @@ class InstallMenu(BaseMenu):
|
|||||||
"5": Option(method=self.install_mainsail_config),
|
"5": Option(method=self.install_mainsail_config),
|
||||||
"6": Option(method=self.install_fluidd_config),
|
"6": Option(method=self.install_fluidd_config),
|
||||||
"7": Option(method=self.install_klipperscreen),
|
"7": Option(method=self.install_klipperscreen),
|
||||||
"8": Option(method=self.install_droidklipp), # Add DroidKlipp option
|
"8": Option(method=self.install_crowsnest),
|
||||||
"9": Option(method=self.install_crowsnest),
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def print_menu(self) -> None:
|
def print_menu(self) -> None:
|
||||||
@@ -64,17 +62,15 @@ class InstallMenu(BaseMenu):
|
|||||||
╟───────────────────────────┬───────────────────────────╢
|
╟───────────────────────────┬───────────────────────────╢
|
||||||
║ Firmware & API: │ Touchscreen GUI: ║
|
║ Firmware & API: │ Touchscreen GUI: ║
|
||||||
║ 1) [Klipper] │ 7) [KlipperScreen] ║
|
║ 1) [Klipper] │ 7) [KlipperScreen] ║
|
||||||
║ 2) [Moonraker] │ 8) [DroidKlipp] ║
|
║ 2) [Moonraker] │ ║
|
||||||
║ │ ║
|
|
||||||
║ │ Webcam Streamer: ║
|
║ │ Webcam Streamer: ║
|
||||||
║ Webinterface: │ 9) [Crowsnest] ║
|
║ Webinterface: │ 8) [Crowsnest] ║
|
||||||
║ 3) [Mainsail] │ ║
|
║ 3) [Mainsail] │ ║
|
||||||
║ 4) [Fluidd] │ ║
|
║ 4) [Fluidd] │ ║
|
||||||
║ │ ║
|
║ │ ║
|
||||||
║ Client-Config: │ ║
|
║ Client-Config: │ ║
|
||||||
║ 5) [Mainsail-Config] │ ║
|
║ 5) [Mainsail-Config] │ ║
|
||||||
║ 6) [Fluidd-Config] │ ║
|
║ 6) [Fluidd-Config] │ ║
|
||||||
║ │ ║
|
|
||||||
╟───────────────────────────┴───────────────────────────╢
|
╟───────────────────────────┴───────────────────────────╢
|
||||||
"""
|
"""
|
||||||
)[1:]
|
)[1:]
|
||||||
@@ -111,6 +107,3 @@ class InstallMenu(BaseMenu):
|
|||||||
|
|
||||||
def install_crowsnest(self, **kwargs) -> None:
|
def install_crowsnest(self, **kwargs) -> None:
|
||||||
install_crowsnest()
|
install_crowsnest()
|
||||||
|
|
||||||
def install_droidklipp(self, **kwargs) -> None:
|
|
||||||
install_droidklipp()
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import sys
|
|||||||
import textwrap
|
import textwrap
|
||||||
from typing import Callable, Type
|
from typing import Callable, Type
|
||||||
|
|
||||||
from components.droidklipp.droidklipp import install_droidklipp
|
|
||||||
from components.crowsnest.crowsnest import get_crowsnest_status
|
from components.crowsnest.crowsnest import get_crowsnest_status
|
||||||
from components.klipper.klipper_utils import get_klipper_status
|
from components.klipper.klipper_utils import get_klipper_status
|
||||||
from components.klipperscreen.klipperscreen import get_klipperscreen_status
|
from components.klipperscreen.klipperscreen import get_klipperscreen_status
|
||||||
|
|||||||
@@ -55,8 +55,16 @@ class Repository:
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class RepoSettings:
|
class KlipperSettings:
|
||||||
repositories: List[Repository] | None = field(default=None)
|
repositories: List[Repository] | None = field(default=None)
|
||||||
|
use_python_binary: str | None = field(default=None)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class MoonrakerSettings:
|
||||||
|
optional_speedups: bool | None = field(default=None)
|
||||||
|
repositories: List[Repository] | None = field(default=None)
|
||||||
|
use_python_binary: str | None = field(default=None)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -93,8 +101,8 @@ class KiauhSettings:
|
|||||||
self.__initialized = True
|
self.__initialized = True
|
||||||
self.config = SimpleConfigParser()
|
self.config = SimpleConfigParser()
|
||||||
self.kiauh = AppSettings()
|
self.kiauh = AppSettings()
|
||||||
self.klipper = RepoSettings()
|
self.klipper = KlipperSettings()
|
||||||
self.moonraker = RepoSettings()
|
self.moonraker = MoonrakerSettings()
|
||||||
self.mainsail = WebUiSettings()
|
self.mainsail = WebUiSettings()
|
||||||
self.fluidd = WebUiSettings()
|
self.fluidd = WebUiSettings()
|
||||||
|
|
||||||
@@ -208,12 +216,23 @@ class KiauhSettings:
|
|||||||
"kiauh", "backup_before_update"
|
"kiauh", "backup_before_update"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.moonraker.optional_speedups = self.config.getboolean(
|
||||||
|
"moonraker", "optional_speedups", True
|
||||||
|
)
|
||||||
|
|
||||||
kl_repos = self.config.getval("klipper", "repositories")
|
kl_repos = self.config.getval("klipper", "repositories")
|
||||||
self.klipper.repositories = self.__set_repo_state(kl_repos)
|
self.klipper.repositories = self.__set_repo_state(kl_repos)
|
||||||
|
|
||||||
mr_repos = self.config.getval("moonraker", "repositories")
|
mr_repos = self.config.getval("moonraker", "repositories")
|
||||||
self.moonraker.repositories = self.__set_repo_state(mr_repos)
|
self.moonraker.repositories = self.__set_repo_state(mr_repos)
|
||||||
|
|
||||||
|
self.klipper.use_python_binary = self.config.getval(
|
||||||
|
"klipper", "use_python_binary", None
|
||||||
|
)
|
||||||
|
self.moonraker.use_python_binary = self.config.getval(
|
||||||
|
"moonraker", "use_python_binary", None
|
||||||
|
)
|
||||||
|
|
||||||
self.mainsail.port = self.config.getint("mainsail", "port")
|
self.mainsail.port = self.config.getint("mainsail", "port")
|
||||||
self.mainsail.unstable_releases = self.config.getboolean(
|
self.mainsail.unstable_releases = self.config.getboolean(
|
||||||
"mainsail", "unstable_releases"
|
"mainsail", "unstable_releases"
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from components.droidklipp.droidklipp import install_droidklipp
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ def create_python_venv(
|
|||||||
target: Path,
|
target: Path,
|
||||||
force: bool = False,
|
force: bool = False,
|
||||||
allow_access_to_system_site_packages: bool = False,
|
allow_access_to_system_site_packages: bool = False,
|
||||||
|
use_python_binary: str | None = None
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""
|
"""
|
||||||
Create a python 3 virtualenv at the provided target destination.
|
Create a python 3 virtualenv at the provided target destination.
|
||||||
@@ -103,36 +104,46 @@ def create_python_venv(
|
|||||||
:param target: Path where to create the virtualenv at
|
:param target: Path where to create the virtualenv at
|
||||||
:param force: Force recreation of the virtualenv
|
:param force: Force recreation of the virtualenv
|
||||||
:param allow_access_to_system_site_packages: give the virtual environment access to the system site-packages dir
|
:param allow_access_to_system_site_packages: give the virtual environment access to the system site-packages dir
|
||||||
|
:param use_python_binary: allows to override default python binary
|
||||||
:return: bool
|
:return: bool
|
||||||
"""
|
"""
|
||||||
Logger.print_status("Set up Python virtual environment ...")
|
Logger.print_status("Set up Python virtual environment ...")
|
||||||
cmd = ["virtualenv", "-p", "/usr/bin/python3", target.as_posix()]
|
# If binarry override is not set, we use default defined here
|
||||||
|
python_binary = use_python_binary if use_python_binary else "/usr/bin/python3"
|
||||||
|
cmd = ["virtualenv", "-p", python_binary, target.as_posix()]
|
||||||
cmd.append(
|
cmd.append(
|
||||||
"--system-site-packages"
|
"--system-site-packages"
|
||||||
) if allow_access_to_system_site_packages else None
|
) if allow_access_to_system_site_packages else None
|
||||||
if not target.exists():
|
|
||||||
try:
|
|
||||||
run(cmd, check=True)
|
|
||||||
Logger.print_ok("Setup of virtualenv successful!")
|
|
||||||
return True
|
|
||||||
except CalledProcessError as e:
|
|
||||||
Logger.print_error(f"Error setting up virtualenv:\n{e}")
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
if not force and not get_confirm(
|
|
||||||
"Virtualenv already exists. Re-create?", default_choice=False
|
|
||||||
):
|
|
||||||
Logger.print_info("Skipping re-creation of virtualenv ...")
|
|
||||||
return False
|
|
||||||
|
|
||||||
try:
|
n = 2
|
||||||
shutil.rmtree(target)
|
while(n > 0):
|
||||||
create_python_venv(target)
|
if not target.exists():
|
||||||
return True
|
try:
|
||||||
except OSError as e:
|
run(cmd, check=True)
|
||||||
log = f"Error removing existing virtualenv: {e.strerror}"
|
Logger.print_ok("Setup of virtualenv successful!")
|
||||||
Logger.print_error(log, False)
|
return True
|
||||||
return False
|
except CalledProcessError as e:
|
||||||
|
Logger.print_error(f"Error setting up virtualenv:\n{e}")
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if n == 1:
|
||||||
|
# This case should never happen,
|
||||||
|
# but the function should still behave correctly
|
||||||
|
Logger.print_error("Virtualenv still exists after deletion.")
|
||||||
|
return False
|
||||||
|
if not force and not get_confirm(
|
||||||
|
"Virtualenv already exists. Re-create?", default_choice=False
|
||||||
|
):
|
||||||
|
Logger.print_info("Skipping re-creation of virtualenv ...")
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
shutil.rmtree(target)
|
||||||
|
n -= 1
|
||||||
|
except OSError as e:
|
||||||
|
log = f"Error removing existing virtualenv: {e.strerror}"
|
||||||
|
Logger.print_error(log, False)
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def update_python_pip(target: Path) -> None:
|
def update_python_pip(target: Path) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user