-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHoursSelect.py
More file actions
69 lines (53 loc) · 1.98 KB
/
Copy pathHoursSelect.py
File metadata and controls
69 lines (53 loc) · 1.98 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
"""
This is how I'm gonna schedule hours
IDEA: import the format example file that I'm using and is saved in the same directory
"""
import csv
import pprint
from tkinter import *
from tkinter.filedialog import askopenfilename
import StringProcessing
def selectHoursFile():
Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
filename = askopenfilename() # show an "Open" dialog box and return the path to the selected file
print(filename)
return filename
"""
Receives a file location, opens the csv
The format looks like this:
CLASS STARTS,Class name (optional),MON,TUES,WED,THURS,FRI,,CLASS ENDS,MON,TUES,WED,THURS,FRI
1, Stats, 10:20:00 AM,,10:20:00 AM,,10:20:00 AM,,,11:15:00 AM,,11:15:00 AM,,11:15:00 AM
2,,,09:35:00 AM,,09:35:00 AM,,,,,10:55:00 AM,,10:55:00 AM,
3,,,11:30:00 AM,11:30:00 AM,11:30:00 AM,11:30:00 AM,,,,12:25:00 PM,12:25:00 PM,12:25:00 PM,12:25:00 PM
4,,,,,,09:10:00 AM,,,,,,,10:05:00 AM
5,,12:00:00 PM,01:00:00 PM,01:00:00 PM,01:00:00 PM,01:00:00 PM,,,,04:30:00 PM,04:30:00 PM,04:30:00 PM,04:30:00 PM
6,,,,,,,,,,,,,
7,,,,,,,,,,,,,
8,,,,,,,,,,,,,
9,,,,,,,,,,,,,
10,,,,,,,,,,,,,
11,,,,,,,,,,,,,
12,,,,,,,,,,,,,
13,,,,,,,,,,,,,
14,,,,,,,,,,,,,
15,,,,,,,,,,,,,
"""
def interpretCSVFormat(csvFile):
#first open the file with the filepath
classList = dict()
with open(csvFile, "r") as csvOpen:
#next populate a temporary dictionary for the classes
tempDict = dict()
classID = 0
rowReader = csv.reader(csvOpen, delimiter=',', quotechar="'")
for row in rowReader:
#dictionary format: class ID::string of class days
classTimes = row
#print(row)
tempDict[classID] = str(classTimes)
classID = classID + 1
print(StringProcessing.lineList(str(classTimes)))
del tempDict[0]
pp = pprint.PrettyPrinter(indent=4)
#pp.pprint(tempDict)
#TODO: make the sections using ClassScheduleStorage