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)
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
def _create_era_wrapper(self, id_): immutable_era = self._immutable_db.eras.get(id_) return Era( db=self._db, id_=id_, immutable_value=immutable_era, )
def a_numeric_era_with(start=None, end=None, time=ANY_NUM_TIME, name="foo", color=(128, 128, 128)): """Create an :doc:`Era <timelinelib_canvas_data_era>` object.""" if not (start or end): start = time end = time return Era().update(start, end, name, color)