diff --git a/annotating_with_checks.py b/annotating_with_checks.py index d747baa..08e8000 100644 --- a/annotating_with_checks.py +++ b/annotating_with_checks.py @@ -20,7 +20,7 @@ LATEX_LOCK = threading.Lock() DPI = 100 BOX_SIZE = 30 SCORE_BOX_SIZE = 40 -SCORES = [x * 0.5 for x in range(9)] # 0.0 to 4.0 +SCORES = [x * 0.5 for x in range(10)] # 0.0 to 4.5 try: CHECKBOX_FONT = ImageFont.truetype("DejaVuSans.ttf", 20) @@ -66,7 +66,15 @@ class CheckboxRenderer: "type": "score", "label": self.label, "value": val, "rel_box": box # Will be adjusted for global Y later }) - start_x += SCORE_BOX_SIZE + 60 + start_x += SCORE_BOX_SIZE + 45 + + start_x += SCORE_BOX_SIZE + 60 + box = draw_checkbox(draw, start_x, pos['y'] + 25, SCORE_BOX_SIZE, "clr") + self.checkboxes.append({ + "type": "clear_all", "label": self.label, + "rel_box": box + }) + elif meta.get("type") == "global_fb": # Draw delete box for global feedback bx = pos['w'] - BOX_SIZE - 5 diff --git a/reading_annotations.py b/reading_annotations.py index dd0e326..14b811d 100644 --- a/reading_annotations.py +++ b/reading_annotations.py @@ -204,6 +204,14 @@ def apply_actions_and_regenerate(root_dir, data, student_id, actions, notes_laye dirty_labels.add(label) print(f" > Updated score for {label} to {act['value']}") + elif act['type'] == 'clear_all': + for fb in feedbacks: + fb["to_delete"] = True + if fb.get("box_2d"): + fb["norectangle"] = True + dirty_labels.add(label) + print(f" > Cleared all feedbacks in {label}") + elif act['type'] == 'del_global': if act['index'] < len(global_fb): global_fb[act['index']]["to_delete"] = True diff --git a/reading_grouped_annotations.py b/reading_grouped_annotations.py index 822a317..f782636 100644 --- a/reading_grouped_annotations.py +++ b/reading_grouped_annotations.py @@ -50,6 +50,14 @@ def apply_actions_and_regenerate_grouped(root_dir, data, student_id, actions, la dirty_labels.add(label) logs.append(f" > Updated score for {label} to {act['value']}") + elif act['type'] == 'clear_all': + for fb in feedbacks: + fb["to_delete"] = True + if fb.get("box_2d"): + fb["norectangle"] = True + dirty_labels.add(label) + logs.append(f" > Cleared all feedbacks in {label}") + elif act['type'] == 'del_global': if act['index'] < len(global_fb): global_fb[act['index']]["to_delete"] = True