NDOJ/judge/models/choices.py

67 lines
1.9 KiB
Python
Raw Permalink Normal View History

2020-01-21 06:35:58 +00:00
from collections import defaultdict
from operator import itemgetter
import pytz
from django.utils.translation import gettext_lazy as _
def make_timezones():
data = defaultdict(list)
for tz in pytz.all_timezones:
2022-05-14 17:57:27 +00:00
if "/" in tz:
area, loc = tz.split("/", 1)
2020-01-21 06:35:58 +00:00
else:
2022-05-14 17:57:27 +00:00
area, loc = "Other", tz
if not loc.startswith("GMT"):
2020-01-21 06:35:58 +00:00
data[area].append((tz, loc))
return sorted(data.items(), key=itemgetter(0))
TIMEZONE = make_timezones()
del make_timezones
ACE_THEMES = (
2022-05-14 17:57:27 +00:00
("ambiance", "Ambiance"),
("chaos", "Chaos"),
("chrome", "Chrome"),
("clouds", "Clouds"),
("clouds_midnight", "Clouds Midnight"),
("cobalt", "Cobalt"),
("crimson_editor", "Crimson Editor"),
("dawn", "Dawn"),
("dreamweaver", "Dreamweaver"),
("eclipse", "Eclipse"),
("github", "Github"),
("idle_fingers", "Idle Fingers"),
("katzenmilch", "Katzenmilch"),
("kr_theme", "KR Theme"),
("kuroir", "Kuroir"),
("merbivore", "Merbivore"),
("merbivore_soft", "Merbivore Soft"),
("mono_industrial", "Mono Industrial"),
("monokai", "Monokai"),
("pastel_on_dark", "Pastel on Dark"),
("solarized_dark", "Solarized Dark"),
("solarized_light", "Solarized Light"),
("terminal", "Terminal"),
("textmate", "Textmate"),
("tomorrow", "Tomorrow"),
("tomorrow_night", "Tomorrow Night"),
("tomorrow_night_blue", "Tomorrow Night Blue"),
("tomorrow_night_bright", "Tomorrow Night Bright"),
("tomorrow_night_eighties", "Tomorrow Night Eighties"),
("twilight", "Twilight"),
("vibrant_ink", "Vibrant Ink"),
("xcode", "XCode"),
2020-01-21 06:35:58 +00:00
)
MATH_ENGINES_CHOICES = (
2022-05-14 17:57:27 +00:00
("tex", _("Leave as LaTeX")),
("svg", _("SVG with PNG fallback")),
("mml", _("MathML only")),
("jax", _("MathJax with SVG/PNG fallback")),
("auto", _("Detect best quality")),
2020-01-21 06:35:58 +00:00
)
2022-05-14 17:57:27 +00:00
EFFECTIVE_MATH_ENGINES = ("svg", "mml", "tex", "jax")