def choose_strip(self, metrics, appearance): """ Return a tuple (major_strip, minor_strip) for current time period and window size. """ day_period = TimePeriod(BosparanianTime(0, 0), BosparanianTime(1, 0)) one_day_width = metrics.calc_exact_width(day_period) self.major_strip_is_decade = False if one_day_width > 20000: return (StripHour(), StripMinute()) elif one_day_width > 600: return (StripDay(), StripHour()) elif one_day_width > 60: return (StripMonth(), StripWeekday()) elif one_day_width > 25: return (StripMonth(), StripDay()) elif one_day_width > 10: return (StripMonth(), StripWeek()) elif one_day_width > 1.75: return (StripYear(), StripMonth()) elif one_day_width > 0.5: return (StripYear(), StripQuarter()) elif one_day_width > 0.12: self.major_strip_is_decade = True return (StripDecade(), StripYear()) elif one_day_width > 0.012: return (StripCentury(), StripDecade()) else: return (StripCentury(), StripCentury())
def start(self, time): (hours, minutes, _) = time.get_time_of_day() return BosparanianTime(time.julian_day, minutes * 60 + hours * 60 * 60)
def start(self, time): days_to_subtract = BosparanianTimeType().get_day_of_week(time) return BosparanianTime(time.julian_day - days_to_subtract, 0)
def get_max_time(self): return BosparanianTime(5369833, 0)
def get_min_time(self): return BosparanianTime.min()
def get_min_time(self): return BosparanianTime.min()
def to_time(self): days = ymd_to_bosparanian_day(self.year, self.month, self.day) seconds = self.hour * 60 * 60 + self.minute * 60 + self.second return BosparanianTime(days, seconds)