Пример #1
0
 def _parse_era(self, text, tmp_dict):
     name = tmp_dict.pop("tmp_name")
     start = self._parse_time(tmp_dict.pop("tmp_start"))
     end = self._parse_time(tmp_dict.pop("tmp_end"))
     color = parse_color(tmp_dict.pop("tmp_color"))
     ends_today = self._parse_optional_bool(tmp_dict, "tmp_ends_today")
     era = Era().update(start, end, name, color)
     era.set_ends_today(ends_today)
     self.db.save_era(era)
Пример #2
0
 def _parse_era(self, text, tmp_dict):
     name = tmp_dict.pop("tmp_name")
     start = self._parse_time(tmp_dict.pop("tmp_start"))
     end = self._parse_time(tmp_dict.pop("tmp_end"))
     color = parse_color(tmp_dict.pop("tmp_color"))
     ends_today = self._parse_optional_bool(tmp_dict, "tmp_ends_today")
     era = Era().update(start, end, name, color)
     era.set_ends_today(ends_today)
     self.db.save_era(era)
Пример #3
0
def a_gregorian_era_with(start=None, end=None, time=ANY_TIME, name="foo",
                         color=(128, 128, 128), time_type=GregorianTimeType(),
                         ends_today=False):
    """Create an :doc:`Era <timelinelib_canvas_data_era>` object."""
    if start and end:
        start = human_time_to_gregorian(start)
        end = human_time_to_gregorian(end)
    else:
        start = human_time_to_gregorian(time)
        end = human_time_to_gregorian(time)
    era = Era().update(start, end, name, color)
    era.set_ends_today(ends_today)
    return era
Пример #4
0
def a_gregorian_era_with(start=None, end=None, time=ANY_TIME, name="foo",
                         color=(128, 128, 128), time_type=GregorianTimeType(),
                         ends_today=False):
    """Create an :doc:`Era <timelinelib_canvas_data_era>` object."""
    if start and end:
        start = human_time_to_gregorian(start)
        end = human_time_to_gregorian(end)
    else:
        start = human_time_to_gregorian(time)
        end = human_time_to_gregorian(time)
    era = Era().update(start, end, name, color)
    era.set_ends_today(ends_today)
    return era