From 1aa3f21ec8549c7d44abb460e241f32fc184fa94 Mon Sep 17 00:00:00 2001 From: Loïc Guégan Date: Fri, 22 Aug 2025 14:22:55 +0200 Subject: Add support for notes --- infos.yaml | 16 +++++++++++----- main.py | 20 +++++++++++++++++++- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/infos.yaml b/infos.yaml index f018edc..7a79cbc 100644 --- a/infos.yaml +++ b/infos.yaml @@ -39,6 +39,7 @@ events: # name: "My event name" # date: "19/11/2025" # hidden: no + # note: "Note on the event" # repeat: # every: 7 # until: "26/11/2025" @@ -64,6 +65,7 @@ events: name: "Introduction" date: "13/08/2025" who: "Loïc" + # note: "Test" # slot: # start: "09:00" # end: "09:00" @@ -85,17 +87,17 @@ events: 3: type: "lecture" - name: "MPI" + name: "MPI (Chapter 3)" date: "29/08/2025" who: "Loïc" 4: type: "lecture" - name: "PThread" + name: "PThread (Chapter 4)" date: "05/09/2025" who: "Loïc" 5: type: "lecture" - name: "OpenMP" + name: "OpenMP (Chapter 5)" date: "12/09/2025" who: "Loïc" 6: @@ -105,14 +107,16 @@ events: who: "JM" 7: type: "lecture" - name: "CUDA Intro" + name: "CUDA Intro (Chapter 6)" date: "26/09/2025" who: "JM" + #note: "Chapter 6" 8: type: "lecture" - name: "CUDA Optim" + name: "CUDA Optim (Chapter 6)" date: "03/10/2025" who: "JM" + #note: "Chapter 6" 9: type: "lecture" name: "CPU vs GPU" @@ -142,6 +146,7 @@ config: show_room: no show_time: yes show_who: yes + show_note: yes # Show event notes show_project: yes show_date: yes min_col_width: 10 # if <=0 not acccounted @@ -149,6 +154,7 @@ config: labels: week: "Week {}" project: "Projects" + note: "Notes" slots: hidden: no # Generate slots tables or not? show_room: no diff --git a/main.py b/main.py index 802c328..cd85abd 100755 --- a/main.py +++ b/main.py @@ -70,6 +70,16 @@ def formatprojects(d): output+="," output+=p["name"] return output +def formatnotes(d): + output="" + for e in events: + _e=events[e] + if (not _e["hidden"]) and (_e["date"].date() == d.date() or matchrepeat(d, e)): + if len(output)!=0: + output+="\n\n" + if _e["note"] is not None: + output+= _e["note"] + return output #### Other help functions def add_row(t,row,div): total=0 @@ -125,6 +135,7 @@ for e in _i["events"]: events[e]["start"]=parse_time(_e["start"]) if "start" in _e.keys() else None events[e]["end"]=parse_time(_e["end"]) if "end" in _e.keys() else None events[e]["room"]=_e["room"] if "room" in _e.keys() else None + events[e]["note"]=_e["note"] if "note" in _e.keys() else None if "repeat" in _e.keys(): events[e]["repeat"]["every"]=_e["repeat"]["every"] events[e]["repeat"]["until"]=parse_date(_e["repeat"]["until"]) if "until" in _e["repeat"].keys() else None @@ -167,7 +178,14 @@ if not _ccal["hidden"]: formatprojects(getnextdayn(d, 1)), formatprojects(getnextdayn(d, 2)), formatprojects(getnextdayn(d, 3)), - formatprojects(getnextdayn(d, 4))],False) + formatprojects(getnextdayn(d, 4))],True) + if _ccal["show_note"]: + add_row(t,[_ccal["labels"]["note"], + formatnotes(getnextdayn(d, 0)), + formatnotes(getnextdayn(d, 1)), + formatnotes(getnextdayn(d, 2)), + formatnotes(getnextdayn(d, 3)), + formatnotes(getnextdayn(d, 4))],False) print(t.get_formatted_string(_c["format"])) d=getnextmonday(d) w+=1 -- cgit v1.2.3