Skip to content

Commit

Permalink
feat(barcalendar): add alternate version for edx production
Browse files Browse the repository at this point in the history
  • Loading branch information
Ned Batchelder committed Aug 17, 2023
1 parent 182a18e commit 1106c7d
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions barcalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@ def rawbar(
color=None,
text_color=None,
current=False,
alternate=False,
indefinite=False,
note=None,
):
text = name
formatting = ""
if color:
if current:
Expand All @@ -185,11 +187,15 @@ def rawbar(
if text_color:
formatting += f""".setFontColor({text_color!r})"""
if current:
formatting += f""".setBorder(true, true, true, true, null, null, "black", SpreadsheetApp.BorderStyle.SOLID_MEDIUM)"""
formatting += f""".setFontWeight("bold")"""
formatting += """.setBorder(true, true, true, true, null, null, "black", SpreadsheetApp.BorderStyle.SOLID_MEDIUM)"""
formatting += """.setFontWeight("bold")"""
elif alternate:
formatting += """.setBorder(true, true, true, true, null, null, "black", SpreadsheetApp.BorderStyle.SOLID)"""
formatting += """.setFontWeight("bold")"""
formatting += """.setFontStyle("italic")"""
text = f"** {text} **"
if indefinite:
iend = self.width - 24
text = name
if note:
self.footnotes.append(note)
text = f"{text} (note {len(self.footnotes)})"
Expand Down Expand Up @@ -329,6 +335,19 @@ def parse_version_name(line):
"Ruby": "3.0",
}

EDX = {
"Python": "3.8",
"Django": "3.2",
"Ubuntu": "20.04",
"Node": "16.x",
"Mongo": "4.2",
"MySQL": "5.7",
"Elasticsearch": "7.10",
"Redis": "5.6",
"Ruby": "3.0",
}


cal = GsheetCalendar(START_YEAR, END_YEAR)
cal.years_months()

Expand Down Expand Up @@ -411,6 +430,7 @@ def parse_version_name(line):
length=length,
color=color,
current=(name==CURRENT["Django"]),
alternate=(name==EDX["Django"]),
note=(more[0] if more else None),
)
cal.gap_line()
Expand All @@ -435,6 +455,7 @@ def parse_version_name(line):
end=(eyear, emonth),
color="#ffd545",
current=(name==CURRENT["Python"]),
alternate=(name==EDX["Python"]),
)
cal.gap_line()

Expand Down Expand Up @@ -463,6 +484,7 @@ def parse_version_name(line):
color=color,
text_color="white",
current=(name==CURRENT["Ubuntu"]),
alternate=(name==EDX["Ubuntu"]),
)
cal.gap_line()

Expand All @@ -485,6 +507,7 @@ def parse_version_name(line):
color="#2f6c1b",
text_color="white",
current=(name==CURRENT["Node"]),
alternate=(name==EDX["Node"]),
)
cal.gap_line()

Expand All @@ -506,6 +529,7 @@ def parse_version_name(line):
end=(eyear, emonth),
color="#4da65a",
current=(name==CURRENT["Mongo"]),
alternate=(name==EDX["Mongo"]),
)
cal.gap_line()

Expand All @@ -523,6 +547,7 @@ def parse_version_name(line):
end=(eyear, emonth),
color="#b9dc48",
current=(name==CURRENT["MySQL"]),
alternate=(name==EDX["MySQL"]),
)
cal.gap_line()

Expand All @@ -548,6 +573,7 @@ def parse_version_name(line):
end=(eyear, emonth),
color="#4595ba",
current=(name==CURRENT["Elasticsearch"]),
alternate=(name==EDX["Elasticsearch"]),
)
cal.gap_line()

Expand All @@ -568,6 +594,7 @@ def parse_version_name(line):
color="#963029",
text_color="white",
current=(name==CURRENT["Redis"]),
alternate=(name==EDX["Redis"]),
)
cal.gap_line()

Expand All @@ -589,6 +616,7 @@ def parse_version_name(line):
end=(eyear, emonth),
color="#DE3F24",
current=(name==CURRENT["Ruby"]),
alternate=(name==EDX["Ruby"]),
note=(more[0] if more else None),
)
cal.gap_line()
Expand Down

0 comments on commit 1106c7d

Please sign in to comment.