added event details

This commit is contained in:
Yessiest 2022-02-02 02:25:50 +04:00
parent 75a2dff92d
commit 1cc223e567
2 changed files with 25 additions and 4 deletions

View File

@ -7,7 +7,7 @@ This is a calendar app which tries to bring something new to the functionality o
This project is currently very WIP, the todo list is: This project is currently very WIP, the todo list is:
- [x] Basic decal functionality (receiving events and showing a tagged calendar) - [x] Basic decal functionality (receiving events and showing a tagged calendar)
- [ ] Event details - [x] Event details
- [ ] Creating events - [ ] Creating events
- [ ] Modifying events - [ ] Modifying events
- [ ] Task lists - [ ] Task lists

27
decal
View File

@ -43,6 +43,12 @@ parser.add_argument("--create",
parser.add_argument("--calendar", parser.add_argument("--calendar",
action="append", action="append",
help="Specify a calendar (or multiple calendars) to sync from") help="Specify a calendar (or multiple calendars) to sync from")
parser.add_argument("-d",
action="store_true",
help="Show event details for selected day")
parser.add_argument("-m",
action="store_true",
help="Show event details for entire month")
parser.add_argument("-1", parser.add_argument("-1",
action="store_true", action="store_true",
help="show only a single month (default)") help="show only a single month (default)")
@ -56,9 +62,6 @@ parser.add_argument("-n",
action="store", action="store",
type=int, type=int,
help="show n months") help="show n months")
parser.add_argument("-d",
action="store_true",
help="show event details")
args = vars(parser.parse_args()) args = vars(parser.parse_args())
@ -284,3 +287,21 @@ for count in range(3-(len(cal_prints)%3)):
for cal in range(0,len(cal_prints),3): for cal in range(0,len(cal_prints),3):
printlines(cal_prints[cal],cal_prints[cal+1],cal_prints[cal+2]) printlines(cal_prints[cal],cal_prints[cal+1],cal_prints[cal+2])
def printDailyEvents(events,evtrack=[]):
for event in events:
if not event in evtrack:
uid = event["uid"].encode()
print(colorize(event["dtstart"]+" - "+event["dtend"],uid)+":\n- "+event["summary"])
evtrack.append(event)
evtrack = []
if args["d"]:
printDailyEvents(events[str(selected_date)],evtrack=evtrack)
exit(0)
if args["m"]:
for day in range(*calendar.monthrange(args['year'],args['month'])):
key = str(date(args['year'],args['month'],day))
if key in events:
printDailyEvents(events[key],evtrack=evtrack)