Beispiel #1
0
 def start(self, time):
     if self.appearance.get_week_start() == "tkyriaka":
         days_to_subtract = PharaonicTimeType().get_day_of_week(time)
     else:
         # It is Psabbaton.
         days_to_subtract = (PharaonicTimeType().get_day_of_week(time) + 1) % 7
     return PharaonicTime(time.julian_day - days_to_subtract, 0)
Beispiel #2
0
 def time_to_wx_date(self, time):
     year, month, day = PharaonicDateTime.from_time(time).to_date_tuple()
     try:
         return wx.DateTime.FromDMY(day, month - 1, year, 0, 0, 0)
     except OverflowError:
         if year < 0:
             year, month, day = PharaonicDateTime.from_time(
                 PharaonicTime(0, 0)).to_date_tuple()
             return wx.DateTime.FromDMY(day, month - 1, year, 0, 0, 0)
Beispiel #3
0
 def choose_strip(self, metrics, appearance):
     """
     Return a tuple (major_strip, minor_strip) for current time period and
     window size.
     """
     day_period = TimePeriod(PharaonicTime(0, 0),PharaonicTime(1, 0))
     one_day_width = metrics.calc_exact_width(day_period)
     if one_day_width > 20000:
         return StripHour(), StripMinute()
     elif one_day_width > 600:
         return StripDay(), StripHour()
     elif one_day_width > 45:
         return StripWeek(appearance), StripWeekday()
     elif one_day_width > 25:
         return StripMonth(), StripDay()
     elif one_day_width > 1.5:
         return StripYear(), StripMonth()
     elif one_day_width > 0.12:
         return StripDecade(), StripYear()
     elif one_day_width > 0.012:
         return StripCentury(), StripDecade()
     else:
         return StripCentury(), StripCentury()
Beispiel #4
0
 def to_time(self):
     days = pharaonic_ymd_to_julian_day(self.year, self.month, self.day)
     seconds = self.hour * 60 * 60 + self.minute * 60 + self.second
     return PharaonicTime(days, seconds)
Beispiel #5
0
 def start(self, time):
     (hours, minutes, _) = time.get_time_of_day()
     return PharaonicTime(time.julian_day, minutes * 60 + hours * 60 * 60)
Beispiel #6
0
 def get_max_time(self):
     return PharaonicTime(5369833, 0)
Beispiel #7
0
 def get_min_time(self):
     return PharaonicTime.min()