Standardisation des scripts
This commit is contained in:
+13
-4
@@ -7,6 +7,7 @@ from pathlib import Path
|
||||
from tkinter import filedialog, messagebox, ttk
|
||||
from typing import Any
|
||||
|
||||
from copienator import ExitCode
|
||||
from platform_utils import WindowsLabelError, validate_windows_labels
|
||||
|
||||
from .diagnostics import collect_diagnostics
|
||||
@@ -26,6 +27,7 @@ STATUS_LABELS = {
|
||||
"ready": "Prête",
|
||||
"running": "En cours",
|
||||
"success": "Réussie",
|
||||
"partial": "Partielle",
|
||||
"failed": "Échouée",
|
||||
"interrupted": "Interrompue",
|
||||
"skipped": "Ignorée",
|
||||
@@ -34,6 +36,16 @@ STATUS_LABELS = {
|
||||
}
|
||||
|
||||
|
||||
def process_status(return_code: int, interrupted: bool = False) -> str:
|
||||
if interrupted or return_code == ExitCode.INTERRUPTED:
|
||||
return "interrupted"
|
||||
if return_code == ExitCode.SUCCESS:
|
||||
return "success"
|
||||
if return_code == ExitCode.PARTIAL:
|
||||
return "partial"
|
||||
return "failed"
|
||||
|
||||
|
||||
class CopienatorApp(tk.Tk):
|
||||
def __init__(
|
||||
self,
|
||||
@@ -624,10 +636,7 @@ class CopienatorApp(tk.Tk):
|
||||
step_id = self.active_step_id
|
||||
if not step_id:
|
||||
return
|
||||
if interrupted:
|
||||
status = "interrupted"
|
||||
else:
|
||||
status = "success" if return_code == 0 else "failed"
|
||||
status = process_status(return_code, interrupted)
|
||||
self.state_store.update_step(step_id, status=status, return_code=return_code)
|
||||
self.state_store.add_history(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user