def update(self, secs=None): clock_format = SystemSettings.get_clock_format() location_time = self.get_location_time(secs) if clock_format == '12h': t = location_time.strftime("%I:%M %p") else: t = location_time.strftime("%H:%M") if t.startswith("0"): t = t[1:] if not t == self._last_time \ or not self.sunrise == self._last_sunrise \ or not self.sunset == self._last_sunset: is_light = self.get_is_light(location_time) if is_light: img = os.path.join(Dirs.get_image_dir(), "cities", "day.png") else: img = os.path.join(Dirs.get_image_dir(), "cities", "night.png") day = self.get_day(secs) if day == "Today": self.drawing.render(t, img, is_light) else: self.drawing.render(t, img, is_light, day) if self.path and self.list_store: self.list_store[self.path][1] = self.drawing.pixbuf if self.standalone: self.standalone.update(img, t, self.sunrise, self.sunset) self._last_time = t
def __init__(self, view, alarm, alert): self.view = view self.alarm = alarm self.alert = alert timestr = alarm.get_time_as_string() repeat = alarm.get_alarm_repeat_string() self.drawing = DigitalClockDrawing() is_light = self.get_is_light(int(timestr[:2])) if is_light: img = os.path.join(Dirs.get_image_dir(), "cities", "day.png") else: img = os.path.join(Dirs.get_image_dir(), "cities", "night.png") self.drawing.render(timestr, img, is_light, repeat) self.standalone = None