-
Notifications
You must be signed in to change notification settings - Fork 0
/
promptHelper.py
executable file
·67 lines (44 loc) · 2.13 KB
/
promptHelper.py
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
import datetime
from model import Calendar
import model
def addEventParsing(proc, test=False):
if test is False:
addWelcome = 'Okay! You\'re going to add an event\n'
# getMonth = 'What month? (mm)\n'
getDay = 'What Day? (dd)\n'
# getYear = 'What Year? (yyyy)\n'
getStartTime = 'What is the start time? (24h hhmm)\n'
getEndTime = 'What is the end time? (24h hhmm)\n'
getName = 'What is the name of this event?\n'
getNumParticipants = 'How many participants? (int)\n'
print (addWelcome)
# month = int(input(getMonth))
day = int(input(getDay))
# year = int(input(getYear))
month = 11
# day = 16
year = 1990
startTime = input(getStartTime)
endTime = input(getEndTime)
startDateTime = datetime.datetime(year,month,day, hour = int(startTime[:2]), minute = int(startTime[2:4]))
endDateTime = datetime.datetime(year,month,day, hour = int(endTime[:2]), minute = int(endTime[2:4]))
eventName = input(getName)
numParticipants = int(input(getNumParticipants))
participants = []
for i in range(0,numParticipants):
singlePart = input('Enter participant %i ID.\n'%(i+1))
participants.append(int(singlePart))
# print (participants)
newEvent = model.CalEvent(eventName, startDateTime, endDateTime, uRank = proc.uRank, participants = participants,uid =proc.uid)
else:
newEvent = model.CalEvent("TEST EVENT", datetime.datetime(2100,10,4,12,44),datetime.datetime(2100,11,4,12,44),
uRank=proc.uRank, participants=[0,1],uid=proc.uid)
return newEvent #Return calendar event
def deleteEventParsing(theCalendar):
deleteWelcome = 'Okay! You\'re going to delete an event\n'
print('This calendar has the following events in it:\n')
numEvents = len(theCalendar.cal)
for i in range(0,numEvents):
print('\t%i. '%(i) + str(theCalendar.cal[i]))
choice = int(input('Which event do you want to delete? (number)'))
return theCalendar.cal[choice] #return the selected event to delete