🎉 Improved Blueprints for Kiosk Mode & Production Readiness 🖱️

This commit is contained in:
Till Tomczak
2025-06-20 09:19:15 +02:00
parent 0360d8c386
commit 268a270f1c
5 changed files with 34 additions and 24 deletions

View File

@ -202,6 +202,7 @@ class SafeFileHandler:
def _move_to_trash_windows(self, file_path: Path) -> bool:
"""Windows-spezifische Papierkorb-Implementation"""
try:
from utils.core_system import safe_subprocess_run
cmd = [
'powershell', '-Command',
f'Add-Type -AssemblyName Microsoft.VisualBasic; '
@ -209,13 +210,14 @@ class SafeFileHandler:
f'"OnlyErrorDialogs", "SendToRecycleBin")'
]
result = subprocess.run(cmd, capture_output=True, text=True)
result = safe_subprocess_run(cmd, capture_output=True, timeout=30)
if result.returncode == 0:
if result and result.returncode == 0:
data_logger.info(f"Datei erfolgreich in Papierkorb verschoben: {file_path}")
return True
else:
data_logger.error(f"PowerShell-Fehler: {result.stderr}")
error_msg = result.stderr if result else "Unbekannter Fehler"
data_logger.error(f"PowerShell-Fehler: {error_msg}")
return False
except Exception as e:
@ -225,6 +227,7 @@ class SafeFileHandler:
def _move_to_trash_unix(self, file_path: Path) -> bool:
"""Unix-spezifische Papierkorb-Implementation"""
try:
from utils.core_system import safe_subprocess_run
tools = ['gio', 'gvfs-trash', 'trash-put']
for tool in tools:
@ -236,9 +239,9 @@ class SafeFileHandler:
elif tool == 'trash-put':
cmd = ['trash-put', str(file_path)]
result = subprocess.run(cmd, capture_output=True, text=True)
result = safe_subprocess_run(cmd, capture_output=True, timeout=10)
if result.returncode == 0:
if result and result.returncode == 0:
data_logger.info(f"Datei erfolgreich in Papierkorb verschoben ({tool}): {file_path}")
return True