Compare commits
	
		
			2 Commits
		
	
	
		
			b5dbfd87de
			...
			804ab33a6d
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 804ab33a6d | |||
| baf214e3cf | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1 +1,2 @@
 | 
				
			|||||||
 | 
					*.swp
 | 
				
			||||||
__pycache__/
 | 
					__pycache__/
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,11 +25,10 @@ class Routine:
 | 
				
			|||||||
            for calendar in calendars:
 | 
					            for calendar in calendars:
 | 
				
			||||||
                if calendar.toggle == 'True': 
 | 
					                if calendar.toggle == 'True': 
 | 
				
			||||||
                    visualCals.append(calendar.name)
 | 
					                    visualCals.append(calendar.name)
 | 
				
			||||||
            
 | 
					            googleCreds = google.oauth2.credentials.Credentials(**credentials)
 | 
				
			||||||
            googleCreds =  google.oauth2.credentials.Credentials(**credentials)
 | 
					            print(credentials_to_dict(googleCreds), flush=True)
 | 
				
			||||||
            calendarjson = caltojson.generateJsonFromCalendarEntries(visualCals,  googleCreds)
 | 
					            calendarjson = caltojson.generateJsonFromCalendarEntries(visualCals,  googleCreds)
 | 
				
			||||||
            user.setJson(calendarjson) 
 | 
					            user.setJson(calendarjson) 
 | 
				
			||||||
            print(calendarjson)
 | 
					 | 
				
			||||||
            directory = 'userinfo/' + user.id + '/'
 | 
					            directory = 'userinfo/' + user.id + '/'
 | 
				
			||||||
            if not os.path.exists(directory):
 | 
					            if not os.path.exists(directory):
 | 
				
			||||||
                os.makedirs(directory)
 | 
					                os.makedirs(directory)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										22
									
								
								caltojson.py
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								caltojson.py
									
									
									
									
									
								
							@@ -138,7 +138,7 @@ def getCalendarEvents(service, visibleCalendars, startDate, endDate):
 | 
				
			|||||||
        for event in events_result.get('items', []):
 | 
					        for event in events_result.get('items', []):
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            # create simple event
 | 
					            # create simple event
 | 
				
			||||||
            name = event['summary']
 | 
					            name = event.get('summary', '(no Title)')
 | 
				
			||||||
            start = event['start'].get('dateTime')
 | 
					            start = event['start'].get('dateTime')
 | 
				
			||||||
            end = event['end'].get('dateTime')
 | 
					            end = event['end'].get('dateTime')
 | 
				
			||||||
            newEvent = Event(name, start, end)
 | 
					            newEvent = Event(name, start, end)
 | 
				
			||||||
@@ -179,17 +179,21 @@ def colorizeEvents(allEvents, service):
 | 
				
			|||||||
    colors = getCalendarColors(service)
 | 
					    colors = getCalendarColors(service)
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    for event in allEvents:
 | 
					    for event in allEvents:
 | 
				
			||||||
        event.colorHex = fromColorIdGetColor(event.calendarColorId, colormap, colors)
 | 
					            event.colorHex = forEventGetColor(event, colormap, colors)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def fromColorIdGetColor(colorId, colormap, colors):
 | 
					# this function is only used once for calendar generation stuff
 | 
				
			||||||
 | 
					def fromColorIdGetColor(color, colormap, colors):
 | 
				
			||||||
 | 
					    return toNaturalColor(colormap, colors['calendar'][color]['background'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if colorId != 0:
 | 
					def forEventGetColor(event, colormap, colors):
 | 
				
			||||||
        orgColor = colors['calendar'][colorId]['background']
 | 
					    if event.calendarColorId != 0:
 | 
				
			||||||
 | 
					        bg  = colors['calendar'][event.calendarColorId]['background']
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        calColorId = toCalendarColorId(colormap, colorId)
 | 
					        calColorId = toCalendarColorId(colormap, event.eventColorId)
 | 
				
			||||||
        orgColor = colors['calendar'][calColorId]['background']
 | 
					        bg = colors['calendar'][calColorId]['background']     
 | 
				
			||||||
    
 | 
					    print(event.name) 
 | 
				
			||||||
    return toNaturalColor(colormap, orgColor)
 | 
					    print(bg)
 | 
				
			||||||
 | 
					    return toNaturalColor(colormap, bg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def toJson(events):
 | 
					def toJson(events):
 | 
				
			||||||
    data = {}
 | 
					    data = {}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      "api": "#f83a22",
 | 
					      "api": "#f83a22",
 | 
				
			||||||
      "natural": "#8E24AA"
 | 
					      "natural": "#d50000"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      "api": "#fa573c",
 | 
					      "api": "#fa573c",
 | 
				
			||||||
@@ -143,4 +143,4 @@
 | 
				
			|||||||
      "to": "8"
 | 
					      "to": "8"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user