summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--infos.yaml9
-rwxr-xr-xmain.py14
2 files changed, 18 insertions, 5 deletions
diff --git a/infos.yaml b/infos.yaml
index 264a2f9..968aafc 100644
--- a/infos.yaml
+++ b/infos.yaml
@@ -133,7 +133,14 @@ config:
show_project: yes
show_date: yes
min_col_width: 10 # if <=0 not acccounted
- defrag: no # If yes empty lines from the calendar are not shown
+ defrag: yes # If yes empty lines from the calendar are not shown
labels:
week: "Week {}"
project: "Projects"
+ slots:
+ show_room: yes
+ projects:
+ show_week: yes
+ labels:
+ start: "Project {} handout"
+ end: "Project {} deadline"
diff --git a/main.py b/main.py
index f745260..711ce1e 100755
--- a/main.py
+++ b/main.py
@@ -8,6 +8,8 @@ with open("infos.yaml", "r") as f:
_i=yaml.safe_load(f)
_c=_i["config"]
_ccal=_c["calendar"]
+ _cslot=_c["slots"]
+ _cproj=_c["projects"]
#### Parsing
def parse_date(s):
@@ -182,14 +184,16 @@ for s in sem["slots"]:
room=p["room"] if p["room"] is not None else ""
if timeStr != "" or room != "":
t.add_row([dayname.capitalize(),timeStr,room])
+ if not _cslot["show_room"]:
+ t.del_column(t.field_names[-1])
print(s+":")
print(t)
#### Gen projects deadline tables
if len(sem["projects"].keys()) > 0:
t = PrettyTable()
- t.field_names = ["Week", "Day", "Project"]
- t.align["Project"]="l"
+ t.field_names = ["Week", "Day", "Project info"]
+ t.align[t.field_names[-1]]="l"
d=getmonday(sem["start"])
w=getweek(d)
while d<=sem["end"]: # This is not optimal but works fine
@@ -198,10 +202,12 @@ if len(sem["projects"].keys()) > 0:
end=sem["projects"][p]["end"]
name=sem["projects"][p]["name"]
if d.date() == start.date():
- t.add_row([w,formatday(start),"Project "+name+" handout"])
+ t.add_row([w,formatday(start),_cproj["labels"]["start"].format(name)])
if d.date() == end.date():
- t.add_row([w,formatday(end),"Project "+name+" deadline"])
+ t.add_row([w,formatday(end),_cproj["labels"]["end"].format(name)])
d=getnextdayn(d, 1)
w=getweek(d)
+ if not _cproj["show_week"]:
+ t.del_column(t.field_names[0])
print("Projects deadlines:")
print(t)