-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.py
More file actions
89 lines (74 loc) · 2.18 KB
/
constants.py
File metadata and controls
89 lines (74 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
DEFAULT_ENCODING = "utf-8"
# Argument parser
ON_OFF_ACTION = "store_true"
DESCRIPTION = "View and create events on a calendar."
class Arg:
def __init__(self, short, long, action, arg_help=""):
self.short = short
self.long = long
self.action = action
self.help = arg_help
class PosArg:
def __init__(self, name, arg_help="", optional=True):
self.name = name
self.help = arg_help
self.optional = optional
ARGS = [
Arg("v", "view", ON_OFF_ACTION, "View the calendar"),
Arg("e", "event", ON_OFF_ACTION, "Views events on a specific date"),
Arg("c", "create", ON_OFF_ACTION, "Create an event"),
Arg("d", "delete", ON_OFF_ACTION, "Delete an event"),
Arg("ed", "edit", ON_OFF_ACTION, "Edit an event"),
Arg("p", "pref", ON_OFF_ACTION, "View all preferences"),
Arg("cp", "changepref", ON_OFF_ACTION, "Change a preference")
]
POS_ARGS = [
PosArg("year", "Year to use, defaults to today"),
PosArg("month", "Month to use, defaults to today"),
PosArg("day", "Day to use, defaults to today")
]
# Dates
SUNDAY_OFFSET = [6, 0, 1, 2, 3, 4, 5]
WEEKDAYS = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
]
WEEKDAYS_SHORT = [weekday[0:3] for weekday in WEEKDAYS]
MONTHS = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
]
CALENDAR_TABLE_FORMAT = {weekday: [] for weekday in WEEKDAYS}
TODAY_ON_COLOR = "on_cyan"
# Events
EVENTS_FILE_LOCATION = "events.csv"
EVENTS_DATE_KEY = "date"
EVENTS_NAME_KEY = "name"
EVENTS_FILE_FIELDNAMES = [EVENTS_DATE_KEY, EVENTS_NAME_KEY]
# Settings
SETTINGS_FILE_LOCATION = "settings.ini"
PREFS_SECTION_NAME = "PREFERENCES"
class Pref:
def __init__(self, name, default):
self.name = name
self.default = default
SUNDAY_FIRST_PREF = Pref("sunday_first", "false")
SHORT_WEEKDAYS_PREF = Pref("short_weekdays", "true")
TABLE_FORMAT_PREF = Pref("table_format", "rounded_grid")
DEFAULT_PREFS = {pref.name: pref.default
for pref in [SUNDAY_FIRST_PREF, SHORT_WEEKDAYS_PREF, TABLE_FORMAT_PREF]}