Manual score modification step
This commit is contained in:
1 parent
261a50a7d2
commit
7bc588e9a1
5 files changed
+383
-2
No files matched your search
+30
-2
@@ -26,6 +26,7 @@ from copienator.rubrics import present_rubric_labels
|
||||
from .diagnostics import collect_diagnostics
|
||||
from .batch_monitor import BatchMonitor
|
||||
from .giving_names import GivingNamesPanel, find_name_issues
|
||||
from .scores import ScoreEditorPanel
|
||||
from .notifications import notify_desktop
|
||||
from .syncthing import SyncthingPanel
|
||||
from .manual_resolution import ManualResolutionPanel
|
||||
@@ -279,6 +280,7 @@ class CopienatorApp(tk.Tk):
|
||||
self._rendering = False
|
||||
self.refaire_panel: RefaireSelection | None = None
|
||||
self.giving_names_panel: GivingNamesPanel | None = None
|
||||
self.score_editor_panel: ScoreEditorPanel | None = None
|
||||
self.complete_giving_names_button: ttk.Button | None = None
|
||||
self.label_groups_button: ttk.Button | None = None
|
||||
self.pending_refaire_commands: list[list[str]] = []
|
||||
@@ -809,7 +811,7 @@ class CopienatorApp(tk.Tk):
|
||||
if not step:
|
||||
return
|
||||
self._rendering = True
|
||||
if step.id == "personal_read":
|
||||
if step.id in {"personal_read", "edit_scores"}:
|
||||
self.command_box.grid_remove()
|
||||
else:
|
||||
self.command_box.grid()
|
||||
@@ -822,6 +824,7 @@ class CopienatorApp(tk.Tk):
|
||||
"plotting",
|
||||
"manual_resolution",
|
||||
"giving_names",
|
||||
"edit_scores",
|
||||
"statement_persp",
|
||||
}
|
||||
self.console.configure(height=8 if expanded_form else 14)
|
||||
@@ -835,6 +838,7 @@ class CopienatorApp(tk.Tk):
|
||||
self.arg_vars.clear()
|
||||
self.refaire_panel = None
|
||||
self.giving_names_panel = None
|
||||
self.score_editor_panel = None
|
||||
self.complete_giving_names_button = None
|
||||
self.label_groups_button = None
|
||||
entry = self.state_store.step(step.id) if self.state_store.evaluation else {}
|
||||
@@ -1050,6 +1054,12 @@ class CopienatorApp(tk.Tk):
|
||||
)
|
||||
row += 1
|
||||
return row
|
||||
if step.id == "edit_scores" and self.evaluation:
|
||||
self.score_editor_panel = ScoreEditorPanel(
|
||||
self.form, self.evaluation, self._score_changed
|
||||
)
|
||||
self.score_editor_panel.grid(row=row, column=0, columnspan=2, sticky="ew", pady=8)
|
||||
row += 1
|
||||
if step.id == "giving_names" and self.evaluation:
|
||||
self.giving_names_panel = GivingNamesPanel(
|
||||
self.form, self.evaluation
|
||||
@@ -1658,7 +1668,9 @@ class CopienatorApp(tk.Tk):
|
||||
if not self.current_step or not self.state_store.evaluation or self.active_step_id:
|
||||
return
|
||||
self._save_current_form()
|
||||
self._invalidate_after_step(self.current_step, self._current_variant().id)
|
||||
# Score edits already invalidate downstream steps when Set saves a change.
|
||||
if self.current_step.id != "edit_scores":
|
||||
self._invalidate_after_step(self.current_step, self._current_variant().id)
|
||||
self.state_store.update_step(self.current_step.id, status=status)
|
||||
history: dict[str, object] = {
|
||||
"step": self.current_step.id,
|
||||
@@ -1687,6 +1699,20 @@ class CopienatorApp(tk.Tk):
|
||||
self._populate_tree()
|
||||
self.info_var.set("Renommage validé — aucun fichier modifié.")
|
||||
|
||||
def _score_changed(self, copy_id: str, label: str, previous: str, current: str) -> None:
|
||||
step = self.step_by_id["edit_scores"]
|
||||
self._invalidate_after_step(step, "default")
|
||||
self.state_store.update_step(step.id, status="detected")
|
||||
self.state_store.add_history({
|
||||
"step": step.id, "copy_id": copy_id, "label": label,
|
||||
"previous_score": previous, "score": current, "manual": True,
|
||||
})
|
||||
# Refresh statuses without rebuilding the form between score edits.
|
||||
for item in self.steps:
|
||||
if self.tree.exists(item.id):
|
||||
status = self._step_status(item)
|
||||
self.tree.item(item.id, values=(STATUS_LABELS.get(status, status),))
|
||||
|
||||
def _complete_giving_names(self) -> None:
|
||||
if (
|
||||
not self.current_step
|
||||
@@ -2091,6 +2117,8 @@ class CopienatorApp(tk.Tk):
|
||||
self.complete_giving_names_button.configure(
|
||||
state="disabled" if running else "normal"
|
||||
)
|
||||
if self.score_editor_panel is not None:
|
||||
self.score_editor_panel.set_busy(running)
|
||||
|
||||
def _move_selection(self, delta: int) -> None:
|
||||
if not self.current_step:
|
||||
|
||||
Reference in new issue
Block a user