Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ui
- import appex
- from datetime import date, datetime, time
- import calendar
- MondayA = {'P1': 'Free','P2': 'Free','T': 'Tutor','P3': 'Ethics','P4': 'Free','P5': 'IT'}
- TuesdayA = {'P1': 'Computing','P2': 'Computing','T': 'Ext. Break','P3': 'IT','P4': 'Free','P5': 'Free'}
- WednesdayA = {'P1': 'Philosophy','P2': 'IT','T': 'Tutor','P3': 'English','P4': 'Computing','P5': ''}
- ThursdayA = {'P1': 'Free','P2': 'Ethics','T': 'Ext. Break','P3': 'Core Maths','P4': 'English','P5': 'Free'}
- FridayA = {'P1': 'Computing','P2': 'IT','T': 'Assembly','P3': 'IT','P4': 'Philosophy','P5': 'Free'}
- MondayB = {'P1': 'Free','P2': 'Free','T': 'Tutor','P3': 'Computing','P4': 'Ethics','P5': 'Free'}
- TuesdayB = {'P1': 'Ethics','P2': 'Computing','T': 'Ext. Break','P3': 'Free','P4': 'Free','P5': 'IT'}
- WednesdayB = {'P1': 'Core Maths','P2': 'Free','T': 'Tutor','P3': 'Tutor','P4': 'Philosophy','P5': ''}
- ThursdayB = {'P1': 'Free','P2': 'IT','T': 'Ext. Break','P3': 'Computing','P4': 'Free','P5': 'Philosophy'}
- FridayB = {'P1': 'IT','P2': 'Computing','T': 'Assembly','P3': 'Free','P4': 'Free','P5': 'Core Maths'}
- my_date = date.today()
- Week = 'A' # Set the Week Here
- Day = calendar.day_name[my_date.weekday()]
- Day = 'Wednesday'
- DayWeek = Day + Week
- Switch = 'no'
- Period1S = "Period 1: " + eval(DayWeek + "['P1']")
- Period2S = "Period 2: " + eval(DayWeek + "['P2']")
- TutorS = "Tutor: " + eval(DayWeek + "['T']")
- Period3S = "Period 3: " + eval(DayWeek + "['P3']")
- Period4S = "Period 4: " + eval(DayWeek + "['P4']")
- Period5S = "Period 5: " + eval(DayWeek + "['P5']")
- v = ui.load_view()
- btn = v['switch']
- p1 = v['p1']
- p2 = v['p2']
- t = v['t']
- p3 = v['p3']
- p4 = v['p4']
- p5 = v['p5']
- p1.text = Period1S
- p2.text = Period2S
- t.text = TutorS
- p3.text = Period3S
- p4.text = Period4S
- p5.text = Period5S
- now = datetime.now()
- now_time = now.time()
- if Day != 'Wednesday':
- Period1T = "Period 1: 8:50 - 9:50"
- Period2T = "Period 2: 9:53 - 10:53"
- TutorT = "Tutor: 10:53 - 11:13"
- Period3T = "Period 3: 11:33 - 12:33"
- Period4T = "Period 4: 1:11 - 2:11"
- Period5T = "Period 5: 2:14 - 3:14"
- if now_time >= time(8,50) and now_time <= time(9,50):
- p1.text_color = 'green'
- if now_time >= time(9,53) and now_time <= time(10,53):
- p2.text_color = 'green'
- if now_time >= time(10,53) and now_time <= time(11,13):
- t.text_color = 'green'
- if now_time >= time(11,33) and now_time <= time(12,33):
- p3.text_color = 'green'
- if now_time >= time(13,11) and now_time <= time(14,11):
- p4.text_color = 'green'
- if now_time >= time(13,14) and now_time <= time(15,14):
- p5.text_color = 'green'
- elif Day == 'Wednesday':
- Period1T = "Period 1: 8:50 - 9:50"
- Period2T = "Period 2: 10:30 - 11:30"
- TutorT = "Tutor: 9:50 - 10:10"
- Period3T = "Period 3: 12:08 - 1:08"
- Period4T = "Period 4: 1:11 - 2:11"
- Period5T = "Period 5:"
- if now_time >= time(8,50) and now_time <= time(9,50):
- p1.text_color = 'green'
- if now_time >= time(10,30) and now_time <= time(11,30):
- p2.text_color = 'green'
- if now_time >= time(9,50) and now_time <= time(10,10):
- t.text_color = 'green'
- if now_time >= time(12,8) and now_time <= time(13,8):
- p3.text_color = 'green'
- if now_time >= time(13,11) and now_time <= time(14,11):
- p4.text_color = 'green'
- def switch(sender):
- global Switch
- if Switch == 'no':
- p1.text = Period1T
- p2.text = Period2T
- t.text = TutorT
- p3.text = Period3T
- p4.text = Period4T
- p5.text = Period5T
- Switch = 'yes'
- elif Switch == 'yes':
- p1.text = Period1S
- p2.text = Period2S
- t.text = TutorS
- p3.text = Period3S
- p4.text = Period4S
- p5.text = Period5S
- Switch = 'no'
- btn.action = switch
- appex.set_widget_view(v)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement