Application PySide6 (GUI + CLI) fonctionnant sous Linux et Windows : - Diagnostic réseau complet AD (DNS, SRV, ports, NTP, outils requis) - Jointure de domaine via realmd (Linux) ou Add-Computer (Windows) - Installation automatique des prérequis Linux (apt) - CLI colorée (diagnose/join/install-prereqs), sans dépendance PySide6 - Scripts de packaging PyInstaller pour Linux et Windows Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
73 lines
2.0 KiB
Python
73 lines
2.0 KiB
Python
"""Workers Qt exécutant diagnostics et jointure de domaine en arrière-plan,
|
|
pour ne jamais bloquer l'interface graphique."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
|
|
from PySide6.QtCore import QThread, Signal
|
|
|
|
from . import diagnostics
|
|
from .backend.base import DomainJoinBackend, JoinResult
|
|
|
|
|
|
class DiagnosticsWorker(QThread):
|
|
check_ready = Signal(object) # diagnostics.CheckResult
|
|
finished_all = Signal()
|
|
|
|
def __init__(self, domain: str, parent=None):
|
|
super().__init__(parent)
|
|
self.domain = domain
|
|
|
|
def run(self) -> None:
|
|
for result in diagnostics.run_diagnostics(self.domain):
|
|
self.check_ready.emit(result)
|
|
self.finished_all.emit()
|
|
|
|
|
|
class JoinWorker(QThread):
|
|
output_line = Signal(str)
|
|
finished_join = Signal(object) # backend.base.JoinResult
|
|
|
|
def __init__(
|
|
self,
|
|
backend: DomainJoinBackend,
|
|
domain: str,
|
|
username: str,
|
|
password: str,
|
|
ou: Optional[str],
|
|
computer_name: Optional[str],
|
|
parent=None,
|
|
):
|
|
super().__init__(parent)
|
|
self.backend = backend
|
|
self.domain = domain
|
|
self.username = username
|
|
self.password = password
|
|
self.ou = ou
|
|
self.computer_name = computer_name
|
|
|
|
def run(self) -> None:
|
|
result: JoinResult = self.backend.join(
|
|
self.domain,
|
|
self.username,
|
|
self.password,
|
|
ou=self.ou,
|
|
computer_name=self.computer_name,
|
|
on_output=self.output_line.emit,
|
|
)
|
|
self.finished_join.emit(result)
|
|
|
|
|
|
class InstallPrerequisitesWorker(QThread):
|
|
output_line = Signal(str)
|
|
finished_install = Signal(object) # backend.base.JoinResult
|
|
|
|
def __init__(self, backend: DomainJoinBackend, parent=None):
|
|
super().__init__(parent)
|
|
self.backend = backend
|
|
|
|
def run(self) -> None:
|
|
result: JoinResult = self.backend.install_prerequisites(on_output=self.output_line.emit)
|
|
self.finished_install.emit(result)
|