Example #1
0
 def increment_day(self, date):
     year, month, day = date
     time = CopticDateTime.from_ymd(year, month, day).to_time()
     if time < CopticTimeType().get_max_time() - CopticDelta.from_days(1):
         return CopticDateTime.from_time(
             time + CopticDelta.from_days(1)).to_date_tuple()
     return date
Example #2
0
 def increment_year(self, date):
     max_year = CopticDateTime.from_time(
         CopticTimeType().get_max_time()).year
     year, month, day = date
     if year < max_year - 1:
         return self._set_valid_day(year + 1, month, day)
     return date
Example #3
0
 def decrement_month(self, date):
     year, month, day = date
     if month > 1:
         return self._set_valid_day(year, month - 1, day)
     elif year > CopticDateTime.from_time(
             CopticTimeType().get_min_time()).year:
         return self._set_valid_day(year - 1, 13, day)
     return date
Example #4
0
 def __init__(self, parent, show_time=True, config=None, on_change=None):
     wx.Panel.__init__(self, parent)
     self.config = config
     self._create_gui()
     self.controller = CopticDateTimePickerController(
         self, self.date_picker, self.time_picker,
         CopticTimeType().now, on_change)
     self.show_time(show_time)
     self.parent = parent
Example #5
0
 def __init__(self, parent, config, name=None):
     Panel.__init__(
         self, CopticPeriodPickerController, parent, {
             "time_type": CopticTimeType(),
             "config": config,
             "to_label": _("to"),
             "period_checkbox_text": _("Period"),
             "show_time_checkbox_text": _("Show time"),
         })
Example #6
0
 def _parse_timetype(self, text, tmp_dict):
     self.db.set_time_type(None)
     valid_time_types = (GregorianTimeType(), BosparanianTimeType(),
                         NumTimeType(), CopticTimeType(),
                         PharaonicTimeType())
     for timetype in valid_time_types:
         if text == timetype.get_name():
             self.db.set_time_type(timetype)
             break
     if self.db.get_time_type() is None:
         raise ParseException("Invalid timetype '%s' found." % text)
Example #7
0
def a_coptic_era_with(start=None,
                      end=None,
                      time=ANY_TIME,
                      name="foo",
                      color=(128, 128, 128),
                      time_type=CopticTimeType(),
                      ends_today=False):
    """Create an :doc:`Era <timelinelib_canvas_data_era>` object."""
    if start and end:
        start = human_time_to_coptic(start)
        end = human_time_to_coptic(end)
    else:
        start = human_time_to_coptic(time)
        end = human_time_to_coptic(time)
    era = Era().update(start, end, name, color)
    era.set_ends_today(ends_today)
    return era
Example #8
0
 def _format_sample_date(self, date_formatter):
     return date_formatter.format(
         CopticDateTime.from_time(
             CopticTimeType().now()).to_date_tuple())[0]
Example #9
0
 def _set_cal_range(self, cal):
     min_date = CopticTimeType().get_min_time()
     max_date = CopticTimeType().get_max_time()
     min_date = self.time_to_wx_date(min_date)
     max_date = self.time_to_wx_date(max_date) - wx.DateSpan.Day()
     cal.SetDateRange(min_date, max_date)
Example #10
0
 def _create_new_coptic_timeline(self):
     self._create_new_timeline(CopticTimeType())
Example #11
0
 def tkyriaka_week_1(year):
     from timelinelib.calendar.coptic.timetype import CopticTimeType
     thoth_4 = CopticDateTime.from_ymd(year, 1, 4).to_time()
     thoth_4_day_of_week = CopticTimeType().get_day_of_week(thoth_4)
     return thoth_4 - CopticDelta.from_days(thoth_4_day_of_week)