def __init__(self): self.forecast = NOAA_Forecast_Adapter(40.7127837, -73.41639) self.pos = () self.orig_pos = () super(Forecast, self).__init__() lblfont = FontFactory().by_name("OpenSans-Regular", 16) font = FontFactory().by_name("OpenSans-Regular", 14) color = "#FFFFFF" self.labels = [] self.weathers = [] self.temps = [] for i in range(5): self.labels.append(TextLayer(lblfont, "#000000", lambda i=i: self.forecast[i][u"startPeriodName"].upper())) self.weathers.append(TextLayer(font, color, lambda i=i: self.forecast[i][u"weather"])) self.temps.append(TextLayer(font, color, lambda i=i: self.forecast[i][u"tempLabel"] + " " + self.forecast[i][u"temperature"]))
def __init__(self, text, size="MEDIUM", color="#FFFFFF"): self.text = text self.size = size self.color = color pygame.font.init() self.font = FontFactory().by_size(size)
class TextLayer(ScreenLayer): def __init__(self, text, size="MEDIUM", color="#FFFFFF"): self.text = text self.size = size self.color = color pygame.font.init() self.font = FontFactory().by_size(size) def enter(self): pass def exit(self): pass def suspend(self): pass def resume(self): pass def step(self): pass def render(self): text = self.font.render(self.text, False, pygame.Color(self.color)) # Convert to PIL image for display img_str = pygame.image.tostring(text, "RGBA") im = Image.frombytes("RGBA", text.get_size(), img_str) return im
def __init__(self, sun): self.sun = sun self.font = FontFactory().by_name("OpenSans-Regular", 24) self.color = "#FFFFFF" self.callback = self.status super(Sunset, self).__init__(self.font, self.color, self.callback)
def __init__(self): self.td = TrashDay() self.font = FontFactory().by_name("OpenSans-Regular", 18) self.color = "#FFFFFF" self.callback = self.text super(TrashItem, self).__init__(self.font, self.color, self.callback)
def __init__(self): self.font = FontFactory().by_name("OpenSans-Regular", 160) self.color = "#FFFFFF" self.callback = lambda: time.strftime("%I:%M", time.localtime() ).lstrip("0") self.am_pm = AmpmItem() super(TimeItem, self).__init__(self.font, self.color, self.callback)
def __init__(self, line, service_status): self.line = line self.service_status = service_status self.font = FontFactory().by_name("OpenSans-Regular", 24) self.color = "#FFFFFF" self.callback = self.status super(LirrItemStatus, self).__init__(self.font, self.color, self.callback)
def __init__(self): # Data services self.sun = Sunrise_Sunset(40.7127837, -74.0059413) self.orig_pos = () self.sunset = Sunset(self.sun) self.font = FontFactory().by_name("OpenSans-Regular", 18) self.color = "#FFFFFF" self.callback = lambda: "Sunset" super(SunsetItem, self).__init__(self.font, self.color, self.callback)
def __init__(self): # Create a connection to the NOAA website self.current_obs = NOAA_Current_Observation(STATION) self.font = FontFactory().by_name("OpenSans-Regular", 48) self.color = "#FFFFFF" self.callback = self.temp self.icon = TempIcon() super(TempItem, self).__init__(self.font, self.color, self.callback)
def __init__(self): # Data services self.service_status = MTA_Status() self.line = "Port Jefferson" self.orig_pos = () self.lirr_item_status = LirrItemStatus(self.line, self.service_status) self.font = FontFactory().by_name("OpenSans-Regular", 18) self.color = "#FFFFFF" self.callback = lambda: self.line super(LirrItem, self).__init__(self.font, self.color, self.callback)
def __init__(self): self.font = FontFactory().by_name("OpenSans-Regular", 48) self.color = "#FFFFFF" self.callback = lambda: time.strftime("%p", time.localtime()) super(AmpmItem, self).__init__(self.font, self.color, self.callback)
def __init__(self): self.font = FontFactory().by_name("OpenSans-Regular", 48) self.color = "#FFFFFF" self.callback = lambda: time.strftime("%A, %B ") + time.strftime( "%d").lstrip("0") super(DateItem, self).__init__(self.font, self.color, self.callback)
def __init__(self): self.font = FontFactory().by_name("OpenSans-Regular", 16) self.color = "#FFFFFF" self.callback = lambda: "RESET" super(ResetItem, self).__init__(self.font, self.color, self.callback)
def __init__(self): self.font = FontFactory().by_name("weathericons-regular-webfont", 32) self.color = "#FFFFFF" self.callback = lambda: u"\uF045" super(TempIcon, self).__init__(self.font, self.color, self.callback)