4.5 and clear checkboxes
parent
f9d43e3ad9
commit
8a1eea6b3b
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue